:root {
  --bg: #121410;
  --raise: #1b201b;
  --raise-2: #242924;
  --ink: #f3efe4;
  --muted: #9a9488;
  --faint: #6f6a62;
  --line: rgba(243, 239, 228, 0.1);
  --gold: #e7b143;
  --gold-ink: #2a220f;
  --coral: #ef6f58;
  --sage: #8fceab;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  --serif: "Fraunces", Georgia, serif;
  --sans: "Figtree", "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 0% -10%, rgba(231, 177, 67, 0.14), transparent 55%),
    radial-gradient(800px 380px at 100% 0%, rgba(143, 206, 171, 0.08), transparent 50%),
    var(--bg);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }

.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side {
  padding: 28px 18px;
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 0 10px; }
.mark { width: 28px; height: 28px; border-radius: 8px; display: block; }
.brand strong { display: block; font-family: var(--serif); font-weight: 500; font-style: italic; font-size: 22px; letter-spacing: -0.03em; }
.brand span { color: var(--muted); font-size: 13px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  text-decoration: none;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 12px;
  border-left: 2px solid transparent;
}
.nav a[aria-current="page"] {
  color: var(--ink);
  background: rgba(231, 177, 67, 0.08);
  border-left-color: var(--gold);
}
.who { margin-top: auto; padding: 12px; color: var(--muted); font-size: 14px; }
.who b { color: var(--ink); font-weight: 600; display: block; }
.linkish { background: none; border: 0; padding: 0; color: var(--gold); }

.main { padding: 36px 40px 72px; max-width: 1180px; }
.page-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-end; margin-bottom: 28px; }
.kicker { margin: 0 0 6px; color: var(--gold); letter-spacing: 0.16em; text-transform: uppercase; font-size: 12px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -0.03em; }
h1 { font-size: 46px; line-height: 0.95; margin: 0; }
h2 { font-size: 28px; margin: 0 0 8px; }
.lede { color: var(--muted); margin: 8px 0 0; max-width: 46ch; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 22px; }
.stat, .card, .panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 42%), var(--raise);
  border: 1px solid var(--line);
  border-radius: 22px;
}
.stat { padding: 18px 20px; }
.stat b { display: block; font-family: var(--serif); font-size: 34px; font-weight: 500; }
.stat span { color: var(--muted); font-size: 14px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.card { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.card header, .row, .split { display: flex; align-items: center; gap: 12px; }
.card header { align-items: flex-start; }
.card h3 { margin: 0; font-size: 26px; }
.sub { margin: 4px 0 0; color: var(--muted); }
.grow { flex: 1; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.avatar {
  width: 52px; height: 52px; border-radius: 18px;
  display: grid; place-items: center; font-size: 26px; flex: none;
  background: var(--raise-2); overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 72px; height: 72px; border-radius: 24px; font-size: 34px; }

.pill {
  border-radius: 999px; padding: 6px 10px; font-size: 12px; letter-spacing: 0.02em;
  background: var(--raise-2); color: var(--muted); white-space: nowrap;
}
.pill.open { color: #123026; background: var(--sage); }
.pill.shut { color: #2a120e; background: var(--coral); }
.pill.wait { color: var(--gold-ink); background: var(--gold); }

.meter { display: grid; grid-template-columns: 92px 1fr; gap: 8px; align-items: center; }
.ring { width: 92px; height: 92px; }
.ring-track { fill: none; stroke: rgba(243, 239, 228, 0.08); stroke-width: 8; }
.ring-value { fill: none; stroke-width: 8; stroke-linecap: round; }
.minutes { font-family: var(--serif); font-size: 42px; line-height: 0.9; margin: 0; }
.minutes small { font-family: var(--sans); font-size: 14px; color: var(--muted); margin-left: 4px; }
.note { margin: 0; color: var(--muted); }

.btn, .btn-ghost, .btn-danger {
  border-radius: 999px; padding: 10px 16px; border: 1px solid transparent;
}
.btn { background: var(--gold); color: var(--gold-ink); font-weight: 600; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-danger { background: transparent; border-color: rgba(239, 111, 88, 0.45); color: var(--coral); }
.btn:disabled { opacity: 0.5; cursor: wait; }

.stack { display: flex; flex-direction: column; gap: 14px; }
.panel { padding: 18px 20px; }
.list { display: flex; flex-direction: column; }
.item {
  display: flex; gap: 14px; align-items: center; justify-content: space-between;
  padding: 14px 0; border-top: 1px solid var(--line);
}
.item:first-child { border-top: 0; }
.item p { margin: 4px 0 0; color: var(--muted); }
.plain { margin: 8px 0 12px; padding-left: 18px; color: var(--muted); }

label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input, select, textarea {
  width: 100%; background: #121410; border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; outline: none;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: rgba(231, 177, 67, 0.7); }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.form-actions { display: flex; gap: 8px; align-items: center; margin-top: 12px; }

.swatches, .emoji-row { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch, .emoji {
  width: 36px; height: 36px; border-radius: 12px; border: 2px solid transparent; background: var(--raise-2);
}
.swatch[aria-pressed="true"], .emoji[aria-pressed="true"] { border-color: var(--ink); }
.emoji { font-size: 18px; }

.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; align-items: end; min-height: 220px; }
.day { display: flex; flex-direction: column; justify-content: flex-end; gap: 8px; min-height: 180px; }
.col { width: 100%; border-radius: 10px 10px 4px 4px; min-height: 4px; }
.day span { color: var(--muted); font-size: 12px; text-align: center; }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.dot { width: 8px; height: 8px; border-radius: 99px; display: inline-block; margin-right: 6px; }

.gate {
  min-height: 100vh; display: grid; place-items: center; padding: 28px;
}
.gate-card { width: min(460px, 100%); padding: 28px; }
.gate-card h1 { font-size: 52px; font-style: italic; font-weight: 500; }
.error { color: var(--coral); margin: 8px 0 0; }

.modal-back {
  position: fixed; inset: 0; background: rgba(8, 10, 8, 0.72);
  display: grid; place-items: center; padding: 20px; z-index: 5;
}
.modal { width: min(480px, 100%); padding: 22px; }
.code {
  font-family: var(--serif); font-size: 56px; letter-spacing: 0.14em; text-align: center; margin: 8px 0;
}

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #1a1914; padding: 12px 16px; border-radius: 999px;
  font-weight: 600; z-index: 6;
}
.keybox {
  font-family: ui-monospace, monospace; background: #10130f; padding: 12px; border-radius: 12px;
  overflow-wrap: anywhere; border: 1px solid var(--line);
}

.empty { padding: 28px; text-align: left; }
.online { color: var(--sage); }
.offline { color: var(--faint); }

@media (max-width: 860px) {
  .app { display: block; }
  .side {
    position: sticky; top: 0; height: auto; width: auto; z-index: 2;
    background: rgba(18, 20, 16, 0.92); backdrop-filter: blur(16px);
    border-right: 0; border-bottom: 1px solid var(--line);
  }
  .nav { flex-direction: row; overflow: auto; }
  .who { display: none; }
  .main { padding: 24px 16px 80px; }
  h1 { font-size: 36px; }
  .stats { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; align-items: flex-start; }
}
