:root {
  color-scheme: light;
  --ink: #211719;
  --muted: #6f5a5d;
  --red: #a4121c;
  --deep-red: #651019;
  --paper: #fff7f6;
  --blush: #f7d8d8;
  --line: #e8bcbc;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 0%, rgba(255, 220, 220, .34), transparent 35rem),
    linear-gradient(155deg, #bd1822 0%, #790f18 48%, #210b0e 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .12;
  background-image: repeating-linear-gradient(125deg, transparent 0 18px, #fff 19px 20px);
}

button, input, select { font: inherit; }

.page-shell {
  position: relative;
  width: min(100% - 2rem, 650px);
  margin-inline: auto;
  padding: clamp(1rem, 4vw, 3rem) 0 2rem;
}

.card {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 28px;
  background: rgba(255, 247, 246, .97);
  box-shadow: 0 28px 80px rgba(22, 3, 6, .45);
}

.brand {
  display: grid;
  min-height: 230px;
  place-items: center;
  padding: 1.25rem 2rem 1rem;
  background: linear-gradient(180deg, #c51922 0%, #fff 48%, #cc1a23 100%);
  border-bottom: 5px solid #171214;
}

.brand img {
  display: block;
  width: min(100%, 205px);
  height: auto;
  max-height: 210px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.content { padding: clamp(1.5rem, 5vw, 3rem); }
.eyebrow { margin: 0 0 .35rem; color: var(--red); font-size: .76rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(2rem, 8vw, 3.35rem); line-height: 1.02; letter-spacing: -.045em; }
.intro { max-width: 48ch; margin: .9rem 0 1.7rem; color: var(--muted); line-height: 1.6; }

.alert, .attendance-note {
  margin: 0 0 1.25rem;
  padding: .85rem 1rem;
  border: 1px solid #e2a3a6;
  border-radius: 12px;
  background: #fff0f0;
  color: #7e1119;
  font-weight: 650;
}

.login-form { display: grid; gap: .7rem; }
.login-form > label, legend { font-weight: 750; }
input[type="text"], input[type="password"], input[type="date"], input[type="number"], select {
  width: 100%;
  min-height: 50px;
  padding: .75rem .9rem;
  color: var(--ink);
  border: 1px solid #cbaeb1;
  border-radius: 11px;
  background: #fff;
  outline: none;
}
input:focus-visible { border-color: var(--red); box-shadow: 0 0 0 4px rgba(164, 18, 28, .14); }
fieldset { margin: .45rem 0; padding: 0; border: 0; }
legend { margin-bottom: .65rem; }
.group-options { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.group-option input { position: absolute; opacity: 0; }
.group-option span {
  display: grid;
  min-height: 50px;
  place-items: center;
  padding: .65rem;
  border: 1px solid #cbaeb1;
  border-radius: 11px;
  background: #fff;
  cursor: pointer;
  font-weight: 700;
}
.group-option input:checked + span { color: #fff; border-color: var(--red); background: var(--red); }
.group-option input:focus-visible + span { outline: 4px solid rgba(164, 18, 28, .18); outline-offset: 2px; }

button, .button-link {
  display: inline-grid;
  min-height: 52px;
  place-items: center;
  margin-top: .7rem;
  padding: .8rem 1.15rem;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, #ba1721, #7d0f18);
  box-shadow: 0 10px 26px rgba(126, 14, 23, .24);
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
}
button:hover, .button-link:hover { filter: brightness(1.08); }
button:focus-visible, .button-link:focus-visible { outline: 4px solid rgba(164, 18, 28, .25); outline-offset: 3px; }
.help-text, .updated-note { color: var(--muted); font-size: .9rem; line-height: 1.5; }

.status-content { text-align: center; }
.status-content .eyebrow { margin-top: .25rem; }
.attendance-note { margin-top: 1.25rem; }
.status-panel {
  margin: 1.7rem 0 1.2rem;
  padding: clamp(1.4rem, 6vw, 2.5rem);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--blush);
}
.mood { font-size: clamp(4rem, 17vw, 6.5rem); line-height: 1; filter: drop-shadow(0 8px 12px rgba(0, 0, 0, .14)); }
.status-label { margin: 1rem 0 .1rem; font-size: .78rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.amount { margin: 0; font-size: clamp(2.6rem, 11vw, 4.7rem); font-weight: 900; letter-spacing: -.06em; }
.status-panel h2 { margin: .6rem 0 .25rem; }
.status-panel p:last-child { margin: 0; }
.mood-clear { background: #dcf5e4; border-color: #9dd5ad; color: #155b2d; }
.mood-low { background: #fff3c7; border-color: #e6cf70; color: #684d00; }
.mood-medium { background: #ffe0bd; border-color: #e6ad6d; color: #713a00; }
.mood-high { background: #ffd1cb; border-color: #e7958b; color: #7e1b10; }
.mood-very-high { background: #a1121c; border-color: #6c0c13; color: #fff; }
.payment-callout {
  margin: 1.2rem 0;
  padding: 1.25rem;
  border: 1px solid #dba6aa;
  border-radius: 18px;
  background: #fff;
  text-align: left;
  box-shadow: 0 10px 28px rgba(101, 16, 25, .08);
}
.payment-callout h2 { margin: 0 0 .55rem; }
.payment-callout > p:not(.eyebrow) { margin: 0; color: var(--muted); line-height: 1.6; }
.payment-button { width: 100%; margin-top: 1rem; }
.countdown-card {
  display: grid;
  margin: 1.25rem 0 0;
  padding: 1rem 1.25rem;
  border: 1px solid #dba6aa;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(101, 16, 25, .08);
}
.countdown-value { color: var(--deep-red); font-size: clamp(2rem, 9vw, 3.35rem); font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.countdown-card span:last-child { color: var(--muted); font-weight: 750; }
.secondary-button { width: 100%; color: var(--deep-red); border: 1px solid #d1a5a8; background: #fff; box-shadow: none; }
.privacy-note { margin: 1rem 0 0; color: rgba(255,255,255,.75); font-size: .8rem; text-align: center; }

.admin-page-shell { width: min(100% - 2rem, 1420px); }
.admin-content { padding: clamp(1.25rem, 3vw, 2.25rem); }
.admin-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.admin-heading .intro { margin-bottom: 0; }
.admin-actions { display: flex; align-items: stretch; flex-wrap: wrap; justify-content: flex-end; gap: .55rem; }
.admin-actions form { display: flex; }
.compact-button { min-width: 120px; margin-top: 0; }
.admin-notice { margin: 1.2rem 0; padding: .85rem 1rem; border-radius: 12px; font-weight: 700; }
.admin-notice.success { color: #155b2d; border: 1px solid #9dd5ad; background: #dcf5e4; }
.admin-notice.error { color: #7e1119; border: 1px solid #e2a3a6; background: #fff0f0; }
.admin-instructions { color: var(--muted); line-height: 1.5; }
.data-grid-wrap { overflow: auto; max-height: 67vh; border: 1px solid #dcbfc1; border-radius: 16px; background: #fff; }
.activity-selector { display: flex; align-items: end; gap: .65rem; margin: 1.25rem 0; }
.activity-selector label { display: grid; flex: 1; max-width: 430px; gap: .35rem; font-weight: 800; }
.activity-selector select { min-height: 42px; }
.activity-selector button { margin: 0; }
.data-grid { width: 100%; min-width: 1360px; border-collapse: separate; border-spacing: 0; font-size: .88rem; }
.data-grid th { position: sticky; z-index: 2; top: 0; padding: .8rem .65rem; color: #fff; background: var(--deep-red); text-align: left; white-space: nowrap; }
.data-grid td { padding: .55rem; border-bottom: 1px solid #eededf; vertical-align: middle; }
.data-grid tbody tr:nth-child(even) { background: #fff9f8; }
.data-grid tbody tr:hover { background: #fff0ef; }
.data-grid input:not([type="checkbox"]), .data-grid select { width: 100%; min-height: 40px; padding: .5rem .55rem; border: 1px solid #d6babc; border-radius: 8px; background: #fff; }
.data-grid input[name="name"] { min-width: 190px; }
.data-grid select { min-width: 120px; }
.money-input { min-width: 105px; }
.checkbox-cell { text-align: center; }
.checkbox-cell input { width: 20px; height: 20px; accent-color: var(--red); }
.grid-badge { display: inline-block; padding: .35rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 800; }
.grid-badge.paid { color: #155b2d; background: #dcf5e4; }
.grid-badge.outstanding { color: #7e1119; background: #ffd1cb; }
.grid-badge.neutral { color: #4f4042; background: #f3e7e7; }
.updated-cell { min-width: 145px; color: var(--muted); font-variant-numeric: tabular-nums; }
.action-cell { display: flex; min-width: 90px; gap: .45rem; }
.grid-button { min-height: 40px; margin: 0; padding: .5rem .7rem; border-radius: 8px; box-shadow: none; font-size: .8rem; }
.delete-button { color: #8d111a; border: 1px solid #dca3a7; background: #fff; }
.empty-grid { padding: 2rem !important; color: var(--muted); text-align: center; }
.settings-section { margin-top: 2rem; }
.settings-section > h2 { margin: 0 0 1rem; font-size: 1.6rem; }
.settings-card { margin-bottom: 1rem; padding: 1.2rem; border: 1px solid #dcbfc1; border-radius: 16px; background: #fff; box-shadow: 0 8px 22px rgba(101, 16, 25, .06); }
.settings-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .85rem; }
.settings-grid h3 { grid-column: 1 / -1; margin: 0; font-size: 1.15rem; }
.settings-grid label, .member-create-form label, .member-profile-form label { display: grid; gap: .35rem; color: var(--muted); font-size: .82rem; font-weight: 800; }
.settings-grid input, .member-create-form input, .member-create-form select, .member-profile-form input, .member-profile-form select { min-height: 42px; padding: .55rem .65rem; }
.settings-grid button { align-self: end; min-height: 42px; margin: 0; }
.member-create-form { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(150px, .35fr) auto; align-items: end; gap: .85rem; }
.member-create-form button { min-height: 42px; margin: 0; }
.member-settings-list { display: grid; gap: .65rem; }
.member-settings-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: .65rem; padding: .8rem; border: 1px solid #e5cfd0; border-radius: 12px; background: #fff; }
.member-profile-form { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(140px, .35fr) auto; align-items: end; gap: .65rem; }
.member-settings-row form { margin: 0; }

@media (max-width: 480px) {
  .page-shell { width: min(100% - 1rem, 650px); padding-top: .5rem; }
  .card { border-radius: 20px; }
  .brand { min-height: 170px; padding: .8rem; }
  .brand img { width: 155px; max-height: 160px; }
  .group-options { grid-template-columns: 1fr; }
  .admin-heading { display: block; }
  .admin-heading form { margin-top: 1rem; }
  .admin-actions { justify-content: stretch; margin-top: 1rem; }
  .admin-actions > * { width: 100%; }
  .activity-selector { align-items: stretch; flex-direction: column; }
  .activity-selector label { max-width: none; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-grid h3 { grid-column: 1; }
  .member-create-form, .member-settings-row, .member-profile-form { grid-template-columns: 1fr; }
  .member-settings-row > form:last-child button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
