/* Age Media Dashboard — design system carried over from v1 so the team
   sees the tool they already know. Tokens first, then components. */

:root {
  /* Surfaces */
  --bg: #FAFAF9;
  --surface: #FFFFFF;
  --surface-2: #F3F2EF;
  --surface-3: #E8E6E1;
  /* Ink */
  --ink: #0F0F0F;
  --ink-soft: #4A4A48;
  --ink-muted: #7A7A78;
  --ink-faint: #B0B0AE;
  /* Lines */
  --border: #E5E3DE;
  --border-soft: #EEECE7;
  /* Brand */
  --accent: #E5C547;
  --accent-dark: #C9A227;
  --accent-deep: #8B6F1A;
  --age-red: #E50914;
  --age-red-soft: #FDE7E9;
  --sidebar: #0A0A0A;
  --sidebar-text: #EDEBE5;
  --sidebar-text-muted: #7A7770;
  /* Pillars */
  --p-thought: #2C5F8D;  --p-thought-bg: #E5EEF6;
  --p-channel: #B8902A;  --p-channel-bg: #F6EEDA;
  --p-product: #4A7C59;  --p-product-bg: #E5EFE7;
  --p-partner: #7A5BA6;  --p-partner-bg: #EEE7F4;
  --p-events: #C46A6A;   --p-events-bg: #F6E5E5;
  /* Channels */
  --ch-linkedin: #0A66C2;
  --ch-instagram: #D4346D;
  --ch-tiktok: #00C2C7;
  --ch-youtube: #DC2626;
  /* Status */
  --s-idea: #8A8278;
  --s-concept: #D4A017;
  --s-ready: #5B8C5A;
  --s-scheduled: #4A7AAE;
  --s-posted: #2E7D5F;
  --s-analyzed: #7A5BA6;
  /* Effects */
  --shadow-sm: 0 1px 2px rgba(20,17,13,.04);
  --shadow-md: 0 4px 12px rgba(20,17,13,.06), 0 1px 2px rgba(20,17,13,.04);
  --shadow-lg: 0 20px 40px -8px rgba(20,17,13,.15), 0 4px 12px rgba(20,17,13,.06);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif: 'Fraunces', Georgia, serif;
  --font-display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}
button { font-family: inherit; font-size: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; color: var(--ink); }

/* ============ App layout ============ */
#app { display: flex; height: 100vh; }
.main {
  flex: 1; display: flex; flex-direction: column;
  min-width: 0; overflow: hidden;
}
.content { flex: 1; overflow-y: auto; padding: 26px 32px 60px; }

/* ============ Sidebar ============ */
.sidebar {
  width: 222px; flex-shrink: 0; background: var(--sidebar);
  color: var(--sidebar-text); display: flex; flex-direction: column;
  padding: 22px 0 14px;
}
.sidebar .brand { padding: 0 22px 20px; }
.sidebar .brand-name {
  font-family: var(--font-display); font-weight: 900; font-size: 21px;
  letter-spacing: .04em; display: flex; align-items: center; gap: 8px;
}
.sidebar .brand-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.sidebar .brand-sub {
  font-size: 9.5px; letter-spacing: .18em; color: var(--sidebar-text-muted);
  text-transform: uppercase; margin-top: 3px;
}
.nav-section {
  font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--sidebar-text-muted); padding: 16px 22px 6px;
}
.nav-item {
  display: flex; width: 100%; align-items: center; gap: 10px;
  padding: 8px 22px; background: none; border: none; text-align: left;
  color: var(--sidebar-text); font-size: 13.5px; border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,.06); }
.nav-item.active { background: rgba(255,255,255,.09); border-left-color: var(--accent); font-weight: 600; }
.nav-note {
  padding: 10px 22px; font-size: 11px; color: var(--sidebar-text-muted);
  font-style: italic;
}
.sidebar .spacer { flex: 1; }
.user-chip {
  margin: 0 14px; padding: 10px 8px; display: flex; align-items: center; gap: 10px;
  border-top: 1px solid rgba(255,255,255,.1);
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; font-size: 11.5px; font-weight: 700;
  color: #fff; flex-shrink: 0;
}
.user-chip .who { min-width: 0; }
.user-chip .who .name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .who .role { font-size: 10.5px; color: var(--sidebar-text-muted); }
.btn-logout {
  margin: 8px 22px 0; background: none; border: 1px solid rgba(255,255,255,.18);
  color: var(--sidebar-text-muted); border-radius: var(--radius-sm);
  padding: 5px 10px; font-size: 11.5px;
}
.btn-logout:hover { color: var(--sidebar-text); border-color: rgba(255,255,255,.4); }
/* Which client you are working on. Deliberately prominent and above the
   user chip: it changes what every screen shows, so it must never be
   something you discover after writing the wrong post. */
