/* CiteMark — by Café del Mark.
   Direction: a proofreader's desk for AI citations. Cool grey-green paper, ink type,
   a petrol accent for the client and for actions, and one loud device: the yellow
   highlighter, reserved for competitor mentions inside AI answers (and the brand mark).
   Quoted material (AI answers, score numerals, page titles) is set in a serif; UI in a sans.

   Theme: tokens on :root (light). Dark applies with the OS setting unless the user picked
   light ([data-theme="light"]), or always with [data-theme="dark"]. */

:root {
  --font-ui: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, "Noto Sans", Roboto, Arial, sans-serif;
  --font-quote: "Source Serif 4", "Source Serif Pro", Georgia, "Noto Serif", "Times New Roman", serif;
  --font-code: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* spacing scale */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px;
  /* type scale */
  --t-xs: 12px; --t-sm: 13px; --t-md: 14px; --t-base: 15px; --t-lg: 17px; --t-xl: 20px; --t-2xl: 26px; --t-3xl: 32px;
  /* radii */
  --r-xs: 4px; --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-pill: 999px;

  --topbar-h: 60px;
  --sidebar-w: 268px;
  --content-max: 1360px;
  --logo-height: 30px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --dur: .16s;

  --bg: #F1F4F3;
  --surface: #FFFFFF;
  --surface-2: #F7F9F8;
  --surface-3: #ECF0EF;
  --line: #E1E6E5;
  --line-strong: #C8D0CE;
  --ink: #17212B;
  --ink-2: #44515D;
  --ink-3: #66727D;

  --accent: #0E6B73;
  --accent-hover: #0A5960;
  --accent-ink: #FFFFFF;
  --accent-soft: #E2EFEE;
  --accent-line: #A9CFCF;

  --mark: #F7DC6F;          /* highlighter: competitor mentions + brand */
  --mark-ink: #2A2200;

  --pass: #2B7A4B;  --pass-soft: #E3F1E8;
  --warn: #8F5E00;  --warn-soft: #FBF0D8;
  --fail: #B23838;  --fail-soft: #F9E4E2;
  --unknown: #5E6A75; --unknown-soft: #E9EDF0;

  --series-1: #0E6B73;      /* Doctor (solid, round markers) */
  --series-2: #C0612B;      /* GEO visibility (dashed, square markers) */

  --focus: #1D5FD1;
  --shadow-sm: 0 1px 2px rgba(16, 28, 36, .05);
  --shadow-md: 0 1px 2px rgba(16, 28, 36, .05), 0 6px 18px -8px rgba(16, 28, 36, .16);
  --shadow-lg: 0 24px 60px -16px rgba(10, 20, 28, .35), 0 2px 6px rgba(10, 20, 28, .08);
  --scrim: rgba(12, 20, 26, .42);
  --skel: #E6EBEA;
  --skel-hi: #F3F6F5;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1317; --surface: #151C22; --surface-2: #1A2229; --surface-3: #202A32;
    --line: #26313A; --line-strong: #37444F;
    --ink: #E4E9EC; --ink-2: #B4BFC7; --ink-3: #8C99A4;
    --accent: #4FB0B8; --accent-hover: #6CC3CA; --accent-ink: #08191B; --accent-soft: #143238; --accent-line: #24585D;
    --mark: #D9B940; --mark-ink: #1C1600;
    --pass: #63C08A; --pass-soft: #15301F;
    --warn: #E2AE45; --warn-soft: #33270F;
    --fail: #F07C72; --fail-soft: #3A1D1C;
    --unknown: #9AA6B0; --unknown-soft: #222B33;
    --series-1: #1D9AA5; --series-2: #D4733B;
    --focus: #7FB0FF;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-md: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -10px rgba(0, 0, 0, .55);
    --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, .7);
    --scrim: rgba(0, 0, 0, .55);
    --skel: #1E272F; --skel-hi: #27323B;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1317; --surface: #151C22; --surface-2: #1A2229; --surface-3: #202A32;
  --line: #26313A; --line-strong: #37444F;
  --ink: #E4E9EC; --ink-2: #B4BFC7; --ink-3: #8C99A4;
  --accent: #4FB0B8; --accent-hover: #6CC3CA; --accent-ink: #08191B; --accent-soft: #143238; --accent-line: #24585D;
  --mark: #D9B940; --mark-ink: #1C1600;
  --pass: #63C08A; --pass-soft: #15301F;
  --warn: #E2AE45; --warn-soft: #33270F;
  --fail: #F07C72; --fail-soft: #3A1D1C;
  --unknown: #9AA6B0; --unknown-soft: #222B33;
  --series-1: #1D9AA5; --series-2: #D4733B;
  --focus: #7FB0FF;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -10px rgba(0, 0, 0, .55);
  --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, .7);
  --scrim: rgba(0, 0, 0, .55);
  --skel: #1E272F; --skel-hi: #27323B;
  color-scheme: dark;
}

/* Logos follow the effective theme (OS or manual). */
.logo-on-dark { display: none !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-on-light { display: none !important; }
  :root:not([data-theme="light"]) .logo-on-dark { display: block !important; }
}
:root[data-theme="dark"] .logo-on-light { display: none !important; }
:root[data-theme="dark"] .logo-on-dark { display: block !important; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 56px); }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--t-base);
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.modal-open { overflow: hidden; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 600; letter-spacing: -0.005em; }
p { margin: 0; }
a { color: var(--accent); text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-hover); }
code, pre, kbd { font-family: var(--font-code); font-size: 13px; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { max-width: 100%; }
::selection { background: var(--accent-soft); }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-xs); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: -1px; }
.skip-link { position: absolute; left: 8px; top: -48px; background: var(--surface); padding: 8px 12px; z-index: 200; border: 1px solid var(--line); border-radius: var(--r-sm); }
.skip-link:focus { top: 8px; }
[hidden] { display: none !important; }

/* icons */
.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: middle; }
.i-sm { width: 15px; height: 15px; }
.i-xs { width: 12px; height: 12px; stroke-width: 2.4; }
.i-lg { width: 22px; height: 22px; }

kbd {
  display: inline-flex; align-items: center; gap: 2px; font-size: 11px; font-weight: 500; line-height: 1;
  padding: 3px 5px; border-radius: var(--r-xs); border: 1px solid var(--line-strong); border-bottom-width: 2px;
  color: var(--ink-3); background: var(--surface); font-family: var(--font-ui);
}

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--s-3);
  padding: 0 var(--s-5);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  -webkit-backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; text-decoration: none; color: var(--ink); flex: none; border-radius: var(--r-sm); }
.brand-logo-img { height: var(--logo-height); width: auto; display: block; }
.byline { font-size: var(--t-xs); color: var(--ink-3); white-space: nowrap; padding-top: 6px; }
.search-trigger {
  display: inline-flex; align-items: center; gap: var(--s-2);
  margin-left: var(--s-6); height: 38px; min-width: 240px; padding: 0 8px 0 12px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2);
  color: var(--ink-3); font-size: var(--t-md); cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.search-trigger:hover { border-color: var(--line-strong); background: var(--surface); color: var(--ink-2); }
.search-trigger .st-text { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: var(--s-2); flex: none; }
.engine-status {
  display: inline-flex; align-items: center; gap: 7px; font-size: var(--t-sm); color: var(--ink-2); white-space: nowrap;
  padding: 0 10px; height: 32px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line);
}
.engine-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--unknown); flex: none; }
.engine-status.ok .dot { background: var(--pass); box-shadow: 0 0 0 3px var(--pass-soft); }
.engine-status.off .dot { background: transparent; border: 2px solid var(--warn); }
.lang-select {
  height: 38px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-md);
  padding: 0 26px 0 10px; font-size: var(--t-sm); font-weight: 600; cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2366727D' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 6px center; background-size: 14px;
}
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; flex: none;
  border: 1px solid transparent; border-radius: var(--r-md); background: transparent; color: var(--ink-2); cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn.bordered { border-color: var(--line); background: var(--surface); }
.drawer-toggle { display: none; }
.search-icon-btn { display: none; }

/* ---------------------------------------------------------------- layout */
.layout { flex: 1; display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 0; }
.sidebar {
  border-right: 1px solid var(--line);
  background: var(--surface-2);
  padding: var(--s-4) var(--s-3) var(--s-4);
  display: flex; flex-direction: column; gap: var(--s-3);
  position: sticky; top: var(--topbar-h); align-self: start;
  height: calc(100vh - var(--topbar-h)); height: calc(100dvh - var(--topbar-h)); overflow-y: auto;
  overscroll-behavior: contain;
}
.sheet-head { display: none; }
.main { padding: var(--s-6) var(--s-8) 64px; min-width: 0; outline: none; }
.main-inner { max-width: var(--content-max); margin: 0 auto; }
.scrim { display: none; }

.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px;
  padding: 0 10px; border: 0; border-radius: var(--r-sm); background: transparent; cursor: pointer;
  font-weight: 500; color: var(--ink-2); text-align: left;
}
.nav-item:hover { background: var(--surface-3); color: var(--ink); }
.nav-item[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line); }
.nav-item[aria-current="page"] .i { color: var(--accent); }

.sidebar-search { position: relative; }
.sidebar-search .i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.sidebar-search input { padding-left: 34px !important; padding-right: 54px !important; background: var(--surface); }
.sidebar-search kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.sidebar-title { display: flex; align-items: center; justify-content: space-between; font-size: var(--t-xs); font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; padding: 4px 10px 0; }
.sidebar-title .count { font-variant-numeric: tabular-nums; font-weight: 500; letter-spacing: 0; }
.client-list { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-height: 60px; }
.client-item {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 0 10px;
  width: 100%; text-align: left; cursor: pointer;
  border: 0; border-radius: var(--r-sm); background: transparent; padding: 7px 8px;
  transition: background var(--dur) var(--ease);
}
.client-item:hover { background: var(--surface-3); }
.client-item[aria-current="true"] { background: var(--surface); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line); }
.client-item[aria-current="true"] .avatar { background: var(--accent); color: var(--accent-ink); }
.ci-text { min-width: 0; }
.ci-name { font-weight: 600; font-size: var(--t-md); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ci-domain { font-size: var(--t-xs); color: var(--ink-3); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ci-score { font-family: var(--font-quote); font-weight: 600; font-size: var(--t-md); font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; gap: 5px; color: var(--ink-2); }
.ci-score .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--unknown); }
.ci-score .dot.band-pass { background: var(--pass); } .ci-score .dot.band-warn { background: var(--warn); } .ci-score .dot.band-fail { background: var(--fail); }
.avatar {
  width: 30px; height: 30px; border-radius: 8px; display: inline-grid; place-items: center; flex: none;
  background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 13px; text-transform: uppercase;
}
.avatar.lg { width: 44px; height: 44px; border-radius: 11px; font-size: 18px; }
.new-audit { border-top: 1px solid var(--line); padding: var(--s-3) 4px 0; }
.sidebar-engine { display: none; }

