/* Ledgerly app shell. Wide = sidebar + top bar + 8/4 grid; narrow (phone) = app bar, single column,
   bottom tab bar with a centre "+" and bottom sheets for forms. Sizes use rem so the account text-size
   preference (html font-size) scales the whole app. Dark mode follows html.dark-theme. */
:root{
  --bg:#F3F6F4; --surface:#FFFFFF; --surface-2:#EEF4F1; --ink:#12201A; --muted:#5B6B64; --line:#DFE7E3;
  --accent:#0D6B4C; --accent-ink:#FFFFFF; --accent-soft:#DCEFE6; --accent-2:#3FA37E;
  --spend:#B8620F; --spend-soft:#FBEBD9; --good:#1E7A4F; --good-soft:#DDF2E6; --warn:#A35A00; --warn-soft:#FCEED6; --bad:#B23A3A; --bad-soft:#F8E1E1;
  --other:#9AA9A2; --scrim:rgba(10,20,16,.42);
  --display:"Outfit","Segoe UI",system-ui,sans-serif; --body:"Figtree","Segoe UI",system-ui,sans-serif;
  --r-sm:8px; --r-md:12px; --r-lg:16px;
  --shadow:0 1px 2px rgba(18,32,26,.05),0 4px 16px rgba(18,32,26,.04);
  color-scheme:light;
}
html.dark-theme{
  color-scheme:dark;
  --bg:#0D1512; --surface:#141F1B; --surface-2:#1A2823; --ink:#E6EFEA; --muted:#93A69D; --line:#26362F;
  --accent:#4CC497; --accent-ink:#06241A; --accent-soft:#183A2E; --accent-2:#2E8A68;
  --spend:#F0A253; --spend-soft:#3A2814; --good:#5CD39A; --good-soft:#163527; --warn:#F2B451; --warn-soft:#3A2B12; --bad:#F08A8A; --bad-soft:#3B1C1C;
  --other:#5E6F68; --scrim:rgba(0,0,0,.6); --shadow:0 1px 2px rgba(0,0,0,.3);
}
*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;background:var(--bg);color:var(--ink);font-family:var(--body);font-size:.875rem;line-height:1.5;-webkit-font-smoothing:antialiased}
h1,h2,h3{font-family:var(--display);margin:0;text-wrap:balance;font-weight:600}
p{margin:0}
a{color:inherit}
button,input,select,textarea{font:inherit;color:inherit}
button{cursor:pointer}
[hidden]{display:none!important}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:6px}
.num{font-variant-numeric:tabular-nums}
svg{display:block;flex:none}
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

.app{container:app/inline-size;position:relative;width:100%;height:100vh;height:100dvh;height:var(--app-h,100dvh);overflow:hidden;background:var(--bg)}
.boot{position:absolute;inset:0;display:grid;place-items:center;color:var(--muted);z-index:5;background:var(--bg)}

/* ---------- shell ---------- */
.shell{display:grid;grid-template-columns:236px minmax(0,1fr);height:100%}
.side{background:var(--surface);border-right:1px solid var(--line);padding:20px 14px;display:flex;flex-direction:column;gap:18px;overflow:auto}
.brand{display:flex;align-items:center;gap:10px;padding:0 6px;text-decoration:none;color:inherit}
.logo{width:34px;height:34px;border-radius:10px;background:var(--accent);display:grid;place-items:center;color:var(--accent-ink);overflow:hidden;flex:none}
.logo img{width:100%;height:100%;object-fit:contain;background:#fff}
.brand b{font-family:var(--display);font-size:1.25rem;font-weight:700;letter-spacing:-.01em;display:block;line-height:1.1}
.brand small{display:block;color:var(--muted);font-size:.72rem;font-weight:600}
.nav{display:flex;flex-direction:column;gap:2px}
.nav-label{font-size:.69rem;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);padding:12px 10px 6px;font-weight:600}
.nav button{display:flex;align-items:center;gap:12px;padding:9px 10px;border:0;background:none;border-radius:var(--r-sm);font-weight:500;color:var(--muted);text-align:left;width:100%}
.nav button:hover{background:var(--surface-2);color:var(--ink)}
.nav button[aria-current="page"]{background:var(--accent-soft);color:var(--accent);font-weight:600}
.nav .count{margin-left:auto;font-size:.75rem;background:var(--surface-2);color:var(--muted);padding:0 7px;border-radius:99px}
.side-foot{margin-top:auto;padding:14px;border-radius:var(--r-md);background:var(--surface-2);display:flex;flex-direction:column;gap:4px}
.side-foot b{font-size:.81rem}
.side-foot p{font-size:.78rem;color:var(--muted)}

