/*
 * Studio 61 brand theme, light + dark.
 * Font: Urbanist. Charcoal + tan (brand), warm glow background on every page.
 * Mode: <html data-theme="dark|light"> (set in index.html before paint, toggled in app.js, remembered per viewer).
 * Components only read the --c-* tokens below, so both modes stay in sync.
 * Served publicly at /brand/theme.css so the login page can use it too.
 */
:root {
  /* brand constants */
  --ink: #262626;
  --ink-deep: #1f2124;
  --tan: #dbb38f;
  --tan-soft: #fbe4ce;
  --paper: #f4f3f0;
  --stone: #e0dfda;
  --white: #fff;
  --line-dark: rgba(255, 255, 255, 0.28);
  --pill: 50px;
  --radius: 18px;
  --font: 'Urbanist', system-ui, sans-serif;
  --sidebar-w: 260px;
  /* sidebar rhythm: row height + gap (tree lines are computed from these) */
  --row-h: 44px;
  --row-gap: 6px;
}

/* ── Dark (default) ── */
:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --c-bg: #141414;
  --c-glow-1: rgba(150, 104, 66, 0.30);
  --c-glow-2: rgba(150, 104, 66, 0.24);
  --c-glow-3: rgba(219, 179, 143, 0.06);
  --c-surface: rgba(32, 31, 30, 0.72);
  --c-surface-solid: #1f1e1d;
  --c-surface-2: rgba(255, 255, 255, 0.03);
  --c-border: rgba(255, 255, 255, 0.08);
  --c-border-strong: rgba(255, 255, 255, 0.15);
  --c-text: #f1ede7;
  --c-muted: #9c978f;
  --c-hover: rgba(255, 255, 255, 0.05);
  --c-active: rgba(255, 255, 255, 0.07);
  --c-accent: #dbb38f;
  --c-accent-text: #dbb38f;
  --c-accent-soft: rgba(219, 179, 143, 0.13);
  --c-accent-border: rgba(219, 179, 143, 0.32);
  --c-urgent: #f08a78;
  --c-urgent-soft: rgba(240, 138, 120, 0.15);
  --c-good: #a9d39a;
  --c-good-soft: rgba(140, 190, 120, 0.16);
  --c-warn: #fbe4ce;
  --c-warn-soft: rgba(219, 179, 143, 0.18);
  --c-topbar: rgba(20, 20, 20, 0.55);
  --c-doc: #d9d2c7;        /* warm, dimmed paper so the report doesn't glare on the dark page */
  --c-doc-text: #2b2824;
  --c-logo-filter: none;
  --c-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.8);
  /* sidebar (from the reference build's palette); translucent so the background glow shows through */
  --s-bg: rgba(16, 16, 16, 0.32);
  --s-bg-overlay: rgba(22, 22, 22, 0.94);
  --s-line: rgba(255, 255, 255, 0.22);
  --s-border: rgba(255, 255, 255, 0.06);
  --s-text: #a3a3a3;
  --s-icon: #999999;
  --s-icon-hover: #cccccc;
  --s-strong: #ffffff;
  --s-hover: rgba(255, 255, 255, 0.05);
  --s-active: rgba(255, 255, 255, 0.07);
  --s-active-child: rgba(255, 255, 255, 0.05);
}

/* ── Light ── */
:root[data-theme="light"] {
  color-scheme: light;
  --c-bg: #f4f1ec;
  --c-glow-1: rgba(219, 179, 143, 0.38);
  --c-glow-2: rgba(219, 179, 143, 0.24);
  --c-glow-3: rgba(255, 255, 255, 0.5);
  --c-surface: rgba(255, 255, 255, 0.8);
  --c-surface-solid: #ffffff;
  --c-surface-2: #faf8f5;
  --c-border: #e4e0d8;
  --c-border-strong: #cfc9be;
  --c-text: #262626;
  --c-muted: #6b6f76;
  --c-hover: rgba(38, 38, 38, 0.045);
  --c-active: rgba(38, 38, 38, 0.07);
  --c-accent: #dbb38f;
  --c-accent-text: #9a7350;
  --c-accent-soft: rgba(219, 179, 143, 0.24);
  --c-accent-border: rgba(169, 130, 94, 0.4);
  --c-urgent: #b83a2a;
  --c-urgent-soft: #f6ddd8;
  --c-good: #2f6b2a;
  --c-good-soft: #e1ecdb;
  --c-warn: #6b4e2e;
  --c-warn-soft: #f8e6d3;
  --c-topbar: rgba(244, 241, 236, 0.78);
  --c-doc: #fbf8f3;
  --c-doc-text: #262626;
  --c-logo-filter: invert(1);
  --c-shadow: 0 18px 40px -22px rgba(60, 45, 30, 0.35);
  --s-bg: rgba(255, 252, 248, 0.42);
  --s-bg-overlay: rgba(251, 249, 246, 0.96);
  --s-line: rgba(38, 38, 38, 0.22);
  --s-border: rgba(38, 38, 38, 0.08);
  --s-text: #5f646b;
  --s-icon: #8a8f96;
  --s-icon-hover: #262626;
  --s-strong: #262626;
  --s-hover: rgba(38, 38, 38, 0.045);
  --s-active: rgba(38, 38, 38, 0.07);
  --s-active-child: rgba(38, 38, 38, 0.05);
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--c-text);
  /* Same warm-glow background on every page, in both modes */
  background-color: var(--c-bg);
  background-image:
    radial-gradient(ellipse 60% 55% at 12% 8%, var(--c-glow-1), transparent 70%),
    radial-gradient(ellipse 55% 50% at 100% 100%, var(--c-glow-2), transparent 70%),
    radial-gradient(ellipse 40% 35% at 70% 30%, var(--c-glow-3), transparent 70%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  transition: background-color .2s, color .2s;
}

a { color: inherit; }
.icon { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.logo-img { filter: var(--c-logo-filter); }

/* ── Top bar (hub overview, client overview, channel placeholders) ── */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--c-topbar);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--c-border);
  padding: 16px 28px;
}
.topbar-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; text-decoration: none; }
.brand img { height: 34px; width: auto; display: block; }
.crumbs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; font-weight: 500; color: var(--c-muted); }
.crumbs a { text-decoration: none; color: var(--c-muted); }
.crumbs a:hover { color: var(--c-text); }
.crumbs b { color: var(--c-text); font-weight: 600; }
.crumbs .sep { opacity: .5; }
.controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-left: auto; }
.controls label, .page-toolbar label {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--c-muted);
}
.controls form { margin: 0; }

