:root {
  --bg-1: #fff7f2;        /* warm cream */
  --bg-2: #f6f3fc;        /* soft lavender */
  --surface: #fffdfb;
  --surface-soft: #fbf7f4;
  --ink: #2a2433;
  --muted: #837b8c;
  --line: #efe7ef;
  --brand: #6d5bd0;
  --husband: #2f6df0;     /* 💙 blue  (Partner A) */
  --husband-soft: #6fa0fb;
  --wife: #ec4899;        /* 💗 pink  (Partner B) */
  --wife-soft: #f79ac9;
  --a: var(--husband);
  --b: var(--wife);
  --unassigned: #d9d2dd;
  --warn: #f59e0b;
  --danger: #e11d48;
  --good: #16a34a;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(60,40,80,.05), 0 10px 30px rgba(80,50,110,.07);
  --shadow-hover: 0 6px 16px rgba(60,40,80,.10), 0 18px 50px rgba(80,50,110,.14);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(900px 500px at 0% -5%, rgba(47,109,240,.10), transparent 55%),
    radial-gradient(900px 500px at 100% -5%, rgba(236,72,153,.10), transparent 55%),
    linear-gradient(180deg, var(--bg-1), var(--bg-2));
  background-attachment: fixed;
}

/* drifting color blobs for a lively, dynamic backdrop */
body::before, body::after {
  content: ""; position: fixed; z-index: -1; border-radius: 50%; filter: blur(60px); pointer-events: none;
}
body::before { width: 460px; height: 460px; top: -140px; left: -120px; background: radial-gradient(circle, rgba(47,109,240,.22), transparent 70%); animation: drift1 22s ease-in-out infinite; }
body::after  { width: 520px; height: 520px; bottom: -180px; right: -140px; background: radial-gradient(circle, rgba(236,72,153,.20), transparent 70%); animation: drift2 26s ease-in-out infinite; }
@keyframes drift1 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(80px,60px); } }
@keyframes drift2 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(-70px,-50px); } }

