/* PhishFort Quote Desk — styled to match the phishfort.com brand.
   Palette: blue primary, clean working surface, navy dark panels.
   Amber reserved for warning states only. */

/* ── Inter (self-hosted variable font, from phishfort-website) ── */
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/fonts/inter/inter-var-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/fonts/inter/inter-var-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter'; font-style: italic; font-weight: 100 900; font-display: swap;
  src: url('/fonts/inter/inter-var-latin-ext-italic.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Inter'; font-style: italic; font-weight: 100 900; font-display: swap;
  src: url('/fonts/inter/inter-var-latin-italic.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Neutrals — the Sentinel Ink ramp + tinted surfaces */
  --ink: #0a0d12;                 /* Ink — body text, dark panels */
  --ink-2: #0e112847;            /* with alpha */
  --bg: #fdfdfd;                  /* Surface — page background */
  --surface-panel: #f5f5f5;      /* Surface Panel — hover fills, chips, read-only */
  --card: #ffffff;               /* Surface Card — the work surface */
  --border: #e9eaeb;             /* Divider — default + input border */
  --border-strong: #d5d7da;      /* gray-300 — stronger separation */
  --text: #0a0d12;               /* Ink — primary content */
  --muted: #535862;              /* Ink Soft — secondary text */
  --muted-2: #717680;            /* Ink Mute — metadata, placeholder */

  /* Brand — Sentinel Blue (action only) */
  --accent: #456ceb;             /* Sentinel Blue (primary-600) */
  --accent-dark: #3a5ac4;        /* Sentinel Blue Deep (primary-700) */
  --accent-wash: #e3e9ff;        /* Sentinel Mist — badge/selection fills */
  --accent-veil: #f3f6ff;        /* Sentinel Veil — faintest selection tint */

  /* Signal — soft-fill / mid-border / dark-text triples */
  --info: #2e90fa;        --info-soft: #eff8ff;     --info-text: #175cd3;
  --success: #17b26a;     --success-soft: #ecfdf3;  --success-text: #067647;
  --warning: #f79009;     --warning-soft: #fffaeb;  --warning-text: #b54708;
  --danger: #f04438;      --danger-soft: #fef3f2;   --danger-text: #b42318;
  /* Back-compat aliases (older selectors referenced these names) */
  --amber: var(--warning);       --amber-wash: var(--warning-soft);
  --danger-wash: var(--danger-soft);
  --blue: var(--accent);         --blue-wash: var(--info-soft);

  /* Radius */
  --radius: 0.75rem;             /* 12px — cards (xl) */
  --radius-md: 0.375rem;         /* 6px — buttons, inputs (md) */
  --radius-sm: 0.5rem;           /* 8px — badges, small panels (lg) */

  /* Elevation — whisper-soft, flat by default */
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);     /* Card */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05); /* buttons, inputs, badges */

  /* Type — Inter does every job (One Family). Mono reserved for raw code only. */
  --mono: "Inter", system-ui, -apple-system, sans-serif;
  --code: ui-monospace, SFMono-Regular, Menlo, monospace;
  --display: "Inter", system-ui, -apple-system, sans-serif;
  --body: "Inter", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--body);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; letter-spacing: -0.01em; margin: 0; }
