/* style.css — Home Hub */

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

:root {
  --cream: #f5f0e8;
  --cream-dark: #ede6d6;
  --ink: #2a2318;
  --ink-light: #6b6050;
  --ink-faint: #a8998a;
  --white: #fdfaf5;
  --border: #ddd5c4;
  --shadow: 0 2px 12px rgba(42,35,24,0.08);
  --shadow-lg: 0 8px 32px rgba(42,35,24,0.14);
  --radius: 12px;
  --sidebar-w: 240px;
  --green: #6b8f5e;
  --blue: #7b9bc2;
  --gold: #c2a05a;
  --orange: #b07b5c;
  --purple: #8b6daa;
  --red: #c25a5a;
}

html[data-theme="dark"] {
  --cream: #1c1814;
  --cream-dark: #272219;
  --ink: #f0e8d8;
  --ink-light: #c0b09a;
  --ink-faint: #6e6358;
  --white: #242018;
  --border: #3d3630;
  --shadow: 0 2px 12px rgba(0,0,0,0.35);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
}

html[data-theme="dark"] .modal-overlay {
  background: rgba(0,0,0,0.65);
}

html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--cream);
  color: var(--ink);
  line-height: 1.5;
}

/* ── Layout ── */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-header {
  padding: 28px 20px 20px;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.logo-icon {
  font-size: 22px;
  line-height: 1;
}

.logo-text {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.3px;
}

.sidebar-sub {
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-weight: 500;
}

.sidebar-nav {
  padding: 12px 10px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: none;
  color: var(--ink-light);
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  font-weight: 400;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
  text-align: left;
  position: relative;
}

.nav-item:hover { background: var(--cream); color: var(--ink); }
.nav-item.active { background: var(--cream-dark); color: var(--ink); font-weight: 500; }

.nav-icon { font-size: 13px; opacity: 0.7; }
.nav-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.nav-divider {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 14px 10px 4px;
}

.nav-badge {
  margin-left: auto;
  background: var(--cream-dark);
  color: var(--ink-light);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 20px;
  min-width: 20px;
  text-align: center;
}

.nav-item.active .nav-badge { background: var(--border); }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.user-row select {
  width: 100%;
  padding: 8px 28px 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--cream);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  cursor: pointer;
  transition: border 0.15s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23a8998a'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.user-row select:focus { border-color: var(--gold); }
.user-row select.select-required {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) 30%, transparent);
  animation: select-pulse 0.4s ease;
}
@keyframes select-pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.03); }
}

.setup-note {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-faint);
}
.setup-note a { color: var(--blue); text-decoration: none; }
.setup-note a:hover { text-decoration: underline; }

/* ── Main ── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--cream);
}

.main-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 28px 32px 16px;
  flex-shrink: 0;
}

.header-left h1 {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.4px;
  line-height: 1.2;
}

.view-sub {
  font-size: 13px;
  color: var(--ink-faint);
  margin-top: 3px;
}

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

/* Progress ring */
.progress-ring-wrap {
  position: relative;
  width: 52px;
  height: 52px;
  cursor: default;
}

.progress-ring { transform: rotate(-90deg); }

.progress-ring-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 3;
}

.progress-ring-fill {
  fill: none;
  stroke: var(--green);
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s ease;
}

.progress-pct {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-light);
}

.conn-status {
  font-size: 16px;
  color: var(--ink-faint);
  cursor: default;
}

/* Search row */
.search-row {
  display: flex;
  gap: 10px;
  padding: 0 32px 16px;
  flex-shrink: 0;
}

.search-input, .area-filter {
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  color: var(--ink);
  outline: none;
  transition: border 0.15s;
}
.search-input { flex: 1; }
.search-input:focus, .area-filter:focus { border-color: var(--gold); }
.search-input::placeholder { color: var(--ink-faint); }

/* Task list */
.task-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 32px 32px;
}

.freq-group-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 18px 0 8px;
}

/* Task card */
.task-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.1s, opacity 0.2s;
  user-select: none;
}

.task-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.task-card.done { opacity: 0.55; }
.task-card.overdue { border-left: 3px solid var(--red); }

/* Check button */
.check-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}

.check-btn:hover { border-color: var(--green); }
.check-btn.checked { background: var(--green); border-color: var(--green); }

.task-card-body { flex: 1; min-width: 0; }
.task-card-title {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-card.done .task-card-title { text-decoration: line-through; color: var(--ink-faint); }

.task-card-meta {
  display: flex;
  gap: 12px;
  margin-top: 3px;
  font-size: 12px;
  color: var(--ink-faint);
}

.task-area {
  background: var(--cream-dark);
  color: var(--ink-light);
  padding: 1px 7px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}

.task-last.never { color: var(--red); font-style: italic; }

.task-card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.freq-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}