/* ── Buttons, pills, inputs ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 20px;
  border-radius: var(--pill);
  border: 1px solid var(--c-border-strong);
  background: transparent;
  color: var(--c-text);
  font: 600 14px/1.2 var(--font);
  text-transform: uppercase; text-decoration: none; cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
}
.btn:hover { border-color: var(--c-accent); color: var(--c-accent-text); }
.btn-primary { background: var(--tan); border-color: var(--tan); color: var(--ink); }
.btn-primary:hover { background: var(--tan-soft); border-color: var(--tan-soft); color: var(--ink); }
.btn-primary:disabled { opacity: .5; cursor: wait; }
.btn-sm { padding: 7px 16px; font-size: 13px; }
.btn-danger { border-color: var(--c-urgent); color: var(--c-urgent); }
.btn-danger:hover { background: var(--c-urgent); border-color: var(--c-urgent); color: var(--white); }
.icon-btn {
  display: grid; place-items: center; width: 38px; height: 38px;
  border: 1px solid var(--c-border-strong); border-radius: 50%;
  background: transparent; color: var(--c-text); cursor: pointer;
}
.icon-btn:hover { border-color: var(--c-accent); color: var(--c-accent-text); }
/* sun in dark mode (switch to light), moon in light mode */
.theme-icon-light { display: none; }
:root[data-theme="light"] .theme-icon-light { display: block; }
:root[data-theme="light"] .theme-icon-dark { display: none; }

select, input {
  font: 500 14px var(--font);
  padding: 8px 16px;
  border-radius: var(--pill);
  border: 1px solid var(--c-border-strong);
  background: var(--c-hover);
  color: var(--c-text);
}
select:focus, input:focus { outline: 2px solid var(--c-accent); outline-offset: 1px; }
select option { color: #262626; background: #fff; }

/* Themed dropdown (month picker): the native <select> stays hidden as the source of truth */
.picker { position: relative; display: inline-block; }
.picker-native { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.picker-btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 14px 8px 18px; border-radius: var(--pill);
  border: 1px solid var(--c-border-strong); background: var(--c-hover); color: var(--c-text);
  font: 500 14px var(--font); text-transform: none; letter-spacing: 0; cursor: pointer;
  transition: border-color .15s;
}
.picker-btn:hover, .picker.open .picker-btn { border-color: var(--c-accent); }
.picker-btn .icon { width: 15px; height: 15px; color: var(--c-muted); transition: transform .15s; }
.picker.open .picker-btn .icon { transform: rotate(180deg); }
.picker-list {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
  min-width: 190px; max-height: 340px; overflow-y: auto; padding: 6px;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--c-surface-solid); border: 1px solid var(--c-border-strong); border-radius: 14px;
  box-shadow: var(--c-shadow);
  animation: picker-in .14s ease-out;
}
.picker-list[hidden] { display: none; }
@keyframes picker-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.picker-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 12px; border: 0; border-radius: 9px; background: none; cursor: pointer;
  color: var(--c-text); font: 500 14px var(--font); text-align: left; text-transform: none; letter-spacing: 0;
}
.picker-opt:hover, .picker-opt:focus-visible { background: var(--c-hover); outline: none; }
.picker-opt[aria-selected="true"] { color: var(--c-accent-text); font-weight: 600; }
.picker-opt .icon { width: 15px; height: 15px; color: var(--c-accent-text); }

/* ── Page layout ── */
main { max-width: 1320px; margin: 0 auto; padding: 40px 28px 72px; }
.page-head { text-align: center; margin-bottom: 36px; }
.page-head h2 {
  margin: 16px 0 8px;
  font-size: clamp(34px, 5vw, 55px); font-weight: 600; line-height: 1.05; letter-spacing: -0.03em; text-transform: uppercase;
}
.page-head p { margin: 0 auto; max-width: 640px; color: var(--c-muted); font-size: 18px; }
.eyebrow {
  display: inline-block; padding: 6px 20px;
  border: 1px solid var(--c-border-strong); border-radius: var(--pill);
  font-size: 13px; font-weight: 500; text-transform: uppercase; color: var(--c-muted);
}
.kicker { font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--c-muted); }
.sub-head { margin-bottom: 28px; }
.sub-head h2 { margin: 6px 0 8px; font-size: clamp(30px, 4vw, 44px); font-weight: 600; line-height: 1.05; letter-spacing: -0.03em; text-transform: uppercase; }
.sub-head p { margin: 0; max-width: 780px; color: var(--c-muted); font-size: 17px; }
.page-toolbar { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-bottom: 24px; }
h3 { margin: 36px 0 14px; font-size: 22px; font-weight: 600; letter-spacing: -0.01em; text-transform: uppercase; }
.grid h3 { margin-top: 0; }
.muted, .sub { color: var(--c-muted); }
.sub { font-size: 13px; margin-top: 4px; }
.small { font-size: 13px; }
.urgent { color: var(--c-urgent); font-weight: 700; }
.loading { color: var(--c-muted); padding: 40px 0; }
code { font-size: 13px; background: var(--c-hover); padding: 1px 6px; border-radius: 6px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }

/* Surfaces */
.card, .panel, .table-wrap, .hero-card, .tile, .client-card, .channel-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  backdrop-filter: blur(6px);
}

/* KPI cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; }
.card {
  display: flex; flex-direction: column; justify-content: space-between; /* numbers line up when a label wraps */
  padding: 20px 22px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--c-muted);
}
.card b { display: block; margin-top: 10px; font-size: 40px; font-weight: 600; line-height: 1; letter-spacing: -0.03em; color: var(--c-text); }
.card b small { display: block; margin-top: 8px; font-size: 13px; font-weight: 600; letter-spacing: 0.02em; text-transform: none; color: var(--c-muted); }
.card.dark { background: linear-gradient(160deg, var(--c-accent-soft), var(--c-surface)); border-color: var(--c-accent-border); }
.card.dark b { color: var(--c-accent-text); }
.card.hot { border-color: var(--c-urgent); }
.card.hot b { color: var(--c-urgent); }
.cards-compact .card { padding: 18px 20px; }
.cards-compact .card b { font-size: 34px; }

/* Tables: scroll sideways on small screens */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: max-content; min-width: 100%; font-size: 14px; }
th, td { padding: 14px 16px; text-align: left; vertical-align: top; max-width: 300px; }
th {
  font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--c-muted); background: var(--c-surface-2); white-space: nowrap;
  border-bottom: 1px solid var(--c-border);
}
tbody tr + tr td { border-top: 1px solid var(--c-border); }
tbody tr:hover td { background: var(--c-hover); }
td a {
  display: inline-block; padding: 4px 14px;
  border-radius: var(--pill); background: var(--tan); color: var(--ink);
  font-weight: 600; font-size: 12px; text-transform: uppercase; text-decoration: none;
}

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-block; padding: 3px 11px; border-radius: var(--pill);
  background: var(--c-hover); color: var(--c-text);
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.chip-warn { background: var(--c-warn-soft); color: var(--c-warn); }
.chip-urgent { background: var(--c-urgent-soft); color: var(--c-urgent); }
.chip-good { background: var(--c-good-soft); color: var(--c-good); }

/* Panels, quotes, bars */
.table-wrap + .panel, .panel + .table-wrap, .table-wrap + .table-wrap { margin-top: 12px; }
.panel { padding: 22px 26px; margin-bottom: 16px; }
.panel p { margin: 0 0 12px; }
.panel p:last-child { margin-bottom: 0; }
.lede { font-size: 21px; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; }
.quote { margin: 6px 0; padding-left: 10px; border-left: 3px solid var(--tan); font-style: italic; font-size: 13px; }
.findings { margin: 0; padding-left: 22px; }
.findings li + li { margin-top: 14px; }
.script-title { margin: 0 0 12px; font-size: 18px; font-weight: 600; text-transform: uppercase; letter-spacing: -0.01em; }
.bar-row { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.bar { width: 90px; height: 8px; border-radius: var(--pill); background: var(--c-hover); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--tan); }
.rank { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--c-accent-soft); color: var(--c-accent-text); font-weight: 700; font-size: 13px; }

