/* SentinelX Cloud — app.css
   Swiss / International Typographic Style, matching sentinelx.systems:
   one grotesque (Inter Tight), a 12-column grid, hairline rules,
   black + white + one red. Light by default, with a dark theme. */

:root {
    --ink: #111111;
    --paper: #ffffff;
    --bg: #f6f6f4;
    --surface: #ffffff;
    --sunk: #efefed;
    --grey: #6b6b6b;
    --faint: #9a9a9a;
    --rule: #dedede;
    --rule-strong: #111111;
    --red: #e2231a;
    --red-tint: rgba(226, 35, 26, 0.08);
    --green: #17a34a;
    --green-tint: rgba(23, 163, 74, 0.1);
    --amber: #d98a00;
    --amber-tint: rgba(217, 138, 0, 0.12);
    --focus: #e2231a;
    --shadow: 0 24px 48px -24px rgba(0, 0, 0, 0.25);

    --f: "Inter Tight", "Helvetica Neue", Helvetica, Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    --max: 1320px;
    --gut: clamp(16px, 3vw, 40px);
    --gap: clamp(12px, 1.6vw, 20px);
    --ease: cubic-bezier(.16, 1, .3, 1);
    --top: 60px;
    color-scheme: light;
}

:root[data-theme="dark"] {
    --ink: #f2f2f0;
    --paper: #0b0b0b;
    --bg: #0b0b0b;
    --surface: #151515;
    --sunk: #1c1c1c;
    --grey: #a0a0a0;
    --faint: #6e6e6e;
    --rule: #2a2a2a;
    --rule-strong: #f2f2f0;
    --red: #ff4136;
    --red-tint: rgba(255, 65, 54, 0.14);
    --green: #2ecc6a;
    --green-tint: rgba(46, 204, 106, 0.14);
    --amber: #f2a93b;
    --amber-tint: rgba(242, 169, 59, 0.15);
    --shadow: 0 24px 48px -24px rgba(0, 0, 0, 0.8);
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 400 15px/1.5 var(--f);
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "ss01", "cv11";
}
img { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
::selection { background: var(--red); color: #fff; }

.logo-light { display: block; }
.logo-dark { display: none; }
[data-theme="dark"] .logo-light { display: none; }
[data-theme="dark"] .logo-dark { display: block; }

/* ── Type ─────────────────────────────────────────── */
.t-display { font-size: clamp(34px, 4.4vw, 56px); font-weight: 700; letter-spacing: -0.045em; line-height: 0.98; }
.t-h2 { font-size: clamp(22px, 2vw, 28px); font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; }
.t-h3 { font-size: 17px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.25; }
.t-label { font-size: 12px; font-weight: 500; color: var(--grey); letter-spacing: 0.01em; }
.t-label b { color: var(--ink); font-weight: 600; }
.t-muted { color: var(--grey); }
.t-small { font-size: 13px; }
.t-num { font-variant-numeric: tabular-nums; }
.t-mono { font-family: var(--mono); font-size: 12.5px; }
.t-red { color: var(--red); }
.t-green { color: var(--green); }

/* ── Top bar ──────────────────────────────────────── */
.topbar { position: sticky; top: 0; z-index: 50; height: var(--top); background: var(--paper); border-bottom: 1px solid var(--rule); }
.topbar-in { max-width: var(--max); height: 100%; margin: 0 auto; padding: 0 var(--gut); display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; text-decoration: none; flex: none; }
.brand img { height: 15px; width: auto; }
.brand-tag { margin-left: 10px; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; color: var(--red); }
.nav { display: flex; gap: 4px; height: 100%; }
.nav a { display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 100%; text-decoration: none; font-size: 14px; font-weight: 500; color: var(--grey); border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color 0.15s; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--red); }
.nav svg { width: 18px; height: 18px; display: none; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--rule); background: transparent; color: var(--ink); cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.icon-btn:hover { border-color: var(--ink); }
.icon-btn svg { width: 17px; height: 17px; }
.theme-btn .i-moon { display: none; }
[data-theme="dark"] .theme-btn .i-sun { display: none; }
[data-theme="dark"] .theme-btn .i-moon { display: block; }
.avatar { width: 36px; height: 36px; background: var(--ink); color: var(--paper); border: 0; font-weight: 600; font-size: 14px; cursor: pointer; }

.menu { position: relative; }
.menu-panel { position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; background: var(--surface); border: 1px solid var(--rule-strong); box-shadow: var(--shadow); padding: 6px 0; display: none; z-index: 60; }
.menu-panel.open { display: block; animation: pop 0.18s var(--ease); }
.menu-head { padding: 10px 16px 12px; border-bottom: 1px solid var(--rule); margin-bottom: 6px; }
.menu-head b { display: block; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.menu-panel a, .menu-panel button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 16px; font-size: 14px; text-decoration: none; background: none; border: 0; text-align: left; cursor: pointer; }
.menu-panel a:hover, .menu-panel button:hover { background: var(--sunk); }
.menu-panel .danger { color: var(--red); }
.menu-panel hr { border: 0; border-top: 1px solid var(--rule); margin: 6px 0; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }

/* ── Page ─────────────────────────────────────────── */
.page { max-width: var(--max); margin: 0 auto; padding: clamp(28px, 4vw, 48px) var(--gut) 96px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding-bottom: 20px; margin-bottom: 28px; border-bottom: 1px solid var(--rule-strong); }
.page-head .t-label { margin-bottom: 10px; }
.page-head .t-muted { margin-top: 10px; max-width: 48em; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.section { margin-top: 40px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 14px; }

/* ── Buttons ──────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border: 1px solid var(--ink); background: var(--ink); color: var(--paper); font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s; }
.btn:hover { background: var(--red); border-color: var(--red); color: #fff; }
.btn:disabled, .btn[aria-busy="true"] { opacity: 0.5; cursor: progress; }
.btn svg { width: 16px; height: 16px; }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn--ghost:hover { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn--red { background: var(--red); border-color: var(--red); color: #fff; }
.btn--red:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn--danger-ghost { background: transparent; color: var(--red); border-color: var(--rule); }
.btn--danger-ghost:hover { background: var(--red); border-color: var(--red); color: #fff; }
.btn--sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn--block { width: 100%; }
.link { background: none; border: 0; padding: 0; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--faint); cursor: pointer; font-size: inherit; }
.link:hover { color: var(--red); text-decoration-color: var(--red); }

/* ── Forms ────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: 16px; }
.field .seg, .field .daypick { align-self: flex-start; }
.field label, .field .t-label { font-size: 13px; font-weight: 500; color: var(--grey); }
.field-row { display: flex; justify-content: space-between; align-items: baseline; }
.input, .select, .textarea {
    width: 100%; height: 44px; padding: 0 12px; background: var(--surface); color: var(--ink);
    border: 1px solid var(--rule); border-radius: 0; font-size: 15px; transition: border-color 0.15s, box-shadow 0.15s;
    -webkit-appearance: none; appearance: none;
}
.textarea { height: auto; min-height: 110px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.select { padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--grey) 50%), linear-gradient(135deg, var(--grey) 50%, transparent 50%); background-position: calc(100% - 17px) 19px, calc(100% - 12px) 19px; background-size: 5px 5px; background-repeat: no-repeat; }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.input[aria-invalid="true"] { border-color: var(--red); }
.hint { font-size: 13px; color: var(--grey); }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 64px; }
.pw-toggle { position: absolute; right: 6px; top: 6px; height: 32px; padding: 0 10px; border: 0; background: none; color: var(--grey); font-size: 13px; font-weight: 500; cursor: pointer; }
.pw-toggle:hover { color: var(--ink); }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); margin: 1px 0 0; }

/* ── Alerts / notices ─────────────────────────────── */
.alert { padding: 12px 14px; border-left: 3px solid var(--ink); background: var(--sunk); font-size: 14px; line-height: 1.45; }
.alert.error { border-left-color: var(--red); background: var(--red-tint); }
.alert.ok { border-left-color: var(--green); background: var(--green-tint); }
.alert.warn { border-left-color: var(--amber); background: var(--amber-tint); }
.alert .link { margin-top: 6px; display: inline-block; }

/* ── Surfaces ─────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--rule); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--rule); }
.card-body { padding: 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--rule); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.grid { display: grid; gap: var(--gap); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* stat tiles */
.stat { border-top: 1px solid var(--rule-strong); padding-top: 12px; }
.stat b { display: block; font-size: clamp(28px, 3vw, 40px); font-weight: 600; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat span { display: block; margin-top: 8px; font-size: 13px; color: var(--grey); }

/* rows / lists */
.rows > * + * { border-top: 1px solid var(--rule); }
.row { display: flex; align-items: center; gap: 16px; padding: 14px 20px; }
.row-main { flex: 1; min-width: 0; }
.row-main b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.row-main span { display: block; font-size: 13px; color: var(--grey); overflow: hidden; text-overflow: ellipsis; }
.row-main .tag, .row-main .status { display: inline-flex; vertical-align: 2px; }
.row-main b .tag { margin-left: 6px; font-weight: 500; }
.kv { display: grid; grid-template-columns: minmax(120px, 1fr) 2fr; }
.kv > * { padding: 12px 0; border-top: 1px solid var(--rule); }
.kv > :nth-child(-n+2) { border-top: 0; }
.kv dt { color: var(--grey); font-size: 14px; }
.kv dd { margin: 0; text-align: right; font-weight: 500; overflow-wrap: anywhere; }

/* ── Status ───────────────────────────────────────── */
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; color: var(--grey); white-space: nowrap; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.status.on { color: var(--green); }
.status.on::before { background: var(--green); box-shadow: 0 0 0 3px var(--green-tint); }
.status.off { color: var(--grey); }
.status.alarm { color: var(--red); }
.status.alarm::before { background: var(--red); animation: blink 1s steps(2, start) infinite; }
.status.warn { color: var(--amber); }
.status.warn::before { background: var(--amber); }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border: 1px solid var(--rule); font-size: 12px; font-weight: 500; color: var(--grey); white-space: nowrap; }
.tag.ink { border-color: var(--ink); color: var(--ink); }
.tag.red { border-color: var(--red); color: var(--red); }
.tag.green { border-color: var(--green); color: var(--green); }
.tag.fill { background: var(--ink); border-color: var(--ink); color: var(--paper); }
@keyframes blink { to { visibility: hidden; } }

/* ── Switch ───────────────────────────────────────── */
.switch { position: relative; flex: none; width: 46px; height: 26px; border: 1.5px solid var(--ink); background: transparent; cursor: pointer; padding: 0; transition: background 0.2s, border-color 0.2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; background: var(--ink); transition: transform 0.25s var(--ease), background 0.2s; }
.switch[aria-checked="true"] { background: var(--green); border-color: var(--green); }
.switch[aria-checked="true"]::after { transform: translateX(20px); background: #fff; }
.switch.red[aria-checked="true"] { background: var(--red); border-color: var(--red); }
.switch.red[aria-checked="true"]::after { background: #fff; }
.switch:disabled { opacity: 0.35; cursor: not-allowed; }
.switch[aria-busy="true"] { opacity: 0.6; }

/* ── Segmented tabs ───────────────────────────────── */
.seg { display: inline-flex; border: 1px solid var(--rule); background: var(--surface); flex-wrap: wrap; }
.seg button { height: 34px; padding: 0 14px; border: 0; background: transparent; font-size: 13px; font-weight: 500; color: var(--grey); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg button + button { border-left: 1px solid var(--rule); }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.seg .n { font-size: 11px; opacity: 0.7; font-variant-numeric: tabular-nums; }

/* ── Table ────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 500; color: var(--grey); padding: 10px 14px; border-bottom: 1px solid var(--rule-strong); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr:last-child td { border-bottom: 0; }

/* ── Empty / loading ──────────────────────────────── */
.empty { padding: 48px 24px; text-align: center; color: var(--grey); }
.empty b { display: block; font-size: 18px; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); margin-bottom: 6px; }
.empty .btn { margin-top: 18px; }
.skel { background: linear-gradient(90deg, var(--sunk) 0, var(--rule) 50%, var(--sunk) 100%); background-size: 200% 100%; animation: skel 1.2s linear infinite; min-height: 14px; }
@keyframes skel { to { background-position: -200% 0; } }
.spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Dialog ───────────────────────────────────────── */
dialog.modal { padding: 0; border: 1px solid var(--rule-strong); background: var(--surface); color: var(--ink); width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: var(--shadow); }
dialog.modal--wide { width: min(760px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(0, 0, 0, 0.45); }
dialog.modal[open] { animation: pop 0.2s var(--ease); display: flex; flex-direction: column; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 22px 14px; }
.modal-head h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.03em; }
.modal-body { padding: 0 22px 20px; overflow-y: auto; }
.modal-body > p + p { margin-top: 10px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 22px; border-top: 1px solid var(--rule); flex-wrap: wrap; }
.x-btn { width: 32px; height: 32px; border: 0; background: none; cursor: pointer; color: var(--grey); font-size: 22px; line-height: 1; flex: none; }
.x-btn:hover { color: var(--ink); }

/* ── Toast ────────────────────────────────────────── */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--ink); color: var(--paper); padding: 11px 16px; font-size: 14px; font-weight: 500; border-left: 3px solid var(--paper); box-shadow: var(--shadow); animation: toast-in 0.25s var(--ease); pointer-events: auto; }
.toast.error { border-left-color: var(--red); }
.toast.ok { border-left-color: var(--green); }
.toast.out { opacity: 0; transform: translateY(8px); transition: 0.25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ── Auth pages ───────────────────────────────────── */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); background: var(--paper); }
.auth-art { background: var(--ink); color: var(--paper); padding: clamp(28px, 4vw, 56px); display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art .brand img { height: 17px; }
.auth-art h1 { font-size: clamp(48px, 6.6vw, 104px); font-weight: 700; letter-spacing: -0.055em; line-height: 0.88; }
.auth-art h1 span { color: var(--red); }
.auth-art p { margin-top: 24px; max-width: 26em; color: rgba(255, 255, 255, 0.6); font-size: 16px; }
[data-theme="dark"] .auth-art { background: #161616; color: #f2f2f0; }
.auth-art-foot { display: flex; justify-content: space-between; gap: 16px; font-size: 13px; color: rgba(255, 255, 255, 0.5); border-top: 1px solid rgba(255, 255, 255, 0.18); padding-top: 14px; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: clamp(28px, 5vw, 64px) var(--gut); }
.auth-box { width: 100%; max-width: 400px; }
.auth-box h2 { font-size: clamp(28px, 3vw, 38px); font-weight: 600; letter-spacing: -0.04em; line-height: 1.05; }
.auth-box > .t-muted { margin-top: 10px; }
.auth-box form { margin-top: 28px; }
.auth-box .alert { margin-top: 20px; }
.auth-box .btn--block { margin-top: 24px; height: 48px; font-size: 15px; }
.auth-switch { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--rule); font-size: 14px; color: var(--grey); }
.auth-mobile-brand { display: none; margin-bottom: 36px; }
.auth-mobile-brand img { height: 16px; }
.big-mark { width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; font-size: 30px; font-weight: 700; background: var(--ink); color: var(--paper); margin-bottom: 28px; }
.big-mark.error { background: var(--red); color: #fff; }

/* ── Bottom tab bar (phones) ──────────────────────── */
@media (max-width: 860px) {
    .nav { position: fixed; left: 0; right: 0; bottom: 0; height: 64px; background: var(--paper); border-top: 1px solid var(--rule); z-index: 50; gap: 0; padding-bottom: env(safe-area-inset-bottom); }
    .nav a { flex: 1; flex-direction: column; justify-content: center; gap: 3px; padding: 0; font-size: 11px; border-bottom: 0; border-top: 2px solid transparent; margin: 0; }
    .nav a[aria-current="page"] { border-top-color: var(--red); }
    .nav svg { display: block; }
    .page { padding-bottom: 120px; }
    .toasts { bottom: 84px; }
    .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
    .auth { grid-template-columns: 1fr; }
    .auth-art { display: none; }
    .auth-mobile-brand { display: block; }
    .auth-form { align-items: flex-start; padding-top: 48px; }
}
@media (max-width: 600px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .row { padding: 14px 16px; }
    .card-head, .card-body, .card-pad { padding-left: 16px; padding-right: 16px; }
    .page-head { align-items: flex-start; }
    .brand-tag { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ══════════════════════════════════════════════════════
   Colour by device type, and motion
   ══════════════════════════════════════════════════════ */
:root {
    --c-light: #f2a900; --c-light-tint: rgba(242, 169, 0, 0.14);
    --c-fan: #2f7ff0;   --c-fan-tint: rgba(47, 127, 240, 0.12);
    --c-outlet: #8b5cf6; --c-outlet-tint: rgba(139, 92, 246, 0.12);
    --c-lock: var(--green); --c-lock-tint: var(--green-tint);
    --c-siren: var(--red);  --c-siren-tint: var(--red-tint);
    --c-blue: #2f7ff0;
}
:root[data-theme="dark"] {
    --c-light: #ffc23d; --c-light-tint: rgba(255, 194, 61, 0.16);
    --c-fan: #5b9cff;   --c-fan-tint: rgba(91, 156, 255, 0.16);
    --c-outlet: #a98bff; --c-outlet-tint: rgba(169, 139, 255, 0.16);
    --c-blue: #5b9cff;
}

/* online dots breathe */
.status.on::before { animation: breathe 2.6s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { box-shadow: 0 0 0 3px var(--green-tint); } 50% { box-shadow: 0 0 0 6px transparent; } }

/* entrance: add .enter to a container; children with --i rise in sequence */
.enter [style*="--i"] { animation: rise 0.7s var(--ease) both; animation-delay: calc(var(--i) * 55ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

/* ── Voice: listening bar, live level bars, thinking dots ── */
.wave { display: none; align-items: center; gap: 3px; height: 26px; flex: none; }
.wave i { width: 3px; height: 100%; background: var(--red); border-radius: 2px; transform: scaleY(0.2); transform-origin: center; transition: transform 0.08s linear; }
.wave.fallback i { animation: wave 0.9s ease-in-out infinite; }
.wave.fallback i:nth-child(2) { animation-delay: 0.15s; } .wave.fallback i:nth-child(3) { animation-delay: 0.3s; }
.wave.fallback i:nth-child(4) { animation-delay: 0.45s; } .wave.fallback i:nth-child(5) { animation-delay: 0.6s; }
@keyframes wave { 0%, 100% { transform: scaleY(0.2); } 50% { transform: scaleY(1); } }
.listening .wave { display: inline-flex; }
.listening { border-bottom-color: var(--red) !important; }
.listening > label { color: var(--red); }
.mic { position: relative; transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.2s; }
.mic:active { transform: scale(0.92); }
.mic.listening { background: var(--red) !important; border-color: var(--red) !important; color: #fff !important; animation: none; }
.mic.listening::before, .mic.listening::after { content: ""; position: absolute; inset: -1px; border-radius: 50%; border: 2px solid var(--red); animation: ring 1.6s var(--ease) infinite; pointer-events: none; }
.mic.listening::after { animation-delay: 0.8s; }
@keyframes ring { from { transform: scale(1); opacity: 0.7; } to { transform: scale(2.1); opacity: 0; } }
.voice-hint { font-size: 12px; color: var(--red); font-weight: 500; white-space: nowrap; display: none; }
.listening .voice-hint { display: inline; }
.thinking { display: inline-flex; gap: 4px; align-items: center; color: var(--grey); }
.thinking i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: think 1s infinite; }
.thinking i:nth-child(2) { animation-delay: 0.15s; } .thinking i:nth-child(3) { animation-delay: 0.3s; }
@keyframes think { 0%, 100% { opacity: 0.25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }
.reply-in { animation: reply 0.45s var(--ease) both; }
@keyframes reply { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) {
    .status.on::before, .enter [style*="--i"], .mic.listening::before, .mic.listening::after { animation: none !important; }
}

.speak .mx { display: none; } .speak.muted .wv { display: none; } .speak.muted .mx { display: inline; } .speak.muted { color: var(--faint); }

.voice-cue { margin-right: auto; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.voice-cue .wave { display: inline-flex; height: 16px; }
