:root {
  --bg: #fbf5ee;
  --surface: #fffaf4;
  --surface-soft: #f7eadc;
  --surface-warm: #fff0cf;
  --ink: #2d241c;
  --muted: #786b5f;
  --line: #eadbca;
  --teal: #b85f45;
  --teal-strong: #8f4938;
  --mint: #d8c88f;
  --coral: #d96850;
  --amber: #e4a43e;
  --blue: #6f8f76;
  --violet: #9b6d7b;
  --danger: #b84e48;
  --shadow: 0 16px 42px rgba(82, 58, 36, 0.12);
  --radius: 8px;
  --radius-sm: 6px;
  --sidebar: 280px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 218, 156, 0.34), rgba(251, 245, 238, 0) 340px),
    var(--bg);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  border: 0;
}

button,
select {
  cursor: pointer;
}

button:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.54;
}

a {
  color: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: rgba(255, 250, 244, 0.9);
  backdrop-filter: blur(18px);
  padding: 22px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--teal);
  color: #fff;
  box-shadow: 0 10px 26px rgba(184, 95, 69, 0.24);
}

.brand-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.brand-subtitle,
.muted {
  color: var(--muted);
}

.brand-subtitle {
  margin: 2px 0 0;
  font-size: 0.83rem;
}

.household-badge {
  display: grid;
  min-width: 190px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-warm);
}

.household-badge strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.92rem;
}

.household-badge span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 720;
}

.account-card {
  display: grid;
  gap: 12px;
  margin-bottom: 22px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.household-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-weight: 750;
}

.invite-code {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--teal-strong);
  background: #fff;
  font-size: 0.78rem;
  font-weight: 750;
}

.label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.select,
.input,
.textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.select,
.input {
  height: 42px;
  padding: 0 11px;
}

.textarea {
  min-height: 88px;
  resize: vertical;
  padding: 10px 11px;
}

.select:focus,
.input:focus,
.textarea:focus {
  border-color: rgba(184, 95, 69, 0.62);
  box-shadow: 0 0 0 4px rgba(184, 95, 69, 0.13);
}

.nav {
  display: grid;
  gap: 6px;
  margin: 0 0 22px;
}

.nav-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border-radius: var(--radius-sm);
  padding: 10px 11px;
  color: var(--muted);
  background: transparent;
  font-weight: 720;
  text-align: left;
}

.nav-button:hover,
.nav-button.is-active {
  color: var(--teal-strong);
  background: #fff0dc;
}

.nav-icon,
.action-icon {
  display: inline-grid;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  place-items: center;
  font-size: 1rem;
}

.sidebar-section {
  margin-top: 20px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  font-size: 0.92rem;
  font-weight: 820;
}

.team-list,
.history-list,
.notification-list,
.comment-list,
.mini-list {
  display: grid;
  gap: 10px;
}

.person-row,
.history-item,
.notification-item,
.comment-item,
.mini-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

button.notification-item,
button.mini-item {
  width: 100%;
  color: inherit;
  background: transparent;
  text-align: left;
}

button.notification-item:hover,
button.mini-item:hover {
  background: #f7faf9;
}

.person-row {
  align-items: center;
  justify-content: space-between;
}

.person-main {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.avatar {
  display: inline-grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 50%;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 850;
  box-shadow: 0 8px 18px rgba(82, 58, 36, 0.13);
}

.avatar.small {
  width: 26px;
  height: 26px;
  font-size: 0.73rem;
}

.person-name,
.truncate {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-name strong,
.person-name span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.person-name span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 720;
}

.person-points {
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 760;
}

.add-user-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
  margin-top: 12px;
}

.main {
  min-width: 0;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
  flex-wrap: wrap;
}

.topbar-brand .brand-title {
  font-size: 1.15rem;
}