.overdue-tag {
  font-size: 10px;
  font-weight: 600;
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Assignee chip on task card */
.assignee-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  position: relative;
}
.assignee-pin-mark {
  position: absolute;
  bottom: -3px;
  right: -3px;
  font-size: 8px;
  line-height: 1;
  color: #fff;
  background: rgba(0,0,0,0.45);
  border-radius: 50%;
  width: 11px;
  height: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* My Tasks toggle */
.mytasks-row {
  padding: 4px 0 12px;
}

.mytasks-toggle {
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--white);
  font-family: 'DM Sans', sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-light);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.mytasks-toggle:hover { background: var(--cream-dark); color: var(--ink); }
.mytasks-toggle.active {
  background: var(--ink);
  color: var(--cream);
  border-color: var(--ink);
}

/* Empty / loading */
.loading-state, .empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 0;
  color: var(--ink-faint);
}

.empty-icon { font-size: 36px; opacity: 0.4; }
.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(42,35,24,0.4);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--white);
  border-radius: 18px;
  padding: 32px;
  max-width: 520px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  position: relative;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.2s, transform 0.2s;
}

.modal.open { opacity: 1; transform: translateY(0); }

.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 28px; height: 28px;
  border: none;
  background: var(--cream-dark);
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  color: var(--ink-light);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.modal-close:hover { background: var(--border); }

.modal-freq-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 10px;
}

.modal-title {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.3px;
  line-height: 1.25;
  margin-bottom: 6px;
}

.modal-area {
  font-size: 13px;
  color: var(--ink-faint);
  margin-bottom: 20px;
}

.modal-section {
  margin-bottom: 20px;
}

.modal-section h3 {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 8px;
}

.modal-instructions p, .modal-supplies p {
  font-size: 14px;
  color: var(--ink-light);
  line-height: 1.65;
  margin-bottom: 6px;
}
.modal-instructions p:last-child, .modal-supplies p:last-child { margin-bottom: 0; }

.modal-supplies {
  background: var(--cream);
  border-radius: 8px;
  padding: 12px 14px;
  border: 1px solid var(--border);
}

/* Modal assignment section */
.modal-assignee-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.assignee-chip-lg {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
}

.modal-pin-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  opacity: 0.75;
  vertical-align: middle;
}

.pin-assignment-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--ink-light);
  cursor: pointer;
  user-select: none;
}
.pin-assignment-label input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--ink);
  flex-shrink: 0;
}

.reassign-btn {
  font-size: 12px;
  font-weight: 500;
  color: var(--blue);
  background: none;
  border: 1px solid var(--blue);
  border-radius: 20px;
  padding: 3px 12px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: background 0.15s, color 0.15s;
}
.reassign-btn:hover { background: var(--blue); color: white; }

.reassign-picker {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
}

.reassign-select {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--cream);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--ink);
  outline: none;
}
.reassign-select:focus { border-color: var(--gold); }

.reassign-save-btn {
  padding: 7px 16px;
  background: var(--ink);
  color: var(--cream);
  border: none;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.reassign-save-btn:hover { background: #3d3226; }

.modal-meta {
  display: flex;
  gap: 20px;
  margin: 20px 0;
  padding: 14px 16px;
  background: var(--cream);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.meta-item { flex: 1; }
.meta-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--ink-faint);
  display: block;
  margin-bottom: 2px;
}
.meta-val { font-size: 13px; font-weight: 500; color: var(--ink); }

.modal-complete-btn {
  width: 100%;
  padding: 13px;
  background: var(--ink);
  color: var(--cream);
  border: none;
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  letter-spacing: 0.2px;
}
.modal-complete-btn:hover:not(:disabled) { background: #3d3226; }
.modal-complete-btn:disabled { opacity: 0.55; cursor: default; }
.modal-complete-btn.completed { background: var(--green); }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: var(--cream);
  padding: 10px 20px;
  border-radius: 30px;
  font-size: 13.5px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 200;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--red); }

/* ── Undo button style in modal ── */
.modal-complete-btn.undo-btn {
  background: var(--cream-dark);
  color: var(--ink);
  border: 1px solid var(--border);
}
.modal-complete-btn.undo-btn:hover { background: var(--border); }

/* ── Grocery List ── */
.grocery-add-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  align-items: center;
}