/* ── Hub overview: every client ── */
.client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.client-card {
  display: flex; flex-direction: column; gap: 20px; padding: 24px;
  text-decoration: none; transition: border-color .2s, transform .2s;
}
.client-card:hover { border-color: var(--c-accent-border); transform: translateY(-2px); }
.client-card-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.client-card h4 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -0.02em; text-transform: uppercase; }
.arrow { display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%; background: var(--c-accent-soft); color: var(--c-accent-text); font-size: 18px; }
.client-card:hover .arrow { background: var(--tan); color: var(--ink); }
.client-stats { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.client-stats div { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--c-muted); }
.client-stats b { display: block; font-size: 28px; line-height: 1.1; letter-spacing: -0.03em; color: var(--c-text); }
.client-stats b.urgent { color: var(--c-urgent); }
.client-stats .known { display: block; text-transform: none; letter-spacing: 0; font-weight: 500; }
.updates { list-style: none; margin: 0; padding: 0; }
.updates li { display: flex; align-items: center; gap: 14px; padding: 14px 18px; font-size: 14px; }
.updates li + li { border-top: 1px solid var(--c-border); }
.updates .chip { min-width: 76px; text-align: center; }
.update-text { flex: 1; min-width: 0; }
.update-at { white-space: nowrap; font-size: 13px; }

/* ── Agency home ── */
.home-hero {
  display: flex; align-items: center; justify-content: space-between; gap: 28px; flex-wrap: wrap;
  padding: 30px 34px; margin-bottom: 28px;
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); backdrop-filter: blur(6px);
}
.home-hero h2 { margin: 6px 0 6px; font-size: clamp(32px, 4vw, 46px); font-weight: 600; line-height: 1.05; letter-spacing: -0.03em; text-transform: uppercase; }
.home-hero p { margin: 0; color: var(--c-muted); font-size: 17px; }
.home-hero p b { color: var(--c-text); }
.home-kpis { display: grid; grid-template-columns: repeat(4, auto); gap: 10px 34px; }
.home-kpis div { display: flex; flex-direction: column; }
.home-kpis b { font-size: 34px; font-weight: 600; line-height: 1.05; letter-spacing: -0.03em; }
.home-kpis span { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--c-muted); }
.home-kpis em { display: block; font-style: normal; font-weight: 500; letter-spacing: 0; text-transform: none; font-size: 12px; }
.home-kpis .off b { color: var(--c-muted); }
.home-block { margin-bottom: 36px; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 14px; }
.block-head h3 { margin: 0; }

/* Priorities */
.todo-list { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.todo {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 14px;
  padding: 14px 18px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 14px; backdrop-filter: blur(6px);
}
.todo.urgent { border-color: var(--c-urgent); color: var(--c-text); font-weight: inherit; } /* not the global .urgent text style */
.todo-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c-muted); }
.todo.urgent .todo-dot { background: var(--c-urgent); box-shadow: 0 0 0 4px var(--c-urgent-soft); }
.todo.soon .todo-dot { background: var(--c-accent); box-shadow: 0 0 0 4px var(--c-accent-soft); }
.todo-body { display: flex; flex-direction: column; min-width: 0; }
.todo-body b { font-size: 15px; }
.todo-body span { font-size: 13px; }
.todo-meta { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.todo .btn { white-space: nowrap; }
.todo-more summary { cursor: pointer; margin: 4px 0 10px; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--c-accent-text); list-style: none; }
.todo-more summary::-webkit-details-marker { display: none; }

/* Scorecard */
.score-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.score-card { padding: 18px 20px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); backdrop-filter: blur(6px); }
.score-card h4 { margin: 0 0 10px; font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--c-accent-text); }
.metric { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 10px; padding: 9px 0; border-top: 1px solid var(--c-border); }
.score-card h4 + .metric { border-top: 0; }
.metric span { font-size: 14px; color: var(--c-muted); }
.metric b { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; text-align: right; }
.metric small { grid-column: 1 / -1; font-size: 12px; color: var(--c-muted); }
.metric.off b, .metric.off span { color: var(--c-muted); opacity: .7; }
.metric.off small { font-style: italic; }
.metric.bad b { color: var(--c-urgent); }
.metric.warn b { color: var(--c-accent-text); }
.score-note { margin: 10px 0 0; font-size: 12px; color: var(--c-muted); line-height: 1.45; }
.channel-table table { width: 100%; }
.channel-table tr.off td { color: var(--c-muted); }
.ch-name { display: inline-flex; align-items: center; gap: 8px; }
.ch-name .icon { width: 16px; height: 16px; color: var(--c-accent-text); }

/* Client table (scales to many clients; no sideways scroll) */
.client-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.client-tools input[type="search"] { width: 220px; }
.seg { display: inline-flex; padding: 3px; border: 1px solid var(--c-border-strong); border-radius: var(--pill); background: var(--c-hover); }
.seg button { border: 0; background: none; color: var(--c-muted); font: 600 13px var(--font); padding: 6px 12px; border-radius: var(--pill); cursor: pointer; }
.seg button.on { background: var(--c-surface-solid); color: var(--c-text); box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.client-table { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); backdrop-filter: blur(6px); overflow: hidden; }
.ct-head, .ct-row { display: grid; grid-template-columns: minmax(0, 2fr) 1.3fr .7fr 1.1fr .8fr .6fr 1fr; gap: 14px; align-items: center; padding: 14px 18px; }
.ct-head { background: var(--c-surface-2); border-bottom: 1px solid var(--c-border); font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--c-muted); }
.ct-row { text-decoration: none; font-size: 14px; transition: background .15s; }
.ct-row + .ct-row { border-top: 1px solid var(--c-border); }
.ct-row:hover { background: var(--c-hover); }
.ct-name { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ct-name b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar-sm { display: grid; place-items: center; flex-shrink: 0; width: 32px; height: 32px; border-radius: 9px; background: var(--c-accent-soft); color: var(--c-accent-text); font-size: 12px; font-weight: 700; }
.ct-ch { display: flex; gap: 4px; flex-wrap: wrap; }
.ct-ch em { font-style: normal; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--c-border); color: var(--c-muted); opacity: .6; }
.ct-ch em.live { border-color: var(--c-accent-border); background: var(--c-accent-soft); color: var(--c-accent-text); opacity: 1; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--c-good); }
.status.urgent { color: var(--c-urgent); } .status.urgent::before { background: var(--c-urgent); }
.status.soon { color: var(--c-accent-text); } .status.soon::before { background: var(--c-accent); }
.status.ok { color: var(--c-good); }