.main{display:grid;grid-template-rows:auto minmax(0,1fr) auto;min-width:0;min-height:0;height:100%}
.top{display:flex;align-items:center;gap:12px;padding:12px 28px;border-bottom:1px solid var(--line);background:var(--surface);min-height:64px}
.top-title{display:none;align-items:center;gap:8px;min-width:0;font-family:var(--display);font-weight:600;font-size:1.06rem}
.top-title span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.top-title .logo{width:28px;height:28px;border-radius:8px}
.search{flex:1;max-width:520px;display:flex;align-items:center;gap:10px;border:1px solid var(--line);background:var(--bg);border-radius:10px;padding:8px 12px;color:var(--muted)}
.search input{border:0;background:none;outline:none;flex:1;min-width:0;color:var(--ink)}
.search kbd{font:600 .69rem var(--body);border:1px solid var(--line);border-radius:5px;padding:1px 5px;color:var(--muted)}
.top-right{margin-left:auto;display:flex;align-items:center;gap:10px}
.icon-btn{position:relative;border:1px solid var(--line);background:var(--surface);border-radius:10px;width:38px;height:38px;display:grid;place-items:center;flex:none;color:inherit}
.icon-btn:hover{border-color:var(--muted)}
.icon-btn.ghost{border-color:transparent;background:none}
.icon-btn .dot{position:absolute;top:-4px;right:-4px;background:var(--bad);color:#fff;font-size:.66rem;font-weight:700;min-width:18px;height:18px;padding:0 4px;border-radius:9px;display:grid;place-items:center;border:2px solid var(--surface)}
.only-narrow{display:none!important}
.me{display:flex;align-items:center;gap:10px;border:0;background:none;padding:4px;border-radius:10px}
.me:hover{background:var(--surface-2)}
.me .who{text-align:left;line-height:1.2;max-width:200px}
.me .who b{display:block;font-size:.84rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.me .who span{font-size:.75rem;color:var(--muted)}
.avatar{width:34px;height:34px;border-radius:50%;display:grid;place-items:center;font-weight:700;font-size:.78rem;flex:none;background:var(--accent);color:var(--accent-ink);overflow:hidden}
.avatar img{width:100%;height:100%;object-fit:cover}
.avatar.b{background:#E7D8F5;color:#5A2E86}
html.dark-theme .avatar.b{background:#3A2A4E;color:#E3CCFA}
.avatar.av-sm{width:26px;height:26px;font-size:.66rem}
.avatar.lg{width:52px;height:52px;font-size:1.06rem}
.stack{display:flex}
.stack .avatar{border:2px solid var(--surface);margin-left:-8px}
.stack .avatar:first-child{margin-left:0}

.scroll{overflow:auto;min-height:0;overscroll-behavior:contain}
.page{padding:28px;display:flex;flex-direction:column;gap:20px;max-width:1240px;margin:0 auto;width:100%}
.foot{color:var(--muted);font-size:.75rem;text-align:center;padding:4px 0 8px}
.foot a{color:inherit}

.tabbar{display:none;align-items:flex-end;justify-content:space-around;background:var(--surface);border-top:1px solid var(--line);padding:6px 6px calc(8px + env(safe-area-inset-bottom,0px))}
.tabbar button{border:0;background:none;display:flex;flex-direction:column;align-items:center;gap:2px;font-size:.69rem;font-weight:600;color:var(--muted);padding:4px 8px;min-width:58px;border-radius:10px}
.tabbar button[aria-current="page"]{color:var(--accent)}
.tabbar .fab{width:52px;height:52px;border-radius:16px;background:var(--accent);color:var(--accent-ink);display:grid;place-items:center;padding:0;min-width:0;margin-top:-22px;box-shadow:0 6px 18px rgba(13,107,76,.35)}

/* ---------- shared components ---------- */
.ph{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:space-between;gap:12px 20px}
.ph h1{font-size:1.69rem;letter-spacing:-.015em}
.ph p{color:var(--muted);margin-top:2px}
.eyebrow{font-size:.75rem;font-weight:600;color:var(--muted);letter-spacing:.02em}
.row{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;border-radius:10px;padding:9px 14px;font-weight:600;border:1px solid var(--line);background:var(--surface);white-space:nowrap;text-decoration:none;color:inherit}
.btn:hover{border-color:var(--muted)}
.btn.primary{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
.btn.primary:hover{filter:brightness(1.07)}
.btn.danger{color:var(--bad);border-color:var(--bad-soft);background:var(--surface)}
.btn.danger.solid{background:var(--bad);color:#fff;border-color:var(--bad)}
.btn.good{color:var(--good);border-color:var(--good-soft)}
.btn.block{width:100%}
.btn.sm{padding:6px 10px;font-size:.78rem;border-radius:8px}
.btn:disabled{opacity:.5;cursor:not-allowed}
.link{border:0;background:none;color:var(--accent);font-weight:600;font-size:.81rem;padding:0;text-decoration:none}
.link:hover{text-decoration:underline}
.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--r-lg);box-shadow:var(--shadow);min-width:0}
.card-h{display:flex;flex-wrap:wrap;align-items:center;gap:6px 12px;padding:16px 18px 0}
.card-h h2{font-size:1rem}
.card-h .meta{color:var(--muted);font-size:.78rem}
.card-h .right{margin-left:auto;display:flex;align-items:center;gap:10px}
.card-b{padding:14px 18px 18px}
.pill{display:inline-flex;align-items:center;gap:4px;font-size:.75rem;font-weight:600;padding:2px 8px;border-radius:99px;white-space:nowrap}
.pill.good{color:var(--good);background:var(--good-soft)}
.pill.warn{color:var(--warn);background:var(--warn-soft)}
.pill.bad{color:var(--bad);background:var(--bad-soft)}
.pill.neutral{color:var(--muted);background:var(--surface-2)}
.pill.accent{color:var(--accent);background:var(--accent-soft)}
.chips{display:flex;gap:8px;overflow-x:auto;padding-bottom:2px;scrollbar-width:none}
.chips::-webkit-scrollbar{display:none}
.chip{border:1px solid var(--line);background:var(--surface);border-radius:99px;padding:6px 13px;font-weight:600;font-size:.81rem;white-space:nowrap;color:var(--muted)}
.chip[aria-pressed="true"]{background:var(--ink);color:var(--surface);border-color:var(--ink)}
.seg{display:flex;background:var(--surface-2);border-radius:12px;padding:4px;gap:4px;overflow-x:auto;scrollbar-width:none}
.seg button{flex:1;border:0;background:none;padding:8px 10px;border-radius:9px;font-weight:600;color:var(--muted);white-space:nowrap;display:inline-flex;align-items:center;justify-content:center;gap:6px}
.seg button[aria-selected="true"]{background:var(--surface);color:var(--ink);box-shadow:var(--shadow)}
.seg button .n{font-size:.72rem;background:var(--accent-soft);color:var(--accent);border-radius:99px;padding:0 6px}
.seg.exp button[aria-selected="true"][data-v="expense"]{background:var(--spend);color:#fff}
.seg.exp button[aria-selected="true"][data-v="income"]{background:var(--accent);color:var(--accent-ink)}
.list{display:flex;flex-direction:column}
.li{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:12px;align-items:center;padding:12px 0;border-top:1px solid var(--line);color:inherit}
.li:first-child{border-top:0}
.li b{display:block;font-weight:600;overflow-wrap:anywhere}
.li .sm,.sm{font-size:.78rem;color:var(--muted)}
.li .end{display:flex;flex-direction:column;align-items:flex-end;gap:3px;text-align:right}
button.li,a.li{border-left:0;border-right:0;border-bottom:0;background:none;width:100%;text-align:left;text-decoration:none;font:inherit}
.li.unread{background:linear-gradient(90deg,var(--accent-soft),transparent 60%);border-radius:8px}
.ic-tile{width:40px;height:40px;border-radius:11px;display:grid;place-items:center;background:var(--accent-soft);color:var(--accent);flex:none;overflow:hidden}
.ic-tile img{width:100%;height:100%;object-fit:cover}
.ic-tile.spend{background:var(--spend-soft);color:var(--spend)}
.ic-tile.muted{background:var(--surface-2);color:var(--muted)}
.ic-tile.bad{background:var(--bad-soft);color:var(--bad)}
.ic-tile.sm{width:28px;height:28px;border-radius:8px}
.amt-in{color:var(--good);font-weight:700}
.amt-out{color:var(--spend);font-weight:700}
.empty{display:flex;gap:14px;align-items:center;flex-wrap:wrap;padding:16px;border:1px dashed var(--line);border-radius:var(--r-md);background:var(--bg)}
.empty .txt{flex:1;min-width:180px}
.empty .txt b{display:block}
.empty .txt p{color:var(--muted);font-size:.81rem}
.meter{height:8px;border-radius:4px;background:var(--surface-2);overflow:hidden;display:flex;gap:2px}
.meter i{display:block;height:100%}
.sw{width:9px;height:9px;border-radius:3px;display:inline-block}
.field{display:flex;flex-direction:column;gap:6px;min-width:0}
.field label,.field .label{font-size:.81rem;font-weight:600}
.field .hint{font-size:.75rem;color:var(--muted)}
.input{width:100%;border:1px solid var(--line);background:var(--bg);border-radius:10px;padding:10px 12px;min-height:44px;outline:none}
textarea.input{min-height:76px;resize:vertical}
.input:focus{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}
.money{position:relative}
.money span{position:absolute;left:12px;top:50%;transform:translateY(-50%);color:var(--muted);font-weight:600;pointer-events:none}
.money .input{padding-left:calc(18px + var(--sym,1ch));font-size:1.12rem;font-weight:600}
.form{display:flex;flex-direction:column;gap:14px}
.two{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px}
.check{display:flex;align-items:center;gap:8px;font-weight:600}
.check input{width:18px;height:18px;accent-color:var(--accent)}
.status{min-height:1.2em;font-size:.81rem;color:var(--muted)}
.status.error{color:var(--bad)}
.grid-2{display:grid;grid-template-columns:minmax(0,8fr) minmax(0,4fr);gap:20px;align-items:start}
.col{display:flex;flex-direction:column;gap:20px;min-width:0}
.stats{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.stats.four{grid-template-columns:repeat(4,minmax(0,1fr))}
.stat{padding:12px 14px;border-radius:var(--r-md);background:var(--bg);border:1px solid var(--line);min-width:0}
.stat .l{font-size:.78rem;color:var(--muted)}
.stat .v{font-family:var(--display);font-size:1.37rem;font-weight:600;overflow-wrap:anywhere}
.code{display:inline-flex;align-items:center;gap:6px;font-size:.78rem;color:var(--muted);border:0;background:none;padding:0}
.code b{font-variant-numeric:tabular-nums;letter-spacing:.06em;color:var(--ink);font-weight:600}
.code:hover b{color:var(--accent)}
.skeleton{color:var(--muted);padding:12px 0}

/* ---------- dashboard ---------- */
.hero{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,1fr);gap:20px 32px;padding:22px;align-items:center}
.hero .big{font-family:var(--display);font-size:2.5rem;font-weight:600;letter-spacing:-.02em;line-height:1.1}
.hero .lbl{font-size:.81rem;color:var(--muted);font-weight:500}
.hero .split{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:12px}
.hero .split div{display:flex;flex-direction:column}
.hero .split b{font-size:1.06rem}
.quick{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}
.quick button{display:flex;align-items:center;gap:10px;padding:12px;border-radius:var(--r-md);border:1px solid var(--line);background:var(--surface);font-weight:600;text-align:left}
.quick button:hover{border-color:var(--accent)}
.quick .ic-tile{width:34px;height:34px;border-radius:9px}
.cat{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:6px 12px;padding:10px 0;border-top:1px solid var(--line)}
.cat:first-child{border-top:0;padding-top:0}
.cat .bar{grid-column:1/-1;height:6px;border-radius:3px;background:var(--surface-2);overflow:hidden}
.cat .bar i{display:block;height:100%;border-radius:3px}
.cat .pct{color:var(--muted);font-size:.78rem;margin-right:6px}

/* ---------- pace chart ---------- */
.chart-b{display:flex;flex-direction:column;gap:12px}
.chart-wrap{width:100%}
.pace-chart{width:100%;height:auto;display:block;overflow:visible}
.pace-chart text{font-family:var(--body)}
.ch-grid{stroke:var(--line);stroke-width:1}
.ch-axis{fill:var(--muted);font-size:12px}
.ch-val{font-size:13px;font-weight:700}
.ch-ref{stroke:var(--muted);stroke-width:2;stroke-dasharray:6 6;opacity:.85}
.ch-today{stroke:var(--muted);stroke-width:1;stroke-dasharray:2 4}
.legend{display:flex;flex-wrap:wrap;gap:6px 16px;font-size:.78rem;color:var(--muted)}
.legend span{display:inline-flex;align-items:center;gap:7px}
.lg-line{display:inline-block;width:16px;height:3px;border-radius:2px}
.lg-dash{display:inline-block;width:16px;height:0;border-top:2px dashed var(--muted)}
.seg.seg-sm{padding:3px;border-radius:10px}
.seg.seg-sm button{padding:5px 10px;font-size:.78rem;border-radius:8px}
.callout{display:flex;gap:10px;align-items:flex-start;padding:12px 14px;border-radius:var(--r-md);background:var(--surface-2);color:var(--ink)}
.callout svg{margin-top:1px;color:var(--muted)}
.callout p{line-height:1.45}
.callout.warn{background:var(--warn-soft)}
.callout.warn svg{color:var(--warn)}
.callout.good{background:var(--good-soft)}
.callout.good svg{color:var(--good)}

/* ---------- room ---------- */
.room-hero{padding:18px;display:flex;flex-wrap:wrap;gap:14px;align-items:center}
.room-hero .t{flex:1;min-width:180px}
.room-hero h1{font-size:1.37rem;overflow-wrap:anywhere}
.trend{display:grid;grid-template-columns:1fr 1fr;gap:18px;align-items:end;height:170px;padding:0 6px}
.trend .b{display:flex;flex-direction:column;align-items:center;justify-content:flex-end;gap:6px;height:100%}
.trend .bar{width:min(84px,70%);border-radius:10px 10px 4px 4px;min-height:4px}
.trend b{font-size:.94rem}
.trend small{color:var(--muted);font-size:.75rem}
.bill-actions{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
.menu{position:relative}
.menu-pop{position:absolute;right:0;top:calc(100% + 6px);background:var(--surface);border:1px solid var(--line);border-radius:12px;box-shadow:0 12px 32px rgba(0,0,0,.14);padding:6px;min-width:200px;z-index:20;display:flex;flex-direction:column}
.menu-pop button{display:flex;align-items:center;gap:10px;border:0;background:none;padding:9px 10px;border-radius:8px;text-align:left;font-weight:500}
.menu-pop button:hover{background:var(--surface-2)}
.menu-pop .danger{color:var(--bad)}
.comment{padding:10px 0;border-top:1px solid var(--line)}
.comment:first-child{border-top:0}
.comment p{white-space:pre-wrap;overflow-wrap:anywhere;margin-top:2px}

/* ---------- finance ---------- */
.kpi3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));background:var(--surface);border:1px solid var(--line);border-radius:var(--r-lg);box-shadow:var(--shadow)}
.kpi3.two-up{grid-template-columns:repeat(2,minmax(0,1fr))}
.kpi3>div{padding:16px 18px;border-left:1px solid var(--line);display:flex;flex-direction:column;gap:2px;min-width:0}
.kpi3>div:first-child{border-left:0}
.kpi3 .l{font-size:.78rem;color:var(--muted);display:flex;align-items:center;gap:6px}
.kpi3 .v{font-family:var(--display);font-size:1.5rem;font-weight:600;overflow-wrap:anywhere}
.day{font-size:.75rem;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);padding:14px 0 4px;display:flex;justify-content:space-between}
.day:first-child{padding-top:0}
.del{border:0;background:none;color:var(--muted);padding:6px;border-radius:8px}
.del:hover{color:var(--bad);background:var(--bad-soft)}
.clock{display:flex;flex-wrap:wrap;gap:14px;align-items:center}
.clock .t{flex:1;min-width:180px}
.clock .elapsed{font-family:var(--display);font-size:1.5rem;font-weight:600}
.small-input{min-height:36px;padding:6px 10px;width:auto}

/* ---------- create ---------- */
.or{display:flex;align-items:center;gap:12px;color:var(--muted);font-size:.75rem;font-weight:700;letter-spacing:.08em}
.or::before,.or::after{content:"";flex:1;height:1px;background:var(--line)}
.create-grid{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);gap:20px;align-items:stretch}
.create-grid .or{flex-direction:column}
.create-grid .or::before,.create-grid .or::after{width:1px;height:auto;flex:1}

/* ---------- settings ---------- */
.set-row{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:12px 0;border-top:1px solid var(--line)}
.set-row:first-child{border-top:0;padding-top:0}
.set-row .sm{display:block}
.danger-card{border-color:var(--bad-soft)}
.danger-card h2{color:var(--bad)}
.range{display:flex;align-items:center;gap:12px}
.range input{flex:1;accent-color:var(--accent)}

/* ---------- sheets, toast, tour ---------- */
.layer{position:absolute;inset:0;z-index:50;background:var(--scrim);display:flex;align-items:center;justify-content:center;padding:24px}
.sheet{background:var(--surface);border-radius:18px;width:min(540px,100%);max-height:90%;overflow:auto;padding:20px;display:flex;flex-direction:column;gap:16px;animation:pop .18s ease-out}
.sheet-h{display:flex;align-items:center;gap:10px}
.sheet-h h2{font-size:1.19rem;overflow-wrap:anywhere}
.grab{display:none;width:40px;height:4px;border-radius:2px;background:var(--line);margin:-8px auto 0;flex:none}
.actions-list{display:flex;flex-direction:column;gap:8px}
.actions-list button{display:flex;align-items:center;gap:12px;padding:12px;border-radius:12px;border:1px solid var(--line);background:var(--surface);text-align:left}
.actions-list button:hover{border-color:var(--accent)}
.actions-list b{display:block}
@keyframes pop{from{transform:translateY(12px);opacity:.4}to{transform:none;opacity:1}}
.toast{position:absolute;left:50%;bottom:24px;transform:translateX(-50%);z-index:60;background:var(--ink);color:var(--surface);padding:10px 14px;border-radius:12px;display:flex;align-items:center;gap:14px;font-weight:500;box-shadow:0 10px 30px rgba(0,0,0,.25);max-width:calc(100% - 32px)}
.toast.error{background:var(--bad);color:#fff}
.toast button{border:0;background:none;color:var(--accent-2);font-weight:700}
.tour-block{position:absolute;inset:0;z-index:69;cursor:default}
.tour-ring{position:absolute;z-index:70;border:2px solid var(--accent-2);border-radius:14px;box-shadow:0 0 0 9999px var(--scrim),0 0 0 6px rgba(63,163,126,.25);pointer-events:none;transition:left .25s ease,top .25s ease,width .25s ease,height .25s ease}
.tour-card{position:absolute;z-index:71;background:var(--surface);color:var(--ink);border:1px solid var(--line);border-radius:16px;padding:16px;width:min(340px,calc(100% - 24px));box-shadow:0 18px 50px rgba(0,0,0,.28);display:flex;flex-direction:column;gap:10px;transition:left .25s ease,top .25s ease;outline:none}
.tour-dots{display:flex;gap:5px;flex-wrap:wrap}
.tour-dots i{width:7px;height:7px;border-radius:50%;background:var(--line)}
.tour-dots i.done{background:var(--accent-2)}
.tour-dots i.on{width:20px;border-radius:4px;background:var(--accent)}
.tour-keys{font-size:.72rem}
@media (hover:none){.tour-keys{display:none}}

/* ---------- container breakpoints ---------- */
@container app (max-width:1080px){
  .grid-2{grid-template-columns:minmax(0,1fr)}
  .stats.four{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@container app (max-width:760px){
  .shell{grid-template-columns:minmax(0,1fr)}
  .side{display:none}
  .tabbar{display:flex}
  .top{padding:10px 12px 10px 16px;min-height:56px;padding-top:calc(10px + env(safe-area-inset-top,0px))}
  .top-title{display:flex}
  .only-wide{display:none!important}
  .only-narrow{display:grid!important}
  .page{padding:16px 16px 24px;gap:16px}
  .ph h1{font-size:1.5rem}
  .hero{grid-template-columns:minmax(0,1fr);padding:18px;gap:14px}
  .hero .big{font-size:2.12rem}
  .quick{gap:8px}
  .quick button{flex-direction:column;text-align:center;font-size:.72rem;padding:10px 4px;gap:6px}
  .kpi3 .v{font-size:1.06rem}
  .kpi3>div{padding:12px}
  .create-grid{grid-template-columns:minmax(0,1fr)}
  .create-grid .or{flex-direction:row}
  .create-grid .or::before,.create-grid .or::after{height:1px;width:auto}
  .layer{align-items:flex-end;padding:0}
  .sheet{width:100%;border-radius:22px 22px 0 0;max-height:92%;padding:18px 16px calc(18px + env(safe-area-inset-bottom,0px));animation:up .22s ease-out}
  .grab{display:block}
  .toast{bottom:92px}
  .card-h{padding:14px 16px 0}
  .card-b{padding:12px 16px 16px}
  .room-hero .acts{width:100%}
  .room-hero .acts .btn{flex:1}
}
@keyframes up{from{transform:translateY(40%)}to{transform:none}}
@container app (max-width:420px){
  .two{grid-template-columns:minmax(0,1fr)}
  .stats.four{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media (prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}
/* on/off switch (room settings) */
.switch{position:relative;width:44px;height:26px;flex:none;display:inline-block}
.switch input{position:absolute;inset:0;opacity:0;margin:0;cursor:pointer;z-index:1}
.switch input:disabled{cursor:progress}
.switch i{position:absolute;inset:0;border-radius:99px;background:color-mix(in srgb,var(--muted) 45%,var(--line));transition:background .15s}
.switch i::after{content:"";position:absolute;top:3px;left:3px;width:20px;height:20px;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.2);transition:transform .15s}
.switch input:checked+i{background:var(--accent)}
.switch input:checked+i::after{transform:translateX(18px)}
.switch input:focus-visible+i{outline:2px solid var(--accent);outline-offset:2px}
.set-row>div:first-child{min-width:0}
