*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* M3 baseline scheme — light (seed #6750A4) */
  --md-primary: #6750A4;
  --md-on-primary: #FFFFFF;
  --md-primary-container: #EADDFF;
  --md-on-primary-container: #21005D;

  --md-secondary: #625B71;
  --md-on-secondary: #FFFFFF;
  --md-secondary-container: #E8DEF8;
  --md-on-secondary-container: #1D192B;

  --md-tertiary: #7D5260;
  --md-on-tertiary: #FFFFFF;
  --md-tertiary-container: #FFD8E4;
  --md-on-tertiary-container: #31111D;

  --md-error: #B3261E;
  --md-on-error: #FFFFFF;
  --md-error-container: #F9DEDC;
  --md-on-error-container: #410E0B;

  --md-background: #FFFBFE;
  --md-on-background: #1C1B1F;
  --md-surface: #FFFBFE;
  --md-on-surface: #1C1B1F;
  --md-surface-variant: #E7E0EC;
  --md-on-surface-variant: #49454F;

  --md-surface-container-low: #F7F2FA;
  --md-surface-container: #F3EDF7;
  --md-surface-container-high: #ECE6F0;

  --md-outline: #79747E;
  --md-outline-variant: #CAC4D0;

  /* shape scale */
  --shape-xs: 4px;
  --shape-sm: 8px;
  --shape-md: 8px;
  --shape-lg: 16px;
  --shape-xl: 28px;
  --shape-full: 999px;
  --shape-tooltip: 4px;

  /* container/card/section stroke */
  --stroke-color: #3A3A3A;

  /* elevation */
  --elevation-1: 0 1px 2px rgba(0,0,0,.30), 0 1px 3px 1px rgba(0,0,0,.15);
  --elevation-2: 0 1px 2px rgba(0,0,0,.30), 0 2px 6px 2px rgba(0,0,0,.15);
  --elevation-3: 0 1px 3px rgba(0,0,0,.30), 0 4px 8px 3px rgba(0,0,0,.15);

  /* legacy aliases still referenced below */
  --bg: var(--md-surface-container-low);
  --surface: var(--md-surface);
  --text: var(--md-on-surface);
  --text-secondary: var(--md-on-surface-variant);
  --separator: var(--md-outline-variant);
  --blue: var(--md-primary);
  --blue-hover: var(--md-primary);
  --green: var(--md-tertiary);
  --radius-card: var(--shape-md);
  --radius-btn: var(--shape-full);
  --shadow: var(--elevation-1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --md-primary: #D0BCFF;
    --md-on-primary: #381E72;
    --md-primary-container: #4F378B;
    --md-on-primary-container: #EADDFF;

    --md-secondary: #CCC2DC;
    --md-on-secondary: #332D41;
    --md-secondary-container: #4A4458;
    --md-on-secondary-container: #E8DEF8;

    --md-tertiary: #EFB8C8;
    --md-on-tertiary: #492532;
    --md-tertiary-container: #633B48;
    --md-on-tertiary-container: #FFD8E4;

    --md-error: #F2B8B5;
    --md-on-error: #601410;
    --md-error-container: #8C1D18;
    --md-on-error-container: #F9DEDC;

    --md-background: #1C1B1F;
    --md-on-background: #E6E1E5;
    --md-surface: #1C1B1F;
    --md-on-surface: #E6E1E5;
    --md-surface-variant: #49454F;
    --md-on-surface-variant: #CAC4D0;

    --md-surface-container-low: #1D1B20;
    --md-surface-container: #211F26;
    --md-surface-container-high: #2B2930;

    --md-outline: #938F99;
    --md-outline-variant: #49454F;

    --stroke-color: #8A8A8A;
  }
}

body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-size: 18px;
  color: var(--md-on-background);
  background: var(--md-background);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
}

/* ── nav (M3 top app bar) ── */
nav {
  position: sticky;
  top: 0;
  z-index: 250;
  background: var(--md-surface);
  border-bottom: 1px solid var(--md-outline-variant);
  height: 64px;
}

.nav-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
}