.client-switch { margin: 0 14px 8px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.1); }
.client-label { display: block; font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--sidebar-text-muted); margin-bottom: 4px; }
.client-pick {
  width: 100%; background: rgba(255,255,255,.07); color: var(--sidebar-text);
  border: 1px solid rgba(255,255,255,.18); border-radius: var(--radius-sm);
  padding: 6px 8px; font-size: 13px; font-weight: 600;
}
.client-pick:hover { border-color: var(--accent); }
.client-single .client-name { font-size: 13px; font-weight: 600; color: var(--sidebar-text); }
.client-none { font-size: 11.5px; color: var(--accent); font-style: italic; }
/* The member tick-list on a client row in Admin. */
.client-members { display: flex; flex-direction: column; gap: 3px; max-height: 132px; overflow-y: auto; padding: 4px 0; }
.member-tick { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-soft); }
.member-tick input { margin: 0; }
.member-tick input:disabled + * , .member-tick input:disabled { opacity: .55; }
/* Competitor growth. The colour says direction; the words say whether that
   direction is better or worse than ours, which is the actual question. */
.trend-cell { min-width: 190px; }
.trend { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.trend-num { font-weight: 700; font-size: 13.5px; }
.trend-pct { font-size: 11.5px; opacity: .8; }
.trend-span { font-size: 10.5px; color: var(--ink-muted); }
.trend.up .trend-num, .trend.up .trend-pct { color: var(--s-posted); }
.trend.down .trend-num, .trend.down .trend-pct { color: var(--age-red); }
.trend.flat .trend-num { color: var(--ink-muted); }
.trend-none { font-size: 11.5px; color: var(--ink-faint); font-style: italic; }
.trend-versus { display: inline-block; margin-top: 3px; font-size: 11px; font-weight: 600; }
.trend-versus.behind { color: var(--age-red); }
.trend-versus.ahead  { color: var(--s-posted); }
.trend-versus.level  { color: var(--ink-muted); font-weight: 500; }
.spark { color: var(--ink-faint); vertical-align: middle; margin-top: 2px; }
/* Publishing: one line per platform, because a post can succeed on one and
   fail on another and a single tick would hide that. */
.pub-row { display: flex; align-items: baseline; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.pub-name { width: 96px; font-weight: 600; flex-shrink: 0; }
.pub-state { flex: 1; color: var(--ink-soft); font-size: 12.5px; }
.pub-ok { color: var(--s-posted); font-weight: 600; }
.pub-warn { color: var(--s-concept); font-weight: 600; }
.pub-bad { color: var(--age-red); font-weight: 600; }
.pub-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.pub-when { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px 9px; font-size: 12.5px; }
.pub-note { font-size: 12px; color: var(--ink-muted); margin-top: 8px; line-height: 1.5; }
/* Trailing aside on a publish row — e.g. a platform this post went out to
   but is no longer aimed at. Quieter than the outcome it follows. */
.pub-note-inline { color: var(--ink-muted); font-size: 11.5px; }
/* Performance. "not provided" is deliberately styled as absent, not as a
   number, so it can never be misread as zero. */
.stat-block { margin-bottom: 12px; }
.stat-head { font-size: 12px; font-weight: 600; text-transform: capitalize; }
.stat-age { font-weight: 400; color: var(--ink-muted); margin-left: 6px; font-size: 11px; text-transform: none; }
.stat-row { display: flex; gap: 22px; margin-top: 6px; flex-wrap: wrap; }
.stat-num { font-family: var(--font-display); font-weight: 800; font-size: 20px; }
.stat-num.unknown { font-family: var(--font-body); font-weight: 400; font-size: 12px; color: var(--ink-faint); font-style: italic; }
.stat-label { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-muted); }

/* ============ Topbar ============ */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 32px 0; gap: 16px; flex-wrap: wrap;
}
.topbar .crumb { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-muted); }
.topbar h1 { font-family: var(--font-serif); font-size: 27px; font-weight: 500; line-height: 1.15; }
.topbar .actions { display: flex; align-items: center; gap: 10px; }

