/* Clean Sweep — design system adapted from the Camp List app,
   re-themed around a fresh teal "clean home" palette. */

:root {
  --danger: #C94F2E;
  --accent: #0F766E;        /* teal */
  --accent-deep: #115E59;
  --accent-tint: rgba(15, 118, 110, 0.13);
  --ink: #16302C;           /* near-black green-tinted text */
  --paper: #FDFFFE;         /* card surface */
  --shell: #EEF3F1;         /* app background */
  --page: #E2E9E6;          /* page background behind the shell */
  --gold: #FBBF24;
  --overdue: #C94F2E;
  --soon: #B0891C;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--page);
  height: 100%;
}

body {
  min-height: 100dvh;
  font-family: -apple-system, system-ui, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-deep); }

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

button {
  touch-action: manipulation;
  font: inherit;
}

@keyframes csFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes csSheetUp { from { transform: translateY(48px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes csPop { 0% { transform: scale(0); } 100% { transform: scale(1); } }
@keyframes csTwinkle { 0%, 100% { opacity: 0.9; } 50% { opacity: 0.3; } }

/* ---- app shell ---- */
.app-shell {
  position: relative;
  height: 100dvh;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--shell);
  font-family: -apple-system, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.08);
}

.screen {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: calc(env(safe-area-inset-top) + 8px) 0 calc(env(safe-area-inset-bottom) + 120px);
}

/* ---- header ---- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px 14px;
}

.page-title {
  font-family: ui-rounded, -apple-system, system-ui, sans-serif;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 0.2px;
  line-height: 41px;
  color: var(--ink);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.add-btn {
  width: 38px;
  height: 38px;
  border-radius: 19px;
  background: var(--accent);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15, 118, 110, 0.35);
  padding: 0;
  transition: transform 0.1s;
}
.add-btn:active { transform: scale(0.92); }
.add-btn span {
  color: #fff;
  font-size: 26px;
  font-weight: 400;
  line-height: 1;
  margin-top: -2px;
}
.add-btn-neutral {
  background: rgba(118, 118, 128, 0.12);
  box-shadow: none;
}
.add-btn-neutral span {
  color: var(--ink);
  font-size: 20px;
  font-weight: 700;
  margin-top: -3px;
}

/* ---- hero card ---- */
.hero-card {
  margin: 0 16px 18px;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  background: linear-gradient(180deg, #123A44 0%, #135951 55%, #17705F 100%);
  padding: 16px 18px 18px;
  color: #fff;
  box-shadow: 0 4px 14px rgba(19, 78, 74, 0.22);
}
.hero-scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.hero-scene .twinkle { animation: csTwinkle 2.6s infinite; }
.hero-content { position: relative; z-index: 1; }
.hero-eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.65);
}
.hero-title {
  font-family: ui-rounded, -apple-system, system-ui, sans-serif;
  font-size: 27px;
  font-weight: 800;
  letter-spacing: 0.2px;
  margin-top: 2px;
}
.hero-sub {
  font-size: 14px;
  letter-spacing: -0.2px;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 1px;
}
.progress-track {
  margin-top: 22px;
  position: relative;
  height: 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.22);
}
.progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-radius: 4px;
  background: var(--gold);
  transition: width 0.45s cubic-bezier(0.34, 1.2, 0.64, 1);
  width: 0%;
}
.progress-broom {
  position: absolute;
  bottom: 1px;
  left: -13px;
  font-size: 19px;
  line-height: 1;
  transition: left 0.45s cubic-bezier(0.34, 1.2, 0.64, 1);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}
.progress-sparkle {
  position: absolute;
  bottom: 4px;
  right: -4px;
  font-size: 16px;
  line-height: 1;
}