.nav-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--shape-full);
  background: none;
  border: none;
  color: var(--md-on-surface);
  cursor: pointer;
  padding: 0;
  margin-right: 8px;
}
.nav-menu-btn:hover { background: color-mix(in srgb, var(--md-on-surface) 8%, transparent); box-shadow: none; }

.nav-brand { display: flex; align-items: center; }

.nav-logo {
  display: block;
  height: 32px;
  width: 122px;
  background-image: url('/static/logo.png');
  background-repeat: no-repeat;
  background-size: contain;
  background-position: left center;
}
.nav-brand:hover .nav-logo { background-image: url('/static/logo-hover.png'); }

.nav-logo-mobile-link { display: none; }
.nav-logo-mobile { display: block; }

.nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.nav-links a {
  color: var(--md-on-surface-variant);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .06em;
  transition: color .15s;
}

.nav-links a:hover, .nav-links a.active { color: var(--md-primary); text-decoration: none; }

.nav-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 150;
}

/* ── page layout ── */
main {
  max-width: 980px;
  margin: 0 auto;
  padding: 64px 24px 80px;
}

h1, h2, h3 { font-family: Fraunces, Georgia, "Times New Roman", serif; }

h1 {
  font-size: 28px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.29;
  color: var(--md-primary);
  margin-bottom: 8px;
}

h2 {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--md-on-background);
  margin: 40px 0 16px;
}

h3 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .009em;
  color: var(--md-on-background);
  margin-bottom: 8px;
}

.card h2, .card h3 { margin-top: 0; }

p { color: var(--md-on-surface-variant); line-height: 1.6; margin: 8px 0; }
a { color: var(--md-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── buttons (M3 filled button by default) ── */
button, input[type=submit] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 8px 24px;
  border: none;
  border-radius: var(--shape-full);
  background: var(--md-primary);
  color: var(--md-on-primary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .01em;
  appearance: none;
  -webkit-appearance: none;
  transition: background .15s, box-shadow .15s;
}

button:hover, input[type=submit]:hover {
  box-shadow: var(--elevation-1);
  background: color-mix(in srgb, var(--md-primary) 92%, var(--md-on-primary));
}

.btn-secondary {
  background: transparent;
  color: var(--md-primary);
  border: 1px solid var(--md-outline);
}
.btn-secondary:hover { background: color-mix(in srgb, var(--md-primary) 8%, transparent); box-shadow: none; }

.btn-small {
  padding: 8px 16px;
  font-size: 13px;
}

.btn-danger {
  background: transparent;
  color: var(--md-error);
  border: 1px solid var(--md-outline);
}
.btn-danger:hover { background: color-mix(in srgb, var(--md-error) 8%, transparent); box-shadow: none; }

.btn-cancel {
  background: transparent;
  color: var(--md-on-surface-variant);
  border: none;
  padding: 8px 16px;
}
.btn-cancel:hover { background: color-mix(in srgb, var(--md-on-surface) 8%, transparent); box-shadow: none; }

/* ── cards (M3 filled card) ── */
.card {
  background: var(--md-surface-container);
  border: 1px solid var(--stroke-color);
  border-radius: var(--shape-md);
  padding: 24px 32px;
}

.settings-sections { display: flex; flex-direction: column; gap: 16px; }

.week-range { margin: 0; }

/* ── two-column dashboard ── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.person-col {
  background: var(--md-surface-container);
  border: 1px solid var(--stroke-color);
  border-radius: var(--shape-md);
  padding: 24px 24px 24px;
  display: flex;
  flex-direction: column;
}

.person-col h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 22px;
  font-weight: 400;
  letter-spacing: 0;
  margin-bottom: 8px;
}

.person-heading { display: flex; align-items: center; gap: 8px; }

/* ── assignment rows ── */
.assignment-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--shape-sm);
  margin-bottom: 8px;
  background: var(--md-surface-container-high);
  flex-wrap: wrap;
  transition: background .15s;
  order: 0;
}

.assignment-row.done {
  background: rgba(52,199,89,.16);
  order: 1;
}

.assignment-row.done .chore-name {
  text-decoration: line-through;
  color: var(--md-on-surface-variant);
}

