:root {
  --paper: #f4f0e6;
  --panel: #fffaf2;
  --ink: #1d1914;
  --muted: #6f675c;
  --line: #e2d8c8;
  --green: #0d6b4c;
  --green-soft: #e5f4ed;
  --red: #8e2f2f;
  --red-soft: #f8e8e4;
  --amber: #8a5a10;
  --amber-soft: #f8efd8;
  --shadow: 0 16px 40px rgba(48, 36, 18, 0.06);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 400px at 10% -10%, #efe4cf, transparent 50%),
    var(--paper);
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  line-height: 1.45;
}
body.public { display: grid; place-items: center; padding: 32px 16px; }
h1, h2, .brand {
  font-family: Palatino, "Palatino Linotype", "Iowan Old Style", Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.02em;
}
h1 { font-size: 2rem; margin: 0 0 8px; }
h2 { font-size: 1.25rem; margin: 28px 0 12px; }
a { color: var(--green); }
code { font-size: 0.92em; word-break: break-all; }

.top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 250, 242, 0.9);
  position: sticky;
  top: 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 1.35rem;
}
.brand span {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: var(--green);
  color: white;
  border-radius: 8px;
  font-family: Palatino, Georgia, serif;
}
.top nav { display: flex; gap: 8px; flex-wrap: wrap; }
.top nav a {
  color: var(--ink);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 999px;
}
.top nav a.active, .top nav a:hover { background: var(--green-soft); }

main { width: min(1080px, calc(100% - 32px)); margin: 28px auto 48px; }
.panel {
  width: min(460px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.narrow { width: min(440px, 100%); }
.eyebrow { margin: 0 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.75rem; }
.lead { color: var(--muted); margin-top: 0; max-width: 62ch; }
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 18px; }
.foot { color: var(--muted); font-size: 0.85rem; padding: 0 28px 28px; }

.notice, .empty, .flash {
  border-radius: 14px;
  padding: 14px 16px;
}
.notice {
  display: grid;
  gap: 10px;
  background: var(--panel);
  border: 1px dashed var(--line);
  margin-bottom: 18px;
}
.notice p { margin: 0; }
.empty { background: transparent; color: var(--muted); border: 1px dashed var(--line); }
.flash { margin: 0 0 14px; }
.flash.ok { background: var(--green-soft); color: var(--green); }
.flash.bad { background: var(--red-soft); color: var(--red); }
.flash.warn { background: var(--amber-soft); color: var(--amber); }

label, fieldset { display: grid; gap: 6px; font-size: 0.92rem; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { padding: 0; margin-bottom: 6px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
}
textarea { min-height: 96px; resize: vertical; }
small, .hint { color: var(--muted); display: block; }
.hint { margin-top: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .wide, .stack label { grid-column: 1 / -1; }
.stack { display: grid; gap: 14px; }
.checks { display: flex; flex-wrap: wrap; gap: 10px 16px; }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: auto; }

.btn, button.link {
  border: 0;
  cursor: pointer;
  font: inherit;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--green);
  color: white;
  text-decoration: none;
  border-radius: 999px;
  padding: 10px 16px;
}
.btn.quiet { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.row-actions, .filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin: 8px 0 18px; }
.filters label { min-width: 180px; }
button.link { background: none; color: var(--green); padding: 0; }
button.link.danger { color: var(--red); }
.actions { display: flex; gap: 12px; align-items: center; white-space: nowrap; }
.actions form { margin: 0; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
.clip { max-width: 360px; word-break: break-all; }

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 9px;
  background: #eee6d8;
  font-size: 0.85rem;
}
.badge.paid, .badge.live { background: var(--green-soft); color: var(--green); }
.badge.failed { background: var(--red-soft); color: var(--red); }
.badge.cancelled, .badge.test { background: var(--amber-soft); color: var(--amber); }
.badge.registered { background: #e7eef8; color: #1d4e89; }

.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; margin: 0; }
.facts div { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.facts dt { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.facts dd { margin: 4px 0 0; word-break: break-word; }
.timeline { padding-left: 18px; }
.timeline li { margin: 6px 0; }
pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: #221e19;
  color: #f4ecdf;
  border-radius: 14px;
  padding: 14px 16px;
  overflow-x: auto;
}

@media (max-width: 720px) {
  .top, .page-head, .facts, .form-grid { display: grid; grid-template-columns: 1fr; }
  .top { position: static; }
  main { width: min(100% - 24px, 1080px); }
  h1 { font-size: 1.6rem; }
}
