/* TaxDesk dashboard styles. No external fonts, images or requests. */

:root {
  color-scheme: light dark;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --border: #dbe1ea;
  --border-strong: #bcc6d3;
  --text: #16202c;
  --muted: #566272;
  --accent: #1d4ed8;
  --accent-hover: #1a3fb0;
  --accent-soft: #e5edff;
  --on-accent: #ffffff;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.06);

  --side-bg: #111b2e;
  --side-text: #c9d3e3;
  --side-active: #1f2f4d;
  --side-muted: #8b98ae;

  /* status colours: background / foreground / solid */
  --red-bg: #fde8e8;   --red-fg: #9b1c1c;   --red: #c0362c;
  --amber-bg: #fdf0c8; --amber-fg: #7a4306; --amber: #b7791f;
  --blue-bg: #dbe8ff;  --blue-fg: #1b3f9e;  --blue: #2563eb;
  --green-bg: #d9f5e3; --green-fg: #146235; --green: #1f8a4c;
  --grey-bg: #e6e9ee;  --grey-fg: #3a4553;  --grey: #7b8794;
  --violet-bg: #ece5ff; --violet-fg: #4c2a9e; --violet: #7045d6;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d131d;
    --surface: #151d2b;
    --surface-2: #1a2434;
    --border: #2a364a;
    --border-strong: #3c4b63;
    --text: #e6ebf3;
    --muted: #9eabbd;
    --accent: #7aa2ff;
    --accent-hover: #a3bfff;
    --accent-soft: #1f2d4d;
    --on-accent: #0b1220;
    --shadow: none;

    --side-bg: #0a1019;
    --side-text: #c4cfe0;
    --side-active: #1a2538;
    --side-muted: #7f8ca2;

    --red-bg: #4a1c1c;   --red-fg: #ffc9c4;   --red: #f0776c;
    --amber-bg: #4a3512; --amber-fg: #fbdc9a; --amber: #e0a43c;
    --blue-bg: #1d3358;  --blue-fg: #c0d5ff;  --blue: #6c9bff;
    --green-bg: #17402a; --green-fg: #b5ecc9; --green: #4fc27f;
    --grey-bg: #2c3646;  --grey-fg: #d1d8e3;  --grey: #8a97aa;
    --violet-bg: #35275e; --violet-fg: #d8caff; --violet: #a68cf5;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 14.5px/1.5 var(--font);
  color: var(--text);
  background: var(--bg);
  overflow-wrap: break-word;
}
[hidden] { display: none !important; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; }
h1 { font-size: 1.55rem; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; }
h3 { font-size: 0.95rem; }
p { margin: 0 0 0.6em; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
code, pre, .mono { font-family: var(--mono); font-size: 0.92em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
main:focus { outline: none; }
.sr-only, .skip-link:not(:focus) {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link:focus { position: fixed; top: 8px; left: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 6px; box-shadow: var(--shadow); }
.muted { color: var(--muted); }
.small { font-size: 0.85em; }
.strong { font-weight: 600; }
.neg { color: var(--red); font-weight: 600; }
.pos { color: var(--green); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.grow { flex: 1 1 auto; }
.pre { white-space: pre-wrap; }
.missing { color: var(--red); font-weight: 650; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: var(--side-bg); color: var(--side-text);
  padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px;
}
.sidebar-top { display: flex; flex-direction: column; gap: 10px; padding: 0 8px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.2rem; letter-spacing: -0.01em; }
.brand:hover { color: #fff; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--blue); color: #fff; font-weight: 800; }
.mode-pill { align-self: flex-start; font-size: 0.75rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--amber-bg); color: var(--amber-fg); }
.mode-pill.is-live { background: var(--green-bg); color: var(--green-fg); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  color: var(--side-text); text-decoration: none; padding: 8px 10px; border-radius: 7px; font-weight: 500;
}
.nav a:hover { background: var(--side-active); color: #fff; }
.nav a[aria-current="page"] { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 var(--blue); }
.nav a:focus-visible { outline-color: #9db8ff; }
.nav-badge { min-width: 20px; padding: 0 6px; border-radius: 999px; background: #3b4a66; color: #fff; font-size: 0.74rem; font-weight: 700; text-align: center; line-height: 20px; }
.nav-badge-danger { background: #c0362c; }
.sidebar-foot { margin: auto 8px 0; font-size: 0.78rem; color: var(--side-muted); }
.sidebar-signout { margin: 8px 8px 0; align-self: flex-start; }

.content { padding: 24px clamp(14px, 3vw, 36px) 80px; min-width: 0; max-width: 1480px; width: 100%; }
#app { min-width: 0; }
.loading { color: var(--muted); padding: 24px 0; }
.loading::before { content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 8px; vertical-align: -2px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .loading::before, .spinner { animation-duration: 3s; } }

/* ---------- banners and job tray ---------- */
.banners { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.banners:empty { display: none; }
.banner { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 8px; border: 1px solid; }
.banner > span { flex: 1; min-width: 0; white-space: pre-wrap; }
.banner-error { background: var(--red-bg); color: var(--red-fg); border-color: var(--red); }
.banner-ok { background: var(--green-bg); color: var(--green-fg); border-color: var(--green); }
.banner-info { background: var(--blue-bg); color: var(--blue-fg); border-color: var(--blue); }

.jobs { position: fixed; right: 16px; bottom: 16px; z-index: 30; display: flex; flex-direction: column; gap: 8px; width: min(400px, calc(100vw - 32px)); max-height: 60vh; overflow-y: auto; }
.jobs:empty { display: none; }
.job { background: var(--surface); border: 1px solid var(--border-strong); border-left: 4px solid var(--blue); border-radius: 8px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18); padding: 10px 12px; }
.job[data-status="done"] { border-left-color: var(--green); }
.job[data-status="failed"] { border-left-color: var(--red); }
.job header { display: flex; align-items: center; gap: 8px; }
.job header strong { flex: 1; min-width: 0; }
.job-status { font-size: 0.82rem; color: var(--muted); }
.job-log { margin: 8px 0 0; padding-left: 20px; max-height: 180px; overflow-y: auto; font-size: 0.85rem; color: var(--muted); }
.job-log:empty { display: none; }
.job-error { margin: 6px 0 0; color: var(--red); font-size: 0.88rem; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--border-strong); border-top-color: var(--blue); border-radius: 50%; animation: spin 0.8s linear infinite; }
.job[data-status="done"] .spinner, .job[data-status="failed"] .spinner { animation: none; border-color: var(--green); }
.job[data-status="failed"] .spinner { border-color: var(--red); }

/* ---------- page structure ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px 20px; margin-bottom: 18px; }
.page-head > div:first-child { flex: 1 1 320px; min-width: 0; }
.page-head .sub { color: var(--muted); margin: 4px 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.crumbs { font-size: 0.85rem; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }
.section { margin-top: 22px; }
.section > h2 { margin-bottom: 10px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.section > h2 select { font-size: 0.88rem; font-weight: 500; }
.section > h2 label { font-size: 0.85rem; font-weight: 600; }
.section > h2 .count { font-weight: 500; color: var(--muted); font-size: 0.85rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 16px; min-width: 0; }
.card + .card { margin-top: 14px; }
.card > h2, .card > h3 { margin-bottom: 10px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.grid-2 > .card + .card { margin-top: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 14px; }
.cards > .card + .card { margin-top: 0; }
.empty { color: var(--muted); padding: 18px; text-align: center; border: 1px dashed var(--border-strong); border-radius: 8px; background: var(--surface-2); }

/* ---------- buttons and forms ---------- */
.btn {
  font: inherit; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 13px; border-radius: 7px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  text-decoration: none; line-height: 1.3;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn-danger { color: var(--red-fg); border-color: var(--red); background: var(--red-bg); }
.btn-danger:hover { background: var(--red); color: #fff; border-color: var(--red); }
.btn-sm { padding: 3px 9px; font-size: 0.85rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn.busy::after { content: ""; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; }
.icon-btn { font: inherit; font-size: 1.15rem; line-height: 1; cursor: pointer; background: none; border: 0; color: inherit; padding: 2px 7px; border-radius: 5px; opacity: 0.75; }
.icon-btn:hover { opacity: 1; background: rgba(127, 127, 127, 0.18); }
.link-btn { font: inherit; background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-align: left; text-decoration: underline; text-underline-offset: 2px; }
.link-btn:hover { color: var(--accent-hover); }

label { font-weight: 600; font-size: 0.88rem; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 7px; padding: 6px 9px; max-width: 100%; min-width: 0;
}
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; padding: 0; accent-color: var(--accent); flex: none; }
textarea { width: 100%; min-height: 64px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field input:not([type="checkbox"]), .field select { width: 100%; }
.field .help { font-weight: 400; font-size: 0.8rem; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 12px 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.checks { display: flex; flex-wrap: wrap; gap: 10px 22px; }
fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px 14px; margin: 14px 0 0; min-width: 0; }
legend { font-weight: 650; padding: 0 6px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.field > .seg { align-self: flex-start; }
#new-client, #mark-before-form, #edit-client { margin-bottom: 18px; }
.form-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { font: inherit; font-weight: 600; background: none; border: 0; padding: 6px 14px; cursor: pointer; color: var(--muted); border-right: 1px solid var(--border); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.seg button:focus-visible { outline-offset: -3px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; margin-bottom: 12px; }
.filters .field { min-width: 150px; }
.filters .field.grow { min-width: 220px; }

/* ---------- chips, badges, meters ---------- */
.chip { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 0.78rem; font-weight: 650; white-space: nowrap; line-height: 1.6; }
.chip-red { background: var(--red-bg); color: var(--red-fg); }
.chip-amber { background: var(--amber-bg); color: var(--amber-fg); }
.chip-blue { background: var(--blue-bg); color: var(--blue-fg); }
.chip-green { background: var(--green-bg); color: var(--green-fg); }
.chip-grey { background: var(--grey-bg); color: var(--grey-fg); }
.chip-violet { background: var(--violet-bg); color: var(--violet-fg); }
.flag { display: inline-block; min-width: 30px; text-align: center; padding: 1px 6px; border-radius: 5px; font-size: 0.75rem; font-weight: 800; letter-spacing: 0.04em; background: var(--grey-bg); color: var(--grey-fg); }
.tier { display: inline-block; padding: 0 8px; border-radius: 5px; font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; border: 1px solid; line-height: 1.6; }
.tier-offline, .tier-other { color: var(--grey-fg); background: var(--grey-bg); border-color: var(--grey); }
.tier-fast { color: var(--green-fg); background: var(--green-bg); border-color: var(--green); }
.tier-balanced { color: var(--blue-fg); background: var(--blue-bg); border-color: var(--blue); }
.tier-expert { color: var(--violet-fg); background: var(--violet-bg); border-color: var(--violet); }
.meter { position: relative; height: 8px; border-radius: 99px; background: var(--grey-bg); overflow: hidden; min-width: 70px; flex: 1; }
.meter-fill { display: block; height: 100%; border-radius: 99px; background: var(--blue); }
.meter-green .meter-fill { background: var(--green); }
.meter-amber .meter-fill { background: var(--amber); }
.meter-red .meter-fill { background: var(--red); }
.meter-violet .meter-fill { background: var(--violet); }
.meter-row { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.meter-row .pct { font-variant-numeric: tabular-nums; font-size: 0.85rem; min-width: 38px; text-align: right; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; max-width: 100%; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); container-type: inline-size; }
.table-wrap:focus-visible { outline-offset: -2px; }
.card .table-wrap { box-shadow: none; }
table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
th, td { padding: 8px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); background: var(--surface-2); font-weight: 650; white-space: nowrap; position: sticky; top: 0; }
th.num { text-align: right; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr[data-href]:hover { background: var(--accent-soft); cursor: pointer; }
tr.detail-row > td { background: var(--surface-2); padding: 12px 16px; }
/* keep expanded details inside the visible width when the table itself scrolls sideways */
tr.detail-row > td > * { position: sticky; left: 14px; width: min(100%, calc(100vw - 76px)); width: min(100%, calc(100cqi - 32px)); }
tr.row-warn > td:first-child { box-shadow: inset 3px 0 0 var(--amber); }
tr.row-bad > td:first-child { box-shadow: inset 3px 0 0 var(--red); }
td.val { text-align: right; overflow-wrap: anywhere; max-width: 420px; }
td.val.nowrap-num { white-space: nowrap; }
td .sub { display: block; color: var(--muted); font-size: 0.82rem; }
td.wrap-narrow { min-width: 180px; }
td.actions-cell { min-width: 222px; }
td select { max-width: 210px; }

/* ---------- KPI tiles ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 12px; }
.kpi { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; text-decoration: none; color: var(--text); box-shadow: var(--shadow); border-top: 3px solid var(--grey); }
a.kpi:hover { border-color: var(--accent); color: var(--text); }
.kpi-value { display: block; font-size: 1.9rem; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi-label { display: block; font-size: 0.84rem; color: var(--muted); font-weight: 600; }
.kpi-red { border-top-color: var(--red); } .kpi-red .kpi-value { color: var(--red); }
.kpi-amber { border-top-color: var(--amber); }
.kpi-blue { border-top-color: var(--blue); }
.kpi-green { border-top-color: var(--green); }

@media (min-width: 1000px) {
  .kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- mode banner ---------- */
.mode-banner { display: flex; flex-wrap: wrap; gap: 6px 24px; align-items: center; padding: 12px 16px; border-radius: 10px; border: 1px solid var(--amber); background: var(--amber-bg); color: var(--amber-fg); margin-bottom: 18px; }
.mode-banner.is-live { border-color: var(--green); background: var(--green-bg); color: var(--green-fg); }
.mode-banner .mb-main { flex: 1 1 380px; min-width: 0; }
.mode-banner .mb-side { flex: 1 1 280px; font-size: 0.88rem; min-width: 0; }
.mode-banner p { margin: 0; }
.mode-banner code { background: rgba(127, 127, 127, 0.2); padding: 0 4px; border-radius: 4px; }

/* ---------- feed ---------- */
.feed { list-style: none; margin: 0; padding: 0; }
.feed-item { padding: 9px 0 9px 12px; border-bottom: 1px solid var(--border); border-left: 3px solid transparent; }
.feed-item:last-child { border-bottom: 0; }
.feed-item.lvl-warn { border-left-color: var(--amber); }
.feed-item.lvl-error { border-left-color: var(--red); }
.feed-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.feed-action { color: var(--muted); }
.feed-detail { margin-top: 2px; color: var(--text); font-size: 0.9rem; white-space: pre-wrap; }
.feed-detail summary { cursor: pointer; list-style: none; font-weight: 400; }
.feed-detail summary::-webkit-details-marker { display: none; }
.feed-detail summary::after { content: " more"; color: var(--accent); font-size: 0.82rem; }
.feed-detail[open] summary { display: none; }

/* ---------- key/value lists ---------- */
dl.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 5px 18px; margin: 0; align-content: start; }
dl.kv dt { color: var(--muted); font-weight: 600; font-size: 0.88rem; }
dl.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
dl.kv dd.mono { white-space: normal; }
.kv-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 4px 36px; }
.kv-cols dl.kv { grid-template-columns: minmax(110px, 40%) minmax(0, 1fr); }

/* ---------- dropzone ---------- */
.dropzone { border: 2px dashed var(--border-strong); border-radius: 10px; padding: 18px; text-align: center; background: var(--surface-2); transition: background 0.15s, border-color 0.15s; }
.dropzone.dragging { border-color: var(--accent); background: var(--accent-soft); }
.dropzone:focus-within { border-color: var(--accent); }
.upload-list { list-style: none; margin: 10px 0 0; padding: 0; text-align: left; font-size: 0.88rem; }
.upload-list li { display: flex; gap: 10px; padding: 3px 0; }
.upload-list .fname { flex: 1; min-width: 0; }

/* ---------- details / extracted data ---------- */
details > summary { cursor: pointer; font-weight: 600; }
.trace { margin: 8px 0 0; padding-left: 22px; color: var(--muted); font-size: 0.9rem; }
.pre-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--font); max-height: 340px; overflow: auto; margin: 0; }
.pre-json { font-family: var(--mono); font-size: 0.82rem; line-height: 1.45; }
.req-details { margin-top: 10px; }
.req-details > summary { font-size: 0.9rem; }
.req-details .pre-box { margin-top: 4px; background: var(--surface); }
.hmrc-result { margin-top: 18px; }
.hmrc-result > h3 { margin-bottom: 8px; }
.hmrc-result td { vertical-align: middle; }
.narrow-only { display: none; margin-top: 3px; }
.extract-mini { margin-top: 6px; }
.extract-mini table { font-size: 0.84rem; }
.extract-mini th { position: static; }

/* ---------- obligation / filing ---------- */
.check-list { list-style: none; margin: 0; padding: 0; }
.check-list li { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 4px 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.check-list li:last-child { border-bottom: 0; }
.check-list .res { font-weight: 700; font-size: 0.85rem; }
.check-list .res.ok { color: var(--green); }
.check-list .res.bad { color: var(--red); }
.copy-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 14px 0 6px; }
.findings { list-style: none; padding: 0; margin: 8px 0 0; }
.findings li { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 4px 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.findings li:last-child { border-bottom: 0; }
.notice { border: 1px solid; border-radius: 8px; padding: 9px 12px; margin: 10px 0; }
.notice-amber { background: var(--amber-bg); color: var(--amber-fg); border-color: var(--amber); }
.notice-red { background: var(--red-bg); color: var(--red-fg); border-color: var(--red); }
.notice-green { background: var(--green-bg); color: var(--green-fg); border-color: var(--green); }
.notice-blue { background: var(--blue-bg); color: var(--blue-fg); border-color: var(--blue); }
.notice-grey { background: var(--grey-bg); color: var(--grey-fg); border-color: var(--grey); }
.notice ul { margin: 4px 0 0; padding-left: 20px; }
.notice code { background: rgba(127, 127, 127, 0.2); padding: 0 4px; border-radius: 4px; overflow-wrap: anywhere; }
.notice a { color: inherit; }
.pack-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.pack-block { margin-top: 18px; }
.pack-block > h3 { margin-bottom: 8px; }
.outputs { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.outputs a { display: inline-flex; gap: 8px; align-items: center; padding: 6px 11px; border: 1px solid var(--border-strong); border-radius: 7px; text-decoration: none; background: var(--surface); }
.outputs a:hover { background: var(--accent-soft); }
.step-list { display: grid; gap: 14px; }
.rule-detail { display: grid; gap: 14px; }
.rule-detail ul { margin: 4px 0 0; padding-left: 20px; }

/* ---------- charts ---------- */
.bars { display: grid; gap: 7px; margin: 0 0 12px; padding: 0; list-style: none; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 32%) minmax(0, 1fr) 74px; gap: 10px; align-items: center; font-size: 0.88rem; }
.bar-row .bar-label { overflow-wrap: anywhere; }
.bar-row .num { text-align: right; }
td .mono { white-space: nowrap; }
.bar-track { height: 14px; background: var(--grey-bg); border-radius: 4px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--blue); border-radius: 4px; min-width: 2px; }
.bar-fill.tier-fast { background: var(--green); }
.bar-fill.tier-balanced { background: var(--blue); }
.bar-fill.tier-expert { background: var(--violet); }
.bar-fill.alt { background: var(--amber); }
.tiles-2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 12px; margin-bottom: 14px; }
.meter-block { margin-bottom: 14px; }
.meter-block .meter { height: 12px; }
.meter-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 4px; flex-wrap: wrap; }
.routing { margin: 0; padding-left: 20px; }
.routing li { margin-bottom: 6px; }

/* ---------- law watch ---------- */
.lw-item { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; box-shadow: var(--shadow); }
.lw-item + .lw-item { margin-top: 10px; }
.lw-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-bottom: 4px; }
.lw-title { font-weight: 650; flex: 1 1 300px; }
.lw-meta { color: var(--muted); font-size: 0.85rem; display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 6px; }
.lw-proposal { margin-top: 8px; padding: 8px 12px; border-left: 3px solid var(--violet); background: var(--surface-2); border-radius: 0 6px 6px 0; white-space: pre-wrap; }
.lw-foot { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; margin-top: 10px; }
.chip-links { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.chip-links a { text-decoration: none; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .shell { display: block; }
  .sidebar { position: sticky; top: 0; z-index: 40; height: auto; flex-direction: column; gap: 4px; padding: 8px 10px 6px; overflow: visible; }
  .sidebar-top { flex-direction: row; align-items: center; justify-content: space-between; padding: 0 2px; }
  .brand { font-size: 1.05rem; }
  .brand-mark { width: 26px; height: 26px; }
  .nav { flex-direction: row; overflow-x: auto; gap: 2px; padding-bottom: 4px; scrollbar-width: thin; }
  .nav a { white-space: nowrap; padding: 6px 10px; }
  .nav a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--blue); }
  .sidebar-foot { display: none; }
  .content { padding: 16px 14px 90px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  h1 { font-size: 1.3rem; }
  dl.kv { grid-template-columns: minmax(0, 1fr); gap: 0; }
  dl.kv dt { margin-top: 6px; }
  .kv-cols dl.kv { grid-template-columns: minmax(0, 1fr); }
  .bar-row { grid-template-columns: minmax(0, 1fr) 74px; }
  .bar-row .bar-track { grid-column: 1 / -1; grid-row: 2; }
  .jobs { right: 8px; left: 8px; bottom: 8px; width: auto; }
  .narrow-only { display: block; } /* repeats a verdict that sits in a column off-screen */
}

@media print { .sidebar, .jobs, .banners, .actions { display: none; } .shell { display: block; } }

/* ---------- HMRC declaration ---------- */
.declaration { margin: 0 0 12px; }
.declaration .check { align-items: flex-start; margin-top: 6px; font-weight: 500; }
.declaration input[type="checkbox"] { margin-top: 3px; }

/* online store and payment processor rows */
.channel { border-top: 1px solid var(--border); padding: 12px 0; }
.channel-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.channel-head .mono { overflow-wrap: anywhere; }
.add-another { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 4px; }
.add-another > summary { cursor: pointer; color: var(--muted, inherit); font-size: 0.9em; }
.add-another[open] > summary { margin-bottom: 8px; }
.channel .btn-danger { margin-left: auto; }
#sales-panel h3 { margin-top: 16px; }
