:root {
  --bg: #0a2a63; --bg-2: #0d3578; --panel: rgba(255,255,255,.055); --panel-2: rgba(255,255,255,.10);
  --ink: #eef9ff; --ink-2: #b9dcf0; --line: rgba(176,228,255,.38); --line-2: rgba(176,228,255,.18);
  --accent: #7fe3ff; --accent-ink: #052a52; --amber: #ffbd3d; --amber-glow: rgba(255,189,61,.55); --ok: #6df0b0; --danger: #ff7b7b;
  --grid-minor: rgba(176,228,255,.07); --grid-major: rgba(176,228,255,.13);
  --head: "Bahnschrift", "Arial Narrow", "Roboto Condensed", sans-serif-condensed, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Roboto Mono", "SF Mono", Menlo, Consolas, monospace;
  --body: system-ui, "Google Sans", Roboto, -apple-system, "Segoe UI", sans-serif;
  --nav-h: 64px; --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #e9f3fb; --bg-2: #ffffff; --panel: rgba(255,255,255,.85); --panel-2: #ffffff;
  --ink: #0a2a63; --ink-2: #3d5f8f; --line: rgba(10,42,99,.45); --line-2: rgba(10,42,99,.18);
  --accent: #0a6aa8; --accent-ink: #ffffff; --amber: #b86b00; --amber-glow: rgba(255,170,30,.55); --ok: #0a8a55; --danger: #c52a2a;
  --grid-minor: rgba(10,42,99,.06); --grid-major: rgba(10,42,99,.11);
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--body); color: var(--ink); background-color: var(--bg); font-size: 16px; line-height: 1.4;
  background-image:
    linear-gradient(var(--grid-major) 1px, transparent 1px), linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    linear-gradient(var(--grid-minor) 1px, transparent 1px), linear-gradient(90deg, var(--grid-minor) 1px, transparent 1px);
  background-size: 96px 96px, 96px 96px, 24px 24px, 24px 24px; background-attachment: fixed;
  overscroll-behavior-y: contain;
}
.ic { display: inline-block; vertical-align: middle; flex: none; }
h1, h2, h3 { font-family: var(--head); text-transform: uppercase; letter-spacing: .06em; margin: 0; font-weight: 600; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.05rem; color: var(--accent); } h3 { font-size: 1rem; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; border-radius: 4px; }
.mono { font-family: var(--mono); font-size: .78rem; letter-spacing: .04em; color: var(--ink-2); }
.muted { color: var(--ink-2); } .small { font-size: .85rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* layout */
#app { min-height: 100%; display: flex; flex-direction: column; max-width: 720px; margin: 0 auto; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 12px 16px 10px;
  background: linear-gradient(var(--bg) 70%, transparent); backdrop-filter: blur(6px); }
.topbar .title { flex: 1; min-width: 0; }
.topbar .title h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .sub { display: block; }
.iconbtn { position: relative; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel);
  display: grid; place-items: center; color: var(--ink); }
.iconbtn:active { transform: scale(.94); }
.badge { position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--amber);
  color: #231600; font: 700 .7rem/18px var(--mono); text-align: center; }