.grocery-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border 0.15s;
}
.grocery-input:focus { border-color: var(--gold); }
.grocery-input::placeholder { color: var(--ink-faint); }

.grocery-cat-select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  cursor: pointer;
  flex-shrink: 0;
}

.grocery-add-btn {
  padding: 10px 18px;
  background: var(--ink);
  color: var(--cream);
  border: none;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.grocery-add-btn:hover { background: #3d3226; }

.grocery-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 6px;
  transition: opacity 0.2s;
}
.grocery-item.checked { opacity: 0.5; }

.grocery-check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: none;
  cursor: pointer;
  font-size: 12px;
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}
.grocery-check:hover { border-color: var(--green); }
.grocery-item.checked .grocery-check { background: var(--green); border-color: var(--green); }

.grocery-name {
  flex: 1;
  font-size: 14.5px;
  font-weight: 400;
  color: var(--ink);
}
.grocery-item.checked .grocery-name { text-decoration: line-through; color: var(--ink-faint); }

.grocery-meta {
  font-size: 11px;
  color: var(--ink-faint);
  flex-shrink: 0;
}

.grocery-delete {
  width: 22px;
  height: 22px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 11px;
  color: var(--ink-faint);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.grocery-delete:hover { background: var(--cream-dark); color: var(--red); }

.grocery-edit {
  width: 22px;
  height: 22px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-faint);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.grocery-edit:hover { background: var(--cream-dark); color: var(--ink); }
.grocery-edit.grocery-edit-save { color: var(--green); font-size: 15px; }
.grocery-edit.grocery-edit-save:hover { background: var(--cream-dark); color: var(--green); }

.grocery-item.editing .grocery-check,
.grocery-item.editing .grocery-delete { display: none; }

.grocery-edit-input {
  flex: 1;
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 4px 8px;
  font-size: 14.5px;
  font-family: 'DM Sans', sans-serif;
  color: var(--ink);
  background: var(--cream);
  min-width: 0;
}
.grocery-edit-input:focus { outline: none; border-color: var(--gold); }

.grocery-edit-cat {
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  color: var(--ink);
  background: var(--cream);
  flex-shrink: 0;
}

.grocery-checked-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 8px;
}

.grocery-clear-btn {
  font-size: 12px;
  font-weight: 500;
  color: var(--red);
  background: none;
  border: 1px solid var(--red);
  border-radius: 20px;
  padding: 3px 12px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: background 0.15s, color 0.15s;
}
.grocery-clear-btn:hover { background: var(--red); color: white; }

/* ── Dark mode toggle ── */
.dark-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 7px;
  margin-top: 8px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-faint);
  font-family: 'DM Sans', sans-serif;
  transition: background 0.15s, color 0.15s;
}
.dark-toggle:hover { background: var(--cream-dark); color: var(--ink); }

/* ── Snooze ── */
.modal-snooze-section {
  margin-bottom: 16px;
}

.modal-snooze-btns {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.modal-snooze-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.snooze-btn {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: none;
  color: var(--ink-light);
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.snooze-btn:hover { background: var(--cream-dark); color: var(--ink); border-color: var(--ink-faint); }

.modal-snooze-active {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--cream-dark);
  border-radius: 8px;
  margin-bottom: 8px;
}

.modal-snooze-status {
  flex: 1;
  font-size: 13px;
  color: var(--ink-light);
}

.snooze-cancel-btn {
  font-size: 12px;
  color: var(--red);
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  padding: 0;
}
.snooze-cancel-btn:hover { text-decoration: underline; }

.snooze-badge {
  font-size: 13px;
  opacity: 0.7;
}

/* ── Household Settings ── */
.household-section {
  padding-top: 8px;
}

.household-section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 10px 0 10px;
}

.members-list {
  margin-bottom: 20px;
}

.member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 6px;
  cursor: default;
  transition: box-shadow 0.15s, opacity 0.15s;
  user-select: none;
}
.member-row.dragging { opacity: 0.4; }
.member-row.drag-over { box-shadow: 0 0 0 2px var(--gold); }

.drag-handle {
  font-size: 16px;
  color: var(--ink-faint);
  cursor: grab;
  flex-shrink: 0;
  line-height: 1;
}
.drag-handle:active { cursor: grabbing; }

.member-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.member-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}

.member-color-input {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  background: none;
  flex-shrink: 0;
  overflow: hidden;
}
.member-color-input::-webkit-color-swatch-wrapper { padding: 0; }
.member-color-input::-webkit-color-swatch { border: none; border-radius: 50%; }
.member-color-input::-moz-color-swatch { border: none; border-radius: 50%; }

