:root {
  /* Acitinar brand: navy #141E29, blue #0046CB, orange #F65703 (from the logo) */
  --brand-navy: #141e29; --brand-blue: #0046cb; --brand-blue-dark: #00369e; --brand-orange: #f65703;
  --bg: #f4f6f9; --panel: #ffffff; --panel-2: #f1f4f8; --border: #e2e7ee; --border-strong: #c9d2dd;
  --text: var(--brand-navy); --muted: #5a6575; --accent: var(--brand-blue); --accent-2: var(--brand-blue-dark);
  --accent-soft: #eaf0fd;
  --ok: #15803d; --warn: #b45309; --bad: #c81e1e; --radius: 12px;
  --ok-bg: #ecfdf3; --ok-border: #a6e3bd; --warn-bg: #fff7e8; --warn-border: #f5c77e;
  --bad-bg: #fdf0f0; --bad-border: #f2b8b8;
  --shadow: 0 1px 2px rgba(20, 30, 41, .05), 0 1px 8px rgba(20, 30, 41, .04);
  --side-w: 268px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }
a { color: var(--brand-blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; line-height: 1.25; margin: 4px 0 16px; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 6px; }
h3 { font-size: 15px; margin: 14px 0 6px; }
.container { max-width: 1320px; margin: 0 auto; padding: 24px 28px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- App frame: side navigation (logged in) ---------- */
body.has-side { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
  background: var(--panel); border-right: 1px solid var(--border); padding: 18px 14px 14px;
  box-shadow: inset 0 3px 0 var(--brand-orange); }
.side-brand { flex-direction: column; align-items: flex-start !important; gap: 6px !important; padding: 4px 8px 16px; }
.side-brand span { border-left: 0 !important; padding-left: 0 !important; font-size: 12px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-group { margin: 14px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #8a94a3; }
.side-link { display: flex; gap: 11px; align-items: flex-start; padding: 9px 10px; border-radius: 10px; color: var(--text); }
.side-link:hover { background: var(--panel-2); text-decoration: none; }
.side-link.active { background: var(--accent-soft); color: var(--brand-blue); box-shadow: inset 3px 0 0 var(--brand-orange); }
.side-link .ico { width: 20px; height: 20px; flex: none; margin-top: 1px; color: var(--muted); }
.side-link.active .ico { color: var(--brand-blue); }
.side-label { display: block; font-weight: 600; font-size: 14px; line-height: 1.3; }
.side-sub { display: block; font-size: 12px; color: var(--muted); line-height: 1.35; font-weight: 400; }
.side-user { display: flex; align-items: center; gap: 10px; margin: 12px 0 0 !important; padding: 12px 8px 4px;
  border-top: 1px solid var(--border); }
.side-user-name { flex: 1; min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-navy); color: #fff; display: inline-flex;
  align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: none; }
.main-col { min-width: 0; display: flex; flex-direction: column; }
.main-col main { flex: 1; width: 100%; }
.mobile-bar { display: none; }
.ico { width: 18px; height: 18px; vertical-align: -4px; }

@media (max-width: 960px) {
  body.has-side { display: block; }
  .mobile-bar { display: flex; position: sticky; top: 0; z-index: 30; align-items: center; justify-content: space-between;
    padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--border); box-shadow: inset 0 3px 0 var(--brand-orange); }
  .mobile-bar .brand img { height: 26px; }
  .sidebar { position: fixed; z-index: 40; left: 0; top: 0; width: min(300px, 86vw); transform: translateX(-102%);
    transition: transform .2s ease; box-shadow: 0 10px 40px rgba(20, 30, 41, .25); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(20, 30, 41, .35); z-index: 35; }
  .container { padding: 16px; }
}

/* Logged-out top bar (login and About) */
.topnav { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--border);
  box-shadow: inset 0 3px 0 var(--brand-orange); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-size: 14px; }
.brand img { height: 30px; width: auto; display: block; }
.brand span { color: var(--muted); font-weight: 500; border-left: 1px solid var(--border); padding-left: 10px; }
.brand:hover { text-decoration: none; }
.topnav nav { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 0; }
.topnav nav a { margin-left: 18px; color: var(--muted); font-weight: 500; padding: 4px 0; border-bottom: 2px solid transparent; }
.topnav nav a.active, .topnav nav a:hover { color: var(--text); text-decoration: none; border-bottom-color: var(--brand-orange); }

/* ---------- Page header, steps ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0 0 4px; }
.lead { margin: 0; color: var(--muted); font-size: 16px; max-width: 760px; }
.page-head-actions { display: flex; align-items: center; gap: 4px; }
.back-link { margin: 0 0 12px; }
.how-steps { list-style: none; padding: 0; margin: 0 0 20px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.how-steps li { display: flex; gap: 10px; align-items: center; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 14px; font-size: 14px; color: var(--muted); }
.how-steps strong { color: var(--text); }
.step-no { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand-navy); color: #fff; font-size: 13px; font-weight: 700; flex: none; }
.card-title { display: flex; align-items: center; gap: 10px; }
.jump-links { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 16px; }
.jump-links a { padding: 5px 12px; border-radius: 999px; background: var(--panel); border: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.jump-links a:hover { color: var(--text); border-color: var(--border-strong); text-decoration: none; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.two-col > .card { margin-bottom: 0; height: 100%; }
.two-col + * { margin-top: 16px; }
.section-block { margin-bottom: 16px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 10px; }
.section-head h2 { margin: 0; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } .how-steps { grid-template-columns: 1fr; } }

/* ---------- Cards, text ---------- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 16px; box-shadow: var(--shadow); }
.hint { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; font-weight: 400; }
.hint-inline { color: var(--muted); font-weight: 400; font-size: 13px; }
.empty { color: var(--muted); padding: 10px 0; }
.mono { font-family: ui-monospace, Consolas, monospace; }

/* ---------- Buttons, inputs ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--panel); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: 9px; padding: 8px 14px; cursor: pointer; font-size: 14px; font-weight: 500; text-decoration: none; line-height: 1.3;
  font-family: inherit; }
.btn:hover { background: var(--panel-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger:hover { background: #a31717; }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--brand-orange); outline-offset: 2px; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn[disabled], .btn.htmx-request { opacity: .6; cursor: wait; }

input[type=text], input[type=password], input[type=number], input[type=search], input[type=date], input[type=url], input[type=email], select {
  background: #fff; color: var(--text); border: 1px solid var(--border-strong); border-radius: 9px;
  padding: 9px 11px; font-size: 14px; width: 100%; font-family: inherit; }
input:focus, select:focus, textarea:focus { border-color: var(--brand-blue); }
input.small { width: 100px; }
input[type=file] { color: var(--muted); font-size: 14px; padding: 10px; border: 1.5px dashed var(--border-strong); border-radius: 10px;
  background: var(--panel-2); width: 100%; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px;
  align-items: end; margin-top: 12px; }
.grid-form label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 14px; }
form.inline { display: inline-flex; gap: 6px; align-items: center; }

/* ---------- Messages ---------- */
.msg { padding: 10px 14px; border-radius: 10px; margin: 10px 0; }
.msg ul { margin: 4px 0 0; padding-left: 20px; }
.extract-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.extract-form input { flex: 1 1 280px; min-width: 0; }
.msg.ok { background: var(--ok-bg); border: 1px solid var(--ok-border); color: #14532d; }
.msg.error { background: var(--bad-bg); border: 1px solid var(--bad-border); color: #8f1414; }
.banner { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 14px; font-weight: 600; }
.banner.warn { background: var(--warn-bg); border: 1px solid var(--warn-border); color: #7a3a04; }
.banner.bad { background: var(--bad-bg); border: 1px solid var(--bad-border); color: #8f1414; }
.banner a { color: inherit; text-decoration: underline; }
/* Results of the dashboard buttons appear as a note in the bottom corner */
.toast-area { position: fixed; right: 20px; bottom: 20px; z-index: 50; max-width: min(440px, calc(100vw - 40px)); }
.toast-area:empty { display: none; }
.toast-area > * { box-shadow: 0 10px 30px rgba(20, 30, 41, .18); margin: 0; background: var(--panel); }
.toast-area > .msg.ok { background: var(--ok-bg); } .toast-area > .msg.error { background: var(--bad-bg); }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; border: 1px solid; white-space: nowrap; font-weight: 500; }
.pill.ok { color: #14632f; border-color: var(--ok-border); background: var(--ok-bg); }
.pill.warn { color: #8a4405; border-color: var(--warn-border); background: var(--warn-bg); }
.pill.bad { color: #9b1717; border-color: var(--bad-border); background: var(--bad-bg); }
.pill.muted { color: var(--muted); border-color: var(--border); background: transparent; }
h1 .pill { vertical-align: middle; font-size: 12px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: 12px; white-space: nowrap; background: var(--panel-2); }
.table thead tr th:first-child { border-top-left-radius: 8px; } .table thead tr th:last-child { border-top-right-radius: 8px; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: #f7f9fc; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .sub { color: var(--muted); font-size: 12px; display: block; }
.actions { white-space: nowrap; }
.actions .btn { margin: 2px 2px; }

.workers-line { margin: 12px 0; }
details.add-key summary { list-style: none; display: inline-flex; }
details.add-key summary::-webkit-details-marker { display: none; }
details.add-key[open] summary { display: none; }

.control-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.control-bar.card { padding: 14px 18px; }
.control-bar .sep { width: 1px; height: 24px; background: var(--border); margin: 0 6px; }

/* ---------- Home: add companies, downloads, controls ---------- */
.seg { display: inline-flex; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; margin: 8px 0 6px; }
.seg-btn { border: 0; background: transparent; padding: 7px 14px; border-radius: 8px; font: inherit; font-size: 14px; font-weight: 500;
  color: var(--muted); cursor: pointer; }
.seg-btn.active { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgba(20, 30, 41, .12); font-weight: 600; }
.seg-panel { padding-top: 4px; }
.dl-list, .action-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; }
.dl-list li, .action-list li { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; padding: 7px 0;
  border-bottom: 1px solid var(--border); }
.dl-list li:last-child, .action-list li:last-child { border-bottom: 0; }
.dl-list .btn, .action-list .btn { min-width: 0; }
.dl-list li.dl-main { padding-bottom: 12px; }
.dl-desc { color: var(--muted); font-size: 13px; flex: 1 1 200px; }
.control-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 8px 28px; }
.control-group h3 { margin: 12px 0 0; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.danger-zone { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px;
  padding: 12px 14px; border: 1px solid var(--bad-border); background: #fffafa; border-radius: 10px; }
.danger-zone strong { color: var(--bad); display: block; }

/* ---------- Progress (live) ---------- */
.progress-hero { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px;
  margin-bottom: 12px; box-shadow: var(--shadow); }
.progress-hero-text { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 10px; color: var(--muted); }
.progress-hero-text strong { color: var(--text); }
.progress-hero-text .hint-inline { margin-left: auto; }
.big-num { font-size: 32px; font-weight: 750; color: var(--text); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.progress-hero progress { height: 10px; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-right: 4px;
  box-shadow: 0 0 0 3px rgba(21, 128, 61, .18); vertical-align: 1px; }
.live-area .tech-only { display: none; }
.live-area.show-tech .tech-only { display: block; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: 13px; font-weight: 600; }
.stat .value { font-size: 26px; font-weight: 700; margin: 4px 0 2px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat .sub { color: var(--muted); font-size: 12.5px; }
.stat.ok .value { color: var(--ok); } .stat.warn .value { color: var(--warn); } .stat.bad .value { color: var(--bad); }
.stat.ok { box-shadow: inset 0 3px 0 var(--ok-border), var(--shadow); }
.stat.bad { box-shadow: inset 0 3px 0 var(--bad-border), var(--shadow); }
.stats-main { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin-bottom: 12px; }
.stats-main .stat .value { font-size: 30px; }
.stats-small { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.stats-small .stat { padding: 10px 14px; box-shadow: none; background: transparent; }
.stats-small .stat .value { font-size: 20px; }

.filters { display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; }
.up { color: var(--ok); } .down { color: var(--bad); }
.kv { display: flex; flex-wrap: wrap; gap: 8px 24px; color: var(--muted); }
.kv strong { color: var(--text); }
progress { width: 100%; height: 6px; accent-color: var(--brand-orange); }

@media (max-width: 720px) {
  h1 { font-size: 22px; }
  .card { padding: 16px; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters input[type=search] { grid-column: 1 / -1; }
  .table.responsive thead { display: none; }
  .table.responsive tr { display: block; border-bottom: 1px solid var(--border); padding: 6px 0; }
  .table.responsive td { display: flex; justify-content: space-between; gap: 12px; border: none; padding: 4px 8px; }
  .table.responsive td::before { content: attr(data-label); color: var(--muted); font-size: 12px; }
  .table.responsive td.num { text-align: right; }
  .progress-hero-text .hint-inline { margin-left: 0; }
}
.yr { color: var(--muted); font-size: 11px; font-weight: normal; margin-left: 4px; }
.about { display: grid; grid-template-columns: 180px 1fr; gap: 8px 16px; margin: 0; }
.about dt { color: var(--muted); }
.about dd { margin: 0; }
@media (max-width: 640px) { .about { grid-template-columns: 1fr; } .about dd { margin-bottom: 8px; } }

/* AI report insights */
.section-title { margin: 20px 0 10px; }
.ai-using { margin: 0 0 10px; }
.insight-cat { margin: 14px 0 4px; font-size: 14px; }
.insight-list { margin: 0 0 8px; padding-left: 18px; }
.insight-list li { margin-bottom: 6px; }
.insight-quote { display: block; color: var(--muted); font-size: 12px; font-style: italic; margin-top: 2px; }

/* Login */
.nav-logout { display: inline-flex; align-items: center; gap: 6px; margin-left: 14px; }
.login-card { max-width: 440px; margin: 48px auto; padding: 28px 30px; }
.login-card .grid-form { grid-template-columns: 1fr; }
.login-card .btn.primary { width: 100%; justify-content: center; padding: 10px 14px; }
code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }

/* Tabs (Manage records, API) */
.tabs { display: flex; gap: 2px; margin-bottom: 16px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab { padding: 9px 14px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--text); border-bottom-color: var(--brand-orange); font-weight: 600; }

/* Manage records */
.action-choice { display: flex; gap: 8px; flex-wrap: wrap; }
.builder-head { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.builder-head h2 { margin: 0; }
.match-toggle { border: 0; padding: 0; margin: 10px 0; display: flex; gap: 16px; flex-wrap: wrap; }
.cond-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.cond-row select, .cond-row input[type=text], .cond-row input[type=number] { width: auto; }
.cond-row .year { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cond-row .year .hint { flex-basis: 100%; }
.num-wrap { display: inline-flex; align-items: center; gap: 6px; }
.parsed { color: var(--muted); font-size: 12px; }
.parsed.bad { color: var(--bad); }
.builder-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.preview-box { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 14px; }
.match-count { font-size: 17px; font-weight: 600; }
.confirm-box { margin-top: 12px; }
.confirm-box .tick { display: block; margin: 8px 0; }
dialog#help-dialog { padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel);
  color: var(--text); max-width: 640px; width: calc(100% - 32px); }
dialog#help-dialog::backdrop { background: rgba(20, 30, 41, .45); }
.dialog-body { padding: 18px 22px; max-height: 80vh; overflow: auto; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; }
.help-text h2 { font-size: 15px; margin: 14px 0 4px; }

/* Help "?" buttons and the shared help pop-up */
.help-dot { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px;
  border-radius: 50%; border: 1px solid var(--border-strong); background: #fff; color: var(--brand-blue); font-size: 11px;
  font-weight: 700; line-height: 1; cursor: pointer; padding: 0; margin-left: 5px; vertical-align: middle; flex: none; }
.help-dot:hover { background: var(--brand-blue); color: #fff; border-color: var(--brand-blue); }
.help-dot.static { cursor: default; margin: 0 2px; width: 16px; height: 16px; font-size: 10px; }
.help-dot.static:hover { background: #fff; color: var(--brand-blue); border-color: var(--border-strong); }
.ctl { display: inline-flex; align-items: center; gap: 2px; }
dialog.help-modal { padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel);
  color: var(--text); max-width: 520px; width: calc(100% - 32px); box-shadow: 0 20px 50px rgba(20, 30, 41, .25); }
dialog.help-modal::backdrop { background: rgba(20, 30, 41, .45); }
dialog.help-modal .dialog-body { border-top: 4px solid var(--brand-orange); }
dialog.help-modal h2 { margin: 0; }
dialog.help-modal ul { padding-left: 20px; }

/* About page */
.about-page { max-width: 860px; margin: 0 auto 16px; padding: 28px 32px; }
.about-logo { height: auto; max-width: 260px; width: 100%; margin: 4px 0 8px; }
.prose { font-size: 16px; line-height: 1.65; }
.prose h2 { font-size: 19px; margin: 26px 0 6px; color: var(--brand-navy); }
.prose table { border-collapse: collapse; width: 100%; margin: 8px 0; }
.prose th, .prose td { border-bottom: 1px solid var(--border); padding: 7px 8px; text-align: left; vertical-align: top; }
.login-logo { display: block; width: 220px; max-width: 100%; height: auto; margin: 0 auto 16px; }
.site-footer { max-width: 1320px; width: 100%; margin: 0 auto; padding: 8px 28px 28px; color: var(--muted); font-size: 12.5px;
  display: flex; gap: 8px; align-items: center; }
.site-footer img { height: 16px; width: 16px; }
@media (max-width: 720px) { .brand span { display: none; } .topnav nav a { margin-left: 12px; } .site-footer { padding: 8px 16px 24px; } }
.grid-form label .lbl { display: inline-flex; align-items: center; gap: 2px; }
.add-row { display: flex; align-items: flex-start; gap: 4px; }
.add-row > .help-dot { order: 2; margin-top: 9px; }
.add-row > details[open] { flex: 1; }
.add-row > details[open] + .help-dot, .add-row:has(details[open]) > .help-dot { display: none; }
.control-bar .help-dot { margin-left: -4px; }

/* API page */
.api-tabs { flex-wrap: nowrap; }
.copy-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.key-value { font-size: 14px; padding: 7px 11px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
  word-break: break-all; }
.new-key { border: 2px solid var(--brand-orange); background: #fff7f1; border-radius: var(--radius); padding: 14px 18px; margin: 8px 0 16px; }
.warn-text { color: #8a3500; margin: 8px 0 0; }
.steps li { margin-bottom: 8px; }
pre.code { background: #0f1722; color: #e6edf3; padding: 12px 14px; border-radius: 8px; overflow-x: auto; font-size: 12.5px;
  line-height: 1.5; margin: 6px 0; white-space: pre; }
.snippets { position: relative; margin: 6px 0 10px; }
.snip-tabs { display: flex; gap: 4px; }
.snip-tab { border: 1px solid var(--border); background: var(--panel-2); border-radius: 6px 6px 0 0; padding: 4px 10px;
  font-size: 12px; cursor: pointer; color: var(--muted); font-family: inherit; }
.snip-tab.active { background: #0f1722; color: #fff; border-color: #0f1722; }
.snip { position: relative; }
.snip pre.code { margin-top: 0; border-top-left-radius: 0; }
.snip .copy-btn { position: absolute; top: 8px; right: 8px; }
.endpoint h3.ep-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 15px; }
.method { font-family: ui-monospace, Consolas, monospace; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; color: #fff; }
.m-get { background: var(--brand-blue); } .m-post { background: var(--brand-orange); }
.ep-summary { color: var(--muted); font-weight: 500; }
.table.params td, .table.params th { font-size: 12.5px; }
.toc a { margin-right: 4px; }
.try-it { margin-top: 10px; }
.try-it > summary { list-style: none; display: inline-flex; }
.try-it > summary::-webkit-details-marker { display: none; }
.try-form textarea, .grid-form textarea { width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px;
  border: 1px solid var(--border-strong); border-radius: 8px; padding: 7px 9px; }
.grid-form label.wide { grid-column: 1 / -1; }
.try-meta { margin: 10px 0 4px; }
.small-text { font-size: 12px; }
.downloads { display: grid; gap: 10px; margin-bottom: 12px; }
.download-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; }
.key-charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px 20px; margin: 8px 0 16px; }
.mini-chart { margin: 0; }
.mini-chart figcaption { margin-bottom: 4px; }
.mini-chart svg { width: 100%; height: 64px; display: block; }
.mini-chart .bar { fill: var(--brand-blue); }
.mini-chart .bar-hit:hover .bar { fill: var(--brand-blue-dark); }
.mini-chart .axis { stroke: var(--border); stroke-width: 1; }
.chart-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
fieldset.events { grid-column: 1 / -1; border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; }
fieldset.events label { display: flex; flex-direction: row; gap: 6px; align-items: center; font-weight: 400; margin: 4px 0; }

/* Run controls above the progress figures (Pause / Resume / Cancel run) */
.run-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px; }
.run-bar.is-paused { border-color: var(--warn-border); background: var(--warn-bg); }
.run-state { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.run-actions { display: inline-flex; flex-wrap: wrap; gap: 8px; }

/* Rename a Companies House key: the label opens a small inline form */
details.rename { display: inline-block; }
details.rename summary { cursor: pointer; list-style: none; font-weight: 600; }
details.rename summary::-webkit-details-marker { display: none; }
.rename-link { font-weight: 400; font-size: 12px; color: var(--accent); margin-left: 6px; }
details.rename[open] .rename-link { display: none; }
details.rename form { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
details.rename input[type=text] { min-width: 0; width: 180px; max-width: 100%; }

/* Directors on the company page */
.director-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.director-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* Time left, under the progress bar */
.eta { margin: 10px 0 0; color: var(--muted); font-size: 14px; }
.eta strong { color: var(--text); }

/* Manage records: quick picks above the rule builder */
.quick-picks { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0 4px; }


/* Buttons inside a stat card (Retry failed on the Failed card) */
.stat-action { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }

/* PDF batches: the AI approval screen */
.approval h3 { margin-top: 22px; }
.filter-results td:first-child { width: 100%; }
.filter-results .total-row td, .cost-compare .total-row td, .cost-compare .total-row th { border-top: 2px solid var(--border-strong); }
.group-list summary { cursor: pointer; }
.group-list[open] summary { margin-bottom: 8px; }
.group-list .table-wrap { max-height: 360px; overflow: auto; }
/* Home: recent results (300 per page) scroll inside the box; the header stays visible. */
.results-scroll { max-height: 70vh; overflow: auto; }
.results-scroll .table thead th { position: sticky; top: 0; z-index: 1; }
.table.compact td, .table.compact th { padding: 5px 8px; font-size: 13px; }
.cost-compare th[scope=row] { text-align: left; font-weight: 600; white-space: nowrap; }
.cost-compare .provider-col { min-width: 180px; }
.cost-compare select { max-width: 100%; }
.warn-text { color: #8a4405; }
.budget-field { display: flex; flex-direction: column; gap: 4px; max-width: 520px; }
.budget-field input[type=number] { max-width: 200px; }
.provider-choice { border: 0; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 8px 22px; }
.provider-choice .radio { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.provider-choice .radio.disabled { color: var(--muted); cursor: not-allowed; font-weight: 400; }
.decision-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.confirm-card { border-color: var(--warn-border); }
.confirm-question { font-size: 16px; }
.waiting-list .num { white-space: nowrap; }

/* PDF batches: Stage 1 progress (batch page panel and a row under each batch on the Batches page) */
.stage-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; margin: 12px 0 4px; }
.stage-steps .step { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; display: flex; flex-direction: column; }
.stage-steps .step .label { color: var(--muted); font-size: 12.5px; }
.stage-steps .step strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.stage-steps .step.ok { border-color: var(--ok-border); background: var(--ok-bg); }
.worker-activity { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.worker-activity li { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.worker-activity progress { margin: 6px 0 2px; }
.batches-list tr.has-progress td { border-bottom: 0; }
.batches-list tr.progress-row td { padding-top: 0; }
.batch-progress progress { height: 8px; }
.batch-progress-text { color: var(--muted); font-size: 13px; margin-top: 4px; }
.batch-progress-text strong { color: var(--text); }

/* Settings: revenue keywords */
.kw-list { list-style: none; padding: 0; margin: 8px 0 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.kw-item { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 11px; border: 1px solid var(--border);
  border-radius: 999px; font-size: 13px; }
.kw-item form { margin: 0; }
.kw-remove { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1;
  padding: 0 6px; border-radius: 999px; }
.kw-remove:hover, .kw-remove:focus-visible { color: var(--bad); background: var(--bad-bg); }
