:root {
  --bg: #07090c; --panel: #0f1318; --panel2: #151a21; --line: #222932; --line2: #2c3440;
  --text: #e6e9ee; --muted: #8b95a3; --dim: #5d6773;
  --accent: #3b82f6; --accent-2: #1d4ed8; --ok: #22c55e; --warn: #f59e0b; --bad: #ef4444;
  --ok-bg: rgba(34,197,94,.12); --warn-bg: rgba(245,158,11,.12); --bad-bg: rgba(239,68,68,.12); --acc-bg: rgba(59,130,246,.12);
  --radius: 12px;
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-size: 14px; line-height: 1.45; }
a { color: var(--accent); }
button, input, select { font: inherit; color: inherit; }
code, .mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85em; }
[hidden] { display: none !important; }

/* ---------- auth screens ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background: radial-gradient(1200px 600px at 50% -10%, rgba(59,130,246,.10), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 1.8rem 1.6rem; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.brand { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.2rem; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--acc-bg); border: 1px solid rgba(59,130,246,.35); display: grid; place-items: center; }
.brand-mark svg { width: 18px; height: 18px; }
.brand h1 { font-size: 1.05rem; margin: 0; }
.brand small { display: block; color: var(--muted); font-size: .78rem; font-weight: 400; }
.auth-card p.lead { color: var(--muted); margin: 0 0 1rem; font-size: .9rem; }

/* ---------- forms ---------- */
label.f { display: block; margin-top: .85rem; font-size: .8rem; color: var(--muted); }
label.f > span { display: block; margin-bottom: .3rem; }
input[type=text], input[type=password], input[type=number], input[type=time], input[type=date], input[type=search], input[type=url], input[type=email], input[type=tel], select {
  width: 100%; background: var(--bg); border: 1px solid var(--line2); border-radius: 9px; padding: .6rem .7rem; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,.18); }