main { flex: 1; padding: 4px 16px calc(var(--nav-h) + var(--safe-b) + 96px); animation: rise .28s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* bottom nav */
.tabbar { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; display: flex; justify-content: center;
  background: var(--bg); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
.tabbar-in { display: flex; width: 100%; max-width: 720px; }
.tab { flex: 1; height: var(--nav-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; color: var(--ink-2); font: 600 .68rem var(--head); letter-spacing: .1em; text-transform: uppercase; position: relative; }
.tab[aria-current="page"] { color: var(--accent); }
.tab[aria-current="page"]::before { content: ""; position: absolute; top: -1px; left: 22%; right: 22%; height: 3px; background: var(--accent); border-radius: 0 0 3px 3px; }
.tab .dot { position: absolute; top: 10px; left: calc(50% + 10px); width: 9px; height: 9px; border-radius: 50%; background: var(--amber); }
.fab { position: fixed; z-index: 25; right: max(16px, calc(50% - 344px)); bottom: calc(var(--nav-h) + var(--safe-b) + 16px); height: 56px; padding: 0 20px 0 16px;
  border-radius: 28px; border: 0; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; gap: 8px;
  font: 700 .95rem var(--head); letter-spacing: .08em; text-transform: uppercase; box-shadow: 0 6px 22px rgba(0,0,0,.35); }
.fab:active { transform: scale(.96); }

/* cards - blueprint corner ticks */
.card { position: relative; border: 1px solid var(--line); background: var(--panel); border-radius: 4px; padding: 14px; margin: 0 0 14px; }
.card::before, .card::after { content: ""; position: absolute; width: 10px; height: 10px; border: 2px solid var(--accent); pointer-events: none; }
.card::before { top: -2px; left: -2px; border-right: 0; border-bottom: 0; }
.card::after { bottom: -2px; right: -2px; border-left: 0; border-top: 0; }
.card > h2:first-child, .sect-h { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.sect-h { justify-content: space-between; margin: 18px 0 8px; }
.sect-h h2 { display: flex; align-items: center; gap: 8px; }
.card.alert { border-color: var(--amber); }
.card.alert::before, .card.alert::after { border-color: var(--amber); }
.figure { font: 500 .7rem var(--mono); letter-spacing: .12em; color: var(--ink-2); text-transform: uppercase; }

/* stat chips */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { border: 1px solid var(--line); background: var(--panel); border-radius: 4px; padding: 10px 8px; text-align: center; }
.stat b { display: block; font: 600 2rem/1.1 var(--head); }
.stat span { font: 600 .68rem var(--head); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.stat.hot { border-color: var(--amber); box-shadow: 0 0 18px -4px var(--amber-glow); } .stat.hot b { color: var(--amber); }

/* task rows */
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px dashed var(--line-2); min-height: 56px; }
.row:first-child { border-top: 0; }
.row .ri { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%; display: grid; place-items: center; flex: none; color: var(--accent); }
.row.over .ri { border-color: var(--amber); color: var(--amber); box-shadow: 0 0 12px -2px var(--amber-glow); }
.row .rt { flex: 1; min-width: 0; text-decoration: none; color: inherit; background: none; border: 0; text-align: left; padding: 0; }
.row .rt b { display: block; font-weight: 600; overflow-wrap: anywhere; }
.row .rt span { font-size: .85rem; color: var(--ink-2); }
.row .rt .due-over { color: var(--amber); font-weight: 600; }
.donebtn { width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--accent); background: transparent; color: var(--accent); display: grid; place-items: center; flex: none; }
.donebtn:active { background: var(--accent); color: var(--accent-ink); }
.pill { display: inline-block; font: 600 .68rem var(--mono); letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink-2); }
.pill.amber { border-color: var(--amber); color: var(--amber); } .pill.ok { border-color: var(--ok); color: var(--ok); }

/* buttons & forms */
.btn { min-height: 48px; padding: 0 18px; border-radius: 4px; border: 1px solid var(--accent); background: transparent; color: var(--accent);
  font: 700 .95rem var(--head); letter-spacing: .1em; text-transform: uppercase; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.block { width: 100%; } .btn:disabled { opacity: .5; }
.btn.small { min-height: 38px; padding: 0 12px; font-size: .8rem; }
.btn:active { transform: translateY(1px); }
.btns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
label.f { display: block; margin: 0 0 12px; }
label.f > span { display: block; font: 600 .72rem var(--head); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=url], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; background: rgba(0,0,0,.18); border: 1px solid var(--line); border-radius: 4px; color: var(--ink); }
:root[data-theme="light"] input, :root[data-theme="light"] select, :root[data-theme="light"] textarea { background: #fff; }
textarea { min-height: 84px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--ink-2); opacity: .7; }
.check { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 0; }
.check input { width: 24px; height: 24px; accent-color: var(--accent); flex: none; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hint { font-size: .8rem; color: var(--ink-2); margin: -6px 0 12px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.seg button { flex: 1; min-height: 44px; background: transparent; border: 0; border-right: 1px solid var(--line); color: var(--ink-2); font: 600 .85rem var(--head); letter-spacing: .08em; text-transform: uppercase; }
.seg button:last-child { border-right: 0; } .seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.error { color: var(--danger); font-weight: 600; margin: 8px 0; }

/* chips + template grid */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { min-height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid var(--line); background: transparent; color: var(--ink); display: inline-flex; align-items: center; gap: 6px; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.tcell { position: relative; min-height: 96px; border: 1px solid var(--line); background: var(--panel); border-radius: 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 8px 4px;
  text-align: center; color: var(--ink); font-size: .82rem; line-height: 1.2; }
.tcell[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent), 0 0 16px -4px var(--accent); }
.tcell[aria-pressed="true"]::after { content: "✓"; position: absolute; top: 4px; right: 7px; color: var(--accent); font-weight: 700; }
.tcell .ic { color: var(--accent); }

/* floor plan */
.plan { position: relative; padding: 14px; border: 3px double var(--line); border-radius: 2px; margin-bottom: 16px; background: rgba(255,255,255,.025); }
.plan-label { position: absolute; top: -9px; left: 14px; background: var(--bg); padding: 0 8px; }
.rooms { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0; border: 2px solid var(--ink); }
.room { position: relative; min-height: 118px; border: 1px solid var(--line); margin: -1px 0 0 -1px; padding: 12px; background: transparent; color: var(--ink); text-align: left; text-decoration: none; display: flex; flex-direction: column; justify-content: space-between; transition: background .2s, box-shadow .2s; }
.room:active { background: var(--panel-2); }
.room .rn { font: 600 1rem var(--head); letter-spacing: .06em; text-transform: uppercase; display: block; margin-top: 6px; overflow-wrap: anywhere; }
.room .ic { color: var(--accent); }
.room .rc { font: .72rem var(--mono); color: var(--ink-2); }
.room.alert { background: radial-gradient(circle at 30% 20%, var(--amber-glow), transparent 75%); box-shadow: inset 0 0 0 2px var(--amber), 0 0 26px -2px var(--amber-glow); z-index: 1; animation: glow 2.6s ease-in-out infinite; }
.room.alert .ic { color: var(--amber); }
.room.alert .rc { color: var(--amber); font-weight: 700; }
@keyframes glow { 50% { box-shadow: inset 0 0 0 2px var(--amber), 0 0 38px 2px var(--amber-glow); } }
.room.add { border-style: dashed; align-items: center; justify-content: center; color: var(--ink-2); }
.room .door { position: absolute; bottom: -2px; left: 40%; width: 22%; height: 3px; background: var(--bg); }

/* vehicles / assets */
.acard { display: flex; gap: 14px; align-items: center; text-decoration: none; color: inherit; }
.acard .big { width: 64px; height: 64px; border: 1px solid var(--line); border-radius: 50%; display: grid; place-items: center; color: var(--accent); flex: none; overflow: hidden; }
.acard .big img, .hero img { width: 100%; height: 100%; object-fit: cover; }
.acard b { font: 600 1.15rem var(--head); letter-spacing: .05em; text-transform: uppercase; display: block; }
.acard .glow { border-color: var(--amber); color: var(--amber); box-shadow: 0 0 16px -2px var(--amber-glow); }
.hero { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.hero .big { width: 84px; height: 84px; border: 1px solid var(--line); border-radius: 4px; display: grid; place-items: center; overflow: hidden; color: var(--accent); flex: none; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
.dl dt { font: 600 .72rem var(--head); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); padding-top: 3px; }
.dl dd { margin: 0; overflow-wrap: anywhere; }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px 12px; padding: 0 16px; scrollbar-width: none; }
.tabs button { flex: none; min-height: 44px; padding: 0 16px; background: transparent; border: 0; border-bottom: 3px solid transparent; color: var(--ink-2); font: 600 .9rem var(--head); letter-spacing: .1em; text-transform: uppercase; }
.tabs button[aria-selected="true"] { color: var(--accent); border-color: var(--accent); }
.photo { max-width: 100%; border: 1px solid var(--line); border-radius: 4px; display: block; margin-top: 8px; }

/* shopping */
.shop-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px dashed var(--line-2); }
.shop-item:first-of-type { border-top: 0; }
.shop-item.have { opacity: .6; }
.shop-item .st { flex: 1; min-width: 0; } .shop-item b { display: block; overflow-wrap: anywhere; }
.shop-total { font: 600 1.1rem var(--head); }

/* bars */
.bars { display: flex; align-items: flex-end; gap: 12px; height: 120px; padding-top: 8px; }
.bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; }
.bar i { display: block; width: 100%; max-width: 56px; background: var(--accent); border: 1px solid var(--accent); min-height: 2px; border-radius: 2px 2px 0 0; position: relative; }
.bar i u { display: block; width: 100%; background: var(--amber); text-decoration: none; }
.bar span { font: .72rem var(--mono); color: var(--ink-2); } .bar em { font: normal .75rem var(--mono); }
.legend { display: flex; gap: 14px; font: .72rem var(--mono); color: var(--ink-2); margin-top: 6px; } .legend i { display: inline-block; width: 10px; height: 10px; margin-right: 5px; }

/* sheet / modal */
.backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(2,12,32,.66); animation: fade .2s ease both; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 720px; max-height: 92vh; overflow-y: auto; background: var(--bg); border: 1px solid var(--line); border-bottom: 0; border-radius: 14px 14px 0 0;
  padding: 8px 16px calc(24px + var(--safe-b)); animation: slide .26s cubic-bezier(.2,.9,.3,1) both; }
.sheet .grab { width: 44px; height: 4px; border-radius: 2px; background: var(--line); margin: 4px auto 10px; }
.sheet-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 8px; }
@keyframes fade { from { opacity: 0; } } @keyframes slide { from { transform: translateY(40px); opacity: 0; } }