.chore-checkbox {
  appearance: none;
  -webkit-appearance: none;
  margin-left: auto;
  width: 20px;
  height: 20px;
  border: 1px solid var(--stroke-color);
  border-radius: var(--shape-xs);
  background: transparent;
  cursor: pointer;
  position: relative;
}

.swap-btn {
  margin-left: auto;
  padding: 4px 12px;
}
.swap-btn + .chore-checkbox { margin-left: 0; }

.chore-checkbox:focus {
  outline: none;
  border-width: 1px;
  padding: 0;
}

.chore-checkbox:disabled {
  cursor: default;
  opacity: .5;
}

.chore-checkbox:checked::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid var(--md-primary);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.chore-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chore-tags { display: flex; gap: 8px; flex-wrap: wrap; }

.chore-name { font-size: 18px; font-weight: 400; }

/* ── badges (tag/pill look) ── */
.badge {
  display: inline-block;
  padding: 2px 4px;
  border-radius: var(--shape-xs);
  border: 1px solid var(--stroke-color);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--md-on-surface-variant);
  white-space: nowrap;
}

/* ── tooltip ── */
.tooltip-wrap { position: relative; display: inline-flex; align-items: center; }

.tooltip-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: var(--shape-full);
  background: none;
  color: var(--md-on-surface-variant);
  cursor: help;
}
.tooltip-trigger:hover { background: color-mix(in srgb, var(--md-on-surface) 8%, transparent); box-shadow: none; }
.tooltip-trigger .material-symbols-outlined { font-size: 16px; }

.tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 220px;
  background: var(--md-surface-container-high);
  color: var(--md-on-surface);
  border: 1px solid var(--stroke-color);
  border-radius: var(--shape-tooltip);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  line-height: 1.4;
  text-align: left;
  opacity: 0;
  visibility: hidden;
  transition: opacity .15s;
  z-index: 20;
  pointer-events: none;
}
.tooltip-wrap:hover .tooltip,
.tooltip-wrap:focus-within .tooltip { opacity: 1; visibility: visible; }

.caption-label {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-size: 14px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--md-on-surface-variant);
}

/* ── generate form ── */
form.generate-form { margin-top: 32px; }

/* ── history ── */
.history-week {
  background: var(--md-surface-container);
  border: 1px solid var(--stroke-color);
  border-radius: var(--shape-md);
  padding: 24px 32px;
  margin-bottom: 16px;
}

.history-week .week-range { margin: 0 0 8px; }

.history-person-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 8px 0;
  flex-wrap: wrap;
}

.history-name { font-weight: 500; font-size: 15px; min-width: 80px; }
.history-counts {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--md-on-surface-variant);
  min-width: 130px;
}

.history-reward {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin: 8px 0 16px;
  font-size: 15px;
  color: var(--md-on-surface-variant);
  overflow-wrap: anywhere;
}
.history-reward-quote { font-style: italic; }
.history-reward-song { color: var(--md-primary); text-decoration: none; }
.history-reward-song:hover { text-decoration: underline; }

.progress-bar-track {
  flex: 1;
  height: 4px;
  background: var(--md-secondary-container);
  border-radius: var(--shape-full);
  min-width: 80px;
  max-width: 280px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--md-primary);
  border-radius: var(--shape-full);
  transition: width .4s cubic-bezier(.4,0,.2,1);
}

/* ── chores list ── */
.chores-legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 32px;
}

.chore-group { margin-bottom: 8px; }

.chore-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--shape-sm);
  background: var(--md-surface-container);
  margin-bottom: 8px;
  flex-wrap: wrap;
  transition: background .15s;
}

.chore-row:hover { background: var(--md-surface-container-high); }
.chore-row .chore-name { flex: 1; font-size: 15px; }

.chore-row button {
  padding: 8px 16px;
  font-size: 12px;
  background: transparent;
  color: var(--md-on-surface-variant);
  border: 1px solid var(--md-outline);
  border-radius: var(--shape-full);
}
.chore-row button:hover { background: color-mix(in srgb, var(--md-on-surface) 8%, transparent); box-shadow: none; }

