/* NimbleOS v2 shell · wireframe styles
   Workspace = Nimble teal (#004447) · Account view picks up clients.brand_colors.accent
   Calm command-centre character: light surfaces, soft 0.5px borders, generous spacing. */

:root {
  /* Nimble base */
  --nimble-teal: #004447;
  --nimble-teal-dark: #002a2c;
  --nimble-teal-light: #e6edee;
  --nimble-orange: #d2804d;
  --nimble-sage: #8ca786;
  --nimble-grey: #e4e4e4;

  /* Channel brand colours (Slice R1, Alex 2026-07-12): account CONTENT
     charts colour by channel identity, never the Nimble teal/orange
     palette (that's reserved for Nimble's own brand + warning/action
     accents). One set, defined once, consumed by every channel chart. */
  --channel-meta: #4a90d9;
  --channel-google: #b0a6d6;
  --channel-seo: #4a9d6f;
  --channel-lp-navy: #1f3a5f;

  /* Tokens */
  --bg-canvas: #f7f6f3;
  --bg-surface: #ffffff;
  --bg-muted: #f1efe8;
  --text-primary: #1f1f1d;
  --text-secondary: #5f5e5a;
  --text-tertiary: #888780;
  --text-inverse: #ffffff;
  --border-soft: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.16);

  --status-live: #2c6b2c;
  --status-live-bg: #eaf3de;
  --status-gap: #a32d2d;
  --status-gap-bg: #fcebeb;
  --status-soon: #5f5e5a;
  --status-soon-bg: #f1efe8;

  /* Per-page accent overridden by JS when entering an account */
  --accent: var(--nimble-teal);
  --accent-light: var(--nimble-teal-light);
  /* Pop accent for nav active-states: Nimble's orange at workspace level,
     each client's own accent_secondary once inside their account (JS-set). */
  --accent-pop: var(--nimble-orange);

  --rail-w: 260px;
  --radius: 8px;
  --radius-lg: 12px;

  /* Type scale (Fable §2b.4): only these five sizes ship on anything this
     slice touches. If a size isn't on this scale it doesn't ship. */
  --fs-hero: 26px;
  --fs-answer: 17px;
  --fs-body: 15px;
  --fs-support: 13px;
  --fs-eyebrow: 11px;
}

/* Self-hosted Raleway (§2b.4 / P2-1): replaces the Google Fonts request for
   this family. Montserrat (eyebrows/labels) stays on the existing Google
   Fonts link · out of this slice's self-hosting scope. */
@font-face {
  font-family: "Raleway";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/raleway-400.woff2") format("woff2");
}
@font-face {
  font-family: "Raleway";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("assets/fonts/raleway-600.woff2") format("woff2");
}
@font-face {
  font-family: "Raleway";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("assets/fonts/raleway-700.woff2") format("woff2");
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: "Raleway", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body { display: grid; grid-template-columns: var(--rail-w) 1fr; min-height: 100vh; }

/* ====== Left rail ====== */
#rail {
  background: var(--nimble-teal);
  color: var(--text-inverse);
  padding: 18px 14px 24px;
  overflow-y: auto;
  border-right: 3px solid var(--nav-text, var(--accent-pop));
  /* Rail background is a variable per-account brand colour, some of which
     (e.g. medium-value teals/tans) don't have the same contrast headroom as
     Nimble's near-black teal. A consistent text-shadow keeps white text
     crisp across the full lightness range instead of tuning opacity per account. */
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
  position: sticky;
  top: 0;
  height: 100vh;
  scrollbar-width: thin;
  scrollbar-color: var(--nav-text, var(--accent-pop)) transparent;
}
#rail::-webkit-scrollbar { width: 6px; }
#rail::-webkit-scrollbar-track { background: transparent; }
#rail::-webkit-scrollbar-thumb { background: var(--nav-text, var(--accent-pop)); border-radius: 3px; }

#rail .rail-brand {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 4px 8px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  margin-bottom: 14px;
}
#rail .rail-brand-logo { max-width: 168px; height: auto; display: block; }
#rail .rail-brand .logo-sub { font-size: 11px; color: rgba(255,255,255,0.6); margin-top: 1px; }