@media (max-width: 1023px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .drawer-toggle { display: inline-grid; }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 60;
    width: min(340px, 88vw); height: auto;
    transform: translateX(-104%); transition: transform .22s var(--ease), visibility 0s linear .22s;
    visibility: hidden;
    box-shadow: var(--shadow-lg); border-right: 0;
    padding-top: var(--s-3);
  }
  .sidebar.open { transform: none; visibility: visible; transition: transform .22s var(--ease); }
  .sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 0 6px; }
  .sheet-head .brand-logo-img { height: 26px; }
  .scrim:not([hidden]) { display: block; position: fixed; inset: 0; background: var(--scrim); z-index: 55; animation: fade .18s var(--ease); }
  .main { padding: var(--s-5) var(--s-5) 56px; }
  .topbar { padding: 0 var(--s-4); gap: var(--s-2); }
  .byline { display: none; }
  .search-trigger { margin-left: var(--s-3); min-width: 0; flex: 0 1 280px; }
}
@media (max-width: 760px) {
  .search-trigger { display: none; }
  .search-icon-btn { display: inline-grid; }
  .engine-status .engine-text { display: none; }
  .engine-status { padding: 0; width: 32px; justify-content: center; }
}
@media (max-width: 640px) {
  :root { --topbar-h: 56px; --logo-height: 26px; }
  /* clients drawer becomes a bottom sheet: reachable with the thumb */
  .sidebar {
    top: auto; left: 0; right: 0; bottom: 0; width: 100%;
    max-height: 88vh; max-height: 88dvh;
    border-radius: 18px 18px 0 0;
    transform: translateY(104%);
    padding: 6px var(--s-4) calc(var(--s-4) + env(safe-area-inset-bottom));
  }
  .sidebar::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 4px auto 6px; flex: none; }
  .sidebar .client-list { flex: 0 0 auto; }
  .main { padding: var(--s-4) var(--s-4) 48px; }
  .topbar { padding: 0 var(--s-3); gap: 6px; }
  .topbar .engine-status { display: none; }
  .sidebar-engine { display: flex; }
  .sidebar-engine .engine-status .engine-text { display: inline; }
  .sidebar-engine .engine-status { padding: 0 10px; width: auto; }
  .lang-select { padding: 0 22px 0 8px; background-position: right 4px center; }
  .sidebar-search kbd { display: none; }
}
@media (min-width: 1600px) { :root { --sidebar-w: 288px; } .main { padding-left: var(--s-10); padding-right: var(--s-10); } }

.footer {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px 14px;
  padding: var(--s-4); font-size: var(--t-xs); color: var(--ink-3);
  border-top: 1px solid var(--line); background: var(--surface);
}
.footer-cdm { height: 20px; width: auto; display: block; }
.footer-by { white-space: nowrap; }

/* ---------------------------------------------------------------- controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 14px; min-height: 38px;
  border-radius: var(--r-md); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink);
  font-weight: 500; font-size: var(--t-md); line-height: 1.2; cursor: pointer; white-space: nowrap; text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform .06s;
}
.btn:hover { border-color: var(--ink-3); color: var(--ink); }
.btn:active:not([disabled]) { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; }
.btn-small { padding: 0 10px; min-height: 32px; font-size: var(--t-sm); gap: 6px; border-radius: var(--r-sm); }
.btn-block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }
.spinner {
  display: inline-block; width: 15px; height: 15px; flex: none;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

input[type="text"], input[type="url"], input[type="search"], input[type="number"], input[type="email"], input[type="password"], select, textarea {
  width: 100%; min-width: 0; min-height: 40px;
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--surface); padding: 8px 12px; font-size: var(--t-md);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
select { cursor: pointer; }
input:hover, select:hover, textarea:hover { border-color: var(--ink-3); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input[aria-invalid="true"] { border-color: var(--fail); }
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
textarea { resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: .85; }
.field-label { display: block; font-size: var(--t-sm); font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field-label .opt { font-weight: 400; color: var(--ink-3); }
.field-hint { font-size: var(--t-xs); color: var(--ink-3); margin-top: 5px; }
.field-error { font-size: var(--t-sm); color: var(--fail); margin-top: 6px; display: flex; gap: 6px; align-items: center; }
.field { margin-bottom: var(--s-4); }
.input-row { display: flex; gap: var(--s-2); }
.input-row input { flex: 1; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 0 var(--s-4); }
.form-msg:empty { display: none; }
.form-msg { margin-top: var(--s-2); }
.checks-inline { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.check-chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: var(--r-md); font-size: var(--t-md); cursor: pointer; background: var(--surface);
}
.check-chip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.check-chip input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
fieldset.field { border: 0; padding: 0; margin: 0 0 var(--s-4); min-width: 0; }

/* segmented control */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r-md); background: var(--surface-3); flex-wrap: wrap; max-width: 100%; }
.seg button {
  border: 0; background: transparent; padding: 0 12px; min-height: 30px; font-size: var(--t-sm); font-weight: 500;
  cursor: pointer; color: var(--ink-2); border-radius: 7px; white-space: nowrap;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }

/* ---------------------------------------------------------------- page + client header */
.page-head { display: flex; flex-wrap: wrap; gap: var(--s-4) var(--s-6); align-items: flex-end; justify-content: space-between; margin-bottom: var(--s-6); }
.page-head h1 { font-family: var(--font-quote); font-size: var(--t-3xl); font-weight: 600; letter-spacing: -0.015em; line-height: 1.1; overflow-wrap: anywhere; }
.eyebrow { font-size: var(--t-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin-bottom: 6px; }
.page-sub { color: var(--ink-3); font-size: var(--t-md); margin-top: 6px; }
.page-head .actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }

.client-head { display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-6); align-items: center; justify-content: space-between; margin-bottom: var(--s-5); }
.client-id { display: flex; gap: var(--s-4); align-items: center; min-width: 0; }
.client-id > div { min-width: 0; }
.crumbs { display: flex; align-items: center; gap: 4px; font-size: var(--t-sm); color: var(--ink-3); margin-bottom: 2px; }
.crumbs button { border: 0; background: none; padding: 2px 0; color: var(--ink-3); cursor: pointer; font-size: inherit; }
.crumbs button:hover { color: var(--accent); text-decoration: underline; }
.client-head h1 { font-family: var(--font-quote); font-size: var(--t-2xl); font-weight: 600; letter-spacing: -0.01em; overflow-wrap: anywhere; line-height: 1.15; }
.client-head .meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--ink-3); font-size: var(--t-sm); margin-top: 4px; }
.client-head .meta a { color: var(--ink-2); text-decoration: none; }
.client-head .meta a:hover { color: var(--accent); text-decoration: underline; }
.client-head .meta span { display: inline-flex; align-items: center; gap: 4px; }
.client-head .actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }

/* tabs: sticky + horizontally scrollable on small screens */
.tabs-wrap {
  position: sticky; top: var(--topbar-h); z-index: 25;
  background: var(--bg); margin: 0 calc(var(--s-2) * -1) var(--s-5); padding: 0 var(--s-2);
}
.tabs {
  display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none;
  border-bottom: 1px solid var(--line); scroll-behavior: smooth;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  border: 0; background: transparent; cursor: pointer; white-space: nowrap;
  min-height: 46px; padding: 0 14px; font-weight: 500; font-size: var(--t-md); color: var(--ink-3);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.tab .i { width: 17px; height: 17px; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tab[aria-selected="true"] .i { color: var(--accent); }
.tab .tab-score { font-variant-numeric: tabular-nums; font-size: var(--t-xs); font-weight: 600; padding: 1px 7px; border-radius: var(--r-pill); background: var(--surface-3); color: var(--ink-2); }
.tab[aria-selected="true"] .tab-score { background: var(--accent-soft); color: var(--accent); }

/* ---------------------------------------------------------------- panels */
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: var(--s-5) var(--s-6); margin-bottom: var(--s-5); min-width: 0;
  box-shadow: var(--shadow-sm);
}
.panel > h2, .section-title { font-size: var(--t-lg); margin-bottom: 4px; }
.section-title { font-size: var(--t-base); }
.panel-sub { color: var(--ink-3); font-size: var(--t-sm); margin-bottom: var(--s-4); max-width: 78ch; }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--s-2) var(--s-4); margin-bottom: var(--s-4); }
.panel-head h2 { font-size: var(--t-lg); display: inline-flex; align-items: center; gap: 8px; }
.panel-head .panel-sub { margin: 2px 0 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: var(--s-5); align-items: start; margin-bottom: var(--s-5); }
.grid-2 > .panel { margin-bottom: 0; }
.stack > * + * { margin-top: var(--s-4); }
.muted { color: var(--ink-3); }
.small { font-size: var(--t-sm); }
.nowrap { white-space: nowrap; }
.timestamp { font-size: var(--t-xs); color: var(--ink-3); display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.count-pill { font-size: var(--t-xs); font-weight: 600; padding: 1px 8px; border-radius: var(--r-pill); background: var(--surface-3); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.count-pill.fail { background: var(--fail-soft); color: var(--fail); }

/* ---------------------------------------------------------------- notices + empty states */
.notice {
  display: flex; gap: 10px; align-items: flex-start;
  border: 1px solid var(--line); background: var(--surface-2); padding: 12px 14px; border-radius: var(--r-md);
  font-size: var(--t-md); max-width: 86ch; color: var(--ink);
}
.notice .notice-icon { flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px; margin-top: 1px; }
.notice strong { display: block; margin-bottom: 1px; }
.notice span { color: var(--ink-2); }
.notice.warn { border-color: color-mix(in srgb, var(--warn) 30%, transparent); background: var(--warn-soft); } .notice.warn .notice-icon { color: var(--warn); }
.notice.fail { border-color: color-mix(in srgb, var(--fail) 30%, transparent); background: var(--fail-soft); } .notice.fail .notice-icon { color: var(--fail); }
.notice.info { border-color: var(--accent-line); background: var(--accent-soft); } .notice.info .notice-icon { color: var(--accent); }
.notice.pass { border-color: color-mix(in srgb, var(--pass) 30%, transparent); background: var(--pass-soft); } .notice.pass .notice-icon { color: var(--pass); }
.notice + .notice { margin-top: var(--s-2); }

.empty {
  padding: var(--s-10) var(--s-6); text-align: center; display: flex; flex-direction: column; align-items: center;
  border: 1px dashed var(--line-strong); border-radius: var(--r-lg); background: var(--surface-2); margin-bottom: var(--s-5);
}
.empty .empty-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: var(--s-4); }
.empty h2 { font-family: var(--font-quote); font-size: var(--t-xl); margin-bottom: 6px; }
.empty p { color: var(--ink-2); margin-bottom: var(--s-4); max-width: 52ch; }
.empty .actions { display: flex; gap: var(--s-2); flex-wrap: wrap; justify-content: center; }

/* skeletons */
.skel { position: relative; overflow: hidden; background: var(--skel); border-radius: var(--r-sm); }
.skel::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, var(--skel-hi), transparent);
  animation: shimmer 1.3s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.skel-line { height: 12px; margin: 10px 0; }
