/* Brand Surge client portal (module "client-portal"). Brand teal, phone first, light and dark. */
:root {
  --brand: #0d9488;
  --brand-ink: #0f766e;
  --brand-deep: #134e4a;
  --brand-soft: #e6f6f4;
  --bg: #f5f8f8;
  --surface: #ffffff;
  --surface-2: #f0f4f4;
  --ink: #0f1a1a;
  --ink-2: #44514f;
  --ink-3: #74817f;
  --line: #e2e9e8;
  --up: #15803d;
  --up-soft: #e7f5ec;
  --down: #c2410c;
  --down-soft: #fdeee6;
  --warn: #b45309;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 40, 38, .05), 0 6px 20px rgba(15, 40, 38, .06);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #2dd4bf; --brand-ink: #5eead4; --brand-deep: #ccfbf1; --brand-soft: #0f2e2b;
    --bg: #0d1312; --surface: #151c1b; --surface-2: #1d2625; --ink: #e8efee; --ink-2: #c4cfcd; --ink-3: #9aa8a6; --line: #26302f;
    --up: #4ade80; --up-soft: #12301c; --down: #fb923c; --down-soft: #3a2116; --warn: #fbbf24;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -.01em; margin: 0; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.boot { display: grid; place-items: center; min-height: 100vh; color: var(--ink-3); }

/* shell */
.top { position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1120px; margin: 0 auto; display: flex; align-items: center; gap: 16px; padding: 12px 20px; }
.top .logo { height: 26px; display: block; }
.logo-dark { display: none !important; }
@media (prefers-color-scheme: dark) { .logo-light { display: none !important; } .logo-dark { display: block !important; } }
.top .who { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); }
.top .client { font-weight: 600; color: var(--ink); font-size: 14px; border-left: 1px solid var(--line); padding-left: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.nav { max-width: 1120px; margin: 0 auto; display: flex; gap: 4px; padding: 0 14px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { padding: 10px 12px; color: var(--ink-2); font-weight: 500; font-size: 14px; border-bottom: 2px solid transparent; white-space: nowrap; }
.nav a:hover { color: var(--ink); text-decoration: none; }
.nav a.on { color: var(--brand-ink); border-bottom-color: var(--brand); }
.main { max-width: 1120px; margin: 0 auto; padding: 24px 20px 64px; animation: up .18s ease; }
@keyframes up { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.preview { background: #fef3c7; color: #78350f; text-align: center; font-size: 13px; padding: 7px 12px; font-weight: 500; }
@media (prefers-color-scheme: dark) { .preview { background: #3b2a0a; color: #fde68a; } }

/* page head */
.hello { margin-bottom: 20px; }
.hello h1 { font-size: 26px; }
.hello p { margin: 4px 0 0; color: var(--ink-2); }
.sec { margin: 28px 0 12px; display: flex; align-items: baseline; gap: 10px; }
.sec h2 { font-size: 17px; }
.sec .more { margin-left: auto; font-size: 13px; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.kpi .label { font-size: 13px; color: var(--ink-3); font-weight: 500; }
.kpi .acct { font-size: 12px; color: var(--ink-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .val { font-family: var(--display); font-size: 30px; font-weight: 700; margin: 6px 0 2px; letter-spacing: -.02em; }
.kpi a.card { display: block; color: inherit; }
a.card:hover { text-decoration: none; border-color: var(--brand); }
.delta { flex: none; white-space: nowrap; display: inline-flex; align-items: center; gap: 3px; font-size: 12.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; }
.delta.good { color: var(--up); background: var(--up-soft); }
.delta.bad { color: var(--down); background: var(--down-soft); }
.delta.flat { color: var(--ink-3); background: var(--surface-2); }
.spark { display: block; margin-top: 10px; width: 100%; height: 36px; }
.spark path.line { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark path.area { fill: var(--brand); opacity: .1; }

.row { display: flex; gap: 12px; align-items: center; }
.list { display: flex; flex-direction: column; }
.list > * { padding: 12px 0; border-bottom: 1px solid var(--line); }
.list > *:last-child { border-bottom: 0; padding-bottom: 0; }
.list > *:first-child { padding-top: 0; }
.date-box { width: 46px; flex: none; text-align: center; border-radius: 10px; background: var(--brand-soft); color: var(--brand-ink); padding: 5px 0; line-height: 1.15; }
.date-box b { display: block; font-size: 18px; font-family: var(--display); }
.date-box span { font-size: 11px; text-transform: uppercase; font-weight: 600; letter-spacing: .04em; }
.avatar { width: 40px; height: 40px; flex: none; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); }
.pill.met { background: var(--up-soft); color: var(--up); }
.pill.on_track { background: var(--brand-soft); color: var(--brand-ink); }
.pill.at_risk { background: #fdf3e2; color: var(--warn); }
.pill.missed { background: var(--down-soft); color: var(--down); }
.tag { display: inline-block; font-size: 12.5px; padding: 3px 10px; border-radius: 99px; border: 1px solid var(--line); color: var(--ink-2); margin: 0 6px 6px 0; }
.empty { text-align: center; color: var(--ink-3); padding: 28px 12px; }
.note { background: var(--brand-soft); color: var(--brand-deep); border-radius: 10px; padding: 12px 14px; font-size: 14px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 10px; padding: 9px 16px; font-weight: 600; cursor: pointer; font-size: 14px; }
.btn:hover { border-color: var(--brand); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-ink); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.link { border: 0; background: none; padding: 0; color: var(--brand-ink); font-weight: 500; }

/* account page */
.acct-head { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 18px; }
.acct-head h1 { font-size: 22px; }
.metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.metric .label { font-size: 12.5px; color: var(--ink-3); }
.metric .val { font-size: 22px; font-weight: 700; font-family: var(--display); margin: 4px 0; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid-l { stroke: var(--line); }
.chart .ax { fill: var(--ink-3); font-size: 11px; }
.chart .line { fill: none; stroke: var(--brand); stroke-width: 2.25; stroke-linejoin: round; }
.chart .area { fill: var(--brand); opacity: .09; }
.chart .dot { fill: var(--brand); }
.back { display: inline-block; margin-bottom: 14px; font-size: 14px; }

/* tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; color: var(--ink-3); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; white-space: nowrap; }
.scroll-x { overflow-x: auto; }

/* report */
.report { max-width: 760px; }
.report h1 { font-size: 24px; margin-bottom: 4px; }
.report .prose p { margin: 0 0 12px; }
.report h3 { font-size: 16px; margin: 26px 0 10px; color: var(--brand-ink); }

/* sign-in */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 500px at 50% -10%, var(--brand-soft), var(--bg)); }
.auth .box { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 30px 26px; box-shadow: var(--shadow); }
.auth .logo { height: 30px; display: block; margin: 0 auto 22px; }
.auth h1 { font-size: 21px; text-align: center; }
.auth .sub { text-align: center; color: var(--ink-2); margin: 6px 0 22px; font-size: 14px; }
label.f { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 14px 0 6px; }
.in { width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; }
.in:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }
.in.code { letter-spacing: .4em; text-align: center; font-size: 22px; font-weight: 700; }
.err { background: var(--down-soft); color: var(--down); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 4px; }
.auth .btn.primary { width: 100%; margin-top: 18px; padding: 12px; }
.auth .foot { text-align: center; margin-top: 16px; font-size: 13px; }

@media (max-width: 640px) {
  .main { padding: 18px 14px 48px; }
  .top-in { padding: 10px 14px; gap: 10px; }
  .top .client { max-width: 46vw; padding-left: 10px; }
  .top .who .name { display: none; }
  .hello h1 { font-size: 22px; }
  .kpi .val { font-size: 26px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}

/* work and approvals */
.pill.wait { background: #fef3c7; color: #92400e; }
@media (prefers-color-scheme: dark) { .pill.wait { background: #3b2a0a; color: #fde68a; } }
.card.waiting { border-color: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .12); }
.sec .count { background: #f59e0b; color: #fff; border-radius: 99px; font-size: 12px; font-weight: 700; padding: 1px 8px; }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 7px 14px; border-radius: 8px; font-weight: 600; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.approve-box { margin-top: 16px; border-color: var(--brand); }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; cursor: pointer; }
label.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--brand); flex: none; }
label.check.off { color: var(--ink-3); cursor: default; }
.msg.client { border-left: 3px solid var(--brand); padding-left: 10px !important; }

/* billing and vault */
.nowrap { white-space: nowrap; }
.card.due-card { border-color: var(--down); }
.over-t { color: var(--down); }
.vault-log { margin-top: 10px; padding: 10px 12px; background: var(--surface-2); border-radius: 10px; display: flex; flex-direction: column; gap: 4px; }

/* what we did */
.done-list { display: flex; flex-direction: column; gap: 10px; }
.done-row { display: flex; gap: 10px; align-items: baseline; }
.done-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); flex: none; transform: translateY(-1px); }

/* Several businesses in one portal */
.biz { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-ink); vertical-align: 1px; white-space: nowrap; }
.biz-tabs { flex-wrap: wrap; }
.top .client { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46vw; }

/* Client branding: the client's logo next to their name, and their colour as a thin bar above the header */
.top:has(.branded) { border-top: 3px solid var(--client); }
.top .client { display: flex; align-items: center; gap: 8px; }
.biz-id { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.biz-name { overflow: hidden; text-overflow: ellipsis; }
.client-logo { height: 28px; max-width: 120px; object-fit: contain; display: block; border-radius: 4px; }
.top .sep { color: var(--ink-3); }
.over-logo { height: 48px; max-width: 200px; object-fit: contain; display: block; margin-bottom: 10px; }
@media (max-width: 640px) { .client-logo { height: 22px; max-width: 80px; } .hide-sm { display: none; } }

/* Monthly report sections */
.rep-sec { margin-top: 26px; }
.rep-sec h3 { margin-bottom: 10px; }
.tbl td.wrap { word-break: break-word; min-width: 140px; }
.up-dot { background: var(--brand-soft); border: 2px solid var(--brand); }

/* billing: cards on phones, table on wider screens */
.inv-cards { display: none; }
.inv-card { margin-bottom: 10px; }
.inv-grid { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin-top: 8px; font-size: 14px; }
@media (max-width: 640px) { .inv-cards { display: block; } .inv-table:not(:has(.empty)) { display: none; } }

/* dashboard: account at a glance (2026-10-13) */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { font-size: 12.5px; padding: 3px 10px; border-radius: 99px; background: var(--brand-soft); color: var(--brand-deep); }
.chip.link { background: transparent; border: 1px solid var(--line); color: var(--brand-ink); }
.grid.glance { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); margin-bottom: 4px; }
.kpi .val.sm { font-size: 20px; display: flex; align-items: center; gap: 8px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; flex: none; background: #94a3b8; }
.dot.ok { background: #16a34a; } .dot.warn { background: #f59e0b; } .dot.bad { background: #dc2626; } .dot.idle { background: #cbd5e1; }
.bar { height: 6px; border-radius: 99px; background: var(--line); margin-top: 6px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.team-mini { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.site-status { text-align: right; }
@media print {
  .top, .nav, .no-print, .preview { display: none !important; }
  .main { padding: 0 !important; max-width: none !important; }
  .card { break-inside: avoid; box-shadow: none !important; }
  body { background: #fff !important; }
}
/* phones: every section visible, no hidden sideways scroll */
/* Phones: one row that scrolls sideways (the open page is scrolled into view), with a fade where more tabs are. */
@media (max-width: 640px) {
  .nav { gap: 0; padding: 0 6px; -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); }
  .nav.at-end { -webkit-mask-image: none; mask-image: none; }
  .nav a { padding: 12px 11px; font-size: 14px; }
  /* Results: two cards a row instead of one tall column. */
  .grid.kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .grid.kpi .card { padding: 14px; }
  .grid.kpi .val { font-size: 22px; }
  .grid.kpi .acct { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .seg button { padding: 9px 14px; min-height: 36px; }
  .grid.glance { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .grid.glance .card { padding: 14px; }
  .grid.glance .val.sm { font-size: 17px; }
  button.chip { min-height: 34px; padding: 6px 12px; }
  .btn.link.small { padding: 8px 0; }
}

/* work: areas, requests, shared files (release 3) */
button.chip { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; font: inherit; font-size: 12.5px; }
button.chip.on { background: var(--brand-soft); color: var(--brand-deep); border-color: transparent; font-weight: 600; }
.card.form { max-width: 640px; }
.card.form label.f:first-of-type { margin-top: 0; }
.prose .files { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.prose .files .label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.prose .files .file { display: flex; justify-content: space-between; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; }
.prose .files .file .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.prose .files .file:hover { border-color: var(--brand); }

/* invoice view (release 4) */
.inv-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.inv-parties .label, .files .label { font-size: 12px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.inv-totals { margin: 12px 0 0 auto; max-width: 320px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.inv-totals > div { display: flex; justify-content: space-between; gap: 12px; }
.inv-totals .t { font-weight: 700; border-top: 1px solid var(--line); padding-top: 6px; margin-top: 2px; }
@media (max-width: 640px) { .inv-parties { grid-template-columns: 1fr; } .inv-totals { max-width: none; } }
@media print { .back, .btn { display: none !important; } }

/* ---------- performance picture and the Meta report (insights.js) ---------- */
.ins-snap { margin-bottom: 14px; }
.ins-sec { margin-bottom: 14px; }
.ins-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin: 12px 0; }
.ins-kpi { background: var(--surface-2); border-radius: 12px; padding: 11px 13px; min-width: 0; }
.ins-kpi .l { font-size: 12px; color: var(--ink-3); line-height: 1.3; }
.ins-kpi .v { font-family: var(--display); font-size: 21px; font-weight: 700; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.ins-kpi .p { font-size: 12px; }
.ins-text { white-space: pre-wrap; line-height: 1.65; font-size: 15px; }
.ins-note { margin-top: 6px; }
.ins-y { margin-bottom: 14px; display: flex; flex-direction: column; gap: 8px; }
.ins-yrow { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; font-size: 13.5px; }
.ins-yrow > b { min-width: 160px; }
.ins-ym { white-space: nowrap; }
.ins-tables { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 18px; margin-top: 6px; }
.ins-tables > * { min-width: 0; }
.ins-tbl h3 { font-size: 14px; margin: 6px 0 4px; }
.ins-tbl .txt { display: inline-block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.tbl-wrap { overflow-x: auto; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--surface-2); }
.linkbtn { background: none; border: 0; padding: 0; color: var(--brand-ink); cursor: pointer; font: inherit; }
.linkbtn.small { font-size: 13px; margin-top: 4px; }
.crumbs { margin-bottom: 10px; }
.mt-name { font-weight: 600; overflow-wrap: anywhere; }
.mt-aud { color: var(--ink-2); margin-top: 2px; max-width: 420px; }
.mt-ads { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.mt-ad { display: flex; flex-direction: column; text-align: left; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: 0; overflow: hidden; cursor: pointer; font: inherit; color: inherit; }
.mt-ad:hover { box-shadow: var(--shadow); }
.mt-ad img, .mt-noimg { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--ink-3); font-size: 12px; }
.mt-adb { padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; }
.mt-adfull { display: grid; grid-template-columns: minmax(0, 280px) 1fr; gap: 16px; }
.mt-adfull img { width: 100%; border-radius: 12px; }
.mt-bars { display: flex; flex-direction: column; gap: 9px; }
.mt-bar { display: grid; grid-template-columns: 200px 1fr; gap: 2px 12px; align-items: center; }
.mt-bl { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-bt { height: 10px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.mt-bt span { display: block; height: 100%; background: var(--brand); border-radius: 6px; }
.mt-bv { grid-column: 2; color: var(--ink-2); }
.modal-back { position: fixed; inset: 0; background: rgba(10, 20, 20, .45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 50; overflow-y: auto; }
.modal-back .modal { width: 100%; max-width: 760px; }
@media (max-width: 700px) {
  .ins-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ins-tables { grid-template-columns: 1fr; }
  .mt-adfull, .mt-bar { grid-template-columns: 1fr; }
  .mt-bv { grid-column: 1; }
  .ins-yrow > b { min-width: 0; width: 100%; }
}

/* ---------- Leads (lead quality, see docs/notes/lead-quality.md) ---------- */
.in.sm { padding: 6px 10px; font-size: 13px; width: auto; border-radius: 8px; }
.lq-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 16px 0 10px; }
.lq-list { padding: 4px 16px; }
.lq-row { display: flex; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.lq-row:last-child { border-bottom: 0; }
.lq-main { flex: 1; min-width: 0; line-height: 1.45; word-break: break-word; }
.lq-act { flex: 0 0 auto; max-width: 52%; display: flex; justify-content: flex-end; }
.lq-btns, .lq-pick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; }
.lq-btns .lq-q { border-color: var(--ok, #15803d); color: var(--ok, #15803d); }
.lq-badge { font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 99px; background: var(--surface-2); white-space: nowrap; }
.lq-badge.ok { background: #e7f6ec; color: #166534; } .lq-badge.warn { background: #fff4e0; color: #9a5b00; } .lq-badge.bad { background: #fde8e8; color: #9b1c1c; }
.lq-more { width: 100%; text-align: right; } .lq-more summary { list-style: none; display: inline; } .lq-more[open] .lq-btns { margin-top: 6px; }
.lq-ans { margin: 6px 0; padding: 8px 10px; background: var(--surface-2); border-radius: 8px; font-size: 13px; }
.lq-note { margin-top: 4px; }
@media (max-width: 640px) { .lq-row { flex-direction: column; gap: 8px; } .lq-act { max-width: 100%; justify-content: flex-start; } .lq-btns, .lq-pick { justify-content: flex-start; } .lq-more { text-align: left; } }
@media (prefers-color-scheme: dark) { .lq-badge.ok { background: #0f3320; color: #86efac; } .lq-badge.warn { background: #3a2a0a; color: #fcd34d; } .lq-badge.bad { background: #3b1111; color: #fca5a5; } }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: 9px 16px; border-radius: 10px; z-index: 60; display: none; max-width: 90vw; }
.lq-bar .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; } .lq-bar .seg button { white-space: nowrap; flex: 0 0 auto; }

/* ---------- agency portal (agency.js) ---------- */
.ag .metrics { margin-bottom: 14px; }
.ag-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.ag-chart { padding: 16px 16px 10px; }
.ag-ch-t { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.ag-ch-n { font-family: var(--display); font-size: 22px; font-weight: 700; margin: 4px 0 6px; display: flex; align-items: center; gap: 8px; }
.ag-legend { font-weight: 500; color: var(--ink-3); display: inline-flex; align-items: center; gap: 6px; }
.ag-legend i { display: inline-block; width: 16px; height: 0; border-top: 2.5px solid var(--brand); }
.ag-legend i.prev { border-top: 2px dashed var(--ink-3); margin-left: 8px; }
.chart .ag-prev { fill: none; stroke: var(--ink-3); stroke-width: 1.6; stroke-dasharray: 4 4; opacity: .7; }
.ag-pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.ag-pill.good { background: var(--up-soft); color: var(--up); }
.ag-pill.bad { background: var(--down-soft); color: var(--down); }
.ag-pill.warn { background: #fef3c7; color: var(--warn); }
.ag-pill.ok { background: var(--brand-soft); color: var(--brand-ink); }
@media (prefers-color-scheme: dark) { .ag-pill.warn { background: #3a2c10; } }
.ag-hl { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ag-hl-card { padding: 14px 16px; }
.ag-hl-card.bad { border-left: 4px solid var(--down); }
.ag-hl-card.good { border-left: 4px solid var(--up); }
.ag-hl-t { font-weight: 700; margin-bottom: 6px; }
.ag-hl-row { display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: left; border: 0; background: none; padding: 7px 0; border-top: 1px solid var(--line); cursor: pointer; color: var(--ink); }
.ag-hl-row:first-of-type { border-top: 0; }
.ag-hl-row:hover b { color: var(--brand-ink); }
.ag-filters { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ag-q { width: 200px; padding: 7px 11px; }
.ag-table td { vertical-align: middle; }
.ag-sort { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; font-weight: 600; }
.ag-sort.on { color: var(--ink); }
.ag-mini { width: 96px; height: 26px; display: block; }
.ag-mini path { fill: none; stroke: var(--brand); stroke-width: 1.8; vector-effect: non-scaling-stroke; }
.ag-rank { font-size: 12.5px; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--brand-soft); color: var(--brand-ink); }
.ag-crumbs { margin-bottom: 10px; flex-wrap: wrap; }
.ag-switch { max-width: 260px; padding: 7px 10px; font-weight: 600; }
.top .agency-name { font-family: var(--display); font-weight: 700; font-size: 16px; white-space: nowrap; }
@media (max-width: 760px) {
  .ag-charts, .ag-hl { grid-template-columns: 1fr; }
  .ag-filters { margin-left: 0; width: 100%; }
  .ag-q { width: 100%; }
  .sec { flex-wrap: wrap; }
}
.ag-cards { display: grid; gap: 10px; }
.ag-acard { display: block; width: 100%; text-align: left; color: var(--ink); cursor: pointer; font: inherit; }
.ag-acard-g { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 6px; }
.ag-acard-g b { display: block; font-size: 16px; margin: 2px 0 3px; }
.ag-acard .ag-mini { width: 100%; height: 30px; }
.top .agency-head { display: inline-flex; gap: 10px; align-items: center; min-width: 0; }
@media (max-width: 640px) {
  .top-in { flex-wrap: wrap; }
  .top .agency-head { order: 3; flex-basis: 100%; }
  .ag-switch { max-width: none; flex: 1; }
}
.top .client.agency-head { max-width: none; overflow: visible; }
@media (max-width: 640px) { .top .client.agency-head { border-left: 0; padding-left: 0; } }

/* files (files.js) */
.cf-row { gap: 10px; align-items: center; flex-wrap: wrap; }
.cf-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; background: #eef2f1; }
.cf-icon { width: 44px; height: 44px; border-radius: 8px; background: #eef2f1; display: grid; place-items: center; font-size: 10px; font-weight: 700; color: #55606a; }
.cf-name { overflow-wrap: anywhere; }

/* Timesheets (public-client/timesheets.js) */
.ts-week { margin-bottom: 10px; }
.ts-week.waiting { border-left: 4px solid var(--warn, #b45309); }
.ts-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; cursor: pointer; flex-wrap: wrap; }
.ts-right { display: flex; gap: 8px; align-items: center; }
.ts-hours { font-size: 18px; font-variant-numeric: tabular-nums; }
.ts-body { margin-top: 10px; }
.ts-days { width: 100%; font-size: 13px; border-collapse: collapse; margin-bottom: 8px; }
.ts-days td { padding: 4px 6px; border-bottom: 1px solid var(--line, #e4e8e6); }
.ts-days td.r { text-align: right; white-space: nowrap; }
.ts-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.pill.ok { background: var(--up-soft); color: var(--up); }
.pill.warn { background: var(--down-soft); color: var(--down); }
.pill.muted { background: var(--surface-2); color: var(--ink-3, var(--ink-2)); }

/* Monthly report charts and images (src/report_studio.js layout) */
.rep-bars { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.rep-bar { border: 1px solid var(--line, #e4e8e6); border-radius: 10px; padding: 10px 12px; }
.rep-bar-row { display: grid; grid-template-columns: 82px 1fr auto; gap: 8px; align-items: center; font-size: 12.5px; margin-top: 6px; }
.rep-bar-row.wide { grid-template-columns: minmax(0, 38%) 1fr auto; }
.rep-bar-track { height: 12px; background: var(--surface-2, #f1f4f3); border-radius: 4px; overflow: hidden; }
.rep-bar-fill { display: block; height: 100%; border-radius: 4px; }
.rep-bar-fill.b0 { background: #0F5A44; } .rep-bar-fill.b1 { background: #9bb8ad; } .rep-bar-fill.b2 { background: #c9d6d0; }
.rep-img { margin: 10px 0; } .rep-img img { max-width: 100%; border-radius: 10px; border: 1px solid var(--line, #e4e8e6); }
@media print { .rep-bar { break-inside: avoid; } }

/* ---------- Surge AI, services and meetings (portalplus.js) ---------- */
.ai-page { display: grid; grid-template-columns: 260px 1fr; gap: 16px; align-items: start; }
.ai-side { position: sticky; top: 12px; }
.ai-chats { display: grid; gap: 4px; margin-top: 12px; max-height: 50vh; overflow: auto; }
.ai-chat { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 8px 10px; border: 1px solid transparent; border-radius: 8px; background: none; cursor: pointer; font: inherit; color: inherit; }
.ai-chat:hover, .ai-chat.on { background: var(--surface-2); border-color: var(--line, #e5e7eb); }
.ai-main { display: flex; flex-direction: column; min-height: 70vh; padding: 0; overflow: hidden; }
.ai-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line, #e5e7eb); flex-wrap: wrap; }
.ai-thread { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; max-height: 64vh; }
.ai-empty { text-align: center; margin: auto; max-width: 560px; }
.ai-starters { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.ai-starters .chip { border: 1px solid var(--line, #e5e7eb); background: var(--surface); border-radius: 99px; padding: 6px 12px; cursor: pointer; font: inherit; color: inherit; }
.ai-msg { display: flex; flex-direction: column; gap: 8px; }
.ai-msg.user { align-items: flex-end; }
.ai-bubble { max-width: 80%; padding: 10px 14px; border-radius: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.ai-msg.user .ai-bubble { background: var(--brand, #0d9488); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.ai-msg.assistant .ai-bubble { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.ai-bubble strong, .ai-bubble b { color: var(--ink); }
.ai-bubble p { margin: 0 0 8px; } .ai-bubble p:last-child { margin: 0; } .ai-bubble ul { margin: 4px 0 8px 18px; padding: 0; }
.ai-action { max-width: 80%; border: 1px solid var(--brand, #0d9488); border-radius: 12px; padding: 12px 14px; background: var(--surface); }
.ai-action-h { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.ai-input { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line, #e5e7eb); align-items: flex-end; }
.ai-input textarea { flex: 1; resize: none; }
.ai-fab { position: fixed; right: 18px; bottom: 18px; z-index: 50; display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 99px; background: var(--brand, #0d9488); color: #fff; text-decoration: none; box-shadow: 0 6px 18px rgba(0,0,0,.18); font-weight: 600; }
.ok-note { background: rgba(13,148,136,.1); border: 1px solid rgba(13,148,136,.35); border-radius: 8px; padding: 8px 10px; margin: 6px 0; }
.cards2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.svc-list { display: grid; gap: 6px; } .svc { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line, #eee); }
.seg { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; } .seg button { border: 1px solid var(--line, #e5e7eb); background: none; border-radius: 99px; padding: 5px 12px; cursor: pointer; font: inherit; color: inherit; } .seg button.on { background: var(--brand, #0d9488); color: #fff; border-color: transparent; }
.book-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line, #e5e7eb); border-radius: 10px; margin-top: 8px; color: inherit; text-decoration: none; }
.book-link span { flex: 1; } .mt-row { padding: 8px 0; border-bottom: 1px solid var(--line, #eee); }
@media (max-width: 860px) {
  .ai-page, .cards2 { grid-template-columns: 1fr; }
  .ai-side { position: static; order: 2; }
  .ai-bubble, .ai-action { max-width: 100%; }
  .ai-fab { bottom: 76px; right: 12px; padding: 10px 12px; } .ai-fab span { display: none; }
}

.ai-starters .chip { border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); border-radius: 99px; padding: 8px 14px; font: inherit; font-size: 13.5px; cursor: pointer; }
.ai-starters .chip:hover { border-color: var(--brand, #0d9488); color: var(--brand, #0d9488); }

/* White label (docs/notes/client-portal.md): the agency's logo or name in the header and sign-in box; agency settings. */
.wl-logo { max-height: 34px; max-width: 170px; width: auto; object-fit: contain; }
.auth .wl-logo { max-height: 48px; max-width: 220px; margin-bottom: 8px; }
.wl-name { font-family: 'Plus Jakarta Sans', Inter, sans-serif; font-weight: 800; font-size: 18px; color: var(--ink); letter-spacing: -.01em; }
.auth .wl-name { display: block; font-size: 22px; margin-bottom: 8px; }
.wl-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 24px; }
@media (max-width: 760px) { .wl-grid { grid-template-columns: 1fr; } }
.wl-color { width: 44px; height: 40px; padding: 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.wl-logo-prev { max-height: 40px; max-width: 180px; background: #fff; border-radius: 8px; padding: 4px 8px; border: 1px solid var(--line); }
.wl-prev { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.wl-prev-bar { height: 4px; }
.wl-prev-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.wl-prev-head img { max-height: 28px; max-width: 130px; }
.wl-prev-body { padding: 14px; }
.wl-prev-btn { display: inline-block; margin-top: 12px; color: #fff; border-radius: 8px; padding: 7px 12px; font-size: 13px; font-weight: 600; }

/* Surge AI charts (aichart.js) */
.aic{margin:10px 0;padding:10px 12px 8px;border:1px solid var(--line);border-radius:12px;background:var(--surface,var(--card,#fff))}
.aic figcaption{font-size:13px;font-weight:600;margin-bottom:4px}.aic svg{width:100%;height:auto;display:block}
.aic-grid{stroke:var(--line);stroke-width:1}.aic-ax{font-size:10.5px;fill:var(--ink-3,var(--muted,#6b7280))}.aic-val{font-size:10px;fill:var(--ink-2,var(--text,#374151))}
.aic-legend{display:flex;gap:14px;flex-wrap:wrap;font-size:12px;color:var(--ink-2,var(--muted,#6b7280));margin-top:2px}.aic-legend i{display:inline-block;width:10px;height:10px;border-radius:3px;margin-right:5px;vertical-align:-1px}
.ai-bubble.wide { max-width: 100%; width: 100%; }
.ai-table { overflow-x: auto; margin: 6px 0 10px; } .ai-table .tbl { font-size: 13px; } .ai-table th, .ai-table td { padding: 6px 8px; white-space: nowrap; }
/* White label: own address and email (whitelabel.js) */
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; word-break: break-all; }

/* Agency dashboard readability (Ubaid, 20 Nov 2026): KPI cards fill the row, bigger numbers, no wrapped "was …",
   a 7-day average line over the daily one, a lone highlight card across the page, every menu item visible. */
.ag .metrics { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.ag .metric { padding: 16px; }
.ag .metric .label { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.ag .metric .val { font-size: 28px; margin: 6px 0 8px; letter-spacing: -.02em; }
.ag .metric .row { flex-wrap: nowrap; white-space: nowrap; gap: 8px; }
.ag-ch-t { color: var(--ink); font-size: 14px; }
.ag-ch-n { font-size: 26px; }
.chart .ag-raw { fill: none; stroke: var(--brand); stroke-width: 1.2; opacity: .35; }
.chart .line.avg { stroke-width: 3; }
.ag-legend i.raw { border-top: 1.5px solid var(--brand); opacity: .45; margin-left: 8px; }
.ag-hl > :only-child { grid-column: 1 / -1; }
.ag-hl > :only-child .ag-hl-rows { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); column-gap: 24px; }
.ag-hl > :only-child .ag-hl-row:nth-of-type(-n+3) { border-top: 0; }
.ag-hl-row b { font-size: 15px; }
.ag-mini { width: 120px; height: 30px; }
.ag-mini path { stroke-width: 2.2; }
.ag-table td b { font-size: 15px; }
@media (min-width: 900px) { .nav { flex-wrap: wrap; overflow: visible; } }
/* Grouped pages (app.js GROUPS): the tabs of the group at the top of the page; the account picked in the header. */
.subnav { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 18px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; width: fit-content; max-width: 100%; }
.subnav a { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 9px; color: var(--ink-2); font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.subnav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.subnav a.on { background: var(--brand); color: #fff; }
.scope-note { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; padding: 9px 14px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-ink); font-size: 13.5px; }
.scope-note .linkish { border: 0; background: none; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; font-weight: 600; }
@media (max-width: 640px) {
  .subnav { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
  .subnav a { justify-content: center; padding: 8px 10px; }
  .ag .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .ag .metric { padding: 13px; }
  .ag .metric .val { font-size: 22px; margin: 4px 0 6px; }
  .ag .metric .row { flex-wrap: wrap; white-space: normal; gap: 4px; }
}
/* DNS guidance on "Your clients" (whitelabel.js) */
.dns-guide { margin-top: 10px; }
.dns-steps { margin: 6px 0 6px; padding-left: 20px; font-size: 14px; line-height: 1.6; }
.dns-steps li { margin-bottom: 10px; }
.dns-where { margin-top: 6px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13.5px; }
.dns-tbl td { vertical-align: top; }
.dns-more { margin-top: 10px; }
.dns-more summary { cursor: pointer; font-weight: 600; font-size: 13.5px; }
.dns-more ul { margin: 8px 0 0; padding-left: 18px; line-height: 1.6; }
.dns-more li { margin-bottom: 6px; }
/* Agency reports for its clients (agencyreports.js) */
.ar-new { display: grid; grid-template-columns: 1.2fr 1fr 1.4fr auto; gap: 10px; align-items: end; margin-top: 10px; }
.ar-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 16px; align-items: start; }
.ar-grid textarea { resize: vertical; }
.ar-prev { margin-top: 16px; }
.ar-prev iframe { width: 100%; height: 900px; border: 1px solid var(--line); border-radius: 10px; background: #f4f6f5; }
@media (max-width: 900px) { .ar-new, .ar-grid { grid-template-columns: 1fr; } .ar-prev iframe { height: 640px; } }
