:root {
  --ink: #2b2320;
  --muted: #65534c;
  --paper: #f4efe8;
  --card: #fffdf9;
  --line: #e4d8cc;
  --terra: #9c3418;
  --terra-deep: #6e2410;
  --good: #1f6b45;
  --good-bg: #e7f4ec;
  --warn: #8a5a00;
  --warn-bg: #fff4d8;
  --bad: #8d2a2a;
  --bad-bg: #fdecec;
  --info: #24516d;
  --info-bg: #e7f1f6;
  --shadow: 0 16px 40px rgba(43, 35, 32, 0.06);
  --sans: "Source Sans 3", "Segoe UI", sans-serif;
  --serif: Fraunces, Georgia, serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body.portal {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(156, 52, 24, 0.08), transparent 28rem),
    var(--paper);
  font-family: var(--sans);
  font-size: 1.05rem;
  line-height: 1.5;
}
a { color: var(--terra-deep); }
.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--ink);
  color: white;
  padding: 0.5rem 0.8rem;
  z-index: 5;
}
.skip:focus { top: 1rem; }

.portal-shell { display: flex; min-height: 100vh; }
.portal-side {
  width: 16.5rem;
  flex: none;
  padding: 1.4rem 1rem 2rem;
  background: #2b2320;
  color: #f6f1ea;
}
.brand { display: flex; gap: 0.75rem; align-items: center; text-decoration: none; color: inherit; margin-bottom: 1.6rem; }
.brand img { width: 2.4rem; height: 2.4rem; border-radius: 0.6rem; background: white; }
.brand strong { display: block; font-family: var(--serif); font-weight: 560; font-size: 1.15rem; }
.brand span { color: #e4d8cc; font-size: 0.85rem; }
.side-link, .more-menu a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.75rem;
  padding: 0.35rem 0.7rem;
  margin: 0.15rem 0;
  border-radius: 0.7rem;
  color: #f6f1ea;
  text-decoration: none;
}
.side-link:hover, .side-link[aria-current="page"] { background: rgba(255, 255, 255, 0.1); }
.portal-main { flex: 1; min-width: 0; padding: 1.25rem 1.25rem 5.5rem; }
.topbar { display: flex; justify-content: space-between; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.who { text-align: right; }
.who strong { display: block; }
.who span, .muted { color: var(--muted); }
.page-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-end; margin-bottom: 1rem; }
.page-head h1, .guest-card h1, .hero h1 { font-family: var(--serif); font-weight: 560; letter-spacing: -0.03em; margin: 0; }
.eyebrow { margin: 0 0 0.2rem; color: var(--terra); font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; }
.grid { display: grid; gap: 0.9rem; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cards-2 { grid-template-columns: 1.4fr 1fr; }
.card, .guest-card, .table-wrap, .alert {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  box-shadow: var(--shadow);
}
.card, .table-wrap { padding: 1rem 1.1rem; }
.stat strong { display: block; font-family: var(--serif); font-size: 2rem; line-height: 1; }
.stat span { color: var(--muted); }
.alert { padding: 0.9rem 1rem; margin-bottom: 0.9rem; }
.alert-bad { background: var(--bad-bg); border-color: #f0c8c8; }
.alert-good { background: var(--good-bg); }
.alert ul { margin: 0.3rem 0 0; padding-left: 1.1rem; }
label { display: block; font-weight: 600; margin-bottom: 0.3rem; }
input, select, textarea {
  width: 100%;
  min-height: 2.8rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid #d9cfc6;
  border-radius: 0.7rem;
  background: white;
  color: var(--ink);
  font: inherit;
}
textarea { min-height: 7rem; }
.field { margin-bottom: 0.9rem; }
.help { color: var(--muted); font-size: 0.92rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.span-2 { grid-column: span 2; }
.btn, button, .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.8rem;
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  border: 0;
  background: var(--terra);
  color: white;
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover, button:hover { background: var(--terra-deep); }
.btn-secondary, .btn-quiet { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.clock-btn { min-width: 8rem; min-height: 3.2rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.7rem 0.4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.82rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.badge { display: inline-flex; align-items: center; min-height: 1.7rem; padding: 0.1rem 0.55rem; border-radius: 999px; background: #f6f1ea; font-size: 0.85rem; }
.badge-good { background: var(--good-bg); color: var(--good); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-bad { background: var(--bad-bg); color: var(--bad); }
.badge-info { background: var(--info-bg); color: var(--info); }
.empty { padding: 1.5rem 0.4rem; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 1.15rem; margin-bottom: 0.25rem; }
.filters { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 0.8rem; }
.filters .field { margin: 0; min-width: 10rem; flex: 1; }
.guest {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem 1rem 2rem;
}
.guest-card { width: min(38rem, 100%); padding: 1.4rem; }
.notice { background: #fff8f3; border: 1px solid var(--line); border-radius: 0.9rem; padding: 0.9rem 1rem; }
.check { display: flex; gap: 0.6rem; align-items: flex-start; }
.check input { width: 1.2rem; min-height: 1.2rem; margin-top: 0.25rem; }
.tabbar {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: #fffdf9;
  border-top: 1px solid var(--line);
  z-index: 4;
}
.tabbar a {
  flex: 1;
  min-height: 3.4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.75rem;
}
.more-menu { display: none; }
.more-menu summary { cursor: pointer; min-height: 2.8rem; }
code { font-size: 0.95rem; }
.secret { font-family: ui-monospace, monospace; letter-spacing: 0.04em; word-break: break-all; }

@media (max-width: 980px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .cards-2, .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .portal-side { display: none; }
  .more-menu, .tabbar { display: flex; }
  .more-menu { display: block; position: relative; }
  .more-menu div {
    position: absolute;
    right: 0;
    background: #2b2320;
    border-radius: 0.8rem;
    padding: 0.4rem;
    min-width: 14rem;
    z-index: 5;
  }
  .page-head { align-items: stretch; flex-direction: column; }
  table, thead, tbody, tr, th, td { display: block; }
  thead { display: none; }
  tr { border: 1px solid var(--line); border-radius: 0.9rem; margin-bottom: 0.7rem; padding: 0.4rem 0.7rem; }
  td { border: 0; padding: 0.28rem 0; }
  td::before { content: attr(data-label); display: block; color: var(--muted); font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase; }
}
@media (min-width: 981px) {
  .portal-main { padding-bottom: 2rem; }
}