#rail .rail-section-title {
  font-size: 9px; letter-spacing: 2px; text-transform: uppercase;
  color: rgba(255,255,255,0.55); padding: 14px 12px 8px;
  font-weight: 700; border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 4px;
}

#rail .rail-link {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px 10px 9px; border-radius: 0;
  border-left: 3px solid transparent;
  color: rgba(255,255,255,0.8); cursor: pointer; user-select: none;
  font-size: 11.5px; font-weight: 700; letter-spacing: 1.1px;
  text-transform: uppercase; text-decoration: none;
  transition: color 0.15s, background 0.15s;
}
#rail .rail-link:hover { background: rgba(0,0,0,0.12); color: #fff; }
#rail .rail-link.active {
  background: rgba(255,255,255,0.10); color: var(--nav-text, var(--accent-pop));
  border-left-color: var(--accent-pop);
}
#rail .rail-link .rl-dot { display: none; }
#rail .rail-link .rl-meta { margin-left: auto; font-size: 9px; letter-spacing: 0.5px; color: rgba(255,255,255,0.4); text-transform: none; }
#rail .rail-link.locked { opacity: 0.6; }
#rail .rail-link.locked .rl-meta { color: rgba(255,255,255,0.5); }

#rail .rail-account-card {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius);
  background: rgba(255,255,255,0.06);
  cursor: pointer; user-select: none;
  text-decoration: none; color: inherit;
}
#rail .rail-account-card:hover { background: rgba(255,255,255,0.10); }
#rail .rail-account-card.active { background: rgba(255,255,255,0.16); }
#rail .rail-account-card .acc-mark {
  width: 22px; height: 22px; border-radius: 4px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 11px; color: #fff;
}
/* Real brand mark image, sized by whichever square slot it's dropped into
   (acc-mark / acc-h-mark / ai-mark / ar-mark keep their existing width/height/radius). */
.mark-img { object-fit: cover; display: block; }
#rail .rail-account-card .acc-name { font-size: 13px; }
#rail .rail-account-card .acc-mode { font-size: 10px; color: rgba(255,255,255,0.55); }

#rail .rail-back {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px; color: rgba(255,255,255,0.65); font-size: 12px;
  cursor: pointer; margin-bottom: 6px;
  text-decoration: none;
}
#rail .rail-back:hover { color: #fff; }

#rail .rail-account-header {
  padding: 10px 8px 14px; margin-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
#rail .rail-account-header .acc-h-name {
  display: flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 600;
}
#rail .rail-account-header .acc-h-mark {
  width: 28px; height: 28px; border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #fff;
  flex-shrink: 0;
}
/* Client logo sits flush on the brand-coloured rail (no chip). Logos must be
   supplied so they read on the brand colour: a transparent/reversed (light-ink)
   logo for dark rails, or one whose own background matches the accent (Nimble's
   is teal = rail). Accounts without a rail-ready logo fall back to a clean
   wordmark of the account name (see app.js). */
#rail .rail-logo-chip {
  padding: 2px 4px 6px;
  display: flex; align-items: center; justify-content: center;
  min-height: 40px;
}
#rail .rail-logo-img { width: 100%; height: auto; max-height: 160px; display: block; }
#rail .rail-account-header.has-logo { padding-top: 4px; }

/* When an account is active the rail tint is the account accent's dark variant */
body.account-mode #rail { background: var(--nav-accent, var(--accent)); }
body.account-mode #rail .rail-brand { display: none; }

/* ====== Main area ====== */
#main { display: flex; flex-direction: column; min-width: 0; }

#topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-soft);
  min-height: 56px;
  position: sticky;
  top: 0;
  z-index: 30;
}

#breadcrumb { font-size: 13px; color: var(--text-secondary); }
#breadcrumb .bc-sep { color: var(--text-tertiary); margin: 0 8px; }
#breadcrumb .bc-current { color: var(--accent); font-weight: 700; font-family: 'Montserrat', sans-serif; }
#breadcrumb a { color: var(--text-secondary); text-decoration: none; }
#breadcrumb a:hover { color: var(--accent); }

#topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-user {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
}
.topbar-user-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; font-family: 'Montserrat', sans-serif;
  flex-shrink: 0;
}