.member-remove-btn {
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 11px;
  color: var(--ink-faint);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.member-remove-btn:hover { background: var(--cream-dark); color: var(--red); }

.household-add-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}

.household-name-input {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  color: var(--ink);
  outline: none;
  transition: border 0.15s;
}
.household-name-input:focus { border-color: var(--gold); }
.household-name-input::placeholder { color: var(--ink-faint); }

.household-color-input {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
  cursor: pointer;
  background: var(--white);
  flex-shrink: 0;
}

.household-add-btn {
  padding: 9px 16px;
  background: var(--ink);
  color: var(--cream);
  border: none;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
  flex-shrink: 0;
}
.household-add-btn:hover { background: #3d3226; }

.household-actions {
  padding-top: 4px;
}

.reshuffle-btn {
  padding: 8px 18px;
  background: none;
  color: var(--ink-light);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.reshuffle-btn:hover { background: var(--cream-dark); color: var(--ink); border-color: var(--ink-faint); }

/* ── To-Do View ── */

.todo-add-form {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 20px;
}

.todo-add-main-row {
  display: flex;
  gap: 8px;
}

.todo-title-input {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--cream);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border 0.15s;
}
.todo-title-input:focus { border-color: var(--gold); }
.todo-title-input::placeholder { color: var(--ink-faint); }

.todo-add-btn {
  padding: 9px 18px;
  background: var(--ink);
  color: var(--cream);
  border: none;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.todo-add-btn:hover { background: #3d3226; }

.todo-extras-toggle {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-faint);
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  padding: 0;
  transition: color 0.15s;
}
.todo-extras-toggle:hover { color: var(--ink-light); }

.todo-add-extras {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.todo-notes-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--cream);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  resize: vertical;
  transition: border 0.15s;
}
.todo-notes-input:focus { border-color: var(--gold); }
.todo-notes-input::placeholder { color: var(--ink-faint); }

.todo-extras-row {
  display: flex;
  gap: 8px;
}

.todo-field-input {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--cream);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  transition: border 0.15s;
}
.todo-field-input:focus { border-color: var(--gold); }

.todo-field-select {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--cream);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  cursor: pointer;
  transition: border 0.15s;
}
.todo-field-select:focus { border-color: var(--gold); }

