:root {
  color-scheme: light;
  --ink: #151514;
  --muted: #68645d;
  --paper: #f4f1ea;
  --panel: #fffdf8;
  --line: #d7d0c4;
  --line-strong: #a9a092;
  --red: #9d3f32;
  --blue: #214f6b;
  --green: #2e6148;
  --gold: #b07a24;
  --shadow: 0 18px 50px rgba(35, 31, 25, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(21, 21, 20, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(21, 21, 20, 0.025) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  color: var(--ink);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  letter-spacing: 0;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

.age-gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(21, 21, 20, 0.88);
}

.age-gate.is-hidden {
  display: none;
}

.age-panel {
  width: min(520px, 100%);
  border: 2px solid var(--ink);
  background: var(--paper);
  box-shadow: 10px 10px 0 rgba(255, 253, 248, 0.24);
  padding: 22px;
}

.age-panel p,
.kicker {
  margin: 0;
  color: var(--red);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.age-panel h1 {
  margin: 8px 0 18px;
  font-size: clamp(1.6rem, 5vw, 3rem);
  line-height: 1;
}

.age-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.age-actions button,
.age-actions a {
  min-height: 42px;
  border: 2px solid var(--ink);
  padding: 10px 14px;
  background: var(--ink);
  color: var(--panel);
  text-decoration: none;
  cursor: pointer;
}

.age-actions a {
  background: transparent;
  color: var(--ink);
}

.shell {
  min-height: 100vh;
}

.commandbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: stretch;
  border-bottom: 2px solid var(--ink);
  background: var(--panel);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  padding: 12px 16px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 2px solid var(--ink);
  background: var(--gold);
  color: var(--ink);
  font-weight: 900;
}

.brand small,
.command-stats span,
.rail-block p,
.ledger-head p,
.detail p,
.muted {
  color: var(--muted);
}

.brand span:last-child {
  display: grid;
  gap: 2px;
}

.command-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 1fr));
  border-left: 2px solid var(--ink);
}

.command-stats span {
  display: grid;
  align-content: center;
  min-height: 64px;
  padding: 8px 14px;
  border-left: 1px solid var(--line);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.command-stats strong {
  color: var(--ink);
  font-size: 1.55rem;
}

.workbench {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 340px;
  min-height: calc(100vh - 66px);
}

.rail,
.detail {
  border-right: 2px solid var(--ink);
  background: rgba(255, 253, 248, 0.72);
}

.detail {
  position: sticky;
  top: 66px;
  height: calc(100vh - 66px);
  overflow: auto;
  border-right: 0;
  border-left: 2px solid var(--ink);
}

.rail-block,
.detail-inner {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.rail-block h1,
.section-label h2,
.ledger-head h2,
.detail h2 {
  margin: 4px 0 0;
  font-size: 1.35rem;
  line-height: 1.1;
}

.rail-block.compact {
  display: grid;
  gap: 12px;
}

label span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  padding: 8px 10px;
  background: var(--panel);
  color: var(--ink);
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(33, 79, 107, 0.34);
  outline-offset: 2px;
}

.checkline {
  display: flex;
  gap: 9px;
  align-items: center;
}

.checkline input {
  width: 18px;
  min-height: 18px;
}

.checkline span {
  margin: 0;
}

.counts {
  display: grid;
  gap: 8px;
}

.count-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px dotted var(--line-strong);
  padding-bottom: 7px;
  color: var(--muted);
  font-size: 0.82rem;
}

.count-row strong {
  color: var(--ink);
}

.trust-block ul {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.trust-block li {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.trust-block a {
  color: var(--blue);
  font-weight: 800;
}

.board {
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(260px, 42vh) minmax(0, 1fr);
  min-height: calc(100vh - 66px);
}

.deal-tape {
  border-bottom: 2px solid var(--ink);
  background: rgba(255, 253, 248, 0.62);
}

.section-label,
.ledger-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  padding: 14px 16px;
}

.deal-row {
  display: grid;
  gap: 1px;
  max-height: calc(42vh - 75px);
  overflow-y: auto;
  border-top: 1px solid var(--line);
  background: var(--line);
}

.deal-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 0.9fr);
  gap: 10px;
  align-items: start;
  min-height: 116px;
  border: 0;
  border-radius: 0;
  padding: 14px;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.deal-card:hover,
