/* Embco: one neutral palette, one accent (the brand blue) for actions and the agent, and color
   only where it means something: green paid, amber waiting, red held. Light and dark. */
:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --line: #e5e7eb;
  --line-soft: #f0f1f3;
  --text: #111827;
  --muted: #4b5563;
  --faint: #646b78;
  --accent: #1d4ed8;
  --accent-hover: #1e40af;
  --accent-ink: #1d4ed8;
  --accent-soft: #eff4ff;
  --accent-line: #c7d7fe;
  --on-accent: #ffffff;
  --on-muted: #ffffff;
  --success: #047857;
  --success-soft: #ecfdf5;
  --success-line: #a7f3d0;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --warn-ink: #92400e;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --danger-line: #fecaca;
  --danger-solid: #b91c1c;
  --brand-tile: #0f172a;
  --chat-bg: #eef2fb;
  --radius: 12px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b0f17;
    --surface: #111827;
    --surface-2: #0f1520;
    --line: #2b3646;
    --line-soft: #182030;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --faint: #8b93a1;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-ink: #93c5fd;
    --accent-soft: #13203a;
    --accent-line: #24375e;
    --success: #34d399;
    --success-soft: #0b2a20;
    --success-line: #1f6f4a;
    --warn: #fbbf24;
    --warn-soft: #3a2a0a;
    --warn-ink: #fcd34d;
    --danger: #f87171;
    --danger-soft: #2c1215;
    --danger-line: #7f1d1d;
    --brand-tile: #1e293b;
    --on-muted: #0b0f17;
  --chat-bg: #0b0f17;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0f17;
  --surface: #111827;
  --surface-2: #0f1520;
  --line: #2b3646;
  --line-soft: #182030;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --faint: #8b93a1;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-ink: #93c5fd;
  --accent-soft: #13203a;
  --accent-line: #24375e;
  --success: #34d399;
  --success-soft: #0b2a20;
  --success-line: #1f6f4a;
  --warn: #fbbf24;
  --warn-soft: #3a2a0a;
  --warn-ink: #fcd34d;
  --danger: #f87171;
  --danger-soft: #2c1215;
  --danger-line: #7f1d1d;
  --brand-tile: #1e293b;
  --on-muted: #0b0f17;
  --chat-bg: #0b0f17;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); color: var(--text); }
[hidden] { display: none !important; }
a { color: var(--accent-ink); }
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 20px; height: 56px; flex: none;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand img { width: 28px; height: 28px; }
.wordmark { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.01em; }
.topbar-right { display: flex; align-items: center; gap: 10px; position: relative; }
.account-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: min(320px, calc(100vw - 32px));
  display: grid; gap: 8px; padding: 12px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 8px 24px rgb(0 0 0 / 0.18);
}
.pill {
  font-size: 0.8rem; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: var(--warn-soft); color: var(--warn-ink);
}
.net-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; background: var(--surface); }
.net-switch button {
  font: inherit; font-size: 0.8rem; font-weight: 600; padding: 3px 10px; border: 0; border-radius: 999px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.net-switch button[aria-pressed="true"] { background: var(--warn-soft); color: var(--warn-ink); cursor: default; }
.net-switch button[data-network="mainnet"][aria-pressed="true"] { background: var(--success-soft); color: var(--success); }
/* Test-USDC-only parts (Earn, cross-chain funds, the faucet) are not shown on Arc Mainnet. */
body[data-network="mainnet"] .test-money { display: none !important; }
.icon-btn {
  font: inherit; width: 34px; height: 34px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}

.container { width: 100%; max-width: 1440px; margin: 0 auto; padding: 28px 20px 48px; flex: 1; }
h1 { font-size: 1.8rem; line-height: 1.2; margin: 0 0 12px; letter-spacing: -0.02em; }
h2 { font-size: 1.05rem; margin: 0 0 12px; }
h3 { font-size: 0.95rem; margin: 16px 0 8px; }
.lead { color: var(--muted); max-width: 640px; line-height: 1.5; margin: 0 0 20px; }
.hint { color: var(--muted); font-size: 0.86rem; line-height: 1.45; }
.optional { color: var(--muted); font-weight: 400; }
.mono { font-family: var(--mono); font-size: 0.88rem; word-break: break-all; }

.notice {
  padding: 10px 14px; border-radius: var(--radius); margin: 0 0 16px;
  background: var(--accent-soft); border: 1px solid var(--accent-line);
}
.notice.error { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); }
.notice.success { background: var(--success-soft); border-color: var(--success-line); color: var(--success); }
.notice:has(.notice-close) { display: flex; align-items: flex-start; gap: 12px; }
.notice:has(.notice-close) > span { flex: 1; }
.notice-close { flex: none; margin: -2px -4px 0 0; padding: 0 6px; border: 0; background: none; color: inherit;
  font-size: 1.25rem; line-height: 1; cursor: pointer; opacity: 0.7; }
.notice-close:hover, .notice-close:focus-visible { opacity: 1; }