/* ── chore inline edit ── */
.chore-row-editing { background: var(--md-surface-container); outline: 2px solid var(--md-primary); outline-offset: -2px; }
.chore-row-editing form { display: flex; gap: 8px; align-items: center; flex: 1; margin: 0; }
.chore-row-editing input { flex: 1; font-size: 15px; }

/* ── avatars ── */
.avatar-slot {
  --avatar-size: 40px;
  display: inline-flex;
  flex-shrink: 0;
}
.avatar-slot--sm { --avatar-size: 28px; }
.avatar-slot--md { --avatar-size: 40px; }
.avatar-slot--lg { --avatar-size: 56px; }

.avatar {
  width: var(--avatar-size);
  height: var(--avatar-size);
  border-radius: var(--shape-full);
  flex-shrink: 0;
}

.avatar-img {
  object-fit: cover;
  border: 1px solid var(--stroke-color);
}

.avatar-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--md-primary-container);
  color: var(--md-primary);
  font-weight: 500;
  font-size: calc(var(--avatar-size) * 0.42);
}

.avatar-upload { cursor: pointer; display: inline-flex; }
.avatar-upload input[type="file"] { display: none; }

/* ── people ── */
.people-list { list-style: none; margin-bottom: 24px; }

.people-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 16px;
  background: var(--md-surface-container);
  border: 1px solid var(--stroke-color);
  border-radius: var(--shape-md);
  margin-bottom: 8px;
}

.person-name { flex: 1; font-weight: 500; font-size: 16px; }

.people-row form { display: flex; gap: 8px; align-items: center; flex: 1; margin: 0; }
.people-row form input { flex: 1; font-size: 15px; }

/* ── ellipsis menu (people + chores) ── */
.person-menu, .chore-menu { position: relative; }

.person-menu summary, .chore-menu summary {
  list-style: none;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--shape-full);
  color: var(--md-on-surface-variant);
  transition: background .15s;
}
.person-menu summary::-webkit-details-marker, .chore-menu summary::-webkit-details-marker { display: none; }
.person-menu summary:hover, .chore-menu summary:hover { background: color-mix(in srgb, var(--md-on-surface) 8%, transparent); }

.person-menu .dropdown-menu, .chore-menu .dropdown-menu {
  position: absolute;
  right: 0;
  top: 44px;
  z-index: 10;
  min-width: 150px;
  background: var(--md-surface-container-high);
  border-radius: var(--shape-xs);
  box-shadow: var(--elevation-2);
  padding: 8px 0;
  display: flex;
  flex-direction: column;
}

.person-menu .dropdown-menu a,
.person-menu .dropdown-menu button,
.chore-menu .dropdown-menu a,
.chore-menu .dropdown-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 16px;
  border-radius: 0;
  background: none;
  color: var(--md-on-surface);
  font-size: 14px;
  font-weight: 400;
  border: none;
}

.person-menu .dropdown-menu a:hover,
.person-menu .dropdown-menu button:hover,
.chore-menu .dropdown-menu a:hover,
.chore-menu .dropdown-menu button:hover { background: color-mix(in srgb, var(--md-on-surface) 8%, transparent); box-shadow: none; }

.person-menu .dropdown-menu .btn-danger, .chore-menu .dropdown-menu .btn-danger { color: var(--md-error); }

/* ── confirm modal (M3 dialog) ── */
dialog.confirm-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  border: 1px solid var(--stroke-color);
  border-radius: var(--shape-md);
  background: var(--md-surface-container-high);
  color: var(--md-on-surface);
  padding: 24px 32px;
  max-width: 380px;
  width: 90%;
}
dialog.confirm-modal::backdrop { background: rgba(0,0,0,.9); }
dialog.confirm-modal h3 { font-size: 24px; font-weight: 400; margin-bottom: 8px; overflow-wrap: break-word; }
dialog.confirm-modal p { color: var(--md-on-surface-variant); overflow-wrap: break-word; }
dialog.confirm-modal .confirm-name-input { width: 100%; margin-top: 8px; }
.confirm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

