@import "tailwindcss";

@font-face {
  font-family: "BinggraeII";
  src: url("/fonts/BinggraeII.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
}

@font-face {
  font-family: "BinggraeII";
  src: url("/fonts/BinggraeII-Bold.woff2") format("woff2");
  font-style: normal;
  font-weight: 700 900;
  font-display: swap;
}

:root {
  --ink: #1f1924;
  --muted: #837c88;
  --faint: #bdb7c1;
  --line: #e9e5ec;
  --panel: #ffffff;
  --canvas: #fbfafc;
  --purple: #7657e8;
  --purple-dark: #5f3ed5;
  --purple-soft: #f1edff;
  --purple-wash: #faf8ff;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: "BinggraeII", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  font-weight: 400;
}
button, input, textarea, select { color: inherit; font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 256px minmax(0, 1fr); background: #fff; }
.sidebar {
  position: relative;
  z-index: 30;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: #fdfbff;
  padding: 14px 8px 10px;
  display: flex;
  flex-direction: column;
}
.wordmark { height: 48px; padding: 0 8px; display: flex; align-items: center; font-size: 27px; line-height: 1; font-weight: 900; letter-spacing: -.06em; color: var(--purple-dark); }
.workspace-switch {
  position: relative;
  width: 100%;
  height: 50px;
  margin: 11px 0 4px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  text-align: left;
}
.workspace-avatar { width: 34px; height: 34px; border-radius: 7px; background: var(--purple); color: #fff; display: grid; place-items: center; font-weight: 900; }
.workspace-copy { display: flex; min-width: 0; flex-direction: column; }
.workspace-copy strong { overflow: hidden; font-size: 13px; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; }
.workspace-copy small { margin-top: 3px; color: var(--muted); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-switch > span:last-child { color: #9f98a4; font-size: 10px; }
.sidebar-brand-menu { position: absolute; z-index: 50; top: 124px; left: 8px; width: calc(100% - 16px); padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: 0 12px 32px rgba(43, 31, 56, .14); }
.sidebar-brand-menu button { width: 100%; min-height: 34px; padding: 7px 9px; border: 0; border-radius: 6px; background: transparent; text-align: left; font-size: 12px; }
.sidebar-brand-menu button:hover { background: var(--purple-soft); }
.sidebar nav { display: grid; gap: 4px; }
.nav-item { width: 100%; height: 32px; padding: 8px; border: 0; border-radius: 8px; background: transparent; display: flex; align-items: center; gap: 8px; color: #5d5661; text-align: left; font-size: 14px; font-weight: 500; }
.nav-item span { width: 16px; display: inline-grid; place-items: center; color: #7f7784; }
.nav-item b { font-weight: 500; }
.nav-item:hover, .nav-item.active { color: var(--purple-dark); background: var(--purple-soft); }
.nav-item.active span { color: var(--purple-dark); }
.nav-divider { height: 1px; margin: 22px -8px 14px; background: var(--line); }
.support-nav { margin-top: 2px; }
.sidebar-footer { margin: auto -8px 0; padding: 12px 8px 0; border-top: 1px solid var(--line); }
.sidebar-footer button { width: 100%; min-height: 38px; padding: 4px 8px; border: 0; background: transparent; display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 8px; text-align: left; }
.sidebar-footer button > span { width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; background: var(--purple-soft); color: var(--purple-dark); font-size: 10px; font-weight: 900; }
.sidebar-footer b { overflow: hidden; font-size: 12px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-footer small { color: var(--muted); }

.planner-layout { min-width: 0; height: 100vh; display: grid; grid-template-columns: minmax(480px, 51%) minmax(370px, 1fr); overflow: hidden; }
.calendar-pane { min-width: 0; height: 100vh; border-right: 1px solid var(--line); background: #fff; display: grid; grid-template-rows: 64px 42px minmax(0, 1fr); }
.calendar-header { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; padding: 0 20px; }
.calendar-header button { width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent; display: grid; place-items: center; font-size: 25px; line-height: 1; }
.calendar-header button:hover { background: var(--purple-soft); color: var(--purple-dark); }
.calendar-header strong { text-align: center; font-size: 14px; font-weight: 700; }
.weekdays { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--line); }
.weekdays span { display: grid; place-items: center; color: #827a86; font-size: 12px; }
.calendar-grid { min-height: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: repeat(6, minmax(76px, 1fr)); }
.day { min-width: 0; min-height: 0; padding: 6px 4px; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fff; display: flex; flex-direction: column; align-items: center; gap: 7px; }
.day:nth-child(7n) { border-right: 0; }
.day:nth-last-child(-n+7) { border-bottom: 0; }
.day:hover { background: var(--purple-wash); }
.day-number { width: 32px; height: 26px; border-radius: 7px; display: grid; place-items: center; color: #554e59; font-size: 12px; }
.day.outside .day-number { color: #d4cfd7; }
.day.selected { position: relative; z-index: 2; border: 2px solid var(--purple-dark); border-radius: 10px; padding: 4px 2px; background: #fff; }
.day.selected .day-number { margin-top: -5px; width: 100%; height: 27px; border-radius: 8px 8px 0 0; background: var(--purple-dark); color: #fff; }
.day-platforms { min-height: 20px; display: flex; justify-content: center; gap: 2px; }
.platform-badge { flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-family: Arial, sans-serif; font-size: 10px; font-weight: 900; }
.platform-badge.instagram { background: linear-gradient(135deg, #8b42df, #e94181, #f6a44a); }
.platform-badge.threads { background: #242027; }
.platform-badge.muted { opacity: .35; filter: grayscale(1); }

.schedule-pane { position: relative; min-width: 0; height: 100vh; overflow-y: auto; background: #fff; }
.schedule-header { position: sticky; z-index: 10; top: 0; height: 64px; padding: 0 20px 0 16px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.95); backdrop-filter: blur(12px); display: flex; align-items: center; gap: 12px; }
.schedule-header strong { margin-right: auto; font-size: 14px; font-weight: 500; }
.schedule-header button { height: 34px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; font-size: 14px; font-weight: 500; }
.schedule-header button:hover { color: var(--purple-dark); background: var(--purple-soft); }
.post-preview { padding: 0 16px 100px; }
.post-meta-row { min-height: 46px; display: flex; align-items: center; gap: 6px; font-size: 11px; }
.post-meta-row > b { font-weight: 500; }
.post-meta-row > button { margin-left: auto; border: 0; background: transparent; color: #9a909d; font-size: 11px; }
.post-meta-row > button:disabled { opacity: .35; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--purple); }
.status-dot.published { background: #2ba77b; }
.status-dot.failed { background: #d84b61; }
.status-dot.cancelled { background: #aaa4ac; }
.status-pill { padding: 4px 7px; border-radius: 8px; background: var(--purple-soft); color: var(--purple-dark); }
.status-pill.published { background: #e8f8f1; color: #177557; }
.status-pill.failed { background: #fff0f2; color: #b62f46; }
.social-preview-card { overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.social-profile { height: 56px; padding: 8px 10px; display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 9px; }
.profile-ring { width: 36px; height: 36px; border: 2px solid var(--purple); border-radius: 50%; background: var(--purple-soft); color: var(--purple-dark); display: grid; place-items: center; font-size: 12px; font-weight: 900; }
.social-profile div { min-width: 0; display: flex; flex-direction: column; }
.social-profile strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.social-profile small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.media-preview { aspect-ratio: 1 / 1; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: linear-gradient(135deg,#eee9ff,#d5c9ff); background-position: center; background-size: cover; display: grid; place-items: center; }
.media-preview span { padding: 7px 10px; border-radius: 6px; background: rgba(255,255,255,.86); color: var(--muted); font-size: 10px; }
.text-preview { min-height: 260px; padding: 34px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: radial-gradient(circle at 70% 20%,#eae3ff,transparent 36%), linear-gradient(145deg,#faf8ff,#f1edff); display: flex; flex-direction: column; justify-content: center; }
.text-preview > span { color: var(--purple); font-family: Arial,sans-serif; font-size: 46px; font-weight: 900; }
.text-preview p { margin: 16px 0 0; font-size: 18px; line-height: 1.55; white-space: pre-wrap; }
.preview-actions { height: 48px; padding: 0 12px; display: flex; align-items: center; font-family: Arial, sans-serif; font-size: 23px; }
.preview-actions span { margin-left: auto; }
.preview-caption { margin: 0; padding: 0 12px 16px; font-size: 12px; line-height: 1.65; white-space: pre-wrap; }
.preview-caption b { margin-right: 5px; }
.target-list { margin-top: 10px; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.target-list > div { min-height: 42px; padding: 7px 10px; display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 7px; border-bottom: 1px solid var(--line); font-size: 11px; }
.target-list > div:last-child { border-bottom: 0; }
.target-list b { font-weight: 500; color: var(--muted); }
.error-box { margin-top: 10px; padding: 10px 12px; border-radius: 8px; background: #fff0f2; color: #a62f43; font-size: 11px; line-height: 1.5; }
.wide-primary { width: 100%; height: 42px; margin-top: 12px; border: 0; border-radius: 8px; background: var(--purple); color: #fff; font-size: 13px; font-weight: 700; }
.empty-schedule { min-height: calc(100vh - 64px); padding: 40px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.empty-schedule > span { width: 54px; height: 54px; border-radius: 50%; background: var(--purple-soft); color: var(--purple-dark); display: grid; place-items: center; font-size: 27px; }
.empty-schedule strong { margin-top: 18px; font-size: 15px; }
.empty-schedule p { max-width: 260px; margin: 8px 0 18px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.empty-schedule button { height: 36px; padding: 0 14px; border: 1px solid var(--purple); border-radius: 8px; background: #fff; color: var(--purple-dark); font-size: 12px; }
.floating-create { position: fixed; z-index: 12; right: 24px; bottom: 24px; width: 56px; height: 56px; border: 0; border-radius: 50%; background: var(--purple-dark); color: #fff; box-shadow: 0 10px 24px rgba(95,62,213,.3); display: grid; place-items: center; font-size: 28px; }

.brand-page { min-width: 0; height: 100vh; overflow-y: auto; padding: 24px; background: #fff; }
.brand-panel { max-width: 1120px; min-height: calc(100vh - 48px); margin: 0 auto; padding: 24px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 2px 6px rgba(38,29,45,.03); }
.brand-toolbar { display: flex; align-items: center; gap: 8px; }
.brand-select { min-width: 0; height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; display: flex; flex: 1; align-items: center; justify-content: space-between; font-size: 14px; }
.brand-select b { font-weight: 700; }
.ghost-button, .dark-button, .square-button { height: 36px; padding: 0 12px; border-radius: 8px; font-size: 14px; font-weight: 500; }
.ghost-button, .square-button { border: 1px solid var(--line); background: #fff; }
.square-button { width: 36px; padding: 0; }
.dark-button { border: 0; background: var(--purple-dark); color: #fff; }
.brand-fields { margin-top: 8px; display: grid; grid-template-columns: 1fr; gap: 6px; }
.brand-fields label { display: grid; grid-template-columns: 120px 1fr; align-items: center; min-height: 32px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.brand-fields label > span { padding-left: 12px; color: var(--muted); font-size: 11px; }
.brand-fields input, .brand-fields textarea { width: 100%; border: 0; outline: 0; background: #fff; font-size: 12px; }
.brand-fields input { height: 30px; }
.brand-fields textarea { min-height: 58px; padding: 8px 0; resize: none; }
.brand-field-split { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.brand-field-split label:first-child { border-radius: 8px 0 0 8px; }
.brand-field-split label:last-child { margin-left: -1px; border-radius: 0 8px 8px 0; }
.brand-tags { height: 26px; padding-left: 120px; display: flex; align-items: center; gap: 6px; }
.brand-tags span { height: 24px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; display: inline-flex; align-items: center; background: #fff; font-size: 10px; }
.section-title { margin: 18px 0 12px; display: flex; align-items: baseline; gap: 10px; }
.section-title strong { font-size: 15px; }
.section-title span { color: var(--muted); font-size: 10px; }
.account-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.account-card { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 2px 5px rgba(37,28,43,.05); }
.account-card-top { height: 56px; padding: 14px; display: flex; justify-content: flex-end; background: var(--purple-soft); }
.account-card-top.instagram { background: linear-gradient(120deg,#f8efff,#ffeef3); }
.account-card-top.threads { background: linear-gradient(120deg,#f1eff4,#e9e3f8); }
.account-info { padding: 16px 18px 8px; display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 10px; }
.account-info h3 { margin: 0; font-size: 16px; }
.account-info p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.connected-badge { padding: 4px 7px; border-radius: 8px; background: #e9f8f1; color: #26765d; font-size: 9px; }
.account-note { min-height: 58px; margin: 0 18px; padding: 10px 12px; border-radius: 8px; background: #faf8fb; color: #6f6873; font-size: 11px; line-height: 1.6; }
.account-actions { padding: 12px 18px 16px; display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.account-actions a, .account-actions button, .connect-button { height: 36px; border: 1px solid var(--line); border-radius: 8px; background: #fff; display: grid; place-items: center; color: inherit; text-decoration: none; font-size: 12px; }
.account-actions button { padding: 0 12px; color: #b44254; }
.connect-button { margin: 12px 18px 16px; border-color: var(--purple); color: var(--purple-dark); font-weight: 700; }

.modal-backdrop { position: fixed; z-index: 100; inset: 0; padding: 20px; background: rgba(28,22,32,.45); backdrop-filter: blur(4px); display: grid; place-items: center; overflow-y: auto; }
.modal { width: min(540px, 100%); max-height: calc(100vh - 40px); padding: 22px; border: 0; border-radius: 14px; background: #fff; box-shadow: 0 24px 80px rgba(28,20,34,.24); overflow-y: auto; }
.modal header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; }
.modal header small { color: var(--purple); font-size: 10px; font-weight: 700; }
.modal h2 { margin: 4px 0 0; font-size: 21px; }
.modal header > button { width: 32px; height: 32px; border: 0; border-radius: 8px; background: #f7f4f8; font-size: 22px; }
.modal > label, .form-row label { display: flex; flex-direction: column; gap: 6px; margin-bottom: 13px; }
.modal label > span, .modal legend { color: #5f5863; font-size: 11px; font-weight: 700; }
.modal input, .modal textarea, .modal select { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; outline: 0; font-size: 12px; }
.modal input, .modal select { height: 40px; padding: 0 10px; }
.modal textarea { padding: 10px; line-height: 1.6; resize: vertical; }
.modal input:focus, .modal textarea:focus, .modal select:focus { border-color: var(--purple); box-shadow: 0 0 0 3px var(--purple-soft); }
.modal fieldset { margin: 0 0 13px; padding: 0; border: 0; }
.modal legend { margin-bottom: 6px; }
.platform-choice { min-height: 46px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; display: grid; grid-template-columns: 16px 24px 1fr; align-items: center; gap: 8px; }
.platform-choice + .platform-choice { margin-top: 6px; }
.platform-choice input { width: 14px; height: 14px; }
.platform-choice > span:last-child { display: flex; flex-direction: column; }
.platform-choice b { font-size: 12px; }
.platform-choice small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.form-row { display: grid; grid-template-columns: 1fr 110px; gap: 8px; }
.form-help { margin: -2px 0 16px; padding: 9px 10px; border-radius: 7px; background: var(--purple-wash); color: #746b7a; font-size: 10px; line-height: 1.55; }
.modal footer { padding-top: 14px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.modal footer button { min-width: 76px; height: 36px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 12px; }
.modal footer .dark-button { border: 0; background: var(--purple-dark); color: #fff; }
.danger-zone { margin: 6px 0 14px; padding: 10px; border: 1px solid #f1d7dc; border-radius: 8px; background: #fff8f9; display: flex; align-items: center; gap: 10px; }
.danger-zone button { height: 30px; padding: 0 10px; border: 1px solid #d75d70; border-radius: 7px; background: #fff; color: #b6384d; font-size: 10px; }
.danger-zone span { color: #8f7a7f; font-size: 9px; }
.toast { position: fixed; z-index: 150; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: min(440px, calc(100vw - 32px)); padding: 11px 16px; border-radius: 9px; background: #241d29; color: #fff; box-shadow: 0 12px 32px rgba(30,22,36,.26); font-size: 12px; text-align: center; }

@media (max-width: 1180px) {
  .app-shell:has(.planner-layout) { grid-template-columns: 117px minmax(0, 1fr); }
  .app-shell:has(.planner-layout) .workspace-switch { grid-template-columns: 30px minmax(0, 1fr); padding: 6px; }
  .app-shell:has(.planner-layout) .workspace-avatar { width: 30px; height: 30px; }
  .app-shell:has(.planner-layout) .workspace-switch > span:last-child { display: none; }
  .app-shell:has(.planner-layout) .workspace-copy strong { font-size: 10px; }
  .app-shell:has(.planner-layout) .workspace-copy small { display: none; }
  .app-shell:has(.planner-layout) .wordmark { font-size: 25px; }
  .app-shell:has(.planner-layout) .sidebar-brand-menu { width: 200px; }
  .planner-layout { grid-template-columns: minmax(475px, 50.8%) minmax(350px, 1fr); }
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 78px minmax(0, 1fr); }
  .wordmark { justify-content: center; padding: 0; overflow: hidden; font-size: 0; }
  .wordmark::after { content: "k"; font-size: 28px; }
  .workspace-switch { display: flex; justify-content: center; border: 0; background: transparent; }
  .workspace-copy, .workspace-switch > span:last-child, .nav-item b, .sidebar-footer b, .sidebar-footer small { display: none; }
  .nav-item { justify-content: center; }
  .nav-item span { font-size: 17px; }
  .sidebar-footer button { display: flex; justify-content: center; }
  .planner-layout { grid-template-columns: minmax(380px, 1fr) minmax(360px, 1fr); overflow-x: auto; }
  .brand-page { padding: 14px; }
  .brand-panel { min-height: calc(100vh - 28px); padding: 16px; }
  .account-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .app-shell, .app-shell:has(.planner-layout) { display: block; }
  .sidebar { position: fixed; z-index: 60; right: 12px; bottom: 12px; left: 12px; top: auto; width: auto; height: 58px; padding: 6px; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 32px rgba(30,22,36,.18); flex-direction: row; align-items: center; }
  .wordmark, .workspace-switch, .nav-divider, .support-nav, .sidebar-footer { display: none; }
  .sidebar nav { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .nav-item { height: 44px; justify-content: center; }
  .nav-item b { display: block; }
  .planner-layout { height: auto; min-height: 100vh; display: block; overflow: visible; padding-bottom: 76px; }
  .calendar-pane { height: 600px; }
  .schedule-pane { height: auto; min-height: 460px; overflow: visible; }
  .schedule-header { position: relative; }
  .floating-create { bottom: 86px; }
  .brand-page { height: auto; min-height: 100vh; padding: 10px 10px 80px; }
  .brand-toolbar { flex-wrap: wrap; }
  .brand-select { width: 100%; min-width: 0; }
  .brand-fields label { grid-template-columns: 90px 1fr; }
  .section-title { align-items: flex-start; flex-direction: column; gap: 3px; }
}