.skel-block { height: 120px; border-radius: var(--r-lg); }
.skel-ring { width: 96px; height: 96px; border-radius: 50%; }
.skel-row { display: flex; gap: var(--s-4); align-items: center; }

/* long-running progress */
.run-progress {
  border: 1px solid var(--accent-line); background: var(--accent-soft); border-radius: var(--r-lg);
  padding: var(--s-4) var(--s-5); margin-bottom: var(--s-5);
}
.run-progress .rp-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; justify-content: space-between; }
.run-progress .rp-title { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; color: var(--ink); }
.run-progress .rp-title .spinner { color: var(--accent); }
.run-progress .rp-time { font-variant-numeric: tabular-nums; font-family: var(--font-quote); font-size: var(--t-lg); font-weight: 600; color: var(--accent); }
.run-progress p { color: var(--ink-2); font-size: var(--t-sm); margin-top: 6px; max-width: 80ch; }
.indeterminate { height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--accent) 18%, transparent); overflow: hidden; margin-top: 12px; position: relative; }
.indeterminate::before { content: ""; position: absolute; top: 0; bottom: 0; width: 34%; border-radius: 2px; background: var(--accent); animation: indet 1.5s var(--ease) infinite; }
@keyframes indet { 0% { left: -34%; } 100% { left: 100%; } }
.progress-note { display: inline-flex; gap: 8px; align-items: center; color: var(--ink-2); font-size: var(--t-md); }
.determinate { height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--accent) 18%, transparent); overflow: hidden; margin-top: 12px; }
.determinate > span { display: block; height: 100%; border-radius: 3px; background: var(--accent); transition: width .6s var(--ease); min-width: 2px; }
.run-progress .rp-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin-top: 8px; }
.run-progress .rp-foot:has(.rp-state:empty):not(:has(.btn)) { display: none; }
.run-progress .rp-state { font-size: var(--t-sm); font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.run-progress .rp-foot .btn { background: var(--surface); }
.run-progress .rp-title .badge { font-weight: 600; }
.run-progress .rp-countdown { font-size: var(--t-sm); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.run-progress .rp-countdown b { color: var(--accent); font-family: var(--font-quote); font-size: var(--t-lg); }

/* manual verification offer (after a bot_blocked Doctor audit) */
.manual-box {
  border: 1px solid var(--accent-line); background: var(--surface); border-radius: var(--r-lg);
  padding: var(--s-4) var(--s-5); margin: var(--s-3) 0 var(--s-5); max-width: 86ch;
}
.manual-box h3 { display: flex; align-items: center; gap: 8px; font-size: var(--t-md); margin-bottom: 6px; }
.manual-box h3 .i { color: var(--accent); }
.manual-box p { color: var(--ink-2); font-size: var(--t-sm); margin-bottom: 8px; }
.manual-box ul { margin: 0 0 var(--s-3) 1.2em; padding: 0; color: var(--ink-2); font-size: var(--t-sm); display: grid; gap: 4px; }
.manual-box .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.save-state { display: inline-flex; align-items: center; gap: 4px; margin-left: 4px; color: var(--ink-3); }
.save-state.ok { color: var(--pass); } .save-state.err { color: var(--fail); }

/* ---------------------------------------------------------------- scheduled audits */
.btn-danger { background: var(--fail); border-color: var(--fail); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--fail) 86%, #000); border-color: transparent; color: #fff; }
.sched-list { list-style: none; margin: 0 0 var(--s-3); padding: 0; display: grid; gap: var(--s-2); }
.sched-item {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3) var(--s-4);
  padding: var(--s-3) var(--s-4); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2);
}
.sched-item.is-off { background: var(--surface); }
.sched-item.is-off .sched-main { opacity: .72; }
.sched-main { min-width: 0; flex: 1 1 320px; }
.sched-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sched-ico { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent); flex: none; }
.sched-when { margin-top: 4px; color: var(--ink-2); font-size: var(--t-sm); }
.sched-times { display: flex; flex-wrap: wrap; gap: 4px var(--s-5); margin: 6px 0 0; font-size: var(--t-sm); }
.sched-times > div { display: flex; flex-wrap: wrap; gap: 0 6px; min-width: 0; }
.sched-times dt { color: var(--ink-3); white-space: nowrap; }
.sched-times dt::after { content: ":"; }
.sched-times dd { margin: 0; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.sched-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.sched-form { border: 1px dashed var(--accent-line); border-radius: var(--r-md); padding: var(--s-4); margin-top: var(--s-2); background: var(--surface); }
.sched-form h3 { font-size: var(--t-md); margin: 0 0 var(--s-3); }
.sched-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 var(--s-3); }
@media (max-width: 760px) { .sched-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) {
  .sched-grid { grid-template-columns: minmax(0, 1fr); }
  .sched-actions { width: 100%; }
  .sched-actions .btn span { display: none; }
}
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: var(--t-sm); color: var(--ink-2); min-height: 32px; position: relative; }
.switch input { position: absolute; opacity: 0; width: 38px; height: 22px; margin: 0; cursor: pointer; }
.switch-track { width: 38px; height: 22px; border-radius: 11px; background: var(--line-strong); position: relative; flex: none; transition: background var(--dur) var(--ease); }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-sm); transition: transform var(--dur) var(--ease); }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------------------------------------------------------------- status labels + badges */
.status {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  font-size: var(--t-xs); font-weight: 600; padding: 2px 9px 2px 4px; border-radius: var(--r-pill);
  white-space: nowrap; line-height: 1.5;
}
.status .ico { width: 16px; height: 16px; border-radius: 50%; display: inline-grid; place-items: center; color: var(--surface); }
.status .ico .i { width: 10px; height: 10px; stroke-width: 3; }
.status.pass { color: var(--pass); background: var(--pass-soft); } .status.pass .ico { background: var(--pass); }
.status.warn { color: var(--warn); background: var(--warn-soft); } .status.warn .ico { background: var(--warn); }
.status.fail { color: var(--fail); background: var(--fail-soft); } .status.fail .ico { background: var(--fail); }
.status.unknown { color: var(--unknown); background: var(--unknown-soft); } .status.unknown .ico { background: var(--unknown); }
.badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: var(--t-xs); font-weight: 600; padding: 1px 8px; border-radius: var(--r-pill);
  border: 1px solid var(--line-strong); color: var(--ink-2); white-space: nowrap; line-height: 1.6;
}
.badge.accent { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }
.badge.warn { border-color: color-mix(in srgb, var(--warn) 40%, transparent); color: var(--warn); background: var(--warn-soft); }

/* deltas */
.delta { display: inline-flex; align-items: center; gap: 2px; font-size: var(--t-xs); font-weight: 600; font-variant-numeric: tabular-nums; padding: 1px 6px 1px 3px; border-radius: var(--r-pill); white-space: nowrap; }
.delta .i { width: 12px; height: 12px; stroke-width: 2.4; }
.delta.up { color: var(--pass); background: var(--pass-soft); }
.delta.down { color: var(--fail); background: var(--fail-soft); }
.delta.flat { color: var(--ink-3); background: var(--surface-3); padding-left: 6px; }

/* ---------------------------------------------------------------- score visuals */
.ring { position: relative; width: var(--size); height: var(--size); display: inline-grid; place-items: center; flex: none; color: var(--unknown); }
.ring svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ring .ring-track { stroke: var(--surface-3); fill: none; }
.ring .ring-fill { fill: none; stroke: currentColor; stroke-linecap: round; transition: stroke-dashoffset .7s var(--ease); }
.ring.band-pass { color: var(--pass); } .ring.band-warn { color: var(--warn); } .ring.band-fail { color: var(--fail); }
.ring .ring-val { position: relative; font-family: var(--font-quote); font-weight: 600; color: var(--ink); font-variant-numeric: lining-nums tabular-nums; line-height: 1; font-size: calc(var(--size) * .34); letter-spacing: -0.02em; }
.ring.is-null .ring-val { color: var(--ink-3); }
.ring .ring-sub { position: absolute; bottom: 22%; font-size: calc(var(--size) * .1); color: var(--ink-3); font-family: var(--font-ui); }
.bar { display: block; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; min-width: 48px; }
.bar > span { display: block; height: 100%; border-radius: 3px; background: var(--accent); transition: width .6s var(--ease); }
.bar.is-null { background: repeating-linear-gradient(135deg, var(--surface-3) 0 5px, transparent 5px 9px); }

