:root {
  --bg: #f4f2ee;
  --panel: #ffffff;
  --ink: #1d2128;
  --muted: #646b76;
  --line: #e2ded6;
  --accent: #c2410c;
  --accent-ink: #ffffff;
  --wait: #b45309;
  --wait-bg: #fef3c7;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --bad: #b91c1c;
  --bad-bg: #fee2e2;
  --radius: 12px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c;
    --panel: #1d2128;
    --ink: #eceae6;
    --muted: #9aa1ab;
    --line: #2c313a;
    --accent: #f97316;
    --accent-ink: #14171c;
    --wait: #fbbf24;
    --wait-bg: #3a2c0b;
    --ok: #4ade80;
    --ok-bg: #0f2a19;
    --bad: #f87171;
    --bad-bg: #3a1414;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { overflow-wrap: anywhere; font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.4rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
code, pre, .mono { font-family: var(--mono); font-size: .88em; }
pre { white-space: pre-wrap; word-break: break-word; margin: 0; }
.muted { color: var(--muted); }
.error { color: var(--bad); min-height: 1.2em; }
[hidden] { display: none !important; }

.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: var(--bg); border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; letter-spacing: .04em; }
.brand span { color: var(--accent); }
.pill { font-size: .8rem; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.pill.on { color: var(--ok); border-color: var(--ok); }

main { padding: 16px 16px 96px; max-width: 760px; margin: 0 auto; outline: none; }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--panel); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { background: none; border: 0; color: var(--muted); padding: 12px 2px; font: inherit; font-size: .82rem; cursor: pointer; position: relative; }
.tabs button[aria-current="page"] { color: var(--accent); font-weight: 700; }
.badge { display: inline-block; min-width: 1.3em; padding: 0 5px; border-radius: 999px; background: var(--wait); color: var(--panel); font-size: .72rem; font-weight: 700; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: 8px; }
label { display: block; font-size: .85rem; color: var(--muted); margin: 8px 0 4px; }
input, select, textarea { width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px; }
textarea { min-height: 120px; resize: vertical; }
button { font: inherit; border-radius: 8px; padding: 9px 14px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; }
.stepup button { min-height: 44px; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
button.danger { color: var(--bad); border-color: var(--bad); }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.card { border-left: 4px solid var(--wait); }
.card.executed { border-left-color: var(--ok); }
.card.rejected, .card.failed { border-left-color: var(--bad); }
.tag { display: inline-block; font-size: .75rem; padding: 2px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }
.tag.wait { background: var(--wait-bg); color: var(--wait); border-color: transparent; }
.tag.out { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.tag.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.why { font-size: .85rem; color: var(--muted); }
.issues { margin: 6px 0 0; padding-left: 18px; color: var(--bad); font-size: .9rem; }

.meter { height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.meter > div { height: 100%; background: var(--accent); }
.meter.full > div { background: var(--bad); }

.msgs { display: flex; flex-direction: column; gap: 8px; }
main { overflow-x: hidden; }
.msg { padding: 10px 12px; border-radius: 12px; max-width: 92%; white-space: pre-wrap; word-break: break-word; }
.msg.owner { align-self: flex-end; background: var(--accent); color: var(--accent-ink); }
.msg.bot { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); }
.msg.system { align-self: center; background: var(--wait-bg); color: var(--wait); font-size: .9rem; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .panel { width: 100%; max-width: 380px; }
.login button { width: 100%; margin-top: 12px; }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 10px 14px; border-radius: 10px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw; }
.toast.show { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* v0.2 */
.banner { border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; border: 1px solid var(--line); }
.banner.bad { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); }
.banner.warn { background: var(--wait-bg); color: var(--wait); border-color: transparent; }
.banner.info { background: var(--panel); color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin: 10px 0; }
.tile { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.tile-v { font-size: 1.4rem; font-weight: 800; }
.tile-l { font-size: .85rem; }
textarea.tall { min-height: 180px; }
a.button { display: inline-block; text-decoration: none; font: inherit; border-radius: 8px; padding: 9px 14px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
section > .seg { margin-bottom: 14px; }
label.row { color: var(--ink); margin-top: 10px; }
label.row input { width: auto; }
pre.diff { font-family: ui-monospace, monospace; font-size: 0.85rem; }
ol.steps { margin: 0.4rem 0; padding-left: 1.2rem; }
ol.steps li { margin: 0.25rem 0; overflow-wrap: anywhere; }
.child { border-left: 3px solid #d9d4cc; padding-left: 0.6rem; margin: 0.6rem 0 0 0.4rem; }
.row.wrap { flex-wrap: wrap; }
label.check { display: inline-flex; gap: 0.3rem; align-items: center; }
.seg[role="tablist"] { display: flex; flex-wrap: wrap; }
.seg[role="tablist"] button { flex: 1 1 auto; white-space: nowrap; padding-left: 10px; padding-right: 10px; }
img.shot, .shots img { max-width: 100%; height: auto; border: 1px solid #d9d4cc; border-radius: 8px; }
.shots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

/* Step-up prompt (D-083): owner token check over the current view. */
.stepup { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, .55); }
.stepup .panel { width: 100%; max-width: 380px; margin: 0; }
.stepup h2 { margin: 0 0 6px; font-size: 1.1rem; }

/* Model swap and template forms. */
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 10px 0; min-width: 0; }
legend { padding: 0 6px; color: var(--muted); font-size: .9rem; }
details > summary { cursor: pointer; padding: 10px 0; min-height: 44px; }

/* Seat page: no tab bar, so the owner-app offsets do not apply. */
body.seat main { padding-bottom: 24px; }
body.seat .toast { bottom: 24px; }
body.seat button { min-height: 44px; }
