:root { --bg:#17191f; --panel:#23262e; --panel2:#1e2129; --text:#eef0f4; --muted:#9aa1af; --accent:#3b82f6; --accent2:#2f7df6; --green:#22c55e; --blue:#3b82f6; --red:#ef4444; --border:#2d323d; --sidebar:#0d0f14; }
* { box-sizing:border-box; }
body { margin:0; font-family:Inter,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif; background:var(--bg); color:var(--text); font-size:14px; line-height:1.5; }
header { padding:20px 24px 8px; }
header h1 { margin:0; font-size:26px; }
main h2 { font-size:20px; font-weight:700; margin:4px 0 12px; }
main h3 { font-size:15px; font-weight:600; margin:18px 0 8px; }
.sub { color:var(--muted); margin:4px 0; }
.health { font-size:13px; color:var(--muted); }
nav { display:flex; flex-wrap:wrap; gap:8px; padding:12px 24px; border-bottom:1px solid var(--border); }
nav button { background:var(--panel); color:var(--text); border:1px solid var(--border); border-radius:8px; padding:8px 14px; cursor:pointer; font-size:14px; }
nav button.active { border-color:var(--accent); color:var(--accent); }
nav button:disabled { opacity:.45; cursor:not-allowed; }
main { padding:20px 24px; }
.screen { display:none; }
.screen.active { display:block; }
input[type=text] { width:100%; max-width:520px; padding:11px 14px; border-radius:8px; border:1px solid var(--border); background:var(--panel2); color:var(--text); font-size:14px; }
textarea { width:100%; max-width:520px; padding:11px 14px; border-radius:8px; border:1px solid var(--border); background:var(--panel2); color:var(--text); font-size:14px; font-family:inherit; margin-top:8px; resize:vertical; }
input[type=text]:focus, textarea:focus, select:focus { outline:none; border-color:var(--accent); box-shadow:0 0 0 2px rgba(59,130,246,.25); }
button { background:var(--accent2); color:#fff; border:none; border-radius:8px; padding:10px 18px; cursor:pointer; font-size:14px; font-weight:600; margin-top:8px; }
button:hover { background:#2a6fe0; }
button:disabled { opacity:.45; cursor:not-allowed; }
button:disabled:hover { background:var(--accent2); }
.hint { color:var(--muted); font-size:13px; }
.placeholder { color:var(--muted); }
footer { padding:16px 24px; color:var(--muted); font-size:12px; border-top:1px solid var(--border); }
.score { font-size:32px; font-weight:700; }
.band-excellent { color:var(--green); } .band-good { color:var(--blue); } .band-fair { color:var(--red); }
.band-strong { color:var(--blue); } .band-decent { color:#e8a33d; } .band-weak { color:var(--red); }
.check { display:flex; flex-wrap:wrap; gap:4px 10px; align-items:baseline; background:var(--panel); border:1px solid var(--border); border-radius:12px; padding:12px 14px; margin:8px 0; }
.check .pts { font-weight:700; margin-left:auto; }
.check.pass .pts { color:var(--green); } .check.fail .pts { color:var(--red); }
.check .hint { flex-basis:100%; }
.result { background:var(--panel); border:1px solid var(--border); border-radius:12px; padding:14px 16px; margin:10px 0; }
.tag { display:inline-block; padding:4px 12px; border-radius:999px; margin:4px; font-size:13px; }
.tag.green { background:#123524; color:#5eeaa0; } .tag.blue { background:#12283d; color:#7cc0ff; } .tag.red { background:#3d1214; color:#ff8a8e; }
.stat-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(180px, 1fr)); gap:10px; margin-top:10px; }
.stat { background:var(--panel); border:1px solid var(--border); border-radius:10px; padding:12px; display:flex; flex-direction:column; gap:2px; }
.stat b { font-size:18px; }
.badge-outlier { display:inline-block; background:#3d2c12; color:#ffcf5c; border-radius:6px; padding:2px 8px; font-size:12px; font-weight:700; margin-right:6px; }
.health.connected { color:var(--green); }
.chip { background:var(--panel2); color:var(--text); border:1px solid var(--border); border-radius:999px; padding:6px 14px; font-size:13px; margin:4px 4px 4px 0; cursor:pointer; }
.chip:hover { border-color:var(--accent); color:var(--accent); }
.chip.active { border-color:var(--accent); color:var(--accent); background:rgba(59,130,246,.12); }

/* --- Phase 4: VidIQ-style layout ------------------------------------ */
.app { display:flex; min-height:100vh; }
.sidebar { width:250px; min-width:250px; flex:0 0 250px; background:var(--sidebar); border-right:1px solid var(--border); padding:14px 12px; display:flex; flex-direction:column; gap:2px; position:sticky; top:0; height:100vh; overflow-y:auto; overflow-x:hidden; scrollbar-width:thin; }
.sidebar .brand h1 { font-size:20px; margin:0; font-weight:700; }
.sidebar .brand .sub { margin:2px 0 8px; }
.sidebar .health { font-size:12px; margin:2px 0; }
#tabs { display:flex; flex-direction:column; gap:2px; padding:0; border-bottom:none; }
#tabs button { background:transparent; color:var(--text); border:1px solid transparent; border-radius:8px; padding:10px 12px; cursor:pointer; font-size:14px; font-weight:500; text-align:left; margin-top:0; width:100%; display:flex; align-items:center; gap:10px; }
#tabs button svg, .account-menu button svg { width:16px; height:16px; flex-shrink:0; }
#tabs button .nav-label { white-space:nowrap; min-width:0; }
#tabs button:hover { background:rgba(255,255,255,.06); }
#tabs button.active { background:#1e232e; color:#fff; box-shadow:inset 2px 0 0 var(--accent); }
.nav-group { color:var(--muted); font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:.08em; margin:16px 12px 6px; }
.side-foot { color:var(--muted); font-size:11px; padding-top:12px; }
main { flex:1; min-width:0; max-width:1150px; margin:0 auto; padding:24px 28px; }

/* Video cards (real thumbnails from the YouTube API) */
.vgrid { display:grid; grid-template-columns:repeat(auto-fill, minmax(220px, 1fr)); gap:12px; }
.vcard { background:var(--panel); border:1px solid var(--border); border-radius:12px; overflow:hidden; }
.vcard:hover { border-color:#3a4150; }
.vcard img { width:100%; aspect-ratio:16/9; object-fit:cover; display:block; background:#000; }
.vcard-body { padding:10px 12px; display:flex; flex-direction:column; gap:4px; }
.vcard-body b { font-size:14px; line-height:1.35; }
.vcard-actions { display:flex; gap:8px; margin-top:6px; }
.vcard-actions button { margin-top:0; padding:6px 10px; font-size:13px; }
.vcard-actions .ghost { background:var(--panel); color:var(--text); border:1px solid var(--border); }
.score-badge { display:inline-block; border-radius:6px; padding:2px 8px; font-size:12px; font-weight:700; }
.score-badge.band-excellent { background:#123524; color:#5eeaa0; }
.score-badge.band-good { background:#12283d; color:#7cc0ff; }
.score-badge.band-fair { background:#3d1214; color:#ff8a8e; }
.outlier-badge { display:inline-block; background:#3d2c12; color:#ffcf5c; border-radius:6px; padding:2px 8px; font-size:12px; font-weight:700; }

/* Region tabs (Trending: US / PK) */
.region-tabs { display:flex; gap:8px; margin:8px 0 12px; }
.region-tabs button { margin-top:0; background:var(--panel2); color:var(--text); border:1px solid var(--border); padding:7px 14px; font-size:13px; font-weight:500; }
.region-tabs button.active { border-color:var(--accent); color:var(--accent); background:rgba(59,130,246,.12); }

/* Feed info cards + idea cards */
.card-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap:14px; margin-top:16px; }
.card { background:var(--panel); border:1px solid var(--border); border-radius:12px; padding:16px; min-width:0; overflow:hidden; }
.card .table-wrap { margin:8px -16px -16px; padding:0 16px 16px; }
.card:hover { border-color:#3a4150; }
.card h3 { margin:0 0 8px; }
.card .idea-title { font-size:16px; font-weight:700; line-height:1.4; }
.idea-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }
.idea-actions button { margin-top:0; padding:6px 12px; font-size:13px; }
.idea-actions .ghost { background:var(--panel); color:var(--text); border:1px solid var(--border); }

/* Progress bars (Race to 4K) */
.progress { height:14px; background:var(--panel); border:1px solid var(--border); border-radius:8px; overflow:hidden; margin:6px 0 12px; }
.progress-fill { height:100%; background:var(--accent); }
.progress-fill.green { background:var(--green); }

/* Create queue */
.queue-item { background:var(--panel); border:1px solid var(--border); border-radius:12px; padding:14px 16px; margin:10px 0; }
.queue-item.used { opacity:.55; }
.queue-item.used b { text-decoration:line-through; }
.queue-item .idea-actions { margin-top:8px; }

/* Video score table (Optimize) */
.table-wrap { overflow-x:auto; margin:10px 0; }
.table-wrap .vtable { min-width:560px; }
.vtable { width:100%; border-collapse:collapse; font-size:14px; }
.vtable td, .vtable th { padding:10px 8px; border-bottom:1px solid var(--border); text-align:left; vertical-align:middle; }
.vtable tbody tr:hover { background:rgba(255,255,255,.03); }
.vtable th { color:var(--muted); font-size:12px; text-transform:uppercase; letter-spacing:.5px; }
.vtable .thumb { width:96px; border-radius:6px; display:block; }
.vtable button { margin-top:0; padding:5px 10px; font-size:12px; }

/* Mobile: sidebar becomes a top bar, nav scrolls horizontally */
@media (max-width: 899px) {
  .app { flex-direction:column; }
  .sidebar { width:100%; height:auto; position:static; overflow:visible; padding:12px 16px 8px; border-right:none; border-bottom:1px solid var(--border); }
  .sidebar .health { display:none; }
  .side-foot { display:none; }
  #tabs { flex-direction:row; overflow-x:auto; gap:6px; padding-bottom:4px; }
  #tabs button { width:auto; white-space:nowrap; border-color:var(--border); }
  .nav-group { display:none; }
  main { padding:16px; }
  .vtable .thumb { width:64px; }
}

/* --- Phase 4b: drawer, account menu, toggles, light theme ----------- */
.mobile-bar { display:none; }
.backdrop { display:none; }
select { width:100%; max-width:520px; padding:11px 14px; border-radius:8px; border:1px solid var(--border); background:var(--panel2); color:var(--text); font-size:14px; margin-top:8px; }
button.ghost { background:var(--panel2); color:var(--text); border:1px solid var(--border); }
button.ghost:hover { background:#262a34; border-color:#3a4150; }
button.mini { padding:6px 12px; font-size:13px; margin-top:0; }

/* Account chip (sidebar footer) + pop-up account menu.
   The menu opens upward from the chip, like VidIQ's account menu. */
.account-chip { display:flex; align-items:center; gap:8px; width:100%; background:var(--panel2); color:var(--text); border:1px solid var(--border); border-radius:10px; padding:9px 10px; cursor:pointer; font-size:13px; font-weight:600; text-align:left; margin-top:auto; }
.account-chip:hover { border-color:#3a4150; }
.account-chip .chip-avatar { width:26px; height:26px; border-radius:50%; background:var(--accent); color:#fff; display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:700; flex-shrink:0; }
.account-chip .chip-name { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.account-chip .chip-caret { color:var(--muted); flex-shrink:0; }
.account-menu { display:none; flex-direction:column; gap:2px; border:1px solid var(--border); border-radius:12px; padding:8px; margin-top:0; background:var(--panel); box-shadow:0 8px 28px rgba(0,0,0,.5); position:absolute; left:12px; right:12px; bottom:64px; z-index:60; max-height:70vh; overflow-y:auto; overflow-x:hidden; }
.account-menu.open { display:flex; }
.account-menu .nav-group { margin:8px 12px 4px; }
.account-menu .nav-group:first-child { margin-top:2px; }
.account-menu button { background:transparent; color:var(--text); border:1px solid transparent; border-radius:8px; padding:10px 12px; cursor:pointer; font-size:14px; font-weight:500; text-align:left; margin-top:0; width:100%; display:flex; align-items:center; gap:10px; }
.account-menu button:hover { background:rgba(255,255,255,.06); }
.account-menu button.menu-action { color:#ff8a8e; }
.menu-row { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:8px 4px; font-size:14px; white-space:nowrap; flex-wrap:nowrap; }
.menu-row > span:first-child { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; }
.menu-row .hint { font-size:12px; }
.switch { position:relative; width:44px; height:24px; border-radius:20px; background:#2a2f3a; border:1px solid var(--border); padding:0; cursor:pointer; flex-shrink:0; margin-top:0; }
.switch .knob { position:absolute; top:2px; left:2px; width:18px; height:18px; border-radius:50%; background:#fff; transition:left .15s; }
.switch.on { background:var(--accent); }
.switch.on .knob { left:22px; }

/* Collapsible "More tools" group */
.nav-details { display:contents; }
.nav-details summary { color:var(--muted); font-size:11px; text-transform:uppercase; letter-spacing:1px; margin:12px 4px 2px; cursor:pointer; list-style:none; }
.nav-details summary::-webkit-details-marker { display:none; }
.nav-details summary::after { content:" ▾"; }

/* Calendar */
.cal-nav { display:flex; align-items:center; gap:12px; margin:10px 0; }
.cal-grid { display:grid; grid-template-columns:repeat(7, 1fr); gap:4px; max-width:520px; }
.cal-cell { aspect-ratio:1; border:1px solid var(--border); border-radius:8px; background:var(--panel2); color:var(--muted); font-size:12px; padding:4px; text-align:left; cursor:default; overflow:hidden; }
.cal-cell.head { background:transparent; border:none; text-align:center; font-weight:700; color:var(--muted); aspect-ratio:auto; }
.cal-cell.has-video { background:rgba(59,130,246,.15); color:#7fb3ff; border-color:var(--accent); cursor:pointer; font-weight:700; }
.cal-cell.has-video:hover { border-color:#fff; }
.cal-cell.today { border-color:var(--green); }
.cal-cell img { width:100%; border-radius:4px; display:block; margin-bottom:2px; }
.cal-cell .cal-t { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; font-size:10px; font-weight:400; line-height:1.25; overflow:hidden; color:var(--text); }

/* Light theme (Dark Mode toggle off) */
body.light { --bg:#f4f5f7; --panel:#ffffff; --panel2:#f0f1f4; --text:#14171d; --muted:#5b6472; --accent:#2563eb; --accent2:#2563eb; --green:#15803d; --blue:#2563eb; --red:#c92a2e; --border:#dde1e8; --sidebar:#e8eaee; }
body.light .sidebar { background:var(--sidebar); }
body.light #tabs button:hover, body.light .account-menu button:hover { background:rgba(0,0,0,.05); }
body.light #tabs button.active { background:#dbe2ee; color:#14171d; }
body.light .tag.green { background:#d9f2e3; color:#146c37; }
body.light .tag.blue { background:#dbeafe; color:#1d4ed8; }
body.light .tag.red { background:#fde2e2; color:#b91c1c; }
body.light .score-badge.band-excellent { background:#d9f2e3; color:#146c37; }
body.light .score-badge.band-good { background:#dbeafe; color:#1d4ed8; }
body.light .score-badge.band-fair { background:#fde2e2; color:#b91c1c; }
body.light .outlier-badge, body.light .badge-outlier { background:#fef3c7; color:#92400e; }
body.light .switch { background:#c9ced8; }
body.light .switch.on { background:var(--accent); }
body.light .cal-cell.has-video { background:#dbeafe; color:#1d4ed8; }
body.light .tag.green { background:#d9f2e3; color:#146c37; }
body.light .tag.blue { background:#dbeafe; color:#1d4ed8; }
body.light .tag.red { background:#fde2e2; color:#b91c1c; }
body.light .score-badge.band-excellent { background:#d9f2e3; color:#146c37; }
body.light .score-badge.band-good { background:#dbeafe; color:#1d4ed8; }
body.light .score-badge.band-fair { background:#fde2e2; color:#b91c1c; }
body.light .outlier-badge, body.light .badge-outlier { background:#fef3c7; color:#92400e; }
body.light .cal-cell.has-video { background:#dbeafe; color:#1d4ed8; }
body.light .switch { background:#c9ced8; }
body.light .switch.on { background:var(--accent); }

/* Hover-expand sidebar (desktop only).
   Collapsed state hides the text label span (JS wraps every nav
   button's text in .nav-label) and shows only the inline SVG icon,
   centred — the old short-code letter (::before) is suppressed, so a
   label can never be cut mid-word. Expanded state = :hover OR
   body.sidebar-open (tap to expand on touch screens), showing icon +
   full label. The sidebar overlays content when expanded; main keeps
   its 64px left margin either way. */
@media (min-width: 900px) {
  body.hover-expand .sidebar { position:fixed; left:0; top:0; bottom:0; width:64px; min-width:64px; flex-basis:64px; z-index:40; overflow-x:hidden; overflow-y:hidden; transition:width .18s ease; }
  body.hover-expand main { margin-left:max(64px, calc((100% + 64px - 1150px) / 2)); margin-right:max(0px, calc((100% - 64px - 1150px) / 2)); }
  body.hover-expand .sidebar .brand h1, body.hover-expand .sidebar .brand .sub,
  body.hover-expand .sidebar .health, body.hover-expand .sidebar .nav-group,
  body.hover-expand .sidebar .side-foot, body.hover-expand .sidebar .account-menu,
  body.hover-expand .sidebar .nav-details summary { display:none; }
  body.hover-expand .sidebar #tabs button { justify-content:center; padding:10px 0; white-space:nowrap; overflow:hidden; }
  body.hover-expand .sidebar #tabs button svg { display:block; }
  body.hover-expand .sidebar #tabs button .nav-label { display:none; }
  body.hover-expand .sidebar #tabs button::before { content:none; }
  body.hover-expand .sidebar .account-chip .chip-name { display:none; }
  body.hover-expand .sidebar:hover, body.hover-expand.sidebar-open .sidebar { width:250px; min-width:250px; flex-basis:250px; box-shadow:8px 0 24px rgba(0,0,0,.45); overflow-y:auto; }
  body.hover-expand .sidebar:hover .brand h1, body.hover-expand .sidebar:hover .brand .sub,
  body.hover-expand .sidebar:hover .health, body.hover-expand .sidebar:hover .nav-group,
  body.hover-expand .sidebar:hover .side-foot, body.hover-expand .sidebar:hover .account-menu,
  body.hover-expand .sidebar:hover .nav-details summary,
  body.hover-expand.sidebar-open .sidebar .brand h1, body.hover-expand.sidebar-open .sidebar .brand .sub,
  body.hover-expand.sidebar-open .sidebar .health, body.hover-expand.sidebar-open .sidebar .nav-group,
  body.hover-expand.sidebar-open .sidebar .side-foot, body.hover-expand.sidebar-open .sidebar .account-menu,
  body.hover-expand.sidebar-open .sidebar .nav-details summary { display:block; }
  body.hover-expand .sidebar:hover #tabs button, body.hover-expand.sidebar-open .sidebar #tabs button { text-align:left; justify-content:flex-start; padding:10px 12px; }
  body.hover-expand .sidebar:hover #tabs button .nav-label, body.hover-expand.sidebar-open .sidebar #tabs button .nav-label { display:inline; }
  body.hover-expand .sidebar:hover #tabs button::before, body.hover-expand.sidebar-open .sidebar #tabs button::before { content:none; }
  body.hover-expand .sidebar:hover .account-chip .chip-name, body.hover-expand.sidebar-open .sidebar .account-chip .chip-name { display:inline; }
}

/* Mobile: sidebar becomes a slide-in drawer with the FULL list */
@media (max-width: 899px) {
  .mobile-bar { display:flex; align-items:center; gap:12px; padding:10px 16px; background:var(--sidebar); border-bottom:1px solid var(--border); position:sticky; top:0; z-index:45; }
  .mobile-bar button { margin-top:0; padding:8px 14px; font-size:14px; }
  .mobile-title { font-weight:700; font-size:17px; }
  .app { flex-direction:column; }
  .sidebar { position:fixed; left:0; top:0; bottom:0; width:280px; max-width:85vw; height:100dvh; z-index:50; transform:translateX(-105%); transition:transform .2s ease; border-right:1px solid var(--border); box-shadow:8px 0 24px rgba(0,0,0,.45); }
  .sidebar.open { transform:none; }
  .sidebar .health { display:block; }
  .side-foot { display:block; }
  .backdrop { display:block; position:fixed; inset:0; background:rgba(0,0,0,.55); z-index:49; opacity:0; pointer-events:none; transition:opacity .2s ease; }
  .backdrop.show { opacity:1; pointer-events:auto; }
  #tabs { flex-direction:column; overflow-x:visible; gap:4px; padding-bottom:4px; }
  #tabs button { width:100%; white-space:normal; border-color:transparent; }
  .nav-group { display:block; }
  main { padding:16px; }
  .vtable .thumb { width:64px; }
}

/* --- Phase 4c: sub-tabs, studio, charts -------------------------------- */
.sub-tabs { display:flex; flex-wrap:wrap; gap:6px; margin:10px 0 14px; }
.sub-tabs button { margin-top:0; background:var(--panel); color:var(--text); border:1px solid var(--border); padding:7px 14px; font-size:13px; }
.sub-tabs button.active { border-color:var(--accent); color:var(--accent); }
.tab-score { font-weight:700; color:var(--accent); }
.more-wrap { position:relative; display:inline-block; }
.more-menu { position:absolute; right:0; top:calc(100% + 4px); min-width:160px; background:var(--panel); border:1px solid var(--border); border-radius:10px; padding:6px; z-index:30; box-shadow:0 8px 24px rgba(0,0,0,.35); }
.more-menu button { display:block; width:100%; text-align:left; border:none; background:transparent; }
.more-menu button:hover { background:var(--panel2); }
.studio-topbar { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.studio-topbar h2 { margin:0; flex:1 1 auto; }
.studio-topbar button { margin-top:0; }
.studio-nav button { padding:7px 12px; }
.studio-seo-grid { display:grid; grid-template-columns:minmax(0,1fr) 320px; gap:16px; align-items:start; }
@media (max-width: 900px) { .studio-seo-grid { grid-template-columns:1fr; } }
.pkg-card { border:1px solid var(--border); border-radius:12px; padding:14px; margin-bottom:12px; background:var(--panel); }
.pkg-card h3 { margin-top:0; }
.pkg-plus { font-size:28px; font-weight:700; margin:0; color:var(--accent); }
.pkg-scores { display:flex; gap:14px; flex-wrap:wrap; }
.tag-x { background:transparent; border:none; color:inherit; font-weight:700; cursor:pointer; padding:0 0 0 4px; margin:0; font-size:14px; line-height:1; }
.tag-x:hover { background:transparent; color:inherit; opacity:.7; }
button.sugg-tag { cursor:pointer; }
button.sugg-tag.added { opacity:.45; cursor:default; }
.sugg-card { border:1px solid var(--border); border-radius:10px; padding:12px; }
.sugg-head { display:flex; align-items:center; justify-content:space-between; gap:8px; flex-wrap:wrap; }
.sugg-icons button { margin-top:0; padding:5px 10px; font-size:12px; }
.subtab-panel[hidden] { display:none; }
.kv-table { width:100%; border-collapse:collapse; font-size:14px; }
.kv-table td, .kv-table th { padding:8px 6px; border-bottom:1px solid var(--border); text-align:left; }
.kv-table th { color:var(--muted); font-size:12px; text-transform:uppercase; letter-spacing:.5px; }
.bar-chart { display:flex; align-items:flex-end; gap:6px; height:90px; margin:10px 0 4px; }
.bar-chart .bar { flex:1; background:var(--accent); border-radius:4px 4px 0 0; min-height:4px; }
.bar-chart-labels { display:flex; gap:6px; font-size:11px; color:var(--muted); }
.bar-chart-labels span { flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.milestone { background:#123524; border:1px solid var(--green); color:#5eeaa0; border-radius:10px; padding:12px 14px; margin:12px 0; font-weight:700; }
body.light .milestone { background:#d9f2e3; color:#146c37; }
.chip-row { display:flex; flex-wrap:wrap; gap:6px; margin:8px 0; }
.perf-good { color:var(--green); font-weight:700; }
.perf-bad { color:var(--red); font-weight:700; }
.perf-avg { color:var(--blue); font-weight:700; }

/* --- Composer + chat (Feed / New Chat / Script Writer / Title Generator) - */
.composer { position:sticky; bottom:0; background:var(--panel); border-top:1px solid var(--border); padding:12px 14px; display:flex; gap:10px; align-items:center; z-index:5; }
.composer input[type=text], .composer textarea { flex:1; min-width:0; max-width:none; margin-top:0; }
.composer button { margin-top:0; flex-shrink:0; }
.chat-msg { max-width:85%; border-radius:12px; padding:10px 14px; margin:10px 0; }
.chat-msg b { display:block; font-size:13px; margin-bottom:2px; }
.chat-msg p { margin:0; }
.chat-msg.user { margin-left:auto; background:rgba(59,130,246,.18); border:1px solid rgba(59,130,246,.35); }
.chat-msg.coach { margin-right:auto; background:var(--panel); border:1px solid var(--border); }
#coach-log { max-height:50vh; overflow-y:auto; overflow-x:hidden; }

/* Calendar: scheduled-upload days (distinct from published-video days) */
.cal-cell.has-scheduled { border-color:var(--accent); }
.cal-cell.has-scheduled .cal-t { color:var(--accent); }

/* --- Phase 4d: Apply (Use) flow ------------------------------------- */
/* Reconnect banner (write permission missing) — visible at the top of
   every screen until the channel is reconnected with the new scope. */
.banner { background:#3d2c12; border:1px solid #e8a33d; color:#ffcf5c; border-radius:12px; padding:12px 16px; margin:12px 0; }
.banner p { margin:4px 0; }
.banner .hint { color:#f5d78e; }
.banner button { margin-top:8px; }
body.light .banner { background:#fef3c7; color:#92400e; border-color:#e8a33d; }
body.light .banner .hint { color:#92400e; }
/* Apply confirm dialog — modal overlay + centred card. */
.modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,.62); z-index:100; display:flex; align-items:flex-start; justify-content:center; padding:16px; overflow-y:auto; }
.modal-overlay[hidden] { display:none; }
.modal { background:var(--panel); border:1px solid var(--border); border-radius:14px; padding:18px; width:100%; max-width:560px; margin-top:6vh; }
.modal h3 { margin:0 0 10px; }
.modal select { margin-top:8px; }
.apply-diff { margin:12px 0; }
.apply-diff .diff-row { border-top:1px solid var(--border); padding:10px 0; }
.apply-diff .diff-row:first-child { border-top:none; }
.apply-diff .diff-label { font-size:12px; text-transform:uppercase; letter-spacing:.5px; color:var(--muted); font-weight:700; }
.apply-diff .diff-old { color:var(--muted); text-decoration:line-through; word-break:break-word; }
.apply-diff .diff-new { font-weight:700; word-break:break-word; }
.apply-diff .diff-arrow { color:var(--muted); font-size:13px; }
.apply-ok { color:var(--green); font-weight:700; }
.apply-err { color:var(--red); font-weight:700; }
.use-row { display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }
.use-row button { margin-top:0; padding:6px 12px; font-size:13px; }
.use-row .ghost { background:var(--panel); color:var(--text); border:1px solid var(--border); }


/* --- Phase 4e --------------------------------------------------------- */
/* Kanban board (Calendar → Board tab): four columns with counts. */
.kanban { display:grid; grid-template-columns:repeat(4, minmax(0, 1fr)); gap:12px; }
@media (max-width: 900px) { .kanban { grid-template-columns:repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .kanban { grid-template-columns:1fr; } }
.kanban-col { background:var(--panel); border:1px solid var(--border); border-radius:12px; padding:12px; min-height:120px; }
.kanban-col h3 { margin:0 0 10px; font-size:15px; }
.kanban-count { display:inline-block; background:var(--accent); color:#fff; border-radius:10px; padding:1px 8px; font-size:12px; font-weight:700; }
.kanban-card { background:var(--bg); border:1px solid var(--border); border-radius:8px; padding:8px 10px; margin-bottom:8px; font-size:13px; }
.kanban-card b { display:block; margin-bottom:2px; }
/* Favourite star (Title Generator). */
.fav-star { background:none; border:1px solid var(--border); border-radius:8px; font-size:16px; line-height:1; padding:6px 10px; cursor:pointer; color:var(--muted); }
.fav-star.fav-on { color:#eab308; border-color:#eab308; }
/* Clickable outlier cards open the Video Details dialog. */
.outlier-card { cursor:pointer; }
.outlier-card:hover { border-color:var(--accent); }
.result.outlier-card { cursor:pointer; }
/* Coach chat markdown: lists and code from renderMd(). */
.chat-msg ul, .chat-msg ol { margin:6px 0 6px 18px; padding:0; }
.chat-msg li { margin:3px 0; }
.chat-msg code { background:rgba(127,127,127,.18); border-radius:4px; padding:1px 5px; font-size:12px; }
.chat-msg p { margin:6px 0; }
.result ul, .result ol { margin:6px 0 6px 18px; }
.result code { background:rgba(127,127,127,.18); border-radius:4px; padding:1px 5px; font-size:12px; }
/* Idea titles are clickable — they open the actions dialog. */
.idea-title { cursor:pointer; }
.idea-title:hover { text-decoration:underline; }

/* Phase 4g — Optimize overview (VidIQ structure, TubeTool data) */
.opt-head { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.opt-head h2 { margin:0; }
.opt-head input[type=text] { margin-top:0; }
.opt-head button { margin-top:0; }
.opt-channel { font-weight:700; color:var(--text); white-space:nowrap; }
.seg-bar { display:flex; gap:3px; margin:8px 0 4px; }
.seg-bar span { flex:1; height:10px; border-radius:5px; background:var(--panel); border:1px solid var(--border); }
.seg-bar span.on { background:var(--accent); border-color:var(--accent); }
.growth-row { margin:10px 0; }
.growth-row .growth-label { display:flex; justify-content:space-between; font-size:13px; }
.growth-row .growth-label b { font-size:15px; }
.growth-bar { height:12px; background:var(--panel); border:1px solid var(--border); border-radius:7px; overflow:hidden; margin-top:4px; }
.growth-bar i { display:block; height:100%; background:var(--accent); }
.growth-bar.grey i { background:#6b7280; }
.hit-row { display:flex; gap:12px; align-items:center; background:var(--panel); border:1px solid var(--border); border-radius:12px; padding:10px 12px; margin:8px 0; }
.hit-row img { width:96px; aspect-ratio:16/9; object-fit:cover; border-radius:8px; background:#000; flex-shrink:0; }
.hit-row .hit-body { flex:1; min-width:0; }
.hit-row .hit-body b { font-size:14px; }
.hit-row .hit-mult { font-weight:700; white-space:nowrap; }
.hit-row .hit-mult.hot { color:var(--green); }
.hit-row .hit-mult.cold { color:var(--red); }
.opt-card-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
@media (max-width:700px) { .opt-card-grid { grid-template-columns:1fr; } .hit-row img { width:72px; } }
.fw-chart { width:100%; max-width:520px; height:auto; display:block; margin:6px 0; }
.fw-chart .fw-line { fill:none; stroke:var(--accent); stroke-width:2.5; }
.fw-chart .fw-dot { fill:var(--accent); }
.fw-chart .fw-lab { fill:var(--text); font-size:12px; font-weight:700; }
.fw-chart .fw-axis { fill:var(--muted); font-size:11px; }