/* ============ Buttons ============ */
.btn-primary {
  background: var(--ink); color: #fff; border: none; border-radius: var(--radius-sm);
  padding: 9px 16px; font-weight: 600; font-size: 13px;
}
.btn-primary:hover { background: #2A2A2A; }
.btn-primary:disabled { opacity: .5; cursor: default; }
.btn-ghost {
  background: var(--surface); border: 1px solid var(--border); color: var(--ink-soft);
  border-radius: var(--radius-sm); padding: 8px 13px; font-size: 12.5px;
}
.btn-ghost:hover { border-color: var(--ink-faint); color: var(--ink); }
.btn-danger { background: none; border: 1px solid var(--border); color: var(--age-red); border-radius: var(--radius-sm); padding: 8px 13px; font-size: 12.5px; }
.btn-danger:hover { background: var(--age-red-soft); border-color: var(--age-red); }

/* ============ Month switcher ============ */
.month-nav { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.month-nav button { background: none; border: none; padding: 8px 12px; font-size: 15px; color: var(--ink-soft); }
.month-nav button:hover { color: var(--ink); }
.month-nav .label { padding: 0 6px; min-width: 118px; text-align: center; font-weight: 600; font-size: 13.5px; }

/* ============ Filter chips ============ */
.filterbar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 16px; margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.filter-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; padding: 4px 0; }
.filter-row .flabel { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-muted); width: 62px; flex-shrink: 0; }
.chip {
  border: 1px solid var(--border); background: var(--surface); border-radius: 20px;
  padding: 4px 12px; font-size: 12px; color: var(--ink-soft);
  display: inline-flex; align-items: center; gap: 6px;
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; }
.chip:hover { border-color: var(--ink-faint); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ============ Calendar ============ */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 7px; }
.cal-head { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-muted); text-align: center; padding: 4px 0 8px; }
.cal-day {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  min-height: 104px; padding: 7px 8px; cursor: pointer; position: relative;
  min-width: 0; /* stop long post titles from blowing the grid column wide */
}
.cal-day:hover { border-color: var(--ink-faint); }
.cal-day.other { background: transparent; border-color: var(--border-soft); }
.cal-day.other .daynum { color: var(--ink-faint); }
.cal-day.today { border: 2px solid var(--accent); }
.cal-day .daynum { font-family: var(--font-serif); font-size: 15px; margin-bottom: 5px; }
.cal-day.today .daynum { font-weight: 600; }
.cal-post {
  border-radius: 4px; padding: 3px 7px; font-size: 11px; font-weight: 500;
  margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-left: 3px solid transparent;
}
.cal-post:hover { filter: brightness(.96); }

/* ============ List ============ */
.list-tools { display: flex; gap: 10px; margin-bottom: 14px; align-items: center; flex-wrap: wrap; }
.search-input {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px;
  font-size: 13px; width: 240px; background: var(--surface);
}
.search-input:focus { outline: none; border-color: var(--accent-dark); }
.list-count { font-size: 12px; color: var(--ink-muted); }
table.posts { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-sm); }
table.posts th {
  text-align: left; font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-muted); padding: 10px 14px; border-bottom: 1px solid var(--border);
  background: var(--surface-2); font-weight: 600;
}
table.posts td { padding: 11px 14px; border-bottom: 1px solid var(--border-soft); font-size: 13px; vertical-align: middle; }
table.posts tr:last-child td { border-bottom: none; }
table.posts tbody tr { cursor: pointer; }
table.posts tbody tr:hover { background: var(--surface-2); }
.table-wrap { overflow-x: auto; border-radius: var(--radius-md); }

/* ============ Badges ============ */
.badge { display: inline-block; padding: 3px 9px; border-radius: 4px; font-size: 10.5px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }
.badge-pillar-thought { background: var(--p-thought-bg); color: var(--p-thought); }
.badge-pillar-channel { background: var(--p-channel-bg); color: var(--p-channel); }
.badge-pillar-product { background: var(--p-product-bg); color: var(--p-product); }
.badge-pillar-partner { background: var(--p-partner-bg); color: var(--p-partner); }
.badge-pillar-events  { background: var(--p-events-bg);  color: var(--p-events); }
.status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-soft); }
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; }

/* ============ Empty state ============ */
.empty-state { text-align: center; padding: 70px 20px; color: var(--ink-muted); }
.empty-state .big { font-family: var(--font-serif); font-size: 19px; color: var(--ink); margin-bottom: 6px; }