.btn {
  font: inherit; font-weight: 600; border-radius: 8px; padding: 9px 15px;
  border: 1px solid transparent; cursor: pointer; line-height: 1.2;
}
.btn:disabled { opacity: 0.55; cursor: wait; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--line); text-decoration: none; }
.btn-ghost:hover:not(:disabled) { border-color: var(--muted); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: var(--danger-line); }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); }
.btn-small { padding: 6px 11px; font-size: 0.82rem; }
.wallet-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.wallet-choice { display: inline-flex; align-items: center; gap: 8px; }
.wallet-choice img { width: 20px; height: 20px; border-radius: 4px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 16px; }
.card.wide { grid-column: 1 / -1; }
.shop-head { margin-bottom: 20px; }

.form { display: grid; gap: 16px; max-width: 520px; }
.form label { display: grid; gap: 6px; font-weight: 600; font-size: 0.95rem; }
input {
  font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; width: 100%;
  background: var(--surface); color: var(--text);
}
input::placeholder { color: var(--faint); }
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.inline-form { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.inline-form input { flex: 1 1 180px; }
.stack-form { display: grid; gap: 8px; margin-top: 12px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; align-items: center; }

.facts { margin: 0 0 8px; display: grid; gap: 8px; }
.facts div { display: flex; justify-content: space-between; gap: 12px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; text-align: right; }
.status-on { color: var(--success); }
.status-off { color: var(--danger); }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.list li {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
}
.list .empty { color: var(--muted); border-style: dashed; }
.amount { font-weight: 700; color: var(--success); }

.footer {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 14px 20px; border-top: 1px solid var(--line); font-size: 0.85rem; color: var(--muted);
}
.footer nav { display: flex; gap: 16px; }
.built-on { display: flex; align-items: center; gap: 8px; color: var(--muted); text-decoration: none; }
:root[data-theme="dark"] .built-on img { filter: invert(1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .built-on img { filter: invert(1); } }

@media (max-width: 560px) {
  h1 { font-size: 1.45rem; }
}

/* decisions, checks and badges */
.badge {
  display: inline-block; min-width: 3.2em; text-align: center; font-size: 0.8rem; font-weight: 700;
  padding: 1px 7px; border-radius: 999px; margin-right: 8px;
}
.badge-pay { background: var(--success-soft); color: var(--success); }
.badge-hold { background: var(--danger-soft); color: var(--danger); }
.badge-ask { background: var(--accent-soft); color: var(--accent-ink); }
.decision { display: grid; gap: 4px; flex: 1 1 320px; }
.decision .reasons, .reasons { color: var(--muted); font-size: 0.86rem; }
.checks { margin-top: 12px; }
.checks .ok::before { content: "✓ "; color: var(--success); font-weight: 700; }
.checks .fail::before { content: "✗ "; color: var(--danger); font-weight: 700; }
#erp-set-agent { margin: 8px 0 12px; }

/* suppliers: the owner's list and the supplier's own page */
.confirm {
  margin: 8px 0 12px; padding: 14px 16px; border-radius: 10px;
  background: var(--accent-soft); border: 1px solid var(--accent-line);
}
.confirm p { margin: 0 0 10px; line-height: 1.45; }
.safety { margin-top: 24px; }
.safety ul, .safety ol { padding-left: 20px; margin: 0 0 8px; display: grid; gap: 6px; }
.safety summary { cursor: pointer; font-weight: 600; margin: 8px 0; }
.supplier-row { display: grid; gap: 2px; flex: 1 1 220px; min-width: 0; }
.wallet-check { display: grid; gap: 8px; margin: 0 0 12px; }
.wallet-groups { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 0; font-size: 1rem; font-weight: 600; }
.wallet-groups .ch-ok { color: var(--success); }
.wallet-groups .ch-wrong { color: #fff; background: var(--danger-solid); border-radius: 3px; }
.wallet-groups .ch-missing { color: var(--muted); }
.check-ok { color: var(--success); font-weight: 600; }
.check-bad { color: var(--danger); font-weight: 600; }

/* what the agent needs from the owner, one invoice per row */
.tasks-head { display: flex; justify-content: space-between; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.tasks-head h2 { margin: 0; }
.task { padding: 14px 16px; border-bottom: 1px solid var(--line-soft); display: grid; gap: 8px; }
.task-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px 12px; flex-wrap: wrap; font-weight: 600; }
.task-head .hint { font-weight: 400; font-family: var(--mono); font-size: 0.8rem; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 0.9rem; }
.step { display: grid; grid-template-columns: 1.3em 1fr; gap: 6px; align-items: start; line-height: 1.45; }
.step .mark { font-weight: 700; text-align: center; }
.step-done .mark { color: var(--success); }
.step-todo .mark { color: var(--danger); }
.step-waiting .mark { color: var(--warn); }
.step-done .text { color: var(--muted); }
.step .row { grid-column: 2; margin-top: 4px; }
.decide { border-top: 1px dashed var(--line); padding-top: 10px; display: grid; gap: 8px; }
.decide .row { margin: 0; }
.decide input { max-width: 420px; }
.pay-state { font-weight: 600; margin: 0; font-size: 0.9rem; }
.pay-state.paid { color: var(--success); }
.pay-state.blocked { color: var(--danger); }
.agent-says { display: grid; gap: 2px; border-left: 2px solid var(--accent); padding: 2px 0 2px 10px; }
.agent-says .who { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; color: var(--accent-ink); }
.agent-says .rec { color: var(--muted); font-size: 0.85rem; }
.weighed { display: grid; gap: 2px; border-left: 2px solid var(--line); padding: 2px 0 2px 10px; }
.weighed .who { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; color: var(--muted); }
.weighed ul { margin: 0; padding-left: 18px; font-size: 0.86rem; }
.reply .row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* ---- the owner console: a sidebar of pages, one page at a time ---- */
body:has(#view-shop:not([hidden])) .container { max-width: none; padding: 0; display: flex; flex-direction: column; min-height: 0; }
body:has(#view-shop:not([hidden])) .footer { display: none; }
body:has(#view-shop:not([hidden])) .notice { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 40; max-width: min(720px, calc(100vw - 32px)); margin: 0; box-shadow: 0 6px 20px rgb(0 0 0 / 0.08); }
.console { flex: 1; min-height: calc(100vh - 56px); display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.side {
  background: var(--surface); border-right: 1px solid var(--line); padding: 18px 12px;
  display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: calc(100vh - 56px);
}
.side-shop { display: grid; gap: 2px; padding: 0 10px 16px; min-width: 0; }
.side-shop b { font-size: 0.95rem; }
.side-shop a { color: var(--muted); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; word-break: normal; }
.side-link {
  display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-radius: 8px;
  color: var(--text); text-decoration: none; font-size: 0.92rem;
}
.side-link:hover { background: var(--bg); }
.side-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.side-link .count { background: var(--accent); color: var(--on-accent); border-radius: 999px; font-size: 0.8rem; padding: 0 7px; font-weight: 600; }
.side-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--line-soft); display: grid; gap: 8px; justify-items: start; }
.eyebrow { color: var(--muted); font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; }

.pages { min-width: 0; padding: 26px 34px 96px; max-width: 1240px; width: 100%; }
.page { display: grid; gap: 18px; align-content: start; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 8px 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.45rem; margin: 0; }
.page-head .row { margin: 0; }
.numbers {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin: 0;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.numbers > div { background: var(--surface); padding: 14px 18px; display: grid; gap: 2px; }
.numbers dt { color: var(--muted); font-size: 0.8rem; display: flex; align-items: center; gap: 6px; }
.numbers dd { margin: 0; font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.numbers .hint { font-size: 0.8rem; }

/* tables: the bills, the money, the cash plan */
.table-card, .card.bills { padding: 0; overflow: hidden; }
.card-title { font-size: 0.95rem; margin: 0; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-foot { margin: 0; padding: 10px 18px 14px; }
.grid-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.grid-table th { text-align: left; font-size: 0.8rem; font-weight: 500; color: var(--muted); padding: 10px 16px; border-bottom: 1px solid var(--line); }
.grid-table td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.grid-table tr:last-child td { border-bottom: 0; }
.grid-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.grid-table .why { color: var(--muted); }
.grid-table .ref { display: block; color: var(--muted); font-size: 0.8rem; font-family: var(--mono); }
.grid-table tr.muted td { color: var(--faint); }
.grid-table td.short { color: var(--danger); }
.grid-table .row-toggle { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.grid-table tr.sub-row td:first-child { padding-left: 36px; }
/* the money on Arc over time: Earn in the accent, the wallet in slate */
.chart-card { padding: 0; }
.chart-card #earn-card-body { padding: 12px 18px 16px; }
.earn-head { display: flex; flex-wrap: wrap; gap: 8px 32px; margin: 0 0 12px; }
.earn-head dt { font-size: 0.8rem; color: var(--muted); }
.earn-head dd { margin: 2px 0 0; font-size: 1.15rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.earn-head dd.up { color: var(--success); }
.earn-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.earn-area { fill: url(#earn-fade); stroke: none; }
.earn-fade-top { stop-color: var(--accent); stop-opacity: 0.18; }
.earn-fade-bottom { stop-color: var(--accent); stop-opacity: 0; }
.earn-mark { fill: var(--text); stroke: var(--surface); stroke-width: 1.5; }
.earn-moves { margin-top: 12px; }
.text-link { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.text-link:hover { color: var(--accent-ink); }
.chart-plot { position: relative; }
.chart-svg { display: block; width: 100%; height: auto; }
.chart-grid { stroke: var(--line-soft); stroke-width: 1; }
.chart-axis { fill: var(--faint); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.chart-cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-tip { position: absolute; top: 4px; transform: translateX(-50%); display: grid; gap: 2px; padding: 8px 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; font-size: 0.8rem; color: var(--text);
  font-variant-numeric: tabular-nums; pointer-events: none; white-space: nowrap; box-shadow: 0 2px 8px rgb(0 0 0 / 0.08); }
.chart-empty { margin: 8px 0; }
.stats-chart-body { padding: 14px 18px 16px; }
.stats-bar { fill: var(--accent); }
.stats-hit { fill: transparent; }
.stats-hit:hover { fill: var(--accent-soft); fill-opacity: 0.5; }
.stats-baseline { stroke: var(--line); stroke-width: 1; }
.stats-table { margin-top: 16px; }
.stats-table summary { padding: 12px 16px; cursor: pointer; font-weight: 600; }
.stats-loading { display: flex; align-items: center; gap: 10px; }
.stats-loading::before { content: ""; width: 16px; height: 16px; flex: none; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .stats-loading::before { animation-duration: 2.4s; } }
.bills-table tbody tr { cursor: pointer; }
.bills-table tbody tr:hover { background: var(--surface-2); }
.bills-table tbody tr.selected { background: var(--accent-soft); }
.bills-table .why { max-width: 460px; }
.open-link { color: var(--accent-ink); font-size: 0.84rem; }
.group-hint { margin: 0; padding: 10px 16px 0; }
.two-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.two-cols .card h2 { margin-bottom: 6px; }
.activity-card { padding: 0; }
.activity-card .activity-log { max-height: none; padding: 16px 18px; }

/* sign-in pages (owner and supplier): one quiet card in the middle */
.auth { display: grid; place-items: start center; padding-top: 7vh; }
.auth-card {
  width: min(440px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 28px 28px 22px; display: grid; gap: 14px; box-shadow: 0 10px 30px rgb(0 0 0 / 0.05);
}
.auth-card h1 { font-size: 1.4rem; margin: 0; }
.auth-card .lead { margin: 0; font-size: 0.95rem; }
.auth-logo { width: 40px; height: 40px; }
.btn-block { width: 100%; padding: 11px 15px; }
.auth-facts { list-style: none; margin: 4px 0 0; padding: 14px 0 0; border-top: 1px solid var(--line-soft); display: grid; gap: 6px; font-size: 0.86rem; color: var(--muted); }
.auth-facts li::before { content: "✓"; color: var(--success); font-weight: 700; margin-right: 8px; }
.auth-help { width: min(440px, 100%); margin-top: 14px; font-size: 0.86rem; }
.auth-help summary { cursor: pointer; color: var(--muted); }
.auth-help ul, .auth-help ol { padding-left: 20px; display: grid; gap: 6px; color: var(--muted); }

/* the supplier's page: one card per shop, tables for invoices and payments */
.supplier-page { max-width: 960px; margin: 0 auto; }
.shop-card { padding: 0; overflow: hidden; }
.shop-card .card-head { padding: 16px 18px; border-bottom: 1px solid var(--line); display: grid; gap: 2px; }
.shop-card .card-head h2 { margin: 0; }
.shop-card .confirm, .shop-card > .notice { margin: 14px 18px 0; }
.shop-card h3 { margin: 18px 18px 6px; font-size: 0.8rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.shop-card .card-foot { border-top: 1px solid var(--line-soft); }

/* signed out of the hub: said on every page, with the way back */
.signin-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px 16px; flex-wrap: wrap;
  margin: 0 0 16px; padding: 12px 16px; border-radius: var(--radius);
  background: var(--warn-soft); border: 1px solid var(--warn); color: var(--warn-ink); font-size: 0.9rem;
}

/* sidebar groups and buttons that open tools */
button.side-link { font: inherit; border: 0; background: none; width: 100%; text-align: left; cursor: pointer; }
.side-group { margin: 14px 10px 4px; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }
.live-mark { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.page-sub { margin: 4px 0 0; }

/* tools over the page */
.modal {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 64px); padding: 20px 22px; border: 1px solid var(--line);
  border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: 0 24px 60px rgb(0 0 0 / 0.25);
}
.modal::backdrop { background: rgb(2 6 23 / 0.45); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.modal-head h2 { margin: 2px 0 0; font-size: 1.15rem; }
.modal h3 { font-size: 0.8rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; }
.modal .card { border: 0; padding: 0; }
.modal label { display: grid; gap: 6px; font-weight: 600; font-size: 0.9rem; }
.modal select { font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); }

/* the agent's console, like a terminal: GitHub's dark colors in the dark theme, its light ones in
   the light theme (which records better on video), in the font of Windows Terminal */
.terminal {
  --t-bg: #0d1117; --t-bar: #161b22; --t-line: #1f2733; --t-text: #c9d1d9; --t-strong: #e6edf3;
  --t-muted: #8b949e; --t-dim: #7d8590; --t-blue: #58a6ff; --t-green: #3fb950; --t-amber: #d29922;
  --t-amber-text: #e3b341; --t-red: #f85149; --t-purple: #d2a8ff; --t-tool: #79c0ff; --t-tool-text: #a5d6ff;
  --t-font: "Cascadia Mono", var(--mono);
  border-radius: 12px; overflow: hidden; background: var(--t-bg); border: 1px solid var(--t-line);
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.12);
}
/* on a wide screen the activity page fits below the top bar (56px) and the page padding (26px + 96px):
   the terminal takes whatever the header and the journal strip leave */
@media (min-width: 901px) {
  .page[data-page="activity"] { height: calc(100vh - 178px); grid-template-rows: auto auto minmax(0, 1fr); }
  .page[data-page="activity"] .terminal { display: flex; flex-direction: column; min-height: 0; }
  .page[data-page="activity"] .terminal-log { height: auto; flex: 1; }
}
:root[data-theme="light"] .terminal {
  --t-bg: #f6f8fa; --t-bar: #eaeef2; --t-line: #d0d7de; --t-text: #1f2328; --t-strong: #1f2328;
  --t-muted: #59636e; --t-dim: #656d76; --t-blue: #0969da; --t-green: #1a7f37; --t-amber: #9a6700;
  --t-amber-text: #9a6700; --t-red: #cf222e; --t-purple: #8250df; --t-tool: #0550ae; --t-tool-text: #0a3069;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .terminal {
    --t-bg: #f6f8fa; --t-bar: #eaeef2; --t-line: #d0d7de; --t-text: #1f2328; --t-strong: #1f2328;
    --t-muted: #59636e; --t-dim: #656d76; --t-blue: #0969da; --t-green: #1a7f37; --t-amber: #9a6700;
    --t-amber-text: #9a6700; --t-red: #cf222e; --t-purple: #8250df; --t-tool: #0550ae; --t-tool-text: #0a3069;
  }
}
.terminal-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--t-bar); border-bottom: 1px solid var(--t-line); }
.terminal-dots { display: inline-flex; gap: 6px; }
.terminal-dots i { width: 11px; height: 11px; border-radius: 50%; background: #30363d; }
.terminal-dots i:nth-child(1) { background: #f85149; }
.terminal-dots i:nth-child(2) { background: #d29922; }
.terminal-dots i:nth-child(3) { background: #3fb950; }
.terminal-title { font: 0.8rem var(--t-font); color: var(--t-muted); flex: 1; }
.terminal .live { color: var(--t-muted); font-family: var(--t-font); }
.terminal-log {
  height: calc(100vh - 250px); min-height: 360px; overflow-y: auto; padding: 14px 16px 18px; display: block;
  font: 0.86rem/1.6 var(--t-font); color: var(--t-text);
}
.t-line { display: grid; grid-template-columns: 5.6em 5.4em minmax(0, 1fr); gap: 10px; padding: 1px 0; }
.t-time { color: var(--t-dim); }
.t-tag { font-weight: 700; color: var(--t-muted); }
.t-text { overflow-wrap: anywhere; white-space: pre-wrap; }
.t-text a { color: var(--t-blue); }
.t-day { color: var(--t-dim); text-align: center; margin: 10px 0 6px; }
.t-line.wake .t-tag { color: var(--t-purple); }
.t-line.wake { margin-top: 8px; }
.t-line.agent .t-tag, .t-line.say .t-tag { color: var(--t-blue); }
.t-line.say .t-text { color: var(--t-strong); }
.t-line.ok .t-tag { color: var(--t-green); }
.t-line.ask .t-tag { color: var(--t-amber); }
.t-line.bad .t-tag, .t-line.bad .t-text { color: var(--t-red); }
.t-line.dim, .t-line.dim .t-tag { color: var(--t-dim); }
.t-line.note .t-tag { color: var(--t-muted); }
.t-line.tool .t-tag { color: var(--t-tool); }
.t-line.tool .t-text { color: var(--t-tool-text); }
.t-line.refused .t-tag { color: var(--t-amber); }
.t-line.refused .t-text { color: var(--t-amber-text); }
.t-text.typing::after { content: "▋"; color: var(--t-green); margin-left: 1px; animation: blink 1s steps(1) infinite; }
/* the cursor says what the live dot says: amber and blinking while the agent works, steady green once done */
.terminal-log::after { content: "▋"; display: block; color: var(--t-green); margin-top: 4px; }
.terminal-log.working::after { color: var(--t-amber); animation: blink 1s steps(1) infinite; }
.terminal .dot.working { background: var(--t-amber); }
.terminal .dot.done { background: var(--t-green); }
@media (prefers-reduced-motion: reduce) { .terminal-log.working::after { animation: none; } }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .terminal-log::after, .t-text.typing::after { animation: none; } }

/* settings: each part a card */
.settings-page > section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; max-width: 760px; }
.settings-page > section h3 { margin: 0 0 10px; font-size: 0.98rem; }
.settings-page .card { border: 0; padding: 0; }
.settings-page .facts { max-width: 420px; }

/* one bill's details, beside the list */
.bill-drawer {
  position: fixed; top: 56px; right: 0; bottom: 0; width: min(480px, 100%); z-index: 20; overflow-y: auto;
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: -10px 0 30px rgb(0 0 0 / 0.07);
  padding: 20px 22px; display: grid; align-content: start; gap: 14px;
}
.bill-drawer .drawer-head { align-items: flex-start; gap: 12px; }
.bill-drawer h2 { margin: 0 0 2px; font-size: 1.1rem; }
.bill-drawer .task { padding: 0; border: 0; gap: 12px; }
.bill-drawer .task-head { display: none; }

/* the chat: closed until the owner asks */
.chat-dock { position: fixed; right: 24px; bottom: 22px; z-index: 30; display: grid; justify-items: end; gap: 10px; }
.chat-launch {
  font: inherit; font-weight: 600; cursor: pointer; padding: 10px 18px; border-radius: 999px;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); box-shadow: 0 4px 14px rgb(0 0 0 / 0.1);
}
.chat-launch:hover { border-color: var(--accent); color: var(--accent-ink); }
/* new messages from the agent, like any chat */
.chat-launch { position: relative; }
.chat-unread {
  position: absolute; top: -7px; right: -7px; min-width: 20px; height: 20px; padding: 0 6px;
  display: grid; place-items: center; border-radius: 999px; font-size: 0.72rem; font-weight: 700;
  background: var(--danger-solid); color: #ffffff; box-shadow: 0 0 0 2px var(--surface);
}
.chat-unread[hidden] { display: none; }
.chat-panel {
  width: min(400px, calc(100vw - 32px)); height: min(560px, calc(100vh - 120px)); display: flex; flex-direction: column;
  background: var(--chat-bg); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  box-shadow: 0 12px 36px rgb(0 0 0 / 0.16);
}
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--line); }
.chat-head h2 { margin: 0; font-size: 0.95rem; }
.tag-testnet {
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--warn-ink); background: var(--warn-soft); border-radius: 3px; padding: 0 4px;
}
.tag-mode {
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  border-radius: 3px; padding: 1px 6px; cursor: help;
}
.tag-mode.draft { color: var(--accent-ink); background: var(--accent-soft); border: 1px solid var(--accent-line); }
.tag-mode.submitted { color: var(--danger); background: var(--danger-soft); border: 1px solid var(--danger-line); }
.draft-mode { margin: 12px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }
.draft-mode p { margin: 0 0 6px; }
.agent-switch .state { font-weight: 600; font-size: 0.86rem; display: inline-flex; align-items: center; gap: 7px; }
.agent-switch .state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.agent-note { margin: 0 0 12px; }
.agent-note:empty { display: none; }
#not-owner { margin: 0 0 12px; }

.tabs { display: flex; flex-wrap: wrap; gap: 4px 18px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.tab {
  font: inherit; font-size: 0.9rem; font-weight: 500; border: 0; background: none; color: var(--muted);
  cursor: pointer; padding: 13px 0 11px; white-space: nowrap; box-shadow: inset 0 -2px 0 transparent;
}
.tab[aria-selected="true"] { color: var(--text); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
.tab .n { font-size: 0.8rem; margin-left: 5px; color: var(--muted); }
.tab.urgent .n { background: var(--accent); color: var(--on-accent); border-radius: 999px; padding: 0 6px; }
#work-setup:empty { display: none; }
#tab-suppliers, #tab-payments { display: grid; gap: 18px; align-content: start; }
#tasks-summary { margin: 0; padding: 16px; }
#tasks-summary:empty { display: none; }
#tab-suppliers .card h2, #tab-payments .card h2 { font-size: 0.98rem; margin-bottom: 6px; }
.page .list li { padding: 10px 12px; font-size: 0.9rem; }
.page .list .btn { padding: 5px 10px; font-size: 0.8rem; }
.page .list .row { margin: 0; }

/* the agent's activity: a calm timeline, sessions of Claude as cards */
.feed-fold .line { display: grid; grid-template-columns: 3.4em 4.6em minmax(0, 1fr); gap: 8px; line-height: 1.45; }
.feed-fold .line .time { font-family: var(--mono); font-size: 0.8rem; color: var(--faint); padding-top: 2px; }
.feed-fold .who { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em; color: var(--faint); padding-top: 3px; }
.who-AGENT { color: var(--accent-ink) !important; }
.who-CONTRACT { color: var(--success) !important; }
.who-GUARD, .who-ERROR { color: var(--danger) !important; }
.who-SUPPLIER, .who-YOU { color: var(--text) !important; }
.session {
  border: 1px solid var(--accent-line); background: var(--accent-soft); border-radius: 10px;
  padding: 10px 12px; display: grid; gap: 6px;
}
.session-head { display: flex; align-items: center; gap: 8px; }
.session-head b { font-size: 0.86rem; }
.session-head .meta { margin-left: auto; font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }
.session .mark-c {
  width: 20px; height: 20px; border-radius: 6px; background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center; font-size: 0.8rem; font-weight: 700;
}
.session .item { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 8px; }
.session .item .ic { font-weight: 700; color: var(--accent-ink); }
.session .item.held .ic { color: var(--danger); }
.session .item.paid .ic { color: var(--success); }
.session .item.note .ic { color: var(--muted); }
.session .item .choice { font-size: 0.8rem; font-weight: 700; }
.session .item.held .choice { color: var(--danger); }
.session .item.paid .choice { color: var(--success); }
.session .item.ask .choice { color: var(--accent-ink); }
.session .said { border-top: 1px solid var(--accent-line); padding-top: 6px; color: var(--text); }

/* the chat */
.chat-panel .chat-form { background: var(--surface); }
.chat-log { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; display: grid; align-content: start; gap: 10px; }
.chat-log .empty { color: var(--muted); font-size: 0.86rem; }
/* weight 500: Segoe UI at 400 looks thin on Windows screens and on video */
.bubble { max-width: 90%; padding: 9px 12px; border-radius: 12px; font-size: 1rem; font-weight: 500; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.me { justify-self: end; background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 4px; }
.bubble.agent { justify-self: start; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble.system { justify-self: start; background: var(--warn-soft); color: var(--warn-ink); }
.bubble .meta { display: block; margin-top: 4px; font: 0.8rem var(--mono); color: var(--muted); }
.bubble.me .meta { color: inherit; opacity: 1; }
.bubble a { font-family: var(--mono); font-size: 0.85em; }
.bubble.me a { color: inherit; text-decoration: underline; }
.chat-status { flex: none; margin: 0; padding: 0 16px; }
.chat-status:empty { display: none; }
.chat-status.working::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 8px;
  border-radius: 50%; background: currentColor; vertical-align: middle;
  box-shadow: 10px 0 0 currentColor, 20px 0 0 currentColor; margin-right: 28px;
  animation: working 1.2s ease-in-out infinite; }
@keyframes working { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .chat-status.working::before { animation: none; } }
.chat-form { flex: none; display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface); }
.chat-form input { flex: 1; min-width: 0; font-weight: 500; }

/* live dot */
.live { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 0.8rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
/* amber and pulsing while the agent works, green once it is done */
.dot.working { background: var(--warn); animation: pulse 1.2s infinite; }
.dot.done { background: var(--success); }
@keyframes pulse { 70% { box-shadow: 0 0 0 6px transparent; } 0% { box-shadow: 0 0 0 0 var(--warn-soft); } }
@media (prefers-reduced-motion: reduce) { .dot.working { animation: none; } }

/* settings aside */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.scrim { position: fixed; inset: 0; background: rgba(2, 6, 23, 0.45); z-index: 9; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100%); z-index: 10; overflow-y: auto;
  background: var(--surface); border-left: 1px solid var(--line); padding: 20px; display: grid; align-content: start; gap: 22px;
}
.drawer-head { display: flex; justify-content: space-between; align-items: center; }
.drawer-head h2 { margin: 0; }
.drawer h3 { margin: 0 0 8px; font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.drawer .card { border: 0; padding: 0; }

/* phone and small screens: the pages as a row of links on top, tables scroll sideways */
@media (max-width: 900px) {
  .console { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side-shop { width: 100%; padding-bottom: 6px; }
  .side-foot { margin: 0; width: 100%; border-top: 0; padding: 6px 10px 0; display: flex; flex-wrap: wrap; align-items: center; }
  .pages { padding: 18px 16px 96px; }
  .numbers, .two-cols { grid-template-columns: minmax(0, 1fr); }
  .table-card, .card.bills { overflow-x: auto; }
  .bill-drawer { top: 0; }
}

/* Which chains the agent can pay from: one row per chain with its switch. */
.chains-card { margin-top: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); display: grid; gap: 12px; }
.chain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.chain-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: 10px; background: var(--surface); cursor: pointer; }
.chain-badge { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--on-muted); font-weight: 700; background: var(--muted); }
.chain-logo { flex: none; width: 32px; height: 32px; border-radius: 8px; object-fit: contain; }
.chain-name { flex: 1; display: grid; gap: 2px; min-width: 0; }
.switch { appearance: none; flex: none; width: 40px; height: 22px; margin: 0; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; transition: background 0.15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(18px); }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Activity: what the agent and the contract did */
.activity-log { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 14px 16px; display: grid; align-content: start; gap: 8px; }
.activity-log .empty { color: var(--muted); font-size: 0.86rem; }
.activity-log .day { justify-self: center; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); margin-top: 4px; }
.feed-money, .feed-note, .feed-fold > summary {
  display: flex; align-items: baseline; gap: 8px; font-size: 0.9rem; line-height: 1.4;
}
.feed-money .what, .feed-note .what, .feed-fold .what { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.activity-log .time, .chat-log .feed-money .time { flex: none; font: 0.8rem var(--mono); color: var(--faint); }
.feed-money {
  justify-self: center; width: min(100%, 520px); padding: 7px 12px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--success); color: var(--text);
}
.feed-money .ic { color: var(--success); font-weight: 700; }
.feed-money a { font-family: var(--mono); font-size: 0.85em; }
.feed-note { justify-self: center; width: min(100%, 520px); padding: 4px 12px; color: var(--muted); }
.feed-note.bad { color: var(--danger); }
.feed-fold { justify-self: center; width: min(100%, 520px); color: var(--muted); }
.feed-fold > summary { cursor: pointer; padding: 3px 12px; list-style: none; border-radius: 8px; }
.feed-fold > summary::-webkit-details-marker { display: none; }
.feed-fold > summary::before { content: "▸"; font-size: 0.8rem; color: var(--faint); }
.feed-fold[open] > summary::before { content: "▾"; }
.feed-fold > summary:hover { background: var(--line-soft); }
.feed-fold[open] { display: grid; gap: 6px; padding-bottom: 6px; }
.feed-fold[open] > .line, .feed-fold[open] > .session { margin: 0 12px; font-size: 0.9rem; }

/* what is happening, inside the open tool */
.modal-notice { margin: 0 0 14px; }

/* the agent's question in the chat: who and how much, the question, two answers */
.ask-card { display: grid; gap: 6px; border-color: var(--accent-line); }
.ask-title { font-weight: 600; font-size: 0.82rem; color: var(--accent-ink); }
.ask-card .row { margin-top: 4px; }
.receipt-why { display: block; margin-top: 2px; color: var(--muted); font-size: 0.9rem; }

/* the journal: checked against Arc, and what the agent read behind each receipt */
.journal-check { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
  padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.journal-status { margin: 0; flex: 1 1 320px; color: var(--muted); font-size: 0.9rem; line-height: 1.45; }
.journal-status.ok { color: var(--success); font-weight: 600; }
.journal-status.bad { color: var(--danger); font-weight: 600; }
.journal-check .row { margin: 0; }
.audit-pick { display: grid; gap: 8px; margin-bottom: 10px; }
#audit-rows td { padding: 10px 16px; border-bottom: 1px solid var(--line-soft); }
.receipt-seen { margin-top: 4px; font-size: 0.9rem; }
.receipt-seen > summary { cursor: pointer; color: var(--accent-ink); }
.receipt-seen .hint { margin: 4px 0; }
.seen-step { margin: 2px 0; font-family: var(--mono); font-size: 0.8rem; overflow-wrap: anywhere; }
.seen-step > summary { cursor: pointer; }
.seen-step pre { margin: 4px 0 6px; padding: 8px; max-height: 260px; overflow: auto; white-space: pre-wrap;
  background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 8px; font: 0.8rem/1.45 var(--mono); }
.copy-button { display: inline-flex; align-items: center; vertical-align: middle; background: none; border: 0;
  padding: 2px; margin-left: 4px; border-radius: 4px; font: inherit; color: var(--muted); cursor: pointer; }
.copy-button:hover { color: var(--accent-ink); }
.copy-button:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 1px; }

/* One decision on the audit page: a white sheet in any theme, the same on screen and on paper */
.decision-report {
  /* the light theme's colors, whatever the page uses around the sheet */
  --surface: #ffffff; --surface-2: #f6f7f9; --line: #d9dde3; --line-soft: #eceef1; --text: #111827;
  --muted: #4b5563; --faint: #646b78; --accent-ink: #1d4ed8; --success: #047857; --danger: #b91c1c;
  color: var(--text); background: var(--surface); color-scheme: light;
  max-width: 190mm; margin: 12px auto 0; padding: 14mm 14mm 12mm; display: grid; gap: 12px;
  border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
  font-size: 0.95rem;
}
.decision-report a { color: var(--accent-ink); }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  padding-bottom: 10px; border-bottom: 2px solid var(--text); }
.sheet-kind { margin: 0; font-size: 0.78em; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.sheet-head .report-title { margin-top: 4px; }
.stamp { flex: none; margin: 0; padding: 6px 10px; border: 2px solid currentColor; border-radius: 6px;
  font-size: 0.85em; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; text-align: center;
  line-height: 1.3; transform: rotate(-2deg); }
.stamp small { display: block; font-weight: 600; letter-spacing: 0; text-transform: none; }
.stamp.ok { color: var(--success); }
.stamp.bad { color: var(--danger); }
.stamp.plain { color: var(--muted); }
.sheet-alert { margin: 0; padding: 8px 10px; border: 1px solid var(--danger); color: var(--danger); border-radius: 4px; }
.sheet-facts { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; }
.sheet-facts dt { color: var(--muted); }
.sheet-facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.sheet-facts .mono { font-weight: 500; font-size: 0.9em; }
.sheet-verify { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: start;
  padding-top: 10px; border-top: 1px solid var(--line); }
.sheet-verify p { margin: 0 0 4px; font-size: 0.9em; line-height: 1.45; }
.sheet-qr { margin: 0; width: 30mm; text-align: center; font-size: 0.8em; color: var(--muted); }
.sheet-qr svg { width: 30mm; height: 30mm; display: block; }
.sheet-foot { margin: 0; font-size: 0.85em; color: var(--muted); }
.print-only { display: none; }
.report-title { margin: 0; font-size: 1.3em; line-height: 1.3; }
.decision-report .hint { margin: 0; color: var(--muted); font-size: 0.9em; }
.report-part h3 { margin: 0 0 6px; font-size: 0.85em; font-weight: 600; color: var(--muted); letter-spacing: 0.06em;
  text-transform: uppercase; }
.report-part p { margin: 0 0 6px; line-height: 1.5; }
.report-checks, .report-checklist { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.report-steps { margin: 0 0 8px; padding-left: 20px; display: grid; gap: 4px; }
.report-steps summary { cursor: pointer; }
.report-read { margin: 6px 0; padding: 8px 10px; display: grid; gap: 4px; background: var(--surface-2);
  border: 1px solid var(--line-soft); border-radius: 8px; font-size: 0.85rem; }
.report-read div { display: grid; grid-template-columns: minmax(110px, 30%) 1fr; gap: 10px; }
.report-read dt { color: var(--muted); }
.report-read dd { margin: 0; overflow-wrap: anywhere; }
@page { margin: 12mm; }
@media print {
  .topbar, .no-print, .audit-pick, .audit-pick + .hint { display: none; }
  /* with a decision open, the paper holds the sheet and nothing else */
  .page:has(.decision-report:not([hidden])) > :not(.decision-report) { display: none; }
  html, body, main, .container, .page { background: #fff !important; min-height: 0 !important; height: auto !important;
    padding: 0 !important; margin: 0 !important; max-width: none !important; }
  .decision-report { max-width: none; margin: 0; padding: 0; border: 0; box-shadow: none; font-size: 8.5pt; gap: 6px; }
  .decision-report .report-part { break-inside: avoid; }
  .decision-report .report-part h3 { margin-bottom: 2px; }
  .decision-report .report-part p { margin-bottom: 2px; line-height: 1.35; }
  .report-checks, .report-checklist { gap: 1px; }
  .sheet-facts { gap: 1px 14px; }
  .sheet-head { padding: 2mm 1mm 6px 0; }  /* room for the tilted stamp */
  .sheet-verify { break-inside: avoid; gap: 10px; padding-top: 6px; }
  .sheet-qr, .sheet-qr svg { width: 24mm; }
  .sheet-qr svg { height: 24mm; }
  .print-only { display: block; }
  .sheet-verify.print-only { display: grid; }
}
