/* HouseBoard v4 — styles.css
   Palette tuned for matte ambient/picture-frame displays.
   Warm off-whites, earthy neutrals, low-saturation naturals.
   No pure whites, no cool grays, no neon accents. */
:root {
  /* Backgrounds — warm parchment family */
  --bg:    #f4ece0;          /* main app bg — warm linen */
  --paper: #fdf7ee;          /* card/panel bg — warm cream */
  --card:  #faf3e8;          /* slightly darker card for depth */

  /* Text */
  --ink:   #2a2620;          /* near-black with warm undertone */
  --muted: #7a7167;          /* warm mid-gray */

  /* Borders / lines */
  --line:  #e5d8c4;          /* warm tan divider */

  /* Status colors — all desaturated, warm-shifted */
  --blue:   #d8eaf0;         /* needs claim — soft sky */
  --blue2:  #b8d4df;         /* active nav, accents */
  --green:  #d5e8d0;         /* done — sage */
  --green2: #9dc4b0;         /* primary button — muted teal */
  --yellow: #f2e4aa;         /* claimed — warm straw */
  --peach:  #f0ccb4;         /* needs completion — warm terracotta */
  --peach2: #e09870;         /* peach accent */
  --purple: #e0d8f0;         /* started — dusty lavender */

  /* Utility */
  --white:  #fdf7ee;         /* "white" — actually warm cream, never pure white */
  --shadow: 0 12px 32px rgba(60, 45, 25, .10);
  --shadow-sm: 0 3px 12px rgba(60, 45, 25, .07);
  --radius: 24px;
  --radius-sm: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-rounded, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overscroll-behavior: none;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

/* ── App shell ── */
.app-shell {
  height: 100%;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
}

/* ── Topbar ── */
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255, 250, 242, .92);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 10px;
  z-index: 20;
  backdrop-filter: blur(14px);
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-shrink: 0;
}
.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: linear-gradient(135deg, #d8eae0, #c8d8e8);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(60,100,80,.18);
}
.brand h1 { font-size: 1.1rem; margin: 0; white-space: nowrap; }
.brand p { margin: 0; color: var(--muted); font-size: .85rem; white-space: nowrap; }

.nav-tabs {
  display: flex;
  gap: 6px;
  flex: 1;
  overflow-x: auto;
  padding: 3px;
  scrollbar-width: none;
  min-width: 0;
}
.nav-tabs::-webkit-scrollbar { display: none; }

