/* Us HQ — warm, phone-first. */
:root {
  --bg: #f6efe6;
  --card: #fffaf3;
  --ink: #2b211c;
  --muted: #7a6a5f;
  --line: #e6d9cb;
  --accent: #c2552f;
  --accent-ink: #fff;
  --ok: #4f7a52;
  --danger: #a33a2a;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 8px 24px -12px rgba(60, 40, 20, .18);
  color-scheme: light;
  font-family: "Avenir Next", "SF Pro Rounded", ui-rounded, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1d1715; --card: #27201d; --ink: #f3eae0; --muted: #b3a295; --line: #3a302b;
    --accent: #e0714a; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { min-height: 100dvh; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); -webkit-font-smoothing: antialiased; line-height: 1.45; }
a { color: var(--accent); }
h1, h2 { margin: 0 0 .35em; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.1rem; }
small, .hint { color: var(--muted); font-size: .85rem; }
.hint { display: block; margin: .25em 0 0; }
p { margin: .5em 0; }

.main { max-width: 720px; margin: 0 auto; padding: 16px 16px 48px; }
body.auth .main { max-width: 440px; padding-top: 8vh; }

/* top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; max-width: 720px; margin: 0 auto; }
.brand { font-weight: 800; font-size: 1.25rem; color: var(--ink); text-decoration: none; letter-spacing: -.02em; }
.brand span, .auth-brand h1 span { color: var(--accent); }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; font-weight: 600; font-size: .9rem; }

/* avatars */
.avatar { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--c, var(--accent)); color: #fff; font-weight: 800; flex: none; }
.avatar.sm { width: 28px; height: 28px; font-size: .8rem; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.4rem; }

/* cards */
.card, .auth-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.auth-card { padding: 28px 24px; }
.auth-brand { text-align: center; margin-bottom: 20px; }
.auth-brand img { border-radius: 16px; margin-bottom: 8px; }
.tagline { color: var(--muted); margin: 0; }

/* forms */
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack + .stack, .auth-card .btn + .stack, .auth-card .btn + .btn { margin-top: 10px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .95rem; }
label .hint { font-weight: 400; }
input:not([type=radio]):not([type=hidden]) {
  font: inherit; font-size: 1rem; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); width: 100%; min-height: 48px;
}
input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.row { display: flex; gap: 14px; align-items: center; }
.grow { flex: 1; min-width: 0; }