/* ============ Detail drawer ============ */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(15,15,15,.32); z-index: 40;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 94vw);
  background: var(--surface); z-index: 41; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
}
.drawer-head { padding: 20px 26px 0; }
.drawer-body { flex: 1; overflow-y: auto; padding: 6px 26px 40px; }
.drawer-close {
  position: absolute; top: 14px; right: 18px; background: none; border: none;
  font-size: 22px; color: var(--ink-muted); line-height: 1;
}
.drawer-close:hover { color: var(--ink); }
.pillar-select { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 12px; }
.pillar-opt { border: 1px solid var(--border); background: var(--surface); border-radius: 4px; padding: 4px 10px; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-muted); }
.hook-input {
  width: 100%; border: none; font-family: var(--font-serif); font-size: 22px;
  font-weight: 500; line-height: 1.25; padding: 2px 0 8px; background: transparent;
  border-bottom: 1px solid var(--border-soft);
}
.hook-input:focus { outline: none; border-bottom-color: var(--accent-dark); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin: 16px 0; }
.field label, .field-grid label {
  display: block; font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-muted); margin-bottom: 4px; font-weight: 600;
}
.field { margin: 14px 0; }
.field input[type="date"], .field-grid input, .field-grid select, .field input, .field select {
  width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 10px; font-size: 13px; background: var(--surface);
}
.field textarea {
  width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 11px; font-size: 13px; resize: vertical; min-height: 64px; background: var(--surface);
  line-height: 1.5;
}
.field input:focus, .field select:focus, .field textarea:focus, .field-grid input:focus, .field-grid select:focus { outline: none; border-color: var(--accent-dark); }
.status-row { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 2px; }
.status-btn { border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-sm); padding: 6px 12px; font-size: 12px; color: var(--ink-soft); }
.status-btn.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.counter { font-size: 11px; color: var(--ink-muted); margin-top: 3px; }
.save-state { font-size: 11px; height: 16px; margin-top: 6px; color: var(--ink-muted); transition: opacity .3s; }
.save-state.ok { color: var(--s-posted); }
.save-state.err { color: var(--age-red); font-weight: 600; }
.drawer-foot { padding: 14px 26px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }

/* ============ Login gate ============ */
.gate-backdrop {
  position: fixed; inset: 0; background: #0A0A0A; z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
.gate-card { width: min(360px, 92vw); text-align: center; color: #EDEBE5; }
.gate-dot { width: 12px; height: 12px; background: var(--accent); border-radius: 50%; margin: 0 auto 18px; }
.gate-title { font-family: var(--font-display); font-weight: 900; font-size: 30px; letter-spacing: .05em; }
.gate-sub { font-size: 12px; color: var(--sidebar-text-muted); margin: 4px 0 26px; }
.gate-card input {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.07); color: #fff; font-size: 14px; margin-bottom: 10px;
}
.gate-card input::placeholder { color: rgba(255,255,255,.4); }
.gate-card input:focus { outline: none; border-color: var(--accent); }
.gate-btn {
  width: 100%; padding: 12px; border: none; border-radius: var(--radius-sm);
  background: var(--accent); color: #0A0A0A; font-weight: 700; font-size: 14px; margin-top: 4px;
}
.gate-btn:hover { background: #EFD35F; }
.gate-btn:disabled { opacity: .6; }
.gate-error { min-height: 20px; margin-top: 12px; font-size: 12.5px; color: #FF7B84; }
.gate-note { margin-top: 20px; font-size: 11px; color: rgba(255,255,255,.35); line-height: 1.6; }

/* ============ Admin ============ */
.admin-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 20px 22px; margin-bottom: 20px; box-shadow: var(--shadow-sm); }
.admin-card h2 { font-family: var(--font-serif); font-size: 18px; font-weight: 500; margin-bottom: 14px; }
.admin-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.admin-form .fcol label { display: block; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 4px; }
.admin-form input, .admin-form select {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; font-size: 13px;
}
.inactive-row { opacity: .5; }

/* ============ Toast ============ */
#toast-zone { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--ink); color: #fff; border-radius: var(--radius-sm);
  padding: 10px 18px; font-size: 13px; box-shadow: var(--shadow-lg);
  animation: toast-in .18s ease-out;
}
.toast.error { background: var(--age-red); font-weight: 600; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; } }