label.check { display: flex; gap: .55rem; align-items: flex-start; margin-top: .8rem; font-size: .88rem; cursor: pointer; }
label.check input { margin-top: .2rem; accent-color: var(--accent); }
.hint { color: var(--dim); font-size: .78rem; margin-top: .3rem; }
.err { color: #fca5a5; background: var(--bad-bg); border: 1px solid rgba(239,68,68,.35); border-radius: 9px; padding: .55rem .7rem; margin-top: .9rem; font-size: .85rem; }

button { cursor: pointer; border-radius: 9px; border: 1px solid transparent; padding: .55rem .95rem; font-weight: 500; transition: background .15s, border-color .15s, opacity .15s, transform .06s; }
button:active { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-2); }
.btn { background: var(--panel2); border-color: var(--line2); }
.btn:hover:not(:disabled) { border-color: #3a4452; }
.btn-danger { background: transparent; border-color: rgba(239,68,68,.5); color: #fca5a5; }
.btn-danger:hover:not(:disabled) { background: var(--bad-bg); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); }
.btn-sm { padding: .32rem .6rem; font-size: .8rem; }
.btn-block { width: 100%; margin-top: 1.2rem; padding: .7rem; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 1rem .7rem; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.side .brand { padding: 0 .4rem; }
.nav { display: flex; flex-direction: column; gap: 2px; margin-top: .4rem; }
.nav button { display: flex; align-items: center; gap: .65rem; width: 100%; text-align: left; background: transparent; color: var(--muted); border: none; padding: .55rem .65rem; }
.nav button svg { width: 17px; height: 17px; flex: none; opacity: .8; }
.nav button:hover { color: var(--text); background: var(--panel2); }
.nav button.active { color: var(--text); background: var(--acc-bg); }
.nav button.active svg { color: var(--accent); opacity: 1; }
.side-foot { margin-top: auto; padding: .6rem .4rem 0; border-top: 1px solid var(--line); font-size: .8rem; color: var(--muted); }
.side-foot .who { display: flex; justify-content: space-between; align-items: center; gap: .4rem; }
.main { padding: 1.4rem 1.6rem 3rem; max-width: 1200px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.page-head h2 { font-size: 1.3rem; margin: 0; letter-spacing: -.01em; }
.page-head p { color: var(--muted); margin: .2rem 0 0; font-size: .88rem; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.panel h3 { font-size: .95rem; margin: 0 0 .6rem; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; margin-bottom: .7rem; flex-wrap: wrap; }
.panel-head h3 { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }

.chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .7rem; margin-bottom: 1rem; }
.chip { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem 1rem; }
.chip .n { font-size: 1.6rem; font-weight: 650; line-height: 1.1; font-variant-numeric: tabular-nums; }
.chip .l { color: var(--muted); font-size: .78rem; margin-top: .2rem; }
.chip.bad .n { color: var(--bad); } .chip.ok .n { color: var(--ok); } .chip.warn .n { color: var(--warn); }

.pill { display: inline-flex; align-items: center; gap: .35rem; font-size: .74rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; background: var(--panel2); color: var(--muted); border: 1px solid var(--line2); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--ok); background: var(--ok-bg); border-color: rgba(34,197,94,.3); }
.pill.bad { color: var(--bad); background: var(--bad-bg); border-color: rgba(239,68,68,.3); }
.pill.warn { color: var(--warn); background: var(--warn-bg); border-color: rgba(245,158,11,.3); }
.pill.acc { color: #93c5fd; background: var(--acc-bg); border-color: rgba(59,130,246,.3); }
.pill.plain::before { display: none; }

.banner { border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: 1rem; font-weight: 600; display: flex; gap: .6rem; align-items: center; }
.banner.fire { background: var(--bad); color: #fff; animation: pulse 1.3s ease-in-out infinite; }
.banner.warn { background: var(--warn-bg); color: #fcd34d; border: 1px solid rgba(245,158,11,.35); font-weight: 500; }
@keyframes pulse { 50% { opacity: .78; } }

.site { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 1rem; overflow: hidden; }
.site-head { display: flex; align-items: center; gap: .7rem; padding: .85rem 1.1rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.site-head h3 { margin: 0; font-size: 1rem; }
.site-head .meta { color: var(--muted); font-size: .8rem; }
.site-body { padding: .9rem 1.1rem 1.1rem; }
.doors { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .6rem; }
.door { background: var(--panel2); border: 1px solid var(--line2); border-radius: 10px; padding: .75rem .8rem; display: flex; flex-direction: column; gap: .45rem; }
.door .top { display: flex; align-items: center; gap: .5rem; }
.door .ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--bg); border: 1px solid var(--line2); flex: none; }
.door .ico svg { width: 16px; height: 16px; }
.door .name { font-weight: 600; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.door .st { font-size: .76rem; color: var(--muted); }
.door.unlocked .ico { color: var(--ok); border-color: rgba(34,197,94,.4); }
.door.alarm { border-color: rgba(239,68,68,.55); background: linear-gradient(0deg, var(--bad-bg), var(--bad-bg)), var(--panel2); }
.door.alarm .ico, .door.alarm .st { color: var(--bad); }
.faults { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: .7rem; }
.empty { text-align: center; color: var(--muted); padding: 2.2rem 1rem; }
.empty svg { width: 36px; height: 36px; color: var(--dim); margin-bottom: .5rem; }

table { width: 100%; border-collapse: collapse; font-size: .85rem; }
th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--dim); font-weight: 600; padding: .5rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255,255,255,.015); }
.table-wrap { overflow-x: auto; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; margin-bottom: .8rem; }
.filters label.f { margin-top: 0; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: .7rem; color: var(--muted); font-size: .82rem; }

.steps { display: flex; flex-direction: column; gap: .35rem; margin-top: .5rem; }
.step { display: flex; gap: .6rem; align-items: center; font-size: .84rem; }
.step .msg { color: var(--muted); }
.code-big { font-family: ui-monospace, Menlo, monospace; font-size: 1.3rem; letter-spacing: .12em; background: var(--bg); border: 1px dashed var(--line2); border-radius: 10px; padding: .7rem; text-align: center; word-break: break-all; }
.keybox { font-family: ui-monospace, Menlo, monospace; font-size: .85rem; background: var(--bg); border: 1px solid var(--line2); border-radius: 9px; padding: .6rem; word-break: break-all; margin-top: .5rem; }

.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.65); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 1rem; z-index: 50; }
.modal { width: 100%; max-width: 460px; max-height: 92vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line2); border-radius: 16px; padding: 1.3rem 1.3rem 1.1rem; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.modal.wide { max-width: 640px; }
.modal h3 { margin: 0 0 .3rem; font-size: 1.05rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.2rem; flex-wrap: wrap; }