.op-viewtoggle {
  display: flex; align-items: center;
  border: 1px solid var(--border-strong); border-radius: 999px;
  padding: 2px; margin-right: 4px;
}
.op-viewtoggle button {
  border: none; background: none; cursor: pointer;
  font-family: 'Raleway', -apple-system, sans-serif;
  font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
  padding: 5px 14px; border-radius: 999px; color: var(--text-tertiary);
  transition: background 0.15s, color 0.15s;
}
.op-viewtoggle button.active { background: var(--accent); color: #fff; }
.op-viewtoggle button:not(.active):hover { color: var(--text-secondary); }

#mode-badge { font-size: 11px; padding: 3px 9px; border-radius: 999px; background: var(--bg-muted); color: var(--text-secondary); }
#mode-badge[data-mode="operate"] { background: #eaf3de; color: #2c6b2c; }
#mode-badge[data-mode="interpret"] { background: #e6f1fb; color: #185fa5; }
#mode-badge[data-mode="audit"] { background: #faeeda; color: #854f0b; }
#mode-badge[data-mode="founders"] { background: #fcebeb; color: #a32d2d; }
#mode-badge[data-mode=""] { display: none; }

/* Account identity strip under the topbar */
.account-identity {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-surface);
  padding: 16px 28px 16px;
  border-bottom: 3px solid var(--accent);
}
.account-identity .ai-mark {
  width: 44px; height: 44px; border-radius: 8px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 18px;
}
.account-identity .ai-name { font-size: 18px; font-weight: 600; }
.account-identity .ai-sub { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }

/* container-type traps position:fixed descendants (drawers/modals): any drawer or
   modal added inside a page module must appendChild to document.body, like op-toast
   already does, never nest it inside #page. */
#page {
  width: 100%;
  padding-block: 24px 80px;
  padding-inline: clamp(20px, 2.2vw, 40px);
  max-width: 1680px;
  margin-inline: auto;
  container-type: inline-size;
}

/* ====== Page header ====== */
.page-h {
  margin-bottom: 18px;
}
.page-h .kicker { font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--text-tertiary); margin-bottom: 4px; }
.page-h h1 { margin: 0; font-family: 'Montserrat', sans-serif; font-size: 24px; font-weight: 700; letter-spacing: 0.3px; color: var(--accent); }
.page-h .sub { color: var(--text-secondary); margin-top: 6px; max-width: 70ch; font-size: 14px; }

/* Sub-tab nav · rectangular underline style (walkthrough-5, Alex: "everything else
   is rectangular · pills look wrong"). Matches the v1 Prototype .sub-nav-btn pattern.
   Used by: .op-pm-tabs (Paid Media + Website & SEO), .subtabs (workspace sub-pages). */
.op-pm-tabs {
  display: flex;
  gap: 0;
  margin: 0 0 20px;
  padding: 0;
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--border-soft);
  border-radius: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.op-pm-tabs::-webkit-scrollbar { display: none; }

.op-pm-tab {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  border-radius: 0;
  font-family: 'Raleway', -apple-system, sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  padding: 10px 16px 12px;
  cursor: pointer;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  text-decoration: none;
  display: inline-block;
}
.op-pm-tab:hover { color: var(--accent); }
.op-pm-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }
.op-pm-tab .badge-count {
  display: inline-block;
  background: var(--accent-pop);
  color: #fff;
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 4px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

/* Paid Media > Campaigns & Ads · campaign toggle (Stage 3) */
.pm-camp-toggle {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 0 0 20px;
}
.pm-camp-label {
  font-family: 'Raleway', -apple-system, sans-serif;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-tertiary);
}
.pm-camp-select {
  font-family: 'Raleway', -apple-system, sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 8px 12px;
  max-width: 100%;
  cursor: pointer;
}
.pm-camp-select:focus {
  outline: none;
  border-color: var(--accent);
}
.pm-camp-note {
  flex-basis: 100%;
  margin: 0;
  font-size: 12px;
  color: var(--text-tertiary);
}

/* Workspace sub-page pills · also updated to underline treatment */
.subtabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border-soft);
  margin: -4px 0 22px;
  overflow-x: auto;
  scrollbar-width: none;
}
.subtabs::-webkit-scrollbar { display: none; }
.subtabs a {
  font-family: 'Raleway', -apple-system, sans-serif;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 12px 18px;
  color: var(--text-tertiary);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color 0.15s;
  display: inline-block;
}
.subtabs a:hover { color: var(--accent-pop); }
.subtabs a.active { color: var(--accent-pop); border-bottom-color: var(--accent-pop); }

