/* Client portal app-shell — sidebar + topbar chrome, ported from the Bridge
   portal prototype. Loaded only by client_base.html, so it never touches the
   operator or partner surfaces. Page CONTENT still styles via bridge.css
   (surface-card / metric-card / cc-chip / cc-btn); this file is the shell. */

:root {
  --cc-bg: #F4F7FB; --cc-bg-sunk: #EEF3F9; --cc-surface: #FFFFFF;
  --cc-ink: #0F172A; --cc-ink-2: #334155; --cc-ink-3: #64748B; --cc-ink-4: #94A3B8;
  --cc-rule: #E2E8F0; --cc-rule-soft: #EEF2F7;
  --cc-brand: #2563EB; --cc-brand-ink: #1D4ED8; --cc-brand-soft: #DCE5FA;
  --cc-teal: #0F766E; --cc-teal-ink: #0B5A54; --cc-teal-soft: #D5EDE9;
  --cc-surface-2: #F8FAFD; --cc-bg-sunk: #EEF3F9;
  --cc-ok: #157048; --cc-ok-bg: #D6EBDD; --cc-warn: #A66A00; --cc-warn-bg: #FBEACB;
  --cc-shadow: 0 4px 14px rgba(15,23,42,.06); --cc-shadow-lg: 0 20px 50px -20px rgba(37,99,235,.22);
  --cc-r-lg: 18px; --cc-r-md: 12px;
  --cc-sidebar-bg: rgba(255,255,255,.72); --cc-topbar-bg: rgba(248,251,255,.9);
  --cc-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --cc-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --cc-shadow-sm: 0 1px 2px rgba(15,23,42,.05);
  --cc-wash: radial-gradient(circle at 4% -2%,rgba(75,160,248,.10),transparent 30%),
             radial-gradient(circle at 98% 2%,rgba(34,200,182,.09),transparent 26%),
             linear-gradient(180deg,#F7FBFF 0%,#F2F7FD 60%,#EEF4FB 100%);
}

body.cc-portal { background: var(--cc-bg); background-image: var(--cc-wash); background-attachment: fixed; }

/* shell grid */
.cc-app { display: grid; grid-template-columns: 244px 1fr; min-height: 100vh; }

/* sidebar */
.cc-side {
  background: var(--cc-sidebar-bg); backdrop-filter: blur(12px);
  border-right: 1px solid var(--cc-rule); padding: 18px 14px;
  display: flex; flex-direction: column; gap: 3px;
  position: sticky; top: 0; height: 100vh;
}
.cc-side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
.cc-side-brand .mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--cc-teal) 0%, var(--cc-brand) 100%);
  display: grid; place-items: center; color: #fff; font-weight: 800; box-shadow: var(--cc-shadow-sm);
}
.cc-side-brand b { font-size: 18px; font-weight: 700; letter-spacing: -.01em; color: var(--cc-ink); }
.cc-side-brand small { display: block; font-size: 8.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--cc-ink-4); font-weight: 700; margin-top: 1px; }
.cc-side-label { font-size: 9.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--cc-ink-4); padding: 16px 10px 6px; }
.cc-nav {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 11px;
  color: var(--cc-ink-2); font-weight: 500; font-size: 15px; text-align: left;
  transition: .14s; position: relative;
}
.cc-nav svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.7; fill: none; flex: none; opacity: .8; }
.cc-nav:hover { background: var(--cc-rule-soft); }
.cc-nav.on { background: var(--cc-brand-soft); color: var(--cc-brand-ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--cc-brand); }
.cc-nav.on svg { opacity: 1; }
.cc-nav .badge { margin-left: auto; background: var(--cc-teal); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 8px; }
.cc-side-foot { margin-top: auto; border-top: 1px solid var(--cc-rule); padding-top: 12px; }
.cc-side-foot .row { display: flex; align-items: center; gap: 10px; padding: 4px 6px; }
.cc-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--cc-brand-soft); color: var(--cc-brand-ink); display: grid; place-items: center; font-weight: 800; font-size: 12px; flex: none; }
.cc-side-foot b { font-size: 12.5px; display: block; color: var(--cc-ink); }
.cc-side-foot span { font-size: 11px; color: var(--cc-ink-3); }
.cc-side-signout { display: block; margin-top: 8px; text-align: center; font-size: 12px; font-weight: 600; color: var(--cc-ink-3); border: 1px solid var(--cc-rule); border-radius: 999px; padding: 6px; transition: .15s; }
.cc-side-signout:hover { color: #dc2626; border-color: #fca5a5; }

/* main column */
.cc-main { min-width: 0; display: flex; flex-direction: column; }
.cc-topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
  padding: 14px 28px; background: var(--cc-topbar-bg); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--cc-rule);
}
.cc-crumb { font-size: 14px; color: var(--cc-ink-3); letter-spacing: .02em; }
.cc-crumb b { color: var(--cc-ink); font-weight: 700; }
.cc-topbar .spacer { flex: 1; }
.cc-content { padding: 26px 28px 60px; }