/* ── Client overview: all channels ── */
.channel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.channel-card {
  display: flex; flex-direction: column; gap: 14px; padding: 26px 28px;
  text-decoration: none; transition: border-color .2s, transform .2s;
}
.channel-card:hover { border-color: var(--c-accent-border); transform: translateY(-2px); }
.channel-card.live { border-color: var(--c-accent-border); background: linear-gradient(150deg, var(--c-accent-soft), var(--c-surface) 55%); }
.channel-top { display: flex; align-items: center; gap: 14px; }
.channel-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--c-accent-soft); color: var(--c-accent-text); flex-shrink: 0; }
.channel-icon .icon { width: 22px; height: 22px; }
.channel-top h3 { margin: 0; font-size: 26px; letter-spacing: -0.02em; text-transform: none; }
.channel-top h3 small { display: block; font-size: 13px; font-weight: 500; color: var(--c-muted); letter-spacing: 0; }
.channel-top .chip { margin-left: auto; }
.channel-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.channel-stats div { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--c-muted); }
.channel-stats b { display: block; font-size: 24px; line-height: 1.1; letter-spacing: -0.02em; color: var(--c-text); }
.channel-stats b.urgent { color: var(--c-urgent); }
.channel-stats .sub { display: block; margin-top: 2px; text-transform: none; letter-spacing: 0; font-weight: 500; }
.channel-card p { margin: 0; color: var(--c-muted); font-size: 15px; }
.channel-card ul { margin: 0; padding-left: 18px; color: var(--c-muted); font-size: 14px; }
.channel-card ul li + li { margin-top: 4px; }
.channel-cta { margin-top: auto; font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--c-accent-text); }
.soon-list { margin: 0; padding-left: 20px; }
.soon-list li + li { margin-top: 8px; }