/* ── profile stats ── */
.profile-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 24px 0;
}
.stat-tile { text-align: center; min-width: 0; }
.stat-value { font-size: 32px; font-weight: 400; color: var(--md-on-surface); }
.stat-label {
  font-size: 14px;
  color: var(--md-on-surface-variant);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-top: 8px;
  overflow-wrap: break-word;
}

/* ── history page summary ── */
.history-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin: 24px 0;
}
.history-summary .card h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 18px; font-weight: 500; }
.history-summary-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 16px 0 0; }
.stat-pct { font-size: 16px; color: var(--md-on-surface-variant); }

.divider { border: none; border-top: 1px solid var(--md-outline-variant); margin: 32px 0; }

/* ── inputs + selects (M3 outlined text field) ── */
input[type=text], input[type=email], input[type=password], input:not([type]), select {
  padding: 16px 16px;
  border: 1px solid var(--md-outline);
  border-radius: var(--shape-xs);
  font-size: 15px;
  font-family: inherit;
  color: var(--md-on-surface);
  background: var(--md-surface);
  appearance: none;
  -webkit-appearance: none;
  transition: border-color .15s, box-shadow .15s;
}

select {
  padding-right: 40px;
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cpath fill='%2349454F' d='M5 8l5 5 5-5z'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cpath fill='%23CAC4D0' d='M5 8l5 5 5-5z'/%3E%3C/svg%3E");
  }
}

input:focus, select:focus {
  outline: none;
  border-color: var(--md-primary);
  border-width: 2px;
  padding: 15px 15px;
}
select:focus { padding-right: 39px; }

form { margin-top: 8px; }

/* ── add chore form ── */
.add-chore-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  background: var(--md-surface-container);
  border: 1px solid var(--stroke-color);
  border-radius: var(--shape-md);
  padding: 24px 24px;
  margin-top: 16px;
}

.add-chore-form input { flex: 1; min-width: 180px; }

/* ── chores table ── */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.chores-table {
  width: 100%;
  min-width: 520px;
  border-collapse: separate;
  border-spacing: 0 8px;
  margin-top: 8px;
}

.chores-table thead th.sortable {
  cursor: pointer;
  user-select: none;
}
.chores-table thead th.sortable:hover { color: var(--md-primary); }
.chores-table thead th.sorted-asc,
.chores-table thead th.sorted-desc { color: var(--md-primary); }

.chores-table thead th {
  text-align: left;
  font-size: 14px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--md-on-surface-variant);
  padding: 0 16px 8px;
}

.chores-table tbody tr {
  background: var(--md-surface-container);
  transition: background .15s;
}

.chores-table tbody tr:hover { background: var(--md-surface-container-high); }

.chores-table td {
  padding: 16px 16px;
  font-size: 15px;
  vertical-align: middle;
}

.chores-table td:first-child { border-radius: var(--shape-sm) 0 0 var(--shape-sm); }
.chores-table td:last-child  { border-radius: 0 var(--shape-sm) var(--shape-sm) 0; }

.chores-table .actions-cell {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  white-space: nowrap;
}

.chores-table .chore-name { font-weight: 400; }

