:root {
  --bg: #f6f7f8;
  --surface: #ffffff;
  --surface-2: #f0f2f4;
  --text: #1b1e23;
  --muted: #6c737f;
  --line: #e2e5e9;
  --primary: #315ee7;
  --primary-soft: #eaf0ff;
  --success: #18794e;
  --warning: #9a6700;
  --danger: #c9372c;
  --radius: 18px;
  --shadow: 0 12px 35px rgba(31, 38, 52, .07);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: .35rem; font-size: clamp(2rem, 5vw, 3.25rem); line-height: 1.08; }
h2 { margin-bottom: .75rem; }
h3 { margin-bottom: .2rem; }
small, .hint { color: var(--muted); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 10px max(18px, calc((100vw - 1180px) / 2));
  background: rgba(246, 247, 248, .9);
  border-bottom: 1px solid rgba(226, 229, 233, .8);
  backdrop-filter: blur(16px);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; }
.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 11px;
  background: var(--text);
  color: white;
}
.member-switch select {
  max-width: 160px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 8px 12px;
}
.page {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 34px 0 120px;
}
.hero { margin-bottom: 32px; }
.hero.compact { max-width: 720px; }
.hero p:last-child { color: var(--muted); }
.eyebrow {
  margin-bottom: 6px;
  color: var(--primary);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 36px 28px;
}
.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(290px, .7fr);
  gap: 28px;
}
.admin-grid {
  display: grid;
  grid-template-columns: minmax(300px, .8fr) minmax(0, 1.2fr);
  gap: 28px;
}
.full-width { grid-column: 1 / -1; }
.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 14px;
}
.section-heading h2 { margin-bottom: 0; }
.section-heading.spaced { margin-top: 34px; }
.text-link { color: var(--primary); font-weight: 700; }

.stack { display: grid; gap: 12px; }
.card, .panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.card { padding: 18px; }
.panel { padding: 22px; }
.sticky-panel { position: sticky; top: 88px; align-self: start; }
.task-card, .row-card, .reservation-card, .history-row, .settlement-card, .member-card {
  display: flex;
  align-items: center;
  gap: 14px;
}
.task-card { justify-content: space-between; }
.task-card p, .row-card p, .history-row p, .reservation-card p { margin: 0; color: var(--muted); }
.task-card h3 { display: inline; }
.status-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--primary);
}
.status-dot.danger { background: var(--danger); }
.row-card { box-shadow: none; }
.date-badge {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
  line-height: 1;
}
.date-badge strong { font-size: 1.1rem; }
.date-badge span { font-size: .72rem; }
.date-badge.large { width: 58px; height: 58px; }
.money-card { display: flex; align-items: center; justify-content: space-between; }
.money-card p { margin: 0; color: var(--muted); }
.money-card strong { font-size: 1.35rem; }
.money-card.positive strong { color: var(--success); }
.timeline { display: grid; gap: 14px; }
.timeline-item { display: flex; gap: 12px; }
.timeline-item > span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #e9f8f0;
  color: var(--success);
  font-weight: 800;
}
.timeline-item small { display: block; }
.admin-shortcut {
  display: inline-block;
  margin-top: 36px;
  color: var(--primary);
  font-weight: 750;
}

.button, .icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 750;
}
.button.primary { background: var(--primary); color: white; }
.button.ghost { background: var(--surface-2); color: var(--text); }
.button.full { width: 100%; }
.icon-button {
  width: 42px;
  padding: 0;
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.35rem;
}

