/* Sunil Social Command Centre — clean light design.
   Chart/series tokens follow the validated dataviz reference palette (light steps):
   slot1 blue = LinkedIn, slot2 orange = YouTube, slot3 aqua = Instagram (all-pairs safe). */
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface-1: #ffffff;
  --surface-2: #f0efec;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11,11,11,0.10);
  --shadow: 0 1px 3px rgba(11,11,11,0.06);
  --linkedin: #2a78d6;
  --youtube: #eb6834;
  --instagram: #1baf7a;
  --good: #006300;
  --warning: #b97e00;
  --critical: #d03b3b;
  --accent: #2a78d6;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--page); color: var(--text-primary);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent); text-decoration: none; }

/* ---- header / tabs ---- */
header {
  display: flex; align-items: center; gap: 20px;
  padding: 12px 22px; border-bottom: 1px solid var(--grid);
  background: var(--surface-1); position: sticky; top: 0; z-index: 20;
  box-shadow: var(--shadow);
}
header .brand { font-weight: 700; font-size: 16px; }
nav { display: flex; gap: 4px; flex: 1; }
nav button {
  background: none; border: none; color: var(--text-secondary); cursor: pointer;
  padding: 8px 14px; border-radius: 8px; font: 600 14px system-ui;
}
nav button:hover { background: var(--surface-2); color: var(--text-primary); }
nav button.active { background: #eaf1fb; color: var(--accent); }
nav button .badge {
  background: var(--critical); color: #fff; border-radius: 9px; font-size: 11px;
  padding: 1px 6px; margin-left: 6px; vertical-align: 1px;
}
main { padding: 20px 22px 60px; max-width: 1280px; margin: 0 auto; }
.tab { display: none; }
.tab.active { display: block; }
h2 { font-size: 17px; margin: 4px 0 14px; }

/* ---- generic cards / chips ---- */
.card {
  background: var(--surface-1); border: 1px solid var(--grid);
  border-radius: 12px; padding: 16px; box-shadow: var(--shadow);
}
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 10px;
  background: var(--surface-2); color: var(--text-secondary);
}
.chip.p-youtube { color: #b34517; }
.chip.p-linkedin { color: #1c5cab; }
.chip.p-instagram { color: #0e7a53; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.p-youtube { background: var(--youtube); }
.dot.p-linkedin { background: var(--linkedin); }
.dot.p-instagram { background: var(--instagram); }
.st { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.st.scheduled { color: var(--warning); }
.st.published { color: var(--good); }
.st.failed, .st.error { color: var(--critical); }
.st.draft, .st.idea { color: var(--muted); }
.st.publishing { color: var(--accent); }

button.btn, a.btn {
  background: var(--surface-1); color: var(--text-primary); border: 1px solid var(--baseline);
  border-radius: 8px; padding: 7px 14px; font: 600 13px system-ui; cursor: pointer;
  display: inline-block;
}
button.btn:hover, a.btn:hover { border-color: var(--muted); background: var(--surface-2); }
button.btn.primary, a.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.btn.danger, a.btn.danger { background: none; color: var(--critical); border-color: var(--critical); }
input, select, textarea {
  background: var(--surface-1); color: var(--text-primary); border: 1px solid var(--baseline);
  border-radius: 8px; padding: 7px 10px; font: 13px system-ui;
}
textarea { width: 100%; resize: vertical; }

/* ---- dashboard (landing) ---- */
.dash-note { color: var(--muted); font-size: 12.5px; margin-top: 10px; }

/* ---- platform page with left menu (LinkedIn tab) ---- */
.platpage { display: flex; gap: 18px; align-items: flex-start; }
.sidemenu { width: 170px; flex: none; display: flex; flex-direction: column; gap: 4px;
  background: var(--surface-1); border: 1px solid var(--grid); border-radius: 12px;
  padding: 8px; box-shadow: var(--shadow); position: sticky; top: 76px; }
.sidemenu button { background: none; border: none; text-align: left; cursor: pointer;
  padding: 9px 12px; border-radius: 8px; font: 600 13.5px system-ui; color: var(--text-secondary); }
.sidemenu button:hover { background: var(--surface-2); color: var(--text-primary); }
.sidemenu button.active { background: #eaf1fb; color: var(--accent); }
.platcontent { flex: 1; min-width: 0; }
.lisec { display: none; }
.lisec.active { display: block; }
.lisec code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
@media (max-width: 720px) { .platpage { flex-direction: column; } .sidemenu { width: 100%; position: static; } }

/* ---- calendar ---- */
#calendarBox { background: var(--surface-1); border: 1px solid var(--grid); border-radius: 12px;
  padding: 12px; box-shadow: var(--shadow); }
.fc { --fc-border-color: var(--grid); --fc-page-bg-color: transparent;
      --fc-neutral-bg-color: var(--surface-2); --fc-today-bg-color: rgba(42,120,214,0.07); }
.fc .fc-toolbar-title { font-size: 16px; color: var(--text-primary); }
.fc .fc-button { background: var(--surface-1); border: 1px solid var(--baseline); color: var(--text-secondary); }
.fc .fc-button-active, .fc .fc-button:hover { background: var(--surface-2) !important; color: var(--text-primary); }
.fc .fc-daygrid-day-number, .fc .fc-col-header-cell-cushion { color: var(--text-secondary); }
.fc-event { border: none; font-size: 12px; cursor: pointer; }

/* drawer */
#drawer {
  position: fixed; top: 0; right: -420px; width: 400px; height: 100%;
  background: var(--surface-1); border-left: 1px solid var(--grid);
  transition: right .2s ease; z-index: 40; padding: 20px; overflow-y: auto;
  box-shadow: -4px 0 16px rgba(11,11,11,0.08);
}
#drawer.open { right: 0; }
#drawer h3 { margin: 4px 0 12px; font-size: 15px; }
#drawer .meta { color: var(--text-secondary); font-size: 13px; margin-bottom: 12px; }
#drawer pre.body {
  white-space: pre-wrap; background: var(--surface-2); padding: 10px; border-radius: 8px;
  font: 13px/1.5 system-ui; color: var(--text-secondary); max-height: 260px; overflow-y: auto;
}
#drawer .err { color: var(--critical); font-size: 13px; white-space: pre-wrap; }
#drawer .actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
#drawerClose { position: absolute; top: 12px; right: 14px; background: none; border: none;
               color: var(--muted); font-size: 18px; cursor: pointer; }

/* ---- inbox ---- */
.filters { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.inbox-item {
  display: flex; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--grid);
  align-items: flex-start;
}
.inbox-item:last-child { border-bottom: none; }
.inbox-item .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center; font-size: 16px; flex: none; }
.inbox-item .avatar img { width: 34px; height: 34px; border-radius: 50%; }
.inbox-item .content { flex: 1; min-width: 0; }
.inbox-item .who { font-weight: 600; font-size: 13px; }
.inbox-item .when { color: var(--muted); font-size: 12px; margin-left: 6px; }
.inbox-item .text { color: var(--text-secondary); margin: 3px 0 6px; }
.inbox-item .replybox { display: none; margin-top: 8px; }
.inbox-item.replying .replybox { display: block; }
.inbox-item .mini { display: flex; gap: 10px; font-size: 12px; }
.inbox-item .mini a { cursor: pointer; }
.inbox-item .replied-note { color: var(--good); font-size: 12px; margin-top: 4px; }
.inbox-item .headline { color: var(--muted); font-size: 12px; margin: 1px 0 3px; }
.inbox-item .catreason { color: var(--muted); font-size: 12px; font-style: italic; margin: 2px 0 4px; }
.inbox-item.is-out { opacity: .72; }