.btn {
  font: inherit; font-weight: 700; font-size: 1rem; min-height: 48px; padding: 10px 18px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .08s ease, opacity .15s;
  width: 100%;
}
.btn:active { transform: scale(.985); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.sm { min-height: 36px; padding: 4px 12px; font-size: .85rem; width: auto; border-radius: 10px; }
.btn.big { min-height: 54px; font-size: 1.05rem; }
.btn[disabled], .btn.busy { opacity: .6; cursor: progress; }
.btn-icon { font-size: 1.1em; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .85rem; margin: 18px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* flash */
.flash { padding: 10px 14px; border-radius: 12px; font-size: .95rem; margin: 0 0 14px; }
.flash.error { background: color-mix(in srgb, var(--danger) 12%, var(--card)); color: var(--danger); }
.flash.ok { background: color-mix(in srgb, var(--ok) 14%, var(--card)); color: var(--ok); }

/* colour swatches */
.swatches { border: 0; padding: 0; margin: 0; }
.swatches legend { font-weight: 600; font-size: .95rem; margin-bottom: 8px; padding: 0; }
.swatch-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.swatch { align-items: center; gap: 4px; font-weight: 500; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch .dot { width: 40px; height: 40px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px var(--card), 0 0 0 4px transparent; transition: box-shadow .12s; }
.swatch input:checked + .dot { box-shadow: 0 0 0 3px var(--card), 0 0 0 6px var(--c); }
.swatch small { font-size: .7rem; }

/* steps */
.steps { display: flex; justify-content: center; gap: 18px; list-style: none; padding: 0; margin: 0 0 18px; counter-reset: s; font-size: .8rem; color: var(--muted); }
.steps li { display: flex; align-items: center; gap: 6px; }
.steps li::before { counter-increment: s; content: counter(s); display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line); font-size: .7rem; }
.steps li.on { color: var(--ink); font-weight: 700; }
.steps li.on::before { background: var(--accent); color: #fff; border-color: transparent; }
.steps li.done::before { content: "✓"; background: var(--ok); color: #fff; border-color: transparent; }

/* lists */
.list { list-style: none; padding: 0; margin: 0 0 12px; }
.list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list small { display: block; }
.inline { display: inline-flex; gap: 6px; align-items: center; }
.inline input { min-height: 36px !important; padding: 6px 10px !important; width: auto !important; max-width: 180px; }
.tag { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ok); margin-left: 6px; }
.empty { color: var(--muted); }
.members { list-style: none; padding: 0; margin: 12px 0; display: flex; flex-direction: column; gap: 10px; }
.members li { display: flex; align-items: center; gap: 12px; }
.members li div { display: flex; flex-direction: column; }
.inline-members { flex-direction: row; gap: 16px; }
.inline-members li { gap: 8px; font-weight: 600; }
details summary { cursor: pointer; font-weight: 600; margin-bottom: 10px; }
.signout { margin-top: 24px; }
.page-title { margin: 8px 0 16px; }

/* home */
.hero { padding: 16px 4px 12px; }
.eyebrow { margin: 0; color: var(--muted); font-weight: 600; }
.hero h1 { font-size: 2.2rem; margin-bottom: 12px; }
.card.soon p { color: var(--muted); }

@media (min-width: 640px) {
  .btn { width: auto; }
  .btn.big, .auth-card .btn { width: 100%; }
}

/* share box */
.share-box { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 14px; }
.share-box input { font-size: .9rem !important; color: var(--muted); }
.center { text-align: center; }
.center-members { align-items: center; }
.center-members li { flex-direction: column; gap: 6px; text-align: center; }
.members.center-members { flex-direction: row; justify-content: center; gap: 28px; }
.invite-from { display: flex; justify-content: center; margin-bottom: 8px; }
.auth-brand .avatar.lg { margin: 0 auto 8px; }

/* password show/hide */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 64px !important; }
.pw-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font: inherit; font-size: .8rem; font-weight: 700; color: var(--accent); background: none; border: 0; padding: 6px 8px; cursor: pointer; }

/* install hint */
.install-hint {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 50;
  background: var(--card); color: var(--ink); border-radius: 16px; box-shadow: 0 12px 32px -8px rgba(40,20,10,.35);
  padding: 14px 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: .9rem; max-width: 560px; margin: 0 auto;
}
.install-hint > div { flex: 1; min-width: 200px; }
.ios-share { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; background: var(--accent); color: #fff; font-size: .8rem; vertical-align: -4px; }
.invite-card { border: 2px dashed var(--line); box-shadow: none; }

/* live colour tint while picking a colour */
.row.names { align-items: flex-start; }
.row.names label { flex: 1; }
.tinted { transition: background-color .25s ease, box-shadow .25s ease; }
.auth-card.tinted { background: color-mix(in srgb, var(--tint) 7%, var(--card)); box-shadow: var(--shadow), 0 0 0 1px color-mix(in srgb, var(--tint) 35%, transparent); }
.auth-card.tinted .auth-brand h1 span, .auth-card.tinted a { color: var(--tint); }
.tinted input:focus-visible { outline-color: var(--tint); }
.tinted .btn.primary { background: var(--tint); }
.tinted .steps li.on::before { background: var(--tint); }
@media (prefers-color-scheme: dark) {
  .auth-card.tinted { background: color-mix(in srgb, var(--tint) 12%, var(--card)); }
}

/* signed-in pages carry the member's colour everywhere */
body.themed .auth-card { background: color-mix(in srgb, var(--tint) 7%, var(--card)); box-shadow: var(--shadow), 0 0 0 1px color-mix(in srgb, var(--tint) 35%, transparent); }
body.themed .auth-card .auth-brand h1 span { color: var(--tint); }
body.themed .steps li.on::before { background: var(--tint); }
body.themed .chip { box-shadow: var(--shadow), 0 0 0 1px color-mix(in srgb, var(--tint) 30%, transparent); }
@media (prefers-color-scheme: dark) {
  body.themed .auth-card { background: color-mix(in srgb, var(--tint) 12%, var(--card)); }
}

/* ---- theme-derived neutrals: once a member colour exists, the whole palette leans on it ---- */
body.themed {
  --bg: color-mix(in srgb, var(--tint) 7%, #fafafa);
  --card: color-mix(in srgb, var(--tint) 2%, #ffffff);
  --ink: color-mix(in srgb, var(--tint) 30%, #1b1b1b);
  --muted: color-mix(in srgb, var(--tint) 35%, #707070);
  --line: color-mix(in srgb, var(--tint) 16%, #e6e6e6);
  --shadow: 0 1px 2px color-mix(in srgb, var(--tint) 12%, transparent), 0 10px 28px -14px color-mix(in srgb, var(--tint) 35%, transparent);
}
html:has(body.themed) { background: color-mix(in srgb, var(--tint) 7%, #fafafa); }
@media (prefers-color-scheme: dark) {
  body.themed {
    --bg: color-mix(in srgb, var(--tint) 12%, #121212);
    --card: color-mix(in srgb, var(--tint) 9%, #1d1d1d);
    --ink: color-mix(in srgb, var(--tint) 8%, #f2f2f2);
    --muted: color-mix(in srgb, var(--tint) 25%, #a8a8a8);
    --line: color-mix(in srgb, var(--tint) 18%, #333);
  }
  html:has(body.themed) { background: color-mix(in srgb, var(--tint) 12%, #121212); }
}

/* ---- home: cover hero ---- */
.hero {
  position: relative; overflow: hidden; border-radius: 24px; min-height: 230px; margin: 4px 0 16px;
  display: flex; align-items: flex-end; padding: 22px 20px; color: #fff; box-shadow: var(--shadow);
  background: var(--accent);
}
.hero.has-cover { background: var(--cover) center / cover no-repeat; }
.hero.has-cover::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 35%, rgba(0,0,0,.55) 100%); }
.hero-art { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-text { position: relative; z-index: 1; text-shadow: 0 1px 2px rgba(0,0,0,.35), 0 6px 18px rgba(0,0,0,.25); }
.hero .eyebrow { color: rgba(255,255,255,.85); margin: 0; }
.hero h1 { font-size: 2.3rem; margin: 0 0 4px; color: #fff; letter-spacing: -.02em; }
.hero-date { margin: 0; font-size: .9rem; color: rgba(255,255,255,.85); font-weight: 600; }
.cover-form { position: absolute; right: 14px; top: 14px; z-index: 2; }
.cover-btn {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  background: rgba(0,0,0,.28); color: #fff; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.25); transition: background .15s;
}
.cover-btn:hover { background: rgba(0,0,0,.45); }
.cover-btn svg { width: 20px; height: 20px; }
.cover-btn.busy { opacity: .6; cursor: progress; }
@media (min-width: 640px) { .hero { min-height: 300px; } .hero h1 { font-size: 2.8rem; } }

/* ---- home: feature tiles ---- */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tile {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
  background: var(--card); color: var(--ink); border: 0; border-radius: 20px; padding: 18px 16px 16px; min-height: 140px;
  box-shadow: var(--shadow); text-decoration: none; font: inherit; cursor: pointer; transition: transform .1s ease;
}
.tile:active { transform: scale(.98); }
.tile-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; margin-bottom: auto; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.tile-icon svg { width: 24px; height: 24px; }
.tile strong { font-size: 1rem; margin-top: 12px; }
.tile small { color: var(--muted); }
.tile.locked { opacity: .72; }
.tile.locked .tile-icon { color: var(--muted); background: color-mix(in srgb, var(--muted) 12%, transparent); }
.tile .lock { position: absolute; top: 12px; right: 12px; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: color-mix(in srgb, var(--muted) 14%, transparent); color: var(--muted); }
.tile .lock svg { width: 13px; height: 13px; }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---- toast ---- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 16px);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: .9rem; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; z-index: 60; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ================= screen transitions ================= */
@view-transition { navigation: auto; }
@keyframes slide-in-right { from { transform: translateX(28px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slide-out-left { from { transform: none; opacity: 1; } to { transform: translateX(-28px); opacity: 0; } }
@keyframes slide-in-left { from { transform: translateX(-28px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slide-out-right { from { transform: none; opacity: 1; } to { transform: translateX(28px); opacity: 0; } }
::view-transition-old(root) { animation: 140ms cubic-bezier(.4,0,1,1) both slide-out-left; }
::view-transition-new(root) { animation: 220ms cubic-bezier(0,0,.2,1) both slide-in-right; }
html:active-view-transition-type(back)::view-transition-old(root) { animation-name: slide-out-right; }
html:active-view-transition-type(back)::view-transition-new(root) { animation-name: slide-in-left; }
.topbar { view-transition-name: topbar; }
::view-transition-old(topbar), ::view-transition-new(topbar) { animation-duration: 180ms; }
/* fallback (no cross-document transitions): fade/slide via classes */
html.vt-fallback .main { animation: slide-in-right 200ms cubic-bezier(0,0,.2,1) both; }
html.vt-fallback.leaving .main { animation: slide-out-left 170ms cubic-bezier(.4,0,1,1) both; }
html.vt-fallback.leaving-back .main { animation: slide-out-right 170ms cubic-bezier(.4,0,1,1) both; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
  html.vt-fallback .main { animation: none; }
}

/* ================= department pages ================= */
.back { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--ink); background: var(--card); box-shadow: var(--shadow); margin-right: 10px; }
.back svg { width: 18px; height: 18px; }
.topbar .brand { margin-right: auto; }
.dept-head { margin: 4px 0 12px; }
.dept-head .page-title { margin: 0; }
.dept-sub { margin: 2px 0 0; color: var(--muted); font-weight: 600; font-size: .9rem; }
.dept-sub .late, .due.late, .badge.late { color: var(--danger); }
.tile .badge { position: absolute; top: 12px; right: 12px; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px; display: grid; place-items: center; background: var(--accent); color: #fff; font-size: .75rem; font-weight: 800; }
.tile .badge.late { background: var(--danger); }

/* quick add */
.quick-add { padding: 10px 10px 10px 14px; }
.qa-row { display: flex; gap: 8px; align-items: center; }
.qa-row input { border: 0 !important; background: transparent !important; padding-left: 0 !important; font-size: 1.05rem !important; }
.qa-row input:focus-visible { outline: none; }
.qa-btn { width: 44px; min-height: 44px; padding: 0; border-radius: 14px; flex: none; }
.qa-btn svg { width: 20px; height: 20px; }


/* list */
.list-card { padding: 4px 0; transition: opacity .15s; }
.list-card.swap { opacity: .4; }
.todo-list { list-style: none; margin: 0; padding: 0; }
.todo { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); animation: fade-up .2s ease-out both; }
.todo:first-child { border-top: 0; }
.todo.pop { animation: pop-in .3s cubic-bezier(.2,.9,.3,1.2) both; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
.check { position: relative; flex: none; width: 28px; height: 28px; cursor: pointer; }
.check input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.check .box { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; color: #fff; transition: background .18s, border-color .18s, transform .18s; }
.check .box svg { width: 16px; height: 16px; opacity: 0; transform: scale(.4); transition: all .18s cubic-bezier(.2,.9,.3,1.3); }
.check input:checked + .box { background: var(--accent); border-color: var(--accent); }
.check input:checked + .box svg { opacity: 1; transform: none; }
.check input:active + .box { transform: scale(.9); }
.todo.late .check .box { border-color: color-mix(in srgb, var(--danger) 60%, var(--line)); }
.todo-main { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 0; font: inherit; color: var(--ink); cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.todo-title { font-weight: 600; font-size: 1rem; line-height: 1.3; transition: color .2s; position: relative; }
.todo.done .todo-title { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.todo-meta { display: flex; gap: 10px; font-size: .8rem; color: var(--muted); }
.due.today { color: var(--accent); font-weight: 700; }
.due.soon { color: var(--ink); }
.due.late { font-weight: 700; }
.has-notes { opacity: .7; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 36px 16px; text-align: center; color: var(--muted); }
.empty-state strong { color: var(--ink); font-size: 1.05rem; }
.clear-done { padding: 8px 14px 10px; display: flex; justify-content: center; border-top: 1px solid var(--line); }

/* bottom sheet */
.no-scroll { overflow: hidden; }
.sheet-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,0); display: flex; align-items: flex-end; justify-content: center; transition: background .25s; }
.sheet-backdrop.open { background: rgba(20,10,5,.45); }
.sheet { width: 100%; max-width: 560px; background: var(--card); border-radius: 24px 24px 0 0; padding: 10px 18px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; transform: translateY(100%); transition: transform .28s cubic-bezier(.2,.9,.3,1); box-shadow: 0 -10px 40px rgba(0,0,0,.2); }
.sheet-backdrop.open .sheet { transform: none; }
.sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 4px; }
.sheet-title { font-size: 1.15rem !important; font-weight: 700; border: 0 !important; background: transparent !important; padding-left: 0 !important; }
.sheet-title:focus-visible { outline: none; }
.sheet textarea { font: inherit; font-size: .95rem; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); resize: vertical; }
.sheet-section { display: flex; flex-direction: column; gap: 6px; }
.sheet-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.sheet-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 4px; }
.sheet-actions .btn { width: auto; flex: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (min-width: 640px) { .sheet { border-radius: 24px; margin-bottom: 24px; } }

@keyframes fade-up { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* filters as quiet tabs */
.tabs { display: flex; gap: 22px; margin: 18px 4px 6px; border-bottom: 1px solid var(--line); }
.tab { font: inherit; font-size: .95rem; font-weight: 600; color: var(--muted); background: none; border: 0; padding: 6px 0 10px; cursor: pointer; position: relative; transition: color .15s; }
.tab.on { color: var(--ink); }
.tab::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); transform: scaleX(0); transition: transform .2s cubic-bezier(.2,.9,.3,1); }
.tab.on::after { transform: scaleX(1); }

/* segmented control (edit sheet) */
.seg { display: flex; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.seg label { flex: 1; position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; padding: 8px 6px; border-radius: 9px; font-size: .9rem; font-weight: 600; color: var(--muted); cursor: pointer; transition: all .15s; }
.seg input:checked + span { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* due field (edit sheet) */
.due-field { display: flex; flex-direction: column; gap: 6px; }
.due-field input[type=date] { -webkit-appearance: none; appearance: none; }
.due-shortcuts { display: flex; gap: 8px; margin-top: 2px; }
.due-shortcuts button {
  font: inherit; font-size: .95rem; font-weight: 600; min-height: 42px; padding: 8px 16px; border-radius: 12px; cursor: pointer;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--card)); border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
  transition: background .15s, transform .08s;
}
.due-shortcuts button:active { transform: scale(.97); }
.due-shortcuts .clear { color: var(--muted); background: transparent; border-color: var(--line); margin-left: auto; opacity: 0; pointer-events: none; transition: opacity .15s; }
.due-field.has-date .clear { opacity: 1; pointer-events: auto; }

/* ---- press ripple ---- */
.has-ripple { position: relative; overflow: hidden; isolation: isolate; }
.ripple {
  position: absolute; border-radius: 50%; pointer-events: none; z-index: -1;
  background: currentColor; opacity: .14; transform: scale(0);
  animation: ripple-in .45s cubic-bezier(.2,.7,.3,1) forwards;
}
.btn.primary .ripple, .chip-btn.on .ripple { opacity: .28; background: #fff; }
.tile .ripple { opacity: .10; background: var(--accent); }
.tab .ripple, .todo .ripple, .seg label .ripple { opacity: .09; background: var(--accent); }
.ripple.fade { animation: ripple-out .35s ease-out forwards; }
@keyframes ripple-in { to { transform: scale(1); } }
@keyframes ripple-out { from { transform: scale(1); } to { transform: scale(1); opacity: 0; } }
/* quick-add busy */
.qa-btn.busy { opacity: 1; }
.qa-btn.busy svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- composer (quick add) ---- */
@media (min-width: 640px) {
  .quick-add { order: -1; }
  body.has-composer .main { display: flex; flex-direction: column; }
  body.has-composer .dept-head { order: -2; }
}
/* ---- phone app shell: body fills exactly the visible viewport (shrinks when the keyboard opens) ---- */
@media (max-width: 639px) {
  html.shell { height: 100%; overflow: hidden; overscroll-behavior: none; }
  body.shell {
    position: fixed; left: 0; right: 0; top: var(--vv-top, 0px); height: var(--vv-h, 100%);
    display: flex; flex-direction: column; overflow: hidden; padding-bottom: 0;
  }
  body.shell .topbar { flex: none; width: 100%; }
  body.shell .main {
    flex: 1; min-height: 0; width: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain; padding-bottom: 16px;
  }
  body.shell .quick-add {
    flex: none; position: static; margin: 0 12px calc(12px + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 16px -6px rgba(40,20,10,.25), var(--shadow); transition: margin .15s, border-radius .15s;
  }
  body.shell.keyboard-open .quick-add { margin: 0; border-radius: 18px 18px 0 0; }
  body.shell .install-hint { bottom: calc(84px + env(safe-area-inset-bottom)); }
  body.keyboard-open .install-hint { display: none; }
}
/* sheet drag */
.sheet { touch-action: none; }
.sheet textarea { touch-action: pan-y; }
.sheet.dragging { transition: none; }
.sheet-handle { width: auto; height: 26px; background: none; margin: -10px -18px -4px; border-radius: 0; cursor: grab; }
.sheet-handle::after { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 11px auto 0; }
.sheet-backdrop.open { transition: background .25s; }

/* header stays put on department pages (and follows the visible area when the keyboard is up) */

/* "Anyone" placeholder avatar on task rows */
.avatar.xs { width: 20px; height: 20px; font-size: .65rem; }
.avatar.anyone { background: transparent; border: 1.5px dashed var(--line); color: transparent; }

/* ---- swipe-to-delete rows ---- */
.list-card { overflow: hidden; }
.todo { display: block; position: relative; padding: 0; overflow: hidden; }
.todo-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; position: relative; z-index: 1;
  background: var(--card); touch-action: pan-y; transition: transform .24s cubic-bezier(.2,.9,.3,1);
}
.todo.swiping .todo-row { transition: none; }
.todo-delete {
  position: absolute; inset: 0; z-index: 0; display: flex; align-items: center; padding-left: 30px;
  background: #e5484d; color: #fff; border: 0; cursor: pointer;
}
.todo-delete svg { width: 26px; height: 26px; }
.todo-delete:active { background: #cf3a3f; }

/* ---- repeat ---- */
.seg-sm span { padding: 8px 2px; font-size: .8rem; }
.weekday-pick { display: flex; justify-content: space-between; gap: 6px; }
.weekday-pick button {
  flex: 1; aspect-ratio: 1; max-width: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg);
  color: var(--muted); font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer; transition: all .15s;
}
.weekday-pick button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.repeat-hint { margin: 0; color: var(--muted); font-size: .85rem; }
.repeat-tag { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 600; }
.repeat-tag svg { width: 13px; height: 13px; }
.sheet { max-height: calc(100dvh - 24px); overflow-y: auto; }

/* ---- toast with action ---- */
.toast.has-action { display: inline-flex; align-items: center; gap: 14px; pointer-events: auto; padding-right: 8px; }
.toast button { font: inherit; font-weight: 800; color: var(--bg); background: color-mix(in srgb, var(--bg) 18%, transparent); border: 0; border-radius: 999px; padding: 6px 12px; cursor: pointer; }
body.shell .toast { bottom: calc(96px + env(safe-area-inset-bottom)); }

/* ---- notifications ---- */
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.push-prompt { display: flex; align-items: center; gap: 12px; }
.push-prompt small { display: block; color: var(--muted); }
.push-x { background: none; border: 0; color: var(--muted); font-size: 1rem; padding: 6px; cursor: pointer; }

.remind-tag { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: var(--ink); }
.remind-tag svg { width: 13px; height: 13px; }
.remind-tag.sent { color: var(--muted); }

/* ---- when field + custom picker ---- */
.when-row { display: flex; align-items: center; gap: 8px; }
.when-btn {
  flex: 1; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 10px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; font-size: 1rem; font-weight: 600; text-align: left; cursor: pointer;
}
.when-btn svg { width: 20px; height: 20px; color: var(--accent); flex: none; }
.when-btn.empty { color: var(--muted); font-weight: 500; }
.when-btn[aria-expanded="true"] { border-color: var(--accent); }
.x-btn { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 0; background: color-mix(in srgb, var(--muted) 12%, transparent); color: var(--muted); cursor: pointer; }
.x-btn svg { width: 16px; height: 16px; }
.x-btn:active { transform: scale(.94); }
.picker { margin-top: 8px; padding: 12px; border-radius: 16px; background: var(--bg); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; animation: fade-up .18s ease-out both; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 6px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); background: color-mix(in srgb, var(--accent) 9%, var(--card));
  color: var(--accent); font: inherit; font-size: .9rem; font-weight: 600; transition: background .15s, color .15s;
}
.pill small { color: inherit; opacity: .7; font-size: .75rem; }
.pill.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.pill.other input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; min-height: 0 !important; padding: 0 !important; cursor: pointer; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.cal-head strong { font-size: .95rem; }
.cal-nav { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 0; background: none; color: var(--ink); cursor: pointer; }
.cal-nav svg { width: 18px; height: 18px; }
.cal-dow, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.cal-dow span { font-size: .7rem; font-weight: 700; color: var(--muted); padding: 4px 0; }
.cal-day { aspect-ratio: 1; max-height: 42px; border-radius: 50%; border: 0; background: none; color: var(--ink); font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; transition: background .12s; }
.cal-day.past { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.cal-day.today { box-shadow: inset 0 0 0 1.5px var(--accent); color: var(--accent); }
.cal-day.on { background: var(--accent); color: #fff; box-shadow: none; }
.picker-time { display: flex; flex-direction: column; gap: 6px; }
.picker-done { width: 100%; }
.remind-row { margin-top: 8px; padding: 4px 4px 4px 12px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 8%, var(--bg)); }
.remind-icon svg { width: 18px; height: 18px; color: var(--accent); display: block; }
.remind-row select { flex: 1; min-width: 0; font: inherit; font-weight: 600; font-size: .95rem; color: var(--ink); background: transparent; border: 0; padding: 10px 0; -webkit-appearance: none; appearance: none; cursor: pointer; }
.remind-at { font-weight: 700; color: var(--accent); white-space: nowrap; font-size: .9rem; }
.add-remind { align-self: flex-start; margin-top: 8px; background: none; border: 0; color: var(--accent); font: inherit; font-weight: 600; padding: 8px 4px; cursor: pointer; }
