*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #F7F6F2; --surface: #FFFFFF; --surface2: #F2F1ED;
  --border: rgba(0,0,0,0.08); --border-mid: rgba(0,0,0,0.14);
  --text: #1A1A18; --text2: #6B6B66; --text3: #A0A09A;
  --accent: #1A1A18; --accent-fg: #FFFFFF;
  --purple-bg:#EEEDFE; --purple-text:#3C3489;
  --green-bg:#E1F5EE; --green-text:#0F6E56;
  --amber-bg:#FAEEDA; --amber-text:#854F0B;
  --blue-bg:#E6F1FB; --blue-text:#185FA5;
  --red-bg:#FCEBEB; --red-text:#A32D2D;
  --radius-sm:6px; --radius-md:8px; --radius-lg:12px; --radius-xl:16px;
  --sidebar-w:228px; --topbar-h:54px;
  --shadow:0 1px 3px rgba(0,0,0,0.06),0 1px 2px rgba(0,0,0,0.04);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg:#111110; --surface:#1C1C1A; --surface2:#242422;
    --border:rgba(255,255,255,0.08); --border-mid:rgba(255,255,255,0.14);
    --text:#EEEEE8; --text2:#9A9A94; --text3:#606060;
    --accent:#EEEEE8; --accent-fg:#111110;
    --purple-bg:#26215C; --purple-text:#CECBF6;
    --green-bg:#04342C; --green-text:#9FE1CB;
    --amber-bg:#412402; --amber-text:#FAC775;
    --blue-bg:#042C53; --blue-text:#B5D4F4;
    --red-bg:#501313; --red-text:#F7C1C1;
  }
}
html, body { height:100%; font-family:'DM Sans',system-ui,sans-serif; background:var(--bg); color:var(--text); font-size:14px; line-height:1.5; -webkit-font-smoothing:antialiased; }

.app { display:flex; height:100vh; overflow:hidden; }

/* SIDEBAR */
.sidebar { width:var(--sidebar-w); background:var(--surface); border-right:1px solid var(--border); display:flex; flex-direction:column; flex-shrink:0; overflow-y:auto; transition:transform 0.25s ease; z-index:200; }
.sidebar-header { display:flex; align-items:center; justify-content:space-between; padding:18px 16px 14px; border-bottom:1px solid var(--border); }
.logo { display:flex; align-items:center; gap:8px; }
.logo-mark { font-size:18px; }
.logo-text { font-size:15px; font-weight:600; letter-spacing:-0.02em; }
.sidebar-close { display:none; background:none; border:none; cursor:pointer; color:var(--text2); font-size:18px; padding:2px; }
.nav-section-label { padding:14px 16px 4px; font-size:10px; font-weight:600; color:var(--text3); text-transform:uppercase; letter-spacing:0.08em; }
.nav { padding:2px 8px; }
.nav-item { display:flex; align-items:center; gap:9px; padding:8px 10px; margin:1px 0; border-radius:var(--radius-md); cursor:pointer; font-size:13.5px; color:var(--text2); transition:background 0.12s,color 0.12s; text-decoration:none; }
.nav-item i { font-size:17px; flex-shrink:0; }
.nav-item:hover { background:var(--surface2); color:var(--text); }
.nav-item.active { background:var(--surface2); color:var(--text); font-weight:500; }
.nav-badge { margin-left:auto; font-size:10px; padding:1px 6px; border-radius:10px; background:var(--blue-bg); color:var(--blue-text); font-weight:600; }
.sidebar-footer { margin-top:auto; padding:12px 12px 16px; border-top:1px solid var(--border); }
.btn-add-client { width:100%; padding:8px 12px; border-radius:var(--radius-md); border:1px dashed var(--border-mid); background:transparent; color:var(--text2); font-size:13px; cursor:pointer; display:flex; align-items:center; justify-content:center; gap:6px; font-family:inherit; transition:background 0.12s,color 0.12s; }
.btn-add-client:hover { background:var(--surface2); color:var(--text); }

/* MAIN */
.main { flex:1; display:flex; flex-direction:column; min-width:0; overflow:hidden; }
.topbar { height:var(--topbar-h); background:var(--surface); border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; padding:0 20px; flex-shrink:0; gap:12px; }
.topbar-left { display:flex; align-items:center; gap:12px; }
.topbar-right { display:flex; align-items:center; gap:8px; }
.page-title { font-size:15px; font-weight:500; white-space:nowrap; }
.menu-btn { display:none; background:none; border:none; cursor:pointer; color:var(--text); font-size:20px; padding:4px; }
.content { flex:1; overflow-y:auto; padding:20px; }

