:root {
  --cream: #FAF8F2;
  --paper: #F1EFE7;
  --ink: #34342F;
  --muted: #76706F;
  --sage: #A78B60;
  --sagedark: #48543D;
  --sage-hover: #E2E5D9;
  --ornament: #A78B60;
  --line: #DAD8CB;
  --pending: #9C8770;
  --danger: #A04D45;
  --accent-soft: rgba(234, 218, 219, 0.68);
}

* {
  box-sizing: border-box;
}

body {
  background: var(--cream);
  color: var(--ink);
  font-family: "Manrope", system-ui, sans-serif;
  line-height: 1.55;
  margin: 0;
}

a,
button,
input,
select {
  font: inherit;
}

.admin-shell {
  margin: 0 auto;
  max-width: 90rem;
  padding: clamp(1.5rem, 4vw, 4rem);
}

.admin-gate {
  border-bottom: 1px solid var(--line);
  margin: min(14vh, 8rem) auto;
  max-width: 34rem;
  padding-bottom: clamp(2rem, 5vw, 4rem);
}

.admin-gate[hidden],
#admin-dashboard[hidden] {
  display: none;
}

.gate-copy {
  color: var(--muted);
  margin: 1.25rem 0 0;
  max-width: 32rem;
}

.login-form {
  display: grid;
  gap: 0.7rem;
  margin-top: 2rem;
  max-width: 22rem;
}

.login-form label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.login-form .export-button {
  justify-self: start;
  margin-top: 0.5rem;
}

.admin-header {
  align-items: end;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 2rem;
  justify-content: space-between;
  padding-bottom: clamp(1.75rem, 4vw, 3rem);
}

.header-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  max-width: 100%;
}

.logout-button {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.78rem;
  min-height: 2.75rem;
  padding: 0.7rem 0.25rem;
}

.logout-button:hover {
  color: var(--ink);
}

.kicker,
.section-kicker {
  color: var(--sagedark);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  margin: 0 0 0.75rem;
  text-transform: uppercase;
}

h1,
h2 {
  font-family: "Libre Baskerville", Georgia, serif;
  font-weight: 400;
  margin: 0;
}

.title-with-icon {
  align-items: center;
  display: flex;
  gap: 0.55rem;
}

.title-with-icon svg {
  color: var(--sagedark);
  flex: 0 0 auto;
  height: 1.15em;
  width: 1.15em;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.65rem);
  font-style: italic;
  line-height: 1.12;
}

h2 {
  font-size: 1.45rem;
  line-height: 1.3;
}

.muted {
  color: var(--muted);
  font-size: 0.84rem;
  margin: 0.85rem 0 0;
}

.export-button {
  background: rgba(250, 247, 242, 0.78);
  border: 1px solid var(--sage);
  border-radius: 3px;
  color: var(--ink);
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 600;
  min-height: 2.75rem;
  padding: 0.7rem 1rem;
  text-decoration: none;
  white-space: nowrap;
}

.export-button:hover {
  background: var(--sage-hover);
  color: var(--ink);
}

button.export-button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.5; }

.export-button:focus-visible,
.logout-button:focus-visible,
select:focus-visible,
input:focus-visible,
.table-scroll:focus-visible {
  outline: 2px solid var(--sage);
  outline-offset: 3px;
}

.summary-section {
  border-bottom: 1px solid var(--line);
  padding: clamp(2rem, 5vw, 4rem) 0;
}

.summary-heading {
  align-items: end;
  display: flex;
  gap: 1.5rem;
  justify-content: space-between;
}

.deadline {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0;
  white-space: nowrap;
}

.response-progress {
  align-items: center;
  display: grid;
  gap: 0.85rem;
  grid-template-columns: auto minmax(7rem, 20rem) auto;
  margin-top: clamp(1.75rem, 3vw, 2.5rem);
}

.progress-copy,
.progress-rate {
  font-size: 0.84rem;
  margin: 0;
}

.progress-copy {
  color: var(--muted);
}

.progress-rate {
  color: var(--sagedark);
  font-weight: 700;
}

.progress-track {
  background: var(--accent-soft);
  height: 0.28rem;
  overflow: hidden;
}