.deal-card.is-active {
  background: #f8ead3;
}

.deal-card h3 {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.25;
}

.deal-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
}

.deal-shop {
  display: grid;
  gap: 5px;
}

.deal-shop strong {
  font-size: 1.02rem;
  line-height: 1.2;
}

.deal-shop address {
  color: var(--muted);
  font-style: normal;
  line-height: 1.35;
}

.deal-offer {
  display: grid;
  gap: 8px;
}

.tagline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--line-strong);
  padding: 3px 7px;
  background: #f7f4ec;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.tag.hot {
  border-color: var(--red);
  background: var(--red);
  color: white;
}

.ledger {
  background: rgba(244, 241, 234, 0.6);
}

.table-wrap {
  overflow: auto;
  border-top: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  vertical-align: top;
  text-align: left;
}

th {
  position: sticky;
  top: 66px;
  z-index: 2;
  background: var(--ink);
  color: var(--panel);
  font-size: 0.74rem;
  text-transform: uppercase;
}

td {
  font-size: 0.88rem;
}

tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.is-active {
  background: #f8ead3;
}

.deal-card.is-favorite,
tbody tr.is-favorite {
  box-shadow: inset 4px 0 0 var(--gold);
}

.shop-cell,
.detail-title {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.detail-title {
  grid-template-columns: minmax(0, 1fr) 32px;
}

.detail-title .favorite-button {
  justify-self: end;
}

.shop-name {
  display: grid;
  gap: 4px;
}

.shop-name strong {
  font-size: 0.94rem;
}

.license {
  color: var(--muted);
  font-size: 0.74rem;
}

.menu-state {
  color: var(--muted);
}

.menu-state.ready {
  color: var(--green);
  font-weight: 800;
}

.favorite-button {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  padding: 0;
  background: var(--panel);
  color: var(--muted);
  line-height: 1;
  cursor: pointer;
}

.favorite-button:hover,
.favorite-button.is-saved {
  border-color: var(--gold);
  background: #f8ead3;
  color: var(--ink);
}

.favorite-glyph {
  color: var(--gold);
}

.tag.favorite {
  border-color: var(--gold);
  background: #f8ead3;
}

.detail-inner {
  display: grid;
  gap: 14px;
  border-bottom: 0;
}

.detail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.detail-actions a {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  padding: 9px 10px;
  color: var(--ink);
  text-align: center;
  text-decoration: none;
}

.detail-actions a.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: white;
}

.detail-deals {
  display: grid;
  gap: 8px;
}

.detail-deal {
  border-left: 4px solid var(--gold);
  padding: 8px 0 8px 10px;
}

.detail-deal h3 {
  margin: 0 0 5px;
  font-size: 0.9rem;
}

.detail-deal p {
  margin: 0;
  line-height: 1.35;
}

.empty {
  padding: 18px 16px;
  color: var(--muted);
}

@media (max-width: 1080px) {
  .workbench {
    grid-template-columns: 250px minmax(0, 1fr);
  }

  .detail {
    grid-column: 1 / -1;
    position: static;
    height: auto;
    border-top: 2px solid var(--ink);
    border-left: 0;
  }
}

@media (max-width: 760px) {
  .commandbar,
  .workbench {
    display: block;
  }

  .command-stats {
    grid-template-columns: repeat(3, 1fr);
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .rail {
    border-right: 0;
    border-bottom: 2px solid var(--ink);
  }

  .detail {
    top: 0;
  }

  .board {
    display: block;
    min-height: auto;
  }

  .deal-row {
    max-height: 420px;
  }

  .deal-card {
    grid-template-columns: 1fr;
  }

  th:nth-child(2),
  td:nth-child(2),
  th:nth-child(3),
  td:nth-child(3) {
    display: none;
  }
}