/* PANELS */
.panel { display:none; }
.panel.active { display:block; }

/* BUTTONS */
.btn { display:inline-flex; align-items:center; gap:6px; padding:7px 14px; border-radius:var(--radius-md); font-size:13px; font-family:inherit; cursor:pointer; border:1px solid var(--border-mid); background:transparent; color:var(--text); font-weight:500; transition:background 0.12s,opacity 0.12s; white-space:nowrap; }
.btn:hover { background:var(--surface2); }
.btn-ghost { border-color:transparent; }
.btn-ghost:hover { background:var(--surface2); border-color:var(--border); }
.btn-primary { background:var(--accent); color:var(--accent-fg); border-color:transparent; }
.btn-primary:hover { opacity:0.82; }
.btn-sm { padding:4px 10px; font-size:12px; }
.btn-icon { padding:6px 8px; }
.btn-full { width:100%; justify-content:center; padding:10px; }
.delete-btn { color:var(--text3); }
.delete-btn:hover { background:var(--red-bg); color:var(--red-text); border-color:transparent; }

/* CARDS */
.card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); padding:16px 18px; box-shadow:var(--shadow); }
.card-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; }
.card-title { font-size:13px; font-weight:600; }

/* METRICS */
.metrics-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-bottom:18px; }
.metric-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); padding:16px 18px; box-shadow:var(--shadow); }
.metric-label { font-size:11px; font-weight:600; color:var(--text3); text-transform:uppercase; letter-spacing:0.06em; margin-bottom:6px; }
.metric-value { font-size:28px; font-weight:500; letter-spacing:-0.02em; line-height:1; margin-bottom:5px; }
.metric-sub { font-size:12px; color:var(--text2); }
.dash-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; }

/* CLIENT ROW */
.client-row { display:flex; align-items:center; gap:8px; padding:11px 0; border-bottom:1px solid var(--border); flex-wrap:nowrap; overflow:visible; }
.client-row:last-child { border-bottom:none; }
.client-row .platform-pills { flex-shrink:1; overflow:hidden; }
.client-actions { display:flex; gap:6px; flex-shrink:0; margin-left:auto; padding-left:12px; }

.avatar { width:36px; height:36px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:600; flex-shrink:0; }
.client-name { font-size:13.5px; font-weight:500; }
.client-meta { font-size:12px; color:var(--text2); margin-top:1px; }
.platform-pills { display:flex; gap:4px; flex-wrap:wrap; }
.ppill { width:22px; height:22px; border-radius:5px; display:flex; align-items:center; justify-content:center; font-size:9px; font-weight:700; }

/* BRAND SWATCHES in client row */
.brand-swatches { display:flex; gap:3px; align-items:center; }
.brand-swatch-dot { width:12px; height:12px; border-radius:50%; border:1px solid var(--border-mid); flex-shrink:0; }