.topbar-brand .household-badge {
  margin-left: 10px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal-strong);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.page-title {
  margin: 0;
  font-size: clamp(1.45rem, 2.4vw, 2rem);
  line-height: 1.1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.button,
.icon-button,
.ghost-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border-radius: var(--radius-sm);
  padding: 0 14px;
  font-weight: 800;
  text-decoration: none;
  transition: transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.button {
  color: #fff;
  background: var(--teal);
  box-shadow: 0 12px 26px rgba(184, 95, 69, 0.24);
}

.button:hover {
  background: var(--teal-strong);
  transform: translateY(-1px);
}

.ghost-button,
.icon-button {
  color: var(--ink);
  border: 1px solid var(--line);
  background: rgba(255, 250, 244, 0.86);
}

.ghost-button:hover,
.icon-button:hover {
  background: #fff;
  transform: translateY(-1px);
}

.danger-button {
  color: #fff;
  background: var(--danger);
}

.icon-button {
  width: 42px;
  padding: 0;
  position: relative;
}

.badge-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 9px;
  height: 9px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--coral);
}

.view {
  display: grid;
  gap: 22px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  display: grid;
  align-content: center;
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 244, 0.88);
  padding: 16px;
}

button.metric {
  width: 100%;
  color: inherit;
  text-align: left;
}

.metric-link {
  position: relative;
}

.metric-link::after {
  content: "›";
  position: absolute;
  right: 14px;
  top: 14px;
  color: var(--teal-strong);
  font-size: 1.2rem;
  font-weight: 850;
}

.metric-link:hover {
  border-color: rgba(184, 95, 69, 0.38);
  background: #fff3e2;
}

.metric-value {
  margin: 0;
  font-size: 1.95rem;
  font-weight: 860;
}

.metric-label {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 720;
}

.mini-ranking {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.reward-dashboard-section {
  margin-top: -4px;
}

.reward-task-list {
  display: grid;
  gap: 10px;
}

.reward-task-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 1px solid rgba(184, 95, 69, 0.28);
  border-radius: var(--radius);
  background: #fff3e2;
  color: var(--ink);
  padding: 12px;
  text-align: left;
}

.reward-task-card:hover {
  border-color: rgba(184, 95, 69, 0.48);
  background: #ffe9cc;
}

.reward-task-card strong,
.reward-task-card small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reward-task-card small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 720;
}

.mini-rank-card {
  display: grid;
  grid-template-columns: 28px auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 70px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 244, 0.92);
  padding: 12px;
}

.rank-number {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  color: var(--teal-strong);
  background: #fff0dc;
  font-weight: 850;
}

.rank-person {
  min-width: 0;
}

.rank-person strong,
.rank-person small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-person small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 720;
}

.rank-points {
  color: var(--teal-strong);
  font-weight: 840;
  white-space: nowrap;
}

.single-column {
  display: grid;
  gap: 22px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 22px;
}

.focus-layout,
.task-screen-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 22px;
  align-items: start;
}

.task-screen-grid {
  grid-template-columns: minmax(380px, 0.95fr) minmax(340px, 0.8fr);
}

.detail-pane {
  position: sticky;
  top: 24px;
  min-width: 0;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 244, 0.82);
  padding: 18px;
}

.task-detail-view {
  max-width: 760px;
}

.detail-screen-head {
  align-items: center;
}

.detail-pane-standalone {
  position: static;
  max-height: none;
  background: rgba(255, 250, 244, 0.92);
  box-shadow: 0 10px 26px rgba(82, 58, 36, 0.06);
}

.back-button {
  width: fit-content;
}

.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.person-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 244, 0.9);
  padding: 16px;
}

.person-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.person-card h3 {
  margin: 0 0 3px;
  font-size: 1rem;
}

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

.compact-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.compact-stats span {
  border-radius: var(--radius-sm);
  background: #fff0dc;
  padding: 9px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 740;
}

.compact-stats strong {
  display: block;
  color: var(--ink);
  font-size: 1.1rem;
}

.narrow-block {
  max-width: 760px;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(96px, 0.35fr) auto;
  gap: 10px;
}

.person-remove-button {
  width: 100%;
  justify-content: center;
  margin-top: 14px;
}

.section-block {
  min-width: 0;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.section-head h2,
.section-head h3,
.detail-pane h2,
.detail-pane h3,
.modal-title {
  margin: 0;
}

.section-head h2,
.detail-pane h2 {
  font-size: 1.05rem;
}

.section-head h3,
.detail-pane h3 {
  font-size: 0.96rem;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--muted);
  background: #fff;
  font-size: 0.86rem;
  font-weight: 760;
}

.chip.is-active {
  border-color: rgba(184, 95, 69, 0.2);
  color: var(--teal-strong);
  background: #fff0dc;
}