/* ---- section / area cards ---- */
.card {
  margin: 0 16px 12px;
  background: var(--paper);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(22, 48, 44, 0.05);
}
.card-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 16px 11px 12px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.card-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}
.card-title {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--ink);
  min-width: 0;
}
.card-title-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}
.card-subtitle {
  font-size: 12px;
  letter-spacing: -0.1px;
  color: rgba(60, 60, 67, 0.55);
}
.count-pill {
  font-size: 13px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.chevron {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
  flex-shrink: 0;
}
.card-body {
  border-top: 0.5px solid rgba(60, 60, 67, 0.1);
}

/* ---- rows (swipeable: content slides to reveal Edit/Delete behind it) ---- */
.row {
  position: relative;
  overflow: hidden;
}
.row-actions {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 140px;
  display: flex;
  z-index: 0;
  visibility: hidden;
}
.row.row-reveal-actions .row-actions {
  visibility: visible;
}
.row-action {
  width: 70px;
  height: 100%;
  border: none;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.row-action-edit {
  background: rgba(118, 118, 128, 0.12);
  color: var(--ink);
}
.row-action-delete {
  background: var(--danger);
  color: #fff;
}
.row-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 16px;
  min-height: 50px;
  background: var(--paper);
  cursor: pointer;
  touch-action: pan-y;
  transition: transform 0.18s ease;
  will-change: transform;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.row-content:active { background: rgba(15, 118, 110, 0.06); }
.row-circle {
  width: 25px;
  height: 25px;
  border-radius: 13px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid rgba(60, 60, 67, 0.3);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  transition: background 0.15s, border 0.15s;
}
.row-circle.done {
  background: var(--accent);
  border-color: var(--accent);
}
.row-circle.overdue-mark {
  border-color: rgba(201, 79, 46, 0.55);
}
.row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.row-name {
  font-size: 16px;
  letter-spacing: -0.35px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-sub {
  font-size: 12px;
  letter-spacing: -0.1px;
  color: rgba(60, 60, 67, 0.55);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.due-pill {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
  padding: 3px 8px;
  border-radius: 20px;
  flex-shrink: 0;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.due-pill-overdue { color: var(--overdue); background: rgba(201, 79, 46, 0.13); }
.due-pill-today { color: var(--accent-deep); background: var(--accent-tint); }
.due-pill-soon { color: var(--soon); background: rgba(176, 137, 28, 0.14); }
.due-pill-upcoming { color: rgba(60, 60, 67, 0.55); background: rgba(118, 118, 128, 0.1); }
.due-pill-asneeded { color: #5A6B78; background: rgba(90, 107, 120, 0.13); }
.pop { animation: csPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }

/* ---- ghost add-row (last row of every area card) ---- */
.ghost-row {
  display: flex;
  align-items: center;
  padding: 0 16px;
  min-height: 46px;
  color: var(--accent);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.ghost-row:active { background: rgba(15, 118, 110, 0.06); }

/* ---- empty state ---- */
.all-done-card {
  margin: 0 16px 12px;
  background: var(--paper);
  border-radius: 16px;
  padding: 28px 20px;
  text-align: center;
  box-shadow: 0 1px 2px rgba(22, 48, 44, 0.05);
}
.all-done-emoji { font-size: 34px; margin-bottom: 6px; }
.all-done-title {
  font-family: ui-rounded, -apple-system, system-ui, sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}
.all-done-sub {
  font-size: 13px;
  color: rgba(60, 60, 67, 0.6);
  margin-top: 3px;
}

.footer-hint {
  padding: 6px 32px 0;
  font-size: 13px;
  text-align: center;
  color: rgba(60, 60, 67, 0.4);
  letter-spacing: -0.1px;
}

.areas-summary {
  padding: 0 20px 16px;
  font-size: 15px;
  letter-spacing: -0.2px;
  color: rgba(60, 60, 67, 0.6);
}

/* ---- tab bar ---- */
.tab-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  padding: 8px 0 max(30px, calc(env(safe-area-inset-bottom) + 12px));
  display: flex;
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  background: rgba(243, 248, 246, 0.85);
  border-top: 0.5px solid rgba(60, 60, 67, 0.14);
}
.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 0;
  cursor: pointer;
  border: none;
  background: none;
  color: rgba(60, 60, 67, 0.5);
}
.tab-item.active { color: var(--accent); }
.tab-item span {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06px;
  color: inherit;
}
.tab-icon-wrap { position: relative; }
.badge {
  position: absolute;
  top: -4px;
  right: -10px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}
.badge[hidden] {
  display: none;
}

/* ---- add / edit sheet ---- */
.sheet-scrim {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: rgba(18, 32, 28, 0.4);
  animation: csFadeIn 0.2s;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.sheet-scrim[hidden] {
  display: none;
}
.sheet {
  background: var(--shell);
  border-radius: 22px 22px 0 0;
  padding: 8px 20px calc(env(safe-area-inset-bottom) + 24px);
  animation: csSheetUp 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 82dvh;
  overflow-y: auto;
}
.sheet-handle {
  width: 36px;
  height: 5px;
  border-radius: 3px;
  background: rgba(60, 60, 67, 0.25);
  margin: 4px auto 14px;
}
.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.sheet-cancel { font-size: 17px; color: var(--accent); cursor: pointer; }
.sheet-title {
  font-family: ui-rounded, -apple-system, system-ui, sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}
.sheet-header-spacer {
  min-width: 40px;
}
.sheet-add { font-size: 17px; font-weight: 600; cursor: pointer; color: var(--accent); }
.sheet-add.disabled { color: rgba(60, 60, 67, 0.3); }
.sheet-input {
  width: 100%;
  border: none;
  outline: none;
  background: var(--paper);
  border-radius: 12px;
  padding: 13px 16px;
  font-size: 17px;
  font-family: -apple-system, system-ui, sans-serif;
  letter-spacing: -0.43px;
  color: var(--ink);
  margin-bottom: 20px;
}
.sheet-label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  color: rgba(60, 60, 67, 0.6);
  margin: 0 4px 8px;
}
.sheet-meta-row {
  font-size: 13px;
  color: rgba(60, 60, 67, 0.6);
  padding: 2px 4px 0;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.chip {
  padding: 8px 13px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.2px;
  cursor: pointer;
  background: rgba(118, 118, 128, 0.12);
  color: var(--ink);
  transition: background 0.15s;
  -webkit-user-select: none;
  user-select: none;
}
.chip-active { background: var(--accent); color: #fff; }
.sheet-delete-btn {
  width: 100%;
  margin-top: 12px;
  background: none;
  border: none;
  color: var(--danger);
  font-size: 16px;
  font-weight: 600;
  padding: 10px 0;
  cursor: pointer;
}

/* ---- overflow menu sheet ---- */
.menu-list {
  padding-bottom: 4px;
}
.menu-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 4px;
  cursor: pointer;
  border-bottom: 0.5px solid rgba(60, 60, 67, 0.1);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.menu-row:last-child { border-bottom: none; }
.menu-row:active { background: rgba(15, 118, 110, 0.06); }
.menu-row-emoji {
  font-size: 20px;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}
.menu-row-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.menu-row-label {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.2px;
}
.menu-row-sub {
  font-size: 13px;
  color: rgba(60, 60, 67, 0.6);
}

.menu-confirm {
  padding: 4px 4px 8px;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.menu-confirm-title {
  font-family: ui-rounded, -apple-system, system-ui, sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
}
.menu-confirm-body {
  font-size: 14px;
  color: rgba(60, 60, 67, 0.7);
  line-height: 1.4;
  margin-bottom: 20px;
}
.menu-danger-btn {
  width: 100%;
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  padding: 13px 0;
  cursor: pointer;
  margin-bottom: 10px;
}
.menu-confirm-cancel {
  display: block;
  text-align: center;
  font-size: 15px;
  color: var(--accent);
  padding: 8px 0;
  cursor: pointer;
}

/* restore-removed list rows */
.restore-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 4px;
  border-bottom: 0.5px solid rgba(60, 60, 67, 0.1);
}
.restore-row:last-child { border-bottom: none; }
.restore-row-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.restore-row-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.restore-row-sub { font-size: 12px; color: rgba(60, 60, 67, 0.55); }
.restore-btn {
  border: none;
  background: var(--accent-tint);
  color: var(--accent-deep);
  font-size: 13px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

/* ---- undo snackbar ---- */
.undo-toast {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(env(safe-area-inset-bottom) + 92px);
  z-index: 35;
  background: #16302C;
  color: #fff;
  border-radius: 14px;
  padding: 13px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  animation: csSheetUp 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}
.undo-toast[hidden] {
  display: none;
}
.undo-toast-text {
  font-size: 15px;
  letter-spacing: -0.2px;
}
.undo-toast-action {
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
  cursor: pointer;
  flex-shrink: 0;
}
