/* A Captive Life. Oxblood and brushed aluminum on warm ivory (light) or near-black (dark). Mobile first. */
@font-face { font-family: "Cormorant"; src: url("/fonts/cormorant.woff2") format("woff2"); font-weight: 500 700; font-display: swap; }
:root {
  --bg: #F6F1EA; --card: #FFFDF9; --ink: #1C1216; --muted: #6E5F63; --line: #E8DFD5; --chip: #F1E9DF; --chip-2: #E8DDD0;
  --accent: #8E1E33; --accent-2: #B0475A; --accent-ink: #FFF8F0; --accent-soft: #F5E4E2;
  --metal: #6B7480; --metal-soft: #E9ECEF;
  --good: #2F7D4F; --good-soft: #E4F2E8; --warn: #A8660C; --warn-soft: #FBEFD9; --bad: #B3261E; --bad-soft: #FBE5E2;
  --switch-off: #D9CFC4; --shadow: 0 1px 2px rgba(42,9,16,.05), 0 8px 24px rgba(42,9,16,.07);
  --radius: 18px; --nav-h: 64px; --logo-heart: var(--metal);
  --serif: "Cormorant", "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F0A0C; --card: #1A1215; --ink: #F4ECE6; --muted: #A8979A; --line: #2E2226; --chip: #241A1D; --chip-2: #2E2226;
    --accent: #D2566C; --accent-2: #E07A8B; --accent-ink: #1A0B0F; --accent-soft: #3A1520;
    --metal: #C9CED6; --metal-soft: #22262B;
    --good: #5CC98A; --good-soft: #13291C; --warn: #E7B15A; --warn-soft: #33250F; --bad: #FF6B61; --bad-soft: #3A1715;
    --switch-off: #3A2D31; --shadow: none;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15.5px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif; min-height: 100vh; overflow-x: hidden; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h1, .page-head h1, .serif { font-family: var(--serif); font-weight: 700; letter-spacing: 0; }
p { margin: 0; }
img, svg { max-width: 100%; }
.ic { width: 20px; height: 20px; flex: none; vertical-align: -4px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; border-radius: 10px; }
#view:focus { outline: none; }
[hidden] { display: none !important; }

.skip { position: absolute; left: -999px; top: 8px; z-index: 100; }
.skip:focus { left: 8px; }

/* ---------- Layout and navigation ---------- */
#view { max-width: 720px; margin: 0 auto; padding: calc(var(--safe-t) + 16px) 16px calc(var(--nav-h) + var(--safe-b) + 40px); }
body.has-savebar #view { padding-bottom: calc(var(--nav-h) + var(--safe-b) + 120px); }
body[data-route="signin"] #view { padding-bottom: 40px; }

.nav { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around; align-items: stretch;
  height: calc(var(--nav-h) + var(--safe-b)); padding: 0 6px var(--safe-b);
  background: color-mix(in srgb, var(--card) 86%, transparent); backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
  border-top: 1px solid var(--line); }
.nav a { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 11.5px; font-weight: 600; text-decoration: none; border-radius: 14px; }
.nav a .ic { width: 24px; height: 24px; }
.nav a.on { color: var(--accent); }
.nav .brand { display: none; }
.badge-dot { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 700; }
.live-dot { display: none; }

@media (min-width: 900px) {
  .nav { top: 0; right: auto; width: 240px; height: auto; flex-direction: column; justify-content: flex-start; gap: 4px; padding: calc(var(--safe-t) + 20px) 14px 20px; border-top: 0; border-right: 1px solid var(--line); }
  .nav a { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; font-size: 15px; padding: 11px 12px; }
  .nav a:hover { background: var(--chip); text-decoration: none; }
  .nav a.on { background: var(--accent-soft); }
  .nav .brand { display: flex; color: var(--ink); font-family: var(--serif); font-size: 24px; font-weight: 700; letter-spacing: .02em; margin-bottom: 14px; }
  .nav .brand:hover { background: none; }
  .badge-dot { position: static; margin-left: auto; }
  .live-dot { display: block; margin: auto 12px 0; width: 8px; height: 8px; border-radius: 50%; background: var(--switch-off); }
  .live-dot[data-state="on"] { background: var(--good); }
  body:not([data-route="signin"]) #view { margin-left: max(260px, calc(50vw - 360px + 120px)); padding-top: calc(var(--safe-t) + 32px); padding-bottom: 80px; }
  body.has-savebar #view { padding-bottom: 140px; }
}
.logo { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: radial-gradient(circle at 50% 35%, #7A1A2C, #2A0910); color: #C9CED6; flex: none; --logo-heart: #C9CED6; box-shadow: inset 0 0 0 1px rgba(201,206,214,.25); }
.logo svg { width: 22px; height: 22px; }

/* ---------- Headings ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 8px 2px 18px; }
.page-head h1 { font-size: 36px; font-weight: 700; line-height: 1.1; }
.page-head.with-back { align-items: center; justify-content: flex-start; }
.page-head.with-back h1 { font-size: 28px; }
.eyebrow { color: var(--metal); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .14em; margin-bottom: 2px; }
h2.sec { display: flex; align-items: center; gap: 8px; font-size: 12.5px; text-transform: uppercase; letter-spacing: .14em; color: var(--metal); font-weight: 700; margin: 26px 6px 9px; }
h3.sub-sec { font-size: 14px; margin: 16px 6px 8px; color: var(--muted); }
.count { background: var(--bad); color: #fff; border-radius: 999px; font-size: 11.5px; padding: 1px 8px; letter-spacing: 0; }
.note { color: var(--muted); font-size: 13.5px; margin: 8px 6px 0; }
.note.top { margin: -2px 6px 10px; }
.note.center, .center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tone-good { color: var(--good); } .tone-warn { color: var(--warn); } .tone-bad { color: var(--bad); }
.warn-note { display: flex; gap: 8px; align-items: flex-start; color: var(--warn); font-weight: 600; margin-bottom: 12px; }
.dim { opacity: .5; pointer-events: none; }
hr.soft { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }

/* ---------- Cards and rows ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 10px; }
.card.pad { padding: 16px; }
.pad { padding: 16px; }
.pad-x { padding: 12px 0 0; }
.list-card { padding: 0 16px; overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); min-height: 56px; width: 100%; color: inherit; text-align: left; }
.list-card > .row:first-child, .list-card > :first-child .row:first-child, .list-card > .muted + .row { border-top: 0; }
.row.block { display: block; }
.row.flush { border-top: 0; padding: 4px 0; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.row-main b { font-weight: 620; overflow-wrap: anywhere; }
.row-main small { color: var(--muted); font-size: 13px; line-height: 1.35; }
.row-ic { width: 36px; height: 36px; border-radius: 10px; background: var(--chip); display: grid; place-items: center; flex: none; color: var(--accent); }
.row-ic.tv { color: var(--accent-2); }
.row-emoji { width: 36px; height: 36px; border-radius: 10px; background: var(--chip); display: grid; place-items: center; flex: none; font-size: 18px; }
.row-btns { display: flex; gap: 6px; flex: none; align-items: center; }
.row-btns.center { justify-content: center; margin-top: 12px; }
.chev { color: var(--muted); opacity: .7; }
button.row, a.row { font: inherit; background: none; border: 0; border-top: 1px solid var(--line); border-radius: 0; cursor: pointer; text-decoration: none; }
.list-card > button.row:first-child, .list-card > a.row:first-child { border-top: 0; }
a.row.link:hover, button.row.link:hover { background: color-mix(in srgb, var(--chip) 50%, transparent); }
.row.danger, .row.danger .row-ic { color: var(--bad); }
.btns-row { gap: 8px; justify-content: flex-start; }
.add-row { gap: 8px; }
.add-row input { flex: 1; min-width: 0; }
.add-row.block { display: flex; flex-direction: column; align-items: stretch; }
.add-row-2 { display: flex; gap: 8px; }
.add-row-2 select { flex: 1; min-width: 0; }

/* ---------- Buttons ---------- */
button, .button { font: inherit; font-weight: 620; border: 0; background: var(--chip); color: var(--ink); border-radius: 12px; padding: 10px 14px; cursor: pointer; min-height: 42px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: transform .08s, background .15s, opacity .15s; text-decoration: none; line-height: 1.2; }
button:hover, .button:hover { background: var(--chip-2); text-decoration: none; }
button:active, .button:active { transform: scale(.97); }
button:disabled { opacity: .45; cursor: default; transform: none; }
button.busy { position: relative; color: transparent !important; }
button.busy::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--muted); border-top-color: transparent; animation: spin .8s linear infinite; }
.primary { background: var(--accent); color: var(--accent-ink); }
.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.ghost { background: transparent; border: 1px solid var(--line); }
.ghost:hover { background: var(--chip); }
.small { min-height: 36px; padding: 7px 12px; font-size: 14px; border-radius: 10px; }
.big { min-height: 52px; font-size: 16.5px; border-radius: 14px; width: 100%; }
.danger { color: var(--bad); }
.danger-solid { background: var(--bad); color: #fff; }
.danger-solid:hover { background: color-mix(in srgb, var(--bad) 88%, #000); }
.danger-soft { background: var(--bad-soft); color: var(--bad); }
.icon-btn { width: 42px; min-height: 42px; padding: 0; border-radius: 12px; background: transparent; color: var(--muted); flex: none; }
.icon-btn:hover { background: var(--chip); }
.icon-btn.danger { color: var(--bad); }
.text-btn { background: none; color: var(--accent); padding: 8px 4px; min-height: 36px; font-weight: 600; }
.text-btn:hover { background: none; text-decoration: underline; }
.text-btn.danger { color: var(--bad); }
.pill { border-radius: 999px; padding: 8px 14px; min-height: 40px; font-size: 14.5px; background: var(--chip); }
.pill .ic { width: 17px; height: 17px; }
.quick-row { display: flex; gap: 6px; }
.quick-row .pill { flex: 1 1 auto; padding: 8px 10px; min-width: 0; white-space: nowrap; }
.quick-row .pill[data-act=bonus] { flex: 0 0 auto; }
.quick-row.wrap { flex-wrap: wrap; }
.see-all { display: flex; align-items: center; justify-content: center; gap: 4px; font-weight: 600; font-size: 14px; margin: 4px 0 0; }
.add-tile { width: 100%; min-height: 56px; border: 1.5px dashed var(--line); background: transparent; color: var(--accent); border-radius: var(--radius); margin: 4px 0 10px; font-size: 15.5px; }
.add-tile:hover { background: var(--accent-soft); }
.add-tile.primary-tile { background: var(--accent); color: var(--accent-ink); border-style: solid; border-color: transparent; }
.chip-btn { border-radius: 999px; min-height: 36px; padding: 6px 12px; font-size: 14px; background: var(--card); border: 1px solid var(--line); font-weight: 600; }
.chip-btn.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.filter-chips, .ideas { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 6px; }
.ideas { margin: 4px 0 0; }

/* ---------- Badges and status ---------- */
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--chip); color: var(--muted); }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.status-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--chip); color: var(--ink); max-width: 100%; }
.status-pill.s-locked { background: #EAE6FF; color: #4B3BD6; }
.status-pill.s-free { background: var(--good-soft); color: var(--good); }
.status-pill.s-schedule { background: #E6EEFF; color: #3657C9; }
.status-pill.s-timesup { background: var(--bad-soft); color: var(--bad); }
.status-pill.s-left, .status-pill.s-nolimit { background: var(--accent-soft); color: var(--accent); }
@media (prefers-color-scheme: dark) {
  .status-pill.s-locked { background: #2A2457; color: #B7ACFF; }
  .status-pill.s-schedule { background: #1C2850; color: #A9BFFF; }
}

/* ---------- Avatars ---------- */
.avatar { display: inline-grid; place-items: center; border-radius: 50%; background: var(--c, var(--accent)); color: #fff; font-weight: 750; flex: none; letter-spacing: 0; }
.avatar.small { width: 32px; height: 32px; font-size: 14px; }
.mini-avatars { display: flex; }
.mini-avatars .avatar { margin-left: -6px; border: 2px solid var(--card); }

/* ---------- Home: kids ---------- */
.kids { display: grid; gap: 12px; }
@media (min-width: 640px) { .kids { grid-template-columns: 1fr 1fr; } }
.kid { padding: 14px; margin: 0; display: flex; flex-direction: column; gap: 12px; position: relative; overflow: hidden; }
.kid::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--c); }
.kid-head { display: flex; align-items: center; gap: 12px; background: none; padding: 0; min-height: 0; text-align: left; width: 100%; color: inherit; border-radius: 12px; }
.kid-head:hover { background: none; }
.kid-name { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.kid-name b { font-size: 19px; font-weight: 750; }
.kid-name small { color: var(--muted); font-size: 13px; font-weight: 500; }
.kid-body { display: flex; align-items: center; gap: 14px; }
.kid-stat { display: flex; flex-direction: column; gap: 4px; min-width: 0; align-items: flex-start; }
.kid-line { font-size: 14px; }
.setup-link { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; }
.dchips { display: flex; flex-wrap: wrap; gap: 6px; }
.dchip { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; background: var(--chip); border-radius: 999px; padding: 4px 10px 4px 8px; max-width: 100%; color: var(--muted); }
.dchip .ic { width: 14px; height: 14px; }
.dchip .dname { color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.dchip .dot, .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--switch-off); flex: none; display: inline-block; }
.dchip.on .dot, .dot.on { background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 25%, transparent); }
.dchip.stale .dot { background: var(--warn); }
.dbat.low { color: var(--bad); font-weight: 700; }

/* Ring */
.ring { position: relative; display: grid; place-items: center; flex: none; }
.ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 7; }
.ring .ring-bg { stroke: var(--chip-2); }
.ring .ring-fg { stroke-linecap: round; transition: stroke-dasharray .5s; }
.ring span { font-weight: 750; font-size: 14px; position: relative; }

/* Requests */
.req { display: flex; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); transition: opacity .3s; }
.reqs > .req:first-child { border-top: 0; }
.req.done { opacity: .4; }
.req.highlight { background: var(--accent-soft); margin: 0 -16px; padding: 14px 16px; }
.req-emoji { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; flex: none; background: color-mix(in srgb, var(--c) 16%, var(--card)); }
.req-main { flex: 1; min-width: 0; }
.req-title { font-weight: 650; overflow-wrap: anywhere; }
.req-sub { color: var(--muted); font-size: 13px; margin-top: 1px; overflow-wrap: anywhere; }
.req-result { font-size: 13px; margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.req-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.req-actions button { flex: 1 1 auto; }

/* Activity */
.events { list-style: none; margin: 0; padding: 0; }
.ev { display: flex; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.ev:first-child { border-top: 0; }
.ev-ic { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--chip); color: var(--c, var(--muted)); }
.ev-ic .ic { width: 16px; height: 16px; }
.ev-main { min-width: 0; flex: 1; }
.ev-text { font-size: 14.5px; overflow-wrap: anywhere; }
.ev-meta { color: var(--muted); font-size: 12.5px; }
.ev.note .ev-text { font-weight: 600; }
.ev.warn .ev-ic { background: var(--warn-soft); color: var(--warn); }
.ev.warn .ev-text { font-weight: 650; }
.ev.sos { background: var(--bad-soft); margin: 0 -16px; padding: 11px 16px; }
.ev.sos .ev-ic { background: var(--bad); color: #fff; }
.ev.sos .ev-text { color: var(--bad); font-weight: 750; }
.sos-banner { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius); background: var(--bad); color: #fff; margin-bottom: 12px; text-decoration: none; animation: sosPulse 2s ease-in-out infinite; }
.sos-banner:hover { text-decoration: none; }
.sos-banner div { flex: 1; display: flex; flex-direction: column; }
.sos-banner b { font-size: 17px; }
.sos-banner span { opacity: .9; font-size: 13.5px; }
.sos-banner .ic { width: 26px; height: 26px; }
@keyframes sosPulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--bad) 30%, transparent); } }

