:root {
  --ink: #1d1914;
  --muted: #6d645b;
  --line: #e6ddd2;
  --paper: #f6f3ee;
  --card: #fffcf8;
  --green: #1e3b31;
  --green-2: #2d5a4a;
  --brass: #8d6240;
  --bad: #8d2f2f;
  --bad-bg: #f8ecec;
  --good: #1d6b45;
  --good-bg: #e8f5ee;
  --warn-bg: #f8f1e4;
  --shadow: 0 16px 40px rgba(48, 36, 22, 0.06);
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; }
h1, h2, h3 { font-family: "Source Serif 4", Georgia, serif; font-weight: 560; letter-spacing: -0.02em; }
h1 { font-size: 32px; margin: 0; }
h2 { font-size: 22px; margin: 0 0 8px; }
button, input, select, textarea { font: inherit; }
button { border: 0; background: var(--green); color: white; border-radius: 8px; padding: 10px 14px; cursor: pointer; }
button:hover { background: var(--green-2); }
button.ghost, button.text { background: transparent; color: var(--green); border: 1px solid var(--line); }
button.text { border: 0; color: #d9cfc3; padding: 12px 18px; text-align: left; }
button:disabled { opacity: 0.55; cursor: not-allowed; }
[hidden] { display: none !important; }

.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(180deg, #1e3b31, #142820 42%, var(--paper) 42%); }
.gate-card, .card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.gate-card { width: min(440px, 100%); padding: 32px; display: flex; flex-direction: column; gap: 14px; }
.eyebrow { margin: 0; color: var(--brass); font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.lede, .muted { color: var(--muted); }
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
input, select, textarea { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: white; color: var(--ink); }
textarea { min-height: 80px; resize: vertical; }
.msg { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--warn-bg); }
.msg.err { background: var(--bad-bg); color: var(--bad); }
.msg.ok { background: var(--good-bg); color: var(--good); }

#app { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; }
aside { background: var(--green); color: white; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { padding: 24px 18px 12px; }
.brand strong { display: block; font-family: "Source Serif 4", Georgia, serif; font-size: 22px; }
.brand span, .nav-group { color: #d9cfc3; font-size: 13px; }
#nav { overflow: auto; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-group { margin: 14px 10px 4px; letter-spacing: 0.08em; text-transform: uppercase; font-size: 11px; }
#nav button { background: transparent; color: white; text-align: left; border-radius: 8px; }
#nav button.active { background: rgba(255,255,255,0.12); }
.workspace { min-width: 0; }
.top { display: flex; justify-content: space-between; gap: 16px; align-items: end; padding: 28px 32px 0; }
#who { color: var(--muted); text-align: right; }
main { padding: 22px 32px 48px; display: flex; flex-direction: column; gap: 18px; }

.toolbar, .row, .actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.metric, .card { padding: 16px 18px; }
.metric b { display: block; font-size: 24px; margin-top: 4px; }
.span-2 { grid-column: span 2; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 14px; background: white; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; vertical-align: top; }
th { color: var(--muted); font-weight: 600; background: #fbf8f4; }
.bad { color: var(--bad); font-weight: 700; }
.good { color: var(--good); font-weight: 700; }
.pill { display: inline-block; border-radius: 999px; padding: 2px 8px; background: var(--paper); font-size: 12px; }
.tape { display: grid; gap: 4px; overflow: auto; }
.tape-row { display: grid; grid-template-columns: 92px repeat(14, minmax(42px, 1fr)); gap: 4px; align-items: stretch; }
.cell, .tape-head { min-height: 36px; border-radius: 6px; background: white; border: 1px solid var(--line); font-size: 12px; display: grid; place-items: center; }
.cell.booked { background: #d9ebe3; border-color: #b7d4c8; }
.cell.maint { background: var(--bad-bg); color: var(--bad); }
.statement { max-width: 760px; }
.statement div { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.statement .total { font-weight: 700; }
.alert { border-left: 4px solid var(--brass); }

@media (max-width: 900px) {
  #app { grid-template-columns: 1fr; }
  aside { position: static; height: auto; }
  #nav { display: flex; flex-direction: row; overflow: auto; }
  .nav-group, #logout { display: none; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .top, main { padding-left: 16px; padding-right: 16px; }
  .span-2 { grid-column: span 2; }
}
@media print {
  aside, .toolbar, button { display: none !important; }
  #app { display: block; }
}
