/* OneClic scraper dashboard. Dark emerald sidebar, light main area, emerald primary actions.
   Colour is kept for status, data and the primary action. One radius family: 10 cards, 8 controls, 6 chips. */

:root {
  --ground: #f7f9f8;
  --surface: #ffffff;
  --raised: #f2f6f4;
  --border: #e5e9e7;
  --rule: #eef2f0;
  --control: #cdd7d2;
  --text: #15201b;
  --muted: #56635d;
  --faint: #66716b;
  --emerald: #047857;
  --emerald-hover: #065f46;
  --emerald-line: #03573f;
  --emerald-tint: #e8f5ef;
  --side: #064e3b;
  --positive-bg: #dcfae5; --positive-ink: #04250e;
  --warning-bg: #fffbeb; --warning-ink: #92400e; --warning-line: #fde68a;
  --negative-bg: #ffedea; --negative-ink: #831c1e; --negative-line: #f5c2bb;
  --info-bg: #e7eefb; --info-ink: #1e3a5f;
  --neutral-bg: #eef2f0; --neutral-ink: #33403a;
  --r-card: 10px; --r-control: 8px; --r-chip: 6px;
  --shadow-primary: 0 1px 2px rgba(2, 44, 34, .28), 0 2px 6px rgba(2, 44, 34, .14);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 20px;
  color: var(--text);
  background: var(--ground);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: 22px; line-height: 28px; letter-spacing: -0.01em; }