.scoreboard { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s-8); align-items: center; }
.score-hero { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; min-width: 150px; }
.score-hero .lbl { font-size: var(--t-sm); color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: center; }
.score-hero .note { font-size: var(--t-xs); color: var(--ink-3); max-width: 24ch; }
.meters { display: grid; gap: 14px; }
.meter { display: grid; grid-template-columns: minmax(96px, 160px) minmax(0, 1fr) 44px; gap: 14px; align-items: center; }
.meter .m-name { font-size: var(--t-md); color: var(--ink-2); }
.meter .m-track { height: 8px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.meter .m-fill { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .7s var(--ease); }
.meter .m-fill.band-fail { background: var(--fail); }
.meter .m-fill.band-warn { background: var(--warn); }
.meter .m-fill.band-pass { background: var(--pass); }
.meter .m-val { text-align: right; font-weight: 600; font-family: var(--font-quote); font-size: var(--t-lg); font-variant-numeric: tabular-nums; }
.meter .m-reason { grid-column: 2 / 4; font-size: var(--t-xs); color: var(--ink-3); margin-top: -8px; }
.meter.is-null .m-track { background: repeating-linear-gradient(135deg, var(--surface-3) 0 6px, transparent 6px 10px); }
.meter.is-null .m-val { color: var(--ink-3); }
@media (max-width: 720px) {
  .scoreboard { grid-template-columns: minmax(0, 1fr); gap: var(--s-5); }
}

/* stat counts row */
.stat-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--s-4); }

/* ---------------------------------------------------------------- client overview band */
.overview { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--s-5); margin-bottom: var(--s-5); }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-3); }
.tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  padding: var(--s-4); display: flex; flex-direction: column; gap: 10px; min-width: 0; text-align: left;
  font: inherit; color: inherit; cursor: pointer; transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.tile:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.tile[aria-current="true"] { border-color: var(--accent-line); box-shadow: inset 0 0 0 1px var(--accent-line), var(--shadow-sm); }
.tile .tile-label { display: flex; align-items: center; gap: 6px; font-size: var(--t-xs); font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; }
.tile .tile-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tile .tile-num { font-family: var(--font-quote); font-weight: 600; font-size: var(--t-2xl); line-height: 1; font-variant-numeric: tabular-nums; }
.tile .tile-num small { font-size: var(--t-sm); color: var(--ink-3); font-weight: 400; margin-left: 1px; }
.tile .tile-foot { font-size: var(--t-xs); color: var(--ink-3); margin-top: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trend-card { margin: 0; padding: var(--s-4) var(--s-5); display: flex; flex-direction: column; }
.trend-card .panel-head { margin-bottom: var(--s-2); }
.trend-card .panel-head h2 { font-size: var(--t-base); }
.legend-inline { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: var(--t-xs); color: var(--ink-2); }
.legend-inline span { display: inline-flex; align-items: center; gap: 6px; }
.legend-inline svg { width: 22px; height: 10px; }
.trend { position: relative; flex: 1; min-height: 132px; }
.trend svg.chart { display: block; width: 100%; height: 100%; overflow: visible; }
.trend svg.chart:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .axis text { fill: var(--ink-3); font-size: 11px; font-family: var(--font-ui); }
.chart .s1 { stroke: var(--series-1); fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .s2 { stroke: var(--series-2); fill: none; stroke-width: 2; stroke-dasharray: 5 4; stroke-linejoin: round; stroke-linecap: round; }
.chart .m1 { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
.chart .m2 { fill: var(--series-2); stroke: var(--surface); stroke-width: 2; }
.chart .area1 { fill: var(--series-1); opacity: .08; stroke: none; }
.chart .cross { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 2 3; }
.chart .hit { fill: transparent; }
.chart .m-active { stroke: var(--surface); stroke-width: 3; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5; min-width: 140px;
  background: var(--ink); color: var(--surface); border-radius: var(--r-sm); padding: 8px 10px; font-size: var(--t-xs);
  box-shadow: var(--shadow-md); transform: translate(-50%, calc(-100% - 12px)); white-space: nowrap;
}
.chart-tip b { font-size: var(--t-sm); }
.chart-tip .row { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.chart-tip .sw { width: 8px; height: 8px; border-radius: 50%; }
.chart-tip .sw.sq { border-radius: 1px; }
.trend-empty { display: grid; place-items: center; text-align: center; color: var(--ink-3); font-size: var(--t-sm); min-height: 132px; padding: var(--s-4); }
.trend-table summary { font-size: var(--t-xs); margin-top: 6px; }
.trend-table table { margin-top: 6px; }
@media (max-width: 1180px) { .overview { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) {
  .tiles { gap: var(--s-2); }
  .tile { padding: var(--s-3); gap: 8px; }
  .tile .tile-num { font-size: var(--t-xl); }
  .tile .tile-label { font-size: 11px; letter-spacing: .03em; }
  .tile .ring { --size: 40px !important; }
  .tile .tile-foot { white-space: normal; }
}

/* ---------------------------------------------------------------- dashboard */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-4); margin-bottom: var(--s-5); }
.kpi-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s-4) var(--s-5); box-shadow: var(--shadow-sm); min-width: 0; }
.kpi-card .k-label { font-size: var(--t-xs); font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; display: flex; align-items: center; gap: 6px; }
.kpi-card .k-val { font-family: var(--font-quote); font-weight: 600; font-size: var(--t-3xl); line-height: 1.1; margin-top: 8px; font-variant-numeric: lining-nums tabular-nums; letter-spacing: -0.015em; }
.kpi-card .k-val small { font-size: var(--t-base); color: var(--ink-3); font-weight: 400; }
.kpi-card .k-sub { font-size: var(--t-xs); color: var(--ink-3); margin-top: 4px; }
.kpi-card .bar { margin-top: 10px; }
.kpi-card.attn .k-val { color: var(--fail); }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 400px) { .kpis { gap: var(--s-2); } .kpi-card { padding: var(--s-3) var(--s-4); } .kpi-card .k-val { font-size: var(--t-2xl); } }

.attn-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: var(--s-3); }
.attn-item {
  display: flex; flex-direction: column; gap: 10px; padding: var(--s-4); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); min-width: 0;
}
.attn-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.attn-top .who { min-width: 0; flex: 1; }
.attn-top .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attn-top .who span { display: block; font-size: var(--t-xs); color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reasons { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: var(--t-sm); color: var(--ink-2); }
.reasons li { display: flex; gap: 8px; align-items: flex-start; }
.reasons .i { width: 15px; height: 15px; margin-top: 2px; }
.reasons .r-fail .i { color: var(--fail); } .reasons .r-warn .i { color: var(--warn); } .reasons .r-info .i { color: var(--accent); }
.attn-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; margin-top: auto; }
.all-good { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: var(--t-md); }
.all-good .i { color: var(--pass); }

