:root {
  --bg: #07080b;
  --bg2: #101218;
  --card: #16181f;
  --line: rgba(242, 228, 196, 0.1);
  --text: #f3ead8;
  --muted: #8d8778;
  --gold: #e0b35a;
  --gold-2: #a67c2d;
  --good: #7dcf9a;
  --warn: #e0a15a;
  --bad: #d96b6b;
  --dock: #0c0e13;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body {
  background:
    radial-gradient(900px 420px at 100% -10%, rgba(224, 179, 90, 0.12), transparent 45%),
    var(--bg);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
input:focus, select:focus, textarea:focus {
  outline: 1px solid var(--gold);
  outline-offset: 1px;
}

.shell {
  max-width: 560px;
  margin: 0 auto;
  padding: 18px 16px calc(92px + env(safe-area-inset-bottom));
}

.hero { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.eyebrow {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
}
h1 { margin: 6px 0 8px; font-size: 28px; letter-spacing: -0.04em; font-weight: 800; }
.lead { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

.ring {
  width: 72px; height: 72px; border-radius: 50%;
  background: conic-gradient(var(--gold) calc(var(--p, 0) * 1%), #23242c 0);
  display: grid; place-items: center; position: relative; flex: 0 0 72px;
}
.ring::after { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--bg); }
.ring span { position: relative; z-index: 1; font-family: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, monospace; font-weight: 600; color: var(--gold); }

.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 18px 0 12px; }
.kpi, .card, .row, .eta {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.kpi { padding: 12px; }
.kpi b { display: block; font-family: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, monospace; font-size: 18px; }
.kpi span { color: var(--muted); font-size: 11px; }

.banner {
  margin: 0 0 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #1a1710;
  border: 1px solid rgba(224, 179, 90, 0.22);
  color: #e8d7a8;
  font-size: 13px;
  line-height: 1.45;
}

.panel { display: none; margin-top: 8px; }
.panel.on { display: block; }

.card { padding: 14px; margin: 0 0 10px; }
.card h3 { margin: 0 0 6px; font-size: 16px; }
.meta, .note, .hint { color: var(--muted); font-size: 13px; line-height: 1.45; }
.note { margin: 8px 0 10px; }

.pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.pill {
  font-size: 11px; padding: 4px 8px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted);
  font-family: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, monospace;
}
.pill.on { color: var(--good); border-color: rgba(125, 207, 154, 0.35); }
.pill.over { color: var(--warn); }
.pill.under { color: var(--bad); }

.adder, .quick, .row-actions { display: flex; gap: 8px; }
.adder input, .quick input, .grid-form input, .grid-form select, .grid-form textarea {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
}
.adder input { width: 76px; }
.adder button { margin-left: auto; }

button.solid, .adder button, .quick button {
  background: var(--gold); color: #1a1408; border: 0;
  border-radius: 12px; padding: 11px 14px; font-weight: 700;
}
button.ghost {
  background: transparent; border: 1px solid var(--line); color: var(--text);
  border-radius: 12px; padding: 11px 14px; font-weight: 700;
}
.row-actions { margin: 12px 0; }
.row-actions button { flex: 1; }
.quick { margin-top: 8px; }
.quick input { flex: 1; }

h2 {
  margin: 20px 0 10px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.eta { padding: 12px; margin: 0 0 8px; display: grid; gap: 4px; }
.eta .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.eta b { font-size: 16px; }
.eta .num { font-family: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, monospace; color: var(--gold); }
.eta.slow { border-color: rgba(224, 161, 90, 0.35); }
.eta.hold { border-color: rgba(125, 207, 154, 0.25); }

.chips { display: flex; gap: 6px; margin: 0 0 10px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--bg2); color: var(--muted);
  border-radius: 999px; padding: 6px 10px; font-size: 12px;
}
.chip.on { color: var(--text); border-color: var(--gold-2); }

.row { display: flex; justify-content: space-between; gap: 12px; padding: 12px; margin: 0 0 8px; align-items: center; }
.row small { color: var(--muted); display: block; }

.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-form label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.wide { grid-column: 1 / -1; }
.grid-form textarea { min-height: 72px; resize: vertical; }

canvas { width: 100%; border-radius: 16px; border: 1px solid var(--line); background: var(--card); }

.chat-log { display: flex; flex-direction: column; gap: 8px; max-height: 48vh; overflow: auto; margin-bottom: 10px; }
.bubble { border-radius: 14px; padding: 10px 12px; font-size: 14px; line-height: 1.45; white-space: pre-wrap; }
.bubble.user { align-self: flex-end; max-width: 85%; background: #2a2418; border: 1px solid var(--gold-2); }
.bubble.assistant { align-self: flex-start; max-width: 92%; background: var(--card); border: 1px solid var(--line); }

.dock {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 2px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--dock) 92%, black);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.tab {
  border: 0; background: transparent; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
}
.tab i { font-style: normal; font-size: 16px; }
.tab.on { color: var(--gold); }

.flash { min-height: 18px; color: var(--gold); font-size: 13px; }