.chore-row-editing td { border-radius: var(--shape-sm); }
.chore-row-editing { background: var(--md-surface-container); outline: 2px solid var(--md-primary); outline-offset: -2px; border-radius: var(--shape-sm); }
.chore-row-editing form { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 0; }
.chore-edit-fields { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chore-edit-fields input { flex: 1; min-width: 120px; font-size: 15px; }
.chore-edit-actions { display: flex; gap: 8px; flex-shrink: 0; }

.chores-table select {
  font-size: 13px;
  padding: 8px 32px 8px 8px;
  border-radius: var(--shape-xs);
  border-color: var(--md-outline);
  color: var(--md-on-surface);
}

/* ── btn variants in table ── */
.chores-table button {
  padding: 8px 16px;
  font-size: 12px;
  background: transparent;
  color: var(--md-on-surface-variant);
  border: 1px solid var(--md-outline);
  border-radius: var(--shape-full);
}
.chores-table button:hover { background: color-mix(in srgb, var(--md-on-surface) 8%, transparent); box-shadow: none; }
.chores-table .btn-danger {
  background: transparent;
  color: var(--md-error);
  border: 1px solid var(--md-outline);
}
.chores-table .btn-danger:hover { background: color-mix(in srgb, var(--md-error) 8%, transparent); }
.chores-table .btn-cancel { color: var(--md-on-surface-variant); border: none; }

/* ── celebration overlay ── */
.celebration-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(28,27,31,.95);
  color: #fff;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}
.celebration-overlay.show { display: flex; flex-direction: column; gap: 24px; animation: celebration-fade .3s ease; }
.celebration-text { font-size: 36px; font-weight: 500; }
.celebration-quote { margin: 0; max-width: 560px; font-size: 18px; font-style: italic; white-space: pre-line; opacity: .9; }
.celebration-song {
  display: inline-block;
  padding: 10px 20px;
  border-radius: var(--shape-full);
  background: #1DB954;
  color: #fff;
  font-weight: 500;
  text-decoration: none;
}
.celebration-song:hover { filter: brightness(1.08); }
.celebration-dismiss {
  padding: 16px 32px;
  border-radius: var(--shape-full);
  background: transparent;
  border: 1px solid #fff;
  color: #fff;
  font-weight: 500;
}
.celebration-dismiss:hover { background: rgba(255,255,255,.08); box-shadow: none; }
@keyframes celebration-fade { from { opacity: 0; } to { opacity: 1; } }

/* ── mobile nav drawer (M3 compact window size class) ── */
/* Kept last in the file: several rules below override earlier base rules
   (main, .two-col, .profile-stats) at equal specificity, so source order
   is what makes the override win — this block must stay after all of them. */
@media (max-width: 599px) {
  .nav-inner { justify-content: flex-start; }
  .nav-menu-btn { display: flex; }
  .nav-logo { display: none; }
  .nav-logo-mobile-link { display: block; margin-left: auto; }
  .nav-logo-mobile { height: 28px; width: 28px; }

  .nav-links {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: min(320px, 85vw);
    background: var(--md-surface);
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 80px 24px 24px;
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    z-index: 200;
    box-shadow: var(--elevation-3);
  }
  body.nav-open .nav-links { transform: translateX(0); }
  body.nav-open .nav-scrim { display: block; }

  .nav-links a { font-size: 16px; padding: 16px 0; width: 100%; justify-content: flex-start; }

  main { padding: 32px 16px 64px; }
  .two-col { grid-template-columns: 1fr; }
  .profile-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .history-summary { grid-template-columns: 1fr; }
  .history-summary-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  /* ── chores table → cards ── */
  .chores-table { min-width: 0; }
  .chores-table thead { display: none; }
  .chores-table tbody { display: block; }

  .chores-table tr {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    align-items: center;
    column-gap: 8px;
    row-gap: 6px;
    background: var(--md-surface-container);
    border-radius: var(--shape-sm);
    padding: 16px;
    margin-bottom: 8px;
  }

  .chores-table td { display: block; padding: 0; border-radius: 0; }

  .chores-table td:nth-child(1) { grid-column: 1; grid-row: 1 / 3; }
  .chores-table td:nth-child(2) { grid-column: 2; grid-row: 1; justify-self: end; }
  .chores-table td:nth-child(3) { grid-column: 3; grid-row: 1; justify-self: end; }
  .chores-table td:nth-child(4) { grid-column: 2 / 4; grid-row: 2; justify-self: end; }
  .chores-table td:nth-child(5) { grid-column: 4; grid-row: 1 / 3; justify-self: end; }

  /* ── chore edit row: stack instead of the desktop single-line layout ── */
  .chore-row-editing td { grid-column: 1 / -1; }
  .chore-row-editing form { flex-direction: column; align-items: stretch; gap: 12px; }
  .chore-edit-fields { width: 100%; }
  .chore-edit-fields input { min-width: 0; flex: 1 1 100%; }
  .chore-edit-fields select { flex: 1 1 auto; min-width: 0; }
  .chore-edit-actions { width: 100%; justify-content: flex-end; }
}
