:root {
  --bg: #10140f;
  --bg-2: #171d16;
  --panel: #1c241b;
  --line: #2c382b;
  --text: #e7eadc;
  --muted: #8e9786;
  --gold: #d4a017;
  --green: #6fcf97;
  --yellow: #e0b44a;
  --red: #e06c75;
  --blue: #8bb8d4;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.5 "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  min-height: 100vh;
}

code, .mono, button, input, select, textarea, table, .pill, .kicker, .mark-k, .idx {
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
}

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

.shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}

.rail {
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  padding: 1.4rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.mark { color: var(--text); display: flex; flex-direction: column; gap: 0.2rem; }
.mark:hover { text-decoration: none; }
.mark-k { color: var(--gold); letter-spacing: 0.22em; font-size: 0.72rem; }
.mark-t { font-size: 1.05rem; }
.rail-note { color: var(--muted); font-size: 0.88rem; margin: 0; }
.rail nav { display: flex; flex-direction: column; gap: 0.2rem; }
.rail nav a {
  color: var(--text);
  padding: 0.45rem 0.55rem;
  border-radius: 6px;
}
.rail nav a.on, .rail nav a:hover {
  background: var(--panel);
  text-decoration: none;
}
.rail-foot { margin-top: auto; color: var(--muted); font-size: 0.8rem; }
.rail-foot p { margin: 0.4rem 0 0; }

.stage { padding: 2rem 2.2rem 4rem; max-width: 1100px; }

.page-head h1 { font-weight: 500; font-size: 2.1rem; letter-spacing: -0.02em; margin: 0.2rem 0 0.6rem; }
.page-head.split { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.head-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: flex-start; }
.search { display: flex; gap: 0.35rem; }
.search input { min-width: 12rem; }
.pin-form { margin-top: 1rem; }
.pin-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.pin-form button { margin-bottom: 0.4rem; }
.pin-addons { display: flex; flex-direction: column; gap: 0.4rem; margin: 0.7rem 0; }
.pin-addons input[type="text"] { max-width: 22rem; }
.addon { display: flex; gap: 0.45rem; align-items: baseline; }
button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  font-weight: 500;
}
.invoice {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  word-break: break-all;
  resize: vertical;
  margin: 0.6rem 0;
}
.invoice-qr {
  display: block;
  width: fit-content;
  margin: 1rem 0 0.6rem;
  background: #fff;
  padding: 0.7rem;
  border-radius: 0.4rem;
}
.invoice-qr img {
  display: block;
  width: min(280px, 78vw);
  height: auto;
}
.kicker {
  color: var(--gold);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.72rem;
  margin: 0;
}
.lede { color: #c5cbb8; max-width: 44rem; }
.fine { color: var(--muted); font-size: 0.88rem; }
.crumb { margin: 0 0 1rem; }

.demo-script {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  padding: 1rem 1.2rem 1rem 2rem;
  margin: 0 0 1.6rem;
}
.demo-script li { margin: 0.3rem 0; }

.cards { display: grid; gap: 1rem; margin: 1rem 0 1.6rem; }
.cards.three { grid-template-columns: repeat(3, 1fr); }
.cards.two { grid-template-columns: repeat(2, 1fr); }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.1rem 1.15rem;
  box-shadow: var(--shadow);
}
a.card { color: inherit; display: block; }
a.card:hover { border-color: var(--gold); text-decoration: none; }
.card h2 { margin: 0.2rem 0 0.4rem; font-size: 1.25rem; font-weight: 500; }
.idx { color: var(--gold); font-size: 0.75rem; letter-spacing: 0.12em; }
.card.proto { min-height: 10.5rem; }

.stat-row { display: flex; flex-wrap: wrap; gap: 0.7rem; align-items: center; color: var(--muted); }
.stat-row.big { font-size: 1rem; margin: 0 0 1.2rem; }
.dot {
  width: 0.55rem; height: 0.55rem; border-radius: 50%; display: inline-block;
  margin: 0 0.25rem 0 0.15rem;
}
.dot.green { background: var(--green); }
.dot.yellow { background: var(--yellow); }
.dot.red { background: var(--red); }

.pill {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.pill.green { color: var(--green); border-color: var(--green); }
.pill.yellow { color: var(--yellow); border-color: var(--yellow); }
.pill.red { color: var(--red); border-color: var(--red); }
.pill.unknown { color: var(--muted); border-color: var(--line); }
.pill.gold { color: var(--gold); border-color: var(--gold); }
.pill.pin-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: #2a2414;
  font-weight: 600;
}
.pin-icon { flex-shrink: 0; display: block; }
a.card.site.pinned {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(212, 160, 23, 0.45), var(--shadow);
}

.grid-sites {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: baseline; }
.muted { color: var(--muted); }

.form { display: grid; gap: 0.7rem; }
label { display: grid; gap: 0.25rem; color: var(--muted); font-size: 0.9rem; }
input, select, textarea, button {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
  font-size: 0.95rem;
}
button {
  background: var(--gold);
  color: #1a1406;
  border: 0;
  font-weight: 600;
  cursor: pointer;
  width: fit-content;
}
button:hover { filter: brightness(1.08); }

table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 0.45rem 0.4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; }

.kv { display: grid; grid-template-columns: 8rem 1fr; gap: 0.35rem 1rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }

.host { font-size: 0.8rem; color: var(--muted); }
.host.up { color: var(--green); }
.host.degraded, .host.yellow { color: var(--yellow); }
.host.down, .host.missing, .host.red { color: var(--red); }

.inbox { list-style: none; padding: 0; margin: 0 0 1.5rem; }
.inbox li { border-bottom: 1px solid var(--line); }
.inbox a { display: block; padding: 0.85rem 0.1rem; color: inherit; }
.inbox a:hover { text-decoration: none; background: var(--panel); }

.channel { list-style: none; padding: 0; margin: 0; }
.channel li { padding: 0.7rem 0; border-bottom: 1px solid var(--line); }
.channel .agent { border-left: 3px solid var(--gold); padding-left: 0.8rem; }
.channel .human { border-left: 3px solid var(--blue); padding-left: 0.8rem; }

.chips { display: flex; gap: 0.4rem; margin: 0.4rem 0 0.6rem; }
.chips a {
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
}
.chips a.on, .chips a:hover { border-color: var(--gold); color: var(--gold); text-decoration: none; }

.bars {
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
  height: 88px;
  margin-top: 0.8rem;
}
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.bar { width: 100%; background: var(--gold); min-height: 4px; border-radius: 3px 3px 0 0; }
.bar-col span { color: var(--muted); font-size: 0.65rem; margin-top: 0.2rem; }

.stack-counts { display: grid; gap: 0.35rem; margin-top: 0.6rem; }
.stack-counts a { color: inherit; }

.notice {
  background: #2a2414;
  border: 1px solid var(--gold);
  color: var(--gold);
  padding: 0.5rem 0.8rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}
.receipt { margin: 1rem 0; }
.receipt dt { color: var(--muted); }

.event-json {
  background: var(--bg-2);
  border: 1px solid var(--line);
  padding: 1rem;
  overflow: auto;
  font-size: 0.82rem;
  line-height: 1.4;
}

.ident p.mono { word-break: break-all; font-size: 0.82rem; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .rail { height: auto; position: relative; }
  .cards.three, .cards.two, .grid-sites { grid-template-columns: 1fr; }
  .page-head.split { flex-direction: column; }
}