/* ── Channel dashboard (LSA) ── */
.hero-card { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding: 30px 34px; margin-bottom: 16px; }
.hero-card h2 { margin: 8px 0 6px; font-size: clamp(30px, 4vw, 44px); font-weight: 600; line-height: 1.05; letter-spacing: -0.03em; text-transform: uppercase; }
.hero-card p { margin: 0; color: var(--c-muted); font-size: 17px; }
.attn-stack { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.attn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: var(--pill);
  background: var(--c-urgent-soft); color: var(--c-urgent); font-weight: 600; font-size: 14px; text-decoration: none; white-space: nowrap;
}
.attn.ok { background: var(--c-good-soft); color: var(--c-good); }
.attn.warn { background: var(--c-warn-soft); color: var(--c-warn); }
.attn:hover { filter: brightness(1.08); }
.insight-strip {
  display: block; margin-bottom: 16px; padding: 24px 28px; text-decoration: none; border-radius: var(--radius);
  border: 1px solid var(--c-accent-border);
  background: linear-gradient(120deg, var(--c-accent-soft), var(--c-surface) 60%);
}
.insight-strip .kicker { color: var(--c-accent-text); }
.insight-strip .lede { margin: 8px 0 10px; }
.insight-strip .more { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--c-accent-text); }
.insight-strip:hover { border-color: var(--c-accent); }
.group-label { margin: 34px 0 14px; font-size: 13px; font-weight: 600; letter-spacing: 0.16em; color: var(--c-accent-text); }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.tile { text-decoration: none; transition: border-color .2s, transform .2s; }
.tile { display: flex; align-items: center; gap: 16px; padding: 20px 22px; min-height: 104px; }
.tile:hover { border-color: var(--c-accent-border); transform: translateY(-2px); }
.tile-icon { display: grid; place-items: center; flex-shrink: 0; border-radius: 50%; background: var(--c-accent-soft); color: var(--c-accent-text); }
.tile-icon { width: 46px; height: 46px; }
.tile-icon .icon { width: 20px; height: 20px; }
.tile-body { flex: 1; min-width: 0; }
.tile-body b { display: block; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
.tile-body span { display: block; margin-top: 4px; font-size: 14px; color: var(--c-muted); line-height: 1.35; }
.tile-arrow { color: var(--c-accent-text); font-size: 18px; }

/* Caller quotes that open their call in the Lead feed: same look as a quote, just underlined.
   td a.quote-link beats the "td a" pill-button rule for links in tables. */
.quote-link, td a.quote-link {
  display: block; margin: 6px 0; padding: 0 0 0 10px; border-radius: 0; background: none;
  border-left: 3px solid var(--tan);
  color: inherit; font-size: 13px; font-weight: 400; font-style: italic; text-transform: none;
  text-decoration: underline; text-decoration-color: var(--c-border-strong); text-underline-offset: 3px;
  cursor: pointer; transition: text-decoration-color .15s;
}
.quote-link:hover, td a.quote-link:hover { background: none; text-decoration-color: var(--c-accent-text); }
mark { background: rgba(219, 179, 143, 0.45); color: inherit; padding: 0 2px; border-radius: 3px; }

/* Lead feed: fits the screen (no sideways scroll); each call expands */
.feed { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); backdrop-filter: blur(6px); overflow: hidden; }
.feed-head, .feed-main { display: grid; grid-template-columns: 1.15fr 1fr 1.8fr 1fr 1.45fr auto; gap: 16px; padding: 14px 18px; }
.feed-head { background: var(--c-surface-2); border-bottom: 1px solid var(--c-border); font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--c-muted); }
.feed-main { font-size: 14px; align-items: start; }
.feed-main > div { min-width: 0; overflow-wrap: anywhere; }
.feed-row + .feed-row { border-top: 1px solid var(--c-border); }
.feed-row:hover { background: var(--c-hover); }
.feed-row.focus { box-shadow: inset 3px 0 0 var(--c-accent); }
.feed-action { justify-self: end; }
.feed-detail { display: none; padding: 4px 18px 22px; }
.feed-row.open .feed-detail { display: block; }
.feed-row.open { background: var(--c-hover); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; padding: 20px 22px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 14px; }
.detail-grid h4 { margin: 18px 0 6px; font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--c-accent-text); }
.detail-main > h4:first-child, .detail-side h4 { margin-top: 0; }
.detail-side { display: flex; flex-direction: column; gap: 18px; }
.detail-grid p { margin: 0 0 6px; }
.detail-grid ul { margin: 0; padding-left: 18px; }
.detail-grid li + li { margin-top: 4px; }
.detail-grid blockquote { margin: 0; padding: 4px 0 4px 12px; border-left: 3px solid var(--tan); font-style: italic; }
.clicked-quote { margin-bottom: 18px; padding: 14px 16px; border-radius: 12px; background: var(--c-accent-soft); border: 1px solid var(--c-accent-border); }
.clicked-quote p { margin: 6px 0 0; font-size: 18px; font-weight: 600; font-style: italic; }
.facts { list-style: none; padding: 0 !important; }
.facts li { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.facts span { color: var(--c-muted); }
.transcript { max-height: 360px; overflow-y: auto; padding: 12px 14px; border-radius: 10px; background: var(--c-surface-2); border: 1px solid var(--c-border); font-size: 14px; }

/* Lead feed: one-paragraph call summary */
.call-summary { font-size: 15px; line-height: 1.6; }

/* Locations & times: stacked outcome bars, legends, heat matrices */
.page-actions { display: flex; justify-content: flex-end; margin: -12px 0 16px; }
.page-actions .btn .icon { width: 15px; height: 15px; }
.stack { display: flex; width: 160px; height: 10px; border-radius: var(--pill); overflow: hidden; background: var(--c-hover); }
.stack i { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 10px; font-size: 12px; color: var(--c-muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
table.matrix { width: 100%; }
table.matrix th small { display: block; font-weight: 500; letter-spacing: 0; text-transform: none; }
table.matrix td.cell { text-align: center; background: color-mix(in srgb, var(--tan) calc(var(--heat, 0) * 55%), transparent); }
table.matrix td.cell b { display: block; font-size: 16px; }
table.matrix td.cell small { display: block; font-size: 11px; color: var(--c-muted); }
table.matrix td.empty { color: var(--c-muted); opacity: .5; }

/* Monthly reports: month list + printable report */
.report-months { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-bottom: 12px; }
.report-month { display: flex; align-items: center; gap: 14px; padding: 18px 20px; text-decoration: none; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 14px; transition: border-color .2s; }
.report-month:hover { border-color: var(--c-accent-border); }
.report-month > span:nth-child(2) { flex: 1; min-width: 0; }
.report-month b { display: block; font-size: 17px; }
.report-month small { display: block; font-size: 13px; color: var(--c-muted); }
.report-month-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--c-accent-soft); color: var(--c-accent-text); flex-shrink: 0; }
.report-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.report-toolbar .btn .icon { width: 15px; height: 15px; }
.print-doc { max-width: 900px; padding: 44px 48px; background: var(--c-doc); color: var(--c-doc-text); border-radius: var(--radius); border: 1px solid var(--c-border); }
.print-doc .muted, .print-doc .kicker { color: #6d675f; }
.print-doc section { margin-top: 30px; break-inside: avoid; }
.print-doc h2 { margin: 0 0 12px; padding-bottom: 6px; border-bottom: 1px solid rgba(38,38,38,.15); font-size: 17px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; }
.print-doc h3 { margin: 12px 0 6px; font-size: 14px; font-weight: 700; text-transform: none; letter-spacing: 0; }
.print-doc ul, .print-doc ol { margin: 0; padding-left: 20px; }
.print-doc li + li { margin-top: 4px; }
.rep-cover { display: flex; align-items: center; gap: 28px; padding-bottom: 22px; border-bottom: 3px solid var(--tan); }
.rep-logo { height: 54px; filter: invert(1); }
.rep-cover h1 { margin: 4px 0; font-size: 34px; letter-spacing: -0.02em; text-transform: uppercase; }
.rep-cover p { margin: 0; color: #6d675f; }
.rep-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.rep-kpis div { padding: 12px 14px; border-radius: 10px; background: rgba(38,38,38,.05); }
.rep-kpis b { display: block; font-size: 26px; letter-spacing: -0.02em; }
.rep-kpis span { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: #6d675f; }
.rep-kpis small { text-transform: none; letter-spacing: 0; font-weight: 500; }
.rep-kpis em { display: block; font-style: normal; font-size: 12px; color: #6d675f; }
.rep-kpis em.up { color: #2f6b2a; } .rep-kpis em.down { color: #b83a2a; }
.rep-lede { font-size: 19px; font-weight: 600; line-height: 1.35; }
.rep-two { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.rep-top { list-style: none; padding: 0 !important; counter-reset: rep; }
.rep-top li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid rgba(38,38,38,.12); counter-increment: rep; }
.rep-top li b::before { content: counter(rep) '. '; color: #9a7350; }
.rep-top span { color: #6d675f; font-size: 14px; text-align: right; }
.rep-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rep-table th, .rep-table td { padding: 7px 8px; border-bottom: 1px solid rgba(38,38,38,.12); text-align: left; background: none; color: inherit; max-width: none; }
.rep-table th { font-size: 11px; color: #6d675f; }
.print-doc .legend { color: #6d675f; }
.print-doc .stack { background: rgba(38,38,38,.08); }
.rep-foot { margin-top: 34px; padding-top: 14px; border-top: 1px solid rgba(38,38,38,.15); font-size: 12px; color: #6d675f; }
.rep-foot h2 { border: 0; font-size: 12px; margin-bottom: 4px; }

/* Print: only the report, on white paper */
@media print {
  @page { margin: 14mm; }
  html, body { background: #fff !important; background-image: none !important; color: #111; }
  main, .side-inner-max { margin: 0 !important; padding: 0 !important; max-width: none !important; }
  .topbar, .side, .side-mobile-btn, .page-toolbar, .no-print, .sub-head { display: none !important; }
  body.with-sidebar main { margin: 0 !important; padding: 0 !important; }
  .side-inner-max { max-width: none; }
  .print-doc { max-width: none; padding: 0; border: 0; border-radius: 0; background: #fff; color: #111; }
  .print-doc section { break-inside: avoid; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ── Chat ── */
.icon-btn.chat-btn { text-decoration: none; }
.chat-wrap { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; min-height: calc(100vh - 160px); }
.chat-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.chat-head h2 { margin: 6px 0 4px; font-size: clamp(28px, 4vw, 40px); letter-spacing: -0.03em; text-transform: uppercase; }
.chat-head p { margin: 0; }
.chat-scope { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--c-muted); }
.chat-log { flex: 1; display: flex; flex-direction: column; gap: 14px; padding: 18px; min-height: 340px; max-height: calc(100vh - 360px); overflow-y: auto;
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); backdrop-filter: blur(6px); }
.chat-empty { margin: auto; text-align: center; color: var(--c-muted); }
.chat-empty .icon { width: 34px; height: 34px; color: var(--c-accent-text); }
.chat-suggest { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 640px; margin-top: 8px; }
.chat-chip { padding: 8px 14px; border-radius: var(--pill); border: 1px solid var(--c-border-strong); background: var(--c-hover); color: var(--c-text); font: 500 13px var(--font); cursor: pointer; }
.chat-chip:hover { border-color: var(--c-accent); }
.msg { display: flex; flex-direction: column; gap: 4px; max-width: 80%; }
.msg.user { align-self: flex-end; align-items: flex-end; }
.msg-who { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--c-muted); }
.msg-body { padding: 12px 16px; border-radius: 16px; font-size: 15px; line-height: 1.55; background: var(--c-surface-solid); border: 1px solid var(--c-border); }
.msg.user .msg-body { background: var(--tan); color: var(--ink); border-color: var(--tan); border-bottom-right-radius: 4px; }
.msg.assistant .msg-body { border-bottom-left-radius: 4px; }
.msg.pending .msg-body { color: var(--c-muted); font-style: italic; }
/* "Hub is typing": three dots that rise in turn while the answer is on its way */
.typing { display: inline-flex; align-items: center; gap: 5px; height: 18px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--c-muted); animation: typing 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-5px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .typing i { animation: none; opacity: .7; } }
.msg.offline .msg-body { background: var(--c-warn-soft); color: var(--c-warn); border-color: transparent; }
.msg-src { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.msg-src a, .msg-src span { font-size: 12px; padding: 2px 8px; border-radius: var(--pill); background: var(--c-hover); color: var(--c-accent-text); text-decoration: none; }
.chat-form { display: flex; gap: 10px; align-items: flex-end; margin-top: 12px; }
.chat-form textarea {
  flex: 1; resize: none; min-height: 48px; max-height: 200px; padding: 13px 18px; border-radius: 22px;
  border: 1px solid var(--c-border-strong); background: var(--c-surface); color: var(--c-text); font: 500 15px var(--font);
}
.chat-form textarea:focus { outline: 2px solid var(--c-accent); outline-offset: 1px; }
.chat-form .btn { width: 48px; height: 48px; padding: 0; border-radius: 50%; }
.chat-form .btn .icon { width: 18px; height: 18px; }
.chat-foot { margin: 6px 0 0 18px; }

/* Rating queue + test lead */
.approve-cell { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rating-select { padding: 7px 14px; }
.test-lead-form { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 24px; }
.test-lead-form input { flex: 1 1 240px; max-width: 360px; }
.test-lead-form .check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--c-muted); }
.test-lead-form .check input { flex: none; }
#delete-status ul { margin: 8px 0 12px; padding-left: 20px; }

/* Back button: top-left of the page (left end of the toolbar on LSA pages) */
.page-back { margin-bottom: 18px; }
.page-toolbar .back-btn { margin-right: auto; }
.back-btn .icon { width: 15px; height: 15px; }

/* "X of Y known" under every booked rate: hover / focus / tap for what "known" means */
.known-tip { text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }
.known-tip:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; border-radius: 3px; }
.known-note { position: fixed; z-index: 80; max-width: 300px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--c-border-strong);
  background: var(--c-surface-solid); color: var(--c-text); box-shadow: var(--c-shadow);
  font-size: 13px; font-weight: 500; line-height: 1.45; letter-spacing: 0; text-transform: none; pointer-events: none; }
.known-note[hidden] { display: none; }

/* Phrases that book: "What does known mean?" dropdown under the intro */
.known-help { max-width: 760px; margin: -6px 0 22px; padding: 12px 16px; border: 1px solid var(--c-border); border-radius: var(--radius); background: var(--c-surface); }
.known-help summary { cursor: pointer; font-weight: 600; color: var(--c-accent-text); }
.known-help p { margin: 10px 0 0; font-size: 14px; line-height: 1.55; }

/* Dashboard KPI cards that open the page where the number is reviewed */
a.card-link { text-decoration: none; transition: border-color .2s, transform .2s; }
a.card-link:hover { border-color: var(--c-accent-border); transform: translateY(-2px); }
a.card-link.hot:hover { border-color: var(--c-urgent); }
a.card-link:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }

/* Chat bubble (bottom-right on the LSA dashboard and its pages) */
.chat-bubble { position: fixed; right: 24px; bottom: 24px; z-index: 60; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.chat-bubble[hidden] { display: none; }
.bubble-btn { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--tan); background: var(--tan); color: var(--ink);
  box-shadow: var(--c-shadow); cursor: pointer; transition: transform .2s; }
.bubble-btn:hover { transform: translateY(-2px); }
.bubble-btn .icon { width: 24px; height: 24px; }
.chat-bubble.open .bubble-btn { background: var(--c-surface-solid); color: var(--c-accent-text); border-color: var(--c-accent-border); }
.bubble-panel { width: min(380px, calc(100vw - 32px)); height: min(560px, calc(100vh - 140px)); display: flex; flex-direction: column; padding: 14px;
  background: var(--c-surface-solid); border: 1px solid var(--c-border-strong); border-radius: var(--radius); box-shadow: var(--c-shadow); }
.bubble-panel[hidden] { display: none; }
.bubble-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 2px 4px 12px; }
.bubble-close { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--c-border); background: transparent; color: var(--c-text); cursor: pointer; }
.bubble-close:hover { border-color: var(--c-accent); }
.bubble-close .icon { width: 16px; height: 16px; }
.bubble-log { min-height: 0; max-height: none; padding: 12px; }
.bubble-log .msg { max-width: 92%; }
.bubble-log .msg-body { font-size: 14px; padding: 10px 13px; }
.bubble-log .chat-chip { font-size: 12px; }
.bubble-form { margin-top: 10px; }
.bubble-form .btn { width: 42px; height: 42px; }
.bubble-foot { margin: 8px 4px 0; }
@media (max-width: 760px) { .chat-bubble { right: 16px; bottom: 16px; } }
@media print { .chat-bubble { display: none !important; } }

/* Lead feed: tools row (needs a rating / spam), spam list, rating, transcript */
.feed-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 14px; }
.spam-feed { margin-bottom: 18px; border-style: dashed; }
.feed-rate { margin-top: 10px; }
.feed-rate .rating-select { max-width: 100%; }
.transcript-box { margin-top: 10px; }
.transcript .speaker { margin-right: 4px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; color: var(--c-muted); }

/* Demo · Import a month */
.demo-form { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin: 16px 0 20px; }
.demo-form .check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--c-muted); }
.demo-progress { height: 10px; max-width: 560px; margin: 10px 0; border-radius: var(--pill); background: var(--c-hover); overflow: hidden; }
.demo-progress i { display: block; height: 100%; background: var(--tan); transition: width 0.4s; }
.demo-active { list-style: none; padding: 0; margin: 8px 0 16px; font-size: 14px; }
.demo-active li::before { content: '● '; color: var(--tan); }
.week-report + .week-report { margin-top: 32px; }
.call-audio { width: 100%; max-width: 420px; margin: 4px 0 10px; }

/* Weekly client report: a paper document in both modes (it gets sent to the client) */
.report-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.client-report { max-width: 760px; padding: 36px 40px; background: var(--c-doc); color: var(--c-doc-text); border-radius: var(--radius); border: 1px solid var(--c-border); box-shadow: inset 0 1px 0 rgba(255,255,255,.4); }
.client-report .kicker, .client-report .muted { color: #6d675f; }
.client-report h3 { margin: 8px 0 14px; font-size: 28px; text-transform: none; letter-spacing: -0.02em; }
.client-report h4 { margin: 24px 0 8px; font-size: 13px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: #9a7350; }
.client-report ol, .client-report ul { margin: 0; padding-left: 22px; }
.client-report li + li { margin-top: 6px; }

/* ══ Sidebar (logic + measurements from the reference build; Studio 61 colors) ══
   240px expanded / 64px rail, fixed; content shifts with a 200ms margin transition.
   Rows 36px high, 4px apart. Groups open with a 0.2s height animation. */
body.with-sidebar .topbar { display: none; }
body.with-sidebar main { max-width: none; margin: 0 0 0 var(--sidebar-w); padding: 28px 44px 72px; transition: margin-left .2s; }
body.side-collapsed { --sidebar-w: 64px; }
.side-inner-max { max-width: 1280px; margin: 0 auto; } /* centered in the space beside the sidebar, open or collapsed */

.side {
  position: fixed; inset: 0 auto 0 0; z-index: 40;
  display: flex; flex-direction: column; overflow-y: auto;
  width: 260px; padding-bottom: 20px;
  background: var(--s-bg); border-right: 1px solid var(--s-border);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
}
.side-rail { width: 64px; align-items: center; display: none; }
body.side-collapsed .side-full { display: none; }
body.side-collapsed .side-rail { display: flex; }
.slide-in { animation: side-slide .4s cubic-bezier(.22, 1, .36, 1); }
@keyframes side-slide { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: none; } }

.side-head { display: flex; align-items: center; gap: 10px; margin: 24px 16px 20px; padding-bottom: 20px; border-bottom: 1px solid var(--s-border); }
.side-mark {
  display: grid; place-items: center; flex-shrink: 0; width: 34px; height: 34px; border-radius: 8px;
  background: var(--tan); color: var(--ink); font-size: 12px; font-weight: 700; text-decoration: none;
}
.side-app { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 15px; font-weight: 600; color: var(--s-strong); }
.side-app span { color: var(--s-text); font-weight: 500; }
.side-btn {
  display: grid; place-items: center; width: 26px; height: 26px; border: 0; border-radius: 6px;
  background: none; color: var(--s-text); cursor: pointer;
}
.side-btn:hover { background: var(--s-hover); color: var(--s-strong); }
.side-btn .icon { width: 16px; height: 16px; }
.side-pad { display: flex; flex-direction: column; gap: var(--row-gap); padding: 0 10px; }
.side-divider { margin: 16px 16px; border-top: 1px solid var(--s-border); }

.side-row, .side-child {
  display: flex; align-items: center; gap: 12px; width: 100%; height: var(--row-h);
  border: 0; border-radius: 8px; background: none; cursor: pointer;
  font-family: var(--font); text-align: left; text-decoration: none; color: var(--s-text);
  transition: background-color .15s, color .15s;
}
.side-row { padding: 0 12px; font-size: 16.5px; font-weight: 600; border-radius: 10px; }
.side-row.depth-1 { padding-left: 40px; font-size: 15px; font-weight: 500; }
.side-row.depth-2 { padding-left: 62px; font-size: 15px; font-weight: 500; }
.side-row .icon { width: 18px; height: 18px; color: var(--s-icon); }
.side-row:hover { color: var(--s-strong); background: var(--s-hover); }
.side-row:hover .icon { color: var(--s-icon-hover); }
.side-row.active { color: var(--s-strong); background: var(--s-active); }
.side-row.active .icon { color: var(--s-strong); }
.side-row-label { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.side-child { padding: 0 12px 0 40px; font-size: 15px; font-weight: 500; border-radius: 10px; }
.side-child.depth-2 { padding-left: 62px; }
.side-child:hover { color: var(--s-icon-hover); background: var(--s-hover); }
.side-child.active { color: var(--s-strong); background: var(--s-active-child); }
.side-chevron { width: 15px !important; height: 15px !important; color: var(--s-text) !important; transition: transform .15s; }
.side-group.open > .side-row-wrap .side-chevron, .side-group.open > .side-row .side-chevron { transform: rotate(90deg); }
/* Row with its own page: the link navigates, the chevron (a separate button) only toggles */
.side-row-wrap { position: relative; }
.side-row-wrap > .side-row { padding-right: 40px; }
.side-row-wrap > .side-toggle {
  position: absolute; right: 10px; top: calc((var(--row-h) - 24px) / 2); width: 24px; height: 24px;
  display: grid; place-items: center; border: 0; padding: 0; border-radius: 5px; background: none; cursor: pointer;
}
.side-row-wrap > .side-toggle:hover { background: var(--s-hover); }
.side-children { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .2s, opacity .2s; }
.side-group.open > .side-children { grid-template-rows: 1fr; opacity: 1; }
.side-children-inner { overflow: hidden; display: flex; flex-direction: column; gap: var(--row-gap); }
.side-group.open > .side-children > .side-children-inner { padding-top: var(--row-gap); }
.side-group { display: flex; flex-direction: column; }
/* Tree lines: a vertical line down each group and a rounded elbow into every row (leaf or nested group).
   Rows are 36px tall with 4px gaps; --tree-x lines up under the parent's icon. */
.side-children-inner { --tree-x: 21px; }
.side-children-inner .side-children-inner { --tree-x: 46px; }
.side-children-inner > * { position: relative; }
.side-children-inner > *::before {
  content: ''; position: absolute; left: var(--tree-x); top: calc(-1 * var(--row-gap)); width: 11px; height: calc(var(--row-gap) + var(--row-h) / 2);
  border-left: 1px solid var(--s-line); border-bottom: 1px solid var(--s-line); border-bottom-left-radius: 8px;
  pointer-events: none;
}
.side-children-inner > *:not(:last-child)::after {
  content: ''; position: absolute; left: var(--tree-x); top: calc(var(--row-h) / 2); bottom: calc(-1 * var(--row-gap));
  border-left: 1px solid var(--s-line); pointer-events: none;
}
.side-badge { font-style: normal; font-size: 12px; font-weight: 600; min-width: 22px; text-align: center; padding: 1px 7px; border-radius: var(--pill); color: var(--s-text); }
.side-badge.hot { background: #c0392b; color: #fff; }
.side-badge.warn { background: var(--tan); color: var(--ink); }
.side-spacer { flex-grow: 1; }

/* Rail: top-level destinations only */
.side-rail-head { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 20px 0 12px; margin-bottom: 12px; border-bottom: 1px solid var(--s-border); width: 100%; }
.side-rail-items { display: flex; flex-direction: column; gap: 4px; padding: 0 8px; }
.side-rail-item {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; border: 0; background: none; cursor: pointer;
  color: var(--s-icon); text-decoration: none; transition: background-color .15s;
}
.side-rail-item .icon { width: 16px; height: 16px; }
.side-rail-item:hover { background: var(--s-hover); color: var(--s-icon-hover); }
.side-rail-item.active { background: var(--s-active); color: var(--s-strong); }

/* Mobile: hamburger + slide-in overlay */
.side-mobile-btn {
  display: none; position: fixed; left: 16px; top: 16px; z-index: 50;
  width: 36px; height: 36px; place-items: center; border-radius: 8px;
  background: var(--s-bg); border: 1px solid var(--s-border); color: var(--s-strong); cursor: pointer;
}

/* ── Map ── */
.icon-btn.map-btn { text-decoration: none; }
.icon-btn.on { border-color: var(--c-accent); color: var(--c-accent-text); background: var(--c-accent-soft); }
body.map-view main { max-width: none; padding: 0; }
.map-wrap { position: relative; height: calc(100vh - 71px); min-height: 480px; }
#map { position: absolute; inset: 0; background: var(--c-bg); }
.map-panel, .map-jump, .map-level { position: absolute; z-index: 500; }
.map-panel {
  top: 16px; left: 16px; width: 300px; max-height: calc(100% - 32px); overflow-y: auto;
  padding: 18px; border-radius: 16px; border: 1px solid var(--c-border-strong);
  background: color-mix(in srgb, var(--c-surface-solid) 88%, transparent); backdrop-filter: blur(12px);
  box-shadow: var(--c-shadow);
}
.map-panel h4 { margin: 16px 0 8px; display: flex; justify-content: space-between; align-items: center; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--c-accent-text); }
.map-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.map-stats b { display: block; font-size: 24px; letter-spacing: -0.02em; }
.map-stats span { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--c-muted); }
.map-stats em { display: block; font-style: normal; text-transform: none; letter-spacing: 0; font-weight: 500; }
.svc-list { display: flex; flex-wrap: wrap; gap: 6px; }
.svc { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: var(--pill); border: 1px solid var(--c-border-strong); background: none; color: var(--c-muted); font: 500 12px var(--font); cursor: pointer; }
.svc i, .map-top i, .map-pop-list i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.svc.on { color: var(--c-text); border-color: var(--c-accent-border); background: var(--c-hover); }
.svc:not(.on) i { opacity: .3; }
.link-btn { border: 0; background: none; color: var(--c-muted); font: 600 11px var(--font); letter-spacing: .06em; text-transform: uppercase; cursor: pointer; }
.map-check { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 14px; }
.map-check input { width: auto; padding: 0; accent-color: var(--tan); }
.map-top { list-style: none; margin: 0; padding: 0; }
.map-top li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; font-size: 14px; border-top: 1px solid var(--c-border); }
.map-top li:first-child { border-top: 0; }
.map-top span { display: inline-flex; align-items: center; gap: 8px; }
.map-warn { margin: 14px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--c-warn-soft); color: var(--c-warn); font-size: 12px; line-height: 1.45; }
.map-jump { top: 16px; right: 16px; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.map-jump .btn { background: color-mix(in srgb, var(--c-surface-solid) 85%, transparent); backdrop-filter: blur(8px); }
.map-level { left: 50%; bottom: 26px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: var(--pill); font-size: 13px;
  background: color-mix(in srgb, var(--c-surface-solid) 88%, transparent); border: 1px solid var(--c-border-strong); backdrop-filter: blur(8px); max-width: calc(100% - 32px); }
.fl-pin span { display: inline-block; white-space: nowrap; transform: translate(-50%, -50%); padding: 8px 14px; border-radius: var(--pill); background: var(--tan); color: var(--ink); font: 700 13px var(--font); box-shadow: 0 0 0 8px rgba(219,179,143,.3); cursor: pointer; }
/* Leaflet controls + popups in the hub theme */
/* .leaflet-container prefix: Leaflet's own CSS loads after ours, so match it with higher specificity */
.leaflet-container { font-family: var(--font); }
.leaflet-container .leaflet-popup-content-wrapper, .leaflet-container .leaflet-popup-tip { background: var(--c-surface-solid); color: var(--c-text); box-shadow: var(--c-shadow); }
.leaflet-container .leaflet-popup-content-wrapper { border-radius: 12px; border: 1px solid var(--c-border-strong); }
.leaflet-container .leaflet-popup-content { margin: 12px 14px; font-size: 13px; line-height: 1.5; }
.leaflet-container .leaflet-popup-content a { color: var(--c-accent-text); font-weight: 600; text-decoration: none; }
.leaflet-container a.leaflet-popup-close-button { color: var(--c-muted); }
.leaflet-container .leaflet-control-attribution { background: color-mix(in srgb, var(--c-surface-solid) 80%, transparent); color: var(--c-muted); }
.leaflet-container .leaflet-control-attribution a { color: var(--c-muted); }
.map-pop-list { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.map-pop-list span { display: inline-flex; align-items: center; gap: 6px; }
.leaflet-container .leaflet-bar a { background: var(--c-surface-solid); color: var(--c-text); border-color: var(--c-border); }
.leaflet-container .leaflet-bar a:hover { background: var(--c-hover); }
/* Street tiles follow the theme: dimmed and inverted in dark mode */
:root:not([data-theme="light"]) .street-tiles { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9) saturate(.6); }
.leaflet-bottom.leaflet-right .leaflet-control-zoom { margin-bottom: 36px; }
.leaflet-container .leaflet-tooltip { background: var(--c-surface-solid); color: var(--c-text); border-color: var(--c-border-strong); }
@media (max-width: 767px) {
  .map-wrap { height: calc(100vh - 120px); }
  .map-panel { top: auto; bottom: 12px; left: 12px; right: 12px; width: auto; max-height: 42%; }
  .map-level { bottom: auto; top: 108px; left: 12px; right: 12px; transform: none; font-size: 12px; } /* below the two rows of jump buttons */
}

/* ── Login (always dark, brand hero) ── */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px; color: var(--white);
  background:
    radial-gradient(ellipse 60% 55% at 12% 8%, rgba(150, 104, 66, 0.30), transparent 70%),
    radial-gradient(ellipse 55% 50% at 100% 100%, rgba(150, 104, 66, 0.24), transparent 70%),
    #141414;
}
.login-box { width: 100%; max-width: 380px; text-align: center; }
.login-box img { height: 72px; margin-bottom: 28px; }
.login-box h1 { margin: 0 0 8px; font-size: 40px; font-weight: 600; letter-spacing: -0.03em; text-transform: uppercase; }
.login-box p { margin: 0 0 28px; color: var(--stone); }
.login-box input, .login-box button { width: 100%; margin-top: 12px; padding: 14px 22px; font-size: 16px; }
.login-box input { background: rgba(255, 255, 255, 0.08); border-color: var(--line-dark); color: var(--white); }
.login-box .err { color: #f1a596; }

/* ── Responsive ── */
@media (max-width: 1200px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1200px) {
  .score-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .ct-head { display: none; }
  .ct-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ct-row .ct-name { grid-column: 1 / -1; }
  .ct-row > span[data-label]::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--c-muted); }
  .todo { grid-template-columns: auto minmax(0, 1fr); }
  .todo-meta, .todo .btn { grid-column: 2; justify-self: start; }
  /* Lead feed: two-line rows on mid widths, still no sideways scroll */
  .feed-head { display: none; }
  .feed-main { grid-template-columns: 1fr 1fr 1fr; }
  .feed-main > div::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--c-muted); margin-bottom: 2px; }
  .feed-action { grid-column: 1 / -1; justify-self: start; }
}
@media (max-width: 900px) {
  .channel-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 767px) {
  .topbar { padding: 14px 16px; }
  .controls { margin-left: 0; width: 100%; }
  main { padding: 28px 16px 56px; }
  .card b { font-size: 34px; }
  .tiles { grid-template-columns: 1fr; }
  .client-grid { grid-template-columns: 1fr; }
  .updates li { flex-wrap: wrap; gap: 6px 10px; }
  .update-text { flex-basis: 100%; order: 3; }
  .attn-stack { align-items: flex-start; }
  .hero-card, .client-report { padding: 24px; }
  .channel-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rep-kpis { grid-template-columns: repeat(2, 1fr); }
  .rep-two { grid-template-columns: 1fr; }
  .print-doc { padding: 24px 20px; }
  .rep-cover { flex-direction: column; align-items: flex-start; gap: 12px; }
  .msg { max-width: 92%; }
  .stack { width: 110px; }
  .score-grid { grid-template-columns: 1fr; }
  .home-kpis { grid-template-columns: repeat(2, auto); }
  .ct-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .client-tools input[type="search"] { width: 100%; }
  .channel-table th:nth-child(5), .channel-table td:nth-child(5), .channel-table th:nth-child(2), .channel-table td:nth-child(2) { display: none; }
  .feed-main { grid-template-columns: 1fr; gap: 10px; }
  /* sidebar becomes an overlay; content uses the full width */
  body.with-sidebar main { margin-left: 0; padding: 68px 16px 56px; }
  .side-mobile-btn { display: grid; }
  .side-full, body.side-collapsed .side-full, .side-rail, body.side-collapsed .side-rail { display: none; }
  body.side-mobile-open .side-full { display: flex; box-shadow: var(--c-shadow); background: var(--s-bg-overlay); }
  .side-full .side-head { margin-left: 60px; }   /* room for the hamburger, which stays on top */
  .side-full .side-collapse { display: none; }   /* collapsing is desktop-only */
}