/* Cards */
.cards { display: grid; gap: 14px; }
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}
.card h3 {
  margin: 0 0 8px; font-size: 13px; font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.4px; text-transform: uppercase;
}
.card .card-body { font-size: 14px; color: var(--text-primary); line-height: 1.65; }
.card ul { margin: 0; padding-left: 18px; }
.card ul li { margin: 3px 0; }
.card.flat { background: transparent; border: none; padding: 0; }

/* Two-column page section */
.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
@media (max-width: 880px) { .two-col { grid-template-columns: 1fr; } }

/* Status pills */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; padding: 3px 9px; border-radius: 999px;
  vertical-align: middle;
}
.pill.live { background: var(--status-live-bg); color: var(--status-live); }
.pill.soon { background: var(--status-soon-bg); color: var(--status-soon); }
.pill.gap { background: var(--status-gap-bg); color: var(--status-gap); }
.pill.partial { background: #faeeda; color: #854f0b; }
.pill.expanding { background: #e6f1fb; color: #185fa5; }

/* Workflow steps */
.workflow {
  display: grid; grid-template-columns: 1fr; gap: 8px;
}
.workflow .step {
  display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border-soft);
}
.workflow .step:last-child { border-bottom: none; }
.workflow .step-n {
  width: 22px; height: 22px; border-radius: 999px;
  background: var(--accent-light); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  margin-top: 1px;
}

/* Data point + API rows */
.kv-list { display: grid; gap: 4px; }
.kv-list .kv {
  display: grid; grid-template-columns: 1fr; gap: 2px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border-soft);
}
.kv-list .kv:last-child { border-bottom: none; }
.kv-list .kv .k {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  font-size: 12.5px; color: var(--text-primary);
}
.kv-list .kv .v { font-size: 12px; color: var(--text-secondary); }

/* Cross-checks */
.cross-checks .cc {
  padding: 8px 0;
  border-bottom: 1px dashed var(--border-soft);
  font-size: 13.5px;
}
.cross-checks .cc:last-child { border-bottom: none; }
.cross-checks .cc strong { color: var(--accent); font-weight: 600; }

/* Agent actions */
.agent-actions .aa {
  display: grid; grid-template-columns: auto 1fr; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border-soft);
}
.agent-actions .aa:last-child { border-bottom: none; }
.agent-actions .aa .aa-icon {
  width: 22px; height: 22px; border-radius: 4px;
  background: var(--accent-light); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  margin-top: 2px;
}

