/* TrashDuty — sleek minimal design system */
:root {
  --brand: #15a34a;
  --brand-2: #0ea582;
  --grad: linear-gradient(150deg, #1bb35a 0%, #0ea582 100%);
  --ink: #11201a;
  --ink-2: #4a5b53;
  --muted: #8a988f;
  --bg: #fafbfa;
  --surface: #ffffff;
  --surface-2: #f3f6f4;
  --line: #ebefec;
  --danger: #e23b54;
  --warn: #d98309;
  --r: 22px;
  --r-sm: 14px;
  --pill: 999px;
  --sh: 0 1px 2px rgba(17,32,26,.04), 0 10px 30px -14px rgba(17,32,26,.18);
  --sh-brand: 0 12px 34px -10px rgba(21,163,74,.5);
  --ease: cubic-bezier(.22,.7,.3,1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", sans-serif;
  color: var(--ink);
  line-height: 1.45;
  background: radial-gradient(120% 60% at 50% -10%, rgba(21,163,74,.10), transparent 60%), var(--bg);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}
#app { max-width: 460px; margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) 20px calc(36px + env(safe-area-inset-bottom)); min-height: 100%; }

.screen { display: flex; flex-direction: column; gap: 14px; animation: screenin .4s var(--ease) both; }
@keyframes screenin { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.grow { flex: 1; }

/* Brand */
.brand { text-align: center; margin: 34px 0 10px; }
.brand-logo { width: 72px; height: 72px; margin: 0 auto 16px; border-radius: 24px; display: grid; place-items: center; font-size: 38px; background: var(--grad); box-shadow: var(--sh-brand); animation: pop .5s var(--ease) both; }
.brand h1 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -0.03em; }
.brand .muted { font-size: 15px; margin: 6px 0 0; }
@keyframes pop { 0% { transform: scale(.7); opacity: 0; } 60% { transform: scale(1.06); } 100% { transform: scale(1); opacity: 1; } }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: flex; flex-direction: column; gap: 13px; box-shadow: var(--sh); }
h2 { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; margin: 4px 0 0; }
h3 { margin: 0; font-size: 14px; font-weight: 700; color: var(--ink-2); letter-spacing: 0; }

/* Forms */
label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
input, select, textarea {
  width: 100%; background: var(--surface-2); border: 1.5px solid transparent; color: var(--ink);
  border-radius: var(--r-sm); padding: 14px; font-size: 16px; font-family: inherit;
  transition: border-color .16s, background .16s, box-shadow .16s;
}
input::placeholder, textarea::placeholder { color: #b3bdb6; }
input:focus, select:focus, textarea:focus { outline: none; background: #fff; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(21,163,74,.12); }

/* Buttons */
.btn { appearance: none; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); border-radius: var(--pill); padding: 14px 18px; font-size: 15px; font-weight: 700; cursor: pointer; transition: transform .1s var(--ease), box-shadow .18s, background .18s, filter .18s; }
.btn:active { transform: scale(.965); }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: var(--sh-brand); }
.btn.primary:hover { filter: brightness(1.04); }
.btn.big { padding: 16px; font-size: 16.5px; width: 100%; }
.btn.small { padding: 9px 14px; font-size: 13.5px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--brand); box-shadow: none; }
.btn.ghost:hover { background: rgba(21,163,74,.08); }
.btn.warn { background: #fff; color: var(--warn); border-color: #f0dcbb; }
.btn.danger { color: var(--danger); border-color: transparent; background: transparent; }
.btn.danger:hover { background: #fdeef1; }

.error { color: var(--danger); min-height: 16px; text-align: center; margin: 0; font-size: 13.5px; font-weight: 600; }

/* Disclosure (Join) */
details.disclose { text-align: center; }
details.disclose > summary { list-style: none; cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 600; padding: 8px; }
details.disclose > summary::-webkit-details-marker { display: none; }
details.disclose[open] > summary { color: var(--brand); }
details.disclose .card { margin-top: 8px; text-align: left; animation: screenin .3s var(--ease) both; }

/* Top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 2px 2px 4px; }
.family-name { font-size: 21px; font-weight: 800; letter-spacing: -0.03em; }
.icon-btn { background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); width: 40px; height: 40px; border-radius: var(--pill); font-size: 17px; cursor: pointer; display: grid; place-items: center; box-shadow: var(--sh); transition: transform .12s; }
.icon-btn:active { transform: scale(.92); }

/* Trash hero */
.trash-card { position: relative; overflow: hidden; align-items: center; text-align: center; gap: 8px; padding: 34px 22px 26px; color: #fff; border: none; background: var(--grad); box-shadow: var(--sh-brand); transition: background .5s var(--ease); }
.trash-card::after { content: ""; position: absolute; inset: 0; background: radial-gradient(140px 120px at 82% 4%, rgba(255,255,255,.28), transparent 70%); pointer-events: none; }
.trash-emoji { font-size: 46px; width: 84px; height: 84px; margin: 0 auto 6px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.18); }
.trash-card.done .trash-emoji { animation: checkpop .55s var(--ease) both; }
@keyframes checkpop { 0% { transform: scale(.4); } 55% { transform: scale(1.12); } 100% { transform: scale(1); } }
.trash-status { font-size: 23px; font-weight: 800; letter-spacing: -0.03em; }
.trash-card .muted { color: rgba(255,255,255,.82); font-weight: 500; font-size: 14px; }
.trash-card .btn.primary { background: #fff; color: #0c3a26; box-shadow: 0 10px 24px rgba(0,0,0,.16); margin-top: 6px; }
.trash-card .btn.ghost { color: #fff; }
.trash-card .btn.ghost:hover { background: rgba(255,255,255,.16); }
.trash-card.done { background: linear-gradient(150deg, #0f3f2b, #0b513f); }
.turn-line { display: inline-block; margin: 4px auto 0; padding: 6px 14px; border-radius: var(--pill); background: rgba(255,255,255,.2); color: #fff; font-weight: 700; font-size: 13.5px; }

/* Who */
.who-list { display: flex; flex-direction: column; gap: 10px; }
.who-btn { text-align: left; padding: 16px 18px; font-size: 17px; font-weight: 700; cursor: pointer; background: var(--surface); border: 1.5px solid var(--line); color: var(--ink); border-radius: var(--r); box-shadow: var(--sh); transition: all .16s var(--ease); display: flex; align-items: center; gap: 13px; animation: screenin .35s var(--ease) both; }
.who-btn::before { content: ""; width: 30px; height: 30px; border-radius: 50%; background: var(--grad); opacity: .85; flex: none; }
.who-btn:hover { border-color: var(--brand); transform: translateX(3px); }

/* Members */
.members-list { display: flex; flex-direction: column; }
.member-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.member-row:last-child { border-bottom: none; }
.member-row .dot { width: 8px; height: 8px; border-radius: 50%; background: #d2dcd6; display: inline-block; margin-right: 11px; transition: background .3s; }
.member-row.handled .dot { background: var(--brand); box-shadow: 0 0 0 4px rgba(21,163,74,.16); }
.member-del { background: transparent; border: none; color: #c2ccc6; cursor: pointer; font-size: 15px; padding: 4px 6px; border-radius: 8px; }
.member-del:hover { color: var(--danger); background: #fdeef1; }

.row { display: flex; gap: 8px; align-items: flex-end; }
.row.between { justify-content: space-between; align-items: center; }
.row input { flex: 1; }
.or-divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12.5px; font-weight: 700; }
.or-divider::before, .or-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* Invite */
.invite-link { width: 100%; text-align: center; font-weight: 700; color: #0c3a26; background: rgba(21,163,74,.1); border: 1.5px dashed rgba(21,163,74,.3); border-radius: var(--r-sm); padding: 14px; cursor: pointer; }
.qr { display: grid; place-items: center; padding: 4px 0; }
.qr img, .qr canvas { border-radius: 12px; }
#join-code { letter-spacing: 2px; color: var(--brand); }

/* Connection — tiny, unobtrusive */
.conn { text-align: center; font-weight: 600; color: var(--muted); font-size: 12px; display: flex; gap: 6px; align-items: center; justify-content: center; }
.conn::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #cfd8d2; }
.conn.live { color: var(--brand); }
.conn.live::before { background: var(--brand); animation: pulse 2.2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(74px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: #11201a; color: #fff; padding: 13px 20px; border-radius: var(--pill); font-weight: 650; font-size: 14.5px; box-shadow: 0 10px 40px -8px rgba(0,0,0,.4); z-index: 60; max-width: 90%; text-align: center; animation: toastin .3s var(--ease) both; }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 14px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Banners / nudge */
.banner { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 13px 16px; font-size: 13.5px; font-weight: 600; display: flex; gap: 12px; align-items: center; justify-content: space-between; box-shadow: var(--sh); }
.banner.warn { background: #fffaf2; border-color: #f0dcbb; color: #875309; }
.banner.expired { background: #fdeef1; border-color: #f6c9d2; color: #a01b38; }
.banner .btn { padding: 9px 14px; font-size: 13px; flex: none; }
.notif-nudge { display: flex; align-items: center; gap: 13px; background: #fffaf2; border: 1px solid #f0dcbb; border-radius: var(--r); padding: 13px 15px; box-shadow: var(--sh); animation: screenin .35s var(--ease) both; }
.notif-ic { width: 38px; height: 38px; flex: none; border-radius: 11px; display: grid; place-items: center; font-size: 18px; background: #fdecc8; }
.notif-tx { flex: 1; }
.notif-title { font-weight: 750; font-size: 14px; }

/* Tasks */
.tasks-list { display: flex; flex-direction: column; gap: 9px; }
.task { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 14px 15px; display: flex; flex-direction: column; gap: 9px; animation: screenin .3s var(--ease) both; }
.task .task-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.task .task-title { font-weight: 750; font-size: 15px; }
.task .task-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.task .task-del { background: transparent; border: none; color: #c2ccc6; cursor: pointer; font-size: 13px; padding: 2px 6px; border-radius: 8px; }
.task .task-del:hover { color: var(--danger); }
.task .responses { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 600; }
.resp-got { color: var(--brand); }
.resp-cant { color: var(--warn); }
.resp-pending { color: var(--muted); }
.task-actions { display: flex; gap: 8px; }
.task-actions .btn { flex: 1; padding: 11px; font-size: 14px; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 9px 15px; border-radius: var(--pill); border: 1.5px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; font-size: 14px; font-weight: 650; user-select: none; transition: all .14s var(--ease); }
.chip:active { transform: scale(.95); }
.chip.on { background: var(--grad); border-color: transparent; color: #fff; box-shadow: var(--sh-brand); }
.check-row { flex-direction: row; align-items: center; gap: 12px; color: var(--ink); font-weight: 600; font-size: 14.5px; }
.check-row input { width: 22px; height: 22px; flex: none; accent-color: var(--brand); }

/* Tab bar */
.tab-bar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 460px;
  display: flex; background: var(--surface); border-top: 1px solid var(--line);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  z-index: 50; box-shadow: 0 -2px 12px rgba(17,32,26,.07);
}
}
.tab-btn {
  flex: 1; background: none; border: none; color: var(--muted); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 10.5px; font-weight: 700; padding: 4px 0;
  transition: color .15s; -webkit-tap-highlight-color: transparent;
  line-height: 1.2;
}
.tab-btn span { display: block; }
.tab-btn.active { color: var(--brand); }
.tab-panel { display: flex; flex-direction: column; gap: 14px; }

/* Ensure main-screen has room above the tab bar */
#main-screen { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }

/* History */
.history-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.stat-chip { padding: 7px 13px; border-radius: var(--pill); background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; font-weight: 700; color: var(--ink-2); }
.history-list { display: flex; flex-direction: column; }
.history-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.history-row:last-child { border-bottom: none; }
.history-date { font-weight: 600; color: var(--ink-2); }
.handled-label { color: var(--brand); font-weight: 700; font-size: 13px; }
.missed-label { color: var(--danger); font-weight: 700; font-size: 13px; }

/* Task templates */
.template-picker-card { gap: 0 !important; padding: 0 !important; overflow: hidden; }
.template-toggle-btn { width: 100%; background: none; border: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 15px 18px; font-size: 14px; font-weight: 700; color: var(--ink-2); text-align: left; }
.template-toggle-btn:hover { background: var(--surface-2); }
.template-toggle-icon { width: 28px; height: 28px; border-radius: 9px; background: var(--grad); display: grid; place-items: center; font-size: 14px; flex: none; }
.template-toggle-btn > span:nth-child(2) { flex: 1; }
.template-chevron { font-size: 18px; color: var(--muted); transition: transform .2s var(--ease); }
.template-panel { border-top: 1px solid var(--line); padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.tcat-row { display: flex; gap: 8px; }
.tcat-btn { flex: 1; padding: 9px 12px; border-radius: var(--pill); border: 1.5px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 700; cursor: pointer; color: var(--ink-2); transition: all .14s var(--ease); }
.tcat-btn.active { background: var(--grad); border-color: transparent; color: #fff; box-shadow: var(--sh-brand); }
.template-list { display: flex; flex-wrap: wrap; gap: 7px; max-height: 200px; overflow-y: auto; }
.tpl-pill { padding: 8px 13px; border-radius: var(--pill); border: 1.5px solid var(--line); background: var(--surface-2); font-size: 13px; font-weight: 650; cursor: pointer; color: var(--ink); transition: all .14s var(--ease); display: flex; align-items: center; gap: 5px; }
.tpl-pill:hover { border-color: var(--brand); background: rgba(21,163,74,.07); color: var(--brand); transform: translateY(-1px); }
.tpl-rec { font-size: 10.5px; font-weight: 700; color: var(--muted); background: var(--surface); border-radius: var(--pill); padding: 2px 7px; margin-left: 2px; }
.tpl-pill:hover .tpl-rec { color: var(--brand); background: rgba(21,163,74,.1); }

/* Home extras — members glance */
.card-label { font-size: 11px; font-weight: 800; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; display: block; }
.member-avatars { display: flex; gap: 12px; flex-wrap: wrap; }
.member-avatar { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 52px; }
.avatar-circle { width: 48px; height: 48px; border-radius: 50%; background: var(--surface-2); border: 2px solid var(--line); display: grid; place-items: center; font-size: 18px; font-weight: 800; color: var(--ink-2); transition: all .2s var(--ease); }
.member-avatar.me .avatar-circle { background: var(--grad); border-color: transparent; color: #fff; box-shadow: var(--sh-brand); }
.avatar-name { font-size: 10.5px; font-weight: 650; color: var(--ink-2); text-align: center; max-width: 54px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.3; }
.member-avatar.me .avatar-name { color: var(--brand); }
.avatar-turn { font-size: 9.5px; font-weight: 800; color: var(--brand); text-align: center; letter-spacing: 0.02em; }

/* Home extras — upcoming tasks */
.home-upcoming { gap: 0 !important; }
.home-upcoming > .row { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.home-task-row { display: flex; align-items: center; gap: 11px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.home-task-row:last-child { border-bottom: none; }
.home-task-row.done { opacity: .55; }
.home-task-icon { font-size: 16px; flex: none; width: 22px; text-align: center; }
.home-task-info { flex: 1; min-width: 0; }
.home-task-title { font-size: 14px; font-weight: 700; display: block; }
.home-task-meta { font-size: 11.5px; color: var(--muted); display: block; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-badge { font-size: 11px; }

.legal-links { text-align: center; font-size: 12px; color: var(--muted); margin-top: 4px; }
.legal-links a { color: var(--muted); text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  *, .screen, .brand-logo, .who-btn, .task, .notif-nudge, .toast { animation: none !important; transition: none !important; }
}
