:root {
  --bg: #f3efe6;
  --bg-2: #e7e1d6;
  --card: #fffcf7;
  --ink: #1c1915;
  --muted: #6f675e;
  --line: #ddd4c6;
  --accent: #9a3412;
  --accent-ink: #fff7ed;
  --good: #3f6212;
  --bad: #9f1239;
  --warn: #92400e;
  --shadow: 0 16px 40px rgba(48, 32, 16, 0.08);
  --serif: "Iowan Old Style", Palatino, Georgia, serif;
  --sans: "Segoe UI", "Helvetica Neue", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1200px 500px at 10% -10%, #fff, transparent 50%),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}
.gate-card, .panel, .card, .column {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.gate-card { width: min(440px, 100%); padding: 32px; }
.eyebrow {
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--accent);
  margin: 0 0 8px;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -0.02em; }
h1 { font-size: 40px; line-height: 1.05; margin: 0 0 12px; }
h2 { font-size: 28px; margin: 0; }
h3 { font-size: 18px; margin: 0; }
.lede { color: var(--muted); margin: 0 0 20px; }
label { display: block; font-size: 13px; margin: 12px 0 6px; }
label span { color: var(--muted); }
input, select, textarea {
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid #fdba74;
  border-color: var(--accent);
}
button.primary, .gate-card button, .toolbar button, .row-actions button, .card button, .product button {
  background: var(--ink);
  color: #f6f1e8;
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
}
button.ghost, .nav button, .who button {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
}
button.danger { background: var(--bad); }
.form-error { color: var(--bad); min-height: 1.2em; }
.top {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(243, 239, 230, 0.92);
  backdrop-filter: blur(10px);
  z-index: 2;
}
.brand {
  font-family: var(--serif);
  font-size: 22px;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.brand span { color: var(--accent); }
.search { flex: 1; }
.search input { background: #fff; }
.who { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; }
a.navlink {
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  white-space: nowrap;
}
.shell { display: grid; grid-template-columns: 180px 1fr; gap: 18px; padding: 18px; }
.nav { display: flex; flex-direction: column; gap: 6px; align-self: start; position: sticky; top: 78px; }
.nav button { text-align: left; border-radius: 12px; }
.nav button.active { background: var(--ink); color: #f6f1e8; border-color: var(--ink); }
main { min-width: 0; }
.page-head, .toolbar, .split, .metrics, .board, .product-grid, .stack {
  display: flex;
  gap: 12px;
}
.page-head, .toolbar { justify-content: space-between; align-items: center; margin-bottom: 16px; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 16px; }
.metric, .panel, .card, .column { padding: 16px; }
.metric strong { display: block; font-family: var(--serif); font-size: 28px; }
.metric span, .muted { color: var(--muted); }
.stack { flex-direction: column; }
.board { align-items: flex-start; overflow-x: auto; padding-bottom: 8px; }
.column { min-width: 260px; max-width: 280px; background: rgba(255, 252, 247, 0.7); }
.column header { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.column .count { color: var(--muted); font-variant-numeric: tabular-nums; }
.card { margin-bottom: 10px; box-shadow: none; }
.card p { margin: 6px 0; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.product { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.price { font-family: var(--serif); font-size: 26px; }
.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--bg-2);
  font-size: 12px;
  letter-spacing: 0.02em;
}
.pill.won { background: #ecfccb; color: var(--good); }
.pill.lost { background: #ffe4e6; color: var(--bad); }
.pill.open { background: #ffedd5; color: var(--warn); }
table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 18px; overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
.table-wrap { border: 1px solid var(--line); border-radius: 18px; overflow: auto; background: var(--card); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.span-2 { grid-column: span 2; }
.list { display: flex; flex-direction: column; gap: 8px; }
.list article, .result {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}
code, .mono { font-family: var(--mono); font-size: 12px; }
.toast {
  position: fixed;
  bottom: 16px;
  right: 16px;
  background: var(--ink);
  color: #f6f1e8;
  padding: 12px 14px;
  border-radius: 12px;
  max-width: 360px;
  z-index: 5;
}
ul.clean { margin: 0; padding-left: 18px; }
.empty { color: var(--muted); padding: 24px; text-align: center; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .nav { position: static; flex-direction: row; overflow-x: auto; }
  .metrics, .form-grid { grid-template-columns: 1fr 1fr; }
  .top { flex-wrap: wrap; }
  .span-2 { grid-column: span 2; }
}