/* Accounts board */
.accounts-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.account-row {
  display: grid;
  grid-template-columns: 32px 1.4fr 0.9fr 0.9fr 1.2fr 0.7fr 14px;
  align-items: center; gap: 14px;
  background: var(--bg-surface);
  padding: 14px 16px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none; color: var(--text-primary);
}
.account-row:hover { border-color: var(--border-strong); }
.account-row .ar-mark {
  width: 30px; height: 30px; border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 12px;
}
.account-row .ar-name { font-weight: 600; font-size: 14px; }
.account-row .ar-sub { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }
.account-row .ar-cell { font-size: 12px; color: var(--text-secondary); }
.account-row .ar-cell .ar-label { font-size: 10px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 2px; }
.account-row .ar-cell .ar-val { font-size: 13px; color: var(--text-primary); font-weight: 500; }
.account-row .ar-cell.bad .ar-val { color: var(--status-gap); }
.account-row .ar-cell.warn .ar-val { color: #854f0b; }
.account-row .ar-cell.good .ar-val { color: var(--status-live); }
.account-row .ar-chev { color: var(--text-tertiary); font-size: 16px; }
.account-row .ar-health { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 4px; vertical-align: middle; }
.account-row .ar-health.green { background: var(--status-live); }
.account-row .ar-health.amber { background: #d9822b; }
.account-row .ar-health.red { background: var(--status-gap); }
.account-row .ar-health.grey { background: var(--text-tertiary); }

/* Account-mode highlight: when inside an account, the board header uses brand accent */
.board-header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 14px;
}
.board-header .filters { display: flex; gap: 4px; }
.board-header .filters a {
  font-size: 12px; padding: 4px 9px; border-radius: 5px;
  color: var(--text-secondary); text-decoration: none;
}
.board-header .filters a.active { background: var(--accent-light); color: var(--accent); }

/* Coming-soon empty state inside a sub-tab */
.empty-soon {
  background: var(--bg-surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  color: var(--text-secondary);
}
.empty-soon h3 { margin: 0 0 6px; color: var(--text-primary); font-size: 16px; }
.empty-soon p { margin: 0; max-width: 50ch; margin-inline: auto; font-size: 13.5px; }

/* Fixtures banner pinned bottom. Deliberately LOUD (brand orange, larger):
   fixture ad names read as real numbers otherwise (2026-07-19 LP incident).
   SIGNED-OUT ONLY since 2026-09-01 - setFixturesBanner() hides it outright when
   there is a session, so this pill is never over a signed-in screen. The .live
   variant that used to soften it while signed in went with it; see app.js. */
#fixtures-banner {
  position: fixed; bottom: 12px; right: 16px;
  background: var(--nimble-orange);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: 999px;
  letter-spacing: 0.4px;
  z-index: 100;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
}

/* Example-data callout at the top of account operational views when the
   rendered data is world.js fixtures (store.dataProvenance === 'fixture'). */
.op-fixture-callout {
  margin: 0 0 18px;
  padding: 12px 16px;
  border: 1.5px solid var(--nimble-orange);
  border-left-width: 6px;
  border-radius: 8px;
  background: rgba(210, 128, 77, 0.10);
  font-size: 14px;
  line-height: 1.45;
}
.op-fixture-callout strong { color: var(--nimble-orange); }
/* Anchor for the page-spec metadata strip */
.spec-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}
.spec-strip .spec-cell {
  background: var(--bg-surface);
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
}
.spec-strip .spec-cell .sc-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text-tertiary); margin-bottom: 4px;
}
.spec-strip .spec-cell .sc-val {
  font-size: 13px; color: var(--text-primary); font-weight: 500;
}
@media (max-width: 880px) { .spec-strip { grid-template-columns: repeat(2, 1fr); } }

/* ============== Auth: login overlay + chip (Stage 5) ============== */
#shell-login-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: none; align-items: center; justify-content: center;
  background: rgba(0, 42, 44, 0.55); backdrop-filter: blur(3px);
}
#shell-login-overlay.visible { display: flex; }
.shell-login-card {
  position: relative;
  width: 100%; max-width: 380px; margin: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 28px 26px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
}
.shell-login-card h2 {
  margin: 0 0 6px; font-size: 20px; color: var(--nimble-teal); font-weight: 700;
}
.shell-login-sub { margin: 0 0 18px; font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.shell-login-card label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.shell-login-card input[type="email"] {
  width: 100%; box-sizing: border-box; padding: 10px 12px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  font-size: 14px; color: var(--text-primary); margin-bottom: 14px;
}
.shell-login-card input[type="email"]:focus { outline: none; border-color: var(--nimble-teal); }
.shell-login-btn {
  width: 100%; padding: 11px; border: none; border-radius: 8px;
  background: var(--nimble-teal); color: var(--text-inverse);
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.shell-login-btn:hover { background: var(--nimble-teal-dark); }
.shell-login-btn:disabled { opacity: 0.6; cursor: default; }
.shell-login-status { margin-top: 12px; font-size: 12px; color: var(--nimble-teal); line-height: 1.5; }
.shell-login-error { margin-top: 12px; font-size: 12px; color: #b3261e; line-height: 1.5; }
.shell-login-footer { margin-top: 16px; font-size: 11px; color: var(--text-tertiary); text-align: center; }
.shell-login-close {
  position: absolute; top: 12px; right: 14px;
  border: none; background: none; font-size: 22px; line-height: 1;
  color: var(--text-tertiary); cursor: pointer;
}
.shell-login-close:hover { color: var(--text-primary); }

.shell-auth-chip {
  font-size: 11px; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--bg-surface);
  color: var(--text-secondary); cursor: pointer; margin-right: 10px;
}
.shell-auth-chip:hover { border-color: var(--nimble-teal); color: var(--nimble-teal); }
.shell-auth-chip.authed { color: var(--nimble-teal); border-color: var(--nimble-teal-light); background: var(--nimble-teal-light); }

/* ── Portal renderer support: sec/g2 layout + targets + pacing ──────────── */
.sec { margin-bottom: 36px; }
.sec-hdr {
  display: flex; align-items: baseline; gap: 12px;
  margin-bottom: 16px; padding-bottom: 10px;
  border-bottom: 2px solid var(--nimble-teal);
}
.sec-title {
  font-family: 'Montserrat', sans-serif; font-size: 15px; font-weight: 700;
  color: var(--nimble-teal); letter-spacing: 0.5px; flex: 1; text-transform: uppercase;
}
.sec-sub { font-size: 11px; color: var(--text-secondary); letter-spacing: 0.5px; }
.g2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-bottom: 18px; }

.targets-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px; margin-bottom: 14px;
}
.target-card {
  background: var(--bg-surface); border-radius: 10px; padding: 16px 18px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04); border-top: 4px solid var(--nimble-teal);
  text-align: center;
}
.target-card.locked { border-top-color: #aaa; opacity: 0.75; }
.target-label {
  font-size: 9px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--text-secondary); font-weight: 700; margin-bottom: 6px;
}
.target-big {
  font-family: 'Montserrat', sans-serif; font-size: 26px; font-weight: 800;
  color: var(--nimble-teal); line-height: 1.1;
}
.target-sub { font-size: 10.5px; color: var(--text-secondary); margin-top: 4px; letter-spacing: 0.2px; }
.target-actual {
  font-size: 11.5px; color: var(--text-primary); margin-top: 8px;
  padding-top: 8px; border-top: 1px dashed var(--border);
}
.target-actual strong { color: var(--nimble-orange); font-weight: 700; }
.target-actual.locked-text { color: var(--text-secondary); font-style: italic; }