/* POST ITEM */
.post-item { display:flex; gap:12px; padding:11px 0; border-bottom:1px solid var(--border); align-items:flex-start; }
.post-item:last-child { border-bottom:none; }
.post-platform { width:30px; height:30px; border-radius:7px; display:flex; align-items:center; justify-content:center; font-size:10px; font-weight:700; flex-shrink:0; margin-top:2px; }
.post-body { flex:1; min-width:0; }
.post-text { font-size:13px; line-height:1.45; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.post-meta { font-size:11.5px; color:var(--text2); margin-top:3px; display:flex; align-items:center; gap:6px; flex-wrap:wrap; }

/* BADGE */
.badge { display:inline-flex; align-items:center; font-size:10.5px; padding:2px 7px; border-radius:20px; font-weight:600; }
.badge-blue { background:var(--blue-bg); color:var(--blue-text); }
.badge-amber { background:var(--amber-bg); color:var(--amber-text); }
.badge-green { background:var(--green-bg); color:var(--green-text); }
.badge-gray { background:var(--surface2); color:var(--text2); }

/* TABS */
.tabs { display:flex; border-bottom:1px solid var(--border); margin-bottom:18px; }
.tab { padding:9px 18px; font-size:13.5px; cursor:pointer; color:var(--text2); border:none; background:none; border-bottom:2px solid transparent; margin-bottom:-1px; font-family:inherit; font-weight:500; transition:color 0.12s; }
.tab:hover { color:var(--text); }
.tab.active { color:var(--text); border-bottom-color:var(--text); }

/* FORMS */
.form-card { max-width:520px; }
.form-title { font-size:16px; font-weight:600; margin-bottom:18px; }
.form-row { display:flex; flex-direction:column; gap:5px; margin-bottom:14px; }
.form-row label { font-size:12px; font-weight:600; color:var(--text2); }
.form-row input, .form-row select, .select-input { padding:8px 11px; border-radius:var(--radius-md); border:1px solid var(--border-mid); background:var(--surface); color:var(--text); font-size:13.5px; font-family:inherit; outline:none; transition:border-color 0.12s; }
.form-row input:focus, .form-row select:focus, .select-input:focus { border-color:var(--text); }
.checkbox-label { display:flex; align-items:center; gap:8px; font-size:13px; cursor:pointer; }
.checkbox-label input { width:16px; height:16px; cursor:pointer; }

/* BRAND SECTION */
.brand-section { margin-top:18px; padding-top:16px; border-top:1px solid var(--border); }
.brand-section-title { font-size:13px; font-weight:600; margin-bottom:14px; display:flex; align-items:center; gap:7px; color:var(--text); }
.brand-optional { font-size:11px; font-weight:400; color:var(--text3); }
.brand-colors-row { display:flex; gap:12px; flex-wrap:wrap; }
.color-input-wrap { display:flex; align-items:center; gap:8px; }
.color-swatch { width:36px; height:36px; border-radius:var(--radius-md); border:1px solid var(--border-mid); cursor:pointer; padding:2px; background:none; }
.color-hex { flex:1; min-width:80px; font-family:'DM Mono',monospace; font-size:12px; }
.logo-upload-area { border:1px dashed var(--border-mid); border-radius:var(--radius-md); padding:14px 16px; display:flex; align-items:center; gap:10px; cursor:pointer; font-size:13px; color:var(--text2); transition:background 0.12s; }
.logo-upload-area:hover { background:var(--surface2); }
.logo-upload-area i { font-size:18px; flex-shrink:0; }

/* BRAND BAR in compose/AI */
.brand-bar { display:flex; align-items:center; gap:10px; padding:8px 12px; border-radius:var(--radius-md); background:var(--surface2); border:1px solid var(--border); margin-bottom:14px; flex-wrap:wrap; }
.brand-bar-logo { height:24px; max-width:80px; object-fit:contain; border-radius:3px; }
.brand-bar-colors { display:flex; gap:4px; }
.brand-bar-dot { width:14px; height:14px; border-radius:50%; border:1px solid var(--border-mid); }
.brand-bar-info { font-size:12px; color:var(--text2); }

/* PLATFORM FORMAT GRID */
.platform-format-grid { display:grid; grid-template-columns:repeat(5,1fr); gap:8px; }
.pf-card { border:1px solid var(--border-mid); border-radius:var(--radius-md); padding:10px 8px; cursor:pointer; text-align:center; transition:all 0.12s; }
.pf-card:hover { background:var(--surface2); }
.pf-card.active { border-color:var(--text); background:var(--surface2); }
.pf-icon { width:32px; height:32px; border-radius:7px; display:flex; align-items:center; justify-content:center; font-size:10px; font-weight:700; margin:0 auto 6px; }
.pf-name { font-size:11px; font-weight:600; margin-bottom:2px; }
.pf-spec { font-size:10px; color:var(--text3); }

/* AI PANEL */
.ai-wrap { max-width:620px; display:flex; flex-direction:column; gap:16px; }
.ai-card { padding:20px 22px; }
.ai-header { display:flex; align-items:flex-start; gap:14px; margin-bottom:20px; }
.ai-icon { font-size:24px; color:var(--purple-text); flex-shrink:0; margin-top:2px; }
.ai-title { font-size:16px; font-weight:600; }
.ai-sub { font-size:13px; color:var(--text2); margin-top:2px; }
.ai-output-area { display:flex; flex-direction:column; gap:14px; }
.ai-result-card { background:var(--purple-bg); border-radius:var(--radius-lg); padding:16px 18px; font-size:13.5px; line-height:1.65; color:var(--purple-text); }
.ai-result-actions { display:flex; gap:8px; flex-wrap:wrap; margin-top:14px; }
.ai-platform-result { border:1px solid var(--border); border-radius:var(--radius-lg); padding:16px 18px; background:var(--surface); }
.ai-platform-result-header { display:flex; align-items:center; gap:10px; margin-bottom:12px; }
.ai-platform-badge { width:28px; height:28px; border-radius:6px; display:flex; align-items:center; justify-content:center; font-size:10px; font-weight:700; flex-shrink:0; }
.ai-platform-name { font-size:13px; font-weight:600; }
.ai-platform-spec { font-size:11px; color:var(--text3); margin-left:auto; }
.ai-platform-text { font-size:13px; line-height:1.6; color:var(--text); white-space:pre-wrap; }

/* COMPOSE */
.compose-wrap { max-width:580px; }
.compose-card { padding:20px 22px; }
.compose-top { display:flex; align-items:flex-end; gap:12px; margin-bottom:16px; flex-wrap:wrap; }
.compose-top .form-row { flex:1; margin-bottom:0; min-width:200px; }
.compose-box { border:1px solid var(--border-mid); border-radius:var(--radius-lg); margin-bottom:16px; overflow:hidden; }
.compose-box textarea { width:100%; border:none; outline:none; resize:none; font-family:'DM Sans',sans-serif; font-size:14px; background:transparent; color:var(--text); line-height:1.6; padding:14px 16px; }
.compose-footer { border-top:1px solid var(--border); padding:10px 14px; display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:8px; }
.char-count { font-size:12px; color:var(--text3); }
.schedule-row { display:flex; align-items:center; gap:12px; margin-bottom:16px; flex-wrap:wrap; }
.schedule-row label { font-size:13px; font-weight:500; color:var(--text2); white-space:nowrap; }
.schedule-row .select-input { flex:1; min-width:200px; }
.compose-actions { display:flex; gap:8px; flex-wrap:wrap; }
.ai-chip { display:inline-flex; align-items:center; gap:5px; font-size:12px; font-weight:500; padding:6px 12px; border-radius:20px; background:var(--purple-bg); color:var(--purple-text); border:none; cursor:pointer; font-family:inherit; transition:opacity 0.12s; white-space:nowrap; }
.ai-chip:hover { opacity:0.82; }
.feedback { margin-top:12px; font-size:13px; color:var(--green-text); min-height:20px; }
.posts-filters { display:flex; gap:10px; margin-bottom:16px; flex-wrap:wrap; }

/* CALENDAR */
.cal-controls { display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; flex-wrap:wrap; gap:10px; }
.cal-nav { display:flex; align-items:center; gap:10px; }
.cal-month-label { font-size:15px; font-weight:600; min-width:160px; text-align:center; }
.cal-card { padding:14px; }
.cal-day-headers { display:grid; grid-template-columns:repeat(7,1fr); gap:4px; margin-bottom:6px; }
.cal-day-headers div { text-align:center; font-size:10.5px; font-weight:600; color:var(--text3); text-transform:uppercase; padding:4px 0; }
.cal-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:4px; }
.cal-day { min-height:70px; border:1px solid var(--border); border-radius:var(--radius-md); padding:5px; background:var(--surface2); overflow:hidden; }
.cal-day.today { border-color:#378ADD; background:var(--blue-bg); }
.cal-day.empty { background:transparent; border-color:transparent; }
.cal-num { font-size:11px; font-weight:600; color:var(--text3); margin-bottom:3px; }
.cal-num.today { color:var(--blue-text); }
.cal-post { font-size:9px; padding:2px 4px; border-radius:3px; margin-bottom:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-weight:500; }
.cal-more { font-size:9px; color:var(--text3); }

/* LOADING */
.loading-dots { display:flex; align-items:center; gap:6px; padding:14px 0; font-size:13px; color:var(--text2); }
.dot { width:6px; height:6px; border-radius:50%; background:var(--purple-text); animation:bounce 1.2s infinite; }
.dot:nth-child(2) { animation-delay:0.2s; }
.dot:nth-child(3) { animation-delay:0.4s; }
@keyframes bounce { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-6px)} }