.table-wrap { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
table.data { border-collapse: separate; border-spacing: 0; width: 100%; font-size: var(--t-md); }
table.data th, table.data td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data th { font-size: var(--t-xs); font-weight: 600; color: var(--ink-3); white-space: nowrap; text-transform: uppercase; letter-spacing: .04em; background: var(--surface-2); }
table.data thead th:first-child { border-top-left-radius: var(--r-sm); }
table.data thead th:last-child { border-top-right-radius: var(--r-sm); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data tr.is-client td { background: var(--accent-soft); }
table.data tr.is-client td:first-child { box-shadow: inset 3px 0 0 var(--accent); font-weight: 600; }
table.data.compact td, table.data.compact th { padding: 6px 8px; }

.clients-table tbody tr { cursor: pointer; transition: background var(--dur) var(--ease); }
.clients-table tbody tr:hover td { background: var(--surface-2); }
.clients-table td { padding-top: 12px; padding-bottom: 12px; }
.cell-client { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-client .name { font-weight: 600; border: 0; background: none; padding: 0; cursor: pointer; text-align: left; color: var(--ink); font-size: var(--t-md); }
.cell-client .name:hover { color: var(--accent); }
.cell-client .dom { display: block; font-size: var(--t-xs); color: var(--ink-3); }
.cell-score { display: flex; align-items: center; gap: 10px; }
.cell-score .v { font-family: var(--font-quote); font-weight: 600; font-size: var(--t-lg); font-variant-numeric: tabular-nums; min-width: 2.2em; }
.cell-score .bar { width: 72px; }
.cell-score .why { font-size: var(--t-xs); color: var(--ink-3); }
.cell-actions { display: flex; gap: 4px; justify-content: flex-end; }
.client-cards { display: none; list-style: none; margin: 0; padding: 0; }
@media (max-width: 899px) {
  .clients-table-wrap { display: none; }
  .client-cards { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
}
.client-card {
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); padding: var(--s-4);
  display: flex; flex-direction: column; gap: var(--s-3); min-width: 0;
}
.client-card .cc-scores { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-2); }
.client-card .cc-score { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.client-card .cc-score .l { font-size: 11px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.client-card .cc-score .v { font-family: var(--font-quote); font-weight: 600; font-size: var(--t-xl); font-variant-numeric: tabular-nums; line-height: 1.1; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.client-card .cc-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); font-size: var(--t-xs); color: var(--ink-3); }

/* ---------------------------------------------------------------- fixes */
.fixes { list-style: none; margin: 0; padding: 0; counter-reset: fix; }
.fix { counter-increment: fix; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 0 14px; padding: var(--s-4) 0; border-top: 1px solid var(--line); }
.fix:first-child { border-top: 0; padding-top: 2px; }
.fix::before {
  content: counter(fix); display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-family: var(--font-quote); font-size: 16px; font-weight: 600;
}
.fix > div { min-width: 0; }
.fix h3 { font-size: var(--t-base); display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-bottom: 4px; }
.fix p { color: var(--ink-2); font-size: var(--t-md); max-width: 80ch; }
.codebox { margin-top: var(--s-3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); min-width: 0; overflow: hidden; }
.codebox-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; padding: 5px 6px 5px 12px; border-bottom: 1px solid var(--line); font-size: var(--t-xs); color: var(--ink-3); background: var(--surface); }
.codebox pre { margin: 0; padding: 12px 14px; overflow-x: auto; white-space: pre; max-height: 320px; line-height: 1.55; }

/* ---------------------------------------------------------------- checks list */
.check-group + .check-group { margin-top: var(--s-5); }
.check-group h3 { font-size: var(--t-md); display: flex; gap: 8px; align-items: center; padding-bottom: 8px; border-bottom: 1px solid var(--line-strong); }
.check-group h3 .muted { font-weight: 400; }
.check { display: grid; grid-template-columns: 136px minmax(0, 1fr); gap: 2px 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.check:last-child { border-bottom: 0; }
.check .c-title { font-weight: 600; font-size: var(--t-md); }
.check .c-detail { color: var(--ink-2); font-size: var(--t-md); overflow-wrap: anywhere; max-width: 82ch; }
.check details { grid-column: 2; margin-top: 4px; }
@media (max-width: 560px) {
  .check { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .check details { grid-column: 1; }
}
details > summary { cursor: pointer; font-size: var(--t-sm); color: var(--accent); width: fit-content; }
details pre.evidence { margin: 6px 0 0; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); overflow-x: auto; max-height: 260px; font-size: 12px; }

/* ---------------------------------------------------------------- fact tables */
.facts { display: grid; grid-template-columns: minmax(110px, max-content) minmax(0, 1fr); gap: 0; margin: 0; font-size: var(--t-md); }
.facts dt, .facts dd { padding: 8px 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--ink-3); padding-right: var(--s-4); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts dt:last-of-type, .facts dd:last-of-type { border-bottom: 0; }
@media (max-width: 420px) {
  .facts { grid-template-columns: minmax(0, 1fr); }
  .facts dt { border-bottom: 0; padding-bottom: 0; font-size: var(--t-xs); }
  .facts dd { padding-top: 2px; }
}

/* ---------------------------------------------------------------- GEO */
.estimate { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline; padding: 12px 16px; border: 1px dashed var(--line-strong); border-radius: var(--r-md); margin-top: var(--s-3); font-size: var(--t-md); background: var(--surface-2); }
.estimate .total { font-family: var(--font-quote); font-size: 24px; font-weight: 600; }
.run-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: var(--s-4); }
.engines-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--s-4); }
.engine-chip { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 6px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); font-size: var(--t-sm); box-shadow: var(--shadow-sm); }
.engine-chip b { font-weight: 600; }
.vis-cell { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.vis-cell .bar { width: 64px; }

.lost { border-top: 1px solid var(--line); padding: var(--s-5) 0 var(--s-2); }
.lost:first-of-type { border-top: 0; padding-top: var(--s-2); }
.lost-prompt { font-family: var(--font-quote); font-size: 19px; font-weight: 600; line-height: 1.3; max-width: 62ch; margin-bottom: 8px; }
.lost-prompt::before { content: "\201C"; color: var(--ink-3); margin-right: 1px; }
.lost-prompt::after { content: "\201D"; color: var(--ink-3); margin-left: 1px; }
.lost-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: var(--t-sm); color: var(--ink-3); margin-bottom: 12px; }
.answer-text {
  font-family: var(--font-quote); font-size: 16.5px; line-height: 1.65;
  white-space: pre-wrap; overflow-wrap: anywhere; max-width: 68ch;
  border-left: 3px solid var(--line-strong); padding: 2px 0 2px 16px; color: var(--ink);
}
mark.comp { background: var(--mark); color: var(--mark-ink); padding: 0 2px; border-radius: 2px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
mark.client { background: transparent; color: var(--accent); font-weight: 600; text-decoration: underline 2px; text-underline-offset: 3px; }
.comp-chip { display: inline-block; background: var(--mark); color: var(--mark-ink); font-size: var(--t-xs); font-weight: 600; padding: 0 7px; border-radius: 3px; }
.citations { list-style: none; padding: 0; margin: 12px 0 0; font-size: var(--t-sm); display: flex; flex-direction: column; gap: 4px; max-width: 68ch; }
.citations li { overflow-wrap: anywhere; display: flex; gap: 6px; align-items: flex-start; }
.citations li .i { color: var(--ink-3); margin-top: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: var(--t-sm); color: var(--ink-2); margin-bottom: 6px; }
.answer-item { border-top: 1px solid var(--line); padding: 10px 0; }
.answer-item > summary { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; color: var(--ink); font-size: var(--t-md); width: auto; min-height: 32px; }
.answer-item > summary .ans-prompt { font-weight: 500; overflow-wrap: anywhere; }
.answer-item[open] > summary { margin-bottom: 10px; }
.domain-list { list-style: none; margin: 0; padding: 0; }
.domain-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: var(--t-md); }
.domain-list li:last-child { border-bottom: 0; }
.domain-list .d-name { overflow-wrap: anywhere; }
.domain-list .d-name .badge { margin-left: 6px; }
.domain-list .d-count { font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }

/* ---------------------------------------------------------------- GBP */
.candidates { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.candidate { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); }
.candidate .cand-name { font-weight: 600; }
.candidate .cand-addr { font-size: var(--t-sm); color: var(--ink-3); }
.recs { margin: 0; padding: 0; list-style: none; }
.recs li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); max-width: 80ch; }
.recs li:last-child { border-bottom: 0; }

/* ---------------------------------------------------------------- AI tools */
.idea-list { list-style: none; margin: 0; padding: 0; }
.idea-list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.idea-list .kw { font-weight: 600; }
.idea-list .why { font-size: var(--t-sm); color: var(--ink-2); }
.article-body { font-family: var(--font-quote); font-size: 16px; line-height: 1.65; max-width: 70ch; overflow-wrap: anywhere; }
.article-body h1, .article-body h2, .article-body h3 { font-family: var(--font-ui); margin: 1.2em 0 .4em; }
.article-body p, .article-body ul, .article-body ol { margin: 0 0 .9em; }
.article-body.plain { white-space: pre-wrap; }

/* ---------------------------------------------------------------- settings + competitor rows */
.comp-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.3fr) auto; gap: var(--s-2); margin-bottom: var(--s-2); align-items: center; }
@media (max-width: 640px) {
  .comp-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: var(--s-3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
  .comp-row > input:nth-child(3) { grid-column: 1 / -1; }
  .comp-row > button { grid-column: 1 / -1; }
}

/* ---------------------------------------------------------------- toasts */
.toasts { position: fixed; z-index: 120; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast {
  display: flex; align-items: center; gap: 10px; pointer-events: auto;
  background: var(--ink); color: var(--surface); padding: 10px 16px 10px 12px; border-radius: var(--r-md);
  font-size: var(--t-md); box-shadow: var(--shadow-lg); animation: rise .2s var(--ease);
}
.toast .t-ico { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--pass); color: var(--surface); flex: none; }
.toast.warn .t-ico { background: var(--warn); }
.toast .t-ico .i { width: 13px; height: 13px; stroke-width: 2.6; }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }

/* ---------------------------------------------------------------- modals: wizard + palette */
.modal-layer { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 8vh var(--s-4) var(--s-4); }
.modal-scrim { position: absolute; inset: 0; background: var(--scrim); animation: fade .16s var(--ease); }
.modal {
  position: relative; width: 100%; max-width: 640px; max-height: 84vh; max-height: 84dvh;
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); border: 1px solid var(--line);
  display: flex; flex-direction: column; overflow: hidden; animation: rise .18s var(--ease);
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3); padding: var(--s-5) var(--s-6) var(--s-3); }
.modal-head h2 { font-family: var(--font-quote); font-size: var(--t-xl); }
.modal-head p { color: var(--ink-3); font-size: var(--t-sm); margin-top: 4px; }
.modal-body { padding: var(--s-2) var(--s-6) var(--s-5); overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.modal-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); padding: var(--s-3) var(--s-6); border-top: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap; }
.modal-foot .grow { flex: 1; }
.modal-foot .right { display: flex; gap: var(--s-2); margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }

.steps { list-style: none; margin: 0; padding: 0 var(--s-6) var(--s-3); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.steps li { display: flex; flex-direction: column; gap: 6px; font-size: var(--t-xs); color: var(--ink-3); min-width: 0; }
.steps li::before { content: ""; height: 4px; border-radius: 2px; background: var(--surface-3); }
.steps li.done::before { background: var(--accent-line); }
.steps li.current::before { background: var(--accent); }
.steps li.current { color: var(--ink); font-weight: 600; }
.steps li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wiz-lede { color: var(--ink-2); font-size: var(--t-md); margin-bottom: var(--s-4); }
.wiz-summary { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 16px; font-size: var(--t-sm); padding: var(--s-3) var(--s-4); background: var(--surface-2); border-radius: var(--r-md); border: 1px solid var(--line); margin-bottom: var(--s-4); }
.wiz-summary dt { color: var(--ink-3); }
.wiz-summary dd { margin: 0; overflow-wrap: anywhere; }

.palette { max-width: 600px; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 0 var(--s-4); border-bottom: 1px solid var(--line); }
.palette-input .i { color: var(--ink-3); }
.palette-input input { border: 0 !important; box-shadow: none !important; min-height: 56px; font-size: var(--t-lg); padding: 0; background: transparent; }
.palette-list { list-style: none; margin: 0; padding: var(--s-2); overflow-y: auto; max-height: 56vh; }
.palette-group { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); padding: 10px 10px 4px; }
.palette-opt {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 46px; padding: 6px 10px; border: 0; border-radius: var(--r-sm);
  background: transparent; text-align: left; cursor: pointer; color: var(--ink);
}
.palette-opt .po-text { flex: 1; min-width: 0; }
.palette-opt .po-text b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-opt .po-text span { display: block; font-size: var(--t-xs); color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-opt .po-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); flex: none; }
.palette-opt[aria-selected="true"] { background: var(--accent-soft); }
.palette-opt[aria-selected="true"] .po-icon { background: var(--accent); color: var(--accent-ink); }
.palette-opt mark { background: none; color: var(--accent); font-weight: 600; }
.palette-empty { padding: var(--s-6); text-align: center; color: var(--ink-3); }
.palette-foot { display: flex; gap: var(--s-4); padding: 8px var(--s-4); border-top: 1px solid var(--line); font-size: var(--t-xs); color: var(--ink-3); background: var(--surface-2); flex-wrap: wrap; }
.palette-foot span { display: inline-flex; gap: 6px; align-items: center; }

