:root {
  --bg: #090909;
  --paper: #12110f;
  --line: rgba(243, 234, 216, 0.14);
  --text: #f7f2ea;
  --muted: #9c9082;
  --ivory: #f3ead7;
  --gold: #c6a56a;
  --ink: #14120f;
  --danger: #e7a090;
  --warn: #e4c27a;
  font-family: Outfit, sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 100% -10%, rgba(198, 165, 106, 0.14), transparent 50%),
    var(--bg);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.stage { min-height: 100vh; }
.mast-actions { display: flex; gap: 8px; align-items: center; }
.mast {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 148px 1fr auto;
  gap: 28px;
  align-items: center;
  padding: 16px 32px;
  background: rgba(9, 9, 9, 0.86);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.brand-card {
  background: #fff;
  border-radius: 16px;
  padding: 8px 10px 4px;
}
.brand-card img { width: 100%; display: block; }
nav { display: flex; gap: 6px; flex-wrap: wrap; }
nav button, .ghost, .solid, .danger {
  border: 0;
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
}
nav button {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-size: 15px;
}
nav button span {
  font-family: "Playfair Display", serif;
  font-style: italic;
  color: var(--gold);
  font-size: 13px;
}
nav button.active { color: var(--ink); background: var(--ivory); }
nav button.active span { color: #8a7040; }
nav button:hover:not(.active) { color: var(--ivory); }
.solid {
  background: var(--ivory);
  color: var(--ink);
  padding: 12px 18px;
  font-weight: 560;
}
.solid:hover { background: #fff; }
.ghost { border: 1px solid var(--line); }
.ghost:hover { border-color: var(--gold); }
.danger { color: var(--danger); border: 1px solid rgba(231, 160, 144, 0.4); }

main { padding: 36px 40px 28px; }
.topbar { margin-bottom: 28px; }
.topbar > div:first-child { max-width: 920px; }
.kicker {
  margin: 0 0 6px;
  color: var(--gold);
  font-family: "Playfair Display", serif;
  font-style: italic;
  font-size: 20px;
}
h1, h2, h3 {
  font-family: "Playfair Display", serif;
  font-weight: 500;
  letter-spacing: -0.03em;
  margin: 0;
}
h1 {
  font-size: clamp(56px, 7vw, 92px);
  font-style: italic;
  line-height: 0.84;
}
h2 { font-size: 36px; font-style: italic; line-height: 1; }

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.cards .card {
  container-type: inline-size;
  min-width: 0;
}
.card, .panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 20px 22px 18px;
}
.cards .card:first-child {
  background: var(--ivory);
  color: var(--ink);
  border-color: transparent;
}
.cards .card:first-child span { color: #6d6256; }
.card span, .muted { color: var(--muted); font-size: 13px; }
.card strong {
  display: block;
  margin: 18px 0 8px;
  font-family: Outfit, sans-serif;
  font-size: clamp(26px, 2.6vw, 36px);
  font-style: normal;
  font-weight: 520;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  line-height: 1.05;
}
.cards .card strong {
  white-space: nowrap;
  font-size: clamp(15px, 7.2cqi, 30px);
  letter-spacing: -0.045em;
}
.nowrap { white-space: nowrap; }
.layout { display: grid; grid-template-columns: 1.35fr 0.75fr; gap: 12px; margin-top: 12px; }
.panel h2 { margin-bottom: 10px; }
.row {
  display: grid;
  grid-template-columns: 84px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.date-pill {
  font-family: "Playfair Display", serif;
  font-style: italic;
  font-size: 20px;
  color: var(--ivory);
  line-height: 1;
}
.cards .card:first-child .date-pill { color: var(--ink); }
.alert { padding: 12px 0; border-top: 1px solid var(--line); }
.alert b { color: var(--gold); font-weight: 500; }

.toolbar, .months { display: flex; flex-wrap: wrap; gap: 8px; }
.toolbar { margin-bottom: 12px; align-items: center; }
.months { margin: 0 0 16px; }
.chip, .months button {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 11px;
}
.chip.on, .months button.on {
  background: var(--ivory);
  color: var(--ink);
}
.search {
  flex: 1;
  min-width: 200px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 10px 2px;
}
.search:focus, dialog input:focus, dialog select:focus, dialog textarea:focus { outline: none; border-color: var(--gold); }

.panel { overflow: visible; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; font-variant-numeric: tabular-nums; }
th {
  text-align: left;
  color: var(--gold);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
thead th {
  position: sticky;
  top: var(--mast-h, 96px);
  z-index: 2;
  background: var(--paper);
}
th, td { padding: 14px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
td:nth-child(2) b { font-family: "Playfair Display", serif; font-size: 18px; font-weight: 500; }
.tag { font-family: "Playfair Display", serif; font-style: italic; font-size: 15px; }
.tag.warn { color: var(--warn); }
.tag.ok { color: var(--ivory); }
.tag.done { color: var(--muted); }
.person {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ivory); color: var(--ink);
  font-family: "Playfair Display", serif; font-style: italic; font-size: 18px;
}
.person-main { display: flex; gap: 12px; align-items: center; }
.inline { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 14px; }
.inline input, .inline select, dialog input, dialog select, dialog textarea {
  background: #0c0c0c;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 12px;
}
.inline input { min-width: 140px; }
.low td:first-child { color: var(--warn); }

.colophon {
  display: flex;
  gap: 22px;
  margin-top: 36px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}
.colophon a { text-decoration: none; }
.colophon a:hover { color: var(--ivory); }

dialog {
  width: min(880px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: hidden;
  border: 1px solid rgba(198, 165, 106, 0.35);
  border-radius: 28px;
  background: #10100e;
  color: var(--text);
  padding: 0;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.74); }
dialog form {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 28px);
  padding: 0;
  overflow: hidden;
}
.dialog-body { overflow: auto; padding: 0 24px 12px; }
dialog header, dialog footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 24px; }
dialog footer {
  position: sticky;
  bottom: 0;
  background: #16140f;
  border-top: 1px solid var(--line);
}
#save-bar {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 14px 12px 20px;
  background: var(--ivory);
  color: var(--ink);
  border-radius: 999px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}
#save-bar[hidden], #stage[hidden], #gate[hidden] { display: none; }
#gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.gate-card {
  width: min(420px, 100%);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 32px 28px 28px;
}
.gate-card img {
  width: 148px;
  display: block;
  background: #fff;
  border-radius: 16px;
  padding: 8px 10px 4px;
  margin-bottom: 22px;
}
.gate-card h1 { font-size: 64px; margin-bottom: 18px; }
.gate-card label { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--muted); }
.gate-card input {
  background: #0c0c0c;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 12px;
  font-size: 16px;
}
.gate-card .solid { width: 100%; margin-top: 16px; }
#gate-error { color: var(--danger); margin: 12px 0 0; }
#save-bar p { margin: 0; font-size: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0; }
.grid-2 label, fieldset { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.span-2 { grid-column: span 2; }
fieldset { border: 1px solid var(--line); border-radius: 18px; padding: 14px; margin: 0 0 16px; }
.assign-row { display: grid; grid-template-columns: 1.4fr repeat(3, 0.7fr) auto; gap: 8px; margin-bottom: 8px; }

@media (max-width: 980px) {
  .mast, .cards, .layout, .grid-2, .assign-row { grid-template-columns: 1fr; }
  nav { gap: 0; }
  main { padding: 22px 16px 32px; }
  h1 { font-size: 52px; }
  .span-2 { grid-column: auto; }
}