.task-list {
  display: grid;
  gap: 10px;
}

.task-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 244, 0.94);
  padding: 13px;
  box-shadow: 0 8px 20px rgba(82, 58, 36, 0.05);
}

.task-card:hover,
.task-card.is-selected {
  border-color: rgba(184, 95, 69, 0.42);
}

.task-check {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: transparent;
}

.task-card.is-done .task-check {
  border-color: var(--teal);
  color: #fff;
  background: var(--teal);
}

.task-title {
  margin: 0 0 7px;
  overflow-wrap: anywhere;
  font-size: 0.98rem;
  line-height: 1.28;
}

.task-card.is-done .task-title {
  color: var(--muted);
  text-decoration: line-through;
}

.task-meta,
.detail-grid,
.compact-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.task-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  background: #eef2f5;
  color: #52605d;
  font-size: 0.75rem;
  font-weight: 780;
}

.pill.high {
  color: #8a3129;
  background: #fde7e3;
}

.pill.medium {
  color: #70501a;
  background: #fff1cf;
}

.pill.low {
  color: #4c6f52;
  background: #e7f0df;
}

.pill.overdue {
  color: #903735;
  background: #ffe1e1;
}

.pill.done {
  color: #4c6f52;
  background: #e7f0df;
}

.pill.blue {
  color: #385b97;
  background: #e6eefb;
}

.task-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.quick-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 34px;
  border-radius: var(--radius-sm);
  color: var(--teal-strong);
  background: #fff0dc;
  font-weight: 850;
}

.quick-button:hover {
  background: #ffe5bf;
}

.empty-state {
  border: 1px dashed #dcc6ae;
  border-radius: var(--radius);
  padding: 26px;
  text-align: center;
  color: var(--muted);
  background: rgba(255, 250, 244, 0.62);
}

.empty-state strong {
  display: block;
  margin-bottom: 5px;
  color: var(--ink);
}

.inspector-stack {
  display: grid;
  gap: 22px;
}

.detail-card {
  display: grid;
  gap: 15px;
}

.detail-title {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 1.28rem;
  line-height: 1.16;
}

.detail-row {
  display: grid;
  grid-template-columns: 98px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.detail-label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
}

.detail-value {
  min-width: 0;
  font-weight: 720;
}

.comment-item,
.history-item,
.notification-item,
.mini-item {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.comment-item:last-child,
.history-item:last-child,
.notification-item:last-child,
.mini-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.item-body {
  min-width: 0;
}

.item-title {
  margin: 0 0 3px;
  overflow-wrap: anywhere;
  font-size: 0.89rem;
  font-weight: 780;
}

.item-text {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.38;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(45, 36, 28, 0.4);
}

.modal {
  width: min(720px, 100%);
  max-height: min(760px, 92vh);
  overflow-y: auto;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 20px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-card {
  display: grid;
  width: min(520px, 100%);
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 244, 0.92);
  box-shadow: var(--shadow);
  padding: 22px;
}

.onboarding-card {
  width: min(760px, 100%);
}

.onboarding-section {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.onboarding-section h2 {
  margin: 0;
  font-size: 1rem;
}

.known-house-list,
.member-setup-list,
.house-create-form {
  display: grid;
  gap: 12px;
}

.known-house-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 0.7fr) minmax(96px, 0.45fr) auto;
  align-items: end;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffaf4;
  padding: 12px;
}

.known-house-card strong,
.known-house-card small {
  display: block;
}

.known-house-card small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 720;
}

.member-setup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(96px, 0.35fr) auto;
  align-items: end;
  gap: 10px;
}

.split-actions {
  justify-content: space-between;
}

.login-card .topbar-brand {
  justify-content: flex-start;
}

.login-card .household-badge {
  width: 100%;
}

.invite-panel {
  width: fit-content;
  min-width: 220px;
}

.login-modal {
  width: min(520px, 100%);
}

.pin-login-form {
  display: grid;
  gap: 14px;
}

.pin-login-form .button {
  width: 100%;
  justify-content: center;
}

.login-options {
  display: grid;
  gap: 10px;
}

.login-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 68px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffaf4;
  color: var(--ink);
  padding: 12px;
  text-align: left;
}