/* Todo card extras */
.todo-notes-preview {
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 4px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.todo-delete-btn {
  width: 22px;
  height: 22px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 11px;
  color: var(--ink-faint);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.todo-delete-btn:hover { background: var(--cream-dark); color: var(--red); }

.todo-edit-form {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.todo-edit-actions {
  display: flex;
  gap: 8px;
}

.todo-save-btn {
  padding: 6px 16px;
  background: var(--ink);
  color: var(--cream);
  border: none;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.todo-save-btn:hover { background: #3d3226; }

.todo-cancel-btn {
  padding: 6px 14px;
  background: none;
  color: var(--ink-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.todo-cancel-btn:hover { background: var(--cream-dark); }

/* ── House Notes ── */

.notes-add-form {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.notes-add-row {
  display: flex;
  gap: 8px;
}

.notes-title-input {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--cream);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border 0.15s;
}
.notes-title-input:focus { border-color: var(--gold); }
.notes-title-input::placeholder { color: var(--ink-faint); }

.notes-cat-select {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--cream);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: border 0.15s;
}
.notes-cat-select:focus { border-color: var(--gold); }

.notes-add-btn {
  padding: 9px 18px;
  background: var(--ink);
  color: var(--cream);
  border: none;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.notes-add-btn:hover { background: #3d3226; }

.notes-content-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--cream);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  resize: vertical;
  transition: border 0.15s;
}
.notes-content-input:focus { border-color: var(--gold); }
.notes-content-input::placeholder { color: var(--ink-faint); }

.notes-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  margin-bottom: 8px;
}

.note-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: box-shadow 0.15s;
}
.note-card:hover { box-shadow: var(--shadow); }

.note-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.note-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}

.note-card-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s;
}
.note-card:hover .note-card-actions { opacity: 1; }

.note-edit-btn,
.note-delete-btn {
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 12px;
  color: var(--ink-faint);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.note-edit-btn:hover   { background: var(--cream-dark); color: var(--blue); }
.note-delete-btn:hover { background: var(--cream-dark); color: var(--red); }

.note-card-content {
  font-size: 13.5px;
  color: var(--ink-light);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.note-card-meta {
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 2px;
}

.note-edit-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.note-edit-actions {
  display: flex;
  gap: 8px;
}

.note-save-btn {
  padding: 6px 16px;
  background: var(--ink);
  color: var(--cream);
  border: none;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.note-save-btn:hover { background: #3d3226; }

.note-cancel-btn {
  padding: 6px 14px;
  background: none;
  color: var(--ink-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.note-cancel-btn:hover { background: var(--cream-dark); }

/* ── Update Banner ── */
.update-banner {
  position: fixed;
  top: -64px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--cream);
  padding: 10px 10px 10px 18px;
  border-radius: 30px;
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 300;
  box-shadow: var(--shadow-lg);
  transition: top 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  white-space: nowrap;
}
.update-banner.show { top: 16px; }

.update-refresh-btn {
  padding: 6px 16px;
  background: var(--cream);
  color: var(--ink);
  border: none;
  border-radius: 20px;
  font-family: 'DM Sans', sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}
.update-refresh-btn:hover { background: var(--cream-dark); }

/* ── Mobile Nav Bar ── */
.mobile-nav {
  display: none;
}

.mobile-nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: none;
  background: none;
  color: var(--ink-faint);
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  padding: 6px 0;
  position: relative;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.mobile-nav-btn.active { color: var(--ink); }

.mobile-nav-icon { font-size: 18px; line-height: 1; }
.mobile-nav-label { font-size: 10px; font-weight: 500; letter-spacing: 0.2px; }

.mobile-nav-badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 20px);
  min-width: 16px;
  height: 16px;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}
.mobile-nav-badge:empty { display: none; }

/* ── Mobile More Drawer ── */
.mobile-drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(42, 35, 24, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.mobile-drawer-overlay.open { opacity: 1; pointer-events: all; }

.mobile-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 90;
  background: var(--white);
  border-radius: 16px 16px 0 0;
  box-shadow: var(--shadow-lg);
  padding: 8px 0 calc(12px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
.mobile-drawer.open { transform: translateY(0); }

.mobile-drawer-handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 4px auto 12px;
}

.mobile-drawer-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 52px;
  padding: 0 24px;
  border: none;
  background: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 400;
  color: var(--ink-light);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.mobile-drawer-item:active { background: var(--cream); color: var(--ink); }

.mobile-drawer-divider {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 12px 24px 4px;
}

.mobile-drawer-user {
  padding: 4px 16px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.mobile-drawer-user select {
  width: 100%;
  padding: 10px 32px 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--cream);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23a8998a'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-color: var(--cream);
}

/* ── Responsive ── */
@media (max-width: 700px) {
  .sidebar { display: none; }

  /* Bottom nav */
  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(60px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--white);
    border-top: 1px solid var(--border);
    z-index: 50;
    align-items: stretch;
  }

  /* Push content above the nav bar */
  .main { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
  .task-list { padding: 0 16px calc(84px + env(safe-area-inset-bottom)); }

  /* Compact header */
  .main-header { padding: 14px 16px 10px; align-items: center; }
  .header-left h1 { font-size: 20px; }
  .view-sub { display: none; }
  .progress-ring-wrap { transform: scale(0.77); transform-origin: center; }

  /* Search row */
  .search-row { padding: 0 16px 12px; flex-wrap: wrap; }
  .area-filter { width: 100%; }

  /* Grocery add form */
  .grocery-add-row { flex-wrap: wrap; }
  .grocery-input { width: 100%; }
  .grocery-cat-select { flex: 1; }

  /* Notes add form */
  .notes-add-row { flex-wrap: wrap; }
  .notes-title-input { width: 100%; }
  .notes-cat-select { flex: 1; }

  /* Note card actions always visible (no hover on touch) */
  .note-card-actions { opacity: 1; }

  /* Touch targets — minimum 44px */
  .check-btn { min-width: 44px; min-height: 44px; }
  .grocery-check { min-width: 44px; min-height: 44px; }
  .grocery-edit { min-width: 44px; min-height: 44px; }
  .todo-delete-btn,
  .note-edit-btn,
  .note-delete-btn,
  .member-remove-btn,
  .member-color-input { min-width: 44px; min-height: 44px; }

  /* Modal as bottom sheet */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal {
    border-radius: 18px 18px 0 0;
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    padding: 24px 18px calc(24px + env(safe-area-inset-bottom));
  }
  .modal-meta { flex-direction: column; gap: 10px; }

  /* Toast sits above bottom nav */
  .toast { bottom: calc(72px + env(safe-area-inset-bottom)); }

  /* Note card grid: single column */
  .notes-group { grid-template-columns: 1fr; }
}