.progress-track span {
  background: var(--sagedark);
  display: block;
  height: 100%;
  transition: width 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

.metric-strip {
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: clamp(1.5rem, 3vw, 2.5rem) 0 0;
}

.metric-strip-five { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.metric-item {
  border-right: 1px solid var(--line);
  padding: clamp(1.25rem, 2.5vw, 2.1rem) clamp(0.75rem, 2vw, 1.5rem);
}

.metric-item:first-child {
  padding-left: 0;
}

.metric-item:last-child {
  border-right: 0;
}

.metric-item dt {
  color: var(--muted);
  font-size: 0.69rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric-item dd {
  color: var(--ink);
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: clamp(1.8rem, 4vw, 3.25rem);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin: 0.65rem 0 0;
}

.member-response-list {
  display: grid;
  gap: 0.3rem;
  list-style: none;
  margin: 0;
  min-width: 12rem;
  padding: 0;
}

.member-response-list li {
  font-size: 0.75rem;
  line-height: 1.45;
  white-space: nowrap;
}

.member-response-yes {
  color: var(--sagedark);
  font-weight: 600;
}

.member-response-no,
.member-response-pending {
  color: var(--muted);
}

.metric-pendingInvitations dd {
  color: var(--pending);
}

.metric-responseRate dd,
.metric-confirmedAttending dd {
  color: var(--sagedark);
}

.guest-summary {
  align-items: end;
  display: flex;
  gap: 2rem;
  justify-content: space-between;
}

.guest-summary-copy {
  color: var(--muted);
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  line-height: 1.6;
  margin: 0;
  max-width: 35rem;
}

.responses-section {
  padding-top: clamp(2.5rem, 5vw, 4.5rem);
}

.section-heading-row {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  margin-bottom: 1.25rem;
}

.section-heading-row h2 {
  margin-right: auto;
}

.filter-label {
  color: var(--muted);
  display: grid;
  font-size: 0.73rem;
  font-weight: 600;
  gap: 0.35rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

select,
input {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 400;
  letter-spacing: 0;
  min-height: 2.5rem;
  padding: 0.45rem 0.7rem;
  text-transform: none;
}

.search-label input {
  min-width: 12rem;
}

.results-count {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0 0 0.7rem;
}

.table-scroll {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  font-size: 0.82rem;
  min-width: 72rem;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 0.9rem 0.75rem;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

tbody tr:hover {
  background: var(--accent-soft);
}

.status {
  font-weight: 600;
}

.status-pending {
  color: var(--pending);
}

.status-attending {
  color: var(--sagedark);
}

.status-absent {
  color: var(--muted);
}

.notes-cell {
  max-width: 22rem;
  white-space: pre-wrap;
}

.feedback {
  color: var(--danger);
  min-height: 1.5rem;
}

.feedback.success { color: var(--sagedark); }

.feedback:empty {
  display: none;
}

.row-edit {
  background: none;
  border: 0;
  border-bottom: 1px solid currentColor;
  color: var(--sagedark);
  cursor: pointer;
  display: block;
  font-size: 0.76rem;
  margin-top: 0.5rem;
  padding: 0 0 0.1rem;
  text-align: left;
}

.row-edit:focus-visible,
.danger-button:focus-visible { outline: 2px solid var(--sagedark); outline-offset: 3px; }

.reset-actions { margin-top: 1.5rem; text-align: right; }
.reset-actions .logout-button { color: var(--danger); }

dialog {
  background: var(--cream);
  border: 1px solid var(--line);
  box-shadow: 0 1rem 3rem rgba(53, 51, 52, 0.14);
  color: var(--ink);
  max-height: calc(100dvh - 2rem);
  max-width: min(32rem, calc(100vw - 2rem));
  overflow-y: auto;
  padding: clamp(1.25rem, 4vw, 2rem);
  width: 100%;
}

dialog::backdrop { background: rgba(53, 51, 52, 0.36); }
.admin-dialog-form { display: grid; gap: 1rem; }
.admin-dialog-form h2 { margin: 0; }
.admin-dialog-form p { margin: 0; }
.admin-dialog-form label { font-size: 0.88rem; }
.edit-members { display: grid; gap: 0.65rem; margin: 0.5rem 0; }
.edit-member { align-items: center; border-bottom: 1px solid var(--line); display: flex; gap: 0.75rem; justify-content: space-between; padding-bottom: 0.65rem; }
.edit-member label { overflow-wrap: anywhere; }
.edit-member select { flex: 0 0 8rem; }
.edit-member { flex-wrap: wrap; }
.edit-member > label { flex: 1; }
.edit-child-age { display: grid; gap: 0.5rem; flex-basis: 100%; }
.edit-child-age[hidden] { display: none; }
.edit-child-age select { font-size: 1rem; width: 100%; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: flex-end; }
.danger-button { border-color: var(--danger); color: var(--danger); }
.danger-button:hover { background: var(--danger); color: white; }

@media (max-width: 700px) {
  .admin-shell {
    padding: 1.25rem 1rem 3rem;
  }

  .admin-header,
  .summary-heading,
  .guest-summary {
    align-items: stretch;
    flex-direction: column;
  }

  .export-button {
    align-self: start;
  }

  .header-actions {
    align-self: start;
  }

  .response-progress {
    align-items: start;
    grid-template-columns: 1fr auto;
  }

  .progress-track {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
  }

  .metric-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-strip-five { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .metric-strip-five .metric-item:last-child { grid-column: 1 / -1; }

  .metric-item {
    border-bottom: 1px solid var(--line);
  }

  .metric-item:nth-child(2n) {
    border-right: 0;
  }

  .metric-item:nth-child(odd) {
    padding-left: 0;
  }

  .metric-item:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .section-heading-row h2 {
    flex-basis: 100%;
  }

  .search-label {
    flex: 1 1 10rem;
  }

  .search-label input {
    min-width: 0;
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .progress-track span {
    transition: none;
  }
}