.pacing-card {
  background: var(--bg-surface); border-radius: 8px; padding: 18px 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04); margin-bottom: 14px;
}
.pacing-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.pacing-label { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-secondary); font-weight: 700; }
.pacing-value { font-family: 'Montserrat', sans-serif; font-size: 16px; font-weight: 700; color: var(--nimble-teal); }
.pacing-bar-wrap { background: #e4e4e4; border-radius: 8px; height: 14px; position: relative; overflow: hidden; }
.pacing-bar { height: 100%; background: #8ca786; border-radius: 8px; transition: width 0.4s; }
.pacing-bar.amber { background: var(--nimble-orange); }
.pacing-bar.red { background: #c0392b; }
.pacing-marker { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--nimble-teal); }
.pacing-foot { font-size: 11.5px; color: var(--text-secondary); margin-top: 8px; line-height: 1.45; }
.pacing-foot strong { color: var(--text-primary); font-weight: 600; }

@media (max-width: 700px) {
  .g2 { grid-template-columns: 1fr; }
  .targets-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Performance Mirror (.pm-perf-*) ───────────────────────────────────── */
.pm-perf-table-wrap { overflow-x: auto; margin-top: 14px; }
.pm-perf-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'Raleway', -apple-system, sans-serif;
  font-size: 13px;
}
.pm-perf-th {
  padding: 8px 12px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-tertiary);
  text-align: left;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
  background: var(--bg-muted);
}
.pm-perf-toggle-col { width: 32px; padding: 0; }
.pm-perf-name-col   { min-width: 200px; max-width: 340px; }

.pm-perf-td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-secondary);
  vertical-align: middle;
  white-space: nowrap;
}
.pm-perf-name-col.pm-perf-td { white-space: normal; word-break: break-word; }

/* Level weight + indentation */
.pm-perf-campaign .pm-perf-td  { color: var(--text-primary); font-weight: 600; background: var(--bg-surface); }
.pm-perf-adset .pm-perf-td     { background: var(--bg-surface); }
.pm-perf-adset .pm-perf-td.pm-perf-name-col { padding-left: 28px; }
.pm-perf-ad .pm-perf-td        { font-size: 12px; color: var(--text-tertiary); background: var(--bg-canvas); }
.pm-perf-ad .pm-perf-td.pm-perf-name-col { padding-left: 44px; display: flex; align-items: center; gap: 8px; }
.pm-perf-ad-direct .pm-perf-td { font-size: 12px; color: var(--text-secondary); background: var(--bg-surface); }
.pm-perf-ad-direct .pm-perf-td.pm-perf-name-col { padding-left: 28px; display: flex; align-items: center; gap: 8px; }

