:root {
  --bg: #0E0F12; --bar: #121418; --card: #17191E; --card2: #1F2228; --line: #2A2E36; --line2: #22252C;
  --text: #F2EFE8; --muted: #A3A8B2; --soft: #C9CDD4;
  --gold: #D4B062; --gold-hi: #E6C77F; --on-gold: #1A1406; --gold-dim: #5C4B22; --gold-bg: #2a2314;
  --ok: #6FCF97; --ok-bg: #16261d; --warn: #E8B04B; --bad: #F08A7E; --bad-bg: #2a1714; --bad-line: #6B3A34;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif; }
body { min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.boot { min-height: 100vh; display: grid; place-items: center; }
.bootlogo { width: 220px; opacity: .9; }

/* header */
.top { position: sticky; top: 0; z-index: 5; background: var(--bar); border-bottom: 1px solid var(--line2); padding: calc(10px + var(--safe-t)) 16px 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.top .logo { height: 34px; width: auto; display: block; }
.housebtn { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-size: 14px; max-width: 58vw; }
.housebtn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--bad); } .dot.warn { background: var(--warn); }

main { padding: 16px 16px calc(96px + var(--safe-b)); max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
h1 { font-size: 24px; margin: 0; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0; font-weight: 600; }
h3 { font-size: 15px; margin: 0; font-weight: 600; }
.muted { color: var(--muted); } .small { font-size: 13px; } .tiny { font-size: 12px; }
.he { font-family: "Noto Sans Hebrew", "Arial Hebrew", sans-serif; }
.kicker { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.card.ok { border-color: #2c4a38; background: linear-gradient(0deg, var(--ok-bg), var(--ok-bg)); }
.card.bad { border-color: var(--bad-line); background: var(--bad-bg); }
.card.gold { border-color: var(--gold-dim); background: var(--gold-bg); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.tile .v { font-size: 18px; font-weight: 600; margin-top: 2px; }
.zm { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.zm div { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.zm b { display: block; font-size: 17px; font-weight: 600; }

.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line2); text-align: left; background: none; border-left: 0; border-right: 0; border-bottom: 0; width: 100%; }
.item:first-child { border-top: 0; }
.item .t { min-width: 76px; font-variant-numeric: tabular-nums; color: var(--gold); font-weight: 600; font-size: 14px; }
.item .b { flex: 1; min-width: 0; }
.item .b .s { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.item .chev { color: var(--muted); }
.devlist { margin: 4px 0 6px 88px; color: var(--soft); font-size: 13px; display: flex; flex-direction: column; gap: 3px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chip { flex: none; min-height: 44px; padding: 6px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); text-align: left; font-size: 13px; line-height: 1.2; }
.chip b { display: block; font-size: 14px; }
.chip[aria-pressed=true] { border-color: var(--gold); background: var(--gold-bg); }
.chip.kodesh b { color: var(--gold); }

.btn { min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--card2); font-weight: 600; font-size: 15px; cursor: pointer; }
.btn.primary { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }
.btn.danger { background: var(--bad-line); border-color: var(--bad-line); color: #fff; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; }
.link { background: none; border: 0; color: var(--gold); font-weight: 600; padding: 4px 0; font-size: 14px; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); color: var(--soft); white-space: nowrap; }
.badge.on { color: var(--gold); border-color: var(--gold-dim); }
.badge.ok { color: var(--ok); border-color: #2c4a38; } .badge.bad { color: var(--bad); border-color: var(--bad-line); }

label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
input, select, textarea { min-height: 46px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--text); width: 100%; }
textarea { padding: 10px 12px; min-height: 96px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
input[type=date], input[type=time], input[type=datetime-local] { color-scheme: dark; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opt { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); cursor: pointer; }
.opt input { width: 20px; min-height: 20px; margin: 2px 0 0; accent-color: var(--gold); flex: none; }
.opt.sel { border-color: var(--gold); background: var(--gold-bg); }

.seg { display: flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg button { flex: 1; border: 0; background: transparent; min-height: 44px; font-size: 14px; padding: 4px 6px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed=true] { background: var(--gold); color: var(--on-gold); font-weight: 600; }
.switch { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 10px 0; border-top: 1px solid var(--line2); }
.switch:first-child { border-top: 0; }
.toggle { position: relative; width: 50px; height: 30px; flex: none; border-radius: 999px; background: var(--line); border: 0; padding: 0; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--soft); transition: left .15s; }
.toggle[aria-checked=true] { background: var(--gold); }
.toggle[aria-checked=true]::after { left: 23px; background: var(--on-gold); }
.toggle:disabled { opacity: .45; }

/* tab bar */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: var(--bar); border-top: 1px solid var(--line2); display: flex; justify-content: space-around; padding: 6px 4px calc(6px + var(--safe-b)); }
.tabs button { flex: 1; max-width: 120px; background: none; border: 0; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11.5px; padding: 6px 0; min-height: 52px; }
.tabs button svg { width: 24px; height: 24px; }
.tabs button[aria-current=page] { color: var(--gold); }

/* sheets */
.scrim { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; background: var(--card); border: 1px solid var(--line); border-bottom: 0; border-radius: 20px 20px 0 0; padding: 18px 18px calc(18px + var(--safe-b)); display: flex; flex-direction: column; gap: 14px; }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: -6px auto 2px; }
@media (min-width: 700px) { .scrim { align-items: center; } .sheet { border-radius: 20px; border-bottom: 1px solid var(--line); } }

#toast { position: fixed; left: 50%; bottom: calc(88px + var(--safe-b)); transform: translateX(-50%); z-index: 30; background: var(--card2); border: 1px solid var(--gold-dim); padding: 10px 16px; border-radius: 12px; display: none; max-width: 90vw; font-size: 14px; }
.empty { text-align: center; padding: 28px 8px; color: var(--muted); }
.welcome { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; gap: 22px; padding: 32px 22px calc(32px + var(--safe-b)); max-width: 480px; margin: 0 auto; }
.welcome .logo { width: 240px; align-self: center; }
.spin { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: spin 1s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }
.search { min-height: 42px; }
.devrow { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line2); }
.devrow:first-child { border-top: 0; }
.devrow .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.devrow.off .n { color: var(--bad); text-decoration: line-through; }

/* voice */
.fab { position: fixed; right: 18px; bottom: calc(84px + var(--safe-b)); z-index: 6; width: 60px; height: 60px; border-radius: 50%; border: 0; background: var(--gold); color: var(--on-gold); box-shadow: 0 6px 20px rgba(0,0,0,.45); display: grid; place-items: center; }
.fab svg { width: 28px; height: 28px; }
.mic { flex: none; width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--gold-dim); background: var(--gold-bg); color: var(--gold); display: grid; place-items: center; }
.mic svg { width: 24px; height: 24px; }
.mic.on { background: var(--bad-line); border-color: var(--bad); color: #fff; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(240,138,126,.18); } }
/* questionnaire */
.period { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line2); }
.mp { display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 8px; }
.mpl { font-weight: 600; }
button.card { color: inherit; font: inherit; width: 100%; }

.sandbox-bar { position: sticky; top: 0; z-index: 4; background: #13202a; border-bottom: 1px solid #2d5470; color: #cfe6f7; padding: 8px 16px; font-size: 14px; text-align: center; }