a { color: var(--accent-dark); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ── Top bar — white header, blue top-border (phishfort.com) ── */
.topbar {
  height: 64px; background: rgba(255, 255, 255, 0.95); color: var(--text);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-top: 3px solid var(--accent); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px; padding: 0 24px;
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; font-family: var(--display); font-weight: 600; }
.brand .home-link { display: block; line-height: 0; }
.brand .logo { height: 32px; width: auto; display: block; }
.brand .tag { color: var(--muted); font-weight: 500; font-size: 14px; padding-left: 12px; border-left: 1px solid var(--border); }
.beta-badge {
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap;
  padding: 2px 8px; border-radius: 999px; color: var(--warning-text); border: 1px solid #fedf89; background: var(--warning-soft); }
.topbar .spacer { flex: 1; }
/* Quiet route out to the guidebook. Sits left of the identity block so it
   reads as navigation, not as part of who-you-are. */
.topbar-link { font-size: 13px; color: var(--muted); text-decoration: none; padding: 3px 10px; border-radius: 999px; }
.topbar-link:hover { color: var(--text); background: var(--surface-panel); }
.whoami { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.role-badge {
  font-size: 12px; font-weight: 600; white-space: nowrap;
  padding: 2px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); color: var(--muted); background: var(--surface-panel); }
.role-badge.staff { color: var(--accent-dark); border-color: #c7d7fe; background: var(--accent-wash); }
.role-badge.msp { color: var(--success-text); border-color: #abefc6; background: var(--success-soft); }
.whoami .logout {
  font-size: 13px; color: var(--muted); text-decoration: none; white-space: nowrap;
  padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border-strong);
}
.whoami .logout:hover { color: var(--text); border-color: var(--text); }

/* ── Layout ──────────────────────────────────────────────── */
.wrap { max-width: 1240px; margin: 0 auto; padding: 22px 20px 60px; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 8px; }
.page-head h1 { font-size: 22px; }
.page-head .sub { color: var(--muted); font-size: 13px; }

.split { display: grid; grid-template-columns: 360px 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }

/* MSP welcome / orientation panel — quiet, full-width, dismissible. Blue wash
   (never amber) because it's informational, not a warning. */
.onboard {
  position: relative;
  background: var(--accent-veil);
  border: 1px solid var(--accent-wash);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 18px;
  animation: onboard-in 0.25s ease;
}
@keyframes onboard-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .onboard { animation: none; } }
.onboard-dismiss {
  position: absolute; top: 12px; right: 12px;
  width: 28px; height: 28px; border: none; border-radius: var(--radius-sm);
  background: transparent; color: var(--muted-2); font-size: 18px; line-height: 1; cursor: pointer;
}
.onboard-dismiss:hover { background: #fff; color: var(--muted); }
.onboard-head h2 { font-size: 16px; margin: 0 0 4px; padding-right: 32px; }
.onboard-head p { color: var(--muted); font-size: 13px; margin: 0 0 16px; max-width: 60ch; }
.onboard-steps {
  list-style: none; margin: 0 0 14px; padding: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 24px;
}
@media (max-width: 720px) { .onboard-steps { grid-template-columns: 1fr; } }
.onboard-steps li { display: flex; gap: 10px; align-items: flex-start; }
.onboard-num {
  flex: none; width: 22px; height: 22px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  font-variant-numeric: tabular-nums;
}
.onboard-steps div strong { display: block; font-size: 13px; margin-bottom: 2px; color: var(--text); }
.onboard-steps div span { display: block; color: var(--muted); font-size: 12px; line-height: 1.4; }
.onboard-foot {
  margin: 0; padding-top: 14px; border-top: 1px solid var(--accent-wash);
  color: var(--muted); font-size: 12px; max-width: 80ch;
}
.onboard-foot strong { color: var(--text); font-weight: 600; }

/* Full-page staff detail and new-request form — capped so the card stacks
   don't sprawl across the whole 1240px wrap. */
.staff-detail-page { max-width: 900px; }
.form-page { max-width: 680px; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card .card-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card .card-head h3 { font-size: 14px; }
.card .card-head .hint { font-size: 12px; color: var(--muted); }
.card .card-body { padding: 18px; }
.card .card-body + .card-body { border-top: 1px solid var(--border); }

.section-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted-2); margin: 0 0 10px; }

/* ── Forms ───────────────────────────────────────────────── */
label { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin: 0 0 5px; }
input, textarea, select {
  width: 100%; font: inherit; color: var(--text); background: #fff;
  border: 1px solid var(--border); border-radius: var(--radius-md); padding: 9px 11px; box-shadow: var(--shadow-sm); }
input::placeholder, textarea::placeholder { color: #a4a7ae; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--border); box-shadow: 0 0 0 2px var(--accent); }
input:disabled, input[readonly], textarea:disabled, select:disabled { background: var(--surface-panel); color: var(--muted-2); cursor: not-allowed; }
input.mono, .field-money input { font-variant-numeric: tabular-nums; }
textarea { resize: vertical; min-height: 64px; }
.field { margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-money { position: relative; }
.field-money .cur { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.field-money input { padding-left: 26px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; line-height: 1.45; }
.req::after { content: " *"; color: var(--danger); }
.optional { color: var(--muted); font-weight: 400; }

/* Mandatory either/or choices on the request form (request type, sub-brands). */
.choice-row { display: flex; gap: 8px; flex-wrap: wrap; }
.choice { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: #fff; cursor: pointer; font-weight: 500; color: var(--muted); box-shadow: var(--shadow-sm); }
.choice:has(input:checked) { border-color: var(--accent); color: var(--accent-dark); background: var(--accent-wash); }
.choice input { accent-color: var(--accent); margin: 0; }

.brand-rows .brand-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin-bottom: 8px; align-items: center; }
.brand-rows input { padding: 7px 9px; }
.icon-btn { border: 1px solid var(--border-strong); background: #fff; border-radius: var(--radius-sm); width: 34px; height: 34px; cursor: pointer; color: var(--muted); font-size: 16px; }
.icon-btn:hover { background: var(--bg); color: var(--danger); }
.brand-rows .brand-row:only-child .b-remove { display: none; }
.link-btn { background: none; border: none; color: var(--accent-dark); font: inherit; font-weight: 500; cursor: pointer; padding: 0; }

/* ── Buttons ─────────────────────────────────────────────── */
/* Ring-over-color-shift: hover responds with a 2px ring at 2px offset
   (a ring colour + a card-coloured gap), not a fill darkening. */
.btn { font: inherit; font-weight: 500; border-radius: var(--radius-md); padding: 9px 16px; cursor: pointer; border: 1px solid transparent; display: inline-flex; align-items: center; gap: 7px; transition: box-shadow 0.15s ease; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--accent); }
.btn-ghost { background: #fff; border-color: var(--border); color: var(--muted); box-shadow: var(--shadow-sm); }
.btn-ghost:hover:not(:disabled) { background: var(--border); box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--border); }
.btn-danger { background: #fff; border-color: var(--danger); color: var(--danger); box-shadow: var(--shadow-sm); }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--danger); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
/* Mine / All scope switch on the MSP list, for partner admins. */
.scope-toggle .btn { padding: 7px 12px; }

/* Partner admins: the grant form is a single short field, so it keeps a
   reading-width column rather than stretching across the full page. */
.admin-grant-card { max-width: 560px; margin-bottom: 16px; }

/* ── Keyboard focus (visible only for keyboard users) ──────── */
.btn:focus-visible, .filters button:focus-visible, .icon-btn:focus-visible,
.link-btn:focus-visible, .btn-link:focus-visible, a:focus-visible,
.q-item:focus-visible, .dossier > summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm);
}
.q-item:focus-visible { outline-offset: -2px; }

/* ── Status badges — soft signal fill + matching dark text + leading dot ── */
.pill { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: var(--radius-sm); border: 1px solid; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; margin-right: 6px; border-radius: 999px; background: currentColor; flex: none; }
.pill.submitted { color: #5925dc; border-color: #d9d6fe; background: #f4f3ff; }
.pill.enriched  { color: var(--info-text); border-color: #b2ddff; background: var(--info-soft); }
.pill.drafted   { color: var(--warning-text); border-color: #fedf89; background: var(--warning-soft); }
.pill.sent      { color: var(--accent-dark); border-color: #c7d7fe; background: var(--accent-wash); }
.pill.accepted  { color: var(--success-text); border-color: #abefc6; background: var(--success-soft); }
.pill.declined  { color: var(--danger-text); border-color: #fecdca; background: var(--danger-soft); }
.pill.expired   { color: var(--warning-text); border-color: #fedf89; background: var(--warning-soft); }
.pill.enriching { color: var(--accent-dark); border-color: #c7d7fe; background: var(--accent-wash); }
.pill.enriching::before { animation: rp-pulse 1.1s ease-in-out infinite; }
.pill.discovering { color: var(--accent-dark); border-color: #c7d7fe; background: var(--accent-wash); }
.pill.discovering::before { animation: rp-pulse 1.1s ease-in-out infinite; }
/* Full-report request marker — teal so it reads as a trait, not a pipeline stage. */
.pill.report,
.pill.report_only { color: #107569; border-color: #99f6e0; background: #f0fdf9; }

/* ── Queue list ──────────────────────────────────────────── */
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.filters button { font: inherit; font-size: 12px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border); background: #fff; cursor: pointer; color: var(--muted); }
.filters button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.queue { display: flex; flex-direction: column; gap: 1px; background: var(--border); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.q-item { background: #fff; padding: 12px 14px; cursor: pointer; display: flex; flex-direction: column; gap: 5px; }
.q-item:hover { background: var(--surface-panel); }
.q-item .q-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.q-item .q-client { font-weight: 600; font-size: 14px; }
.q-item .q-meta { display: flex; gap: 10px; color: var(--muted); font-size: 12px; align-items: center; }
.q-item .q-id { font-variant-numeric: tabular-nums; font-size: 11px; color: var(--muted-2); }

/* A freshly-arrived submission slides down from the top with an accent flash. */
.q-item.is-new { animation: q-arrive 0.45s ease both; }
@keyframes q-arrive {
  0%   { opacity: 0; transform: translateY(-10px); background: var(--accent-wash); }
  60%  { opacity: 1; background: var(--accent-wash); }
  100% { transform: translateY(0); background: #fff; }
}
/* The global guard at :214 only disables `transition`, not `animation`. */
@media (prefers-reduced-motion: reduce) { .q-item.is-new { animation: none; } }

/* ── Quote table (staff + MSP lists) ─────────────────────── */
.list-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.list-toolbar .filters { margin-bottom: 0; flex: 1 1 auto; }
.search-input { width: 260px; flex: none; }
.msp-filter { width: 180px; flex: none; }

.table-wrap { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; container-type: inline-size; }
.qt { width: 100%; border-collapse: collapse; font-size: 13px; }
.qt th {
  text-align: left; padding: 10px 14px; background: var(--surface-panel); border-bottom: 1px solid var(--border);
  font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.qt th.num, .qt td.num { text-align: right; }
.qt td.num { font-variant-numeric: tabular-nums; }
.th-sort {
  font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit;
  background: none; border: none; padding: 0; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px; }
.th-sort:hover { color: var(--text); }
.th-sort:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm); }
.th-sort .sort-arrow { font-size: 8px; line-height: 1; min-width: 8px; }
.qt th[aria-sort="ascending"] .th-sort, .qt th[aria-sort="descending"] .th-sort { color: var(--text); }
.qt td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.qt tbody tr:last-child td { border-bottom: none; }
.qt tr.q-row { cursor: pointer; }
.qt tr.q-row:hover td { background: var(--surface-panel); }
.qt tr.q-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.qt .cell-client { font-weight: 600; }
.qt .cell-sub { display: block; font-weight: 400; font-size: 11px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.qt .cell-quiet { color: var(--muted); }
.qt .cell-note { margin-left: 8px; font-size: 11px; color: var(--muted-2); }
.pill-row { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.qt .qt-empty td { padding: 36px 20px; text-align: center; color: var(--muted); }

/* A freshly-arrived row flashes its cells — no transform, tables dislike it. */
.qt tr.is-new td { animation: row-flash 0.9s ease both; }
@keyframes row-flash {
  0%, 50% { background: var(--accent-wash); }
  100% { background: transparent; }
}
@media (prefers-reduced-motion: reduce) { .qt tr.is-new td, .qt tbody tr.is-new { animation: none; } }

/* In a narrow container each row becomes a stacked card with labeled fields —
   same white-cells-on-hairline look as the .queue cards. (display:block strips
   table semantics here; acceptable, each card is self-labeled.) Container
   queries, not viewport ones: the MSP list lives in a .split column, so only
   the wrap's own width says whether the table fits. The .qt background paints
   the hairlines between cards (a container query can't style .table-wrap
   itself). Thresholds come from measured min-content widths: analytics tables
   need ~650px; the quote lists (.table-wrap--cards, 9 staff columns ~1080px,
   7 MSP columns in a ~880px column) get a wider trigger. The --cards block
   must mirror this one. */
@container (max-width: 700px) {
  .qt thead { display: none; }
  .qt, .qt tbody { display: block; }
  .qt { background: var(--border); }
  .qt tbody tr { display: block; padding: 12px 14px; background: var(--card); }
  .qt tbody tr + tr { margin-top: 1px; }
  .qt td { display: grid; grid-template-columns: 120px 1fr; gap: 8px; padding: 2px 0; border: none; align-items: baseline; justify-items: start; }
  .qt td::before { content: attr(data-label); font-size: 11px; color: var(--muted); font-weight: 500; }
  .qt td.num { text-align: left; }
  .qt td.cell-client { display: flex; align-items: baseline; gap: 8px; padding-bottom: 6px; font-size: 14px; }
  .qt td.cell-client::before { content: none; }
  .qt .cell-sub { display: inline; }
  .qt tr.q-row:hover td { background: transparent; }
  .qt tbody tr.q-row:hover { background: var(--surface-panel); }
  .qt tr.is-new td { animation: none; }
  .qt tbody tr.is-new { animation: row-flash 0.9s ease both; background: var(--card); }
  .qt .qt-empty td { display: block; padding: 36px 20px; }
  .qt .qt-empty td::before { content: none; }
}
@container (max-width: 1100px) {
  .table-wrap--cards .qt thead { display: none; }
  .table-wrap--cards .qt, .table-wrap--cards .qt tbody { display: block; }
  .table-wrap--cards .qt { background: var(--border); }
  .table-wrap--cards .qt tbody tr { display: block; padding: 12px 14px; background: var(--card); }
  .table-wrap--cards .qt tbody tr + tr { margin-top: 1px; }
  .table-wrap--cards .qt td { display: grid; grid-template-columns: 120px 1fr; gap: 8px; padding: 2px 0; border: none; align-items: baseline; justify-items: start; }
  .table-wrap--cards .qt td::before { content: attr(data-label); font-size: 11px; color: var(--muted); font-weight: 500; }
  .table-wrap--cards .qt td.num { text-align: left; }
  .table-wrap--cards .qt td.cell-client { display: flex; align-items: baseline; gap: 8px; padding-bottom: 6px; font-size: 14px; }
  .table-wrap--cards .qt td.cell-client::before { content: none; }
  .table-wrap--cards .qt .cell-sub { display: inline; }
  .table-wrap--cards .qt tr.q-row:hover td { background: transparent; }
  .table-wrap--cards .qt tbody tr.q-row:hover { background: var(--surface-panel); }
  .table-wrap--cards .qt tr.is-new td { animation: none; }
  .table-wrap--cards .qt tbody tr.is-new { animation: row-flash 0.9s ease both; background: var(--card); }
  .table-wrap--cards .qt .qt-empty td { display: block; padding: 36px 20px; }
  .table-wrap--cards .qt .qt-empty td::before { content: none; }
}
@media (max-width: 700px) {
  .search-input { width: 100%; }
}

/* ── Buffer strip — the signature element ────────────────── */
.buffer-strip { display: flex; align-items: stretch; gap: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.buffer-strip .bcell { padding: 12px 16px; flex: 1; text-align: center; background: #fff; }
.buffer-strip .bcell .blabel { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.buffer-strip .bcell .bval { font-variant-numeric: tabular-nums; font-size: 24px; font-weight: 600; margin-top: 4px; }
.buffer-strip .barrow { display: flex; align-items: center; justify-content: center; padding: 0 4px; color: var(--muted-2); }
.buffer-strip .bcell.added { background: var(--blue-wash); }
.buffer-strip .bcell.added .bval { color: var(--accent); }
.buffer-strip .bcell.added .blabel { color: var(--accent); }
.buffer-strip .bcell.result { background: var(--accent-wash); }
.buffer-strip .bcell.result .bval { color: var(--accent-dark); }
.buffer-note { font-size: 12px; color: var(--muted); margin-top: 8px; }

/* ── Detail / data grid ──────────────────────────────────── */
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }
.enrich-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 600px) {
  .enrich-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  /* Stack the brand name/domain inputs, keep the remove button alongside. */
  .brand-rows .brand-row {
    grid-template-columns: 1fr auto;
    grid-template-areas: "name remove" "domain remove";
    align-items: center;
  }
  .brand-rows .brand-row .b-name   { grid-area: name; }
  .brand-rows .brand-row .b-domain { grid-area: domain; }
  .brand-rows .brand-row .b-remove { grid-area: remove; align-self: center; }
}
.stat { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; background: var(--surface-panel); }
.stat .s-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.stat .s-val { font-variant-numeric: tabular-nums; font-size: 20px; font-weight: 600; margin-top: 4px; }
.stat input { margin-top: 6px; }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .big { font-family: var(--display); font-size: 16px; color: var(--text); margin-bottom: 6px; }

/* ── Staff detail: weighted panel stack ──────────────────────── */
.staff-detail-stack { display: flex; flex-direction: column; gap: 16px; }
/* The price-and-send panel is the primary action zone — an accent top edge
   (mirrors the topbar) lifts it above the supporting panels. */
.card-primary { border-top: 3px solid var(--accent); }
.card-primary > .card-head h3 { color: var(--accent-dark); }
/* Activity is reference-only — recessed and quiet. */
.card-muted { box-shadow: none; background: #fcfcfd; }
.card-muted > .card-head h3 { color: var(--muted); }

.total-line { display: flex; align-items: baseline; justify-content: space-between; padding: 14px 16px; background: var(--ink); color: #fff; border-radius: var(--radius); }
.total-line .t-label { font-size: 13px; color: #aebbcd; }
.total-line .t-val { font-variant-numeric: tabular-nums; font-size: 26px; font-weight: 600; }
.total-line .t-val small { font-size: 13px; color: #8fa0b8; }

.timeline { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.timeline li { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--border); }
.timeline li:last-child { border-bottom: none; }
.timeline .t-when { font-variant-numeric: tabular-nums; font-size: 11px; color: var(--muted-2); min-width: 120px; }
.timeline .t-act { font-weight: 600; }

.banner { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; }
.banner.warn { background: var(--warning-soft); color: var(--warning-text); border: 1px solid #fedf89; }
.banner.ok { background: var(--success-soft); color: var(--success-text); border: 1px solid #abefc6; }
.banner.err { background: var(--danger-soft); color: var(--danger-text); border: 1px solid #fecdca; }
.banner.info { background: var(--info-soft); color: var(--info-text); border: 1px solid #b2ddff; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: var(--radius); box-shadow: var(--shadow); font-size: 14px; z-index: 50; opacity: 0; transition: opacity 0.2s, transform 0.2s; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: #b91c1c; }
.toast.show.error { pointer-events: auto; cursor: pointer; }

/* ── Skeleton loaders ────────────────────────────────────── */
.skel { background: linear-gradient(90deg, #eef1f4 25%, #f6f8fa 37%, #eef1f4 63%); background-size: 400% 100%; border-radius: 6px; animation: skel-shimmer 1.4s ease infinite; }
.skel-line { height: 12px; margin-bottom: 12px; }
.skel-block { height: 130px; margin: 16px 0; }
.skel.w40 { width: 40%; } .skel.w50 { width: 50%; } .skel.w60 { width: 60%; } .skel.w70 { width: 70%; }
@keyframes skel-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } .skel { animation: none; } }

/* ── Small screens: keep the topbar from overflowing ───────── */
@media (max-width: 560px) {
  .topbar { padding: 0 14px; gap: 8px; }
  .whoami { gap: 8px; }
  .whoami > span:first-child { display: none; } /* hide the email; role badge + log out remain */
}
@media (max-width: 430px) {
  .brand .tag { display: none; } /* drop the "Quote Desk" sub-label so the bar fits */
}

/* ── MSP-facing statuses ─────────────────────────────────── */
.pill.in_review   { color: #5925dc; border-color: #d9d6fe; background: #f4f3ff; }
.pill.quote_ready { color: var(--accent-dark); border-color: #c7d7fe; background: var(--accent-wash); }

/* ── MSP quote document (the client-facing trust moment) ──── */
.chip { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; border: 1px solid transparent; background: var(--surface-panel); font-size: 12px; color: #181d27; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

.msp-detail { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; max-width: 1060px; }
@media (max-width: 860px) { .msp-detail { grid-template-columns: 1fr; } }
.msp-recap .recap-notes { margin-top: 14px; font-size: 13px; line-height: 1.55; white-space: pre-wrap; }

.quote-doc { padding: 26px 28px; }
.quote-doc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.quote-doc-title { font-size: 19px; }
.quote-doc-id { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--muted-2); }
.quote-doc-total {
  margin-top: 18px; display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  background: var(--ink); color: #fff; border-radius: var(--radius); padding: 20px 22px; }
.quote-doc-total .qdt-label { font-size: 13px; color: #aebbcd; }
.quote-doc-total .qdt-val { font-variant-numeric: tabular-nums; font-size: 32px; font-weight: 600; letter-spacing: -0.01em; }
.quote-valid { margin-top: 8px; font-size: 12px; color: var(--muted); text-align: right; }
.quote-doc-body { margin-top: 20px; }
.quote-lines { display: grid; gap: 14px; margin: 0; }
.quote-lines > div { display: grid; grid-template-columns: 150px 1fr; gap: 12px; }
.quote-lines dt { color: var(--muted); font-size: 13px; }
.quote-lines dd { margin: 0; font-size: 14px; line-height: 1.55; }
@media (max-width: 520px) {
  .quote-lines > div { grid-template-columns: 1fr; gap: 4px; }
  /* Recap list: label above value so the value isn't crushed on a phone. */
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dt { font-size: 12px; }
  /* Tighten the generous desktop padding so content isn't edge-squeezed. */
  .wrap { padding: 16px 14px 48px; }
  .quote-doc { padding: 20px 18px; }
  .quote-doc.is-pending { padding: 28px 20px; }
  .quote-doc-total { padding: 16px 18px; }
  .quote-doc-total .qdt-val { font-size: 26px; }
  /* Stack the footer actions and give them full-width tap targets. */
  .quote-doc-foot { flex-direction: column; align-items: stretch; gap: 10px; }
  .quote-doc-foot > .btn { width: 100%; justify-content: center; }
  .quote-actions { width: 100%; display: flex; gap: 10px; }
  .quote-actions .btn { flex: 1; justify-content: center; }
}
.quote-reassure { margin: 18px 0 0; max-width: 60ch; color: var(--muted); font-size: 13px; line-height: 1.6; }
.quote-doc-foot { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.quote-actions { display: flex; gap: 10px; }
.btn.btn-decline { color: var(--muted); }
.btn.btn-decline:hover:not(:disabled) { color: var(--danger); border-color: var(--danger); background: var(--danger-wash); }

.quote-doc.is-pending { padding: 40px 32px; }
.quote-doc-status { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent-dark); }
.quote-doc-status .qd-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--accent); animation: rp-pulse 1.4s ease-in-out infinite; }
.quote-doc.is-pending .quote-doc-title { margin-top: 12px; font-size: 20px; }
.quote-doc-lead { margin: 10px 0 0; max-width: 56ch; color: var(--muted); font-size: 14px; line-height: 1.6; }

/* ── Brand list (staff detail) ───────────────────────────── */
.brand-lines { display: flex; flex-direction: column; gap: 6px; }
.brand-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.brand-line .bl-name { font-weight: 600; }
.brand-line .bl-domain { font-size: 12px; color: var(--muted); }
.brand-src { display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: var(--radius-sm); border: 1px solid; white-space: nowrap; }
.brand-src-ai { color: var(--accent-dark); border-color: #c7d7fe; background: var(--accent-wash); }

/* ── Brand discovery panel ───────────────────────────────── */
#discover-panel:empty { display: none; }
.discover-status { border-top: 1px solid var(--line); padding: 14px 20px; font-size: 13px; color: var(--muted); }
.discover-results { border-top: 1px solid var(--line); }
.discover-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin-bottom: 10px; }
.discover-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.discover-cand { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.discover-cand:hover { border-color: #c7d7fe; }
.discover-cand.is-added { opacity: 0.6; cursor: default; }
.discover-cand .dc-check { margin-top: 3px; }
.discover-cand .dc-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.discover-cand .dc-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.discover-cand .dc-name { font-weight: 600; }
.discover-cand .dc-domain { font-size: 12px; color: var(--muted); }
.discover-cand .dc-rationale { font-size: 12px; color: var(--muted-2); line-height: 1.45; }
.discover-cand .dc-added { font-size: 11px; color: var(--muted-2); font-style: italic; }
.conf-pill { display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: var(--radius-sm); border: 1px solid; white-space: nowrap; }
.conf-pill.conf-high   { color: var(--success-text); border-color: #abefc6; background: var(--success-soft); }
.conf-pill.conf-medium { color: var(--warning-text); border-color: #fedf89; background: var(--warning-soft); }
.conf-pill.conf-low    { color: var(--danger-text);  border-color: #fecdca; background: var(--danger-soft); }

/* ── AI research card ────────────────────────────────────── */
.pill.confidence-high   { color: var(--success-text); border-color: #abefc6; background: var(--success-soft); text-transform: capitalize; }
.pill.confidence-medium { color: var(--warning-text); border-color: #fedf89; background: var(--warning-soft); text-transform: capitalize; }
.pill.confidence-low    { color: var(--danger-text); border-color: #fecdca; background: var(--danger-soft); text-transform: capitalize; }
.research-summary { margin: 0 0 10px; line-height: 1.55; }
.research-est { padding: 10px 12px; border: 1px solid #cfe0fb; background: var(--blue-wash); border-radius: 8px; }
.research-list { margin: 6px 0 0; padding-left: 18px; line-height: 1.5; }
.research-list li { margin-bottom: 4px; }
.ev-src { color: var(--muted-2); font-size: 12px; }

/* Per-brand collapsible dossier inside the research card */
.dossier { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px; background: #fff; }
.dossier > summary { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; user-select: none; list-style: none; }
.dossier > summary::-webkit-details-marker { display: none; }
.dossier > summary::before { content: "▸"; color: var(--muted-2); font-size: 12px; }
.dossier[open] > summary::before { content: "▾"; }
.dossier-body { padding: 4px 14px 14px; border-top: 1px solid var(--border); }
#research-version { padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); font: inherit; font-size: 13px; background: #fff; }

/* Live progress while a research run is in flight */
.research-progress { margin-bottom: 14px; }
.rp-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
.rp-phase { font-weight: 600; font-size: 13px; color: var(--accent-dark); }
.rp-count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rp-bar { height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; }
.rp-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.4s ease; }
.rp-list { list-style: none; margin: 10px 0 0; padding: 0; }
.rp-brand { display: flex; align-items: baseline; gap: 9px; padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.rp-brand:last-child { border-bottom: none; }
.rp-glyph { width: 16px; flex: none; text-align: center; color: var(--muted-2); }
.rp-brand.running .rp-glyph { color: var(--accent); animation: rp-pulse 1.1s ease-in-out infinite; }
.rp-brand.complete .rp-glyph { color: #1a7f52; }
.rp-brand.fallback .rp-glyph { color: var(--amber); }
.rp-name { font-weight: 500; }
.rp-step { margin-left: auto; color: var(--muted); font-size: 12px; text-align: right; }
.rp-brand.pending { color: var(--muted-2); }
@keyframes rp-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* Staff correction notes inside a dossier */
.research-notes { list-style: none; margin: 6px 0 0; padding: 0; }
.research-notes .note { padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; margin-bottom: 6px; }
.research-notes .note-text { line-height: 1.5; white-space: pre-wrap; }
.research-notes .note-meta { color: var(--muted-2); font-size: 12px; margin-top: 4px; display: flex; gap: 8px; align-items: center; }
.note-add { margin-top: 8px; }
.note-input { width: 100%; min-height: 56px; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); font: inherit; font-size: 13px; resize: vertical; box-sizing: border-box; }
.note-add .btn { margin-top: 6px; }
.btn-link { background: none; border: none; padding: 0; color: var(--blue); font: inherit; font-size: 12px; cursor: pointer; }
.btn-link:hover { text-decoration: underline; }

/* Research-history status pills */
.pill.research-complete { color: var(--success-text); border-color: #abefc6; background: var(--success-soft); }
.pill.research-running  { color: var(--info-text); border-color: #b2ddff; background: var(--info-soft); }
.pill.research-running::before { animation: rp-pulse 1.1s ease-in-out infinite; }
.pill.research-error,
.pill.research-stalled  { color: var(--danger-text); border-color: #fecdca; background: var(--danger-soft); }

/* ── Confirm dialog (irreversible / outward-facing actions) ── */
.confirm-modal { z-index: 1100; }
.confirm-dialog { width: min(440px, 100%); max-height: none; }
.confirm-body { padding: 24px 24px 8px; }
.confirm-body h3 { font-size: 16px; margin: 0 0 8px; }
.confirm-body p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.confirm-input-label { display: block; margin: 14px 0 0; font-size: 12px; font-weight: 500; color: var(--muted); }
.confirm-input { width: 100%; min-height: 72px; margin-top: 5px; resize: vertical; }
.confirm-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px 20px; }

/* ── Transcript modal (ported from the quoting project) ───── */
.hidden { display: none !important; }
.modal { position: fixed; inset: 0; background: rgba(17, 24, 39, 0.58); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.modal-dialog { background: #fff; border-radius: 8px; width: min(960px, 100%); max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(17, 24, 39, 0.28); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.modal-header h3 { margin: 0; font-size: 1rem; }
.modal-close { background: none; border: none; font-size: 1.75rem; line-height: 1; color: var(--muted-2); cursor: pointer; padding: 0 0.25rem; }
.modal-close:hover { color: var(--ink); background: none; }
.modal-meta { padding: 0.5rem 1.25rem; border-bottom: 1px solid var(--border); font-size: 0.8125rem; color: var(--muted-2); display: flex; gap: 1.25rem; flex-wrap: wrap; }
.modal-meta strong { color: var(--ink); font-weight: 650; }
.modal-body { padding: 1rem 1.25rem; overflow-y: auto; font-size: 0.875rem; }
.transcript-turn { border: 1px solid var(--border); border-radius: 6px; margin-bottom: 0.75rem; overflow: hidden; }
.transcript-turn-header { padding: 0.375rem 0.75rem; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: #fff; }
.transcript-turn.role-system .transcript-turn-header { background: var(--muted); }
.transcript-turn.role-user .transcript-turn-header { background: var(--info-text); }
.transcript-turn.role-assistant .transcript-turn-header { background: #5925dc; }
.transcript-turn.role-tool .transcript-turn-header { background: var(--success-text); }
.transcript-content,
.transcript-tool-args { padding: 0.625rem 0.75rem; white-space: pre-wrap; word-break: break-word; font-family: var(--code); font-size: 0.8125rem; background: var(--surface-panel); border-top: 1px solid var(--border); max-height: 24rem; overflow-y: auto; }
.transcript-thinking { border-top: 1px dashed var(--border-strong); }
.transcript-thinking summary { padding: 0.375rem 0.75rem; font-size: 0.75rem; color: var(--muted-2); background: var(--surface-panel); cursor: pointer; user-select: none; }
.transcript-thinking pre { margin: 0; padding: 0.625rem 0.75rem; white-space: pre-wrap; word-break: break-word; font-family: var(--code); font-size: 0.8125rem; background: var(--surface-panel); color: var(--muted); max-height: 20rem; overflow-y: auto; }
.transcript-tool-call { padding: 0.375rem 0.75rem; font-size: 0.8125rem; border-top: 1px solid var(--border); background: #fff; }
.transcript-tool-call strong { color: #5925dc; font-family: var(--code); }
