/* ============================================================
   GGWS — Golden Gate Prep Schedule
   Editorial warm-paper aesthetic for 55"+ TV display
   ============================================================ */

/* ------------------------------------------------------------
   Fonts: Geist from Google Fonts CDN, system fallback
   ------------------------------------------------------------ */
/* Google Fonts link is in <head>; this rule handles failure */
:root {
  --font-sans: "Geist", ui-sans-serif, -apple-system, system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", "Cascadia Mono", monospace;
}

/* ------------------------------------------------------------
   Design tokens — light mode ("warm paper")
   ------------------------------------------------------------ */
:root {
  --paper:         #faf7f2;
  --paper-sunken:  #f3efe6;
  --ink:           #1a1814;
  --muted:         #6b655a;
  --faint:         #9c958a;
  --rule:          rgba(26, 24, 20, 0.08);
  --accent:        #c94a2c;
  --today-tint:    rgba(201, 74, 44, 0.045);
  --shadow-sm:     0 1px 2px rgba(26,24,20,0.04);
  --shadow-md:     0 1px 2px rgba(26,24,20,0.04), 0 4px 16px rgba(26,24,20,0.06);

  /* Tag hues — muted, ~30% saturation */
  --tag-slate:  #4a5d7a;
  --tag-olive:  #5d5a4a;
  --tag-wine:   #7a4a4a;
  --tag-forest: #4a5d3f;
  --tag-rust:   #7a5d4a;
  --tag-plum:   #5d4a6b;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:         #17130d;
    --paper-sunken:  #1e1913;
    --ink:           #f5f0e5;
    --muted:         #a39a88;
    --faint:         #6b6555;
    --rule:          rgba(245, 240, 229, 0.08);
    --accent:        #e85f42;
    --today-tint:    rgba(232, 95, 66, 0.07);
    --shadow-sm:     0 1px 2px rgba(0,0,0,0.4);
    --shadow-md:     0 1px 2px rgba(0,0,0,0.4), 0 4px 16px rgba(0,0,0,0.3);
  }
}

/* ------------------------------------------------------------
   Reset + base
   ------------------------------------------------------------ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: clamp(0.875rem, 1vw, 1rem);
  line-height: 1.5;
  background: var(--paper);
  color: var(--ink);
  min-height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Screen-reader-only utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ============================================================
   LOGIN GATE
   ============================================================ */
.login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 24px;
  background: var(--paper);
}

.login-card {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.login-brand {
  text-align: center;
}

.login-brand .brand {
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  text-transform: uppercase;
  color: var(--ink);
  line-height: 1;
}

.login-brand .tagline {
  margin-top: 8px;
  font-size: clamp(0.875rem, 1vw, 1rem);
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.password-input {
  font-family: var(--font-sans);
  font-size: 1rem;
  width: 100%;
  height: 52px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  padding: 0 4px;
  outline: none;
  transition: border-color 150ms ease;
  appearance: none;
  -webkit-appearance: none;
}

.password-input::placeholder {
  color: var(--faint);
}

.password-input:focus-visible {
  border-bottom-color: var(--accent);
}

.login-btn {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  width: 100%;
  height: 52px;
  margin-top: 16px;
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  outline: none;
  transition: opacity 120ms ease;
}

.login-btn:hover {
  opacity: 0.88;
}

.login-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.login-btn:active {
  opacity: 0.75;
}

.login-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.login-error {
  margin-top: 12px;
  font-size: 0.875rem;
  color: var(--accent);
  min-height: 1.25em;
  text-align: center;
}

/* ============================================================
   SCHEDULE VIEW
   ============================================================ */
.schedule-view {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-height: 100dvh;
  padding: 48px;
  gap: 32px;
  overflow: hidden;
}

/* ------------------------------------------------------------
   Header
   ------------------------------------------------------------ */
.schedule-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--rule);
}