h2 { font-size: 16px; line-height: 22px; }
h3 { font-size: 13px; line-height: 18px; color: var(--muted); margin-bottom: 8px; }
p { margin: 0; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--emerald); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-size: 12px; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- shell ---------- */
.frame { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.sched-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 16px; align-items: start; }
.sched-grid .form-card { max-width: none; margin-top: 0; }
.sched-grid > .card { margin-top: 0; }
.sidebar {
  /* A grid item stretches to the row height, so the dark column always spans the whole page. */
  align-self: stretch; min-height: 100vh;
  background: var(--side); color: #fff;
  display: flex; flex-direction: column; padding: 20px 14px 16px;
  box-shadow: 2px 0 8px -2px rgba(2, 22, 16, .18);
  z-index: 2;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; text-decoration: none; color: #fff; }
.brand .mark { width: 28px; height: 28px; flex: none; }
.brand strong { display: block; font-size: 15px; font-weight: 600; line-height: 18px; }
.brand small { display: block; font-size: 12px; color: rgba(255, 255, 255, .72); line-height: 16px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; min-height: 36px; padding: 0 12px;
  border-radius: var(--r-control); text-decoration: none;
  color: rgba(255, 255, 255, .78); font-weight: 500;
}
.nav a:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.nav a[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, .15); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding: 0 8px; }
.runstate { display: flex; flex-direction: column; gap: 4px; font-size: 12px; line-height: 16px; color: rgba(255, 255, 255, .85); }
.runstate strong { font-weight: 600; color: #fff; }
.runstate .bar { display: block; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .18); overflow: hidden; }
.runstate .bar span { display: block; height: 100%; background: #6ee7b7; }
.keys { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: rgba(255, 255, 255, .62); }
.keys span { display: flex; align-items: center; gap: 6px; }
.keys .dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, .3); }
.keys .on { color: rgba(255, 255, 255, .85); }
.keys .on .dot { background: #6ee7b7; }

.main { padding: 32px 40px 72px; min-width: 0; max-width: 1240px; width: 100%; }
.main:focus { outline: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { margin-top: 4px; color: var(--muted); font-size: 14px; line-height: 20px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- cards and notes ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: 20px; }
.card + .card, .card + .step-card, .step-card + .card, .kpis + .step-card { margin-top: 16px; }
.card h2 { margin-bottom: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.note { color: var(--muted); font-size: 13px; line-height: 19px; margin-top: 12px; }
.note.warn, .warn { color: var(--warning-ink); background: var(--warning-bg); border: 1px solid var(--warning-line); border-radius: var(--r-control); padding: 8px 12px; }
.note.warn { margin: 0 0 16px; }
.sentence { font-size: 15px; line-height: 22px; }
.estimate { color: var(--muted); font-size: 13px; margin: 12px 0 0; min-height: 19px; }
.field-label { font-size: 13px; color: var(--muted); margin: 18px 0 8px; }
.form-card { max-width: 760px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 4px; }
.form-foot { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.form-foot .btn:first-child:last-child { margin-left: auto; }
.max-field { max-width: 200px; margin-top: 18px; }

/* ---------- fields and controls ---------- */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.field > span { color: var(--text); font-weight: 500; }
.input {
  height: 36px; padding: 0 12px; border: 1px solid var(--control); border-radius: var(--r-control);
  background: #fff; color: var(--text); min-width: 0; width: 100%;
}
.input::placeholder { color: var(--faint); }
.input.small { height: 30px; font-size: 13px; padding: 0 8px; width: auto; }
.input.num { font-variant-numeric: tabular-nums; }
.input:focus { outline: 2px solid var(--emerald); outline-offset: 0; border-color: transparent; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 0 14px; border-radius: var(--r-control);
  border: 1px solid var(--control); background: #fff; color: var(--text);
  font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--raised); }
.btn.small { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn.primary { background: var(--emerald); border-color: var(--emerald-line); color: #fff; box-shadow: var(--shadow-primary); }
.btn.primary:hover { background: var(--emerald-hover); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--muted); }
.btn.quiet:hover { background: var(--raised); color: var(--text); }
.btn.danger { color: var(--negative-ink); border-color: var(--negative-line); }
.btn.danger:hover { background: var(--negative-bg); }
.btn:disabled, .btn.disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn:focus-visible { outline: 2px solid var(--emerald); outline-offset: 2px; }
.text-link { border: 0; background: none; padding: 0; color: var(--emerald-hover); text-decoration: underline; cursor: pointer; font: inherit; }
.btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; min-height: 28px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--emerald); margin: 0; }
.check input:disabled + * , .check input:disabled { opacity: .5; }

/* switch (All regions) */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 36px; height: 20px; border-radius: 999px; background: var(--control); position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + .track { background: var(--emerald); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--emerald); outline-offset: 2px; }

/* region picker */
.picker { display: flex; flex-direction: column; gap: 12px; }
.picker-body { display: flex; flex-direction: column; gap: 10px; }
.picker-body[hidden] { display: none; }
.tree { max-height: 320px; overflow: auto; border: 1px solid var(--border); border-radius: var(--r-control); background: #fff; }
.tree details { border-top: 1px solid var(--rule); }
.tree details:first-child { border-top: 0; }
.tree summary {
  display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; cursor: pointer; list-style: none;
  font-weight: 500;
}
.tree summary::-webkit-details-marker { display: none; }
.tree summary::after { content: "›"; color: var(--faint); margin-left: 8px; transform: rotate(90deg); display: inline-block; }
.tree details[open] summary::after { transform: rotate(270deg); }
.tree summary .n { color: var(--muted); font-weight: 400; font-size: 13px; }
.tree .cities { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 2px 12px; padding: 4px 12px 12px 24px; }
.tree .cities .check:first-child { grid-column: 1 / -1; font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips .note { margin: 0; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: var(--r-chip); background: var(--emerald-tint); color: var(--emerald-hover); font-size: 13px; }
.chip-x { border: 0; background: transparent; color: inherit; width: 22px; height: 22px; border-radius: 4px; cursor: pointer; font-size: 15px; line-height: 1; }
.chip-x:hover { background: rgba(4, 120, 87, .12); }

/* ---------- live run ---------- */
.live { display: flex; flex-direction: column; gap: 18px; max-width: 760px; }
.stepper { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.stepper li { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--raised); color: var(--muted); font-weight: 500; }
.stepper li .step-n { background: #fff; color: var(--muted); border: 1px solid var(--control); }
.stepper li.done { color: var(--text); }
.stepper li.done .step-n { background: var(--positive-bg); color: var(--positive-ink); border-color: transparent; }
.stepper li.current { background: var(--emerald-tint); color: var(--emerald-hover); }
.stepper li.current .step-n { background: var(--emerald); color: #fff; border-color: transparent; }
.progress { height: 8px; border-radius: 999px; background: var(--raised); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--emerald); border-radius: 999px; transition: width .4s ease; }
.live-foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.live-foot .now { color: var(--text); }
.live .note { margin-top: 0; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 2fr) minmax(0, 1fr); gap: 16px; }
.kpi-group { min-width: 0; }
.kpi-cap { font-size: 13px; color: var(--muted); font-weight: 500; margin: 0 0 8px 2px; }
.kpi-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.kpi-group:last-child .kpi-pair { grid-template-columns: 1fr; }
.kpi {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
  padding: 14px 16px; min-width: 0; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card);
}
.kpi:hover { border-color: var(--control); }
.kpi.on { border: 1.5px solid var(--emerald); padding: 13.5px 15.5px; }
.kpi-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi-value { font-size: 26px; line-height: 32px; font-weight: 600; letter-spacing: -0.01em; }
.kpi-hint { font-size: 12px; line-height: 16px; color: var(--faint); }

/* ---------- next steps ---------- */
.step-card {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card);
  margin-top: 16px;
}
.step { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px 18px; min-width: 0; }
.step + .step { border-left: 1px solid var(--rule); }
.step-n {
  display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; flex: none;
  border-radius: 50%; background: var(--raised); color: var(--muted); font-size: 12px; font-weight: 600;
}
.step-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.step-text strong { font-weight: 600; }
.step-text .muted { font-size: 13px; line-height: 18px; }
.step > .btn { margin-top: auto; }
.step > a.btn, .step > .btn { align-self: flex-start; }
.step > .step-n { margin-bottom: -2px; }
.step > .step-n + .step-text { margin-top: 0; }
.step input[type="file"] { display: none; }
#import-panel:empty { display: none; }
.import-card { margin-top: 16px; }
.report .kv { margin-top: 0; }

/* ---------- definition lists ---------- */
.kv { display: grid; grid-template-columns: max-content max-content; gap: 6px 24px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 500; }
.fields { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; margin: 0; }
.fields dt { color: var(--muted); font-size: 13px; padding-top: 1px; }
.fields dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.fields .src { display: block; color: var(--faint); font-size: 12px; }
.fields a { color: var(--emerald-hover); }

/* ---------- table ---------- */
.table-card { padding: 0; overflow: hidden; }
.table-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; flex-wrap: wrap; border-bottom: 1px solid var(--rule); }
.table-tools .filter { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; }
.table-tools .search { width: 280px; max-width: 100%; }
.table-wrap { overflow-x: auto; position: relative; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
  text-align: left; font-weight: 500; font-size: 13px; color: var(--muted);
  padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface);
}
table.data td { padding: 12px 14px; border-top: 1px solid var(--rule); vertical-align: middle; }
table.data tbody tr:first-child td { border-top: 0; }
table.data tr.row { cursor: pointer; }
table.data tr.row:hover td { background: #fafcfb; }
table.data tr.row.open td { background: var(--emerald-tint); }
table.data tr.row:focus-visible { outline: 2px solid var(--emerald); outline-offset: -2px; }
table.data tr.detail td { background: #fafcfb; border-top: 1px solid var(--border); padding: 16px 18px 14px; }
table.data.compact th, table.data.compact td { padding: 8px 10px; }
.c-num { text-align: right !important; white-space: nowrap; }
.c-status { white-space: nowrap; }
.c-act { text-align: right; white-space: nowrap; width: 1%; }
.c-contact { white-space: nowrap; }
.c-contact .chk { display: inline-flex; align-items: center; gap: 4px; margin-right: 10px; font-size: 12px; color: var(--faint); }
.c-contact .chk.yes { color: var(--text); }
.c-contact .ico { width: 12px; height: 12px; stroke: var(--emerald); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.c-contact .dash { color: var(--faint); }
.c-practice { min-width: 220px; }
.c-needs { min-width: 200px; }
.line1 { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 360px; }
.line2 { display: block; font-size: 12px; line-height: 16px; color: var(--muted); margin-top: 2px; }
td.two { min-width: 0; }
td.two .line1 { white-space: normal; }
.decide { display: flex; gap: 6px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.decide .input.small { max-width: 200px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; }
.detail-grid .note { margin-top: 8px; }
.detail-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--rule); flex-wrap: wrap; }
.detail-foot .muted { font-size: 13px; }
.skeleton { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.skel-row { display: block; height: 14px; border-radius: 4px; background: var(--raised); width: 100%; }
.skel-row:nth-child(2n) { width: 70%; }
.pager { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--rule); font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.pager .spacer { flex: 1; }
.pager .size { display: inline-flex; align-items: center; gap: 8px; }
.pager .range { color: var(--text); font-weight: 500; }
.pill {
  display: inline-flex; align-items: center; padding: 2px 10px; border: 1px solid transparent; border-radius: 999px; min-height: 22px;
  font-size: 12px; font-weight: 500; background: var(--neutral-bg); color: var(--neutral-ink); white-space: nowrap; flex: none;
}
.pill.positive { background: var(--positive-bg); color: var(--positive-ink); }
.pill.warning { background: var(--warning-bg); color: var(--warning-ink); border-color: var(--warning-line); }
.pill.negative { background: var(--negative-bg); color: var(--negative-ink); }
.pill.info { background: var(--info-bg); color: var(--info-ink); }

/* states */
.state { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 24px; margin: 0; color: var(--muted); }
.state strong { color: var(--text); font-weight: 500; }
.state.error strong { color: var(--negative-ink); }
.state .btn { margin-top: 8px; }

/* ---------- dialog and toast ---------- */
.dialog-backdrop { position: fixed; inset: 0; background: rgba(6, 30, 22, .32); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 20; }
.dialog-backdrop[hidden] { display: none; }
.dialog { background: #fff; border-radius: var(--r-card); padding: 22px; width: min(440px, 100%); box-shadow: 0 12px 32px rgba(2, 22, 16, .22); border: 1px solid var(--border); }
.dialog h2 { margin-bottom: 8px; }
.dialog p { color: var(--muted); }
.dialog .field { margin-top: 14px; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 30;
  background: var(--side); color: #fff; padding: 10px 16px; border-radius: var(--r-control);
  box-shadow: 0 8px 20px rgba(2, 22, 16, .25); max-width: calc(100% - 32px); font-size: 14px;
}
.toast[hidden] { display: none; }

/* ---------- phone and tablet ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi-group:last-child { grid-column: 1 / -1; }
  .step-card { grid-template-columns: 1fr 1fr; }
  .step:nth-child(3) { border-left: 0; }
  .step:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .detail-grid { grid-template-columns: 1fr; }
  .sched-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .frame { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: sticky; top: 0; height: auto; min-height: 0; flex-direction: row; align-items: center; flex-wrap: wrap;
    padding: 10px 16px; gap: 12px; box-shadow: 0 4px 12px -6px rgba(2, 22, 16, .45);
  }
  .brand { padding: 0; }
  .brand small { display: none; }
  .nav { flex-direction: row; gap: 4px; margin-left: auto; }
  .nav a { min-height: 34px; padding: 0 10px; }
  .side-foot { display: none; }
  .main { padding: 24px 24px 56px; }
}
@media (max-width: 640px) {
  .main { padding: 20px 16px 56px; }
  .sidebar { padding: 10px 12px; }
  .nav a { font-size: 13px; }
  .page-head h1 { font-size: 20px; }
  .card { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr; gap: 12px; }
  .kpi-group:last-child { grid-column: auto; }
  .kpi-pair { grid-template-columns: 1fr 1fr; }
  .kpi-value { font-size: 22px; }
  .step-card { grid-template-columns: 1fr; }
  .step + .step { border-left: 0; border-top: 1px solid var(--rule); }
  .step:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .table-tools .search { width: 100%; }
  .btn { min-height: 40px; }
  .btn.small { min-height: 36px; }
  .input { height: 40px; }
  /* Tables become lists of two-line rows: the practice, then the rest in a grid. */
  .rows-table thead { display: none; }
  .rows-table, .rows-table tbody { display: block; width: 100%; }
  .rows-table tr { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 12px 14px; border-top: 1px solid var(--rule); }
  .rows-table tr.row { cursor: pointer; }
  .rows-table td { border: 0; padding: 0; background: none !important; white-space: normal; min-width: 0; }
  .rows-table td.c-practice { grid-column: 1 / -1; min-width: 0; }
  .rows-table td.c-status { grid-column: 2; grid-row: 1; justify-self: end; }
  .rows-table td.c-practice { grid-row: 1; grid-column: 1; }
  .rows-table td.c-needs { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
  .rows-table td.c-contact { grid-column: 1 / -1; }
  .rows-table td.c-num, .rows-table td.c-act { text-align: left !important; font-size: 13px; color: var(--muted); }
  .rows-table td.c-num::before, .rows-table td.c-num[data-label]::before { content: attr(data-label) ": "; }
  .rows-table td.c-act { grid-column: 1 / -1; width: auto; }
  .rows-table td.c-act:empty { display: none; }
  .decide { justify-content: flex-start; }
  .rows-table tr.detail { display: block; padding: 0; }
  .rows-table tr.detail td { display: block; padding: 14px; }
  .c-practice .line1 { max-width: 100%; white-space: normal; }
  .pager .size { display: none; }
  .fields { grid-template-columns: 1fr; gap: 2px 0; }
  .fields dt { margin-top: 8px; }
  .kv { grid-template-columns: 1fr auto; }
  .stepper { gap: 6px; }
  .stepper li { padding: 4px 10px 4px 4px; font-size: 13px; }
}

/* ===== Quick pass (2026-11-25): darker green, pill buttons, centred layout, softer cards (flair-inspired) ===== */
:root {
  --side: #022c22;            /* deep emerald sidebar */
  --emerald: #065f46;         /* primary */
  --emerald-hover: #064e3b;
  --emerald-line: #054d39;
  --emerald-tint: #e7f3ee;
  --ground: #f4f7f5;
  --border: #e2eae6;
  --r-card: 20px; --r-control: 12px; --r-chip: 999px;
  --shadow-card: 0 1px 2px rgba(2, 44, 34, .04), 0 10px 28px -14px rgba(2, 44, 34, .16);
  --shadow-primary: 0 8px 18px -8px rgba(2, 44, 34, .55), 0 1px 2px rgba(2, 44, 34, .25);
}
h1 { font-size: 28px; line-height: 34px; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 17px; line-height: 24px; font-weight: 600; }

/* Sidebar: wider, bigger type, icons, clear active state */
.frame { grid-template-columns: 264px minmax(0, 1fr); }
.sidebar { padding: 28px 16px 20px; box-shadow: 4px 0 24px -8px rgba(1, 20, 15, .45); }
.brand { padding: 0 10px 32px; gap: 12px; }
.brand .mark { width: 36px; height: 36px; }
.brand strong { font-size: 18px; line-height: 22px; font-weight: 700; }
.brand small { font-size: 13px; }
.nav { gap: 6px; }
.nav a { position: relative; min-height: 48px; padding: 0 14px; gap: 12px; border-radius: 14px; font-size: 15.5px; font-weight: 600; color: rgba(255, 255, 255, .72); }
.nav a .ico { width: 21px; height: 21px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav a[aria-current="page"] { background: rgba(255, 255, 255, .14); color: #fff; }
.nav a[aria-current="page"]::before { content: ""; position: absolute; left: -16px; top: 12px; bottom: 12px; width: 4px; border-radius: 0 4px 4px 0; background: #6ee7b7; }
.side-foot { padding: 0 10px; }

/* Content: one centred column */
.main { justify-self: center; width: 100%; max-width: 1180px; padding: 44px clamp(24px, 4vw, 56px) 80px; }
.page-head { margin-bottom: 28px; align-items: center; }
.page-head .sub { margin-top: 6px; font-size: 15px; }
/* Pages built around one form (new scrape, live run) sit centred, title included */
.main:has(> .form-card), .main:has(> .live) { max-width: 820px; }
.main:has(> .form-card) .page-head, .main:has(> .live) .page-head { justify-content: center; text-align: center; }
.form-card, .live { max-width: none; margin-left: auto; margin-right: auto; }

/* Cards */
.card { border-radius: var(--r-card); border-color: var(--border); box-shadow: var(--shadow-card); padding: 28px; }
.card + .card, .card + .step-card, .step-card + .card, .kpis + .step-card { margin-top: 20px; }
.table-card { padding: 0; }
.form-card h2 { font-size: 19px; margin-bottom: 4px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text); margin: 22px 0 10px; }

/* Controls: pills */
.btn { min-height: 42px; padding: 0 22px; border-radius: 999px; font-weight: 600; border-color: var(--border); background: #fff; }
.btn:hover { background: var(--emerald-tint); border-color: #cfe3da; }
.btn.small { min-height: 34px; padding: 0 14px; border-radius: 999px; }
.btn.primary { background: var(--emerald); border-color: var(--emerald); color: #fff; box-shadow: var(--shadow-primary); }
.btn.primary:hover { background: var(--emerald-hover); border-color: var(--emerald-hover); }
.btn:disabled, .btn.disabled, .btn[aria-disabled="true"] { opacity: .5; box-shadow: none; }
.btns { justify-content: center; margin-top: 26px; }
.form-card .btns .btn.primary { min-width: 220px; min-height: 48px; font-size: 15px; }
.input { height: 44px; border-radius: 12px; padding: 0 14px; border-color: var(--border); }
.input:focus { outline: 3px solid rgba(6, 95, 70, .18); border-color: var(--emerald); }

/* Region picker: name left, count right, chevron last */
.tree { border-radius: 14px; border-color: var(--border); }
.tree summary { justify-content: flex-start; align-items: center; padding: 12px 16px; }
.tree summary .n { margin-left: auto; }
.tree summary:hover { background: var(--emerald-tint); }
.chip { padding: 4px 6px 4px 12px; font-weight: 500; }

/* KPIs */
.kpis { gap: 20px; }
.kpi { border-radius: 18px; box-shadow: var(--shadow-card); border-color: var(--border); padding: 18px 20px; }
.kpi.on { border: 2px solid var(--emerald); padding: 17px 19px; }
.kpi-value { font-size: 32px; line-height: 38px; font-weight: 700; }
.kpi-cap { font-weight: 600; color: var(--text); }

/* Status chips as pills */
.pill { border-radius: 999px; padding-left: 12px; padding-right: 12px; }

@media (max-width: 900px) {
  .frame { grid-template-columns: minmax(0, 1fr); }
  .nav a[aria-current="page"]::before { display: none; }
  .main { padding: 24px 16px 64px; }
}
html, body { min-height: 100%; background: var(--ground); }
.frame { min-height: 100vh; align-items: start; }
.sidebar { position: sticky; top: 0; height: 100vh; min-height: 0; overflow-y: auto; }
.form-foot { display: flex; justify-content: stretch; margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--rule); }
.form-foot .btn.primary { width: 100%; min-height: 50px; font-size: 15.5px; }
.estimate { margin-top: 12px; color: var(--muted); font-size: 13.5px; }
@media (max-width: 900px) { .sidebar { position: static; height: auto; } }

/* New scrape: wide two-column layout, left-aligned like the other pages */
.main:has(> .form-card), .main:has(> .live) { max-width: 1180px; }
.main:has(> .form-card) .page-head, .main:has(> .live) .page-head { justify-content: space-between; text-align: left; }
.scrape-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: 20px; align-items: start; }
.scrape-side { display: flex; flex-direction: column; gap: 20px; }
.scrape-side .card + .card { margin-top: 0; }
.card-title { margin-bottom: 18px; }
.card-title h2 { margin: 0 0 4px; }
.card-title p { font-size: 13.5px; line-height: 20px; }
.scrape-where .tree { max-height: 460px; }
.max-field .input { width: 100%; }
.what-next h2 { margin-bottom: 14px; }
.flow { list-style: none; margin: 0 0 22px; padding: 0; counter-reset: f; display: flex; flex-direction: column; gap: 14px; }
.flow li { counter-increment: f; display: grid; grid-template-columns: 28px 1fr; column-gap: 12px; row-gap: 2px; }
.flow li::before { content: counter(f); grid-row: 1 / 3; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--emerald-tint); color: var(--emerald); font-weight: 700; font-size: 13px; }
.flow li b { font-weight: 600; }
.flow li span { color: var(--muted); font-size: 13.5px; line-height: 19px; }
.start-btn { width: 100%; min-height: 50px; font-size: 15.5px; }
@media (max-width: 1000px) { .scrape-grid { grid-template-columns: minmax(0, 1fr); } }
.scrape-grid { align-items: stretch; }
.scrape-where { display: flex; flex-direction: column; }
.all-note { display: none; margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--rule); }
.scrape-where:has(.switch input:checked) .all-note { display: block; }
.all-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.all-stats div { background: var(--emerald-tint); border-radius: 16px; padding: 18px 20px; }
.all-stats b { display: block; font-size: 30px; line-height: 36px; font-weight: 700; color: var(--emerald-hover); }
.all-stats span { color: var(--muted); font-size: 13.5px; }
.all-note p { font-size: 14px; line-height: 21px; max-width: 60ch; }

/* ===== Run view: connected KPI groups, readable table ===== */
.kpis { grid-template-columns: minmax(0, 2fr) minmax(0, 2fr) minmax(0, 1fr); gap: 20px; align-items: stretch; }
.kpi-group { background: #fff; border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow-card); padding: 0 16px 16px; display: flex; flex-direction: column; }
.kpi-cap { display: flex; align-items: center; justify-content: space-between; margin: 0 -16px 14px; padding: 14px 20px; border-bottom: 1px solid var(--border); background: var(--emerald-tint); border-radius: 22px 22px 0 0; font-size: 14px; font-weight: 700; color: var(--emerald-hover); }
.kpi-total { font-size: 13px; font-weight: 700; color: #fff; background: var(--emerald); border-radius: 999px; padding: 2px 10px; min-width: 28px; text-align: center; }
.kpi-pair { flex: 1; gap: 12px; }
.kpi { box-shadow: none; background: #f8fbf9; border: 1px solid var(--rule); border-radius: 16px; }
.kpi:hover { background: var(--emerald-tint); border-color: #cfe3da; }
.kpi.on { background: #fff; border: 2px solid var(--emerald); }
.kpi-value { color: var(--text); }

.count-badge { display: inline-grid; place-items: center; min-width: 30px; height: 26px; padding: 0 10px; margin-left: 8px; border-radius: 999px; background: var(--emerald); color: #fff; font-size: 13px; font-weight: 700; }

.table-card { overflow: hidden; }
.table-tools { padding: 18px 22px; }
table.rows-table { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; }
.rows-table thead th { background: var(--emerald-tint); color: var(--emerald-hover); font-size: 12.5px; font-weight: 700; letter-spacing: .01em; padding: 13px 14px; border-bottom: 1px solid #d5e8df; text-align: left; white-space: nowrap; }
.rows-table thead th:first-child { padding-left: 22px; }
.rows-table td { padding: 16px 14px; border-top: 1px solid var(--rule); }
.rows-table tbody tr:first-child td { border-top: 0; }
.rows-table td:first-child { padding-left: 22px; }
.rows-table tbody tr.row:hover td { background: #f6faf8; }
.rows-table tr.row.open td { background: var(--emerald-tint); }
.rows-table th.c-practice { width: 30%; }
.rows-table th.c-status { width: 11%; }
.rows-table th.c-needs { width: 17%; }
.rows-table th.c-tick { width: 7.5%; text-align: center; }
.rows-table th.c-date { width: 10%; }
.rows-table th.c-act { width: 0; padding: 0; }
.rows-table td.c-tick { text-align: center; }
.rows-table td.c-practice .line1 { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.rows-table td.c-practice .line2 { color: var(--muted); font-size: 12.5px; }
.rows-table td.c-needs { color: var(--muted); font-size: 13.5px; }
.tick { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; }
.tick .ico { width: 13px; height: 13px; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tick.yes { background: #d9f2e6; }
.tick.yes .ico { stroke: var(--emerald); }
.tick.no { background: #f3f4f4; }
.tick.no .ico { stroke: #a3aaa7; }
.pushed { display: inline-block; padding: 3px 10px; border-radius: 999px; background: #d9f2e6; color: var(--emerald-hover); font-size: 12.5px; font-weight: 600; }
.rows-table td.c-act:empty { padding: 0; }
.rows-table:has(td.c-act .decide) th.c-act { width: 22%; }
@media (max-width: 900px) {
  .kpis { grid-template-columns: minmax(0, 1fr); }
  .rows-table td.c-tick { grid-column: auto; text-align: left; font-size: 12.5px; }
  .rows-table td.c-tick::before, .rows-table td.c-date::before { content: attr(data-label) " "; color: var(--muted); margin-right: 6px; }
}

/* Next-steps bar: more air inside and around it */
.kpis + .step-card, .step-card { margin-top: 24px; }
.step-card + .card, .step-card + .table-card, #table-card { margin-top: 24px; }
.step-card { border-radius: 22px; box-shadow: var(--shadow-card); overflow: hidden; }
.step { padding: 24px 26px; gap: 12px; }
.step-n { width: 28px; height: 28px; font-size: 13px; font-weight: 700; background: var(--emerald-tint); color: var(--emerald); border: 0; }
.step-text strong { font-size: 15px; }
.step-text .muted { font-size: 13.5px; line-height: 19px; margin-top: 2px; }
.step > .btn { margin-top: 6px; }

/* ---------- final pass: login, profile, clearer form and run page ---------- */
body.locked .frame { display: none; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--side); }
.login[hidden] { display: none; }
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 24px; padding: 32px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.login-brand .mark { width: 40px; height: 40px; }
.login-brand strong { display: block; font-size: 16px; }
.login-brand small { color: var(--muted); font-size: 13px; }
.login-card h1 { font-size: 24px; line-height: 30px; }
.login-card .muted { margin-top: -10px; font-size: 14px; }
.login-card .field span { font-weight: 600; color: var(--text); }
.login-card .btn { width: 100%; justify-content: center; height: 46px; font-size: 15px; }
.login-error { color: var(--negative-ink); font-size: 13px; min-height: 18px; margin: -4px 0; }

.profile { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 16px; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .1); }
.avatar { width: 36px; height: 36px; flex: none; border-radius: 50%; background: #6ee7b7; color: #022c22; display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.who strong { color: #fff; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { color: rgba(255, 255, 255, .6); font-size: 12px; }
.signout { width: 36px; height: 36px; flex: none; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .18); background: transparent; color: #fff; display: grid; place-items: center; cursor: pointer; }
.signout:hover { background: rgba(255, 255, 255, .12); }
.signout .ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side-foot { padding: 0; }

/* scrape form */
.howto { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: 0 0 24px; padding: 0; background: #fff; border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow-card); overflow: hidden; }
.howto li { display: flex; gap: 12px; padding: 20px 22px; align-items: flex-start; }
.howto li + li { border-left: 1px solid var(--border); }
.howto li:last-child { background: var(--emerald-tint); }
.howto-n { width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--emerald); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.howto b { display: block; font-size: 15px; margin-bottom: 2px; }
.howto span:not(.howto-n) { display: block; font-size: 13px; line-height: 19px; color: var(--muted); }
.card-title { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 18px; }
.card-title h2 { font-size: 17px; line-height: 24px; }
.card-title .muted { font-size: 13.5px; line-height: 20px; margin-top: 2px; }
.q-n { width: 30px; height: 30px; flex: none; border-radius: 10px; background: var(--emerald-tint); color: var(--emerald-hover); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.hint { font-size: 13px; line-height: 19px; color: var(--muted); margin-top: 16px; padding: 12px 14px; background: #f8fbf9; border-radius: 12px; }
.presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.preset { height: 42px; border-radius: 999px; border: 1px solid var(--control); background: #fff; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; color: var(--text); }
.preset:hover { border-color: var(--emerald); }
.preset.on { background: var(--emerald); border-color: var(--emerald-line); color: #fff; }
.max-field .input { width: 100%; }
.summary-line { font-size: 15px; line-height: 22px; font-weight: 600; color: var(--text); }
.start-card .estimate { margin-top: 6px; }
.start-card .start-btn { width: 100%; justify-content: center; margin-top: 18px; height: 48px; font-size: 15px; }
.start-card .hint { margin-top: 14px; }

/* run page */
.kpis { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) minmax(0, 1fr); }
.kpi-n3 .kpi-pair { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi-cap { align-items: flex-start; }
.kpi-cap-text { display: flex; flex-direction: column; gap: 2px; }
.kpi-cap-text small { font-size: 12px; font-weight: 500; color: var(--muted); line-height: 16px; }
.kpi-label { font-weight: 600; color: var(--text); }
.kpi-hint { color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); padding: 0 22px 14px; margin: 0; }
.legend .tick { transform: scale(.85); }
.legend b { color: var(--text); font-weight: 600; }
.diff { margin: 4px 0 20px; padding: 18px 20px; background: #f8fbf9; border: 1px solid var(--rule); border-radius: 16px; }
.diff-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.diff-head h3 { margin: 0; font-size: 14px; color: var(--text); }
.diff-sum { font-size: 14px; margin: 8px 0 12px; }
.diff-table { width: 100%; table-layout: fixed; background: #fff; border-radius: 12px; overflow: hidden; }
.diff-table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 10px 12px; background: #fff; border-bottom: 1px solid var(--border); }
.diff-table th:last-child { width: 110px; }
.diff-table th:first-child { width: 140px; }
.diff-table td { padding: 10px 12px; border-bottom: 1px solid var(--rule); font-size: 13.5px; overflow-wrap: anywhere; vertical-align: top; }
.diff-table tr:last-child td { border-bottom: 0; }
.diff-table tr.d-same td { color: var(--muted); }
@media (max-width: 1100px) {
  .howto { grid-template-columns: 1fr 1fr; }
  .howto li:nth-child(3) { border-left: 0; }
  .howto li:nth-child(n+3) { border-top: 1px solid var(--border); }
  .kpis { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .howto { grid-template-columns: 1fr; }
  .howto li + li { border-left: 0; border-top: 1px solid var(--border); }
  .kpi-n3 .kpi-pair { grid-template-columns: 1fr; }
  .presets { grid-template-columns: repeat(2, 1fr); }
}
.kpis { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) minmax(170px, 1.1fr); }
@media (max-width: 1100px) { .kpis { grid-template-columns: 1fr; } }

/* legend: even padding; table: roomier status and next step, scrolls sideways when narrow */
.legend { padding: 12px 22px; margin: 0; background: #f8fbf9; border-top: 1px solid var(--rule); line-height: 20px; }
.legend .tick { margin: 0 2px; }
@media (min-width: 901px) {
  .table-wrap { overflow-x: auto; }
  table.rows-table { min-width: 1100px; }
  .rows-table th.c-practice { width: 25%; }
  .rows-table th.c-status { width: 14%; }
  .rows-table th.c-needs { width: 23%; }
  .rows-table th.c-tick { width: 6.5%; }
  .rows-table th.c-date { width: 10%; }
  .rows-table td.c-status, .rows-table th.c-status { padding-right: 20px; }
  .rows-table td.c-needs, .rows-table th.c-needs { padding-left: 8px; padding-right: 24px; }
  .rows-table td.c-needs .line2 { display: block; margin-top: 3px; }
}

/* loading screen */
.splash { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--side); transition: opacity .3s ease, visibility .3s; }
.splash.out { opacity: 0; visibility: hidden; }
.splash-box { display: flex; flex-direction: column; align-items: center; gap: 4px; color: #fff; }
.splash-mark { width: 56px; height: 56px; margin-bottom: 12px; filter: drop-shadow(0 10px 24px rgba(0, 0, 0, .35)); }
.splash-box strong { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.splash-sub { font-size: 14px; color: rgba(255, 255, 255, .65); }
.splash-text { font-size: 13px; color: rgba(255, 255, 255, .75); margin-top: 10px; }
.spinner { width: 28px; height: 28px; margin-top: 28px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .18); border-top-color: #6ee7b7; animation: spin .8s linear infinite; }
.spinner.dark { margin: 0 0 8px; width: 26px; height: 26px; border-color: var(--emerald-tint); border-top-color: var(--emerald); }
@keyframes spin { to { transform: rotate(360deg); } }
.state.loading { align-items: center; justify-content: center; text-align: center; padding: 56px 24px; min-height: 220px; }
.skel-row { background: linear-gradient(90deg, var(--raised) 0%, #eef5f1 50%, var(--raised) 100%); background-size: 200% 100%; animation: shimmer 1.2s ease-in-out infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .spinner, .skel-row { animation: none; } .splash { transition: none; } }