/* ============ Dashboard ============ */
.dash-hello { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; }
.dash-counters { display: flex; gap: 34px; }
.dash-counter { text-align: right; }
.dash-counter .n { font-family: var(--font-display); font-weight: 800; font-size: 30px; line-height: 1; }
.dash-counter .l { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-muted); margin-top: 3px; }
.dash-counter.hot .n { color: var(--age-red); }
.attention-bar {
  background: var(--age-red-soft); border: 1px solid #F5C6CB; border-radius: var(--radius-md);
  padding: 10px 16px; margin-bottom: 18px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.attention-title { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; color: var(--age-red); }
.dash-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; align-items: start; }
.dash-col { display: flex; flex-direction: column; gap: 18px; }
.dash-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.dash-card-head h2, .admin-card h2 { font-family: var(--font-serif); font-size: 18px; font-weight: 500; }
.week-day { border-top: 1px solid var(--border-soft); padding: 7px 0; }
.week-day.today { background: #FEFBF0; margin: 0 -8px; padding: 7px 8px; border-radius: 6px; }
.week-head { display: flex; align-items: baseline; gap: 10px; }
.week-num { font-family: var(--font-serif); font-size: 16px; }
.week-name { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-muted); flex: 1; }
.week-day.today .week-name { color: var(--accent-deep); font-weight: 700; }
.week-add { background: none; border: none; font-size: 11px; color: var(--ink-faint); }
.week-day:hover .week-add { color: var(--accent-deep); }
.bal-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; }
.bal-row .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.bal-name { flex: 1; }
.bal-count { font-weight: 700; font-family: var(--font-display); font-size: 16px; }
.funnel-line { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 12px; }
.funnel-tag { width: 44px; font-size: 9.5px; letter-spacing: .1em; font-weight: 800; color: var(--accent-deep); flex-shrink: 0; }
.funnel-meaning { width: 108px; color: var(--ink-muted); flex-shrink: 0; }
.funnel-bar { flex: 1; height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.funnel-bar span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.funnel-num { width: 58px; text-align: right; font-weight: 600; color: var(--ink-soft); flex-shrink: 0; }
.wait-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--border-soft); cursor: pointer; font-size: 12.5px; }
.wait-row:hover .wait-hook { color: var(--accent-deep); }
.wait-label { font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; color: var(--ink-muted); background: var(--surface-2); border-radius: 4px; padding: 2px 6px; flex-shrink: 0; }
.wait-label.mention { color: var(--age-red); background: var(--age-red-soft); }
.wait-hook { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.wait-date { color: var(--ink-muted); font-size: 11.5px; }
.act-row { display: flex; align-items: flex-start; gap: 8px; padding: 5px 0; border-top: 1px solid var(--border-soft); }
.act-text { font-size: 12px; line-height: 1.45; color: var(--ink-soft); }
.act-detail { color: var(--ink-muted); }

/* ============ Board ============ */
.board-wrap { overflow-x: auto; padding-bottom: 10px; }
.board { display: flex; gap: 12px; min-width: 900px; align-items: flex-start; }
.board-col { flex: 1; min-width: 150px; background: var(--surface-2); border-radius: var(--radius-md); padding: 10px; }
.board-col.drop-target { outline: 2px dashed var(--accent-dark); outline-offset: -2px; }
.board-col-head { display: flex; align-items: center; gap: 7px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; color: var(--ink-soft); padding: 2px 4px 10px; }
.board-col-head .dot { width: 8px; height: 8px; border-radius: 50%; }
.board-count { margin-left: auto; color: var(--ink-faint); font-weight: 600; }
.board-col-body { min-height: 40px; }
.board-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 10px; margin-bottom: 8px; cursor: grab; box-shadow: var(--shadow-sm); }
.board-card:hover { border-color: var(--ink-faint); }
.board-card.dragging { opacity: .45; }
.board-card.saving { opacity: .55; pointer-events: none; }
.board-card-top { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.board-date { font-size: 10.5px; color: var(--ink-muted); flex: 1; }
.board-flag { font-size: 11px; font-weight: 700; }
.board-flag.ok { color: var(--s-posted); }
.board-flag.warn { color: var(--s-concept); }
.board-pillar { font-size: 9.5px; letter-spacing: .07em; text-transform: uppercase; font-weight: 700; margin-bottom: 2px; }
.board-hook { font-size: 12.5px; font-weight: 500; line-height: 1.35; }

/* ============ Drawer: approval / assets / comments ============ */
.appr-block { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 14px; }
.appr-state { font-size: 13px; color: var(--ink-muted); }
.appr-state.ok { color: var(--s-posted); font-weight: 600; }
.appr-state.warn { color: var(--s-concept); font-weight: 600; }
.appr-note { margin-top: 6px; font-size: 12.5px; font-style: italic; color: var(--ink-soft); }
.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius-sm); padding: 16px;
  text-align: center; font-size: 12px; color: var(--ink-muted); cursor: pointer; margin-top: 8px;
}
.upload-zone:hover, .upload-zone.drag { border-color: var(--accent-dark); color: var(--accent-deep); background: #FEFBF0; }
.asset-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.asset-tile { position: relative; width: 92px; }
.asset-tile img { width: 92px; height: 92px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); display: block; }
.asset-pdf { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 92px; height: 92px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); font-weight: 800; color: var(--age-red); text-decoration: none; font-size: 13px; text-align: center; }
.asset-pdf span { font-weight: 400; font-size: 9px; color: var(--ink-muted); max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 3px; }
.asset-del { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: none; background: var(--ink); color: #fff; font-size: 12px; line-height: 1; }
.comment-row { display: flex; gap: 9px; padding: 8px 0; border-top: 1px solid var(--border-soft); }
.comment-body { flex: 1; min-width: 0; }
.comment-meta { font-size: 11px; color: var(--ink-muted); margin-bottom: 2px; }
.comment-del { background: none; border: none; font-size: 10.5px; color: var(--ink-faint); }
.comment-del:hover { color: var(--age-red); }
.comment-text { font-size: 13px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.mention-tag { color: var(--p-thought); font-weight: 600; background: var(--p-thought-bg); border-radius: 3px; padding: 0 3px; }

/* ============ Campaigns ============ */
.camp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.camp-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.camp-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.camp-status { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; padding: 3px 8px; border-radius: 4px; background: var(--surface-2); color: var(--ink-muted); }
.camp-status.active { background: #E5EFE7; color: var(--s-posted); }
.camp-status.completed { background: var(--surface-3); color: var(--ink-soft); }
.camp-name { font-family: var(--font-serif); font-size: 18px; font-weight: 500; margin-bottom: 4px; }
.camp-goal { font-size: 12.5px; color: var(--ink-soft); line-height: 1.5; margin-bottom: 8px; }
.camp-meta { display: flex; gap: 14px; font-size: 11.5px; color: var(--ink-muted); margin-bottom: 8px; flex-wrap: wrap; }
.camp-bar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.camp-bar span { display: block; height: 100%; background: var(--accent); }
.camp-bar-label { font-size: 10.5px; color: var(--ink-faint); margin: 3px 0 10px; }
.camp-metrics { display: flex; gap: 18px; border-top: 1px solid var(--border-soft); padding-top: 10px; }
.camp-metrics .n { font-family: var(--font-display); font-weight: 800; font-size: 19px; }
.camp-metrics .l { font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-muted); }

/* ============ Events ============ */
.ev-status { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; padding: 2px 7px; border-radius: 4px; }
.ev-status.upcoming { background: #E5EFE7; color: var(--s-posted); }
.ev-status.live { background: var(--age-red-soft); color: var(--age-red); }
.ev-status.past { background: var(--surface-2); color: var(--ink-muted); }
.ev-status.undated { background: var(--surface-2); color: var(--ink-faint); }

/* ============ Strategy ============ */
.strat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.strat-card { background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px; }
.strat-channel { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; }
.strat-nickname { font-family: var(--font-serif); font-size: 19px; margin: 2px 0 8px; }
.strat-role { font-size: 12.5px; line-height: 1.55; color: var(--ink-soft); }
.strat-tone { font-size: 11.5px; color: var(--ink-muted); margin-top: 8px; }
.strat-pillar { background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 12px; }
.strat-pillar-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.strat-funnel { font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-deep); font-weight: 700; }
.strat-target { font-size: 11.5px; color: var(--ink-muted); }
.strat-why { font-size: 13px; line-height: 1.55; margin-bottom: 10px; }
.strat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; font-size: 12.5px; }
.strat-grid .l { display: block; font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 2px; }
.editable { border-bottom: 1px dashed var(--border); cursor: text; display: inline-block; min-width: 40px; }
.editable:hover { border-bottom-color: var(--accent-dark); background: #FEFBF0; }
.editable:focus { outline: none; border-bottom-color: var(--accent-dark); background: #FEFBF0; }
.editable:empty::before { content: attr(data-placeholder); color: var(--ink-faint); }

/* ============ News ============ */
.news-head { font-size: 12px; color: var(--ink-muted); margin-bottom: 14px; }
.news-head .src-bad { color: var(--age-red); text-decoration: line-through; }
.news-warn { color: var(--accent-deep); margin-top: 4px; }
.news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.news-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 15px 16px; display: flex; flex-direction: column; box-shadow: var(--shadow-sm); }
.news-source { font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: var(--accent-deep); }
.news-title { font-family: var(--font-serif); font-size: 15.5px; line-height: 1.35; margin: 5px 0 6px; }
.news-desc { font-size: 12px; line-height: 1.5; color: var(--ink-muted); flex: 1; }
.news-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; gap: 8px; }
.news-age { font-size: 11px; color: var(--ink-faint); }
.news-foot .btn-ghost, .news-foot .btn-primary { padding: 5px 10px; font-size: 11.5px; text-decoration: none; }
.news-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.news-card.muted { opacity: .72; border-style: dashed; }
/* Two different notes sit in the filter row: what muting hides, and how
   much of the match set is on screen. Separate classes so each can be
   found on its own. */
.news-muted-note,
.news-count-note { font-size: 11.5px; color: var(--ink-muted); margin-left: 6px; }
.chip-count { font-size: 10px; opacity: .7; margin-left: 2px; }

/* ============ Research library ============ */
.tabbar { display: flex; gap: 6px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tab-btn { background: none; border: none; padding: 9px 14px; font-size: 13px; color: var(--ink-muted); border-bottom: 2px solid transparent; }
.tab-btn.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
.res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.res-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px 16px; box-shadow: var(--shadow-sm); }
.res-top { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.type-chip { font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; background: var(--surface-2); color: var(--ink-muted); padding: 2px 7px; border-radius: 4px; }
.stars { color: var(--accent-dark); font-size: 13px; letter-spacing: 1px; cursor: pointer; }
.res-quote { font-size: 14.5px; font-weight: 500; line-height: 1.45; margin-bottom: 8px; }
.res-title { font-size: 14px; font-weight: 500; line-height: 1.4; }
.res-title a { color: var(--ink); text-decoration: none; }
.res-title a:hover { color: var(--accent-deep); }
.res-notes { font-size: 12px; color: var(--ink-muted); line-height: 1.5; margin-top: 6px; }
.res-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.tag-chip { font-size: 11px; background: var(--surface-2); color: var(--ink-muted); padding: 2px 7px; border-radius: 3px; }
.res-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--border-soft); font-size: 11.5px; color: var(--ink-muted); }
.res-foot .btn-ghost, .res-foot .btn-danger { padding: 4px 9px; font-size: 11px; }
/* "used in 3 posts" — evidence, so it reads stronger than the source note
   beside it; "not used yet" is a neutral fact, not a warning. */
