:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --text: #101828;
  --muted: #667085;
  --border: #e4e7ec;
  --accent: #3b5bdb;
  --accent-soft: #edf2ff;
  --ok: #2b8a3e;
  --warn: #b35c00;
  --bad: #c92a2a;
  --side-bg: #111827;
  --side-text: #cbd2dc;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --surface: #161b24;
    --text: #e6e8ee;
    --muted: #98a2b3;
    --border: #2a3140;
    --accent: #7c95ff;
    --accent-soft: #222b47;
    --ok: #69db7c;
    --warn: #ffa94d;
    --bad: #ff8787;
    --side-bg: #0a0d12;
    --side-text: #aeb6c2;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 1rem/1.6 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-size: 0.82em; background: var(--accent-soft); padding: 1px 6px; border-radius: 4px; }
.strong { font-weight: 600; }
.right { text-align: right; }

/* App shell */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 24px;
  padding: 20px 14px; background: var(--side-bg); color: var(--side-text);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.02rem; color: #fff; padding: 0 8px; }
.brand:hover { text-decoration: none; }
.brand span:not(.brand-mark) { color: #9fb0ff; font-weight: 500; }
.brand-mark {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, #4c6ef5, #7950f2); color: #fff; font-size: 0.95rem;
}
.sidebar nav { display: grid; gap: 2px; }
.sidebar nav a { color: var(--side-text); padding: 10px 14px; border-radius: 8px; font-weight: 500; font-size: 1rem; }
.sidebar nav a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; text-decoration: none; }
.sidebar nav a.active { background: rgba(124, 149, 255, 0.16); color: #fff; }
.sidebar-foot { margin-top: auto; display: grid; gap: 4px; padding: 12px 8px 0; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.sidebar-foot span { color: var(--side-text); word-break: break-all; }
.sidebar-foot button.link { color: #9fb0ff; text-align: left; }

.container { width: 100%; max-width: 1680px; margin: 0 auto; padding: 32px 40px 72px; min-width: 0; }
.page-head { margin-bottom: 24px; }
.page-head h1 { margin: 0 0 4px; font-size: 1.9rem; letter-spacing: -0.015em; line-height: 1.25; }
.page-head p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.accent { color: var(--accent); }
.empty { color: var(--muted); font-style: italic; }
.inline { display: inline; margin: 0; }
.warn { color: var(--warn); }
.bad { color: var(--bad); }
.ok { color: var(--ok); }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.split { display: grid; gap: 20px; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; margin-bottom: 20px; }
.split > .panel { margin-bottom: 0; }
.stack { display: grid; gap: 20px; }
.stack > .panel { margin-bottom: 0; }
.card, .panel, .login-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow);
}
.panel { margin-bottom: 20px; }
.panel.flush { padding: 0; overflow: hidden; }
.pad { padding: 18px 24px; margin: 0; }
.panel h2, .card h2 { margin: 0 0 12px; font-size: 1.2rem; }
.panel-head h2 { margin: 0; }
.panel h3 { margin: 22px 0 4px; font-size: 1rem; }
.panel h4 { margin: 18px 0 2px; font-size: 0.95rem; }
.panel h4 + p.small { margin-top: 0; }
.panel .table { margin-bottom: 6px; }
.panel .table td.small { word-break: break-all; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
.card-head { margin-bottom: 12px; }
.card-head a.small { word-break: break-all; }

/* KPI strip */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin: 0 0 20px; }
.kpis > div {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow);
}
.kpis dt { font-size: 0.92rem; color: var(--muted); font-weight: 600; }
.kpis dd { margin: 6px 0 4px; font-size: 2.1rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.kpis dd small { font-size: 0.95rem; font-weight: 600; color: var(--muted); }
.kpis > div > span { font-size: 0.86rem; color: var(--muted); display: block; line-height: 1.4; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 10px; }
.stats.wide { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 18px; }
.stats div { background: var(--bg); border-radius: 8px; padding: 10px; }
.stats dt { font-size: 0.78rem; color: var(--muted); }
.stats dd { margin: 0; font-size: 1.4rem; font-weight: 700; }
.stats dd.warn { color: var(--warn); }
.stats dd.bad { color: var(--bad); }

.profile { display: grid; grid-template-columns: 170px 1fr; gap: 8px 16px; margin: 8px 0; }
.profile dt { color: var(--muted); font-size: 0.84rem; }
.profile dd { margin: 0; word-break: break-word; }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.table.data th { background: var(--bg); text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.78rem; white-space: nowrap; }
.table.data td { vertical-align: middle; padding-top: 14px; padding-bottom: 14px; }
.table.data th, .table.data td { padding-left: 14px; padding-right: 14px; }
.table.data td:first-child { min-width: 170px; }
.table.data th:first-child, .table.data td:first-child { padding-left: 24px; }
.table.data th:last-child, .table.data td:last-child { padding-right: 24px; }
.table.data tbody tr:hover { background: var(--bg); }
.table.data tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table td.num.muted { text-align: center; font-style: italic; }
.table.data td span.warn, .table.data td span.bad { font-weight: 700; }

/* Buttons */
.btn {
  display: inline-block; border: 1px solid transparent; border-radius: 8px; padding: 10px 18px; cursor: pointer;
  background: var(--accent); color: #fff; font: inherit; font-weight: 600; white-space: nowrap;
}
.btn:hover { text-decoration: none; filter: brightness(1.06); }
.btn-secondary { background: var(--accent-soft); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); }
button.link { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }

.badge, .status, .stage, .health, .trend { display: inline-block; font-size: 0.8rem; padding: 3px 10px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.badge.measured { background: #d3f9d8; color: #1b5e20; }
.badge.estimated { background: #fff3bf; color: #7a4f00; }
.badge.ai_suggestion { background: #e5dbff; color: #4a2c8a; }
.status-done { background: #d3f9d8; color: #1b5e20; }
.status-running { background: #d0ebff; color: #1864ab; }
.status-error { background: #ffe3e3; color: #a51111; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid var(--border); }
.flash-success { background: #ebfbee; color: #1b5e20; }
.flash-warning { background: #fff9db; color: #7a4f00; }
.flash-danger { background: #fff5f5; color: #a51111; }
.flash-info { background: #e7f5ff; color: #1864ab; }
.note { margin: 0 0 16px; padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--surface);
  border-radius: 0 8px 8px 0; color: var(--muted); font-size: 0.88rem; }

.login-card { max-width: 380px; margin: 10vh auto 0; }
.login-card h1 { margin: 0; }
.login-card h1 span { color: var(--accent); }
.login-card form { display: grid; gap: 12px; margin-top: 18px; }
.login-card label { display: grid; gap: 4px; font-size: 0.9rem; }
input[type=text], input[type=email], input[type=password], input:not([type]) {
  padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text); font: inherit; width: 100%;
}

.issue-summary { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.issue-summary li { background: var(--bg); border-radius: 8px; padding: 6px 10px; }
.page-row { border-top: 1px solid var(--border); padding: 8px 0; }
.page-row summary { cursor: pointer; display: flex; gap: 10px; align-items: center; }
.page-row .url { flex: 1; word-break: break-all; font-size: 0.9rem; }
.page-row .count { color: var(--warn); font-size: 0.85rem; white-space: nowrap; }
.code-pill { font-size: 0.75rem; background: var(--bg); padding: 2px 6px; border-radius: 4px; }
.issues { margin: 6px 0 4px; padding-left: 18px; font-size: 0.9rem; }

.badge.rules { background: var(--accent-soft); color: var(--accent); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-small { padding: 4px 10px; font-size: 0.82rem; }

.plan-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.gen-form { display: flex; gap: 8px; flex-wrap: wrap; }

.budget { display: grid; gap: 10px; }
.budget-row { display: grid; grid-template-columns: 80px 1fr auto; gap: 10px; align-items: center; }
.budget-row span:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.budget p { margin: 2px 0 0; }
.meter { height: 6px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.meter div { height: 100%; background: var(--accent); min-width: 2px; }

.pill { display: inline-block; font-size: 0.8rem; padding: 3px 10px; border-radius: 999px;
  background: var(--bg); color: var(--muted); font-weight: 600; text-transform: capitalize; }
.pill-high { background: #ffe3e3; color: #a51111; }
.pill-medium { background: #fff3bf; color: #7a4f00; }
.pill-low { background: #e7f5ff; color: #1864ab; }

/* Status labels */
.stage-todo { background: var(--bg); color: var(--muted); }
.stage-review { background: #fff3bf; color: #7a4f00; }
.stage-approved { background: #d0ebff; color: #1864ab; }
.stage-verified { background: #d3f9d8; color: #1b5e20; }
.stage-done { background: #e6fcf5; color: #0b7285; }
.stage-dismissed { background: var(--bg); color: var(--muted); }
.health-attention { background: #ffe3e3; color: #a51111; }
.health-ok { background: #fff3bf; color: #7a4f00; }
.health-good { background: #d3f9d8; color: #1b5e20; }
.health-unknown { background: var(--bg); color: var(--muted); }
.trend { padding-left: 0; padding-right: 0; font-size: 0.92rem; }
.trend-up { color: var(--ok); }
.trend-up::before { content: "\25B2  "; }
.trend-down { color: var(--bad); }
.trend-down::before { content: "\25BC  "; }
.trend-flat { color: var(--text); }
.trend-flat::before { content: "\25CF  "; color: var(--muted); }
.trend-unknown { color: var(--muted); font-weight: 500; }
.na { color: var(--muted); font-style: italic; font-size: 0.9rem; }
.yes { color: var(--ok); font-weight: 700; }
.no { color: var(--muted); font-weight: 700; }
.label { display: block; margin: 0 0 4px; font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--muted); }

/* Dashboard */
.top-actions { list-style: none; counter-reset: top; padding: 0; margin: 8px 0 0; display: grid; gap: 4px; }
.top-actions li { counter-increment: top; position: relative; padding: 16px 0 16px 52px; border-top: 1px solid var(--border); }
.top-actions li:first-child { border-top: 0; }
.top-actions li::before { content: counter(top); position: absolute; left: 0; top: 16px; width: 36px; height: 36px;
  border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.top-actions li.empty { padding-left: 0; }
.top-actions li.empty::before { content: none; }
.top-actions-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.top-title { display: block; margin: 6px 0 4px; font-size: 1.1rem; font-weight: 600; color: var(--text); }
.top-actions p { margin: 0 0 4px; }
.focus-card { border-top: 4px solid var(--bad); }
.focus-name { font-size: 1.35rem; font-weight: 700; margin: 0 0 6px; }
.focus-card p { margin: 0 0 6px; }
.waiting { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.waiting li { display: flex; gap: 14px; align-items: flex-start; }
.count-badge { flex: none; min-width: 40px; height: 40px; padding: 0 8px; border-radius: 10px; display: grid; place-items: center;
  background: var(--bg); font-weight: 700; font-size: 1.1rem; }
.count-badge.hot { background: #fff3bf; color: #7a4f00; }

/* Businesses */
.biz-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.biz-card { display: flex; flex-direction: column; gap: 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.biz-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.biz-head h2 { margin: 0; font-size: 1.3rem; }
.biz-goal { margin: 0; }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0; }
.mini-stats div { background: var(--bg); border-radius: 10px; padding: 12px 14px; }
.mini-stats dt { font-size: 0.82rem; color: var(--muted); }
.mini-stats dd { margin: 2px 0 0; font-size: 1.35rem; font-weight: 700; }
.mini-stats dd .trend { font-size: 1rem; }
.biz-card > p.small { margin: -6px 0 0; }
.na-box { margin: 0; padding: 12px 14px; border-radius: 10px; background: var(--bg); color: var(--muted); }
.biz-next { border-top: 1px solid var(--border); padding-top: 14px; flex: 1; }
.biz-next p { margin: 0 0 6px; }
.biz-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Plan task cards */
.task-card { background: var(--surface); border: 1px solid var(--border); border-left: 5px solid var(--border);
  border-radius: var(--radius); padding: 24px 28px; margin-bottom: 18px; box-shadow: var(--shadow); }
.task-card.prio-high { border-left-color: var(--bad); }
.task-card.prio-medium { border-left-color: #f59f00; }
.task-card.prio-low { border-left-color: #339af0; }
.task-card.stage-dismissed, .task-card.stage-done, .task-card.stage-verified { opacity: 0.7; }
.task-card h3 { margin: 10px 0 16px; font-size: 1.3rem; line-height: 1.35; }
.task-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.task-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 32px; }
.task-grid p { margin: 0 0 6px; }
.apply-box, .verify-note { margin-top: 18px; padding: 16px 18px; border-radius: 10px; background: var(--accent-soft); }
.apply-page { padding: 10px 0; border-top: 1px solid var(--border); }
.apply-page p { margin: 4px 0 0; }
.verify-note { background: #fff9db; color: #5c3d00; }
.verify-note.ok { background: #ebfbee; color: #1b5e20; }
.verify-note p { margin: 0 0 4px; word-break: break-word; }
.task-more { border-top: 1px solid var(--border); margin-top: 18px; padding-top: 12px; }
.task-more summary { cursor: pointer; font-size: 0.92rem; color: var(--accent); font-weight: 600; }
.task-fields dd { margin-bottom: 4px; }
.evidence { margin: 10px 0 0; padding-left: 18px; font-size: 0.9rem; }
.evidence li { margin-bottom: 4px; word-break: break-word; }
.task-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.task-actions form { margin: 0; }
.empty-state { text-align: center; padding: 40px 24px; }

/* Review page */
.review-page .compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; margin-top: 14px; }
.review-page .compare p { margin: 0 0 10px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; font-weight: 600; }
.field input, .field textarea { font: inherit; font-weight: 400; width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--bg); color: var(--text); resize: vertical; }
.count { font-size: 0.82rem; font-weight: 500; color: var(--muted); margin-left: 6px; }
.count.ok { color: var(--ok); }
.count.warn { color: var(--warn); }
.count.bad { color: var(--bad); }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: 14px 0; margin-top: 0; }

.plan-list { list-style: none; padding: 0; margin: 6px 0 4px; display: grid; gap: 6px; }
.plan-list li { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
details.panel summary { cursor: pointer; font-weight: 600; }

@media (max-width: 1100px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 20px; }
  .sidebar nav { display: flex; flex-wrap: wrap; }
  .sidebar-foot { margin: 0 0 0 auto; border: 0; padding: 0; display: flex; gap: 10px; align-items: center; }
  .sidebar-foot span { display: none; }
  .split { grid-template-columns: 1fr; }
  .container { padding: 28px 24px 64px; }
}
@media (max-width: 720px) {
  .task-grid, .review-page .compare { grid-template-columns: 1fr; }
  .task-card { padding: 20px; }
}
@media (max-width: 600px) {
  html { font-size: 15px; }
  .container { padding: 20px 16px 48px; }
  .page-head h1 { font-size: 1.55rem; }
  .budget-row { grid-template-columns: 1fr auto; }
  .budget-row .meter { grid-column: 1 / -1; grid-row: 2; }
  .profile { grid-template-columns: 1fr; }
  .mini-stats { grid-template-columns: 1fr 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpis dd { font-size: 1.6rem; }
  .sidebar .brand span:not(.brand-mark) { display: none; }
}

/* Task workflow statuses */
.stage-recommended { background: var(--bg); color: var(--muted); }
.stage-preparing { background: #e7f5ff; color: #1864ab; }
.stage-ready_for_review { background: #fff3bf; color: #7a4f00; }
.stage-awaiting_approval { background: #ffe8cc; color: #8a4500; }
.stage-in_progress { background: #e5dbff; color: #4a2c8a; }
.stage-failed { background: #ffe3e3; color: #a51111; }
.count-badge.fail { background: #ffe3e3; color: #a51111; }
.status-note { margin: 14px 0 0; padding: 10px 14px; border-radius: 8px; background: var(--bg); font-size: 0.92rem; }
.status-note.bad { background: #fff5f5; color: #a51111; }
.task-card h3 a { color: var(--text); }

/* Task page */
.stepper { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0 0 18px; counter-reset: step; }
.stepper li { counter-increment: step; padding: 6px 12px 6px 8px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--border); font-size: 0.86rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stepper li::before { content: counter(step); width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  background: var(--bg); font-size: 0.75rem; font-weight: 700; }
.stepper li.done { color: var(--ok); }
.stepper li.done::before { content: "\2713"; background: #d3f9d8; color: #1b5e20; }
.stepper li.current { border-color: var(--accent); color: var(--accent); font-weight: 700; background: var(--accent-soft); }
.stepper li.current::before { background: var(--accent); color: #fff; }
.next-step { border-left: 5px solid var(--accent); }
.next-step p { margin: 0 0 4px; }
.review-page { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 16px; }
.review-page:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.revise { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between;
  margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); }
.revise form:first-child { flex: 1 1 420px; display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.revise .field { flex: 1 1 300px; margin: 0; }
.apply-status { padding: 14px 16px; border-radius: 10px; margin-bottom: 16px; background: var(--bg); }
.apply-status.on { background: #ebfbee; }
.apply-status p { margin: 0 0 4px; }
.guide { margin: 6px 0 0; padding-left: 22px; }
.guide li { margin-bottom: 6px; word-break: break-word; }
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.timeline li { padding-left: 14px; border-left: 3px solid var(--border); }
.apply-preview { border: 2px solid var(--accent); border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; }
.apply-preview .compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin: 8px 0; }
.apply-preview .compare p { margin: 0 0 6px; word-break: break-word; }
.diff { white-space: pre-wrap; word-break: break-all; font-size: 0.85rem; background: var(--bg); padding: 10px 12px; border-radius: 8px; margin: 6px 0; }
.diff .del { color: var(--bad); }
.diff .add { color: var(--ok); }
.rollback { padding: 14px 16px; border-radius: 10px; background: var(--bg); margin-bottom: 16px; }
@media (max-width: 720px) { .apply-preview .compare { grid-template-columns: 1fr; } }
.perm-list { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 12px; }
.perm-list li { display: flex; gap: 12px; align-items: flex-start; }
.perm { flex: none; min-width: 54px; text-align: center; padding: 3px 8px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; }
.perm.on { background: #d3f9d8; color: #1b5e20; }
.perm.off { background: var(--bg); color: var(--muted); border: 1px solid var(--border); }
.claims { list-style: none; padding: 0; margin: 4px 0 6px; display: grid; gap: 6px; }
.claims li.ok strong { color: var(--ok); }
.claims li.bad strong { color: var(--bad); }

/* ---- Phone layout fixes ---- */
.stepper-mobile { display: none; margin: 0 0 16px; padding: 10px 14px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent); }
@media (max-width: 1100px) {
  /* Header: logo and Sign out on one row, menu on the next — instead of three rows. */
  .sidebar { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "brand foot" "nav nav";
    gap: 8px 12px; padding: 10px 16px; }
  .sidebar .brand { grid-area: brand; padding: 0; }
  .sidebar nav { grid-area: nav; display: flex; gap: 4px; overflow-x: auto; }
  .sidebar nav a { flex: 1 0 auto; text-align: center; padding: 10px 12px; }
  .sidebar-foot { grid-area: foot; margin: 0; }
  .sidebar-foot button.link { min-height: 40px; padding: 0 6px; }
}
@media (max-width: 600px) {
  /* Inputs under 16px make iPhones zoom in when tapped. */
  input, textarea, select, .field input, .field textarea { font-size: 16px; }
  .btn { min-height: 42px; }
  /* A lone last summary card uses the full width instead of leaving a gap. */
  .kpis > div:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .stats.wide { grid-template-columns: 1fr 1fr; }
  .stats.wide div { background: var(--surface); border: 1px solid var(--border); }
  /* Progress: one line on phones instead of seven pills. */
  .stepper { display: none; }
  .stepper-mobile { display: block; }
  /* Data tables: each row becomes a small card of "label: value" lines. */
  .table.data thead { display: none; }
  .table.data, .table.data tbody, .table.data tr, .table.data td { display: block; width: 100%; }
  .table.data tr { padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .table.data tbody tr:last-child { border-bottom: 0; }
  .table.data td { display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
    padding: 3px 0 !important; border: 0; text-align: right; white-space: normal; min-width: 0 !important;
    word-break: normal; overflow-wrap: anywhere; }
  .panel .table.data td.small { word-break: normal; }  /* beats the desktop break-all rule */
  .table.data td[data-label]::before { content: attr(data-label); flex: none; max-width: 45%; text-align: left;
    color: var(--muted); font-size: 0.85rem; font-weight: 600; }
  .table.data td:first-child { display: block; text-align: left; font-size: 1.02rem; margin-bottom: 4px; }
  .table.data td:first-child::before { content: none; }
  .table.data td:empty { display: none; }
  .table.data td.num.muted { text-align: right; }
  .table:not(.data) th, .table:not(.data) td { padding: 8px 6px; }
}