@media (max-width: 640px) {
  .modal-layer { padding: 0; align-items: flex-end; }
  .modal { max-width: none; max-height: 94vh; max-height: 94dvh; border-radius: 18px 18px 0 0; border-bottom: 0; }
  .modal.wizard { height: 94vh; height: 94dvh; }
  .modal-head { padding: var(--s-4) var(--s-4) var(--s-2); }
  .modal-body { padding: var(--s-2) var(--s-4) var(--s-4); }
  .modal-foot { padding: var(--s-3) var(--s-4) calc(var(--s-3) + env(safe-area-inset-bottom)); }
  .modal-foot { flex-wrap: nowrap; align-items: flex-end; }
  .modal-foot .right { flex: 1; }
  .modal-foot .right .btn { flex: 1 1 auto; }
  .steps { padding: 0 var(--s-4) var(--s-3); }
  .steps li span { display: none; }
  .palette-foot { display: none; }
  .palette-layer { align-items: flex-start; padding: var(--s-3); }
  .palette-layer .modal { border-radius: 16px; border-bottom: 1px solid var(--line); max-height: 80dvh; }
}

/* ---------------------------------------------------------------- report: always "paper" */
.report {
  --surface: #FFFFFF; --surface-2: #F7F9F8; --surface-3: #ECF0EF; --line: #E1E6E5; --line-strong: #C8D0CE;
  --ink: #17212B; --ink-2: #44515D; --ink-3: #66727D; --accent: #0E6B73; --accent-soft: #E2EFEE; --accent-line: #A9CFCF;
  --pass: #2B7A4B; --pass-soft: #E3F1E8; --warn: #8F5E00; --warn-soft: #FBF0D8; --fail: #B23838; --fail-soft: #F9E4E2;
  --unknown: #5E6A75; --unknown-soft: #E9EDF0;
  color-scheme: light;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 40px 48px; max-width: 880px; box-shadow: var(--shadow-md); margin: 0 auto;
}
.report-toolbar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; justify-content: space-between; max-width: 880px; margin: 0 auto var(--s-4); }
.report-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s-4); border-bottom: 2px solid var(--ink); padding-bottom: 18px; margin-bottom: 24px; flex-wrap: wrap; }
.report-head .rh-logo { height: 52px; width: auto; display: block; }
.login-card .login-logo { height: 42px; }
.report-head h1 { font-family: var(--font-quote); font-size: 32px; margin-top: 18px; letter-spacing: -0.01em; }
.report-head .meta { color: var(--ink-3); font-size: 14px; margin-top: 4px; }
.report section { margin-bottom: 30px; break-inside: avoid-page; }
.report section h2 { font-size: 13px; margin-bottom: 14px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); display: flex; align-items: center; gap: 10px; }
.report section h2::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.report .rkpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-bottom: 14px; }
.report .rkpi { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; display: flex; gap: 12px; align-items: center; }
.report .rkpi .v { font-family: var(--font-quote); font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.report .rkpi .l { font-size: 12px; color: var(--ink-3); }
.report ol, .report ul { padding-left: 20px; margin: 0; }
.report li { margin-bottom: 6px; }
.report-foot { margin-top: 36px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 11px; color: var(--ink-3); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.report-foot img { height: 18px; width: auto; }
@media (max-width: 640px) {
  .report { padding: 22px 16px; border-radius: var(--r-md); }
  .report-head h1 { font-size: 24px; }
}

/* ---------------------------------------------------------------- monthly report */
.print-only { display: none; }
.report-toolbar .rm-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; min-width: 0; }
.rm-picker select { min-height: 36px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: inherit; font-size: var(--t-md); max-width: 100%; }
.report-monthly .report-head { align-items: flex-end; }
.rm-kicker { margin: 18px 0 0; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.report-monthly .report-head h1 { margin-top: 4px; }
.rm-period { text-align: right; }
.rm-period-m { font-family: var(--font-quote); font-size: 22px; font-weight: 600; line-height: 1.2; margin-bottom: 2px; }
.report .rm-highlights { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.report .rm-highlights li { margin: 0; padding: 10px 14px 10px 16px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 var(--r-sm) var(--r-sm) 0; font-size: 15px; line-height: 1.45; }
.rm-note { margin: -4px 0 12px; }
.rm-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 12px; }
.rm-card { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; min-width: 0; break-inside: avoid; }
.rm-card-l { font-size: 12px; color: var(--ink-3); margin-bottom: 4px; }
.rm-card-v { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.rm-card-v .v { font-family: var(--font-quote); font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.rm-card-p { font-size: 11px; color: var(--ink-3); margin-top: 4px; font-variant-numeric: tabular-nums; }
.delta.good { color: var(--pass); background: var(--pass-soft); }
.delta.bad { color: var(--fail); background: var(--fail-soft); }
.rm-scope { display: flex; gap: 8px; align-items: flex-start; margin: 4px 0 14px; color: var(--ink-2); overflow-wrap: anywhere; }
.rm-scope .i { flex: none; margin-top: 2px; color: var(--ink-3); }
.rm-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; margin-bottom: 14px; }
.rm-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rm-cols-1 { grid-template-columns: minmax(0, 1fr); }
.rm-col { min-width: 0; break-inside: avoid; }
.report .rm-col h3, .report .rm-h3 { font-size: 14px; font-weight: 600; margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.report .rm-h3 { margin-top: 18px; }
.rm-count { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); background: var(--surface-3); font-size: 11px; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.report .rm-list { list-style: none; padding: 0; margin: 0; }
.report .rm-list li { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 6px; font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.rm-ico { flex: none; display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; margin-top: 1px; }
.rm-ico .i { width: 12px; height: 12px; stroke-width: 2.6; }
.rm-ico.pass { color: var(--pass); background: var(--pass-soft); }
.rm-ico.fail { color: var(--fail); background: var(--fail-soft); }
.rm-ico.warn { color: var(--warn); background: var(--warn-soft); }
.rm-st { color: var(--ink-3); font-size: 12px; }
.rm-nodata, .rm-warn { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md); border: 1px dashed var(--line-strong); background: var(--surface-2); color: var(--ink-2); font-size: 14px; }
.rm-nodata .i, .rm-warn .i { margin-top: 2px; color: var(--ink-3); }
.rm-warn { border-style: solid; border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: var(--warn-soft); margin-bottom: 12px; }
.rm-warn .i { color: var(--warn); }
.report .rm-domains { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 20px; padding-left: 22px; }
.report .rm-domains li { margin: 0; font-size: 14px; }
.rm-dom { font-weight: 500; margin-right: 6px; overflow-wrap: anywhere; }
.rm-dom.is-client { background: var(--accent-soft); color: var(--accent); padding: 0 4px; border-radius: 3px; }
.report table.rm-table { font-size: 13px; }
.report table.rm-table th[scope="row"] { font-weight: 500; text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--ink); background: none; white-space: normal; }
.report table.rm-table tr.is-client th, .report table.rm-table tr.is-client td { background: var(--accent-soft); }
.report table.rm-table tbody tr:last-child th { border-bottom: 0; }
.report table.rm-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.rm-notes-edit textarea { width: 100%; min-height: 110px; }
.rm-notes-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.rm-notes-state.is-pass { color: var(--pass); }
.rm-notes-state.is-fail { color: var(--fail); }
.rm-notes-print { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.5; }
.report-monthly .report-foot { justify-content: space-between; }
@media (max-width: 760px) {
  .rm-cols, .rm-cols-3 { grid-template-columns: minmax(0, 1fr); }
  .rm-period { text-align: left; }
  .report-monthly .report-head { align-items: flex-start; }
}
@media (max-width: 640px) {
  .rm-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .rm-card { padding: 10px 12px; }
  .rm-card-v .v { font-size: 22px; }
  .report table.rm-table th, .report table.rm-table td { padding: 8px; }
  .report-toolbar .rm-hint { display: none; }
  .report-toolbar, .report-toolbar .rm-controls { width: 100%; }
  .report-toolbar .rm-controls .btn, .rm-picker, .rm-picker select { flex: 1; }
}

@media print {
  :root, :root[data-theme="dark"] {
    --bg: #fff; --surface: #fff; --surface-2: #fff; --ink: #000; --ink-2: #222; --ink-3: #555;
    --line: #ccc; --line-strong: #999; --accent: #0E6B73; --accent-soft: #EAF4F4;
    color-scheme: light;
  }
  body { background: #fff; font-size: 11pt; }
  .topbar, .sidebar, .scrim, .footer, .tabs-wrap, .client-head, .overview, .no-print, .toasts, .skip-link, .report-toolbar, #modal-root { display: none !important; }
  .layout { display: block; }
  .main { padding: 0; }
  .report { border: 0; padding: 0; max-width: none; box-shadow: none; }
  .report { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-only { display: block; }
  .report-monthly .rm-sec { break-inside: auto; }
  .report-monthly .rm-sec-doctor, .report-monthly .rm-sec-geo, .report-monthly .rm-sec-gbp { break-before: page; }
  .report-monthly .rm-sec h2, .report-monthly .rm-h3, .report-monthly .rm-col h3 { break-after: avoid; }
  .report-monthly .rm-sec-notes.is-empty { display: none; }
  .report-monthly .rm-cards { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
  .report-monthly .rm-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-monthly .rm-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .report-monthly .rm-cols-1 { grid-template-columns: minmax(0, 1fr); }
  .report-monthly tr, .report-monthly li { break-inside: avoid; }
  .report-monthly .table-wrap { overflow: visible; }
  a { color: #000; text-decoration: none; }
  .status { border: 1px solid currentColor; }
  @page { size: A4; margin: 16mm; }
}

@media (max-width: 640px) {
  input[type="text"], input[type="url"], input[type="search"], input[type="email"], input[type="password"], input[type="number"], select, textarea { font-size: 16px; min-height: 44px; }
  .btn { min-height: 42px; }
  .btn-small { min-height: 40px; }
  .seg button { min-height: 38px; }
  .icon-btn { width: 40px; height: 40px; }
  .lang-select { height: 40px; }
  .panel { padding: var(--s-4); border-radius: var(--r-md); }
  .page-head h1 { font-size: var(--t-2xl); }
  .client-head h1 { font-size: 22px; }
  .meter { grid-template-columns: minmax(78px, 104px) minmax(0, 1fr) 36px; gap: 10px; }
  .page-head .actions, .client-head .actions { width: 100%; }
  .page-head .actions .btn, .client-head .actions .btn { flex: 1; }
  .avatar.lg { width: 38px; height: 38px; font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .indeterminate::before { left: 0; width: 100%; opacity: .5; }
}

/* small screens: keep the history chart on the Doctor tab only, so tab content stays near the top */
@media (max-width: 640px) {
  .overview:not(.ov-doctor) .trend-card { display: none; }
}
@media (max-width: 1180px) {
  /* hint that the tab bar scrolls sideways */
  .tabs { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); padding-right: 28px; }
}

/* ---------------------------------------------------------------- API costs ("Xərclər") */
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; font-size: var(--t-xs); font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
.nav-badge[hidden] { display: none; }
.nav-badge.warn { background: var(--warn-soft); color: var(--warn); box-shadow: inset 0 0 0 1px var(--warn); }
.nav-badge.fail { background: var(--fail-soft); color: var(--fail); box-shadow: inset 0 0 0 1px var(--fail); }

.spend-banner { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; padding: 12px 16px; border-radius: var(--r-md);
  border: 1px solid; margin-bottom: var(--s-5); }
.spend-banner > div { flex: 1; min-width: 220px; }
.spend-banner strong { display: block; margin-bottom: 4px; }
.spend-banner ul { margin: 0; padding-left: 18px; font-size: var(--t-sm); }
.spend-banner .notice-icon .i { width: 20px; height: 20px; }
.spend-banner.warn { background: var(--warn-soft); border-color: var(--warn); }
.spend-banner.warn .notice-icon { color: var(--warn); }
.spend-banner.fail { background: var(--fail-soft); border-color: var(--fail); }
.spend-banner.fail .notice-icon { color: var(--fail); }

.cost-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: var(--s-4); margin-bottom: var(--s-5); align-items: start; }
.cost-grid > .panel { margin-bottom: 0; }
.cost-card { display: flex; flex-direction: column; gap: 10px; }
.cost-card.level-critical, .cost-card.level-empty, .cost-card.level-exhausted, .cost-card.level-auth_failed { box-shadow: var(--shadow-sm), inset 3px 0 0 var(--fail); }
.cost-card.level-low { box-shadow: var(--shadow-sm), inset 3px 0 0 var(--warn); }
.cost-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.cost-head h2 { font-size: var(--t-lg); margin: 0; }
.cost-remaining { display: flex; flex-direction: column; gap: 2px; }
.cost-remaining .big { font-family: var(--font-quote); font-weight: 600; font-size: var(--t-3xl); line-height: 1.1; font-variant-numeric: lining-nums tabular-nums; }
.cost-nobal { margin: 4px 0; }
.cost-bar.warn > span { background: var(--warn); }
.cost-bar.fail > span { background: var(--fail); }
.cost-bar.pass > span { background: var(--pass); }
.cost-rows { margin: 0; display: grid; gap: 4px; font-size: var(--t-sm); }
.cost-rows > div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed var(--line); padding: 3px 0; }
.cost-rows dt { color: var(--ink-3); }
.cost-rows dd { margin: 0; font-variant-numeric: tabular-nums; text-align: right; }
.cost-card .run-row { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bal-form { display: grid; gap: 10px; border-top: 1px solid var(--line); padding-top: 12px; }
.bal-form .field { margin: 0; }
.chk-line { display: flex; gap: 8px; align-items: center; font-size: var(--t-sm); cursor: pointer; }
.chk-line input { width: 18px; height: 18px; accent-color: var(--accent); }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-align: left; }
.link-btn:hover { text-decoration: underline; }
ul.plain { margin: 4px 0 0; padding-left: 18px; }
details.prices { margin-top: var(--s-4); }
details.prices summary { cursor: pointer; font-weight: 600; font-size: var(--t-sm); color: var(--ink-2); }
details.prices .table-wrap { margin-top: 8px; }

/* ---------------------------------------------------------------- team accounts */
.login-root { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(1200px 600px at 20% -10%, var(--accent-soft), transparent 60%), var(--bg); overflow-y: auto; }
.login-root[hidden] { display: none; }
body.login-mode .topbar, body.login-mode .layout, body.login-mode .footer { visibility: hidden; }
.login-card { width: min(100%, 400px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-md, var(--shadow-sm)); padding: 28px 28px 22px; }
.login-card h1 { font-family: var(--font-quote); font-size: var(--t-2xl); margin: 18px 0 4px; }
.login-card form { display: grid; gap: 12px; margin-top: 18px; }
.login-card .field { margin: 0; }
.login-card input { width: 100%; }
.login-by { color: var(--ink-3); text-align: center; margin-top: 18px; }
.user-menu { display: flex; align-items: center; gap: 4px; }
.user-menu[hidden] { display: none; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 3px 12px 3px 3px; cursor: pointer; color: var(--ink); max-width: 220px; }
.user-chip:hover { background: var(--surface-3); }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.uc-text { display: flex; flex-direction: column; line-height: 1.15; text-align: left; min-width: 0; }
.uc-name { font-size: var(--t-sm); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uc-role { font-size: 11px; color: var(--ink-3); }
@media (max-width: 760px) { .uc-text { display: none; } .user-chip { padding: 3px; } }
.team-form { display: grid; gap: 12px; margin-top: 12px; max-width: 760px; }
.team-form .field { margin: 0; }
.grid-form { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); align-items: start; }
.grid-form .full { grid-column: 1 / -1; }
table.data tr.is-off td { color: var(--ink-3); }
table.data select { min-height: 32px; padding: 2px 8px; }
.act-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.act-list li { display: flex; gap: 12px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--line); }
.act-list li:last-child { border-bottom: 0; }
.act-ic { flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--accent); }
.act-list li.is-fail .act-ic { color: var(--fail); background: var(--fail-soft); }
.act-body { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; flex: 1; min-width: 0; font-size: var(--t-sm); }
.act-text { min-width: 0; overflow-wrap: anywhere; }
.act-time { color: var(--ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- report delivery */
.dlv-panel .panel-head { flex-wrap: wrap; gap: 10px; }
.dlv-panel .panel-head h2 { display: flex; align-items: center; gap: 8px; }
.dlv-summary { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface-2); margin: 10px 0; }
.dlv-summary > div:first-child { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.dlv-h3 { font-size: var(--t-md); margin: 18px 0 8px; }
.dlv-err { max-width: 46ch; overflow-wrap: anywhere; }
.dlv-form { border-top: 1px solid var(--line); padding-top: 12px; }

/* print mode: the report alone, rendered to PDF by the server */
html.print-mode .topbar, html.print-mode .sidebar, html.print-mode .footer, html.print-mode .scrim,
html.print-mode .skip-link, html.print-mode .no-print, html.print-mode #login-root { display: none !important; }
html.print-mode .layout { display: block; }
html.print-mode .main { padding: 0; }

/* ---------------------------------------------------------------- tasks + run history */
.task-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; }
.task { display: flex; gap: 12px 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; padding: 12px 0; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.task.is-closed .task-title b { color: var(--ink-3); }
.task-main { flex: 1 1 320px; min-width: 0; }
.task-title { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.task-title b { overflow-wrap: anywhere; }
.task-desc { color: var(--ink-2); font-size: var(--t-sm); margin-top: 3px; max-width: 80ch; overflow-wrap: anywhere; white-space: pre-line; }
.task-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-size: var(--t-sm); align-items: center; }
.task-side { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.task-side select { min-height: 34px; padding: 2px 8px; font-size: var(--t-sm); max-width: 170px; }
.task-status.st-in_progress { border-color: var(--warn); }
.task-status.st-done { border-color: var(--pass); }
.prio { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 1px 7px; border-radius: 999px; }
.prio-high { background: var(--fail-soft); color: var(--fail); }
.prio-low { background: var(--surface-3); color: var(--ink-3); }
.due { display: inline-flex; gap: 4px; align-items: center; color: var(--ink-2); }
.due.late { color: var(--fail); font-weight: 600; }
.status.small { font-size: 12px; }
.icon-btn.sm { width: 32px; height: 32px; }
.task-chip { display: inline-flex; gap: 5px; align-items: center; font-size: 12px; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 2px 9px; }
.check .c-actions { margin-top: 6px; }
.task-form { max-width: none; border-top: 1px solid var(--line); padding-top: 12px; }
.rm-fixes { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rm-fixes li { display: flex; gap: 8px; align-items: flex-start; }
.rm-fixes li .i { color: var(--pass); margin-top: 3px; flex: none; }

/* ---------------------------------------------------------------- wrong-information detector */
.fc-panel .panel-head h2 { display: flex; align-items: center; gap: 8px; }
.fc-facts { max-width: 560px; margin: 8px 0 12px; }
.fc-chips { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-bottom: 8px; }
.fc-chips b { margin-left: -4px; margin-right: 6px; }
.fc-list { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.fc-list li { border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; background: var(--surface); }
.fc-list li.fc-fail { box-shadow: inset 3px 0 0 var(--fail); }
.fc-list li.fc-warn { box-shadow: inset 3px 0 0 var(--warn); }
.fc-row { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.fc-compare { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 6px 0; font-size: var(--t-md); overflow-wrap: anywhere; }
.fc-excerpt { margin: 4px 0 0; padding: 6px 10px; border-left: 3px solid var(--line-strong); color: var(--ink-2); font-family: var(--font-quote); font-size: var(--t-sm); overflow-wrap: anywhere; }
.report .rm-fc { margin: 4px 0 8px; padding-left: 18px; font-size: 13px; }
.report .rm-fc li { margin: 3px 0; }
.report .rm-fc-fail b { color: var(--fail); }

/* ---------------------------------------------------------------- inbox (client replies) */
.nav-badge.info { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-line); }
.badge.fail { border-color: color-mix(in srgb, var(--fail) 40%, transparent); color: var(--fail); background: var(--fail-soft); }
.badge.pass { border-color: color-mix(in srgb, var(--pass) 40%, transparent); color: var(--pass); background: var(--pass-soft); }
.chip { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 1px 9px; white-space: nowrap; }
.chip-muted { color: var(--ink-3); background: var(--surface-3); }
.mail-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; }
.mail-row { border-bottom: 1px solid var(--line); }
.mail-row:last-child { border-bottom: 0; }
.mail-head { all: unset; box-sizing: border-box; display: flex; gap: 12px; align-items: flex-start; width: 100%; padding: 12px 6px; cursor: pointer; border-radius: var(--r-sm); }
.mail-head:hover { background: var(--surface-2); }
.mail-head:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.mail-dot { flex: none; width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: transparent; }
.mail-dot.on { background: var(--accent); }
.mail-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mail-top { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.mail-from { font-weight: 500; overflow-wrap: anywhere; }
.mail-row.unread .mail-from, .mail-row.unread .mail-subject { font-weight: 700; }
.mail-subject { color: var(--ink); overflow-wrap: anywhere; }
.mail-preview { color: var(--ink-3); font-size: var(--t-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-time { flex: none; color: var(--ink-3); font-size: var(--t-sm); white-space: nowrap; }
.mail-row.open > .mail-head { background: var(--surface-2); }
.mail-detail { padding: 4px 6px 16px 26px; }
.mail-meta { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 4px 0 10px; font-size: var(--t-sm); }
.mail-meta dt { color: var(--ink-3); }
.mail-meta dd { margin: 0; overflow-wrap: anywhere; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.mail-meta select { min-height: 32px; padding: 2px 8px; font-size: var(--t-sm); max-width: 240px; }
.mail-body { white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--font-ui); font-size: var(--t-md); line-height: 1.55; margin: 0 0 6px; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); max-height: 420px; overflow: auto; }
.mail-att { display: flex; gap: 6px; align-items: center; color: var(--ink-2); }
.mail-actions { margin-top: 10px; flex-wrap: wrap; }
.mail-list.compact .mail-head { padding: 9px 4px; }
.mail-list.compact .mail-preview { display: none; }
.dlv-hint { color: var(--warn); margin-top: 2px; max-width: 60ch; }
@media (max-width: 640px) {
  .mail-detail { padding-left: 6px; }
  .mail-time { display: none; }
}

/* ---------------------------------------------------------------- notes + fix pack (Work tab) */
.notes-panel textarea { width: 100%; min-height: 120px; resize: vertical; font: inherit; }
.notes-text { white-space: pre-line; overflow-wrap: anywhere; margin: 4px 0 6px; max-width: 90ch; }
.fix-toolbar { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-end; justify-content: space-between; margin: 4px 0 12px; }
.fix-platform { display: flex; flex-direction: column; gap: 4px; min-width: 240px; }
.fix-platform select { min-height: 36px; max-width: 320px; }
.fix-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.fix-item { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.fix-item.fail { box-shadow: inset 3px 0 0 var(--fail); }
.fix-item.warn { box-shadow: inset 3px 0 0 var(--warn); }
.fix-head { all: unset; box-sizing: border-box; display: flex; gap: 12px; align-items: center; width: 100%; padding: 10px 14px; cursor: pointer; border-radius: var(--r-md); }
.fix-head:hover { background: var(--surface-2); }
.fix-head:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.fix-ic { flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.fix-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; overflow-wrap: anywhere; }
.fix-chev { flex: none; color: var(--ink-3); }
.fix-body { padding: 2px 16px 14px 56px; }
.fix-body h4 { margin: 10px 0 4px; font-size: var(--t-sm); }
.fix-steps { margin: 0 0 8px; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; max-width: 90ch; }
.fix-mail { margin: 8px 0 12px; }
@media (max-width: 640px) { .fix-body { padding-left: 14px; } }
.fix-mail pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 360px; overflow: auto; }

/* ---------------------------------------------------------------- execution system: roles, plan, packages, results */
.role-badge { display: inline-flex; gap: 4px; align-items: center; }
.role-badge .i { width: 12px; height: 12px; }
.chip .i { width: 12px; height: 12px; margin-right: 3px; }
.chip-client { color: var(--ink-2); background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line-strong); }
.chip-wait { color: var(--warn); background: var(--warn-soft); white-space: normal; }
.chip-approval { color: var(--fail); background: var(--fail-soft); }
.chip-ok { color: var(--pass); background: var(--pass-soft); }
.task.is-waiting .task-title b { color: var(--ink-2); }
.task-status.st-review { border-color: var(--accent); }
.task-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.task-edit, .task-return { margin-top: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.task-return input { width: 100%; max-width: 520px; }
.te-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 12px; }
.te-grid .field { margin: 0; }
.te-deps, .te-approval { border: 0; padding: 0; margin: 12px 0 0; min-width: 0; }
.te-deps { max-height: 180px; overflow: auto; }
.te-approval input[type="text"] { width: 100%; max-width: 520px; margin-top: 6px; }
.tick-row { display: flex; gap: 8px; align-items: flex-start; font-size: var(--t-sm); padding: 3px 0; cursor: pointer; }
.tick-row input { margin-top: 3px; flex: none; }
.tick-row span { overflow-wrap: anywhere; }

.ct-hint { display: flex; gap: 6px; align-items: center; margin-top: 8px; }
.ct-list { list-style: none; margin: 4px 0 8px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ct-list li { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: var(--t-sm); overflow-wrap: anywhere; }
.ct-row { display: grid; grid-template-columns: 170px repeat(3, minmax(0, 1fr)); gap: 8px; align-items: center; margin-bottom: 8px; }
.ct-row input { min-width: 0; }
.ct-exec-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px 14px; margin-top: 8px; }
.ct-exec { display: flex; flex-direction: column; gap: 4px; font-size: var(--t-sm); }

.plan-bar { margin-top: 0; }
.plan-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; }
.plan-item { border-bottom: 1px solid var(--line); }
.plan-item:last-child { border-bottom: 0; }
.plan-item.is-existing { opacity: .72; }
.plan-check { display: flex; gap: 10px; align-items: flex-start; padding: 10px 2px; cursor: pointer; }
.plan-check input { margin-top: 4px; flex: none; }
.plan-main { flex: 1; min-width: 0; }

.role-seg { margin: 10px 0 14px; }
.role-seg button { display: inline-flex; gap: 5px; align-items: center; }
.seg-n { font-size: 11px; font-weight: 700; color: var(--ink-3); }
.pkg-head { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between; align-items: center; }
.pkg-head .run-row { margin-top: 0; }
.pkg-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.pkg-confirm { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: var(--t-sm); }
.pkg-assign { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.pkg-assign select { min-height: 34px; max-width: 220px; }
.txt-fail { color: var(--fail); font-weight: 600; }

.results-empty p { max-width: 70ch; }
.res-set-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.res-set-form input[type="text"] { flex: 1 1 240px; max-width: 420px; }
.res-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 220px)); gap: 10px; margin: 4px 0 14px; }
.res-table td, .res-table th { vertical-align: middle; }
.res-table th[scope="row"] { font-weight: 500; }
.res-n, .res-hint { display: block; font-weight: 400; }
.res-spark { width: 110px; }
.spark { display: block; }
.spark.good { color: var(--pass); }
.spark.bad { color: var(--fail); }
.res-history { margin: 4px 0 0; padding-left: 18px; font-size: var(--t-sm); color: var(--ink-2); }

@media (max-width: 760px) {
  .ct-row { grid-template-columns: minmax(0, 1fr); gap: 6px; margin-bottom: 14px; }
  .res-spark { display: none; }
  .res-table th:last-child { display: none; }
  .task-side select { max-width: 100%; }
}

/* Paid-check limits: a short bar with "used / limit" next to it */
.limit-bar { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.limit-bar .bar { flex: 1 1 120px; min-width: 80px; }
.health-err { overflow-wrap: anywhere; }

/* AI drafts: marked text, warnings, the editor */
.draft-form .full, .draft-form .field.full { grid-column: 1 / -1; }
.draft-editor { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin: 12px 0; background: var(--surface-2); }
.draft-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 12px; }
.draft-sub { font-size: .85rem; margin: 12px 0 6px; }
.draft-preview { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; padding: 12px; margin: 10px 0 6px;
  border-radius: 8px; background: var(--surface); border: 1px solid var(--line); max-height: 420px; overflow: auto; }
.draft-preview mark { border-radius: 3px; padding: 0 2px; color: inherit; }
.draft-preview mark.dw-fact { background: var(--fail-soft); box-shadow: inset 0 -2px 0 var(--fail); }
.draft-preview mark.dw-ok { background: var(--pass-soft); }
.draft-preview mark.dw-style { background: var(--warn-soft); box-shadow: inset 0 -2px 0 var(--warn); }
.draft-warnings, .draft-lint ul, .draft-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.draft-warnings li, .draft-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.draft-warnings li.is-ok code { text-decoration: line-through; opacity: .7; }
.draft-list li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.draft-list li.is-open .link-btn { font-weight: 600; }
.draft-editor textarea { width: 100%; font: inherit; }
.draft-name { max-width: 200px; }

/* Chrome extension panel (Team page) */
.token-once { margin: 12px 0 16px; }
.token-once .actions { margin-top: 8px; }
.ext-panel .table-wrap { margin-top: 16px; }
.token-once .codebox pre { white-space: pre-wrap; word-break: break-all; }
.sub-head { font-size: 1rem; margin: 20px 0 4px; }
.plain-list { list-style: none; margin: 8px 0 0; padding: 0; }
.plain-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.plain-list li .btn { margin-left: auto; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