/* staff persona switcher (full-width, above the shell) */
.cc-persona { display: flex; align-items: center; gap: 12px; padding: 8px 20px; background: var(--cc-brand); color: #fff; }
.cc-persona .lab { font-size: 10px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; opacity: .85; }
.cc-persona .seg { display: inline-flex; background: rgba(255,255,255,.16); border-radius: 999px; padding: 3px; }
.cc-persona .seg a { border-radius: 999px; padding: 4px 14px; font-weight: 700; font-size: 12.5px; color: rgba(255,255,255,.85); }
.cc-persona .seg a.on { background: #fff; color: var(--cc-brand); }
.cc-persona .hint { font-size: 11.5px; opacity: .8; }

@media (max-width: 860px) {
  .cc-app { grid-template-columns: 1fr; }
  .cc-side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .cc-side-foot, .cc-side-label { display: none; }
}

/* ── page components (ported from the prototype design system) ───────────── */
.cc-eyebrow { font-family: var(--cc-mono); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .14em; color: var(--cc-teal-ink); }
.cc-phead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.cc-phead h1, .cc-h1 { font-family: var(--cc-display); font-size: 27px; font-weight: 600; letter-spacing: -.01em; margin: 6px 0 0; color: var(--cc-ink); text-wrap: balance; }
.cc-phead p { margin: 6px 0 0; color: var(--cc-ink-3); max-width: 64ch; font-size: 15px; }
.cc-phead-actions { display: flex; gap: 9px; flex-wrap: wrap; }

.cc-card { background: var(--cc-surface); border: 1px solid var(--cc-rule); border-radius: var(--cc-r-lg); box-shadow: var(--cc-shadow); padding: 20px; }
.cc-card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.cc-card-h h3 { font-family: var(--cc-display); font-size: 17px; font-weight: 600; margin: 0; color: var(--cc-ink); }

.cc-grid { display: grid; gap: 16px; }
.cc-g4 { display: grid; gap: 16px; grid-template-columns: repeat(4, 1fr); }
.cc-g2 { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); align-items: start; }
.cc-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (max-width: 1080px) { .cc-g4 { grid-template-columns: repeat(2, 1fr); } .cc-g2 { grid-template-columns: 1fr; } }

/* ── Overflow safety: no page ever scrolls sideways ──────────────────────
   Grid tracks default to a min-content floor, so one long unbreakable token
   (an email address, a URL) inside a card blows the track past the viewport
   and the whole page scrolls. Let every grid/flex child shrink, wrap long
   tokens inside cards, and keep content within the main column. Applies to
   every page on the shell — client, partner, and operator. */
.cc-content { max-width: 100%; }
.cc-grid > *, .cc-g4 > *, .cc-g2 > *, .cc-col > * { min-width: 0; }
.cc-card { max-width: 100%; overflow-wrap: anywhere; }
body.cc-portal { overflow-x: hidden; }

.cc-kpi { background: var(--cc-surface); border: 1px solid var(--cc-rule); border-radius: var(--cc-r-lg); box-shadow: var(--cc-shadow); padding: 16px 18px; }
.cc-kpi .lab { font-family: var(--cc-mono); font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--cc-ink-4); }
.cc-kpi .num { font-family: var(--cc-display); font-size: 30px; font-weight: 600; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; color: var(--cc-ink); }
.cc-kpi .sub { font-size: 13px; color: var(--cc-ink-3); margin-top: 3px; }
.cc-kpi.link { display: block; transition: .15s; }
.cc-kpi.link:hover { border-color: var(--cc-ink-3); transform: translateY(-1px); }

.cc-pill { display: inline-flex; align-items: center; gap: 5px; font-family: var(--cc-mono); font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; border-radius: 999px; padding: 3px 10px; }
.cc-pill.blue { background: var(--cc-brand-soft); color: var(--cc-brand-ink); }
.cc-pill.teal { background: var(--cc-teal-soft); color: var(--cc-teal-ink); }
.cc-pill.ok { background: var(--cc-ok-bg); color: var(--cc-ok); }
.cc-pill.warn { background: var(--cc-warn-bg); color: var(--cc-warn); }
.cc-pill.neutral { background: var(--cc-bg-sunk); color: var(--cc-ink-3); }
.cc-dot-i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.cc-kv { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--cc-rule-soft); font-size: 14px; }
.cc-kv:last-child { border-bottom: 0; }
.cc-kv .k { color: var(--cc-ink-3); }
.cc-kv .v { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--cc-ink); }

.cc-nudge { background: linear-gradient(120deg, var(--cc-teal-soft), var(--cc-brand-soft)); border: 1px solid var(--cc-rule); border-radius: var(--cc-r-lg); padding: 18px 20px; display: flex; align-items: center; gap: 16px; }
.cc-nudge .ic { width: 42px; height: 42px; border-radius: 12px; background: var(--cc-surface); display: grid; place-items: center; flex: none; box-shadow: var(--cc-shadow); }
.cc-nudge .ic svg { width: 22px; height: 22px; stroke: var(--cc-teal-ink); stroke-width: 1.8; fill: none; }
.cc-nudge b { font-family: var(--cc-display); font-size: 16px; color: var(--cc-ink); }
.cc-nudge p { margin: 3px 0 0; font-size: 13px; color: var(--cc-ink-2); }
.cc-nudge .go { margin-left: auto; flex: none; }

.cc-note { font-size: 13px; color: var(--cc-ink-3); background: var(--cc-bg-sunk); border: 1px dashed var(--cc-rule); border-radius: var(--cc-r-md); padding: 10px 13px; }
.cc-caption { font-size: 13.5px; color: var(--cc-ink-4); font-family: var(--cc-mono); }

/* Readability lift — the partner (and operator) pages lean on a lot of tiny
   hardcoded Tailwind sizes; nudge the smallest ones up a notch. Scoped to the
   app shell (.cc-portal) so it never touches the participant portal, which
   doesn't load this stylesheet. !important beats Tailwind's own `!text-[…]`. */
.cc-portal .text-\[9px\],
.cc-portal .\!text-\[9px\]  { font-size: 11px   !important; }
.cc-portal .text-\[10px\],
.cc-portal .\!text-\[10px\] { font-size: 11.5px !important; }
.cc-portal .text-\[11px\],
.cc-portal .\!text-\[11px\] { font-size: 12.5px !important; }
.cc-portal .text-xs        { font-size: 12.75px !important; }