/* MOBILE */
.sidebar-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.4); z-index:199; }
.empty-state { text-align:center; padding:40px 20px; color:var(--text2); }
.empty-state i { font-size:32px; color:var(--text3); display:block; margin-bottom:10px; }
.empty-state p { font-size:14px; }

@media (max-width:900px) {
  .metrics-grid { grid-template-columns:repeat(2,1fr); }
  .dash-grid { grid-template-columns:1fr; }
  .platform-format-grid { grid-template-columns:repeat(3,1fr); }
}
@media (max-width:700px) {
  .sidebar { position:fixed; top:0; left:0; bottom:0; transform:translateX(-100%); }
  .sidebar.open { transform:translateX(0); }
  .sidebar-close { display:flex; }
  .sidebar-overlay.show { display:block; }
  .menu-btn { display:flex; }
  .metrics-grid { grid-template-columns:repeat(2,1fr); gap:10px; }
  .topbar { padding:0 14px; }
  .content { padding:14px; }
  .platform-format-grid { grid-template-columns:repeat(3,1fr); }
}
@media (max-width:480px) {
  .metrics-grid { grid-template-columns:1fr 1fr; }
  .metric-value { font-size:22px; }
  .topbar-right .btn-ghost { display:none; }
  .platform-format-grid { grid-template-columns:repeat(2,1fr); }
}