/* ---------- Animations ---------- */
@keyframes floatIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes popIn   { 0% { transform: scale(.8); opacity: 0; } 60% { transform: scale(1.06); } 100% { transform: scale(1); opacity: 1; } }
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
@keyframes heartbeat { 0%,100% { transform: scale(1); } 12% { transform: scale(1.18); } 24% { transform: scale(1); } 36% { transform: scale(1.12); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(20px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes wiggle { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 14px 24px;
  background: rgba(255,253,251,.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  font-size: 26px; width: 48px; height: 48px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--husband), var(--wife));
  border-radius: 14px; box-shadow: 0 6px 16px rgba(140,60,160,.28);
  cursor: pointer; transition: transform .2s ease;
}
.brand-mark:hover { animation: wiggle .5s ease; }
.brand h1 {
  font-size: 18px; margin: 0; font-weight: 800; letter-spacing: -.02em;
  background: linear-gradient(120deg, var(--husband), var(--wife));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.tagline { margin: 0; font-size: 12px; color: var(--muted); }

.topbar-right { display: flex; align-items: center; gap: 14px; }
.sync-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600; color: var(--muted);
  padding: 6px 12px; border-radius: 999px; background: #f1ecf5; border: 1px solid var(--line);
}
.sync-pill .sdot { width: 8px; height: 8px; border-radius: 50%; background: #b9b1c2; }
.sync-pill.synced { color: var(--good); background: #e9f9ee; border-color: #cdeed7; }
.sync-pill.synced .sdot { background: var(--good); box-shadow: 0 0 0 0 rgba(22,163,74,.5); animation: pulse 2s infinite; }
.sync-pill.connecting .sdot { background: var(--warn); animation: spin 1s linear infinite; border-radius: 2px; }
.sync-pill.error { color: var(--danger); background: #fff0f3; }
.sync-pill.error .sdot { background: var(--danger); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(22,163,74,.5); } 70% { box-shadow: 0 0 0 6px rgba(22,163,74,0); } 100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); } }

.tabs { display: flex; gap: 4px; background: #efe9f3; padding: 4px; border-radius: 12px; }
.tab {
  border: 0; background: transparent; padding: 8px 16px; border-radius: 9px;
  font: inherit; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer;
  transition: color .2s ease, transform .1s ease;
}
.tab:active { transform: scale(.95); }
.tab.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- Layout ---------- */
.container { max-width: 1080px; margin: 0 auto; padding: 24px; }
.view { display: none; }
.view.active { display: block; }
.view.active > * { animation: floatIn .5s ease both; }
.view.active > *:nth-child(2) { animation-delay: .04s; }
.view.active > *:nth-child(3) { animation-delay: .08s; }
.view.active > *:nth-child(4) { animation-delay: .12s; }
.view.active > *:nth-child(5) { animation-delay: .16s; }
.view.active > *:nth-child(6) { animation-delay: .20s; }
.view.active > *:nth-child(7) { animation-delay: .24s; }

.section-head { margin-bottom: 18px; }
.section-head h2 { margin: 0 0 2px; font-size: 26px; letter-spacing: -.02em; }
.section-head.row, .row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.muted { color: var(--muted); font-size: 14px; margin: 0; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow); margin-bottom: 18px;
  transition: transform .22s ease, box-shadow .22s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.card h3 { margin: 0 0 14px; font-size: 16px; }

/* ---------- Hero banner ---------- */
.hero {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 26px 28px; margin-bottom: 20px; border-radius: 20px; position: relative; overflow: hidden;
  color: #fff; box-shadow: 0 12px 34px rgba(120,60,170,.28);
  background: linear-gradient(120deg, #2f6df0 0%, #6d5bd0 45%, #ec4899 100%);
  background-size: 200% 200%; animation: heroShift 12s ease infinite;
}
@keyframes heroShift { 0%,100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 35%, rgba(255,255,255,.18) 50%, transparent 65%); transform: translateX(-100%); animation: shimmer 5s ease-in-out infinite; }
.hero-text h2 { margin: 0 0 4px; font-size: 26px; letter-spacing: -.02em; color: #fff; }
.hero-text p { margin: 0; font-size: 14px; color: rgba(255,255,255,.9); max-width: 540px; }
.hero-emoji { font-size: 64px; line-height: 1; filter: drop-shadow(0 6px 12px rgba(0,0,0,.2)); animation: bob 4s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-8px) rotate(3deg); } }

/* ---------- Colorful dashboard cards ---------- */
#view-dashboard > .card, #view-dashboard .two-col > .card {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, #ffffff, #fdfaff);
}
#view-dashboard > .card::before, #view-dashboard .two-col > .card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, #2f6df0, #6d5bd0, #ec4899, #f59e0b);
}
.fairness-card { background: linear-gradient(180deg, #fbfaff, #fdf5fa) !important; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.two-col > .card { margin-bottom: 0; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- Fairness ---------- */
.fairness-card { position: relative; overflow: hidden; }
.fairness-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.fairness-head h3 { margin: 0; }
.badge { font-size: 13px; font-weight: 700; padding: 6px 13px; border-radius: 999px; background: #f0ebf4; color: var(--muted); transition: all .3s ease; }
.badge.good { background: #dcfce7; color: var(--good); }
.badge.warn { background: #fef3c7; color: #b45309; }
.badge.bad  { background: #ffe4e6; color: var(--danger); }

.balance-bar { position: relative; display: flex; height: 46px; border-radius: 12px; overflow: hidden; background: var(--unassigned); box-shadow: inset 0 1px 3px rgba(0,0,0,.08); }
.balance-seg { display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 13px; transition: width .55s cubic-bezier(.34,1.3,.5,1); white-space: nowrap; overflow: hidden; position: relative; }
.balance-seg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%); transform: translateX(-100%); animation: shimmer 3.2s ease-in-out infinite; }
.seg-a { background: linear-gradient(135deg, var(--husband), var(--husband-soft)); }
.seg-b { background: linear-gradient(135deg, var(--wife), var(--wife-soft)); }
.balance-legend { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 14px; font-size: 13px; color: var(--muted); }
.balance-legend b { color: var(--ink); }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 4px; vertical-align: middle; }
.dot-a { background: var(--husband); } .dot-b { background: var(--wife); } .dot-unassigned { background: var(--unassigned); }

/* ---------- Coverage progress ---------- */
.coverage-head { display: flex; align-items: center; justify-content: space-between; font-weight: 800; font-size: 15px; margin-bottom: 10px; }
.coverage-head span:last-child { font-size: 22px; letter-spacing: -.02em; background: linear-gradient(120deg, var(--husband), var(--wife)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.coverage-track { height: 16px; background: #efe7f0; border-radius: 999px; overflow: hidden; box-shadow: inset 0 1px 3px rgba(0,0,0,.08); }
.coverage-fill { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #2f6df0, #6d5bd0, #ec4899); background-size: 200% 100%; animation: heroShift 6s ease infinite; transition: width .65s cubic-bezier(.34,1.3,.5,1); }
.coverage-sub { margin: 9px 0 0; font-size: 13px; color: var(--muted); font-weight: 600; }

/* ---------- Achievements ---------- */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 12px; }
.badge-chip {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 5px;
  padding: 16px 12px; border-radius: 14px; border: 1px solid var(--line); position: relative;
  transition: transform .2s ease, box-shadow .2s ease;
}
.badge-chip.earned {
  background: linear-gradient(160deg, rgba(47,109,240,.10), rgba(236,72,153,.12));
  border-color: transparent; box-shadow: 0 6px 16px rgba(120,60,170,.12); animation: popIn .4s ease;
}
.badge-chip.earned::after { content: ""; position: absolute; inset: 0; border-radius: 14px; padding: 1.5px; background: linear-gradient(135deg, var(--husband), var(--wife)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; }
.badge-chip.earned:hover { transform: translateY(-4px) scale(1.03); }
.badge-chip.locked { opacity: .55; filter: grayscale(.6); }
.badge-ic { font-size: 30px; line-height: 1; }
.badge-chip.earned .badge-ic { animation: heartbeat 2.5s ease-in-out infinite; }
.badge-tt { font-size: 13px; font-weight: 800; color: var(--ink); }
.badge-ds { font-size: 11px; color: var(--muted); line-height: 1.35; }
#badgeCount { color: var(--muted); font-size: 13px; font-weight: 700; background: #f0ebf4; padding: 2px 10px; border-radius: 999px; }

/* ---------- KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 18px; }
@media (max-width: 760px) { .kpi-grid { grid-template-columns: 1fr 1fr; } }
.kpi { display: flex; flex-direction: column; gap: 2px; margin-bottom: 0; position: relative; overflow: hidden; border: 0; color: #fff; }
.kpi.k-load      { background: linear-gradient(135deg, #6d5bd0, #9b7bf0); }
.kpi.k-time      { background: linear-gradient(135deg, #0ea5e9, #22d3ee); }
.kpi.k-invisible { background: linear-gradient(135deg, #d946ef, #ec4899); }
.kpi.k-unassigned{ background: linear-gradient(135deg, #f59e0b, #fb923c); }
.kpi-icon { position: absolute; right: -6px; top: -10px; font-size: 72px; opacity: .22; transform: rotate(-8deg); transition: transform .3s ease; pointer-events: none; }
.kpi:hover { transform: translateY(-5px) scale(1.015); box-shadow: 0 14px 34px rgba(80,50,110,.22); }
.kpi:hover .kpi-icon { transform: rotate(6deg) scale(1.12); }
.kpi-label { font-size: 11.5px; color: rgba(255,255,255,.92); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; z-index: 1; }
.kpi-value { font-size: 34px; font-weight: 800; letter-spacing: -.03em; color: #fff; z-index: 1; text-shadow: 0 2px 8px rgba(0,0,0,.12); }
.kpi-sub { font-size: 12px; color: rgba(255,255,255,.82); z-index: 1; }

/* ---------- Versus / avatars ---------- */
.versus { display: flex; align-items: center; justify-content: center; gap: 22px; margin: 4px 0 18px; }
.avatar-block { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; max-width: 180px; }
.avatar {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 32px;
  box-shadow: 0 6px 18px rgba(0,0,0,.14); transition: transform .3s ease;
}
.avatar-a { background: linear-gradient(135deg, var(--husband), var(--husband-soft)); animation: bob 4.5s ease-in-out infinite; }
.avatar-b { background: linear-gradient(135deg, var(--wife), var(--wife-soft)); animation: bob 4.5s ease-in-out infinite .6s; }
.avatar:hover { transform: translateY(-4px) scale(1.08); }
.avatar-name { font-size: 13px; font-weight: 700; color: var(--ink); }
.avatar-pct { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.avatar-block:nth-child(1) .avatar-pct { color: var(--husband); }
.avatar-block:nth-child(3) .avatar-pct { color: var(--wife); }
.vs { font-size: 13px; font-weight: 800; color: var(--muted); background: #f0ebf4; padding: 6px 12px; border-radius: 999px; }

/* ---------- Tables ---------- */
.mini-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.mini-table th, .mini-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.mini-table tr:last-child td { border-bottom: 0; }
.mini-table th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.mini-table td:not(:first-child), .mini-table th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.mini-table tbody tr { transition: background .15s ease; }
.mini-table tbody tr:hover { background: var(--surface-soft); }

.insights ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.insights li {
  font-size: 14px; line-height: 1.55; padding: 13px 14px 13px 42px; position: relative;
  background: linear-gradient(120deg, rgba(109,91,208,.07), rgba(236,72,153,.07));
  border: 1px solid var(--line); border-radius: 12px; border-left: 4px solid var(--brand);
  animation: floatIn .4s ease both;
}
.insights li:nth-child(2) { border-left-color: var(--husband); animation-delay: .06s; }
.insights li:nth-child(3) { border-left-color: var(--wife); animation-delay: .12s; }
.insights li:nth-child(4) { border-left-color: var(--warn); animation-delay: .18s; }
.insights li::before { content: "✨"; position: absolute; left: 14px; top: 12px; font-size: 16px; }

/* ---------- Inputs / buttons ---------- */
.input, select.input {
  font: inherit; font-size: 14px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 11px; background: #fff; color: var(--ink); width: 100%; transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(109,91,208,.18); }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-label { font-size: 13px; font-weight: 600; display: block; margin-bottom: 6px; }

.btn {
  font: inherit; font-weight: 600; font-size: 14px; padding: 10px 17px; border-radius: 11px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; transition: transform .1s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
}
.btn:hover { border-color: #d6ccdd; box-shadow: var(--shadow); }
.btn:active { transform: scale(.96); }
.btn-primary { background: linear-gradient(120deg, var(--husband), var(--brand)); border: 0; color: #fff; box-shadow: 0 6px 16px rgba(80,60,180,.28); }
.btn-primary:hover { filter: brightness(1.05); box-shadow: 0 8px 22px rgba(80,60,180,.34); }
.btn-danger { color: var(--danger); border-color: #f3c4cd; }
.btn-danger:hover { background: #fff1f3; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Filters ---------- */
.filters { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 12px; margin-bottom: 18px; }
@media (max-width: 760px) { .filters { grid-template-columns: 1fr 1fr; } }

/* ---------- Task list ---------- */
.task-cat {
  --cat: #888;
  margin-bottom: 16px; padding: 8px 12px 12px; border-radius: 18px;
  background: color-mix(in srgb, var(--cat) 7%, #fff);
  border: 1px solid color-mix(in srgb, var(--cat) 16%, #fff);
}
.task-cat-head {
  display: flex; align-items: center; gap: 11px; margin-bottom: 10px;
  padding: 8px 14px 8px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--cat) 14%, #fff);
  border: 1px solid color-mix(in srgb, var(--cat) 22%, #fff);
}
.task-cat-head .cat-emoji {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 18px;
  background: #fff; box-shadow: 0 2px 6px color-mix(in srgb, var(--cat) 35%, transparent);
}
.task-cat-head h3 { margin: 0; font-size: 15px; font-weight: 800; color: color-mix(in srgb, var(--cat) 72%, #1c1322); }
.task-cat-head .count { color: #fff; font-size: 12px; font-weight: 800; background: var(--cat); padding: 2px 10px; border-radius: 999px; }
.task-cat-head .cat-load { margin-left: auto; font-size: 12px; font-weight: 600; color: color-mix(in srgb, var(--cat) 55%, #555); font-variant-numeric: tabular-nums; }
.task-cat .task-row { background: #fff; }
.task-cat .task-row.owned-unassigned { border-left: 4px solid color-mix(in srgb, var(--cat) 45%, #fff); }

.task-row {
  display: flex; align-items: center; gap: 12px; padding: 13px 15px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 13px; margin-bottom: 8px;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  animation: floatIn .35s ease both;
}
.task-row:hover { transform: translateX(3px); box-shadow: var(--shadow); border-color: #e3d8e6; }
.task-row.owned-A { border-left: 4px solid var(--husband); }
.task-row.owned-B { border-left: 4px solid var(--wife); }
.task-row.owned-both { border-left: 4px solid transparent; border-image: linear-gradient(var(--husband), var(--wife)) 1; }
.task-main { flex: 1; min-width: 0; }
.task-name { font-weight: 600; font-size: 14px; }
.task-meta { font-size: 12px; color: var(--muted); margin-top: 3px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.pill { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: #f0ebf4; color: var(--muted); }
.pill.invisible { background: #efe7fb; color: #6d28d9; }
.task-load { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 13px; min-width: 64px; text-align: right; }

/* segmented owner control */
.seg-control { display: inline-flex; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; background: #fff; }
.seg-control button {
  font: inherit; font-size: 12px; font-weight: 600; padding: 8px 11px; border: 0;
  background: #fff; color: var(--muted); cursor: pointer; border-right: 1px solid var(--line);
  transition: background .15s ease, color .15s ease, transform .1s ease;
}
.seg-control button:last-child { border-right: 0; }
.seg-control button:active { transform: scale(.92); }
.seg-control button.on { animation: popIn .3s ease; }
.seg-control button.on[data-owner="A"] { background: linear-gradient(135deg, var(--husband), var(--husband-soft)); color: #fff; }
.seg-control button.on[data-owner="B"] { background: linear-gradient(135deg, var(--wife), var(--wife-soft)); color: #fff; }
.seg-control button.on[data-owner="both"] { background: linear-gradient(120deg, var(--husband), var(--wife)); color: #fff; }
.seg-control button.on[data-owner="unassigned"] { background: #9aa0ad; color: #fff; }
.task-row .seg-control button { padding: 7px 10px; }

.edit-link { color: var(--brand); font-size: 12px; font-weight: 700; cursor: pointer; background: none; border: 0; transition: opacity .15s; }
.edit-link:hover { opacity: .7; }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(40,30,60,.45); display: grid; place-items: center; z-index: 50; padding: 16px; animation: floatIn .2s ease; backdrop-filter: blur(3px); }
.modal { background: #fff; border-radius: 18px; width: 100%; max-width: 480px; box-shadow: 0 24px 70px rgba(0,0,0,.3); animation: popIn .3s ease; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 22px; display: flex; flex-direction: column; gap: 14px; max-height: 70vh; overflow: auto; }
.modal-foot { display: flex; align-items: center; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line); }
.modal-foot .spacer { flex: 1; }
.icon-btn { border: 0; background: none; font-size: 18px; cursor: pointer; color: var(--muted); transition: transform .15s; }
.icon-btn:hover { transform: rotate(90deg); }
.assign-block .seg-control { display: flex; flex-wrap: wrap; }

/* ---------- Toasts ---------- */
.toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast {
  background: #2a2433; color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,.25); animation: toastIn .3s ease; display: flex; align-items: center; gap: 9px;
}
.toast.success { background: linear-gradient(120deg, #16a34a, #22c55e); }
.toast.sync { background: linear-gradient(120deg, var(--husband), var(--wife)); }
.toast.error { background: linear-gradient(120deg, #e11d48, #f43f5e); }

/* confetti canvas */
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 90; }

/* ---------- Done button ---------- */
.done-btn {
  font: inherit; font-size: 12px; font-weight: 700; padding: 7px 11px; border-radius: 10px;
  border: 1px solid #cdeed7; background: #eafaf0; color: #16a34a; cursor: pointer; white-space: nowrap;
  transition: transform .1s ease, background .15s ease, color .15s ease, border-color .15s ease;
}
.done-btn:hover { background: #16a34a; color: #fff; border-color: #16a34a; }
.done-btn:active { transform: scale(.9); }
.done-btn.did { background: #16a34a; color: #fff; border-color: #16a34a; animation: popIn .3s ease; }

/* ---------- View toggle ---------- */
.view-toggle-row { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.view-toggle button { padding: 9px 16px; font-size: 13px; }
.view-toggle button.on { background: linear-gradient(120deg, var(--husband), var(--wife)); color: #fff; }
.view-hint { font-size: 12.5px; color: var(--muted); font-weight: 600; }

/* ---------- "I am" identity toggle (topbar) ---------- */
.topbar-right { flex-wrap: wrap; }
.me-toggle button { padding: 6px 10px; font-size: 12px; display: inline-flex; align-items: center; gap: 4px; }
.me-toggle button.on[data-me="A"] { background: linear-gradient(135deg, var(--husband), var(--husband-soft)); color: #fff; }
.me-toggle button.on[data-me="B"] { background: linear-gradient(135deg, var(--wife), var(--wife-soft)); color: #fff; }

/* ---------- This week card ---------- */
.thisweek-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.thisweek-head h3 { margin: 0; }
.balance-bar.mini { height: 30px; }
.thisweek-tip { margin-top: 12px; }

/* ---------- Identity modal ---------- */
.modal-sm { max-width: 400px; }
.me-choice { display: flex; gap: 14px; margin-top: 6px; }
.me-big {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 22px 10px;
  font-size: 40px; border-radius: 16px; border: 2px solid var(--line); background: #fff; cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease;
}
.me-big span { font-size: 15px; font-weight: 800; color: var(--ink); }
.me-big-a:hover { border-color: var(--husband); box-shadow: 0 8px 20px rgba(47,109,240,.25); transform: translateY(-3px); }
.me-big-b:hover { border-color: var(--wife); box-shadow: 0 8px 20px rgba(236,72,153,.25); transform: translateY(-3px); }

/* ---------- Weekly recap ---------- */
.recap-hero { text-align: center; margin-bottom: 16px; }
.recap-num { font-size: 48px; font-weight: 800; line-height: 1; background: linear-gradient(120deg, var(--husband), var(--wife)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.recap-hero div:last-child { color: var(--muted); font-size: 13px; font-weight: 600; }
.recap-verdict { margin: 16px 0 0; padding: 12px 14px; border-radius: 12px; font-size: 14px; font-weight: 600; text-align: center; }
.recap-verdict.good { background: #dcfce7; color: #15803d; }
.recap-verdict.warn { background: #fef3c7; color: #b45309; }
.recap-verdict.bad { background: #ffe4e6; color: #be123c; }

.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 26px; }
.footer .heart { color: var(--wife); }