.res-used { font-weight: 600; color: var(--ink); }
/* Post Maker's "From the Library" rows — chips wrap, and a long hook is
   allowed to be wide without stretching the row it sits in. */
.pm-lib-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; padding: 4px 0; }
.pm-lib-row .flabel { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-muted); width: 62px; flex-shrink: 0; }
.pm-lib-row .chip { max-width: 100%; text-align: left; }
.res-used.none { font-weight: 400; color: var(--ink-faint); }
.src-state { font-size: 11px; }
.src-state.ok { color: var(--s-posted); }
.src-state.bad { color: var(--age-red); }

/* ============ Post Maker ============ */
.mode-line { font-size: 12px; color: var(--ink-muted); background: var(--surface-2); border-radius: 6px; padding: 7px 11px; margin-bottom: 12px; display: inline-block; }
.mode-line.ai { background: #F6EEDA; color: var(--accent-deep); font-weight: 600; }

/* ============ IG Feed ============ */
.ig-wrap { display: grid; grid-template-columns: 380px 1fr; gap: 20px; align-items: start; }
.ig-phone { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow-md); }
.ig-profile { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.ig-avatar { width: 52px; height: 52px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--age-red)); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; }
.ig-handle { font-weight: 700; font-size: 14px; }
.ig-bio { font-size: 11.5px; color: var(--ink-muted); }
.ig-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.ig-cell { aspect-ratio: 1; padding: 8px; cursor: pointer; display: flex; flex-direction: column; justify-content: space-between; color: #fff; overflow: hidden; }
.ig-cell:hover { filter: brightness(1.08); }
.ig-cell-hook { font-size: 10.5px; line-height: 1.3; font-weight: 500; }
.ig-cell-date { font-size: 9px; opacity: .8; }
.ig-empty { grid-column: 1 / -1; padding: 40px 10px; text-align: center; font-size: 12.5px; color: var(--ink-muted); }
.ig-side { display: flex; flex-direction: column; gap: 16px; }

/* ============ Account: connections ============ */

/* ============ Help (?) ============ */
.help-btn {
  width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--border);
  background: var(--surface); color: var(--ink-muted); font-weight: 700; font-size: 13px;
  flex-shrink: 0; line-height: 1;
}
.help-btn:hover { border-color: var(--accent-dark); color: var(--accent-deep); }
/* The two screens that sit outside the topbar carry their own ?: the post
   drawer (beside its close button) and the login gate (under the form). */