/* stamp */
.stamp-wrap { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; pointer-events: none; }
.stamp { width: 210px; height: 210px; border-radius: 50%; border: 6px double var(--ok); color: var(--ok); display: grid; place-items: center; text-align: center;
  font: 800 2.6rem/1 var(--head); letter-spacing: .12em; transform: rotate(-14deg); background: rgba(8,30,60,.55); animation: stamp 1.3s cubic-bezier(.2,1.4,.4,1) both; box-shadow: 0 0 40px rgba(109,240,176,.35); }
:root[data-theme="light"] .stamp { background: rgba(255,255,255,.8); }
.stamp small { display: block; font: 600 .75rem var(--mono); letter-spacing: .15em; margin-top: 6px; }
@keyframes stamp { 0% { transform: rotate(-14deg) scale(3.2); opacity: 0; } 35% { transform: rotate(-14deg) scale(.92); opacity: 1; } 48% { transform: rotate(-14deg) scale(1.04); } 60% { transform: rotate(-14deg) scale(1); } 85% { opacity: 1; } 100% { transform: rotate(-14deg) scale(1); opacity: 0; } }
.toast { position: fixed; z-index: 95; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 84px); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 4px; font-weight: 600; max-width: 90vw; animation: rise .25s ease both; }
.toast.err { background: var(--danger); color: #fff; }

/* auth + onboarding */
.auth { padding: 28px 18px 40px; max-width: 460px; margin: 0 auto; }
.logo { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; color: var(--accent); }
.logo h1 { font-size: 2.2rem; color: var(--ink); letter-spacing: .14em; }
.steps { display: flex; gap: 6px; margin: 8px 0 18px; } .steps i { flex: 1; height: 4px; background: var(--line-2); border-radius: 2px; } .steps i.on { background: var(--accent); }
.titleblock { margin-top: 26px; border: 1px solid var(--line); display: grid; grid-template-columns: 2fr 1fr 1fr; font: .66rem var(--mono); color: var(--ink-2); letter-spacing: .08em; text-transform: uppercase; }
.titleblock div { padding: 6px 8px; border-right: 1px solid var(--line); } .titleblock div:last-child { border: 0; }
.titleblock b { display: block; color: var(--ink); font-size: .8rem; }
.empty { text-align: center; padding: 22px 8px; color: var(--ink-2); } .empty .ic { color: var(--accent); margin-bottom: 6px; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 24px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.demo-banner { background: var(--amber); color: #231600; text-align: center; font: 700 .72rem var(--mono); letter-spacing: .08em; padding: 4px 8px; text-transform: uppercase; }
.offline-banner { background: var(--danger); color: #fff; text-align: center; font: 700 .75rem var(--mono); padding: 3px 8px; }
.list-btn { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; text-align: left; background: transparent; border: 0; border-top: 1px dashed var(--line-2); padding: 8px 0; color: inherit; text-decoration: none; }
.list-btn:first-child { border-top: 0; } .list-btn .grow { flex: 1; min-width: 0; }
.sugg { border: 1px dashed var(--amber); padding: 8px 10px; border-radius: 4px; margin-bottom: 8px; }
.sugg .pill { border-color: var(--amber); color: var(--amber); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
@media (min-width: 560px) { .rooms { grid-template-columns: repeat(3, 1fr); } }
@media print { .tabbar, .fab, .topbar { display: none; } }