/* AI triage category chips + counts */
.chip.cat-priority { background: #fff4e0; color: #9a6a00; }
.chip.cat-genuine  { background: #e6f4ea; color: #0e7a3a; }
.chip.cat-sales    { background: #eaf1fb; color: #1c5cab; }
.chip.cat-spam     { background: #fdecec; color: #b3312f; }
.catcounts { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.catcount { font-size: 12.5px; font-weight: 600; padding: 5px 11px; border-radius: 20px; cursor: pointer;
  background: var(--surface-2); color: var(--text-secondary); border: 1px solid var(--grid); }
.catcount:hover { border-color: var(--muted); }
.catcount.cat-priority { background: #fff4e0; color: #9a6a00; }
.catcount.cat-genuine  { background: #e6f4ea; color: #0e7a3a; }
.catcount.cat-sales    { background: #eaf1fb; color: #1c5cab; }
.catcount.cat-spam     { background: #fdecec; color: #b3312f; }
.catcount b { font-variant-numeric: tabular-nums; }
.notice { background: #fdf6e7; border-left: 3px solid var(--warning);
  padding: 10px 14px; border-radius: 8px; color: var(--text-secondary); font-size: 13px; margin-bottom: 14px; }

/* ---- analytics ---- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--surface-1); border: 1px solid var(--grid); border-radius: 12px;
  padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .plat { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 13px; margin-bottom: 8px; }
.kpi .big { font-size: 26px; font-weight: 700; }
.kpi .sub { color: var(--text-secondary); font-size: 12px; margin-top: 2px; }
.kpi .delta { font-size: 12px; font-weight: 600; }
.kpi .delta.up { color: var(--good); }
.kpi .delta.down { color: var(--critical); }
#chartBox { background: var(--surface-1); border: 1px solid var(--grid); border-radius: 12px;
  padding: 16px; margin-bottom: 18px; box-shadow: var(--shadow); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px 10px;
  border-bottom: 1px solid var(--baseline); cursor: pointer; white-space: nowrap; }
table.data td { padding: 8px 10px; border-bottom: 1px solid var(--grid); color: var(--text-secondary); }
table.data tr:last-child td { border-bottom: none; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td .title-cell { color: var(--text-primary); font-weight: 600; }
.tablewrap { overflow-x: auto; background: var(--surface-1); border: 1px solid var(--grid);
  border-radius: 12px; padding: 6px 10px; box-shadow: var(--shadow); }

/* ---- accounts ---- */
.acct { display: flex; flex-direction: column; gap: 8px; min-width: 280px; flex: 1; }
.acct .top { display: flex; align-items: center; gap: 10px; }
.acct .name { font-weight: 700; font-size: 15px; }
.acct .kv { font-size: 12.5px; color: var(--text-secondary); }
.acct .kv b { color: var(--text-primary); font-weight: 600; }
.acct .err { color: var(--critical); font-size: 12.5px; white-space: pre-wrap; }
.acct .capnote { color: var(--muted); font-size: 12px; border-left: 2px solid var(--baseline); padding-left: 8px; }