.login-option:hover {
  border-color: rgba(184, 95, 69, 0.38);
  background: #fff3e2;
}

.login-option strong,
.login-option small {
  display: block;
}

.login-option small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 720;
}

.calendar-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.calendar-title {
  margin: 0;
  font-size: 1.15rem;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.weekday,
.day-cell {
  min-width: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.weekday:nth-child(7n),
.day-cell:nth-child(7n) {
  border-right: 0;
}

.weekday {
  display: grid;
  min-height: 42px;
  place-items: center;
  color: var(--muted);
  background: #f9fbfa;
  font-size: 0.76rem;
  font-weight: 800;
}

.day-cell {
  min-height: 112px;
  padding: 8px;
  background: #fff;
  text-align: left;
}

.day-cell.is-muted {
  background: #fafafa;
  color: #a0aaa7;
}

.day-cell.is-today {
  background: #fff1dc;
}

.day-cell.is-selected {
  outline: 3px solid rgba(184, 95, 69, 0.34);
  outline-offset: -3px;
}

.day-number {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  font-size: 0.82rem;
  font-weight: 830;
}

.is-today .day-number {
  color: #fff;
  background: var(--teal);
}

.day-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
}

.dot.high {
  background: var(--coral);
}

.dot.medium {
  background: var(--amber);
}

.dot.low {
  background: var(--teal);
}

.dot.done {
  background: #9fa9a6;
}

.day-count {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 760;
}

.leaderboard {
  display: grid;
  gap: 12px;
}

.leader-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.progress {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #eadbca;
}

.progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--amber));
}

.reward-axis {
  position: relative;
  height: 24px;
  margin-top: 7px;
  border-radius: 999px;
  background: #eadbca;
}

.reward-axis.compact {
  height: 18px;
  margin-top: 5px;
}

.reward-axis-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--amber), var(--coral));
}

.reward-axis-marker {
  position: absolute;
  top: 50%;
  display: grid;
  min-width: 34px;
  transform: translate(-50%, -50%);
  place-items: center;
  border: 2px solid #fffaf4;
  border-radius: 999px;
  background: #8f7a67;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 850;
  line-height: 1;
  padding: 4px 6px;
  box-shadow: 0 2px 8px rgba(82, 58, 36, 0.16);
}

.reward-axis.compact .reward-axis-marker {
  min-width: 26px;
  font-size: 0.58rem;
  padding: 3px 4px;
}

.reward-axis-marker.is-reached {
  background: var(--teal-strong);
}

.reward-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.reward {
  min-height: 142px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 244, 0.9);
  padding: 15px;
}

.reward-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: var(--radius);
  background: #fff0dc;
  color: var(--teal-strong);
  font-size: 1.15rem;
}

.reward h3 {
  margin: 12px 0 5px;
  font-size: 0.98rem;
}

.reward p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.toast-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 36px));
}

.toast {
  border: 1px solid var(--line);
  border-left: 5px solid var(--teal);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 12px 13px;
}

.toast strong {
  display: block;
  margin-bottom: 3px;
}

.toast span {
  color: var(--muted);
  font-size: 0.86rem;
}

.notification-panel {
  position: fixed;
  right: 20px;
  top: 72px;
  z-index: 18;
  width: min(380px, calc(100vw - 32px));
  max-height: 70vh;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 16px;
}

.split-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 720;
}

.hidden {
  display: none !important;
}

@media (max-width: 1240px) {
  :root {
    --sidebar: 250px;
  }

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

  .content-grid,
  .focus-layout,
  .task-screen-grid,
  .calendar-shell {
    grid-template-columns: 1fr;
  }

  .detail-pane {
    position: static;
    max-height: none;
  }

  .notification-panel {
    right: 20px;
  }
}

