:root {
  color-scheme: light;
  --bg: #f3f0e9;
  --card: #fffdf8;
  --text: #201c18;
  --muted: #746b61;
  --line: #e7dfd3;
  --accent: #9f2f13;
  --gold: #9a6b1d;
  --accent-soft: #f0e7dc;
  --danger: #a33a35;
  --shadow: 0 18px 50px rgb(52 43 31 / 8%);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }

.gate-view { min-height: 100svh; display: grid; place-items: center; padding: 20px; }
.gate-card { display: grid; gap: 16px; width: min(420px, 100%); padding: 24px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.gate-card h1 { font-size: clamp(2.4rem, 12vw, 4rem); }
.page-shell { width: min(1080px, 100%); margin: 0 auto; padding: clamp(18px, 4vw, 36px); }
.top-bar { position: relative; display: flex; align-items: center; justify-content: center; gap: 16px; padding-right: 42px; }
.view-nav { justify-self: center; display: flex; gap: 4px; padding: 4px; background: #fffaf2; border: 1px solid var(--line); border-radius: 999px; box-shadow: 0 1px 0 rgb(0 0 0 / 4%); }
.nav-button { border: 0; border-radius: 999px; padding: 10px 14px; background: transparent; color: var(--text); font-weight: 650; }
.nav-button.active { background: var(--text); color: white; }
.user-pill { position: absolute; right: 0; top: 50%; transform: translateY(-50%); display: inline-flex; align-items: center; gap: 8px; min-width: 0; padding: 0; border: 0; background: transparent; color: var(--text); font-size: 0.9rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.avatar { display: grid; place-items: center; flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; background: #f1c5a6; color: var(--accent); font-weight: 800; font-size: 0.75rem; text-transform: uppercase; }

.hero { padding: clamp(24px, 5vw, 38px) 4px 24px; }
.compact-hero { padding-bottom: 18px; }
.eyebrow { margin: 0 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.22em; font-size: 0.68rem; font-weight: 800; }
h1 { margin: 0; font: 500 clamp(2.5rem, 7vw, 4.9rem)/0.98 Georgia, "Times New Roman", serif; letter-spacing: -0.055em; }
h1 .headline-count { color: var(--accent); font-style: italic; }
.muted { color: var(--muted); }
.hero .muted { margin-top: 10px; }

.home-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.95fr); gap: 18px; align-items: start; }
.home-main-column { display: grid; gap: 18px; }
.bulletin-panel { display: grid; gap: 12px; }
.bulletin-panel .section-heading { margin-bottom: 0; }
.bulletin-edit-button { width: 34px; height: 34px; padding: 0; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; line-height: 1; }
.bulletin-edit-button span { display: block; line-height: 1; transform: translateY(-1px); }
.bulletin-text { margin: 0; white-space: pre-wrap; line-height: 1.45; }
.bulletin-meta { margin: 2px 0 0; font-size: 0.74rem; }
.empty-bulletin { color: var(--muted); font-style: italic; }
.bulletin-body { min-height: 140px; resize: vertical; }
.bulletin-field { margin-bottom: 8px; }
.link-button { border: 0; padding: 0; background: transparent; color: var(--accent); font-weight: 800; text-align: left; text-decoration: underline; text-underline-offset: 2px; }
.bulletin-clear-link { justify-self: start; margin-top: 2px; font-size: 0.78rem; }
.bulletin-modal-actions { margin-top: 8px; }
#bulletin-status { margin: 0; font-size: 0.82rem; }
.card, .day-card { background: color-mix(in srgb, var(--card) 92%, white); border: 1px solid rgb(231 223 211 / 70%); border-radius: 16px; box-shadow: var(--shadow); }
.card { padding: clamp(18px, 3vw, 24px); }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
h2 { margin: 0; font-size: 1rem; line-height: 1.2; }
.section-heading .muted { margin: 6px 0 0; font-size: 0.86rem; }
.hidden { display: none !important; }

.icon-button, .secondary-button { border: 1px solid var(--line); border-radius: 999px; padding: 9px 13px; background: #fffaf2; color: var(--text); font-weight: 750; }
.shift-unclaim-button { padding: 5px 9px; color: var(--danger); font-size: 0.72rem; line-height: 1; }
.coverage-list, .shift-list, .schedule { display: grid; gap: 0; }
.coverage-row, .shift-row { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 18px; align-items: center; padding: 20px 0; border-top: 1px solid var(--line); }
.coverage-row { grid-template-columns: 54px minmax(0, 1fr); }
.coverage-row { min-height: 98px; }
.coverage-row:first-child, .shift-row:first-child { border-top: 0; }
.date-chip { width: 54px; border: 0; background: transparent; text-align: center; line-height: 1; text-transform: uppercase; letter-spacing: 0.16em; color: var(--muted); font-size: 0.62rem; }
.date-chip strong { display: block; margin: 4px 0 0; color: var(--text); font: 500 1.55rem/0.9 Georgia, serif; letter-spacing: -0.04em; text-transform: none; }
.coverage-row .date-chip { align-self: center; }
.slot-chip-list { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-items: center; }
.coverage-slot-cell { position: relative; display: grid; justify-items: center; min-width: 96px; }
.coverage-slot-cell small { position: absolute; top: calc(100% + 5px); left: 50%; transform: translateX(-50%); color: #3e7a4d; font-size: 0.68rem; font-weight: 800; line-height: 1; text-align: center; white-space: nowrap; }
.coverage-claim-button small { position: static; transform: none; color: inherit; font-size: 0.68rem; }
.appointment-chip { line-height: 0.95; padding-block: 5px; font-size: 0.72rem; }
.appointment-chip small { display: block; }
.appointment-chip-unclaimed { background: #fff0ef; border-color: #efc0bc; color: var(--text); }
.coverage-slot-cell .coverage-unclaimed-label { color: var(--danger); font-size: 0.58rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.06em; }
.slot-chip { display: inline-flex; align-items: center; justify-content: center; text-align: center; border: 1px solid var(--line); border-radius: 999px; padding: 8px 13px; background: #fffaf2; color: var(--text); font-size: 0.84rem; }
.slot-chip-filled { border-color: #b8d8bf; background: #e8f4eb; color: #265d34; cursor: default; }
button.slot-chip:hover, .icon-button:hover, .secondary-button:hover { border-color: #d7cab9; background: white; }
.empty-state { padding: 24px 0; color: var(--muted); }

.shift-row { grid-template-columns: 48px minmax(0, 1fr) auto; }
.activity-feed { display: grid; gap: 0; }
.activity-item { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start; padding: 14px 0; border-top: 1px solid var(--line); }
.activity-item:first-child { border-top: 0; }
.activity-token { min-width: 78px; border-radius: 999px; padding: 5px 9px; text-align: center; font-size: 0.68rem; font-weight: 900; }
.activity-claimed { background: #e8f4eb; color: #265d34; }
.activity-assigned { background: #e9eef8; color: #2e4d85; }
.activity-unclaimed { background: #f8dddd; color: var(--danger); }
.activity-commented { background: var(--accent-soft); color: var(--accent); }
.activity-renamed { background: #fffaf2; color: var(--muted); border: 1px solid var(--line); }
.activity-bulletin_updated { background: #fff0d8; color: var(--gold); }
.activity-joined, .activity-participant_added { background: #e8f4eb; color: #265d34; }
.activity-left, .activity-participant_removed, .activity-comment_deleted { background: #f8dddd; color: var(--danger); }
.activity-item strong { font-size: 0.94rem; }
.activity-slot, .activity-time { margin-top: 3px; color: var(--muted); font-size: 0.82rem; }
.activity-time { opacity: 0.78; }
.shift-title { display: flex; align-items: center; gap: 8px; font-weight: 750; }
.shift-note { margin-top: 6px; color: var(--muted); font: italic 0.9rem Georgia, serif; }
.calendar-toolbar { display: flex; justify-content: flex-end; gap: 8px; margin: 0 0 12px; }
.calendar-toolbar .secondary-button:disabled { opacity: 0.45; cursor: not-allowed; }
.calendar-card { margin-top: 0; overflow: hidden; }
.appointments-card { margin-top: 16px; }
.appointment-item { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; }
.appointment-actions { display: flex; gap: 8px; margin-top: 0; align-items: center; }
.appointment-actions .menu-item { width: auto; padding-inline: 12px; }
.calendar-cell-open small { display: block; margin-top: 3px; color: var(--muted); font-size: 0.72rem; }
.appointment-unclaimed-label { display: block; margin: -1px 0 5px; color: var(--danger); font-size: 0.5rem; font-style: normal; font-weight: 900; line-height: 1; text-transform: uppercase; letter-spacing: 0.06em; }
.appointment-cell-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-size: 0.74rem; font-weight: 750; line-height: 1.05; }
.open-cell-label { font-size: 0.58rem; font-weight: 400; }
.calendar-scroll-hint { display: none; margin: 0 0 10px; color: var(--muted); font-size: 0.78rem; font-weight: 750; text-align: right; }
.calendar-grid-wrap { position: relative; overflow-x: auto; padding-bottom: 4px; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.calendar-grid-wrap::after { content: ""; position: sticky; right: 0; display: block; float: right; width: 28px; height: 1px; margin-top: -1px; pointer-events: none; box-shadow: -18px 0 24px 20px var(--card); }
.calendar-grid { display: grid; grid-template-columns: 92px repeat(var(--day-count), minmax(118px, 1fr)); gap: 5px; min-width: 920px; }
.calendar-corner { position: sticky; left: 0; z-index: 3; display: flex; align-items: center; padding: 14px 10px; background: var(--card); color: var(--muted); text-transform: uppercase; letter-spacing: 0.18em; font-size: 0.68rem; font-weight: 800; }
.calendar-day-head { display: grid; grid-template-columns: 1fr auto; align-items: start; min-height: 58px; border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; background: #ece5da; color: var(--text); text-align: left; }
.calendar-day-head span { color: var(--muted); text-transform: uppercase; letter-spacing: 0.16em; font-size: 0.58rem; font-weight: 850; }
.calendar-day-head strong { grid-column: 1; font: 500 1.55rem/1 Georgia, serif; }
.calendar-day-head em { color: var(--accent); text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.52rem; font-style: normal; font-weight: 900; }
.calendar-day-head.today { background: var(--text); color: white; border-color: var(--text); }
.calendar-day-head.today span { color: #c8bfb3; }
.calendar-shift-label { position: sticky; left: 0; z-index: 2; display: flex; align-items: center; min-height: 58px; padding: 10px; background: var(--card); color: var(--muted); font-size: 0.86rem; }
.calendar-cell { min-height: 58px; border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: #fffaf2; color: var(--muted); text-align: left; }
.calendar-cell-open { display: flex; align-items: center; justify-content: center; text-align: center; }
.calendar-cell-open:hover { border-color: #d7cab9; background: white; }
.calendar-cell-appointment-open { background: #fff0ef; border-color: #efc0bc; color: var(--text); padding-top: 6px; }
.calendar-cell-appointment-open:hover { background: #fff6f5; border-color: #df9d98; }
.calendar-cell-filled { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; align-items: center; background: #dcefdc; border-color: #c5e0c7; color: var(--text); cursor: pointer; }
.calendar-cell-appointment-claimed { background: #e7f1fb; border-color: #bdd7ef; }
.calendar-cell-filled:hover { border-color: #95c89c; }
.calendar-cell-appointment-claimed:hover { border-color: #8fbce3; background: #edf6ff; }
.calendar-avatar { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #bce2c1; color: #2d7040; font-size: 0.62rem; font-weight: 900; text-transform: uppercase; }
.calendar-cell-appointment-claimed .calendar-avatar { background: #a9cfee; color: #24577e; }
.calendar-cell-copy { min-width: 0; }
.calendar-cell-copy div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.83rem; }
.comment-indicator { display: inline-block; margin-top: 4px; margin-right: 4px; color: var(--muted); font-style: normal; font-size: 0.82rem; line-height: 1; }
.day-card { padding: 18px 20px; scroll-margin-top: 24px; margin-bottom: 14px; }
.day-card h3 { margin: 0 0 8px; font: 500 1.35rem Georgia, serif; }
.slot { display: grid; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.slot:first-of-type { border-top: 0; }
.slot-main { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.slot-title { font-weight: 800; }
.reserved { color: var(--muted); }
.slot-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-items: center; }
.reserve-button, .quick-reserve-button { border: 0; border-radius: 999px; padding: 10px 14px; background: var(--text); color: white; font-weight: 800; }
.field-label { display: grid; gap: 6px; color: var(--muted); font-size: 0.9rem; font-weight: 700; }
input, textarea { width: 100%; max-width: 100%; border: 1px solid #d7c8bc; border-radius: 12px; padding: 10px; color: var(--text); background: white; }
.slot-menu { position: relative; }
.slot-menu summary { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 999px; background: #fffaf2; border: 1px solid var(--line); color: var(--text); font-size: 1.35rem; font-weight: 900; cursor: pointer; list-style: none; }
.slot-menu summary::-webkit-details-marker { display: none; }
.menu-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 5; min-width: 150px; padding: 6px; background: white; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 14px 35px rgb(68 45 25 / 18%); }
.menu-item { width: 100%; border: 0; border-radius: 10px; padding: 10px 12px; background: transparent; color: var(--text); text-align: left; font-weight: 750; }
.menu-item:hover { background: var(--accent-soft); }
.unclaim-button { color: var(--danger); }
.name-dialog { width: min(420px, calc(100% - 32px)); border: 0; border-radius: 22px; padding: 0; box-shadow: 0 24px 70px rgb(68 45 25 / 28%); }
.name-dialog::backdrop { background: rgb(47 42 37 / 45%); }
.name-card { display: grid; gap: 16px; padding: 20px; background: var(--card); }
.name-card input { width: 100%; max-width: 100%; min-width: 0; }
.easter-egg-dialog { width: min(360px, calc(100% - 32px)); }
.easter-egg-card { position: relative; padding: 14px; }
.easter-egg-close { position: absolute; top: 8px; right: 8px; z-index: 1; }
.easter-egg-gif { display: block; width: 100%; border-radius: 16px; }
.reservation-drawer { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
.reservation-drawer.open { pointer-events: auto; }
.drawer-backdrop { position: absolute; inset: 0; background: rgb(47 42 37 / 0%); transition: background 160ms ease; }
.reservation-drawer.open .drawer-backdrop { background: rgb(47 42 37 / 38%); }
.drawer-card { position: absolute; top: 0; right: 0; display: flex; flex-direction: column; gap: 18px; width: min(420px, 92vw); height: 100%; padding: 24px; background: var(--card); box-shadow: -18px 0 50px rgb(52 43 31 / 18%); transform: translateX(100%); transition: transform 180ms ease; overflow-y: auto; }
.reservation-drawer.open .drawer-card { transform: translateX(0); }
.drawer-card .section-heading, .name-card .section-heading { align-items: flex-start; flex-direction: row; margin-bottom: 2px; }
.drawer-card .section-heading > div, .name-card .section-heading > div { min-width: 0; }
.drawer-card h2, .name-card h2 { font: 700 1.15rem/1.12 ui-sans-serif, system-ui, sans-serif; letter-spacing: -0.03em; }
.drawer-close-button { display: flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 34px; height: 34px; padding: 0 0 2px; border: 1px solid var(--line); border-radius: 999px; background: #fffaf2; color: var(--text); font-size: 1.2rem; font-weight: 800; line-height: 1; }
.drawer-card .field-label { gap: 8px; }
.participants-section, .slot-comments-section { display: grid; gap: 10px; }
.participants-section h3, .slot-comments-section h3 { margin: 0; font-size: 0.92rem; }
.participant-list, .comment-list { display: grid; gap: 8px; }
.participant-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 12px; background: #fffaf2; font-weight: 750; }
.compact-empty { padding: 4px 0; margin: 0; font-size: 0.86rem; }
.comment-row { display: grid; gap: 5px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 12px; background: #fffaf2; }
.comment-row p { margin: 0; white-space: pre-wrap; }
.comment-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 0.78rem; }
.comment-actions { display: flex; gap: 10px; }
.comment-edit-textarea { width: 100%; min-height: 86px; resize: vertical; }
.comment-edit-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.comment-edit-actions .secondary-button, .comment-edit-actions .reserve-button { width: 100%; }
#participant-add-button, #comment-post-button { width: 100%; }
.drawer-appointment-details { display: grid; gap: 5px; padding: 12px; border: 1px solid #c5e0c7; border-radius: 14px; background: #e8f4eb; color: var(--text); }
.drawer-appointment-details .eyebrow { margin: 0; color: #2d7040; }
.drawer-appointment-details span { color: var(--muted); font-size: 0.9rem; }
.drawer-card input, .drawer-card textarea { min-height: auto; padding: 12px; font-size: 1rem; }
.fancy-select { position: relative; }
.fancy-select-trigger { display: flex; align-items: center; justify-content: space-between; width: 100%; border: 1px solid #d7c8bc; border-radius: 12px; padding: 12px; background: white; color: var(--text); font-size: 1rem; font-weight: 650; line-height: 1.2; }
.fancy-select-trigger span:last-child { display: flex; align-items: center; justify-content: center; line-height: 1; }
.fancy-select-options { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30; display: none; padding: 6px; background: white; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 14px 35px rgb(68 45 25 / 18%); }
.fancy-select.open .fancy-select-options { display: grid; gap: 4px; }
.fancy-select-option { display: flex; align-items: center; justify-content: space-between; width: 100%; border: 0; border-radius: 10px; padding: 10px 12px; background: transparent; color: var(--text); text-align: left; font-weight: 750; }
.fancy-select-option:hover, .fancy-select-option.selected { background: var(--accent-soft); }
.drawer-card textarea { resize: vertical; }
.inline-unclaim-button { justify-self: start; width: auto; border: 1px solid var(--line); border-radius: 999px; padding: 7px 11px; background: #fffaf2; color: var(--danger); font-size: 0.78rem; font-weight: 800; }
.drawer-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: center; margin-top: auto; padding-top: 12px; }
.drawer-actions-single { grid-template-columns: 1fr; }
.drawer-actions .reserve-button, .drawer-actions .secondary-button { width: 100%; }

@media (max-width: 820px) {
  .top-bar { justify-content: center; }
  .view-nav { justify-self: auto; }
  .home-grid { grid-template-columns: 1fr; }
  .coverage-row { grid-template-columns: 46px minmax(0, 1fr); }
  .shift-row { grid-template-columns: 46px minmax(0, 1fr) auto; }
  .shift-unclaim-button { grid-column: auto; justify-self: end; align-self: center; white-space: nowrap; }
  .slot-chip-list { grid-column: 2; justify-content: flex-start; }
}

@media (max-width: 560px) {
  .page-shell { padding: 16px; }
  .top-bar { gap: 12px; }
  .brand-name { white-space: normal; }
  .top-bar { padding-right: 38px; }
  .view-nav { width: 100%; }
  .nav-button { flex: 1; }
  .signed-in-label { display: none; }
  .hero { padding-top: 28px; }
  .section-heading { align-items: start; flex-direction: row; }
  .calendar-scroll-hint { display: block; }
  .calendar-card { padding-inline: 16px; }
  .calendar-grid { grid-template-columns: 82px repeat(var(--day-count), minmax(118px, 118px)); min-width: max-content; }
  .coverage-row { grid-template-columns: 40px 1fr; gap: 8px 12px; align-items: center; }
  .slot-chip-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; justify-content: stretch; width: 100%; }
  .coverage-slot-cell { min-width: 0; width: 100%; }
  .slot-chip { width: 100%; padding-inline: 6px; font-size: 0.76rem; }
  .slot-main { align-items: stretch; flex-direction: column; }
  .slot-actions { justify-content: flex-start; }
  .quick-reserve-button, .secondary-button, .reserve-button { width: 100%; }
  .shift-unclaim-button { width: auto; min-width: 0; padding: 5px 9px; }
  #refresh-button { width: 34px; height: 34px; padding: 0; display: grid; place-items: center; flex: 0 0 auto; }
  .slot-menu { align-self: flex-start; }
  .menu-panel { left: 0; right: auto; }
}