.drawer .help-btn { position: absolute; top: 13px; right: 52px; }
.gate-card .help-btn { margin: 14px auto 0; display: block; }
/* Help is a modal ON TOP of whatever raised it — including the login gate,
   which sits at z-index 100. Without this the ? on the gate opened a panel
   behind it: invisible, and impossible to close. */
#help-modal .cmdk-backdrop { z-index: 110; }
#help-modal .help-panel { z-index: 111; }
.help-panel {
  position: fixed; top: 10vh; left: 50%; transform: translateX(-50%);
  width: min(520px, 92vw); max-height: 76vh; overflow-y: auto;
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  z-index: 95; padding: 22px 26px;
}
.help-body p { font-size: 13px; line-height: 1.6; color: var(--ink-soft); margin-bottom: 9px; }
.help-body b { color: var(--ink); }

/* ============ Account ============ */
.conn-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border-soft); font-size: 13px; }
.conn-row .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.conn-name { width: 90px; font-weight: 600; flex-shrink: 0; }
.conn-status { flex: 1; color: var(--ink-soft); }
.conn-status.ok { color: var(--s-posted); font-weight: 600; }
.conn-status.muted { color: var(--ink-muted); font-size: 12px; }
/* The connect half of a Channels card: separated from the numbers above it,
   because "how is this channel doing" and "am I attached to it" are two
   different questions that happen to belong on the same card. */