#toasts { position: fixed; bottom: 1rem; right: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 60; max-width: min(380px, calc(100vw - 2rem)); }
.toast { background: var(--panel2); border: 1px solid var(--line2); border-left: 3px solid var(--accent); border-radius: 10px; padding: .65rem .85rem; font-size: .86rem; box-shadow: 0 10px 30px rgba(0,0,0,.5); animation: tin .2s ease; }
.toast.ok { border-left-color: var(--ok); } .toast.bad { border-left-color: var(--bad); }
@keyframes tin { from { opacity: 0; transform: translateY(6px); } }
.spin { display: inline-block; width: 13px; height: 13px; border: 2px solid rgba(255,255,255,.25); border-top-color: #fff; border-radius: 50%; animation: sp .6s linear infinite; vertical-align: -2px; margin-right: .35rem; }
@keyframes sp { to { transform: rotate(360deg); } }

.mobile-top { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 250px; transform: translateX(-100%); transition: transform .2s ease; z-index: 40; box-shadow: 0 0 40px rgba(0,0,0,.6); }
  .side.open { transform: none; }
  .mobile-top { display: flex; align-items: center; gap: .6rem; padding: .7rem 1rem; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
  .mobile-top button { background: none; border: none; padding: .3rem; color: var(--text); }
  .mobile-top svg { width: 22px; height: 22px; }
  .main { padding: 1rem 1rem 3rem; }
  .hide-sm { display: none; }
}

.progress { height: 10px; background: var(--bg); border: 1px solid var(--line2); border-radius: 999px; overflow: hidden; margin-top: .8rem; }
.progress-fill { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.step-progress { margin: .35rem 0 .6rem; height: 8px; }
.progress.busy .progress-fill { width: 30%; animation: progress-slide 1.4s ease-in-out infinite; }
@keyframes progress-slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(340%); } }
@media (prefers-reduced-motion: reduce) { .progress.busy .progress-fill { animation: none; width: 100%; opacity: .45; } }
.serial-log { background: #04060a; border: 1px solid var(--line); border-radius: 10px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .76rem; color: #b6c2d1; height: 300px; overflow-y: auto; white-space: pre-wrap; word-break: break-all; padding: .6rem; margin-top: .6rem; }
.serial-log .dim { color: var(--dim); }
.banner.ok-banner { background: var(--ok-bg); color: #86efac; border: 1px solid rgba(34,197,94,.35); font-weight: 500; }

textarea.yaml { width: 100%; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8rem; background: var(--bg); color: var(--text); border: 1px solid var(--line2); border-radius: 9px; padding: .6rem; margin-top: .6rem; resize: vertical; }
.door-checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 1rem; }
.review-door.off > :not(label.check) { opacity: .35; pointer-events: none; }
.review-notes { margin: .6rem 0 0; padding-left: 1.1rem; }
.banner ul { margin: 0; padding-left: 1.1rem; }

/* ---------------- themes ---------------- */
:root[data-theme="blackout"] {
  --bg: #000; --panel: #050505; --panel2: #0b0b0b; --line: #161616; --line2: #222; --text: #f2f2f2; --muted: #8a8a8a; --dim: #555;
}
:root[data-theme="light"] {
  --bg: #f3f5f8; --panel: #fff; --panel2: #f0f2f5; --line: #dfe3e8; --line2: #cfd5dc; --text: #12161c; --muted: #5b6573; --dim: #8a93a0;
  --accent: #2563eb; --accent-2: #1d4ed8; --ok: #15803d; --warn: #b45309; --bad: #dc2626;
  --ok-bg: rgba(21,128,61,.1); --warn-bg: rgba(180,83,9,.1); --bad-bg: rgba(220,38,38,.08); --acc-bg: rgba(37,99,235,.08);
  color-scheme: light;
}
:root[data-theme="light"] .banner.warn { color: #92400e; }
:root[data-theme="light"] .pill.acc { color: #1d4ed8; }
:root[data-theme="light"] .serial-log { background: #0b1220; }
:root[data-theme="contrast"] {
  --bg: #000; --panel: #000; --panel2: #111; --line: #fff; --line2: #fff; --text: #fff; --muted: #e5e5e5; --dim: #bdbdbd;
  --accent: #ffd400; --accent-2: #ffbf00; --ok: #00ff6a; --warn: #ffd400; --bad: #ff3b3b;
}
:root[data-theme="contrast"] .btn-primary { color: #000; }
:root[data-theme="security"] {
  --bg: #020a05; --panel: #04140a; --panel2: #072011; --line: #0e3a1f; --line2: #145a2e; --text: #c8ffd9; --muted: #6fbf8b; --dim: #3f7d55;
  --accent: #22c55e; --accent-2: #16a34a;
}
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .5rem; }
.theme-swatch { display: flex; align-items: center; gap: .55rem; padding: .55rem .7rem; border: 1px solid var(--line2); border-radius: 10px; background: var(--panel2); color: var(--text); cursor: pointer; text-align: left; }
.theme-swatch.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.theme-swatch .sw { width: 22px; height: 22px; border-radius: 6px; border: 1px solid #555; flex: none; }
.theme-swatch[data-swatch="dark"] .sw { background: linear-gradient(135deg, #07090c 50%, #3b82f6 50%); }
.theme-swatch[data-swatch="blackout"] .sw { background: #000; }
.theme-swatch[data-swatch="light"] .sw { background: linear-gradient(135deg, #fff 50%, #2563eb 50%); }
.theme-swatch[data-swatch="contrast"] .sw { background: linear-gradient(135deg, #000 50%, #ffd400 50%); }
.theme-swatch[data-swatch="security"] .sw { background: linear-gradient(135deg, #020a05 50%, #22c55e 50%); }

/* ---------------- lockdown / monitor-only ---------------- */
.banner.lockdown { background: #7f1d1d; color: #fff; border: 1px solid #b91c1c; margin: .6rem 0; }
.door.lockdown { border-color: #b91c1c; background: rgba(185,28,28,.12); }
.door.monitor { border-style: dashed; }
.chip.clickable { cursor: pointer; }
.chip.clickable:hover { border-color: var(--accent); }

/* ---------------- tabs, people ---------------- */
.tabs { display: flex; gap: .3rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line); }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); padding: .55rem .9rem; cursor: pointer; font: inherit; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .6rem; }
.person-card { display: flex; gap: .75rem; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem; cursor: pointer; }
.person-card:hover { border-color: var(--accent); }
.person-card.off { opacity: .55; }
.avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex: none; background: var(--panel2); }
.avatar.ph { display: grid; place-items: center; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.avatar.big { width: 96px; height: 96px; font-size: 1.6rem; }
.person-head { display: flex; gap: 1rem; align-items: center; margin-bottom: .6rem; }
.photo-box { display: flex; flex-direction: column; gap: .35rem; align-items: center; }
.row.tight { gap: .25rem; margin-top: .25rem; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 .8rem; }
.check-grid label.check { margin-top: .4rem; }
textarea { width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line2); border-radius: 9px; padding: .5rem; font: inherit; }
h4 { margin: 1rem 0 .3rem; font-size: .85rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* ---------------- maps ---------------- */
.map-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .7rem; }
.map-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; }
.map-card img { width: 100%; height: 150px; object-fit: cover; display: block; background: #fff; }
.map-card > div { padding: .6rem .8rem; }
.map-stage { position: relative; margin-top: .8rem; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; user-select: none; }
.map-stage img { display: block; width: 100%; height: auto; }
.map-stage.editing img { cursor: crosshair; }
.map-pins { position: absolute; inset: 0; pointer-events: none; }
.pin { position: absolute; transform: translate(-50%, -50%); display: flex; align-items: center; gap: .3rem; pointer-events: auto; cursor: pointer;
  background: rgba(10,14,20,.85); color: #fff; border-radius: 999px; padding: .15rem .5rem .15rem .25rem; font-size: .72rem; white-space: nowrap; border: 1px solid rgba(255,255,255,.25); touch-action: none; }
.pin .dot { width: 12px; height: 12px; border-radius: 50%; background: #9ca3af; box-shadow: 0 0 0 2px rgba(255,255,255,.6); }
.pin.st-locked .dot, .pin.st-closed .dot, .pin.st-off .dot { background: #22c55e; }
.pin.st-unlocked .dot, .pin.st-open .dot, .pin.st-on .dot { background: #f59e0b; }
.pin.st-forced .dot, .pin.st-held .dot, .pin.st-fire .dot { background: #ef4444; animation: pulse 1s infinite; }
.pin.st-lockdown .dot { background: #7f1d1d; box-shadow: 0 0 0 2px #fca5a5; }
.pin.st-edit .dot { background: #3b82f6; }
.pin.input .dot { border-radius: 3px; }
.pin.aux .dot, .pin.output .dot { border-radius: 2px; transform: rotate(45deg); }
.pin.st-opening .dot, .pin.st-closing .dot { background: #f59e0b; animation: pulse 1s infinite; }
.pin.door { flex-direction: row; gap: .3rem; padding: .15rem .5rem .15rem .25rem; border-radius: 999px; background: rgba(10,14,20,.85); border: 1px solid rgba(255,255,255,.25); }   /* not the dashboard's .door tile */
.pin.sel { outline: 2px solid #3b82f6; outline-offset: 2px; z-index: 2; }
.pin-x { margin-left: .15rem; width: 1.1rem; height: 1.1rem; padding: 0; border: none; border-radius: 50%; background: #ef4444; color: #fff;
  font-size: .8rem; line-height: 1.1rem; text-align: center; cursor: pointer; flex: none; }
.pin-x:hover { background: #dc2626; }
.map-placed { margin-top: .8rem; }
.map-placed h4 { margin: 0; }
.map-placed tr.sel td { background: color-mix(in srgb, #3b82f6 14%, transparent); }
.map-placed input[type=text] { width: 100%; min-width: 10rem; }
.map-title { margin: 0; }
.legend { margin-left: auto; }

/* ---------------- integrations ---------------- */
.ha-steps { display: grid; gap: .8rem; }
.ha-step { border: 1px solid var(--line); border-radius: 10px; padding: .8rem; background: var(--panel2); }
.ha-step p { margin: .3rem 0 .6rem; }
.action-row { background: var(--panel2); }
a.btn, a.btn-primary { text-decoration: none; display: inline-flex; align-items: center; }
.floor-switch { display: flex; gap: .3rem; flex-wrap: wrap; }
.floor-switch .on { border-color: var(--accent); color: var(--accent); }
textarea.mono, input.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8rem; word-break: break-all; }
/* help */
.help-tip { display: inline-flex; align-items: center; justify-content: center; width: 1.25rem; height: 1.25rem; margin-left: .4rem; padding: 0; border-radius: 50%; border: 1px solid var(--line2); background: var(--bg); color: var(--muted); font-size: .75rem; font-weight: 700; cursor: pointer; vertical-align: middle; }
.help-tip:hover { color: var(--text); border-color: var(--accent); }
.help-box p { line-height: 1.5; }
.help-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .8rem 1.2rem; }
.help-cols ul { margin: .3rem 0 0; padding-left: 1.1rem; }
.help-cols li { margin: .15rem 0; }
.guide-steps { padding-left: 1.3rem; }
.guide-steps li { margin: .55rem 0; }
.help-topic { border-top: 1px solid var(--line); padding-top: .6rem; margin-top: .6rem; }
.help-topic h4 { margin: 0 0 .2rem; }
figure.diagram { margin: 1rem 0 0; }
figure.diagram img, .layout-img { width: 100%; height: auto; background: #fff; border-radius: 10px; border: 1px solid var(--line2); }
figure.diagram figcaption { font-size: .8rem; color: var(--muted); margin-top: .3rem; }
.layout-view { display: grid; gap: .8rem; }
.err-text { color: var(--bad, #ef4444); }
/* inline icons default to text size unless a component sizes them */
.banner > svg, .btn > svg, .btn-primary > svg, .btn-sm > svg, button > svg { width: 1.1em; height: 1.1em; flex: none; vertical-align: -0.15em; }

/* Home Assistant entity search */
.ha-picker { margin: -.2rem 0 .6rem; }
.ha-ent-list { display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow-y: auto; margin-top: .3rem; border-radius: 8px; }
.ha-ent-list.tall { max-height: 55vh; }
.ha-ent-list:empty { display: none; }
.ha-ent { display: flex; align-items: center; gap: .6rem; width: 100%; text-align: left; padding: .4rem .6rem; border: 1px solid var(--line2); border-radius: 8px;
  background: var(--panel2); color: inherit; cursor: pointer; font: inherit; }
.ha-ent:hover, .ha-ent:focus-visible { border-color: var(--acc, #3b82f6); }
.ha-ent-ico { width: 1.4rem; text-align: center; flex: none; opacity: .8; }
.ha-ent-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ha-ent-main > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ha-ent-side { flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* lockdown areas */
.area-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .7rem; }
.area-chip { display: flex; align-items: center; gap: .5rem; padding: .35rem .6rem; border: 1px solid var(--line2); border-radius: 10px; background: var(--panel2); }
.area-chip.armed { border-color: #b45309; }
.area-chip.alarm { border-color: rgba(239,68,68,.7); background: var(--bad-bg); color: var(--bad); }
.area-form h4 { margin: .9rem 0 .3rem; }
.io-picker { gap: .4rem; flex-wrap: wrap; }
.sensor-row { gap: .4rem; flex-wrap: wrap; margin-bottom: .3rem; }