.welcome, .empty { text-align: center; padding: 28px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-emoji { font-size: 44px; line-height: 1; }
.welcome h2, .empty h2 { font-size: 21px; }
.welcome p, .empty p { color: var(--muted); max-width: 420px; }
.welcome .big { max-width: 320px; margin-top: 6px; }
.empty.small { padding: 20px; }
.empty-inline { text-align: center; color: var(--muted); }

/* ---------- Child page ---------- */
.child-head { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; }
.child-head .back { margin-left: -10px; }
.ch-title { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.ch-title h1 { font-size: 24px; font-weight: 780; line-height: 1.1; }
.ch-title .status-pill { font-size: 12px; padding: 2px 9px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 14px; padding: 2px 16px 4px; scroll-padding: 16px;
  position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 13px; border-radius: 999px; color: var(--muted); font-weight: 650; font-size: 14px; white-space: nowrap; background: var(--card); border: 1px solid var(--line); text-decoration: none; flex: none; }
.tabs a .ic { width: 16px; height: 16px; }
.tabs a.on { background: var(--ink); color: var(--bg); border-color: transparent; }
@media (min-width: 900px) { .tabs { top: 0; padding-top: 8px; } }

.today-hero { display: flex; align-items: center; gap: 18px; padding: 18px; }
.today-hero .ring span { font-size: 20px; }
.today-hero .ring circle { stroke-width: 6; }
.today-main { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; min-width: 0; }
.big-num { font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.big-num small { font-size: 15px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.plus { color: var(--good); }
.bar-row { align-items: flex-start; }
.bar-label { display: flex; justify-content: space-between; gap: 8px; }
.bar-label span { color: var(--muted); font-size: 13.5px; white-space: nowrap; }
.hbar { display: block; height: 8px; border-radius: 4px; background: var(--chip); margin: 6px 0 2px; overflow: hidden; }
.hbar i { display: block; height: 100%; border-radius: 4px; min-width: 4px; }
.app-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 750; flex: none; background: var(--c); font-size: 16px; }
.week-sum { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; gap: 8px; flex-wrap: wrap; }
.chart { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; height: 170px; align-items: stretch; }
.chart .col { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.col-val { font-size: 11px; color: var(--muted); height: 14px; white-space: nowrap; }
.col-track { position: relative; flex: 1; width: 100%; max-width: 34px; background: var(--chip); border-radius: 8px; overflow: hidden; }
.col-track .fill { position: absolute; left: 0; right: 0; bottom: 0; background: color-mix(in srgb, var(--accent) 55%, var(--card)); border-radius: 8px; min-height: 2px; }
.col.today .fill { background: var(--accent); }
.col-track .fill.over { background: var(--warn); }
.col-track .limit { position: absolute; left: -2px; right: -2px; height: 0; border-top: 2px dashed var(--muted); z-index: 1; opacity: .7; }
.col-day { font-size: 12px; color: var(--muted); font-weight: 600; }
.col.today .col-day { color: var(--ink); }
.chart-skel { height: 170px; border-radius: 12px; background: linear-gradient(90deg, var(--chip), var(--chip-2), var(--chip)); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Presets */
.presets { display: grid; gap: 10px; }
@media (min-width: 640px) { .presets { grid-template-columns: repeat(3, 1fr); } }
.preset-card { background: var(--card); border: 1.5px solid var(--line); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.preset-card.on { border-color: var(--accent); background: var(--accent-soft); }
.preset-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.preset-card p { color: var(--muted); font-size: 13.5px; flex: 1; }
.preset-card button { align-self: flex-start; }

/* Week editor */
.week { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.week-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.week-row > span { font-weight: 600; }
.week-row small { color: var(--muted); font-weight: 500; }
.week-row select { min-width: 132px; }
.week .text-btn { align-self: flex-start; }

/* Category rules */
.cat-rule { padding: 14px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.cat-rule:first-child { border-top: 0; }
.cat-top { display: flex; align-items: center; gap: 10px; }
.cat-top .row-emoji { width: 32px; height: 32px; font-size: 16px; }
.cat-rule .week { margin: 0 0 0 4px; padding-left: 12px; border-left: 2px solid var(--line); }

/* Segmented control */
.seg { display: flex; background: var(--chip); border-radius: 12px; padding: 3px; gap: 2px; }
.seg-opt { flex: 1; position: relative; min-width: 0; }
.seg-opt input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg-opt span { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 6px 8px; border-radius: 9px; font-weight: 650; font-size: 14px; color: var(--muted); text-align: center; line-height: 1.15; transition: background .15s; }
.seg-opt input:checked + span { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg-opt input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); }
.seg.small .seg-opt span { font-size: 13px; min-height: 32px; padding: 4px 6px; }
.center-seg { max-width: 280px; margin: 4px auto 8px; }

/* Switch */
.sw-row { justify-content: space-between; }
.sw-row select { max-width: 48%; }
input.switch { appearance: none; -webkit-appearance: none; flex: none; width: 51px; height: 31px; border-radius: 999px; background: var(--switch-off); position: relative; cursor: pointer; transition: background .2s; margin: 0; }
input.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .2s; }
input.switch:checked { background: var(--good); }
input.switch.red:checked { background: var(--bad); }
input.switch:checked::after { transform: translateX(20px); }
input.switch:disabled { opacity: .45; cursor: default; }
label.row-main { cursor: pointer; }

/* Fields */
input:not([type]), input[type=text], input[type=password], input[type=search], input[type=number], input[type=time], select, textarea {
  font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--chip); color: var(--ink); min-height: 44px; width: 100%; max-width: 100%; }
select { width: auto; padding-right: 30px; appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 14px; }
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input[type=range] { width: 100%; accent-color: var(--accent); min-height: 32px; }
input[type=checkbox]:not(.switch), input[type=radio] { accent-color: var(--accent); width: 20px; height: 20px; margin: 0; flex: none; }
.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span, .field > legend, .field .label { font-weight: 650; font-size: 14px; padding: 0; }
.field > span b { color: var(--accent); }
.field small { color: var(--muted); font-size: 12.5px; }
.field.inline { flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.form-err { color: var(--bad); font-weight: 600; font-size: 14px; }
.check-row { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.plain-input { background: transparent !important; border-color: transparent !important; font-weight: 700 !important; font-size: 17px !important; padding: 6px 8px !important; flex: 1; min-width: 0; }
.plain-input:focus { background: var(--chip) !important; border-color: var(--accent) !important; }
.sub-h { font-weight: 650; font-size: 14px; margin: 14px 0 8px; }

/* Schedules */
.sched { display: flex; flex-direction: column; gap: 12px; }
.sched-top { display: flex; align-items: center; gap: 8px; }
.times { display: flex; align-items: flex-end; gap: 8px; }
.times label { flex: 1; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 650; color: var(--muted); min-width: 0; }
.times input { font-weight: 700; font-size: 17px; text-align: center; }
.times .arrow { padding-bottom: 11px; color: var(--muted); }
.days { display: flex; gap: 5px; }
.days label { flex: 1; min-width: 0; }
.days input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.days span { display: grid; place-items: center; height: 38px; border-radius: 10px; background: var(--chip); font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; user-select: none; }
.days input:checked + span { background: var(--accent); color: var(--accent-ink); }
.days input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); }
.chips-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-pick { position: relative; }
.chip-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip-pick span { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 6px 11px; font-size: 13.5px; font-weight: 600; background: var(--chip); color: var(--muted); cursor: pointer; border: 1.5px solid transparent; }
.chip-pick input:checked + span { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.chip-pick input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); }
.chip-app { display: inline-flex; align-items: center; gap: 2px; border-radius: 999px; padding: 2px 4px 2px 11px; font-size: 13.5px; font-weight: 600; background: var(--accent-soft); color: var(--accent); }
.chip-app .x { min-height: 28px; width: 28px; padding: 0; border-radius: 50%; background: transparent; color: inherit; }
.chip-app .x .ic { width: 14px; height: 14px; }

/* Apps */
.toolbar { display: flex; flex-direction: column; gap: 8px; margin: 18px 0 10px; }
.search { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; flex: 1; }
.search input { border: 0; background: transparent; padding-left: 0; box-shadow: none !important; }
.search .ic { color: var(--muted); }
.app-sheet-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.app-sheet-head div { display: flex; flex-direction: column; min-width: 0; }
.app-sheet-head b { font-size: 18px; }
.app-sheet-head small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.radio-list { display: flex; flex-direction: column; gap: 6px; }
.radio-opt { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 14px; border: 1.5px solid var(--line); cursor: pointer; }
.radio-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio-opt span { display: flex; flex-direction: column; }
.radio-opt small { color: var(--muted); font-size: 13px; }
.radio-opt input { margin-top: 2px; }
.pick-list { display: flex; flex-direction: column; max-height: 50vh; overflow: auto; margin: 0 -4px 12px; }
.pick-row { display: flex; gap: 12px; align-items: center; padding: 10px 4px; border-top: 1px solid var(--line); cursor: pointer; }
.pick-row:first-child { border-top: 0; }
.pick-row span { display: flex; flex-direction: column; }
.pick-row small { color: var(--muted); font-size: 12.5px; }

/* Callouts */
.callout { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--accent-soft); font-size: 14px; margin-bottom: 10px; }
.callout .ic { flex: none; margin-top: 1px; }
.callout.warn { background: var(--warn-soft); color: color-mix(in srgb, var(--warn) 70%, var(--ink)); }
.callout.warn .ic { color: var(--warn); }
.callout.bad { background: var(--bad-soft); color: color-mix(in srgb, var(--bad) 70%, var(--ink)); }
.callout.bad .ic { color: var(--bad); }
.callout.good { background: var(--good-soft); color: color-mix(in srgb, var(--good) 60%, var(--ink)); }
.callout.good .ic { color: var(--good); }
.big-callout { font-size: 15.5px; padding: 16px; }

/* Map */
.map-card { overflow: hidden; position: relative; padding: 0; }
.map { height: min(56vh, 520px); min-height: 300px; background: var(--chip); z-index: 0; }
.map.short { height: 240px; min-height: 0; }
.map-over { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 500; background: var(--bad); color: #fff; font-weight: 700; font-size: 13px; padding: 6px 12px; border-radius: 999px; display: flex; align-items: center; gap: 8px; white-space: nowrap; box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.live-pulse { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.map-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 6px; }
.map-actions .pill { flex: 1 1 auto; background: var(--card); border: 1px solid var(--line); }
.map-hint { text-align: center; font-size: 13px; color: var(--muted); padding: 8px; border-top: 1px solid var(--line); }
.map-search { display: flex; gap: 8px; padding: 10px; border-bottom: 1px solid var(--line); }
.map-search .search { background: var(--chip); border-color: transparent; }
.results { border-bottom: 1px solid var(--line); max-height: 220px; overflow: auto; }
.result { display: flex; width: 100%; text-align: left; justify-content: flex-start; align-items: flex-start; gap: 8px; background: none; border-radius: 0; font-weight: 500; font-size: 14px; padding: 10px 14px; border-top: 1px solid var(--line); }
.result:first-child { border-top: 0; }
.map-dot-wrap { background: none; border: 0; }
.map-dot { width: 34px; height: 34px; border-radius: 50%; background: var(--c); color: #fff; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.35); display: grid; place-items: center; font-weight: 800; font-size: 12px; font-family: inherit; }
.map-dot.pulse { animation: dotPulse 1.6s infinite; }
@keyframes dotPulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c) 60%, transparent), 0 2px 8px rgba(0,0,0,.35); } 100% { box-shadow: 0 0 0 18px transparent, 0 2px 8px rgba(0,0,0,.35); } }
.place-tip { font-weight: 700; }
.leaflet-container { font: inherit; }
.leaflet-popup-content { font-size: 14px; line-height: 1.4; }
@media (prefers-color-scheme: dark) {
  .leaflet-tile-pane { filter: brightness(.82) contrast(1.1) saturate(.8); }
  .leaflet-popup-content-wrapper, .leaflet-popup-tip, .leaflet-bar a, .leaflet-tooltip { background: var(--card); color: var(--ink); border-color: var(--line); }
  .leaflet-control-attribution { background: rgba(21,25,39,.8) !important; color: var(--muted); }
  .leaflet-control-attribution a { color: var(--accent); }
}

/* Devices */
.device { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.dev-head { display: flex; align-items: center; gap: 12px; }
.dev-ic { width: 44px; height: 44px; border-radius: 13px; background: var(--chip); color: var(--muted); display: grid; place-items: center; flex: none; }
.dev-ic.on { background: var(--good-soft); color: var(--good); }
.dev-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dev-title b { font-size: 17px; }
.dev-title small { color: var(--muted); font-size: 13px; }
.dev-stats { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13.5px; }
.dev-stats span { display: inline-flex; align-items: center; gap: 6px; }
.health { border-radius: 14px; background: var(--chip); padding: 0 12px; }
.health summary { cursor: pointer; padding: 11px 0; font-weight: 650; font-size: 14px; list-style: none; display: flex; align-items: center; }
.health summary::-webkit-details-marker { display: none; }
.health summary::after { content: "›"; margin-left: auto; font-size: 20px; color: var(--muted); transform: rotate(90deg); transition: transform .2s; }
.health[open] summary::after { transform: rotate(-90deg); }
.health summary span { display: inline-flex; gap: 6px; align-items: center; }
.checklist { list-style: none; margin: 0; padding: 0 0 8px; }
.checklist li { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); align-items: flex-start; }
.checklist li > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.checklist small { color: var(--muted); font-size: 13px; }
.ck { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 800; font-size: 13px; background: var(--card); color: var(--muted); }
.ck .ic { width: 14px; height: 14px; stroke-width: 3; }
.checklist .ok .ck { background: var(--good); color: #fff; }
.checklist .warn .ck { background: var(--warn); color: #fff; }
.checklist .bad .ck { background: var(--bad); color: #fff; }
.checklist .bad b { color: var(--bad); }
.dev-actions { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.dev-actions .act { flex-direction: column; gap: 4px; font-size: 11.5px; padding: 10px 2px; min-height: 64px; border-radius: 14px; text-align: center; }
.dev-actions .act .ic { color: var(--accent); width: 22px; height: 22px; }
.dev-more { display: flex; flex-wrap: wrap; gap: 4px 14px; border-top: 1px solid var(--line); padding-top: 6px; }
.code-box { font: 800 52px/1 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .08em; text-align: center; padding: 22px 8px; border-radius: 18px; background: var(--accent-soft); color: var(--accent); margin-bottom: 14px; }
.code-box span { display: inline-block; width: .3em; }
.facts { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 10px; }
.facts li { display: flex; gap: 10px; align-items: flex-start; }
.facts .ic { color: var(--accent); margin-top: 1px; }

/* Enroll */
.enroll { display: flex; flex-direction: column; gap: 4px; }
@media (min-width: 760px) { .enroll { display: grid; grid-template-columns: 300px 1fr; gap: 12px; align-items: start; } .enroll .waiting, .enroll .row-btns, .enroll .callout { grid-column: 1 / -1; } }
.qr-card { padding: 16px; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.qr-wrap { background: #fff; border-radius: 16px; padding: 6px; width: 100%; max-width: 340px; }
.qr { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 12px; }
.steps li::marker { color: var(--accent); font-weight: 800; }
.steps.compact { gap: 6px; margin: 10px 0; }
.waiting { display: flex; align-items: center; gap: 10px; justify-content: center; color: var(--muted); font-weight: 600; }
.wifi-box { background: var(--chip); border-radius: 14px; padding: 12px; gap: 10px; }
.wifi-box summary { cursor: pointer; font-weight: 650; display: flex; gap: 8px; align-items: center; }
.wifi-box[open] summary { margin-bottom: 4px; }
.wifi-box input { background: var(--card); }

/* Rewards */
.bank-hero { display: flex; align-items: center; gap: 16px; padding: 18px; }
.bank-emoji { font-size: 40px; width: 64px; height: 64px; border-radius: 18px; background: var(--good-soft); display: grid; place-items: center; }
.amount { font-weight: 800; font-size: 15px; min-width: 64px; }
.amount.pos { color: var(--good); } .amount.neg { color: var(--bad); }

/* Auth */
.auth { min-height: calc(100vh - 80px); display: grid; place-items: center; }
.auth-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 14px; }
.auth-card h1 { font-size: 40px; text-align: center; letter-spacing: .03em; }
.auth-tagline { text-align: center; color: var(--muted); font-family: var(--serif); font-size: 19px; font-style: italic; margin-top: -8px; }
.auth-logo { width: 84px; height: 84px; border-radius: 24px; display: grid; place-items: center; margin: 12px auto 4px; background: radial-gradient(circle at 50% 35%, #7A1A2C, #2A0910); color: #C9CED6; box-shadow: 0 14px 40px rgba(90,16,32,.35), inset 0 0 0 1px rgba(201,206,214,.3); --logo-heart: #C9CED6; }
.auth-card .auth-logo svg { width: 44px; height: 44px; }
.auth-card form { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }

/* Add child sheet */
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.swatch span { display: block; width: 38px; height: 38px; border-radius: 50%; background: var(--c); cursor: pointer; box-shadow: inset 0 0 0 3px transparent; transition: box-shadow .15s; }
.swatch input:checked + span { box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--c); }
.swatch input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 4px; }
.preset-pick { display: flex; flex-direction: column; gap: 8px; }
.preset-opt { display: flex; gap: 12px; padding: 12px; border-radius: 14px; border: 1.5px solid var(--line); cursor: pointer; align-items: flex-start; }
.preset-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.preset-opt span { display: flex; flex-direction: column; gap: 2px; }
.preset-opt small { color: var(--muted); font-size: 13px; }
.tv-sub { display: flex; flex-direction: column; gap: 10px; padding: 4px 4px 6px 14px; margin: -2px 0 2px 10px; border-left: 2px solid var(--accent-soft); }
.tv-sub[hidden] { display: none; }
.tv-sub .sub-label { font-weight: 650; font-size: 14px; }
.tv-sub .callout { margin: 2px 0 0; }
.tv-sub .callout a { color: inherit; font-weight: 650; }
.tv-sub select { width: 100%; }
.row-main small.tv-who { display: flex; align-items: center; gap: 5px; }
.row-main small.tv-who .ic { width: 14px; height: 14px; flex: none; }
.row-main small.tv-who.on { color: var(--accent); font-weight: 600; }
.row-main small.tv-hint { color: var(--warn); }

/* ---------- Sheets ---------- */
dialog.sheet { border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 560px; max-height: calc(100dvh - 24px - var(--safe-t)); background: var(--card); color: var(--ink);
  border-radius: 24px 24px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,.25); animation: sheetUp .22s cubic-bezier(.2,.9,.3,1); overflow: hidden; }
dialog.sheet::backdrop { background: rgba(8,10,20,.45); animation: fade .2s; }
dialog.sheet.out { animation: sheetDown .18s ease-in forwards; }
dialog.sheet.out::backdrop { opacity: 0; transition: opacity .18s; }
.sheet-inner { display: flex; flex-direction: column; max-height: inherit; }
.sheet-head { position: relative; padding: 18px 56px 8px 20px; }
.sheet-head h2 { font-size: 19px; font-weight: 750; }
.grab { position: absolute; top: 7px; left: 50%; width: 38px; height: 5px; margin-left: -19px; border-radius: 3px; background: var(--line); }
.sheet-x { position: absolute; right: 8px; top: 8px; }
.sheet-body { padding: 8px 20px calc(20px + var(--safe-b)); overflow-y: auto; overscroll-behavior: contain; }
.sheet-text { color: var(--muted); margin-bottom: 14px; }
.sheet-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }
.sheet-actions > * { flex: 1; }
.sheet-actions .danger { flex: 0 0 auto; background: var(--bad-soft); }
.choices { display: flex; flex-direction: column; gap: 8px; }
.choice { justify-content: flex-start; text-align: left; gap: 12px; padding: 12px 14px; min-height: 54px; border-radius: 14px; }
.choice span { display: flex; flex-direction: column; }
.choice small { color: var(--muted); font-weight: 500; font-size: 13px; }
.choice .ic { color: var(--accent); }
.choice.danger .ic, .choice.danger b { color: var(--bad); }
@media (min-width: 640px) {
  dialog.sheet { margin: auto; border-radius: 24px; animation: pop .18s ease-out; }
  dialog.sheet.out { animation: fade .15s reverse forwards; }
  .grab { display: none; }
}
@keyframes sheetUp { from { transform: translateY(100%); } }
@keyframes sheetDown { to { transform: translateY(100%); } }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* ---------- Save bar ---------- */
.savebar { position: fixed; z-index: 40; left: 12px; right: 12px; bottom: calc(var(--nav-h) + var(--safe-b) + 10px); display: none; }
.savebar.show { display: block; animation: sheetUp .25s cubic-bezier(.2,.9,.3,1); }
.savebar-inner { max-width: 696px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line); border-radius: 18px; padding: 10px 10px 10px 16px; box-shadow: 0 10px 30px rgba(0,0,0,.22); }
.savebar-msg { font-weight: 650; min-width: 0; }
.savebar-msg.err { color: var(--bad); font-size: 14px; }
.savebar-btns { display: flex; gap: 8px; flex: none; }
@media (min-width: 900px) { .savebar { left: 260px; bottom: 16px; } }

/* ---------- Toasts and loading ---------- */
#toasts { position: fixed; z-index: 100; left: 0; right: 0; top: calc(var(--safe-t) + 10px); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 12px; }
.toast { display: flex; align-items: center; gap: 10px; max-width: 480px; background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 16px; font-weight: 600; font-size: 14.5px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25); transform: translateY(-20px); opacity: 0; transition: transform .25s, opacity .25s; pointer-events: auto; }
.toast.in { transform: none; opacity: 1; }
.toast .ic { color: var(--good); }
.toast.err .ic { color: var(--bad); }
.loading { display: grid; place-items: center; min-height: 40vh; }
.loading.small { min-height: 80px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; display: inline-block; }
.spinner.small { width: 18px; height: 18px; border-width: 2.5px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (max-width: 380px) {
  #view { padding-left: 12px; padding-right: 12px; }
  .tabs { margin: 0 -12px 14px; padding: 2px 12px 4px; }
  .page-head h1 { font-size: 26px; }
  .dev-actions { grid-template-columns: repeat(3, 1fr); }
  .week-row select { min-width: 116px; }
  .req.highlight, .ev.sos { margin: 0 -16px; }
}
.pill.danger-soft { background: var(--bad-soft); color: var(--bad); }

/* Security & privacy */
.tag { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; vertical-align: 2px; background: var(--chip); color: var(--muted); }
.tag.good { background: var(--good-soft); color: color-mix(in srgb, var(--good) 70%, var(--ink)); }
.tag.warn { background: var(--warn-soft); color: color-mix(in srgb, var(--warn) 70%, var(--ink)); flex: none; }
.codes { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.codes code, code.secret { font: 600 15px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; }
.codes li { background: var(--chip); border-radius: 10px; padding: 8px; text-align: center; }
code.secret { display: inline-block; background: var(--chip); border-radius: 10px; padding: 8px 12px; overflow-wrap: anywhere; user-select: all; }
.qr-wrap.small-qr { max-width: 220px; margin: 0 auto; }
.code-input { width: 100%; min-width: 0; box-sizing: border-box; font: 650 24px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .3em; text-align: center; }
.or-line { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.or-line::before, .or-line::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

/* ---------- Money ---------- */
.money-hero .ring span { font-size: 22px; }
.money-hero .ring circle { stroke-width: 6; }
.amt { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.row-top { display: flex; align-items: center; gap: 12px; }
.row.block .row-btns { margin-top: 10px; flex-wrap: wrap; }
.btn-link { display: flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; background: var(--accent); color: var(--accent-ink); font-weight: 700; }
a.link-callout { color: inherit; text-decoration: none; }
h2.sec .sec-btn { margin-left: auto; min-height: 30px; padding: 4px 10px; font-size: 13px; text-transform: none; letter-spacing: 0; }
.badge.warn { background: var(--warn-soft); color: color-mix(in srgb, var(--warn) 70%, var(--ink)); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .grid2 { grid-template-columns: 1fr; } }
.chip-check { position: relative; }
.chip-check input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip-check span { display: inline-flex; align-items: center; min-height: 34px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-size: 14px; font-weight: 600; }
.chip-check input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.chip-check input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip-check input:disabled + span { opacity: .75; }
.kind-pick { width: 100%; margin-top: 8px; }
.acct-pick { margin: 4px 2px 10px; }
.acct-pick select { max-width: 60%; }
.txn.flagged { box-shadow: inset 3px 0 0 var(--bad); padding-left: 10px; }
.txn-note { color: var(--ink) !important; }
.bills-sum { display: flex; gap: 16px; justify-content: space-between; flex-wrap: wrap; }
.bills-sum > div { display: flex; flex-direction: column; gap: 2px; }

/* Money categories: one colour each (bars, dots). Used as var(--cat-<color>). */
:root { --cat-groceries: hsl(145 52% 42%); --cat-eating: hsl(22 52% 42%); --cat-coffee: hsl(30 52% 42%); --cat-delivery: hsl(12 52% 42%); --cat-transport: hsl(205 52% 42%); --cat-car: hsl(220 52% 42%); --cat-shopping: hsl(290 52% 42%); --cat-clothing: hsl(315 52% 42%); --cat-household: hsl(95 52% 42%); --cat-health: hsl(170 52% 42%); --cat-care: hsl(335 52% 42%); --cat-fun: hsl(265 52% 42%); --cat-subs: hsl(250 52% 42%); --cat-games: hsl(275 52% 42%); --cat-housing: hsl(0 52% 42%); --cat-utilities: hsl(48 52% 42%); --cat-phone: hsl(190 52% 42%); --cat-insurance: hsl(230 52% 42%); --cat-kids: hsl(58 52% 42%); --cat-pets: hsl(36 52% 42%); --cat-gifts: hsl(350 52% 42%); --cat-travel: hsl(185 52% 42%); --cat-fees: hsl(355 52% 42%); --cat-cash: hsl(120 52% 42%); --cat-bars: hsl(40 52% 42%); --cat-gambling: hsl(5 52% 42%); --cat-smoke: hsl(25 52% 42%); --cat-transfers: hsl(210 12% 42%); --cat-income: hsl(140 52% 42%); --cat-other: hsl(30 12% 42%); }
@media (prefers-color-scheme: dark) { :root { --cat-groceries: hsl(145 60% 68%); --cat-eating: hsl(22 60% 68%); --cat-coffee: hsl(30 60% 68%); --cat-delivery: hsl(12 60% 68%); --cat-transport: hsl(205 60% 68%); --cat-car: hsl(220 60% 68%); --cat-shopping: hsl(290 60% 68%); --cat-clothing: hsl(315 60% 68%); --cat-household: hsl(95 60% 68%); --cat-health: hsl(170 60% 68%); --cat-care: hsl(335 60% 68%); --cat-fun: hsl(265 60% 68%); --cat-subs: hsl(250 60% 68%); --cat-games: hsl(275 60% 68%); --cat-housing: hsl(0 60% 68%); --cat-utilities: hsl(48 60% 68%); --cat-phone: hsl(190 60% 68%); --cat-insurance: hsl(230 60% 68%); --cat-kids: hsl(58 60% 68%); --cat-pets: hsl(36 60% 68%); --cat-gifts: hsl(350 60% 68%); --cat-travel: hsl(185 60% 68%); --cat-fees: hsl(355 60% 68%); --cat-cash: hsl(120 60% 68%); --cat-bars: hsl(40 60% 68%); --cat-gambling: hsl(5 60% 68%); --cat-smoke: hsl(25 60% 68%); --cat-transfers: hsl(210 14% 68%); --cat-income: hsl(140 60% 68%); --cat-other: hsl(30 14% 68%); } }
.cat-tag { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.cat-tag::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--cat-other)); flex: none; }
.row-emoji { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: color-mix(in srgb, var(--c, var(--chip-2)) 18%, var(--card)); font-size: 18px; }
.pace { display: block; margin-top: 4px; font-weight: 650; }
.pace b { color: var(--accent); }
details.counts { padding: 0 16px; }
details.counts summary { cursor: pointer; padding: 14px 0; font-weight: 650; list-style-position: inside; }
details.counts ul { margin: 0 0 14px; padding-left: 20px; font-size: 14px; }
details.counts li { margin: 3px 0; }
/* Bars: spending by category, with the budget as a line. */
.bars { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; }
.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: baseline; }
.bar-row .bar-name { font-weight: 650; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .bar-amt { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.bar-row > small { grid-column: 1 / -1; color: var(--muted); }
.bar { grid-column: 1 / -1; position: relative; height: 10px; border-radius: 6px; background: var(--chip); overflow: visible; }
.bar > i { position: absolute; inset: 0 auto 0 0; border-radius: 6px; background: var(--c, var(--accent)); max-width: 100%; }
.bar > i.over { background: var(--bad); }
.bar > b { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); border-radius: 1px; }
.sum-tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 10px; }
@media (min-width: 640px) { .sum-tiles { grid-template-columns: repeat(5, 1fr); } }
.sum-tiles .card { margin: 0; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.sum-tiles .card b { font-size: 19px; font-variant-numeric: tabular-nums; }
.sum-tiles .net { grid-column: 1 / -1; }
@media (min-width: 640px) { .sum-tiles .net { grid-column: auto; } }
.period-bar { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; flex-wrap: wrap; }
.period-bar .seg { flex: 0 1 220px; }
.period-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.period-nav b { min-width: 8.5em; text-align: center; font-variant-numeric: tabular-nums; }
.period-nav input[type=month] { width: auto; min-height: 36px; padding: 4px 8px; }
.trend { padding: 12px 16px 14px; }
.trend svg { width: 100%; height: auto; display: block; overflow: visible; }
.trend text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.trend .val { fill: var(--ink); font-weight: 700; }
.minis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 0 16px 14px; }
.mini { font-size: 13px; }
.mini svg { width: 100%; height: 34px; display: block; }
/* The bills calendar. */
.cal { padding: 10px 10px 12px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.cal-grid .dow { text-align: center; font-size: 11.5px; color: var(--muted); font-weight: 700; padding-bottom: 2px; }
.cal-day { min-height: 54px; border-radius: 9px; background: var(--chip); padding: 3px 4px; font-size: 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-day.empty { background: transparent; }
.cal-day.today { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal-day .n { font-weight: 700; color: var(--muted); }
.cal-bill { display: block; border-radius: 5px; padding: 1px 4px; font-size: 11px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--card); }
.cal-bill.paid { background: var(--good-soft); color: var(--good); }
.cal-bill.late { background: var(--bad-soft); color: var(--bad); }
.cal-bill.due { background: var(--warn-soft); color: color-mix(in srgb, var(--warn) 70%, var(--ink)); }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 4px 8px; }
.payday { display: flex; flex-direction: column; gap: 4px; }
.payday .big { font-size: 17px; font-weight: 700; }
.search-row { display: flex; gap: 8px; margin-bottom: 10px; }
.search-row .search { min-height: 44px; }
.search-row .search input { border: 0; background: transparent; padding: 8px 0; min-height: 40px; }
.search-row .search input:focus { outline: none; }
.search-row .search:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.active-filters { display: flex; gap: 6px; flex-wrap: wrap; margin: -2px 0 10px; }
.active-filters button { min-height: 30px; padding: 3px 10px; font-size: 13px; border-radius: 999px; background: var(--chip); border: 1px solid var(--line); }
.sub-row .row-btns { gap: 6px; }
.sub-row .row-btns button[aria-pressed=true] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.rule-row { display: flex; align-items: center; gap: 10px; }

/* A child's Money tab: its own row of smaller tabs inside the child's page. */
.tabs.sub-tabs { position: static; margin-top: -4px; }
.tabs.sub-tabs a { padding: 6px 11px; font-size: 13px; }
.add-row-2 .money-in { flex: 0 1 6.5em; min-width: 5em; }
.add-row-2 select { min-width: 8.5em; }

/* ---------- Tasks, rewards, consequences ---------- */
.task-note { margin: 6px 0 0; font-size: 14px; white-space: pre-line; }
.task-photo { display: block; margin: 8px 0 0; padding: 0; border: 0; background: none; border-radius: 12px; overflow: hidden; max-width: 220px; cursor: zoom-in; }
.task-photo img { display: block; width: 100%; height: auto; max-height: 220px; object-fit: cover; }
.task-photo-full { display: block; width: 100%; height: auto; border-radius: 12px; margin-bottom: 8px; }
.task-streak { font-weight: 650; margin-bottom: 10px; }
.task-grid { overflow-x: auto; margin: 0 -4px 8px; padding: 0 4px; }
.tg-row { display: grid; grid-template-columns: minmax(96px, 1fr) repeat(14, 22px) 46px; gap: 3px; align-items: center; min-width: 470px; padding: 3px 0; }
.tg-head { color: var(--muted); font-size: 11.5px; font-weight: 700; }
.tg-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.tg-cell { display: grid; place-items: center; height: 22px; border-radius: 6px; background: var(--chip); font-size: 12px; font-weight: 700; }
.tg-head .tg-cell { background: none; }
.tg-approved { background: var(--good-soft); color: var(--good); }
.tg-submitted, .tg-todo { background: var(--warn-soft); color: var(--warn); }
.tg-returned, .tg-missed { background: var(--bad-soft); color: var(--bad); }
.tg-streak { text-align: center; font-weight: 700; font-size: 13px; }
.points-hero { align-items: center; }
.points-hero > button { margin-left: auto; }
.points-num { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.points-num .ic { width: 30px; height: 30px; }
.pre-line { white-space: pre-line; }
.hard-limits-card { margin-top: 12px; border: 2px solid var(--bad); background: var(--bad-soft); }
.hl-title { display: flex; align-items: center; gap: 8px; font-weight: 750; color: var(--bad); margin-bottom: 6px; }
.hl-list { margin: 0; padding-left: 22px; }
.hl-list li { margin: 3px 0; }

/* ---------- Rules ---------- */
.status-pill.s-paused { background: var(--warn-soft); color: var(--warn); }
.status-pill.s-ended { background: var(--chip); color: var(--muted); }

/* ---------- A Captive Life: shell, safety, agreement, chat, journal ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.page-head .back { display: inline-flex; align-items: center; gap: 2px; font-size: 14px; font-weight: 600; margin: 0 0 6px -4px; }
.nav-safety { display: none; }
@media (min-width: 900px) {
  .nav-safety:not([hidden]) { display: flex; flex-direction: column; gap: 4px; margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); }
  .nav-safety .nav-side:last-child { color: var(--bad); }
}

/* Pause and Leave: big, plain, always easy to find. */
.safety-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 6px; }
@media (max-width: 380px) { .safety-row { grid-template-columns: 1fr; } }
.safety-btn { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 14px; text-align: left; border-radius: 18px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--ink); }
.safety-btn .ic { width: 26px; height: 26px; color: var(--warn); }
.safety-btn span { display: flex; flex-direction: column; min-width: 0; }
.safety-btn small { color: var(--muted); font-weight: 500; font-size: 12.5px; }
.safety-btn.leave .ic, .safety-btn.leave b { color: var(--bad); }
button.callout.link-callout { width: 100%; text-align: left; font: inherit; color: inherit; border: 0; cursor: pointer; }
.callout + .callout { margin-top: 8px; }

/* Agreement */
.sigs { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 6px 10px; font-size: 13.5px; }
.sig { display: inline-flex; align-items: center; gap: 4px; }
.sig .ic { width: 16px; height: 16px; }
.sig.ok { color: var(--good); }
.sig.wait { color: var(--warn); }
.pending-card .sigs { margin: 0; }
.agreement { display: flex; flex-direction: column; gap: 10px; }
.agreement h3 { font-size: 16px; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.hard-limits { border: 2px solid var(--bad); background: var(--bad-soft); }
.hard-limits h3, .hard-limits > h3 .ic { color: var(--bad); }
.hard-limits .ag-list li { font-weight: 650; }
.ag-list { margin: 6px 0 0; padding-left: 22px; }
.ag-list li { margin: 4px 0; }
.ag-q { margin: 2px 0 6px; padding-left: 18px; color: var(--muted); font-size: 14px; }
.ag-text { white-space: pre-line; overflow-wrap: anywhere; }
.share-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.share { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 14px; background: var(--chip); font-weight: 650; }
.share .ic { width: 18px; height: 18px; }
.share b { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.share.on { background: var(--accent-soft); color: var(--accent); }
.share.on b { color: var(--accent); }
.diff { display: flex; flex-direction: column; gap: 12px; }
.diff-block h4 { margin: 0 0 4px; font-size: 14px; }
.diff-block.strong { padding: 10px 12px; border-radius: 12px; border: 2px solid var(--bad); }
.diff-list { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.diff-list li { padding: 6px 10px; border-radius: 10px; }
.diff-list li.add, .dl.add { background: var(--good-soft); }
.diff-list li.del, .dl.del { background: var(--bad-soft); text-decoration: line-through; text-decoration-thickness: 1px; }
.diff-list li b { margin-right: 6px; text-decoration: none; display: inline-block; }
.diff-text { font-size: 14px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.dl { display: grid; grid-template-columns: 18px 1fr; gap: 4px; padding: 2px 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.dl > span:first-child { color: var(--muted); font-weight: 700; }
.list-edit { display: flex; flex-direction: column; gap: 8px; }
.list-edit .add-row { padding: 0; }
.ci-edit { margin-bottom: 10px; }
.page-actions { margin: 24px 0 8px; }

/* Home */
.quick-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 4px; }
.quick-links .pill { text-decoration: none; color: var(--ink); }
a.link-card { display: block; color: inherit; text-decoration: none; }
a.link-card:hover { text-decoration: none; }
.phone-card .phone-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.points-mini { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Messages */
.chat-page { display: flex; flex-direction: column; }
.chat { display: flex; flex-direction: column; gap: 6px; padding: 12px; min-height: 40vh; max-height: calc(100vh - 290px); max-height: calc(100dvh - 290px); overflow-y: auto; }
.chat-day { align-self: center; color: var(--muted); font-size: 12px; font-weight: 650; margin: 8px 0 2px; }
.chat-older { align-self: center; }
.bubble { max-width: 82%; padding: 8px 12px; border-radius: 18px; overflow-wrap: anywhere; }
.bubble p { white-space: pre-line; }
.bubble small { display: block; font-size: 11.5px; opacity: .75; margin-top: 2px; }
.bubble.mine { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 6px; }
.bubble.theirs { align-self: flex-start; background: var(--chip); border-bottom-left-radius: 6px; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }
.chat-form textarea { flex: 1; resize: none; min-height: 44px; }
.chat-form button { min-width: 48px; min-height: 44px; }

/* Journal, check-ins, review, consent */
.journal-list { display: flex; flex-direction: column; gap: 10px; }
.journal-entry.private { border: 1px dashed var(--line); }
.je-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.je-head .tag, .je-head > :last-child:not(:first-child) { margin-left: auto; }
.checkin-card { margin-bottom: 10px; }
.qa { margin: 0; }
.qa dt { font-weight: 650; font-size: 14px; margin-top: 8px; }
.qa dd { margin: 2px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.mood-seg .seg-opt span { font-size: 20px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.stat { display: flex; flex-direction: column; }
.stat b { font-size: 26px; font-weight: 780; }
.stat span { color: var(--muted); font-size: 13px; }
.week-nav { display: flex; justify-content: space-between; margin: -6px 0 12px; }
.invite-url code { display: block; padding: 10px 12px; border-radius: 12px; background: var(--chip); overflow-wrap: anywhere; font-size: 13.5px; }
.log-filter { margin: 10px 2px; }
.filter-chips { margin-bottom: 4px; }

/* ---------- Wallpaper & lock screen ---------- */
.wp-pick { margin-bottom: 10px; }
.wp-pick legend { margin-bottom: 10px; }
.wp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 10px; }
.wp-opt { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; min-width: 0; }
.wp-opt input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.wp-thumb { width: 100%; aspect-ratio: 9 / 20; border-radius: 12px; overflow: hidden; display: grid; place-items: center; background: var(--chip); border: 2px solid transparent; color: var(--muted); }
.wp-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wp-thumb.none { border: 2px dashed var(--line); }
.wp-label { font-size: 12.5px; font-weight: 600; color: var(--muted); text-align: center; }
.wp-opt input:checked + .wp-thumb { border: 2px solid var(--metal); box-shadow: 0 0 0 3px var(--metal-soft); }
.wp-opt input:checked ~ .wp-label { color: var(--ink); }
.wp-opt input:focus-visible + .wp-thumb { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }
.wp-upload.busy .wp-thumb { opacity: .5; }
.wp-ro { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.wp-ro .wp-thumb { width: 54px; flex: none; }
.lock-preview { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 4px 0 8px; }
.lock-phone { width: 168px; aspect-ratio: 9 / 20; border-radius: 22px; background: #0F0A0C center / cover no-repeat; border: 3px solid var(--metal); box-shadow: var(--shadow); color: #fff; display: flex; flex-direction: column; align-items: center; padding: 26px 12px; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.lock-phone.plain { background: linear-gradient(160deg, #3a3f46, #15171a); }
.lock-time { font-size: 38px; font-weight: 300; letter-spacing: .02em; line-height: 1; }
.lock-msg { margin-top: 10px; font-size: 11.5px; line-height: 1.3; text-align: center; overflow-wrap: anywhere; max-width: 100%; }
.save-bar { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }

/* Daily structure: free time items, an open "check in now", the place editor's map. */
.gate-items { list-style: none; padding-left: 0; }
.demand-card .stack { gap: 6px; flex: 1; min-width: 0; }
.demand-card .ag-text { font-size: 16px; font-weight: 600; }
.place-edit { margin-bottom: 14px; }
.place-edit .map.short { height: 260px; }

/* Camera station */
.two-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 4px; }
.two-btns button { min-height: 52px; min-width: 0; }
@media (max-width: 360px) { .two-btns { grid-template-columns: 1fr; } }
.st-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; margin-top: 10px; }
.st-photos button { position: relative; padding: 0; min-height: 0; border: 0; background: var(--chip); border-radius: 10px; overflow: hidden; aspect-ratio: 3 / 4; cursor: zoom-in; }
.st-photos img { display: block; width: 100%; height: 100%; object-fit: cover; }
.st-photos small { position: absolute; left: 4px; right: 4px; bottom: 4px; padding: 1px 5px; border-radius: 6px; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; font-weight: 650; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-video { display: block; width: 100%; max-height: 380px; margin-top: 10px; border-radius: 12px; background: #000; }
.st-listen { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.st-ln { display: flex; flex-direction: column; gap: 3px; padding: 8px 10px; border-radius: 12px; background: var(--chip); min-width: 0; }
.st-ln-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; }
.st-ln small { overflow-wrap: anywhere; }
.st-ln audio { width: 100%; height: 34px; margin-top: 4px; }
.st-full { display: block; width: 100%; height: auto; border-radius: 12px; }

/* Master (AI) */
.link-plain { all: unset; box-sizing: border-box; width: 100%; cursor: pointer; }
.link-plain:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.ms-run { margin-top: 8px; display: grid; gap: 8px; }
.ms-acts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ms-act { display: grid; gap: 3px; padding: 8px 10px; border-radius: 10px; background: var(--chip); overflow-wrap: anywhere; }
.ms-act small { font-size: 12.5px; }
.ms-text { margin: 0; font-size: 14px; white-space: pre-line; }
.ms-err { color: var(--bad); }
.ms-file { display: block; margin-top: 4px; font-size: 13.5px; white-space: pre-line; color: var(--ink); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.bubble-who { display: block; font-size: 11.5px; opacity: .8; margin-bottom: 2px; }
