/* Layout: header with market switch, step rail, main column + sticky summary (stacks on small screens). */
:root {
  --bg: #f3f6f2;
  --surface: #ffffff;
  --surface-2: #eaf0eb;
  --ink: #15211b;
  --muted: #5a6a61;
  --line: #d6e0d8;
  --primary: #0e6b4f;
  --primary-ink: #0b5940;
  --on-primary: #ffffff;
  --accent: #d99a00;
  --pass: #1b7f3a; --pass-bg: #e3f3e7;
  --cond: #2a6a94; --cond-bg: #e4eff7;
  --warn: #9a6200; --warn-bg: #fbf0d9;
  --fail: #b8322a; --fail-bg: #fbe6e3;
  --shadow: 0 1px 2px rgba(20, 40, 30, .06), 0 4px 16px rgba(20, 40, 30, .05);
  --f-display: 'Bricolage Grotesque', 'Inter', system-ui, sans-serif;
  --f-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  --r: 12px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1411; --surface: #16201b; --surface-2: #1d2a23; --ink: #e5eee8; --muted: #9aaca2; --line: #2a3a31;
    --primary: #39b789; --primary-ink: #5fcfa3; --on-primary: #06221a; --accent: #f0b429;
    --pass: #5fd07f; --pass-bg: #173322; --cond: #7cb9e3; --cond-bg: #172a38; --warn: #f0b85a; --warn-bg: #33270f; --fail: #ff8a7d; --fail-bg: #3a1a17;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1411; --surface: #16201b; --surface-2: #1d2a23; --ink: #e5eee8; --muted: #9aaca2; --line: #2a3a31;
  --primary: #39b789; --primary-ink: #5fcfa3; --on-primary: #06221a; --accent: #f0b429;
  --pass: #5fd07f; --pass-bg: #173322; --cond: #7cb9e3; --cond-bg: #172a38; --warn: #f0b85a; --warn-bg: #33270f; --fail: #ff8a7d; --fail-bg: #3a1a17;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--f-body); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); }
h1, h2, h3 { font-family: var(--f-display); text-wrap: balance; margin: 0; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.25rem); font-weight: 800; line-height: 1.1; }
.h3 { font-size: 1.05rem; font-weight: 600; margin-bottom: .75rem; }
p { margin: 0; }
.mono { font-family: var(--f-mono); font-size: .85em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; }

/* Header */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1240px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding-block: 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand b { font-family: var(--f-display); font-size: 1.25rem; font-weight: 800; display: block; line-height: 1; }
.brand .dotin { color: var(--accent); }
.brand small { color: var(--muted); font-size: .75rem; letter-spacing: .04em; }
.markets { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 999px; overflow-x: auto; max-width: 100%; }
.market { border: 0; background: transparent; padding: 7px 14px; border-radius: 999px; cursor: pointer; font-weight: 600; white-space: nowrap; }
.market small { font-weight: 500; color: var(--muted); font-size: .72rem; margin-left: 3px; }
.market[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }
.market[aria-pressed="true"] small { color: inherit; opacity: .8; }