.task-detail { padding: 22px; }
.task-main { display: flex; justify-content: space-between; gap: 20px; }
.task-main p { color: var(--muted); }
.assignee {
  min-width: 150px;
  padding: 12px 15px;
  border-radius: 14px;
  background: var(--primary-soft);
}
.assignee small, .assignee strong { display: block; }
.assignee strong { color: var(--primary); }
.rotation { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.rotation span {
  border-radius: 999px;
  background: var(--surface-2);
  padding: 6px 10px;
  color: var(--muted);
  font-size: .85rem;
}
.rotation span.active { background: var(--text); color: white; }
.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.form-stack { display: grid; gap: 15px; }
label { display: grid; gap: 7px; font-weight: 650; font-size: .9rem; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: white;
  color: var(--text);
  padding: 11px 12px;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
textarea { resize: vertical; }
fieldset {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}
legend { padding: 0 6px; font-weight: 750; }
.checkbox-row, .toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.checkbox-row { justify-content: start; margin-top: 10px; }
.checkbox-row input, .toggle-row input, .member-toggles input { width: auto; }
details {
  border-top: 1px solid var(--line);
  padding-top: 13px;
}
details summary { margin-bottom: 13px; cursor: pointer; font-weight: 750; }
details label + label { margin-top: 12px; }
.inline-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.test-form { display: flex; gap: 10px; margin-top: 16px; }
.test-form select { min-width: 0; }

.calendar-heading { display: flex; align-items: end; justify-content: space-between; max-width: none !important; }
.month-controls { display: flex; align-items: center; gap: 10px; }
.calendar-legend { display: flex; gap: 18px; margin-bottom: 15px; color: var(--muted); font-size: .85rem; }
.legend-dot { display: inline-block; width: 9px; height: 9px; margin-right: 5px; border-radius: 50%; }
.legend-dot.chore, .calendar-event.chore { background: var(--primary-soft); color: var(--primary); }
.legend-dot.bathroom, .calendar-event.bathroom { background: #e9f8f0; color: var(--success); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.weekdays { color: var(--muted); font-size: .78rem; font-weight: 750; text-align: center; }
.weekdays div { padding: 8px; }
.month-grid {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
  gap: 1px;
}
.calendar-day { min-height: 128px; padding: 10px; background: var(--surface); }
.calendar-day.muted { opacity: .45; }
.calendar-day.today .day-number { background: var(--primary); color: white; }
.day-number {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  margin-bottom: 8px;
  border-radius: 9px;
  font-size: .85rem;
  font-weight: 750;
}
.day-events { display: grid; gap: 5px; }
.calendar-event { overflow: hidden; border-radius: 7px; padding: 5px 7px; font-size: .72rem; text-overflow: ellipsis; }

.reservation-card .grow { flex: 1; }
.settlement-card { justify-content: space-between; }
.settlement-card > div { display: flex; align-items: center; gap: 10px; }
.amount { font-size: 1.15rem; }
.history-row { justify-content: space-between; }
.muted-card { opacity: .55; }
.money-input { position: relative; }
.money-input input { padding-right: 44px; }
.money-input span { position: absolute; right: 13px; top: 11px; color: var(--muted); }

.member-card { align-items: start; }
.member-actions { display: flex; gap: 10px; margin-top: -2px; }
.member-avatar {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 14px;
  background: var(--text);
  color: white;
  font-weight: 800;
}
.member-fields { display: grid; flex: 1; gap: 9px; }
.member-toggles { display: flex; flex-wrap: wrap; gap: 14px; color: var(--muted); font-size: .82rem; }
.member-toggles label { display: flex; grid-auto-flow: column; align-items: center; gap: 6px; }
.add-member { margin-top: 16px; }
.feedback-list { display: grid; gap: 14px; }
.feedback-list article { border-top: 1px solid var(--line); padding-top: 14px; }
.feedback-list article:first-child { border-top: 0; padding-top: 0; }
.feedback-list article > div { display: flex; justify-content: space-between; gap: 10px; }
.feedback-list article span, .feedback-list article small { color: var(--muted); }
.feedback-list article p { margin: 8px 0 2px; }

.feedback-button {
  position: fixed;
  right: 22px;
  bottom: 88px;
  z-index: 30;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--text);
  color: white;
  box-shadow: var(--shadow);
  padding: 11px 17px;
  cursor: pointer;
  font-weight: 750;
}
.dialog {
  width: min(470px, calc(100% - 28px));
  border: 0;
  border-radius: 22px;
  padding: 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .25);
}
.dialog::backdrop { background: rgba(15, 18, 24, .5); backdrop-filter: blur(4px); }
.dialog-header { display: flex; justify-content: space-between; }
.dialog form { display: grid; gap: 15px; }

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 14px;
  z-index: 25;
  display: flex;
  width: min(620px, calc(100% - 28px));
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255,255,255,.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(15px);
}
.bottom-nav a {
  display: grid;
  flex: 1;
  place-items: center;
  gap: 1px;
  padding: 10px 4px;
  color: var(--muted);
  font-size: .7rem;
  font-weight: 700;
}
.bottom-nav a span { color: var(--text); font-size: 1.15rem; }
.empty-state {
  border: 1px dashed #cbd0d7;
  border-radius: var(--radius);
  padding: 24px;
  color: var(--muted);
  text-align: center;
}
.toast {
  position: fixed;
  top: 78px;
  left: 50%;
  z-index: 60;
  transform: translateX(-50%);
  border-radius: 12px;
  background: var(--text);
  color: white;
  box-shadow: var(--shadow);
  padding: 11px 15px;
  transition: opacity .3s, transform .3s;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }
.toast.hide { opacity: 0; transform: translate(-50%, -10px); pointer-events: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

@media (max-width: 820px) {
  .dashboard-grid, .content-grid, .admin-grid { grid-template-columns: 1fr; }
  .sticky-panel { position: static; }
  .full-width { grid-column: auto; }
  .calendar-day { min-height: 95px; padding: 6px; }
  .calendar-event { padding: 4px; font-size: .62rem; }
}
@media (max-width: 560px) {
  .page { width: min(100% - 20px, 1180px); padding-top: 24px; }
  .brand span:last-child { display: none; }
  .dashboard-grid { gap: 28px; }
  .task-main, .calendar-heading { align-items: stretch; flex-direction: column; }
  .assignee { min-width: 0; }
  .task-card, .reservation-card, .settlement-card, .member-card { align-items: stretch; }
  .task-card, .settlement-card { flex-direction: column; }
  .task-card .button, .settlement-card form, .settlement-card .button { width: 100%; }
  .reservation-card { flex-wrap: wrap; }
  .calendar-grid { min-width: 680px; }
  .month-grid, .weekdays { width: 680px; }
  .calendar-legend + .calendar-grid, .month-grid { }
  body:has(.month-grid) .page { overflow-x: auto; }
  .inline-fields { grid-template-columns: 1fr; }
  .feedback-button { right: 14px; bottom: 84px; }
  .bottom-nav a { font-size: .62rem; }
}


.user-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.current-user {
  max-width: 170px;
  overflow: hidden;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.button.small {
  min-height: 36px;
  padding: 0 12px;
  font-size: .82rem;
}
.auth-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top, rgba(49, 94, 231, .10), transparent 38%),
    var(--bg);
}
.auth-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: min(440px, 100%);
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: clamp(24px, 6vw, 38px);
}
.auth-card h1 {
  font-size: clamp(1.8rem, 7vw, 2.6rem);
}
.auth-description {
  margin-bottom: 25px;
  color: var(--muted);
}
.auth-logo {
  display: grid;
  width: 52px;
  height: 52px;
  margin-bottom: 24px;
  place-items: center;
  border-radius: 16px;
  background: var(--text);
  color: white;
  font-size: 1.5rem;
}
.auth-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: .82rem;
  text-align: center;
}
.remember-row {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  cursor: pointer;
}
.remember-row input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}
.remember-row span {
  display: grid;
  gap: 2px;
}
.remember-row small {
  font-weight: 400;
}
code {
  border-radius: 6px;
  background: var(--surface-2);
  padding: 2px 5px;
}

@media (max-width: 560px) {
  .current-user {
    max-width: 105px;
  }
  .user-actions .button {
    padding: 0 9px;
  }
}


.action-group {
  display: flex;
  align-items: center;
  gap: 9px;
}
.nudge-progress {
  display: block;
  margin-top: 4px;
}
.button:disabled {
  cursor: default;
  opacity: .55;
}
.button.danger {
  background: var(--danger);
  color: white;
}
.danger-text {
  color: var(--danger);
}
.danger-zone {
  border-color: rgba(201, 55, 44, .35);
}
.reset-form {
  display: grid;
  grid-template-columns: 1fr minmax(150px, .35fr) auto;
  align-items: end;
  gap: 12px;
}
.shopping-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
}
.shopping-info {
  display: flex;
  min-width: 0;
  gap: 12px;
}
.shopping-info p,
.shopping-summary p {
  margin: 0;
  color: var(--muted);
}
.shopping-check {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 11px;
  background: var(--surface-2);
  font-size: 1.25rem;
}
.purchase-form {
  display: flex;
  align-items: center;
  gap: 8px;
}
.compact-money {
  width: 120px;
}
.pill {
  display: inline-block;
  margin-top: 7px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 4px 8px;
  font-size: .72rem;
  font-weight: 750;
}
.shopping-summary {
  display: flex;
  align-items: center;
  gap: 16px;
}
.summary-number {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 16px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 1.5rem;
  font-weight: 850;
}
.more-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.feature-link {
  display: flex;
  align-items: center;
  gap: 16px;
}
.feature-link h2 {
  margin: 0 0 4px;
}
.feature-link p {
  margin: 0;
  color: var(--muted);
}
.feature-icon {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 15px;
  background: var(--surface-2);
  font-size: 1.35rem;
}

@media (max-width: 720px) {
  .reset-form,
  .shopping-card {
    grid-template-columns: 1fr;
  }
  .purchase-form,
  .purchase-form .button,
  .compact-money {
    width: 100%;
  }
  .chore-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .action-group,
  .action-group form,
  .action-group .button {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .more-grid {
    grid-template-columns: 1fr;
  }
}


.shopping-aside { display: grid; gap: 24px; }
.aside-section + .aside-section { border-top: 1px solid var(--line); padding-top: 22px; }
.history-actions { display: flex; align-items: center; gap: 12px; }
.message-preview p, .board-message p { margin: 8px 0; white-space: pre-wrap; }
.message-preview > div, .board-message-header { display: flex; justify-content: space-between; gap: 12px; }
.message-preview span, .board-message-header span { color: var(--muted); font-size: .82rem; }
.board-message small { display: block; text-align: right; }