/* ── Buttons ── */
.nav-tab, .small-btn, .ghost-btn, .primary-btn, .icon-btn {
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  background: #f2eadf;
  color: var(--ink);
  white-space: nowrap;
  line-height: 1;
}
.nav-tab.active { background: var(--blue2); font-weight: 800; }
.primary-btn { background: var(--green2); color: #16251e; font-weight: 800; }
.ghost-btn { background: #f2eadf; }
.small-btn { padding: 7px 10px; font-weight: 700; }
.icon-btn { width: 38px; height: 38px; padding: 0; font-size: 1.3rem; background: #f4eadc; flex-shrink: 0; }

/* ── Main grid — stretches to fill remaining screen height ── */
.main-grid {
  display: grid;
  grid-template-columns: 185px minmax(0, 1fr) 230px;
  gap: 14px;
  flex: 1;
  min-height: 0;
  align-items: stretch;
}

/* ── Panels ── */
.side-panel, .view-root {
  background: rgba(255, 250, 242, .92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: auto;
  min-height: 0;
}
.side-panel { padding: 14px; }
.view-root { padding: 16px; }

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.panel-title-row h2 { margin: 0; font-size: .95rem; }

.family-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.family-chip {
  border: 2px solid transparent;
  background: var(--white);
  border-radius: 18px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  width: 100%;
}
.family-chip.active { border-color: #6e9885; box-shadow: 0 0 0 3px rgba(110, 152, 133, .15); }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: .9rem; flex-shrink: 0; }

.soft-note { font-size: .82rem; color: var(--muted); line-height: 1.3; }
.mini-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.grocery-mini-head { margin-top: 18px; }
.mini-card { background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 9px 11px; font-size: .85rem; box-shadow: var(--shadow-sm); }
.empty { color: var(--muted); padding: 12px; border: 1px dashed var(--line); border-radius: 14px; background: #fffaf7; font-size: .88rem; text-align: center; }

/* ── View header ── */
.view-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.view-head h2 { margin: 0; font-size: 1.35rem; }
.view-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.date-controls { display: flex; align-items: center; gap: 6px; }

/* ── Task cards / pills ── */
.task-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 11px 13px;
  box-shadow: var(--shadow-sm);
  display: block;
  width: 100%;
  text-align: left;
  margin-bottom: 8px;
}
.task-card:last-child { margin-bottom: 0; }
.task-card h4 { margin: 0 0 3px; font-size: .95rem; }
.task-card p { margin: 0; color: var(--muted); font-size: .8rem; line-height: 1.3; }

.task-pill {
  border: 0;
  border-radius: 10px;
  padding: 5px 7px;
  text-align: left;
  background: var(--blue);
  font-size: .8rem;
  line-height: 1.15;
  overflow: hidden;
  display: block;
  width: 100%;
  cursor: pointer;
}
.task-pill strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-pill .meta { display: block; color: #5f5a51; font-size: .7rem; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Status colors */
.task-card.done, .task-pill.done { background: var(--green); opacity: .78; }
.task-card.claimed, .task-pill.claimed { background: var(--yellow); }
.task-card.started, .task-pill.started { background: var(--purple); }
.task-card.needs_completion, .task-pill.needs_completion { background: var(--peach); }
.task-card.needs_claim, .task-pill.needs_claim { background: var(--blue); }

.status-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 800;
  margin-top: 6px;
  background: #f2eadf;
}
.status-needs_claim { background: var(--blue); }
.status-claimed { background: var(--yellow); }
.status-started { background: var(--purple); }
.status-done { background: var(--green); }
.status-needs_completion { background: var(--peach); }

/* ── Today board ── */
.today-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 10px;
  overflow-x: auto;
}
.lane {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 12px;
  min-height: 280px;
  min-width: 0;
}
.lane h3 {
  margin: 0 0 10px;
  font-size: .92rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}
.lane.needs_completion { background: #fff5ef; }
.lane.done { background: #f5fbf3; }

/* ── Week grid ── */
.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}
.week-day {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 10px;
  min-height: 200px;
}
.week-day h3 { margin: 0 0 6px; font-size: .88rem; font-weight: 800; }
.week-day.today-day { outline: 2px solid var(--green2); outline-offset: -1px; }

/* ── Month calendar — CRITICAL: no nested buttons ── */
.month-calendar { width: 100%; }

.weekday-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--hb-gap, 6px);
  margin-bottom: 6px;
  color: var(--muted);
  font-weight: 900;
  text-align: center;
  font-size: clamp(.6rem, 1.1vw, .85rem);
  text-transform: uppercase;
  letter-spacing: .03em;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--hb-gap, 6px);
  width: 100%;
}

/* Day cell: NOT a button — avoids nested button issue */
.day-cell {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: clamp(8px, 1.5vw, 18px);
  padding: clamp(4px, .8vw, 9px);
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: clamp(70px, 10vw, 140px);
  min-width: 0;
  position: relative;
  overflow: hidden;
}
.day-cell.today { outline: 2px solid rgba(169, 205, 189, .9); outline-offset: -2px; background: #f7fdf9; }
.day-cell.outside { opacity: .38; }

/* Day number row — clickable area to open day */
.day-num-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  border-radius: 6px;
  padding: 1px 2px;
}
.day-num-row:hover { background: rgba(0,0,0,.04); }
.day-num {
  font-size: clamp(.68rem, 1.5vw, .95rem);
  font-weight: 900;
  color: #3e3a34;
  line-height: 1;
}
.day-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.3em;
  height: 1.3em;
  padding: 0 .25em;
  border-radius: 999px;
  background: var(--peach);
  font-size: .65em;
  font-weight: 800;
  color: #5a2e18;
}

.month-task-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

/* Task pills inside month cells — these ARE buttons */
.month-task-pill {
  border: 0;
  border-radius: clamp(4px, .8vw, 10px);
  padding: clamp(2px, .4vw, 5px) clamp(3px, .6vw, 7px);
  text-align: left;
  line-height: 1.1;
  font-size: clamp(.5rem, .95vw, .78rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  width: 100%;
  display: block;
}
.month-task-pill.needs_claim { background: var(--blue); }
.month-task-pill.claimed { background: var(--yellow); }
.month-task-pill.started { background: var(--purple); }
.month-task-pill.done { background: var(--green); opacity: .75; }
.month-task-pill.needs_completion { background: var(--peach); }

.day-add-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: clamp(.65rem, 1.2vw, .9rem);
  padding: 1px 3px;
  border-radius: 5px;
  cursor: pointer;
  align-self: flex-end;
  line-height: 1;
  opacity: 0;
  transition: opacity .15s;
}
.day-cell:hover .day-add-btn { opacity: 1; }

.more-count {
  color: var(--muted);
  font-weight: 800;
  font-size: clamp(.48rem, .9vw, .72rem);
  padding: 1px 2px;
}

/* ── Groceries ── */
.list-sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.list-section { background: var(--white); border: 1px solid var(--line); border-radius: 20px; padding: 12px; }
.list-section h3 { margin: 0 0 10px; font-size: .92rem; }
.grocery-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 9px 11px;
  margin-bottom: 7px;
  box-shadow: var(--shadow-sm);
  gap: 8px;
}
.grocery-card.bought { opacity: .5; text-decoration: line-through; }
.grocery-card-actions { display: flex; gap: 5px; flex-shrink: 0; }