/* Main */
.wrap { max-width: 1240px; margin: 0 auto; padding-block: 20px 60px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.steps { list-style: none; margin: 0 0 20px; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.step { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 10px 12px; cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--muted); }
.step .sn { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-family: var(--f-mono); font-size: .8rem; }
.step.is-active { border-color: var(--primary); color: var(--ink); box-shadow: inset 0 -3px 0 var(--primary); }
.step.is-active .sn { background: var(--primary); color: var(--on-primary); }
.step.is-done .sn { background: var(--pass-bg); color: var(--pass); }
.step:disabled { opacity: .5; cursor: not-allowed; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 20px; align-items: start; }
.content { min-width: 0; display: grid; gap: 16px; }
.panel { display: grid; gap: 16px; min-width: 0; }
.side { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 80px); display: grid; gap: 12px; }
.phead { display: grid; gap: 6px; padding: 4px 2px; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 700; color: var(--primary-ink); }
.lede { color: var(--muted); max-width: 65ch; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.pad { padding: 16px 18px; }
.pad-x { margin: 0 18px 12px; }
.cards { gap: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid2 .wide { grid-column: 1 / -1; }

.field { display: grid; gap: 6px; min-width: 0; }
.field label, .label-row label { font-weight: 600; font-size: .85rem; }
.field.inline { display: flex; align-items: center; gap: 8px; }
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.label-row .h3 { margin: 0; }
input, select, textarea { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; min-width: 0; }
textarea { resize: vertical; line-height: 1.45; }
#ingredients { font-family: var(--f-mono); font-size: .88rem; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
.f-color input { height: 42px; padding: 3px; cursor: pointer; }
.numin { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: hidden; }
.numin input { border: 0; width: 6.5em; text-align: right; padding: 6px 6px; box-shadow: none; }
.numin span { padding: 0 9px 0 2px; color: var(--muted); font-size: .85rem; }
.numin:focus-within { border-color: var(--primary); }
.hint { color: var(--muted); font-size: .84rem; margin-top: 8px; }
.hint.right { text-align: right; }

.btn, .btn-ghost { border-radius: 9px; padding: 10px 18px; font-weight: 600; cursor: pointer; border: 1px solid var(--primary); }
.btn { background: var(--primary); color: var(--on-primary); }
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--primary-ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--primary); }
.link { background: none; border: 0; color: var(--primary-ink); font-weight: 600; cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 2px; }
.actions { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.actions .btn:only-child { margin-left: auto; }
.samples { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.samples .btn-ghost { padding: 6px 12px; font-size: .85rem; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; gap: 5px; align-items: baseline; border: 1px solid var(--line); background: var(--surface-2); padding: 4px 10px; border-radius: 999px; font-size: .84rem; max-width: 100%; overflow-wrap: anywhere; }
.chip i { font-style: normal; color: var(--cond); }
.chip-fail { background: var(--fail-bg); border-color: var(--fail); color: var(--fail); }
.chip-warn { background: var(--warn-bg); border-color: var(--warn); }
.chip-al { background: var(--warn-bg); border-color: transparent; font-weight: 600; }
.chip-ok { background: var(--pass-bg); border-color: transparent; color: var(--pass); font-weight: 600; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 700; white-space: nowrap; }
.pill-ok, .pill-pass { background: var(--pass-bg); color: var(--pass); }
.pill-cond { background: var(--cond-bg); color: var(--cond); }
.pill-verify, .pill-review { background: var(--warn-bg); color: var(--warn); }
.pill-ban, .pill-fail { background: var(--fail-bg); color: var(--fail); }

.verdict { display: flex; gap: 16px; align-items: flex-start; border-radius: var(--r); padding: 18px; border: 1px solid; }
.verdict h3 { font-size: 1.3rem; margin-bottom: 4px; }
.v-badge { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 1.4rem; font-weight: 800; color: #fff; }
.verdict-pass { background: var(--pass-bg); border-color: var(--pass); } .verdict-pass .v-badge { background: var(--pass); }
.verdict-review { background: var(--warn-bg); border-color: var(--warn); } .verdict-review .v-badge { background: var(--warn); }
.verdict-fail { background: var(--fail-bg); border-color: var(--fail); } .verdict-fail .v-badge { background: var(--fail); }
:root .verdict .v-badge { color: var(--surface); }
.counts { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: .85rem; }

.table-scroll { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th, .tbl td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl thead th { background: var(--surface-2); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.tbl tr.grp th { background: var(--surface-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--primary-ink); }
.ntbl th[scope="row"] { font-weight: 500; }
.ntbl td.num, .ntbl th:not(:first-child) { text-align: right; }
.ntbl td:nth-child(2) { text-align: right; }
.ntbl tr.calc { background: color-mix(in srgb, var(--surface-2) 50%, transparent); }

.list { margin: 0; padding-left: 1.1rem; display: grid; gap: 6px; }
.list.check { list-style: none; padding: 0; }
.list.check li { padding-left: 24px; position: relative; }
.list.check li::before { content: ""; position: absolute; left: 2px; top: .35em; width: 12px; height: 12px; border: 2px solid var(--primary); border-radius: 3px; }
.adv-warn { color: var(--fail); font-weight: 600; }
.vegline { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: .9rem; font-weight: 600; }
.ack { display: flex; gap: 10px; align-items: flex-start; background: var(--warn-bg); padding: 14px; border-radius: var(--r); font-weight: 500; }
.ack input { width: auto; margin-top: 3px; }
details.card summary { cursor: pointer; font-weight: 600; }
details.card[open] summary { margin-bottom: 10px; }

.tls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.tl { border-radius: 10px; padding: 10px 6px; text-align: center; font-size: .72rem; font-weight: 700; letter-spacing: .05em; color: #1b1b1b; }
.tl b { display: block; font-size: .85rem; letter-spacing: 0; margin-bottom: 2px; }
.tl-low { background: #8fd16a; } .tl-medium { background: #ffc444; } .tl-high { background: #f0605a; color: #fff; }

.side-card { display: grid; gap: 4px; }
.sum-row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: .88rem; }
.sum-row .k { color: var(--muted); }
.sum-row .v { text-align: right; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.sum-markets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.mk-mini { display: flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px; padding: 6px 4px; font-weight: 700; font-size: .8rem; cursor: pointer; }
.dot { width: 9px; height: 9px; border-radius: 50%; }
.dot-pass { background: var(--pass); } .dot-review { background: var(--warn); } .dot-fail { background: var(--fail); }
.sum-note { font-size: .76rem; color: var(--muted); margin-top: 6px; }
.disclaimer { font-size: .76rem; color: var(--muted); padding: 0 4px; }

.preview-card { display: grid; gap: 10px; }
.preview { background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 0 0 / 20px 20px; border-radius: 8px; padding: 12px; overflow: hidden; }
.preview svg { width: 100%; height: auto; display: block; box-shadow: var(--shadow); }
.warnlist { margin: 0; padding: 10px 14px 10px 30px; background: var(--warn-bg); border-radius: 8px; font-size: .86rem; display: grid; gap: 4px; }
.dl { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Front / back panel preview */
.pv-tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 10px; justify-self: start; }
.pv-tab { border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600; font-size: .85rem; padding: 7px 14px; border-radius: 7px; cursor: pointer; }
.pv-tab[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.pv-grid { display: grid; gap: 16px; align-items: start; }
.pv-fig { margin: 0; display: grid; gap: 6px; min-width: 0; }
.pv-fig figcaption { display: flex; justify-content: space-between; gap: 8px; font-size: .8rem; color: var(--muted); }
.pv-fig figcaption b { color: var(--ink); }
.pv-fig svg { border-radius: 4px; }
@media (max-width: 760px) { .pv-grid { grid-template-columns: minmax(0, 1fr) !important; } .pv-grid .pv-fig:first-child svg { max-width: 360px; margin: 0 auto; } }

/* Brand logo upload */
.flabel { font-weight: 600; font-size: .85rem; }
.logo-drop { display: flex; gap: 14px; align-items: center; padding: 16px; border: 1.5px dashed var(--line); border-radius: 10px; background: var(--surface-2); color: var(--primary-ink); cursor: pointer; }
.logo-drop:hover, .logo-drop.is-over, .logo-drop:focus-within { border-color: var(--primary); }
.logo-drop span { display: grid; gap: 2px; color: var(--ink); }
.logo-drop small { color: var(--muted); font-size: .8rem; }
.logo-has { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.logo-thumb { width: 132px; height: 72px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: #fff; }
.logo-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.logo-acts label.btn-ghost { cursor: pointer; }
.logo-acts select { width: auto; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; z-index: 20; max-width: calc(100% - 32px); }

/* Claude */
:root { --ai: #6b4fd8; --ai-bg: #efebfc; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --ai: #b5a4ff; --ai-bg: #241d3f; } }
:root[data-theme="dark"] { --ai: #b5a4ff; --ai-bg: #241d3f; }
.ai-chip { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; padding: 5px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); margin-left: auto; }
.ai-chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.ai-chip.ai-artifact, .ai-chip.ai-server { background: var(--ai-bg); color: var(--ai); }
.ai-chip.ai-artifact::before, .ai-chip.ai-server::before { background: var(--ai); }
.ai-card { border-color: color-mix(in srgb, var(--ai) 35%, var(--line)); }
.ai-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.ai-head > div { flex: 1 1 280px; min-width: 0; }
.ai-head .hint { margin-top: 2px; }
.btn-ai { border: 0; border-radius: 9px; padding: 10px 16px; font-weight: 700; cursor: pointer; background: var(--ai); color: #fff; white-space: nowrap; }
.btn-ai:disabled { opacity: .7; cursor: progress; }
.btn-ai:hover:not(:disabled) { filter: brightness(1.1); }
.ai-inline { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 10px; padding: 10px 12px; background: var(--ai-bg); border-radius: 8px; }
.ai-note { margin-top: 12px; padding: 10px 12px; background: var(--ai-bg); border-radius: 8px; font-size: .9rem; }
.by-claude { display: inline-block; font-size: .68rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--ai); background: var(--ai-bg); padding: 1px 6px; border-radius: 4px; vertical-align: 1px; }
.h4 { font-size: .95rem; font-weight: 600; margin: 0 0 6px; font-family: var(--f-display); }
.issues { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.issues li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }
.issues li > div { min-width: 0; }
.suggest { display: grid; gap: 6px; margin-top: 10px; }
.ai-off { margin: 0; }

/* Tablet */
@media (max-width: 1000px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; order: -1; }
  .side-card { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 18px; }
  .side-card .h3, .sum-markets, .sum-note { grid-column: 1 / -1; }
  #sum { display: contents; }
}
/* Phone */
@media (max-width: 640px) {
  .steps { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  .step { flex-direction: column; gap: 4px; padding: 8px 4px; text-align: center; font-size: .7rem; line-height: 1.2; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .side-card { grid-template-columns: minmax(0, 1fr); }
  .markets { width: 100%; justify-content: space-between; }
  .market { flex: 1; padding: 7px 6px; }
  .market small { display: none; }
  .ai-chip { order: -1; }
  .btn-ai { width: 100%; }
  .card { padding: 14px; }
  .tbl.stack thead { display: none; }
  .tbl.stack tr { display: block; padding: 10px 14px; border-bottom: 1px solid var(--line); }
  .tbl.stack tr.grp { padding: 0; }
  .tbl.stack td { display: block; border: 0; padding: 3px 0; }
  .tbl.stack tr.grp th { display: block; }
  .tbl.stack td[data-l]::before { content: attr(data-l); display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
  .tbl.stack td[data-l="Status"]::before { display: none; }
  .ntbl th, .ntbl td { padding: 8px 6px; font-size: .84rem; }
  .numin input { width: 4.8em; }
  .tls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .verdict { padding: 14px; }
  .actions .btn, .actions .btn-ghost { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* ---------- Accounts: header bar, save box ---------- */
.acct { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.acct-who { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; margin-right: 4px; }
.acct-who b { display: block; font-size: .85rem; line-height: 1.1; }
.acct-who small { color: var(--muted); font-size: .72rem; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: var(--on-primary); font-weight: 700; font-size: .85rem; flex: none; }
a.btn, a.btn-ghost { text-decoration: none; display: inline-flex; align-items: center; }
.btn-sm { padding: 6px 12px; font-size: .84rem; border-radius: 8px; text-decoration: none; display: inline-flex; align-items: center; white-space: nowrap; }
.btn-danger { background: var(--fail); border-color: var(--fail); color: #fff; }
.danger { color: var(--fail); }
.danger:hover { border-color: var(--fail); }
.save-card { display: grid; gap: 10px; }
.save-row { display: flex; gap: 8px; flex-wrap: wrap; }
.form-err { color: var(--fail); background: var(--fail-bg); border-radius: 8px; padding: 8px 12px; font-size: .88rem; }
.center { text-align: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Login page ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; }
.auth-wrap { width: 100%; max-width: 420px; padding: 32px 16px; display: grid; gap: 18px; }
.auth-brand { justify-self: center; }
.auth-card { display: grid; gap: 18px; padding: 22px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 999px; }
.auth-tab { border: 0; background: transparent; padding: 8px; border-radius: 999px; font-weight: 600; cursor: pointer; }
.auth-tab[aria-selected="true"] { background: var(--primary); color: var(--on-primary); }
.auth-form { display: grid; gap: 14px; }
.auth-h { font-size: 1.5rem; }
.auth-form .btn { width: 100%; }

/* ---------- Dashboards ---------- */
.dash { display: grid; gap: 18px; }
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.dash-head > div { display: grid; gap: 6px; }
.dash-tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.dash-tab { border: 0; background: transparent; padding: 10px 14px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.dash-tab[aria-current="page"] { color: var(--ink); border-bottom-color: var(--primary); }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--warn); color: #fff; font-size: .72rem; margin-left: 4px; }
.dash-body { display: grid; gap: 16px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: grid; gap: 2px; border-top: 3px solid var(--primary); }
.tile-warn { border-top-color: var(--warn); } .tile-pass { border-top-color: var(--pass); } .tile-fail { border-top-color: var(--fail); }
.tile-k { font-size: .8rem; color: var(--muted); font-weight: 600; }
.tile-v { font-family: var(--f-display); font-size: 1.9rem; font-weight: 800; line-height: 1.1; }
.tile-n { font-size: .78rem; color: var(--muted); }
.sec-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.sec-head .h3 { margin: 0; }
.dash-tbl td { vertical-align: middle; }
.dash-tbl tr.is-off td { opacity: .6; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.nowrap { white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 28px 14px !important; }
.note { margin-top: 6px; padding: 6px 10px; border-left: 3px solid var(--fail); background: var(--fail-bg); border-radius: 0 6px 6px 0; }
.sel-sm { padding: 5px 8px; font-size: .85rem; width: auto; max-width: 180px; }
.role { font-size: .8rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); }
.role-admin { background: var(--fail-bg); color: var(--fail); } .role-manager { background: var(--cond-bg); color: var(--cond); }
.banner { background: var(--cond-bg); border: 1px solid var(--cond); border-radius: var(--r); padding: 12px 16px; font-size: .9rem; }
.banner-warn { background: var(--warn-bg); border-color: var(--warn); }
.feed { list-style: none; margin: 0; padding: 0 18px 12px; }
.feed li { padding: 9px 0; border-top: 1px solid var(--line); font-size: .88rem; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: baseline; }
.feed-who { font-weight: 600; }
.feed-d { color: var(--muted); overflow-wrap: anywhere; }
.feed-t { margin-left: auto; color: var(--muted); font-size: .78rem; white-space: nowrap; }
.dlg { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); padding: 0; width: min(460px, calc(100% - 32px)); box-shadow: var(--shadow); }
.dlg::backdrop { background: rgba(10, 20, 15, .45); }
.dlg-form { display: grid; gap: 14px; padding: 20px; }
.dlg-body { display: grid; gap: 12px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; }
@media (max-width: 640px) {
  .row-actions { justify-content: flex-start; padding-top: 6px; }
  .acct-who span:last-child { display: none; }
  .acct { gap: 6px; }
  .acct .btn-sm { padding: 5px 9px; font-size: .8rem; }
  .dash-head .btn { width: 100%; justify-content: center; }
  .dash-tbl td[data-l]::before { content: attr(data-l); display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
  .tile-v { font-size: 1.5rem; }
}

/* ---------- ingredient table ---------- */
.ing-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ing-tools .sel-sm { width: auto; max-width: none; }
.ing-scroll { border: 1px solid var(--line); border-radius: 10px; }
.ing-tbl { min-width: 640px; }
.ing-tbl th, .ing-tbl td { padding: 6px 8px; vertical-align: middle; }
.ing-tbl tbody tr:last-child td { border-bottom: 1px solid var(--line); }
.ing-tbl tfoot td { border-bottom: 0; }
.ing-tbl input[type="text"] { padding: 7px 9px; }
.ing-tbl .ing-n { width: 2.2em; text-align: right; }
.ing-tbl .ing-q { width: 9.5em; }
.ing-tbl .ing-q .numin input { width: 5.5em; }
.ing-tbl .ing-p { width: 6.5em; color: var(--muted); }
.ing-tbl.pct-mode .ing-p { display: none; }
.ing-del { padding: 4px 9px; }
.ing-paste { margin-top: 10px; }
.ing-paste summary { cursor: pointer; color: var(--muted); }
.ing-paste textarea { margin: 8px 0; }
@media (max-width: 640px) { .ing-tbl { min-width: 560px; } }

/* ---------- final (read-only) labels ---------- */
body.is-locked [data-logo-ctl], body.is-locked .samples, body.is-locked #clear, body.is-locked #ing-add, body.is-locked .ing-del,
body.is-locked .ing-paste, body.is-locked .btn-ai, body.is-locked [data-apply], body.is-locked #n-reset { display: none !important; }
body.is-locked .market { opacity: .55; }
.credit-note { margin: 4px 0 8px; color: var(--muted); }
.credit-out { color: var(--fail); font-weight: 600; }
.credit-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.credit-bar .tile-v { font-size: 1.6rem; }
.credit-bar .row-actions { align-items: center; }
.pay-box { white-space: pre-wrap; background: var(--surface-2, var(--cond-bg)); border: 1px dashed var(--line); border-radius: 8px; padding: 10px 12px; font-size: .88rem; }
.final-note { border-left: 3px solid var(--primary, #0e6b4f); padding-left: 10px; }