.title-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.title-block .brand {
  font-size: clamp(3rem, 6vw, 5rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  text-transform: uppercase;
  color: var(--ink);
  line-height: 1;
}

/* Accent on "Golden" — the red strike is the Golden Gate bridge */
.title-block .brand-accent {
  color: var(--accent);
}

.prep-week {
  font-family: var(--font-mono);
  font-size: clamp(0.875rem, 1vw, 1.125rem);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.as-of-block {
  text-align: right;
  flex-shrink: 0;
}

.as-of-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

.as-of-value {
  font-family: var(--font-mono);
  font-size: clamp(0.875rem, 1vw, 1.125rem);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------
   Days grid — 9 columns: time-axis + yesterday + 7 day columns
   7 rows:  today-slot | day-header | all-day | early | morning | afternoon | evening
   ------------------------------------------------------------ */
.days-grid {
  display: grid;
  grid-template-columns: 44px 72px repeat(7, minmax(0, 1fr));
  /* Bands are CONTENT-sized so 1200/1800 gridlines sit flush against the
     bottom of the tallest column's content in each time band, instead of
     stretching to fill empty vertical space. */
  grid-template-rows:
    auto    /* row 1: today-slot */
    auto    /* row 2: day-header */
    auto    /* row 3: all-day band */
    auto    /* row 4: early band (before 8am) */
    auto    /* row 5: morning band (8am–noon) */
    auto    /* row 6: afternoon band (noon–6pm) */
    auto;   /* row 7: evening band (after 6pm) */
  column-gap: 12px;
  row-gap: 0;
  flex: 1;
  min-height: 0;
  /* Grid items must STRETCH to fill their row (default behavior).
     `align-items: start` was letting band elements take their natural
     content size and overflow past their grid row into the next row's
     Y space — defeating overflow: hidden on the band. */
  align-content: start;
  align-items: stretch;
}

/* ------------------------------------------------------------
   Time axis — grid column 1, spans all rows
   ------------------------------------------------------------ */
.time-axis {
  grid-column: 1;
  grid-row: 1 / -1;
  display: grid;
  /* Mirror the same 7 rows as .days-grid — all auto */
  grid-template-rows:
    auto    /* today-slot */
    auto    /* day-header */
    auto    /* all-day band */
    auto    /* early band */
    auto    /* morning band */
    auto    /* afternoon band */
    auto;   /* evening band */
  height: 100%;
  align-self: stretch;
}

.time-axis-cell {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding-top: 4px;
  padding-right: 6px;
}

.time-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
}

/* Empty axis cells for today-slot, header, all-day, early rows */
.time-axis-cell--empty {
  /* Occupies the space, no content */
}

/* ------------------------------------------------------------
   TODAY slot — row 1, same height on every column
   ------------------------------------------------------------ */
.today-slot {
  min-height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ------------------------------------------------------------
   Day column — normal (today + 6 forward)
   Each column occupies one grid column, 7 grid rows individually
   ------------------------------------------------------------ */

/* today-slot: row 1 */
.day-col-today-slot {
  grid-row: 1;
}

/* day-header: row 2 */
.day-col-header {
  grid-row: 2;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 0;
  padding-top: 4px;
}

.day-name {
  font-size: clamp(1.125rem, 1.3vw, 1.5rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink);
  line-height: 1.1;
}

.day-meta {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 3px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

/* all-day band: row 3 */
.day-col-allday {
  grid-row: 3;
  padding-top: 6px;
  padding-bottom: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Time bands: rows 4–7 */
.day-col-band {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.day-col-band--early    { grid-row: 4; }
.day-col-band--morning  { grid-row: 5; border-top: 1px dashed var(--rule); }
.day-col-band--afternoon{ grid-row: 6; border-top: 1px dashed var(--rule); }
.day-col-band--evening  { grid-row: 7; border-top: 1px dashed var(--rule); }

/* Inner container for scroll-loop animation */
.band-inner {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 0 6px;
  will-change: transform;
}

/* Today column tint — data-today="true" is set directly on each cell element */
.day-col-today-slot[data-today="true"],
.day-col-header[data-today="true"],
.day-col-allday[data-today="true"],
.day-col-band[data-today="true"] {
  background: var(--today-tint);
}

/* Round the top corners on the today-slot cell */
.day-col-today-slot[data-today="true"] {
  border-radius: 8px 8px 0 0;
}

/* Round the bottom corners on the last band cell */
.day-col-band--evening[data-today="true"] {
  border-radius: 0 0 8px 8px;
}

/* ------------------------------------------------------------
   Yesterday column — grid column 2, spans all rows
   ------------------------------------------------------------ */
.yesterday-col {
  grid-column: 2;
  grid-row: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 0;
  opacity: 0.7;
  overflow: hidden;
}

.yesterday-spacer {
  /* Matches today-slot height so yesterday header aligns with day headers */
  min-height: 1.5rem;
}

.yesterday-header {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
  padding-top: 4px;
  margin-bottom: 6px;
}

.yesterday-label {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.2;
}

.yesterday-date {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--faint);
  margin-top: 2px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

.yesterday-events {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow: hidden;
}

.yesterday-event {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.45;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

/* ------------------------------------------------------------
   All-day event band (e.g. "PRE RIG", "COSTUME FREIGHT")
   ------------------------------------------------------------ */
.allday-band {
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  line-height: 1.3;
  background-color: var(--paper-sunken);  /* fallback; JS sets inline tinted color */
}

/* ------------------------------------------------------------
   Event card
   ------------------------------------------------------------ */
.event-card {
  position: relative;
  background: var(--paper-sunken);
  box-shadow: var(--shadow-sm);
  border-radius: 6px;
  padding: 10px 12px;
  overflow: hidden;
}

.event-card--completed {
  opacity: 0.45;
}

/* Postponed: diagonal stripe overlay */
.event-card--postponed::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 8px;
  background-image: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 6px,
    rgba(26, 24, 20, 0.06) 6px,
    rgba(26, 24, 20, 0.06) 8px
  );
  pointer-events: none;
}

@media (prefers-color-scheme: dark) {
  .event-card--postponed::after {
    background-image: repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 6px,
      rgba(245, 240, 229, 0.06) 6px,
      rgba(245, 240, 229, 0.06) 8px
    );
  }
}

.event-time {
  display: block;
  font-family: var(--font-mono);
  font-size: clamp(0.75rem, 0.8vw, 0.875rem);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-bottom: 2px;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

.event-title {
  font-size: clamp(0.9375rem, 1vw, 1.125rem);
  font-weight: 600;
  letter-spacing: 0.015em;
  text-transform: uppercase;
  color: var(--ink);
  line-height: 1.2;
  /* Clamp title to at most 2 lines with ellipsis on TV — long titles don't dominate */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.event-postponed-label {
  display: block;
  font-size: 0.625rem;
  font-style: italic;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-top: 2px;
}

.event-location {
  display: block;
  font-size: clamp(0.75rem, 0.85vw, 0.875rem);
  font-style: italic;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.3;
  /* Clamp to 1 line */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-attendees {
  display: -webkit-box;
  font-size: clamp(0.75rem, 0.85vw, 0.875rem);
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.3;
  /* Clamp attendee list to 2 lines with ellipsis — long casts don't blow up cards */
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.event-tags {
  display: flex;
  flex-wrap: nowrap;  /* no wrap — all tags on one line */
  gap: 4px;
  margin-top: 4px;
  overflow: hidden;
}

.tag-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #fff;
  line-height: 1.6;
  font-weight: 500;
}

/* ------------------------------------------------------------
   Empty day placeholder
   ------------------------------------------------------------ */
.day-empty {
  font-size: 0.75rem;
  color: var(--faint);
  padding: 8px 0;
  letter-spacing: 0.03em;
}

/* ------------------------------------------------------------
   Footer
   ------------------------------------------------------------ */
.schedule-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  margin-top: auto;
}

#footer-status {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--faint);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.demo-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--paper-sunken);
  border: 1px solid var(--rule);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 8px;
  font-family: var(--font-mono);
  vertical-align: middle;
}

.logout-btn {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--faint);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: color 120ms ease;
  outline: none;
  flex-shrink: 0;
}

.logout-btn:hover {
  color: var(--muted);
}

.logout-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ============================================================
   ANIMATIONS — initial column fade-up
   ============================================================ */
@keyframes column-enter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.day-col-entering {
  animation: column-enter 320ms cubic-bezier(0.32, 0.72, 0, 1) both;
}

@media (prefers-reduced-motion: reduce) {
  @keyframes column-enter {
    from { opacity: 0; }
    to   { opacity: 1; }
  }

  .day-col-entering {
    animation-duration: 150ms;
  }
}

/* ============================================================
   SETUP PAGE
   ============================================================ */
.setup-page {
  background: var(--paper);
  color: var(--ink);
}

.setup-page main {
  max-width: 680px;
  margin: 0 auto;
  padding: 64px 32px 96px;
}

.setup-page h1 {
  font-size: clamp(3rem, 6vw, 5rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  text-transform: uppercase;
  color: var(--ink);
  line-height: 1;
  margin-bottom: 8px;
}

.setup-page > main > p {
  font-size: clamp(0.875rem, 1vw, 1rem);
  color: var(--muted);
  margin-bottom: 48px;
  line-height: 1.6;
}

.setup-page section {
  margin-bottom: 48px;
  padding-bottom: 48px;
  border-bottom: 1px solid var(--rule);
}

.setup-page section:last-child {
  border-bottom: none;
}

.setup-page h2 {
  font-size: clamp(1.5rem, 2vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 16px;
  line-height: 1.15;
}

.setup-page p {
  font-size: clamp(0.875rem, 1vw, 1rem);
  color: var(--ink);
  line-height: 1.6;
  margin-bottom: 16px;
}

.setup-page strong {
  font-weight: 600;
  color: var(--ink);
}

.setup-page input[type="password"] {
  font-family: var(--font-sans);
  font-size: 1rem;
  width: 100%;
  max-width: 360px;
  height: 52px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  padding: 0 4px;
  outline: none;
  display: block;
  margin-bottom: 16px;
  transition: border-color 150ms ease;
  appearance: none;
  -webkit-appearance: none;
}

.setup-page input[type="password"]:focus-visible {
  border-bottom-color: var(--accent);
}

.setup-page button,
.setup-page .button {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  display: inline-block;
  height: 48px;
  padding: 0 28px;
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  line-height: 48px;
  outline: none;
  transition: opacity 120ms ease;
}

.setup-page button:hover,
.setup-page .button:hover {
  opacity: 0.88;
}

.setup-page button:focus-visible,
.setup-page .button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.setup-page .status {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--muted);
  margin-top: 12px;
  font-variant-numeric: tabular-nums;
  min-height: 1.5em;
  display: block;
}

.setup-page pre {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  background: var(--paper-sunken);
  color: var(--ink);
  padding: 20px 24px;
  border-radius: 8px;
  overflow-x: auto;
  line-height: 1.6;
  margin-top: 16px;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ============================================================
   MOBILE — single column stack below 900px
   ============================================================ */
@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .schedule-view {
    height: auto;
    max-height: none;
    min-height: 100dvh;
    overflow: visible;
    padding: 24px 20px;
    gap: 24px;
  }

  .schedule-header {
    flex-direction: column;
    gap: 12px;
    padding-bottom: 16px;
  }

  .title-block .brand {
    font-size: clamp(2rem, 8vw, 3rem);
  }

  .as-of-block {
    text-align: left;
  }

  /* On mobile: switch to vertical flex layout */
  .days-grid {
    display: flex;
    flex-direction: column;
    gap: 32px;
  }

  /* Yesterday becomes a normal section at the top */
  .yesterday-col {
    grid-column: unset;
    grid-row: unset;
    opacity: 0.7;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--rule);
  }

  /* Time axis hidden on mobile */
  .time-axis {
    display: none;
  }

  /* Each day column: each cell stacks naturally as a flex column */
  .day-col-today-slot,
  .day-col-header,
  .day-col-allday,
  .day-col-band {
    /* In flex column layout, these stack as block elements */
    display: block;
  }

  /* Each "day" on mobile: wrap all the cells for a single day into a block.
     Since each cell is a separate grid child in desktop, on mobile we rely on
     the JS wrapping them in a .mobile-day-wrap div (added by renderSchedule). */
  .mobile-day-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .day-col-band--morning,
  .day-col-band--afternoon,
  .day-col-band--evening {
    border-top: 1px dashed var(--rule);
    padding-top: 4px;
  }

  .event-card {
    padding: 14px;
  }

  .event-title {
    font-size: clamp(1rem, 4vw, 1.25rem);
  }

  .schedule-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* ============================================================
   ADMIN PAGE
   ============================================================ */
.admin-page {
  background: var(--paper);
  color: var(--ink);
}
.admin-view {
  max-width: 1080px;
  margin: 0 auto;
  padding: 40px 32px 80px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 24px;
}
.admin-header .brand {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
}
.admin-header-actions,
.chat-header-actions {
  display: flex;
  gap: 16px;
  align-items: center;
}
.admin-link {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.875rem;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  padding: 6px 10px;
}
.admin-link:hover {
  color: var(--ink);
}

.admin-panel {
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 24px;
  background: var(--paper-sunken);
}
.admin-section-title {
  font-size: clamp(1rem, 1.2vw, 1.25rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
}
.admin-empty {
  color: var(--muted);
  font-style: italic;
}
.admin-accordion {
  margin-bottom: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
}
.admin-accordion:last-child {
  border-bottom: none;
}
.admin-accordion summary {
  font-weight: 600;
  cursor: pointer;
  padding: 8px 0;
}
.admin-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}
.admin-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--muted);
}
.admin-form input,
.admin-form select,
.admin-form textarea {
  font-family: inherit;
  font-size: 1rem;
  padding: 8px 12px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
}
.admin-form button {
  align-self: flex-start;
  background: var(--ink);
  color: var(--paper);
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
}
.admin-form button:hover {
  opacity: 0.9;
}
.admin-output {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-all;
}

/* Proposal cards */
.proposals-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.proposal-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.proposal-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.75rem;
  color: var(--muted);
  flex-wrap: wrap;
}
.kind-pill, .state-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
  font-family: var(--font-mono);
}
.kind-pill { background: #4a5d7a; color: #fff; }
.kind-new_event { background: #4a5d3f; }
.kind-modification { background: #5d5a4a; }
.kind-postpone { background: #7a4a4a; }
.kind-day_note_update { background: #5d4a6b; }

.state-pill { background: var(--muted); color: var(--paper); }
.state-proposed { background: var(--accent); }
.state-drafting { background: #7a5d4a; }
.state-admin { background: var(--ink); color: var(--paper); }
.state-proposer { background: #4a5d7a; color: #fff; }
.state-viewer { background: var(--muted); color: var(--paper); }

.proposal-card h3 {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.015em;
  text-transform: uppercase;
}
.proposal-card .muted {
  font-size: 0.8125rem;
}
.proposal-card .rationale {
  font-size: 0.875rem;
  color: var(--muted);
  font-style: italic;
}
.proposal-card pre {
  background: var(--paper-sunken);
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  overflow-x: auto;
}
.proposal-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.proposal-actions button {
  background: var(--ink);
  color: var(--paper);
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
}
.proposal-actions button.danger {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.proposal-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sessions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.session-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 12px;
  background: var(--paper);
  border-radius: 4px;
  font-size: 0.875rem;
  flex-wrap: wrap;
}
.session-row button {
  margin-left: auto;
}

/* ============================================================
   CHAT PAGE
   ============================================================ */
.chat-page {
  background: var(--paper);
  color: var(--ink);
}
.chat-view {
  max-width: 760px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 32px 24px;
  gap: 20px;
}
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 20px;
}
.chat-title {
  font-size: clamp(1.5rem, 2vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.chat-transcript {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 12px 0;
}
.chat-message {
  padding: 12px 16px;
  border-radius: 8px;
  max-width: 85%;
}
.chat-message strong {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 6px;
}
.chat-message p {
  font-size: 0.9375rem;
  line-height: 1.5;
}
.chat-message--user {
  background: var(--paper-sunken);
  align-self: flex-end;
}
.chat-message--assistant {
  background: transparent;
  border: 1px solid var(--rule);
  align-self: flex-start;
}
.chat-message--system {
  font-size: 0.75rem;
  color: var(--muted);
  font-style: italic;
  text-align: center;
  max-width: 100%;
}
.chat-form {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  border-top: 1px solid var(--rule);
  padding-top: 20px;
}
.chat-input {
  flex: 1;
  font-family: inherit;
  font-size: 1rem;
  padding: 12px 16px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  resize: vertical;
  line-height: 1.4;
}
.chat-input:focus {
  outline: none;
  border-color: var(--accent);
}
.chat-send-btn {
  background: var(--ink);
  color: var(--paper);
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
}
.chat-send-btn:hover {
  opacity: 0.9;
}
.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================================
   HIDDEN UTILITY
   ============================================================ */
[hidden] {
  display: none !important;
}