/* Toggle cell + button */
.pm-perf-toggle-cell { padding: 6px 4px; text-align: center; }
.pm-perf-toggle-btn  {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-tertiary);
  font-size: 11px;
  padding: 2px 4px;
  line-height: 1;
}
.pm-perf-toggle-btn:hover { color: var(--accent); }

/* Ad thumbnail */
.pm-perf-thumb { width: 28px; height: 28px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }

/* Status badge */
.pm-perf-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  background: var(--bg-muted);
  color: var(--text-tertiary);
}
.pm-perf-badge-active   { background: var(--status-live-bg); color: var(--status-live); }
.pm-perf-badge-paused   { background: var(--bg-muted);       color: var(--text-tertiary); }
.pm-perf-badge-archived { background: var(--status-gap-bg);  color: var(--status-gap); }

/* Window selector */
.pm-perf-win-row { display: flex; gap: 4px; margin: 14px 0 0; }
.pm-perf-win-btn {
  background: none;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 5px 12px;
  font-family: 'Raleway', -apple-system, sans-serif;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.pm-perf-win-btn:hover  { border-color: var(--accent); color: var(--accent); }
.pm-perf-win-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.pm-perf-filter-bar {
  display: flex; align-items: center; gap: 8px; margin: 10px 0 4px; flex-wrap: wrap;
}
.pm-perf-filter-input {
  padding: 5px 10px; border: 1px solid var(--border, #d0d0d0); border-radius: 6px;
  font-size: 12px; color: var(--text-primary); background: var(--bg-surface);
  width: 220px; outline: none;
}
.pm-perf-filter-input:focus { border-color: var(--accent); }
.pm-perf-filter-select {
  padding: 5px 8px; border: 1px solid var(--border, #d0d0d0); border-radius: 6px;
  font-size: 12px; color: var(--text-primary); background: var(--bg-surface); cursor: pointer; outline: none;
}
.pm-perf-filter-select:focus { border-color: var(--accent); }
.pm-perf-filter-spend-wrap { display: flex; align-items: center; gap: 4px; }
.pm-perf-filter-spend-lbl  { font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
.pm-perf-filter-spend-input {
  width: 72px; padding: 5px 8px; border: 1px solid var(--border, #d0d0d0); border-radius: 6px;
  font-size: 12px; color: var(--text-primary); background: var(--bg-surface); outline: none;
}
.pm-perf-filter-spend-input:focus { border-color: var(--accent); }
.pm-perf-filter-clear {
  font-size: 12px; color: var(--accent); background: none; border: none;
  cursor: pointer; padding: 4px 6px; text-decoration: underline;
}
.pm-perf-filter-clear:hover { opacity: .75; }
.pm-perf-win-note {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--text-tertiary);
}
.pm-perf-loading {
  margin: 16px 0;
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
}

/* Custom date range row */
.pm-perf-date-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0 0;
  flex-wrap: wrap;
}
.pm-perf-date-lbl {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.pm-perf-date-input {
  padding: 5px 8px;
  border: 1px solid var(--border, #d0d0d0);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-primary);
  background: var(--bg-surface);
  outline: none;
}
.pm-perf-date-input:focus { border-color: var(--accent); }
.pm-perf-date-apply {
  padding: 5px 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.pm-perf-date-apply:hover { opacity: 0.88; }

/* Column picker */
.pm-perf-picker-wrap { margin: 12px 0 4px; }
.pm-perf-picker      { display: inline-block; position: relative; }
.pm-perf-picker-summary {
  cursor: pointer;
  font-family: 'Raleway', -apple-system, sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--accent);
  padding: 4px 0;
  list-style: none;
  user-select: none;
}
.pm-perf-picker-summary::-webkit-details-marker { display: none; }
.pm-perf-picker-list {
  position: absolute;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 6px 0;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  z-index: 100;
  min-width: 180px;
}
.pm-perf-picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}
.pm-perf-picker-item:hover { background: var(--bg-muted); }
