/* Angular design system: no rounded corners. Theme token sets live in themes.js and are applied as CSS variables on
   <body> (data-theme, data-mode light|dark, data-kid). The :root values below are the Night fallback for first paint. */
:root {
  --grad: linear-gradient(135deg, #22E3FF 0%, #8B5CF6 100%);
  --cut: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
  --cut-sm: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 7px 100%, 0 calc(100% - 7px));
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --tap: 48px;
}
body { --bg: #0A0F2C; --bg-img: linear-gradient(160deg, #0A0F2C 0%, #150D3B 100%); --bg2: #141B45; --card: #18204F; --line: #2E3A7A; --text: #EEF1FF; --muted: #A3AED6;
  --accent: #22E3FF; --accent2: #A78BFA; --ok: #C8F135; --on-ok: #0B1120; --warn: #FFB547; --danger: #FF7A93; --on-accent: #0B1120;
  --tgrad: linear-gradient(90deg, #22E3FF, #A78BFA); --bar: linear-gradient(90deg, #22E3FF, #8B5CF6); --toast-btn: #5B21B6; --shadow: rgba(0,0,0,.45); }
body[data-kid] { --font: "Nunito", "Trebuchet MS", "Segoe UI", system-ui, sans-serif; --tap: 56px; }
* { box-sizing: border-box; border-radius: 0 !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); -webkit-tap-highlight-color: transparent; }
body { min-height: 100vh; min-height: 100dvh; padding-bottom: env(safe-area-inset-bottom); background: var(--bg-img, var(--bg)) var(--bg) fixed; }
body[data-kid] { font-size: 18px; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px 120px; }
.top { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px);
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; }
.top::after { content: ''; position: absolute; left: 0; right: 0; bottom: -3px; height: 3px; background: var(--bar); } /* brand gradient bar under the header */
body[data-mode="light"] .top { background: color-mix(in srgb, var(--bg) 70%, transparent); }
body[data-mode="light"] .top::after { height: 4px; bottom: -4px; }
.top-in { max-width: 860px; margin: 0 auto; display: flex; align-items: center; gap: 10px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; font-size: 18px; text-decoration: none; color: var(--text); }
.brand .bname { background: var(--tgrad); -webkit-background-clip: text; background-clip: text; color: transparent; font-size: 19px; }
.brand .mark { width: 30px; height: 30px; background: var(--grad); clip-path: var(--cut-sm); display: grid; place-items: center; color: var(--on-accent); font-weight: 900; }
.spacer { flex: 1; }
.staging { font-size: 11px; font-weight: 700; letter-spacing: .12em; color: var(--warn); border: 1px solid var(--warn); padding: 2px 6px; text-transform: uppercase; }
.iconbtn { text-decoration: none; color: var(--text); min-width: 44px; height: 44px; display: inline-grid; place-items: center; background: var(--card); border: 1px solid var(--line); cursor: pointer; clip-path: var(--cut-sm); position: relative; padding: 0 10px; }
.iconbtn:hover { border-color: var(--accent); }
.badge { position: absolute; top: 3px; right: 5px; background: var(--danger); color: #fff; font-size: 10px; padding: 0 4px; font-weight: 800; }
h1 { font-size: 26px; margin: 18px 0 6px; letter-spacing: .01em; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); margin: 22px 0 8px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.btn { min-height: var(--tap); padding: 0 18px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-weight: 700; clip-path: var(--cut-sm); display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; color: var(--text); }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--grad); color: var(--on-accent); border: 0; }
.btn.danger { color: var(--danger); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.card { background: var(--card); border: 1px solid var(--line); clip-path: var(--cut); padding: 14px 16px; }
a.card { text-decoration: none; color: var(--text); display: block; position: relative; }
a.card:hover { border-color: var(--accent); }
/* list cards: coloured top edge per list (list colour, else the theme's edge palette) + matching icon chip */
.tile { min-width: 0; }
body[data-mode="light"] .tile { filter: drop-shadow(0 8px 10px var(--shadow)); } /* soft violet shadow that follows the chamfer */
a.card.listcard { border-top: 3px solid var(--edge, var(--accent)); height: 100%; }
a.card.listcard:hover { border-color: var(--accent); border-top-color: var(--edge, var(--accent)); }
.lchip { display: inline-block; width: 10px; height: 10px; margin-right: 7px; background: var(--edge, var(--accent)); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); vertical-align: 0; }
.ltitle { border-left: 4px solid var(--edge, var(--accent)); padding-left: 10px; }
.card .kind { font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
.card .name { font-size: 18px; font-weight: 800; margin: 4px 0; }
.card .count { position: absolute; right: 14px; top: 14px; font-weight: 900; font-size: 22px; background: var(--tgrad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.dots { display: flex; gap: 4px; margin-top: 6px; }
.dot { width: 10px; height: 10px; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.banner { background: var(--grad); color: var(--on-accent); padding: 12px 16px; clip-path: var(--cut); display: flex; gap: 10px; align-items: center; margin: 14px 0; font-weight: 700; }
.banner .btn { background: var(--bg); color: var(--text); border: 0; min-height: 40px; }
input[type=text], input[type=email], input[type=number], input[type=time], input[type=datetime-local], input[type=date], select, textarea {
  background: var(--bg2); border: 1px solid var(--line); min-height: var(--tap); padding: 0 12px; width: 100%; outline: none; clip-path: var(--cut-sm); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
label.field { display: block; margin: 10px 0; }
label.field > span { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 4px; }
.addbar { position: sticky; top: calc(env(safe-area-inset-top) + 66px); z-index: 5; background: var(--bg); padding: 10px 0; display: flex; gap: 8px; }
.addbar input { flex: 1; font-size: 17px; }
.items { list-style: none; margin: 0; padding: 0; }
.item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); min-height: 58px; background: var(--card); margin-bottom: 4px; clip-path: var(--cut-sm); }
.item.done .t { text-decoration: line-through; color: var(--muted); }
.item.expired { opacity: .55; }
.check { width: 34px; height: 34px; flex: none; border: 2px solid var(--accent); background: transparent; cursor: pointer; clip-path: polygon(0 0, 100% 0, 100% 70%, 70% 100%, 0 100%); display: grid; place-items: center; font-weight: 900; color: var(--on-accent); }
body[data-kid] .check { width: 44px; height: 44px; }
.item.done .check { background: var(--ok); border-color: var(--ok); color: var(--on-ok); }
.item .body { flex: 1; min-width: 0; }
.item .t { font-size: 17px; font-weight: 600; word-break: break-word; }
.item .meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.qty { font-weight: 900; color: var(--accent); margin-right: 6px; }
.tag { border: 1px solid var(--line); padding: 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.tag.warn { border-color: var(--warn); color: var(--warn); }
.tag.ok { border-color: var(--ok); color: var(--ok); }
.more { background: none; border: 0; color: var(--muted); font-size: 22px; width: 44px; height: 44px; cursor: pointer; }
.cat { font-size: 12px; text-transform: uppercase; letter-spacing: .14em; color: var(--accent); margin: 16px 0 6px; font-weight: 800; }
.empty { text-align: center; padding: 40px 10px; color: var(--muted); }
.empty .big { font-size: 46px; }
.tabs { display: flex; gap: 6px; margin: 12px 0; overflow-x: auto; }
.tabs button { min-height: 40px; padding: 0 14px; background: var(--card); border: 1px solid var(--line); cursor: pointer; font-weight: 700; clip-path: var(--cut-sm); white-space: nowrap; }
.tabs button.on { background: var(--grad); color: var(--on-accent); border: 0; }
/* dialogs (custom, never browser alert/confirm) */
.scrim { position: fixed; inset: 0; background: rgba(4,6,12,.62); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 700px) { .scrim { align-items: center; } }
.sheet { background: var(--bg2); border: 1px solid var(--line); width: 100%; max-width: 520px; max-height: 90dvh; overflow: auto; padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); clip-path: var(--cut); }
.sheet h3 { margin: 0 0 8px; font-size: 20px; }
.sheet .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.choice { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); margin: 6px 0; cursor: pointer; background: var(--card); clip-path: var(--cut-sm); }
.choice input { width: 22px; height: 22px; flex: none; accent-color: var(--accent); }
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(520px, calc(100% - 24px)); }
.toast { background: var(--text); color: var(--bg); padding: 12px 14px; display: flex; gap: 10px; align-items: center; font-weight: 600; clip-path: var(--cut-sm); animation: up .2s ease-out; }
.toast button { background: none; border: 0; color: var(--toast-btn); font-weight: 900; cursor: pointer; text-transform: uppercase; min-height: 36px; }
@keyframes up { from { transform: translateY(20px); opacity: 0; } }
/* celebration */
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.shard { position: absolute; width: 10px; height: 14px; clip-path: polygon(50% 0, 100% 100%, 0 100%); animation: burst 900ms cubic-bezier(.2,.7,.3,1) forwards; }
@keyframes burst { to { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; } }
.cheer { position: fixed; left: 50%; top: 38%; transform: translate(-50%, -50%); font-size: 34px; font-weight: 900; background: var(--tgrad); -webkit-background-clip: text; background-clip: text; color: transparent; animation: pop 1.4s ease-out forwards; white-space: nowrap; }
@keyframes pop { 0% { transform: translate(-50%, -50%) scale(.6); opacity: 0; } 20% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; } 80% { opacity: 1; } 100% { transform: translate(-50%, -60%) scale(1); opacity: 0; } }
.calm-flash { animation: calm .6s ease-out; }
@keyframes calm { from { background: color-mix(in srgb, var(--ok) 35%, var(--card)); } }
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { animation-duration: .001ms !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; transition: none !important; } }
/* login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.login .card { max-width: 420px; width: 100%; padding: 28px; }
.login .mark { width: 64px; height: 64px; font-size: 36px; margin-bottom: 10px; }
.codein { font-size: 26px !important; letter-spacing: .3em; text-align: center; text-transform: uppercase; }
.shopitem .check { width: 44px; height: 44px; }
.shopitem .t { font-size: 20px; }
.fab { position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 20; min-height: 56px; padding: 0 22px; font-size: 16px; }
.footer { text-align: center; font-size: 11px; letter-spacing: .14em; color: var(--muted); margin: 40px 0 0; }
.swatch { width: 34px; height: 34px; border: 2px solid transparent; cursor: pointer; clip-path: var(--cut-sm); }
.swatch.on { border-color: var(--text); }
.member { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; font-weight: 900; color: #0b0e17; clip-path: var(--cut-sm); flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
/* sheets: header with X (form sheets never close on backdrop click) */
.sheet-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.sheet-head h3 { flex: 1; margin: 0; }
.xbtn { width: 40px; height: 40px; flex: none; background: var(--card); border: 1px solid var(--line); color: var(--muted); cursor: pointer; clip-path: var(--cut-sm); font-size: 16px; }
.xbtn:hover { color: var(--text); border-color: var(--accent); }
.sheet.confirm { max-width: 400px; border-color: var(--warn); }
.scrim + .scrim { background: rgba(4,6,12,.45); z-index: 55; }
/* task sheet: repeat options */
.repbox { border-left: 3px solid var(--ok); padding: 4px 0 4px 12px; margin: 6px 0 10px; }
.days { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.daypick { position: relative; cursor: pointer; }
.daypick input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.daypick span { display: inline-grid; place-items: center; min-width: 46px; height: 40px; padding: 0 8px; border: 1px solid var(--line); background: var(--card); font-weight: 700; font-size: 13px; clip-path: var(--cut-sm); }
.daypick input:checked + span { background: var(--grad); color: var(--on-accent); border-color: transparent; }
.daypick input:focus-visible + span { outline: 2px solid var(--accent); }
.tag.rep { border-color: var(--ok); color: var(--ok); }
.item.upcoming { opacity: .8; }
.item.upcoming .check { border-style: dashed; opacity: .5; }
/* check-off pulse (angular, brand colours) */
.item { position: relative; }
.item.pulse::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 35%, transparent), color-mix(in srgb, var(--ok) 35%, transparent)); animation: rowpulse .55s ease-out forwards; }
.item.pulse .check { animation: checkpop .45s cubic-bezier(.2,.9,.3,1.4); }
@keyframes rowpulse { from { opacity: 1; transform: scaleX(.2); transform-origin: left; } 60% { opacity: .9; transform: scaleX(1); } to { opacity: 0; transform: scaleX(1); } }
@keyframes checkpop { 0% { transform: scale(1); } 40% { transform: scale(1.28) rotate(-6deg); } 100% { transform: scale(1); } }
/* in-app reminder card */
.remind { background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-left: 4px solid var(--ok); padding: 12px 12px 12px 14px; clip-path: var(--cut); animation: up .2s ease-out; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.remind-top { display: flex; gap: 10px; align-items: flex-start; }
.remind-icon { width: 36px; height: 36px; flex: none; display: grid; place-items: center; background: var(--grad); color: var(--on-accent); clip-path: var(--cut-sm); font-size: 18px; }
.remind-title { font-weight: 800; font-size: 16px; word-break: break-word; }
.remind-body { color: var(--muted); font-size: 13px; }
.remind-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.remind-actions .btn { min-height: 42px; padding: 0 14px; }
/* notification prompt + settings cards */
.npcard { margin: 14px 0 4px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--ok); clip-path: var(--cut); }
.np-title { font-weight: 800; font-size: 16px; margin-bottom: 4px; }
.setcard { margin-bottom: 6px; }
.devstate { font-weight: 800; display: flex; align-items: center; gap: 8px; }
.devstate::before { content: ''; width: 10px; height: 10px; flex: none; background: var(--muted); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.devstate[data-state="on"]::before { background: var(--ok); }
.devstate[data-state="blocked"]::before, .devstate[data-state="unsupported"]::before { background: var(--danger); }
.installbtn { font-size: 13px; font-weight: 800; color: var(--accent); }
.steps { padding-left: 22px; line-height: 1.7; }
@media (max-width: 420px) { .installbtn { font-size: 12px; padding: 0 8px; } }
/* click-to-edit rows (tap text or its date/time tag; long-press on touch) */
.item .body.editable { cursor: pointer; }
.item .body.editable:hover .t { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.item.done .body.editable:hover .t { text-decoration: line-through; }
.item .body.editable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: none) { .item { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; } }
/* new list: share with */
.fieldlabel { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 14px 0 4px; }
.sharerow { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); margin: 6px 0; background: var(--card); clip-path: var(--cut-sm); flex-wrap: wrap; }
.sharerow label { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.sharerow .who { flex: 1; min-width: 160px; font-weight: 700; }
.sharerow input { width: 22px; height: 22px; flex: none; accent-color: var(--accent); }
.sharerow .vo input { width: 18px; height: 18px; }
.sharerow .vo:has(input:disabled) { opacity: .45; cursor: default; }
/* autosave tick */
.saved { display: inline-block; margin-left: 8px; font-size: 11px; letter-spacing: .08em; color: var(--ok); opacity: 0; transition: opacity .2s; text-transform: none; font-weight: 800; }
.saved.on { opacity: 1; }
.digestrow { flex-wrap: wrap; cursor: default; }
.digestrow .inl { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 200px; cursor: pointer; }
.digestrow .inl input { width: 22px; height: 22px; accent-color: var(--accent); }
/* notification diagnostics + help */
.diag { margin-top: 8px; }
.trouble { margin: 8px 0; padding: 8px 10px; border: 1px solid var(--line); background: var(--bg2); clip-path: var(--cut-sm); }
.trouble summary { cursor: pointer; font-weight: 800; }
.trouble code { font-size: 12px; background: var(--card); padding: 0 4px; word-break: break-all; }
/* theme picker: swatch tiles drawn from each theme's own tokens; sharp corners */
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; margin: 6px 0 4px; }
.ttile { display: flex; flex-direction: column; gap: 6px; padding: 6px; background: var(--card); border: 2px solid var(--line); cursor: pointer; clip-path: var(--cut-sm); text-align: left; color: var(--text); }
.ttile:hover:not(:disabled) { border-color: var(--accent); }
.ttile.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.ttile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ttile:disabled { opacity: .55; cursor: not-allowed; }
.ttile .tl { font-weight: 800; font-size: 13px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ttile.on .tl::after { content: '✓'; margin-left: auto; color: var(--accent); font-weight: 900; }
.kidtag { font-size: 9px; letter-spacing: .12em; border: 1px solid currentColor; padding: 0 4px; color: var(--muted); }
.tp { position: relative; display: block; height: 76px; overflow: hidden; clip-path: var(--cut-sm); }
.tp-bar { position: absolute; left: 0; right: 0; top: 10px; height: 3px; }
.tp-row { position: absolute; left: 8px; right: 8px; top: 22px; height: 26px; border: 1px solid; border-top-width: 3px; display: flex; align-items: center; gap: 6px; padding: 0 6px; }
.tp-check { width: 14px; height: 14px; flex: none; display: grid; place-items: center; font-size: 10px; font-weight: 900; line-height: 1; }
.tp-lines { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.tp-lines span { display: block; height: 3px; }
.tp-lines span:first-child { width: 80%; } .tp-lines span:last-child { width: 50%; }
.tp-btn { position: absolute; right: 8px; bottom: 7px; width: 40px; height: 12px; clip-path: polygon(0 0, calc(100% - 5px) 0, 100% 5px, 100% 100%, 5px 100%, 0 calc(100% - 5px)); }
.accents { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 6px 0 10px; }
.aswatch, .lcolors .swatch { width: 40px; height: 40px; }
.swatch:disabled, .achip:disabled { opacity: .5; cursor: not-allowed; }
.swatch.on { border-color: var(--text); box-shadow: inset 0 0 0 2px var(--card); }
.achip { min-height: 40px; padding: 0 14px; background: var(--card); border: 2px solid var(--line); font-weight: 800; cursor: pointer; clip-path: var(--cut-sm); color: var(--text); }
.achip.on { border-color: var(--accent); color: var(--accent); }
.lcolors .swatch.auto { background: var(--bar); color: var(--on-accent); font-weight: 900; font-size: 13px; }
.lcolors { gap: 8px; margin-top: 4px; }