.chan-connect { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border-soft); }
.chan-connect-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chan-connect-head .flabel { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-muted); width: 84px; flex-shrink: 0; }
.chan-connect-head .conn-status { flex: 1; min-width: 140px; }
.chan-connect-why { font-size: 12px; color: var(--ink-muted); margin-top: 7px; }
.chan-connect-team { font-size: 12px; margin-top: 5px; }
.chan-connect-team .conn-status { flex: none; }
.gate-or { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.35); margin: 14px 0 10px; }

/* user-chip is a button now */
button.user-chip { background: none; border: none; color: inherit; text-align: left; width: calc(100% - 28px); cursor: pointer; }
button.user-chip:hover .name { color: var(--accent); }

/* ============ Cmd-K ============ */
.cmdk-backdrop { position: fixed; inset: 0; background: rgba(15,15,15,.35); z-index: 90; }
.cmdk-panel {
  position: fixed; top: 14vh; left: 50%; transform: translateX(-50%);
  width: min(560px, 92vw); background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); z-index: 91; overflow: hidden;
}
#cmdk-input { width: 100%; border: none; border-bottom: 1px solid var(--border); padding: 15px 18px; font-size: 15px; background: var(--surface); }
#cmdk-input:focus { outline: none; }
#cmdk-results { max-height: 46vh; overflow-y: auto; padding: 6px; }
.cmdk-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 13.5px; }
.cmdk-item.sel, .cmdk-item:hover { background: var(--surface-2); }
.cmdk-kind { font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); width: 44px; flex-shrink: 0; }
.cmdk-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-date { font-size: 11.5px; color: var(--ink-muted); }
.cmdk-empty { padding: 22px; text-align: center; font-size: 13px; color: var(--ink-muted); }

/* ============ Responsive ============ */
@media (max-width: 860px) {
  .dash-grid, .ig-wrap { grid-template-columns: 1fr; }
  .camp-grid, .news-grid, .res-grid { grid-template-columns: 1fr; }
  .dash-hello { flex-direction: column; align-items: flex-start; }
  .dash-counters { gap: 22px; }
  .dash-counter { text-align: left; }
  .sidebar { width: 64px; }
  .sidebar .brand-name span.txt, .sidebar .brand-sub, .nav-item span.txt,
  .nav-section, .nav-note, .user-chip .who, .btn-logout { display: none; }
  .nav-item { justify-content: center; padding: 10px 0; }
  .user-chip { justify-content: center; margin: 0; }
  .content { padding: 18px 14px 50px; }
  .topbar { padding: 14px 14px 0; }
  .cal-day { min-height: 64px; }
}

/* --- Software update card (Admin › Setup) ------------------------------- */
.upd-now { display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
           padding: 12px 14px; background: var(--bg-soft, #F7F5F2);
           border: 1px solid var(--border-soft); border-radius: 8px; }
.upd-version { font-family: var(--font-display); font-weight: 800; font-size: 19px; }
.upd-sub { font-size: 11.5px; color: var(--ink-muted); line-height: 1.5; }
.upd-note { font-size: 12.5px; line-height: 1.55; margin-top: 12px; padding: 10px 12px;
            border-radius: 8px; border: 1px solid var(--border-soft);
            background: var(--bg-soft, #F7F5F2); white-space: pre-wrap; }
.upd-note.ok  { border-color: #2E7D5F44; background: #2E7D5F0D; }
.upd-note.bad { border-color: #E5091444; background: #E509140D; }
.ok-tag { font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
          color: #2E7D5F; margin-left: 6px; }