@media (max-width: 980px) {
  .app-shell {
    display: block;
  }

  .main {
    width: 100%;
    padding: 16px 16px calc(98px + env(safe-area-inset-bottom));
  }

  .sidebar {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 30;
    height: auto;
    max-height: 92px;
    overflow: visible;
    border: 0;
    border-top: 1px solid var(--line);
    background: rgba(255, 250, 244, 0.97);
    box-shadow: 0 -14px 34px rgba(82, 58, 36, 0.14);
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  }

  .account-card,
  .sidebar-section {
    display: none;
  }

  .nav {
    display: flex;
    gap: 6px;
    margin: 0;
    overflow-x: auto;
    padding: 0 2px;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav-button {
    flex: 0 0 86px;
    min-height: 58px;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 7px 6px;
    text-align: center;
  }

  .nav-button span:last-child {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.7rem;
  }

  .nav-icon {
    width: 24px;
    height: 22px;
    font-size: 1rem;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 12;
    display: grid;
    align-items: center;
    gap: 10px;
    margin: -16px -16px 16px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 250, 244, 0.97);
    backdrop-filter: blur(16px);
    padding: 10px 16px;
  }

  .topbar-brand {
    flex-wrap: nowrap;
    width: 100%;
    gap: 9px;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 44px 44px minmax(0, 1fr);
    width: 100%;
    gap: 8px;
  }

  .topbar-actions [data-action="request-notifications"] {
    display: none;
  }

  .topbar-actions [data-action="open-login-modal"] {
    width: 44px;
    padding: 0;
  }

  .topbar-actions [data-action="open-login-modal"] span:not(.avatar) {
    display: none;
  }

  .topbar-actions .icon-button,
  .topbar-actions .button,
  .topbar-actions .ghost-button {
    min-height: 44px;
  }
}

@media (max-width: 720px) {
  .main {
    padding: 12px 12px calc(94px + env(safe-area-inset-bottom));
  }

  .sidebar {
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  }

  .nav-button {
    flex: 0 0 76px;
  }

  .topbar {
    margin: -12px -12px 16px;
    padding: 10px 12px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .topbar-brand .brand-title {
    font-size: 1rem;
  }

  .topbar-brand .brand-subtitle {
    display: none;
  }

  .topbar-brand .household-badge {
    min-width: 0;
    max-width: 132px;
    margin-left: auto;
    padding: 7px 9px;
  }

  .topbar-brand .household-badge strong {
    font-size: 0.76rem;
  }

  .topbar-brand .household-badge span {
    display: none;
  }

  .section-head,
  .calendar-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-row {
    justify-content: flex-start;
  }

  .filter-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .filter-row::-webkit-scrollbar {
    display: none;
  }

  .chip {
    flex: 0 0 auto;
    min-height: 38px;
  }

  .view {
    gap: 16px;
  }

  .section-head {
    gap: 10px;
    margin-bottom: 10px;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .metric {
    min-height: 84px;
    padding: 12px;
  }

  .metric-value {
    font-size: 1.55rem;
  }

  .metric-label {
    font-size: 0.78rem;
  }

  .mini-ranking,
  .form-grid,
  .reward-grid,
  .compact-stats,
  .known-house-card,
  .member-setup-row,
  .inline-form {
    grid-template-columns: 1fr;
  }

  .split-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .mini-rank-card {
    min-height: 62px;
    padding: 10px;
  }

  .task-card {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
  }

  .task-check {
    width: 32px;
    height: 32px;
  }

  .quick-button {
    min-width: 40px;
    min-height: 40px;
  }

  .select,
  .input {
    height: 46px;
  }

  .task-title {
    font-size: 0.94rem;
  }

  .task-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    padding-left: 42px;
  }

  .day-cell {
    min-height: 62px;
    padding: 5px;
  }

  .weekday {
    min-height: 30px;
    font-size: 0.68rem;
  }

  .day-number {
    width: 24px;
    height: 24px;
    font-size: 0.75rem;
  }

  .day-dots {
    margin-top: 5px;
  }

  .dot {
    width: 6px;
    height: 6px;
  }

  .day-count {
    display: none;
  }

  .detail-row {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .button,
  .ghost-button,
  .danger-button {
    width: 100%;
  }

  .back-button {
    width: 100%;
  }

  .modal-backdrop {
    align-items: stretch;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-height: none;
    min-height: 100vh;
    border-radius: 0;
    padding: 16px;
  }

  .notification-panel {
    right: 8px;
    left: 8px;
    top: 76px;
    width: auto;
    max-height: calc(100vh - 168px);
  }

  .toast-root {
    right: 10px;
    bottom: calc(86px + env(safe-area-inset-bottom));
    width: min(360px, calc(100vw - 20px));
  }

  .split-actions {
    grid-template-columns: 1fr;
  }
}