/* ── Stats ── */
.metric-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.metric { background: var(--white); border: 1px solid var(--line); border-radius: 20px; padding: 14px 16px; }
.metric strong { display: block; font-size: 1.55rem; line-height: 1.1; margin-bottom: 3px; }
.metric span { color: var(--muted); font-size: .82rem; }

/* ── Modals ── */
.modal {
  border: 0;
  background: transparent;
  max-width: min(620px, 94vw);
  width: 620px;
  padding: 0;
}
.modal::backdrop { background: rgba(40, 35, 28, .35); backdrop-filter: blur(4px); }
.modal-card { background: var(--paper); border: 1px solid var(--line); border-radius: 28px; padding: 20px; box-shadow: var(--shadow); }
.small-modal { max-width: 420px; margin: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.modal-head h2 { margin: 0; font-size: 1.15rem; }
.modal label { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; font-weight: 800; color: #4a453e; font-size: .9rem; }
.modal input, .modal select, .modal textarea { border: 1px solid var(--line); border-radius: 14px; padding: 11px 13px; background: var(--white); color: var(--ink); }
.form-row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.template-pills { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.template-pills button { border: 0; border-radius: 999px; background: var(--blue); padding: 7px 10px; font-size: .82rem; cursor: pointer; }
.template-pills button:hover { background: var(--blue2); }

/* ── Action dialog content ── */
.action-info { margin-bottom: 12px; }
.action-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.action-grid button { border: 0; border-radius: 16px; padding: 13px; background: #f2eadf; font-weight: 800; cursor: pointer; font-size: .9rem; }
.action-grid button:hover { filter: brightness(.95); }

.person-choice, .time-choice { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.person-choice button, .time-choice button { border: 0; border-radius: 14px; padding: 11px 13px; background: #f2eadf; font-weight: 800; cursor: pointer; }
.person-choice button:hover, .time-choice button:hover { filter: brightness(.95); }
.person-choice button.selected { outline: 3px solid #426b5a; }

.danger { background: var(--peach) !important; }
.success { background: var(--green) !important; }
.warning { background: var(--yellow) !important; }

/* ── Morning review ── */
.morning-review {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.morning-review h2 { margin: 0 0 6px; font-size: 1.25rem; }
.morning-review .soft-note { margin-bottom: 14px; }
.review-items { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.review-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 13px;
}
.review-item .task-name { font-weight: 700; flex: 1; }
.review-item .task-reason { font-size: .8rem; color: var(--muted); }
.review-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Settings ── */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.setting-card { background: var(--white); border: 1px solid var(--line); border-radius: 20px; padding: 14px; }
.setting-card h3 { margin: 0 0 8px; font-size: 1rem; }

/* ── Toast ── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #2b2b28;
  color: #fff;
  padding: 11px 18px;
  border-radius: 999px;
  z-index: 100;
  box-shadow: var(--shadow);
  font-size: .9rem;
  animation: toast-in .2s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translateX(-50%) translateY(8px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ── Needs completion lane color strip ── */
.nc-reason { font-size: .75rem; color: #7a4a2e; background: rgba(244, 209, 191, .5); border-radius: 6px; padding: 2px 6px; display: inline-block; margin-top: 4px; }

/* ── Backlog card ── */
.task-card.backlog { background: var(--blue); }
.month-task-pill.backlog { background: var(--blue); }

/* ── Backlog toggle in task dialog ── */
.backlog-toggle-label {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 10px;
  margin: 8px 0 4px !important;
  font-weight: 700 !important;
  font-size: .9rem;
  cursor: pointer;
  background: var(--blue);
  border-radius: 12px;
  padding: 10px 13px !important;
}
.backlog-toggle-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #5a8fa0;
  flex-shrink: 0;
  border: none !important;
  padding: 0 !important;
}

/* ── Stats ── */
.stats-period-tabs {
  display: flex;
  gap: 4px;
  background: #f0e8dc;
  border-radius: 999px;
  padding: 3px;
}
.stats-period-tab {
  border: 0;
  border-radius: 999px;
  padding: 7px 13px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: .85rem;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.stats-period-tab.active {
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(70,55,35,.12);
}

.stat-summary-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  min-width: 0;
}
.stat-card.accent-green { background: #f2fbf5; border-color: #c8e8d2; }
.stat-card.accent-peach { background: #fff5ef; border-color: #f4d1bf; }
.stat-card.accent-blue  { background: #f0f8fd; border-color: #bfdbe5; }
.stat-number { font-size: 1.65rem; font-weight: 900; line-height: 1; margin-bottom: 4px; }
.stat-label  { font-size: .78rem; color: var(--muted); font-weight: 600; }

.stat-bar-wrap {
  margin-top: 8px;
  height: 7px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.stat-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width .4s ease;
  min-width: 2px;
}
.stat-bar-label { display: none; }

.stat-chart-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 14px;
}
.stat-chart-title { font-weight: 800; font-size: .9rem; margin-bottom: 12px; color: var(--muted); }

.mini-bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 80px;
  padding-bottom: 20px;
  position: relative;
}
.mini-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 4px;
}
.mini-bar {
  width: 100%;
  border-radius: 5px 5px 0 0;
  min-height: 3px;
  transition: height .35s ease;
}
.mini-bar-x {
  font-size: .65rem;
  color: var(--muted);
  font-weight: 700;
  position: absolute;
  bottom: 0;
  white-space: nowrap;
}

.stat-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.stat-detail-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
}
.stat-detail-card h3 { margin: 0 0 4px; font-size: .95rem; }

.stat-person-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
}
.stat-cat-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--purple);
  flex-shrink: 0;
}

.rhythm-fact {
  font-size: .88rem;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  line-height: 1.4;
}
.rhythm-fact:last-child { border-bottom: 0; }

/* ── Backup status ── */
.backup-status {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 13px;
  font-size: .88rem;
}
.backup-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.backup-status-dot.ok   { background: #6bb886; }
.backup-status-dot.warn { background: #e8a886; }

/* ── Day detail panel (right sidebar in month view) ── */
#dayDetailPanel {
  height: 100%;
  overflow-y: auto;
}
.day-cell.day-selected {
  outline: 2px solid var(--green2) !important;
  outline-offset: -2px;
  background: #f0faf5 !important;
}
.day-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.day-detail-date {
  font-size: .75rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.day-detail-full {
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--ink);
  margin-top: 2px;
}
.day-detail-section-label {
  font-size: .72rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.day-detail-task {
  padding: 8px 10px !important;
}

/* ── Dashboard ── */
.dashboard-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
}
.dash-hero {
  background: linear-gradient(135deg, #e8f0e8 0%, #dce8f0 100%);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px 22px;
  flex-shrink: 0;
}
.dash-greeting {
  font-size: .85rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 2px;
}
.dash-date {
  font-size: clamp(1.1rem, 2.5vw, 1.55rem);
  font-weight: 900;
  color: var(--ink);
  margin-bottom: 12px;
}
.dash-progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.dash-progress-bar {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,.5);
  border-radius: 999px;
  overflow: hidden;
}
.dash-progress-fill {
  height: 100%;
  background: var(--green2);
  border-radius: 999px;
  transition: width .5s ease;
  min-width: 2px;
}
.dash-progress-label {
  font-size: .82rem;
  color: var(--muted);
  white-space: nowrap;
  font-weight: 600;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 12px;
  flex: 1;
  min-height: 0;
  align-items: start;
}
.dash-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  box-shadow: var(--shadow-sm);
}
.dash-card-head {
  font-weight: 800;
  font-size: .82rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.dash-side-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dash-member-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
}
.dash-member-row:last-child { margin-bottom: 0; }
.dash-member-name { font-weight: 700; font-size: .88rem; flex: 1; }
.dash-alert-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  font-size: .88rem;
}
.dash-alert-row:last-child { border-bottom: 0; padding-bottom: 0; }
.dash-alert-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dash-upcoming-row {
  padding: 8px 0 8px 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2px;
}
.dash-upcoming-row:last-child { border-bottom: 0; }
.dash-done-section {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  opacity: .7;
}
.dash-done-label {
  font-size: .75rem;
  font-weight: 800;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.dash-tasks-card {
  overflow-y: auto;
  max-height: 70vh;
}

/* Dashboard responsive */
@media (max-width: 1100px) {
  .dashboard-grid {
    grid-template-columns: 1fr 1fr;
  }
  .dash-side-col {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
  }
}
@media (max-width: 600px) {
  .dashboard-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Dashboard week strip */
.dash-week-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 4px;
}
.dash-week-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px;
  border-radius: 12px;
  cursor: pointer;
  transition: background .12s;
}
.dash-week-day:hover { background: var(--bg); }
.dash-week-today {
  background: linear-gradient(135deg, #e8f0e8, #dce8f0);
  border: 1px solid var(--line);
}
.dash-week-label {
  font-size: .68rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.dash-week-num {
  font-size: .95rem;
  font-weight: 900;
  color: var(--ink);
  line-height: 1;
}
.dash-week-bar-wrap {
  width: 100%;
  height: 32px;
  background: var(--line);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}
.dash-week-bar {
  width: 100%;
  background: var(--green2);
  border-radius: 4px;
  transition: height .3s ease;
  min-height: 2px;
}
.dash-week-count {
  font-size: .7rem;
  font-weight: 700;
  color: var(--muted);
}
.dash-week-event-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--peach2);
}

/* ── Needs Completion view ── */
.needs-today-summary {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.needs-today-stats {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  font-size: .9rem;
}
.needs-today-stats span { color: var(--muted); }
.needs-today-stats strong { color: var(--ink); }
.needs-today-bar {
  height: 8px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.needs-today-fill {
  height: 100%;
  background: var(--green2);
  border-radius: 999px;
  transition: width .4s ease;
  min-width: 2px;
}
.needs-section-head {
  font-weight: 800;
  font-size: .88rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.needs-section-count {
  background: var(--peach);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: .75rem;
  font-weight: 800;
  color: var(--ink);
}
.needs-today-lanes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.needs-today-lane { display: flex; flex-direction: column; gap: 6px; }
.needs-lane-label {
  font-size: .75rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
  width: fit-content;
}
.needs-lane-label.status-needs_claim { background: var(--blue); }
.needs-lane-label.status-claimed     { background: var(--yellow); }
.needs-lane-label.status-started     { background: var(--purple); }
.needs-lane-label.status-done        { background: var(--green); }
.needs-lane-label.status-needs_completion { background: var(--peach); }

/* ── Task member dots ── */
.task-member-dots {
  display: flex;
  gap: 3px;
  align-items: center;
  flex-shrink: 0;
}
.task-member-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: .65rem;
  font-weight: 900;
  color: rgba(0,0,0,.5);
  flex-shrink: 0;
}

/* Missed recurring — faded red pill on calendar */
.month-task-pill.missed-recurring {
  background: rgba(220, 100, 80, .12) !important;
  border-left: 3px solid rgba(220, 100, 80, .5) !important;
  color: rgba(180, 60, 40, .7) !important;
  opacity: .75;
  cursor: default;
  pointer-events: none;
}

/* ── Calendar filter bar ── */
.cal-filter-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.cal-filter-btn {
  border: 0;
  border-radius: 999px;
  padding: 7px 14px;
  background: #f0e8dc;
  color: var(--muted);
  font-weight: 700;
  font-size: .82rem;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.cal-filter-btn.active {
  background: var(--ink);
  color: #fff;
}

/* ── Calendar event cards (Today / Agenda view) ── */
.today-events {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}
.cal-event-card {
  border-radius: 16px;
  padding: 11px 14px;
  cursor: pointer;
  transition: filter .15s;
  border: 1px solid rgba(0,0,0,.06);
}
.cal-event-card:hover { filter: brightness(.97); }
.cal-event-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.cal-event-type-badge {
  font-size: .7rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.cal-event-time {
  font-size: .78rem;
  color: var(--muted);
  font-weight: 600;
}
.cal-event-title {
  font-size: .95rem;
  display: block;
}
.cal-event-who {
  font-size: .78rem;
  color: var(--muted);
  margin-top: 3px;
}
.cal-event-note {
  font-size: .78rem;
  color: var(--muted);
  margin-top: 3px;
  font-style: italic;
}

/* ── Agenda view ── */
.agenda-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.agenda-day { }
.agenda-day-label {
  font-weight: 800;
  font-size: .88rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.agenda-day-label.agenda-today { color: var(--ink); }
.today-tag {
  background: var(--green2);
  color: #16251e;
  font-size: .68rem;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 800;
}
.agenda-events { display: flex; flex-direction: column; gap: 7px; }

/* ── Member checkboxes in event dialog ── */
.member-check-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.member-check-item {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 6px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px 6px 8px !important;
  font-weight: 600 !important;
  font-size: .85rem;
  cursor: pointer;
  margin: 0 !important;
}
.member-check-item input[type=checkbox] {
  width: 15px;
  height: 15px;
  border: none !important;
  padding: 0 !important;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════
   HOUSE / GARDEN VIEW
   ══════════════════════════════════════════ */
.house-view { display: flex; flex-direction: column; gap: 16px; }

.house-main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}

/* Garden panel */
.garden-panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.garden-scene {
  position: relative;
  height: 200px;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 12px;
}
.garden-sky {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, #d8eef8 0%, #eef8f0 70%, #c8d8a8 100%);
}
.garden-ground {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 36px;
  background: linear-gradient(180deg, #a89860 0%, #8a7848 100%);
  border-radius: 0 0 14px 14px;
}
.garden-tree {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
}
.garden-stage-label {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: .7rem;
  font-weight: 800;
  color: rgba(255,255,255,.85);
  text-shadow: 0 1px 3px rgba(0,0,0,.4);
  white-space: nowrap;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.garden-health-wrap { margin-bottom: 8px; }
.garden-health-label {
  display: flex;
  justify-content: space-between;
  font-size: .8rem;
  font-weight: 700;
  margin-bottom: 5px;
}
.garden-health-bar {
  height: 10px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.garden-health-fill {
  height: 100%;
  border-radius: 999px;
  transition: width .5s ease;
  min-width: 3px;
}
.garden-streak {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px;
  background: var(--bg);
  border-radius: 12px;
}
.garden-streak-flame { font-size: 1.4rem; }
.garden-streak-num {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--ink);
  line-height: 1;
}

/* RPG Card */
.rpg-card {
  background: #1a1208;
  border: 2px solid #4a3a10;
  border-radius: 16px;
  padding: 18px 16px;
  color: #e0c870;
  font-family: 'Courier New', 'Lucida Console', monospace;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,200,80,.1);
}
.rpg-scanlines {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,.08) 2px,
    rgba(0,0,0,.08) 4px
  );
  pointer-events: none;
  border-radius: 14px;
}
.rpg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .65rem;
  letter-spacing: .12em;
  color: #a08840;
  margin-bottom: 8px;
  border-bottom: 1px solid #3a2a08;
  padding-bottom: 8px;
}
.rpg-title { text-transform: uppercase; }
.rpg-star { color: #e0c870; font-size: .85rem; }
.rpg-name {
  font-size: clamp(.85rem, 2vw, 1.1rem);
  font-weight: 900;
  color: #f0e090;
  letter-spacing: .08em;
  margin-bottom: 6px;
  text-shadow: 0 0 8px rgba(240,224,144,.3);
}
.rpg-level {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 2px;
}
.rpg-lv { font-size: .65rem; color: #a08840; letter-spacing: .1em; }
.rpg-lv-num { font-size: 2rem; font-weight: 900; color: #f0e090; line-height: 1; text-shadow: 0 0 12px rgba(240,224,144,.4); }
.rpg-class { font-size: .68rem; color: #c0a050; letter-spacing: .1em; margin-bottom: 12px; }
.rpg-xp-section { margin-bottom: 10px; }
.rpg-xp-label { font-size: .65rem; color: #a09060; letter-spacing: .06em; margin-bottom: 5px; }
.rpg-xp-bar-wrap { }
.rpg-xp-bar { display: flex; gap: 2px; }
.rpg-xp-seg {
  flex: 1;
  height: 10px;
  background: #2a2008;
  border: 1px solid #3a3010;
  border-radius: 1px;
  transition: background .3s;
}
.rpg-xp-seg.filled { background: #80c030; border-color: #60a020; box-shadow: 0 0 4px rgba(128,192,48,.4); }
.rpg-divider { border: 0; border-top: 1px solid #3a2a08; margin: 10px 0; }
.rpg-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}
.rpg-stat { text-align: center; }
.rpg-stat-val { font-size: .95rem; font-weight: 900; color: #d0e080; }
.rpg-stat-lbl { font-size: .52rem; color: #806830; letter-spacing: .06em; margin-top: 2px; }
.rpg-party-label { font-size: .6rem; color: #a08840; letter-spacing: .12em; margin-bottom: 8px; }
.rpg-party { display: flex; gap: 8px; flex-wrap: wrap; }
.rpg-party-member { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.rpg-party-avatar {
  width: 28px; height: 28px; border-radius: 6px;
  display: grid; place-items: center;
  font-weight: 900; font-size: .85rem;
  color: rgba(0,0,0,.6);
  border: 1px solid rgba(255,200,80,.2);
}
.rpg-party-name { font-size: .52rem; color: #c0a050; letter-spacing: .06em; }
.rpg-party-weight { font-size: .55rem; color: #80c030; }

/* Grove */
.grove-section {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.grove-grid {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.grove-tree {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  min-width: 70px;
}
.grove-dates { font-size: .62rem; color: var(--muted); font-weight: 700; text-align: center; }
.grove-peak { font-size: .6rem; color: #5a9048; font-weight: 800; }
.grove-days { font-size: .58rem; color: var(--muted); }

/* House view responsive */
@media (max-width: 900px) {
  .house-main-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .rpg-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .house-main-grid { grid-template-columns: 1fr !important; }
}

/* ── Inline new category form ── */
.new-cat-inline {
  background: var(--blue);
  border: 1px solid var(--blue2);
  border-radius: 14px;
  padding: 12px;
  margin: 4px 0 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.new-cat-inline input[type="text"],
.new-cat-inline input:not([type="hidden"]):not([type="checkbox"]) {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  background: var(--white);
  color: var(--ink);
  font: inherit;
  width: 100%;
}
.cat-color-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-left: 8px;
  vertical-align: middle;
  flex-shrink: 0;
  transition: background .15s;
}

/* ── Curated color swatch picker ── */
.color-swatch-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 7px;
  margin: 8px 0 4px;
}
.color-swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .12s, border-color .12s;
  outline: none;
  position: relative;
}
.color-swatch:hover { transform: scale(1.12); }
.color-swatch.selected {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink);
}
.color-swatch-label {
  font-size: .75rem;
  color: var(--muted);
  margin-bottom: 4px;
  font-weight: 700;
}
.color-preview-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.color-preview-chip {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.color-preview-hex {
  font-size: .82rem;
  color: var(--muted);
  font-family: monospace;
}

/* ── Daily backup banner ── */
.daily-backup-banner {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 10px 10px 18px;
  box-shadow: var(--shadow);
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .9rem;
  font-weight: 600;
  white-space: nowrap;
  animation: toast-in .25s ease;
}
.daily-backup-actions {
  display: flex;
  gap: 6px;
}

/* ── Misc ── */
.footer-note { color: var(--muted); font-size: .85rem; line-height: 1.4; }
.section-divider { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
