/* Diane OS — product UI rebuilt from scratch, July 2026
   Theme system (refactored Sep 2026):
   - Semantic tokens (--bg-*, --text-*, --border-*, --accent-*, --success/--warning/--error/--info, --shadow-*)
     are the single source of truth. Components must use them, never hard-coded hex.
   - Dark is a calm charcoal system with a single soft indigo accent and low-contrast
     tinting. Light is an independent theme, never a filter/overlay/gradient patch over
     dark. No invert()/brightness() hacks. */
:root {
    /* ---------- Semantic tokens — Dark (source of truth, preserved visuals) ---------- */
    --bg-app: #0a0c11;
    --bg-surface: #11141b;
    --bg-surface-elevated: #161a23;
    --bg-sidebar: #0d1016;
    --bg-hover: #1a1f2a;
    --bg-active: rgba(124, 140, 255, .14);
    --text-primary: #eceef4;
    --text-secondary: #a3abbb;
    --text-muted: #6b7486;
    --text-disabled: #4c5464;
    --border-subtle: #1a1f2b;
    --border-default: #232936;
    --border-strong: #313949;
    --accent: #7c8cff;
    --accent-hover: #96a3ff;
    --accent-muted: rgba(124, 140, 255, .11);
    --success: #4fd1a5;
    --warning: #f2b45e;
    --error: #f0796f;
    --info: #5aa9ff;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-md: 0 12px 32px rgba(0, 0, 0, .35);
    --shadow-lg: 0 30px 90px rgba(0, 0, 0, .55);

    /* ---------- Legacy surface/ink scale (kept, mapped to semantic tokens) ---------- */
    --canvas: var(--bg-app);
    --chrome: var(--bg-sidebar);
    --surface-1: var(--bg-surface);
    --surface-2: var(--bg-surface-elevated);
    --surface-3: #1b212c;
    --surface-input: #0e1219;
    --surface-raised: var(--bg-surface-elevated);
    --surface-sunken: var(--surface-input);
    --line: var(--border-default);
    --line-strong: var(--border-strong);
    --ink: var(--text-primary);
    --ink-2: var(--text-secondary);
    --ink-3: var(--text-muted);
    /* Aliases for undefined legacy names found across the codebase. */
    --ink-1: var(--text-primary);
    --ink-muted: var(--text-secondary);
    --ink-faint: var(--text-muted);
    --muted: var(--text-muted);
    --warn: var(--warning);
    --diane: var(--accent);
    --diane-blue: #5aa9ff;
    --diane-violet: #8b7cff;
    --diane-soft: var(--accent-muted);
    --violet-soft: rgba(139, 124, 255, .12);
    --violet-line: rgba(139, 124, 255, .28);
    --ok: var(--success);
    --wait: var(--warning);
    --bad: var(--error);
    --r-1: 8px;
    --r-2: 12px;
    --r-3: 18px;
    --r-4: 24px;
    --r-pill: 999px;
    --radius-xs: 6px;
    --radius-sm: var(--r-2);
    --radius-md: 12px;
    --radius-lg: 18px;
    --s-1: 4px;
    --s-2: 8px;
    --s-3: 12px;
    --s-4: 16px;
    --s-5: 24px;
    --s-6: 32px;
    --s-7: 48px;
    --fast: 150ms;
    --normal: 220ms;
    --ease: cubic-bezier(.22, 1, .36, 1);
    --sidebar: 0px;
    --nav-drawer: min(340px, 92vw);
    --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;

    /* ── Additive semantic + compatibility tokens ──
       One-directional mappings only (never semantic↔legacy cycles):
       legacy scale maps up to the semantic source of truth above. */
    --bg-surface-sunken: var(--surface-input);
    --bg-topbar: var(--bg-sidebar);
    --bg-overlay: var(--bg-surface);

    --gauge-track: rgba(255, 255, 255, .07);
    --code-bg: #0b0f16;
    --code-ink: #a8c0ff;

    --font-ui: "Heebo", system-ui, sans-serif;

    /* Compatibility aliases used by application-rendered content. */
    --bg-primary: var(--bg-app);
    --bg-secondary: var(--bg-sidebar);
    --bg-card: var(--bg-surface);
    --bg-card-hover: var(--bg-hover);
    --bg-body: var(--surface-input);
    --border: var(--border-default);
    --accent-blue: var(--diane-blue);
    --accent-purple: var(--diane-violet);
    --accent-green: var(--success);
    --accent-orange: var(--warning);
    --accent-red: var(--error);
    --danger: var(--error);
    --radius: var(--r-3);
    --transition: color var(--fast) ease, background-color var(--fast) ease, border-color var(--fast) ease, transform var(--normal) var(--ease);
}

/* ---------- Semantic tokens — Light (independent theme, never a patch over dark) ----------
    Calm deep-gray system: #DDE0E6 canvas, #E8EAEE card surfaces, #D6D9DF sidebar
    (no glaring panels), #171A1F/#596273/#5B6678 ink, deep indigo accent,
    #F6EEDC cream-gold selected state. All text pairs hold WCAG AA ≥4.5:1. */
html[data-theme="light"] {
    color-scheme: light;
    --bg-app: #DDE0E6;
    --bg-surface: #E8EAEE;
    --bg-surface-elevated: #F2F3F6;
    --bg-sidebar: #D6D9DF;
    --bg-hover: #D6DAE1;
    --bg-active: #F6EEDC;
    --text-primary: #171A1F;
    --text-secondary: #596273;
    --text-muted: #5B6678;
    --text-disabled: #A3ADBE;
    --border-subtle: #CCD2DB;
    --border-default: #B9C0CC;
    --border-strong: #A2ABB9;
    --accent: #4C58C0;
    --accent-hover: #4655C4;
    --accent-muted: rgba(76, 88, 192, .14);
    --success: #177245;
    --warning: #8A5D0E;
    --error: #B3373F;
    --info: #4C58C0;
    --shadow-sm: 0 1px 2px rgba(22, 32, 47, .06);
    --shadow-md: 0 10px 28px rgba(22, 32, 47, .10);
    --shadow-lg: 0 22px 54px rgba(22, 32, 47, .14);

    --canvas: var(--bg-app);
    --chrome: var(--bg-sidebar);
    --surface-1: var(--bg-surface);
    --surface-2: var(--bg-surface-elevated);
    --surface-3: #D8DCE3;
    --surface-input: #E0E4EA;
    --surface-raised: #F2F3F6;
    --surface-sunken: #E0E4EA;
    --line: var(--border-default);
    --line-strong: var(--border-strong);
    --ink: var(--text-primary);
    --ink-2: var(--text-secondary);
    --ink-3: var(--text-muted);
    --ink-1: var(--text-primary);
    --ink-muted: var(--text-secondary);
    --ink-faint: var(--text-muted);
    --muted: var(--text-muted);
    --warn: var(--warning);
    --diane: var(--accent);
    --diane-blue: #4C58C0;
    --diane-violet: #6757C7;
    --diane-soft: var(--accent-muted);
    --violet-soft: rgba(103, 87, 199, .10);
    --violet-line: rgba(103, 87, 199, .30);
    --ok: var(--success);
    --wait: var(--warning);
    --bad: var(--error);
}

/* ---------- Calm pass: soft depth, UI-native type, friendlier controls ----------
   Depth reads as a subtle lift rather than a glow, the interface face carries
   labels and values (monospace is reserved for real code), and buttons become
   rounded rectangles instead of full pills. */
:root {
    --shadow-sm: 0 1px 2px rgba(6, 8, 14, .30);
    --shadow-md: 0 8px 26px rgba(6, 8, 14, .30);
    --shadow-lg: 0 20px 56px rgba(6, 8, 14, .44);
    --font-mono: var(--font-ui);
}

html[data-theme="light"] {
    --shadow-sm: 0 1px 2px rgba(22, 32, 47, .05);
    --shadow-md: 0 8px 22px rgba(22, 32, 47, .08);
    --shadow-lg: 0 18px 44px rgba(22, 32, 47, .12);
}

pre, code, kbd, samp {
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
}

.btn,
button[class*="btn-"] {
    border-radius: var(--r-2);
}

* {
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--diane-violet) 42%, var(--line-strong)) transparent;
}

*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

*::-webkit-scrollbar-button {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

*::-webkit-scrollbar-corner {
    background: transparent;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    border: 3px solid transparent;
    border-radius: 999px;
    background: color-mix(in srgb, var(--diane-violet) 42%, var(--line-strong));
    background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
    background: color-mix(in srgb, var(--diane-violet) 62%, var(--line-strong));
    background-clip: padding-box;
}

/* RTL dashboard: every vertical scroll container reserves its own gutter so
   the thin thumb never paints over neighbouring text, numbers or borders.
   (Horizontal rails are excluded: they scroll on the X axis and must keep
   their overlay-free hidden/HashiCorp-style scrollbars.) */
.nav,
.conversations-list,
.chat-messages-container,
.command-center-results,
.flow-list,
.logs-container,
.dashboard-tile-editor,
.price-check-providers-grid,
.subagent-form-grid,
.vault-body {
    scrollbar-gutter: stable;
}

.nav,
.conversations-list,
.chat-messages-container,
.command-center-results,
.flow-list,
.logs-container,
.dashboard-tile-editor,
.price-check-providers-grid,
.subagent-form-grid,
.vault-body {
    overflow-x: hidden;
    overscroll-behavior-y: contain;
}

html {
    min-width: 0;
    background: var(--canvas);
    color-scheme: dark;
}

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    background: var(--canvas);
    color: var(--ink);
    font-family: "Heebo", system-ui, sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a,
input,
select,
textarea,
summary {
    -webkit-tap-highlight-color: transparent;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: .45;
}

[hidden] {
    display: none !important;
}

/* Authentication */
body.auth-locked {
    overflow: hidden;
}

body.auth-locked .app {
    display: none;
}

#login-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    padding: 20px;
    /* Tall first-time content (film panel + card) on a short phone must stay
       fully reachable — a scrollable overlay, not a clipped centered box. */
    overflow-y: auto;
    overflow-x: hidden;
    background: radial-gradient(circle at 50% 30%, #101d34, var(--canvas) 58%);
}

.login-card {
    width: min(100%, 430px);
    padding: 38px;
    border: 1px solid var(--line);
    border-radius: var(--r-4);
    background: var(--surface-1);
    box-shadow: 0 28px 90px rgba(0,0,0,.45);
    text-align: center;
}

.login-logo-icon {
    width: 92px;
    height: 92px;
}

.login-title {
    margin: 20px 0 8px;
    font-size: 24px;
}

.login-subtitle,
.login-footer {
    color: var(--ink-3);
}

.login-error {
    margin: 18px 0;
    padding: 12px;
    border-radius: var(--r-2);
    background: rgba(242,118,112,.09);
    color: #ffaaa5;
}

.google-btn-container,
#google-signin-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.google-btn-container {
    margin: 20px 0 0;
}

.dashboard-google-login-button {
    max-width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* ──── Login launch film ──── */
/* First-time visitor: a film panel sits above (narrow) or beside (wide) the
   login card. Returning visitor (diane.film.seen set): no panel, just
   .login-film-link in the card. State lives in app.js — this is layout only. */
.login-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
    width: 100%;
    max-width: 430px;
    margin: 0 auto;
}

.login-film-panel {
    width: 100%;
}

.login-film-label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.login-film-eyebrow {
    color: var(--diane);
    font: 600 10px/1 var(--font-mono);
    letter-spacing: .14em;
}

.login-film-time {
    color: var(--ink-3);
    font: 500 10px/1 var(--font-mono);
    letter-spacing: .05em;
    white-space: nowrap;
}

.login-film-frame {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--r-3);
    /* Poster painted as the frame's own background so there is never a black
       flash before the <video> has decoded a frame. */
    background: #000 url("assets/film/diane-film-poster.webp") center / cover no-repeat;
}

.login-film-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity var(--normal) var(--ease);
}

.login-film-video.is-playing {
    opacity: 1;
}

.login-film-play {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    border: 0;
    padding: 0;
    background: rgba(6, 9, 14, .16);
    cursor: pointer;
    transition: background var(--fast) var(--ease);
}

.login-film-play:hover,
.login-film-play:focus-visible {
    background: rgba(6, 9, 14, .34);
}

.login-film-play:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.login-film-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: var(--r-pill);
    background: rgba(17, 20, 27, .6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fff;
    font: 600 13px/1 var(--font-ui);
    box-shadow: var(--shadow-md);
    white-space: nowrap;
}

.login-film-glyph {
    display: inline-block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 6px 0 6px 10px;
    border-color: transparent transparent transparent #fff;
}

.login-film-link {
    display: block;
    width: 100%;
    margin: 2px 0 18px;
    padding: 4px;
    border: 0;
    border-radius: var(--r-1);
    background: none;
    color: var(--ink-3);
    font: 500 13px/1.4 var(--font-ui);
    text-align: center;
    cursor: pointer;
}

.login-film-link:hover,
.login-film-link:focus-visible {
    color: var(--ink);
}

.login-film-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

@media (min-width: 1100px) {
    .login-stage {
        /* RTL: DOM order is [film, card]; row-reverse puts the DOM-first item
           at the new main-end (left) and keeps the card at inline-start (right). */
        flex-direction: row-reverse;
        align-items: center;
        justify-content: center;
        gap: 40px;
        max-width: none;
    }
    .login-stage .login-film-panel {
        flex: 0 1 660px;
        width: 660px;
    }
    .login-stage .login-card {
        flex: 0 0 auto;
    }
}

/* Full-film lightbox — native <dialog>, opened from the preview panel or the
   returning-visitor link. Frame stays literal black in both themes. */
#diane-film-dialog {
    /* Bounded by height*16/9 too, so a landscape phone never turns the
       player into a scrollbar. */
    width: min(1100px, calc(100vw - 28px), calc((100vh - 96px) * 16 / 9));
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--r-4);
    background: var(--surface-1);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

#diane-film-dialog::backdrop {
    background: rgba(1, 5, 10, .76);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.film-dialog-video {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
}

.film-dialog-close {
    position: absolute;
    top: 12px;
    inset-inline-end: 12px;
    z-index: 1;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 10px;
    background: rgba(6, 9, 14, .55);
    color: #fff;
    cursor: pointer;
}

.film-dialog-close svg {
    width: 18px;
    height: 18px;
}

.film-dialog-close:hover,
.film-dialog-close:focus-visible {
    background: rgba(6, 9, 14, .8);
}

.film-dialog-close:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.film-dialog-caption {
    margin: 0;
    padding: 14px 20px;
    color: var(--ink-3);
    font: 500 12px/1 var(--font-mono);
    letter-spacing: .04em;
    text-align: center;
    background: var(--surface-1);
}

@media (prefers-reduced-motion: reduce) {
    .login-film-video {
        transition: none;
    }
}

/* Application shell */
.app {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    inset: 0 0 0 auto;
    z-index: 80;
    width: var(--nav-drawer);
    height: 100dvh;
    max-height: 100dvh;
    padding: 14px 12px calc(14px + env(safe-area-inset-bottom, 0px));
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    border-inline-end: 1px solid var(--line);
    background: color-mix(in srgb, var(--chrome) 94%, #000 6%);
    backdrop-filter: blur(22px);
    overflow: hidden;
    transform: translateX(110%);
    transition: transform .32s var(--ease), box-shadow .32s var(--ease);
    box-shadow: none;
    pointer-events: none;
}

.app.nav-open .sidebar {
    transform: translateX(0);
    pointer-events: auto;
    box-shadow: -28px 0 80px rgba(0, 0, 0, .45);
}

.sidebar-header {
    min-height: 64px;
    padding: 4px 8px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 9px;
}

.logo-icon {
    width: 38px;
    height: 38px;
    display: block;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -.03em;
}

.version {
    margin-inline-start: auto;
    padding: 4px 7px;
    border-radius: 99px;
    background: var(--diane-soft);
    color: var(--diane);
    font: 600 9px/1 "JetBrains Mono", monospace;
}

.nav {
    min-height: 0;
    min-width: 0;
    padding: 6px 2px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

.nav-item {
    min-height: 42px;
    min-width: 0;
    padding: 9px 12px;
    display: flex;
    align-items: center;
    gap: 11px;
    border-radius: 10px;
    color: #77869a;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    transition: var(--transition);
}

.nav-item:hover {
    background: var(--surface-1);
    color: #c8d3e1;
}

.nav-item.active {
    background: var(--surface-2);
    color: var(--ink);
    box-shadow: none;
}

.nav-item:focus { outline: 0; }
.nav-item:focus-visible {
    outline: 1px solid rgba(124,140,255,.42);
    outline-offset: -1px;
}

.nav-icon,
.title-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav-item.active .nav-icon {
    color: var(--diane);
    filter: drop-shadow(0 0 7px rgba(124,140,255,.35));
}

.sidebar-footer {
    padding: 14px 8px 4px;
    border-top: 1px solid var(--line);
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ink-3);
    font-size: 11px;
}

.status-badge.online {
    color: var(--ok);
}

.pulse {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    animation: live-pulse 2.1s ease-out infinite;
}

.main {
    min-height: 100dvh;
    min-width: 0;
    width: 100%;
    margin-inline-start: 0;
    overflow-x: clip;
}

.topbar {
    position: sticky;
    inset-block-start: 0;
    z-index: 30;
    height: 72px;
    padding: 0 clamp(20px,4vw,56px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    background: rgba(5,8,17,.88);
    backdrop-filter: blur(18px);
}

.topbar h1 {
    margin: 0;
    color: var(--ink-3);
    font-size: 12px;
    font-weight: 500;
}

.clock {
    color: var(--ink-3);
    font: 500 11px/1 "JetBrains Mono", monospace;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.theme-toggle {
    min-height: 36px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--violet-soft);
    color: var(--ink-2);
    font-size: 11px;
    font-weight: 550;
}

.theme-toggle:hover:not(:disabled) {
    border-color: var(--violet-line);
    background: color-mix(in srgb, var(--violet-soft) 78%, var(--surface-2));
    color: var(--ink);
    transform: none;
}

.theme-icon {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: var(--diane-violet);
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.theme-icon-moon,
html[data-theme="light"] .theme-icon-sun {
    display: none;
}

html[data-theme="light"] .theme-icon-moon {
    display: block;
}

html[data-theme="light"] .topbar {
    background: color-mix(in srgb, var(--bg-sidebar) 88%, transparent);
}

html[data-theme="light"] .nav-item {
    color: var(--ink-3);
}

html[data-theme="light"] .nav-item:hover {
    color: var(--ink);
}

html[data-theme="light"] .nav-item.active {
    background: var(--bg-active);
    color: var(--ink);
    box-shadow: inset 0 0 0 1px rgba(146, 97, 15, .20);
}

html[data-theme="light"] #login-overlay {
    background: radial-gradient(circle at 50% 26%, rgba(116, 87, 219, .1), var(--canvas) 58%);
}

.command-center-trigger {
    min-height: 36px;
    padding: 0 8px 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255,255,255,.025);
    color: var(--ink-3);
    font-size: 11px;
    font-weight: 500;
}

.command-center-trigger:hover {
    border-color: var(--line-strong);
    background: var(--surface-1);
    color: var(--ink);
    transform: none;
}

.command-center-trigger svg,
.command-center-search svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
}

kbd {
    padding: 4px 6px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface-input);
    color: var(--ink-3);
    font: 500 9px/1 "JetBrains Mono", monospace;
}

body.command-center-open {
    overflow: hidden;
}

.command-center {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: start center;
    padding: min(12vh,110px) 18px 24px;
    opacity: 0;
    transition: opacity 180ms ease;
}

.command-center.is-visible {
    opacity: 1;
}

.command-center-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    background: rgba(2,5,10,.78);
    backdrop-filter: blur(12px);
}

.command-center-backdrop:hover {
    background: rgba(2,5,10,.78);
    transform: none;
}

.command-center-panel {
    position: relative;
    width: min(100%,680px);
    max-height: min(76vh,720px);
    display: grid;
    grid-template-rows: auto auto minmax(0,1fr) auto;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: 22px;
    background:
        radial-gradient(circle at 15% 0, rgba(139,124,255,.1), transparent 28%),
        var(--surface-1);
    box-shadow: 0 34px 100px rgba(0,0,0,.64);
    transform: translateY(-14px) scale(.98);
    transition: transform 220ms var(--ease);
}

.command-center.is-visible .command-center-panel {
    transform: none;
}

.command-center-head {
    min-height: 78px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--line);
}

.command-center-head > div {
    display: grid;
    gap: 3px;
}

.command-center-head strong {
    font-size: 15px;
}

.command-center-head small {
    color: var(--ink-3);
    font-size: 10px;
}

.command-center-head > kbd {
    margin-inline-start: auto;
}

.command-center-orb {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: linear-gradient(135deg,var(--diane),var(--diane-violet));
    box-shadow: 0 0 20px rgba(124,140,255,.7), 0 0 30px rgba(139,124,255,.3);
    animation: presence 2s infinite;
}

.command-center-search {
    min-height: 64px;
    padding: 10px 18px;
    display: grid;
    grid-template-columns: 20px 1fr;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--line);
    color: var(--diane);
}

.command-center-search input {
    min-height: 42px !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    font-size: 15px;
}

.command-center-results {
    min-height: 90px;
    padding: 10px;
    overflow-y: auto;
}

.command-center-results::after {
    content: "לא נמצא יעד מתאים";
    display: none;
    padding: 34px 18px;
    color: var(--ink-3);
    text-align: center;
}

.command-center.is-empty .command-center-results::after {
    display: block;
}

.command-center-results button {
    width: 100%;
    min-height: 58px;
    padding: 8px 12px;
    display: grid;
    grid-template-columns: 34px 1fr auto;
    align-items: center;
    gap: 10px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    text-align: start;
}

.command-center-results button:hover,
.command-center-results button:focus-visible {
    border-color: rgba(124,140,255,.18);
    background: var(--diane-soft);
    transform: none;
    outline: 0;
}

.command-center-results button > span {
    color: var(--diane);
    font: 600 10px/1 "JetBrains Mono", monospace;
}

.command-center-results button strong {
    font-size: 13px;
}

.command-center-results button small {
    color: var(--ink-3);
    font-size: 10px;
}

.command-center-foot {
    min-height: 48px;
    padding: 10px 18px;
    display: flex;
    align-items: center;
    gap: 18px;
    border-top: 1px solid var(--line);
    color: var(--ink-3);
    font-size: 9px;
}

.command-center-foot span:last-child {
    margin-inline-start: auto;
}

/* Pages and information hierarchy */
.page {
    display: none;
    width: min(100%, 1380px);
    margin-inline: auto;
    padding: clamp(26px,4vw,54px) clamp(18px,4vw,56px) 80px;
}

.page.active {
    display: block;
    animation: page-enter 360ms var(--ease) both;
}

.page-intro {
    min-height: 84px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.page-intro-copy {
    max-width: 780px;
}

.page-intro-eyebrow,
.section-eyebrow,
.eyebrow {
    display: block;
    margin-bottom: 14px;
    color: var(--diane);
    font: 600 10px/1 "JetBrains Mono", monospace;
    letter-spacing: .14em;
}

.page-intro-eyebrow {
    display: none;
}

.page-intro h2 {
    margin: 0;
    font-size: clamp(24px,2.5vw,31px);
    font-weight: 650;
    line-height: 1.12;
    letter-spacing: -.035em;
}

.page-intro p {
    max-width: 620px;
    margin: 8px 0 0;
    color: var(--ink-2);
    font-size: 13px;
    line-height: 1.55;
}

.page-intro::after { display: none; }

/* Product primitives */
.card,
.service-card,
.learning-panel,
.tools-readiness-item {
    border: 0;
    border-radius: var(--r-3);
    background: var(--surface-1);
}

.card {
    padding: clamp(20px,2.5vw,32px);
    margin-bottom: 12px;
}

.card-title,
.books-header h3 {
    margin: 0 0 16px;
    color: var(--ink);
    font-size: 16px;
    font-weight: 600;
}

.card-body,
.vault-subtitle,
.books-subtitle {
    color: var(--ink-2);
}

.grid-2col,
.insight-grid {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 12px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1.4fr repeat(3,1fr);
    gap: 1px;
    overflow: hidden;
    border-radius: var(--r-3);
    background: var(--line);
}

.stat-card {
    min-height: 138px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--surface-1);
}

.stat-card:first-child {
    background: var(--surface-2);
}

.stat-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: var(--r-2);
    background: var(--surface-3);
    color: var(--diane);
    font-size: 0;
}

.stat-icon::after {
    content: "";
    width: 8px;
    height: 8px;
    border: 1px solid currentColor;
    border-radius: 50%;
}

.stat-info,
.stat-info span {
    display: block;
}

.stat-value {
    color: var(--ink);
    font: 650 24px/1 "JetBrains Mono", monospace;
}

#stat-uptime {
    direction: ltr;
    unicode-bidi: isolate;
}

.stat-label {
    margin-top: 8px;
    color: var(--ink-2);
    font-size: 12px;
}

.stat-meta {
    margin-top: 4px;
    color: var(--ink-3);
    font-size: 10px;
}

input:not([type="checkbox"]):not([type="range"]),
textarea,
select {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: var(--r-2);
    outline: 0;
    background: var(--surface-input);
    color: var(--ink);
    transition: border-color var(--fast) ease, box-shadow var(--fast) ease, background-color var(--fast) ease;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--diane);
    box-shadow: 0 0 0 3px var(--diane-soft);
}

button {
    min-height: 42px;
    padding: 9px 16px;
    border: 0;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--ink);
    font-weight: 600;
    transition: var(--transition);
}

button:hover:not(:disabled) {
    transform: translateY(-1px);
    background: #1b2c44;
}

button:active:not(:disabled) {
    transform: scale(.97);
}

button#btn-save-provider-keys,
button#btn-save-google-keys,
button#btn-save-response-prefs,
button#btn-save-persona,
button#btn-send-chat,
button#btn-add-book,
button#btn-save-phone-link,
.vault-btn-primary {
    background: var(--diane);
    color: #03111b;
}

/* Switches and steppers: explicit, high-contrast application controls */
input[type="checkbox"] {
    width: 46px;
    height: 26px;
    appearance: none;
    position: relative;
    flex: 0 0 auto;
    border: 1px solid var(--line-strong);
    border-radius: 99px;
    background: #0a111d;
    cursor: pointer;
    transition: background-color var(--normal) ease, border-color var(--normal) ease;
}

input[type="checkbox"]::after {
    content: "";
    position: absolute;
    inset: 3px auto auto 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #718096;
    transition: transform var(--normal) var(--ease), background-color var(--normal) ease;
}

input[type="checkbox"]:checked {
    border-color: var(--diane);
    background: var(--diane);
}

input[type="checkbox"]:checked::after {
    background: white;
    transform: translateX(20px);
}

.platform-select {
    min-width: 92px;
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-input);
    color: var(--ink-2);
    cursor: pointer;
}

.platform-select:hover,
.platform-select:focus-visible {
    border-color: var(--line-strong);
    color: var(--ink);
}

.number-stepper {
    width: 142px;
    height: 48px;
    display: grid;
    grid-template-columns: 44px minmax(50px,1fr) 44px;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-2);
    background: var(--surface-input);
}

.number-stepper input {
    min-width: 0;
    min-height: 46px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    text-align: center;
    font: 650 15px/1 "JetBrains Mono", monospace;
    appearance: textfield;
}

.number-stepper input::-webkit-inner-spin-button {
    appearance: none;
}

.number-step-button {
    width: 44px !important;
    min-width: 44px;
    min-height: 46px !important;
    padding: 0 !important;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 0 !important;
    background: var(--surface-3) !important;
    color: white !important;
    font: 700 20px/1 "JetBrains Mono", monospace;
}

.number-step-button:hover:not(:disabled) {
    background: var(--diane-blue) !important;
    color: white !important;
    transform: none;
}

.setting-item,
.runtime-number-setting,
.proactive-setting {
    min-width: 0;
}

.settings-list,
.proactive-settings-grid {
    display: grid;
    gap: 12px;
}

.proactive-settings-grid {
    grid-template-columns: repeat(2,minmax(0,1fr));
}

.proactive-setting,
.runtime-number-setting,
.setting-item {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--r-3);
    background: var(--surface-1);
}

.setting-label,
.proactive-setting-label {
    color: var(--ink);
    font-weight: 600;
}

.setting-description,
.proactive-setting-description {
    color: var(--ink-3);
    font-size: 11px;
}

.proactive-actions {
    margin-top: 18px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.proactive-autosave-note {
    margin: 14px 0 0;
    color: var(--ink-3);
    font-size: 12px;
}

/* Progressive disclosure */
.is-collapsible-surface {
    padding: 0;
    overflow: hidden;
}

.collapsible-surface-toggle {
    width: 100%;
    min-height: 76px;
    padding: 16px 22px;
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 14px;
    border-radius: 0;
    background: transparent;
    text-align: start;
}

.collapsible-surface-toggle small {
    color: var(--ink-3);
    font-size: 10px;
}

.collapsible-surface-toggle i {
    width: 9px;
    height: 9px;
    border-inline-end: 1.5px solid var(--ink-3);
    border-block-end: 1.5px solid var(--ink-3);
    transform: rotate(45deg);
    transition: transform var(--normal) var(--ease);
}

.is-collapsible-surface.is-open .collapsible-surface-toggle i {
    transform: rotate(225deg);
}

.collapsible-surface-body {
    padding: 22px;
    border-top: 1px solid var(--line);
}

/* Application workspaces: settings and integrations are tools, not document pages. */
.application-workspace {
    width: 100%;
    min-width: 0;
    min-height: 560px;
    display: grid;
    grid-template-columns: minmax(220px, 270px) minmax(0, 1fr);
    border: 1px solid var(--line);
    border-radius: 24px;
    overflow: clip;
    background: var(--surface-1);
    box-shadow: var(--shadow-lg);
}

.application-workspace-rail {
    min-width: 0;
    padding: 17px 12px;
    border-inline-end: 1px solid var(--line);
    background: var(--chrome);
}

.application-workspace-rail-head {
    display: grid;
    gap: 5px;
    padding: 4px 10px 14px;
}

.application-workspace-rail-head span {
    color: var(--diane);
    font-size: .66rem;
    font-weight: 750;
    letter-spacing: .14em;
}

.application-workspace-rail-head strong {
    color: var(--ink);
    font-size: 1.08rem;
}

.application-workspace-tabs {
    min-width: 0;
    max-width: 100%;
    display: grid;
    gap: 5px;
}

.application-workspace-tab {
    width: 100%;
    min-height: 50px;
    display: grid;
    grid-template-columns: 1fr 8px;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    color: var(--ink-muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 13px;
    text-align: start;
    font-weight: 650;
}

.application-workspace-tab:hover {
    color: var(--ink);
    background: rgba(255,255,255,.035);
}

.application-workspace-tab.is-active {
    color: var(--ink);
    border-color: rgba(124,140,255,.2);
    background: linear-gradient(100deg,rgba(124,140,255,.12),rgba(124,140,255,.025));
}

.application-workspace-tab i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--line-strong);
}

.application-workspace-tab.is-active i {
    background: var(--diane);
    box-shadow: 0 0 14px rgba(124,140,255,.8);
}

.application-workspace-stage {
    min-width: 0;
    padding: clamp(18px,2.5vw,30px);
    background: var(--surface-1);
}

.application-workspace-panel.card {
    margin: 0 !important;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    animation: workspace-panel-in .32s cubic-bezier(.2,.75,.2,1) both;
}

.application-workspace-panel > .card-title,
.application-workspace-panel > .books-header,
.application-workspace-panel > .vault-head {
    padding-bottom: 22px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--line);
}

#btn-add-dashboard-user,
#btn-add-telegram-user,
#btn-add-whatsapp-user,
#btn-login-google,
#btn-login-spotify {
    min-height: 44px;
    color: #fff !important;
    background: linear-gradient(110deg,var(--diane-blue),var(--diane)) !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 26px rgba(124,140,255,.14);
}

#user-avatar { border-color: var(--diane-blue) !important; }

#page-users .application-workspace-panel > p {
    color: var(--ink-muted) !important;
    line-height: 1.65;
}
#page-users .application-workspace-panel > div:not([style*="overflow"]) {
    border-radius: 14px;
}
#page-users .application-workspace-panel table {
    min-width: 680px;
}
#page-users .application-workspace-panel tbody tr {
    transition: background var(--fast) var(--ease);
}
#page-users .application-workspace-panel tbody tr:hover {
    background: rgba(124,140,255,.035);
}

#page-users .users-table-state:hover {
    background: transparent;
}

#page-users .users-table-state td {
    padding: 22px 12px !important;
    color: var(--ink-3);
    text-align: center !important;
}

#page-users .users-table-state-loading td::after {
    width: 6px;
    height: 6px;
    margin-inline-start: 8px;
    display: inline-block;
    border-radius: 50%;
    background: var(--diane-violet);
    content: "";
    animation: users-state-pulse 1.2s ease-in-out infinite;
}

#page-users .users-table-state-error td {
    color: var(--danger);
}

@keyframes users-state-pulse {
    50% { opacity: .35; transform: scale(.75); }
}

@keyframes workspace-panel-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

/* Dashboard */
#page-dashboard > .page-intro {
    display: none;
}

.dashboard-today-live { color: var(--ink-muted); font-size: .72rem; }
.dashboard-today-live i { display: inline-block; width: 7px; height: 7px; margin-inline-end: 7px; border-radius: 50%; background: var(--diane); box-shadow: 0 0 12px rgba(124,140,255,.7); animation: presence 2s infinite; }
.dashboard-inline-action { min-height: 34px; padding: 6px 10px; color: var(--diane); border: 1px solid rgba(124,140,255,.18); background: rgba(124,140,255,.055); font-size: .7rem; }
.dashboard-reminder-row,
.dashboard-connection-row {
    min-height: 58px;
    display: grid;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,.045);
}
.dashboard-reminder-row { grid-template-columns: 28px minmax(0,1fr) auto; }
.dashboard-reminder-index { color: var(--ink-faint); font: 600 .66rem/1 var(--font-mono); }
.dashboard-reminder-row div,
.dashboard-connection-row div { min-width: 0; }
.dashboard-reminder-row strong,
.dashboard-connection-row strong,
.dashboard-attention-row strong,
.dashboard-calm-state strong { display: block; color: var(--ink); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-reminder-row small,
.dashboard-connection-row small,
.dashboard-attention-row small,
.dashboard-calm-state span { display: block; margin-top: 3px; color: var(--ink-faint); font-size: .67rem; line-height: 1.4; }
.dashboard-reminder-row time { color: var(--diane); font: 650 .75rem/1 var(--font-mono); direction: ltr; }
.dashboard-connection-row { grid-template-columns: 8px minmax(0,1fr) auto; }
.dashboard-connection-row > span:last-child { color: var(--ink-faint); font-size: .64rem; }
.dashboard-connection-light { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 9px rgba(71,215,154,.55); }
.dashboard-connection-row[data-tone="attention"] .dashboard-connection-light { background: var(--wait); box-shadow: 0 0 9px rgba(244,180,95,.45); }
.dashboard-attention-row {
    width: 100%;
    min-height: 72px;
    padding: 10px 4px;
    display: grid;
    grid-template-columns: 8px minmax(0,1fr) 18px;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,.045);
    border-radius: 0;
    background: transparent;
    text-align: start;
}
.dashboard-attention-row:hover:not(:disabled) { background: rgba(255,255,255,.025); transform: none; }
.dashboard-attention-mark { width: 7px; height: 7px; border-radius: 50%; background: var(--diane); }
.dashboard-attention-row[data-tone="bad"] .dashboard-attention-mark { background: var(--bad); }
.dashboard-attention-row[data-tone="wait"] .dashboard-attention-mark { background: var(--wait); }
.dashboard-attention-row[data-tone="ok"] .dashboard-attention-mark { background: var(--ok); }
.dashboard-attention-row[data-tone="info"] .dashboard-attention-mark {
    background: var(--diane-violet);
    box-shadow: 0 0 12px rgba(139,124,255,.5);
}
.dashboard-attention-row i { color: var(--diane); font-style: normal; }
.dashboard-calm-state { min-height: 190px; display: flex; align-items: center; gap: 14px; color: var(--ink-muted); }
.dashboard-calm-state > i { width: 10px; height: 10px; flex: 0 0 auto; border-radius: 50%; background: var(--diane); box-shadow: 0 0 16px rgba(124,140,255,.55); animation: presence 2.2s infinite; }
.data-badge {
    padding: 6px 10px;
    border-radius: 99px;
    background: var(--surface-2);
    color: var(--ink-2);
    font-size: 10px;
}

.health-metrics-grid,
.services-grid,
.tools-readiness-grid,
.learning-grid {
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 1px;
    overflow: hidden;
    border-radius: var(--r-2);
    background: var(--line);
}

.health-metric,
.quick-fact,
.activity-item,
.service-card,
.tools-readiness-item,
.learning-panel {
    padding: 15px;
    background: var(--surface-input);
}

.health-metric strong {
    font: 650 24px/1 "JetBrains Mono", monospace;
}

.health-metric {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0,1fr) auto auto;
    align-items: baseline;
    gap: 4px 7px;
}
.health-metric-label { grid-column: 1 / -1; color: var(--ink-muted); font-size: .72rem; }
.health-metric > span:not(.health-metric-label) { color: var(--ink-faint); font: 550 .66rem/1 var(--font-mono); direction: ltr; }
.health-metric small { grid-column: 1 / -1; color: var(--ink-faint); font-size: .62rem; }
.weather-now { display: flex; align-items: center; gap: 16px; }
.weather-reading strong { display: block; color: var(--ink); font: 700 1.8rem/1 var(--font-mono); direction: ltr; }
.weather-reading span { display: block; margin-top: 8px; color: var(--ink-muted); font-size: .8rem; }
.weather-visual { position: relative; width: 64px; height: 64px; flex: 0 0 auto; display: grid; place-items: center; }
.weather-visual::before,
.weather-visual::after { content: ""; position: absolute; border-radius: 50%; border: 1px solid rgba(124,140,255,.22); }
.weather-visual::before { inset: 5px; animation: rotate 10s linear infinite; border-style: dashed; }
.weather-visual::after { inset: 17px; background: radial-gradient(circle at 65% 30%, var(--violet-soft), rgba(124,140,255,.08) 65%); }
.weather-visual span { position: relative; z-index: 1; width: 13px; height: 13px; border-radius: 50%; background: var(--diane); box-shadow: 0 0 18px rgba(124,140,255,.7); }
.weather-visual i { position: absolute; inset: auto 5px 12px auto; width: 7px; height: 7px; border-radius: 50%; background: var(--diane-blue); animation: presence 2s infinite; }
.weather-visual[data-weather="rain"] span,
.weather-visual[data-weather="storm"] span { border-radius: 3px 50% 50%; transform: rotate(45deg); }
.weather-visual[data-weather="snow"] span { background: #dcefff; }
.weather-details { margin-top: 16px; display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; }
.weather-stat { padding: 8px; color: var(--ink-muted); border: 1px solid var(--line); border-radius: 10px; background: var(--surface-input); font-size: .72rem; text-align: center; }

/* Health is a live diagnostic console, not another card. */
.health-console {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 26px;
    background: var(--surface-1);
    box-shadow: var(--shadow-lg);
}

.health-console > .vault-head {
    padding: clamp(24px,3vw,38px);
    margin: 0;
    background: radial-gradient(circle at 12% 0,rgba(124,140,255,.1),transparent 36%);
}

.health-command-strip {
    min-height: 150px;
    padding: 20px clamp(24px,3vw,38px);
    display: grid;
    grid-template-columns: minmax(260px,1.25fr) minmax(340px,1fr);
    align-items: center;
    gap: 34px;
    border-block: 1px solid var(--line);
    background: var(--surface-input);
}

.health-pulse-visual {
    position: relative;
    height: 74px;
    display: grid;
    place-items: center;
}

.health-pulse-visual svg {
    width: 100%;
    height: 52px;
    overflow: visible;
}

.health-pulse-visual path {
    fill: none;
    stroke: var(--diane);
    stroke-width: 2;
    stroke-linecap: round;
    filter: drop-shadow(0 0 7px rgba(124,140,255,.65));
    stroke-dasharray: 320;
    animation: health-scan 2.8s linear infinite;
}

.health-pulse-visual i {
    position: absolute;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--diane);
    box-shadow: 0 0 18px rgba(124,140,255,.9);
    animation: presence 2s ease-in-out infinite;
}

.health-pulse-visual i:nth-child(1) { inset-inline-start: 7%; }
.health-pulse-visual i:nth-child(2) { inset-inline-start: 51%; animation-delay: -.7s; }
.health-pulse-visual i:nth-child(3) { inset-inline-end: 4%; animation-delay: -1.3s; }

.health-command-strip .vault-summary {
    margin: 0;
}

.health-console-grid {
    display: grid;
    grid-template-columns: minmax(230px,280px) minmax(0,1fr);
    min-height: 360px;
}

.health-alert-panel {
    padding: 28px 24px;
    border-inline-end: 1px solid var(--line);
    background: var(--chrome);
}

.health-alert-panel h4 {
    margin: 7px 0 8px;
    font-size: 1.12rem;
}

.health-alert-panel p {
    margin: 0 0 22px;
    color: var(--ink-muted);
    font-size: .84rem;
    line-height: 1.65;
}

.health-alert-panel .health-channels {
    display: grid;
    gap: 8px;
}

.health-alert-panel .health-channel {
    min-height: 44px;
    padding: 8px 11px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-1);
}

.health-systems {
    padding: 24px;
}

@keyframes health-scan {
    from { stroke-dashoffset: 640; }
    to { stroke-dashoffset: 0; }
}

.health-console {
    border-color: var(--line);
    background: var(--surface-input);
}

.health-console-head {
    min-height: 82px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid rgba(91, 147, 195, .12);
}
.health-console-head h2 { margin: 0 0 5px; color: var(--ink); font-size: clamp(1.35rem, 2vw, 1.7rem); letter-spacing: -.025em; }
.health-console-head p { max-width: 680px; margin: 0; color: var(--ink-3); font-size: .64rem; line-height: 1.5; }
.health-console-actions { display: flex; align-items: center; justify-content: end; gap: 12px; flex-wrap: wrap; }
.health-console-actions > span { color: #577187; font: .52rem/1 var(--font-mono); }

.health-diagnostic-runner {
    min-height: 120px;
    padding: 14px 20px;
    display: grid;
    grid-template-columns: minmax(250px, 1fr) minmax(300px, 1.2fr) minmax(280px, .8fr);
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid rgba(91, 147, 195, .12);
    background: color-mix(in srgb, var(--surface-1) 82%, var(--diane-violet) 3%);
}
.health-verdict { min-width: 0; display: grid; grid-template-columns: 50px minmax(0, 1fr); align-items: center; gap: 12px; }
.health-verdict > div:last-child { min-width: 0; }
.health-verdict small { color: #567187; font-size: .53rem; }
.health-verdict strong { display: block; margin-top: 5px; overflow: hidden; color: var(--ink); font-size: 1rem; text-overflow: ellipsis; white-space: nowrap; }
.health-verdict p { margin: 7px 0 0; color: #526b80; font-size: .55rem; line-height: 1.55; }

.health-orbit {
    width: 48px;
    height: 48px;
    position: relative;
    display: grid;
    place-items: center;
    border: 1px solid rgba(74, 166, 224, .15);
    border-radius: 50%;
}
.health-orbit::before,
.health-orbit::after {
    content: "";
    position: absolute;
    border: 1px dashed rgba(76, 177, 239, .18);
    border-radius: 50%;
}
.health-orbit::before { inset: 7px; }
.health-orbit::after { inset: 15px; border-style: solid; background: rgba(49, 133, 185, .06); }
.health-orbit svg { position: relative; z-index: 2; width: 20px; height: 20px; fill: none; stroke: #73cbf7; stroke-width: 1.6; }
.health-orbit > span { position: absolute; inset: -3px; border: 1px solid transparent; border-top-color: #63c4f3; border-radius: 50%; opacity: 0; }
.health-orbit i { position: absolute; z-index: 3; width: 5px; height: 5px; border-radius: 50%; background: #5abdec; opacity: .25; }
.health-orbit i:nth-of-type(1) { top: 5px; left: 15px; }
.health-orbit i:nth-of-type(2) { right: 4px; bottom: 17px; }
.health-orbit i:nth-of-type(3) { left: 8px; bottom: 8px; }
.health-diagnostic-runner[data-state="scanning"] .health-orbit > span { opacity: 1; animation: rotate .9s linear infinite; }
.health-diagnostic-runner[data-state="scanning"] .health-orbit i { opacity: 1; animation: presence 1.2s ease-in-out infinite; }
.health-diagnostic-runner[data-state="healthy"] .health-orbit svg { stroke: #75d0fb; filter: drop-shadow(0 0 9px rgba(87, 195, 246, .5)); }
.health-diagnostic-runner[data-state="degraded"] .health-orbit svg { stroke: #f0ae62; }
.health-diagnostic-runner[data-state="down"] .health-orbit svg { stroke: #ef78ae; }

.health-scan-route {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: relative;
}
.health-scan-route::before {
    content: "";
    position: absolute;
    inset: 15px 12.5% auto;
    height: 1px;
    background: rgba(78, 137, 183, .18);
}
.health-scan-route > span {
    position: relative;
    z-index: 1;
    display: grid;
    justify-items: center;
    gap: 5px;
    color: #526b80;
}
.health-scan-route i {
    width: 30px;
    height: 30px;
    display: block;
    border: 1px solid rgba(80, 139, 185, .18);
    border-radius: 50%;
    background: #07111d;
}
.health-scan-route b { font: 600 .49rem/1 var(--font-mono); }
.health-scan-route small { font-size: .48rem; }
.health-diagnostic-runner[data-state="scanning"] .health-scan-route > span i {
    border-color: rgba(83, 189, 244, .46);
    box-shadow: inset 0 0 0 10px rgba(76, 176, 231, .07), 0 0 16px rgba(65, 168, 224, .12);
    animation: health-stage 2.8s ease-in-out infinite;
}
.health-diagnostic-runner[data-state="scanning"] .health-scan-route > span:nth-child(2) i { animation-delay: .45s; }
.health-diagnostic-runner[data-state="scanning"] .health-scan-route > span:nth-child(3) i { animation-delay: .9s; }
.health-diagnostic-runner[data-state="scanning"] .health-scan-route > span:nth-child(4) i { animation-delay: 1.35s; }
.health-diagnostic-runner:not([data-state="idle"]):not([data-state="scanning"]) .health-scan-route i {
    border-color: rgba(84, 189, 242, .35);
    background: radial-gradient(circle, #68c5f2 0 17%, #07111d 19%);
}

.health-summary {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 7px;
}
.health-summary .vault-fact {
    min-width: 0;
    min-height: 58px;
    padding: 10px 8px;
    display: grid;
    align-content: center;
    gap: 5px;
    border: 1px solid rgba(91, 147, 195, .12);
    border-radius: 12px;
    background: rgba(7, 17, 29, .78);
}
.health-summary .vault-fact strong { color: #d8e9f4; font: 650 1.15rem/1 var(--font-mono); }
.health-summary .vault-fact span { color: #5b7489; font-size: .49rem; }
.health-summary .vault-fact[data-tone="bad"] strong { color: #f08bb9; }
.health-summary .vault-fact[data-tone="warning"] strong { color: #e8a451; }
.health-summary .vault-fact[data-tone="missing"] strong { color: #e9ae68; }

.health-operational-section { padding: 18px 20px; border-bottom: 1px solid var(--line); background: var(--surface-input); }
.health-operational-section .health-systems-head { margin-bottom: 14px; align-items: center; }
.health-operational-section .health-systems-head p { max-width: 540px; margin: 0; color: #60798e; font-size: .54rem; line-height: 1.6; }
.health-operational-overview { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; }
.health-operational-card { min-width: 0; min-height: 72px; padding: 11px; display: grid; align-content: space-between; gap: 5px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-1); }
.health-operational-card span { color: #668096; font-size: .51rem; }
.health-operational-card strong { color: #bfd2df; font: 600 1rem/1 var(--font-mono); overflow-wrap: anywhere; }
.health-operational-card small { color: #526b80; font-size: .48rem; line-height: 1.5; }
.health-operational-card[data-tone="ok"] { border-color: rgba(76,189,146,.18); }
.health-operational-card[data-tone="warning"] { border-color: rgba(232,164,81,.26); }
.health-operational-card[data-tone="bad"] { border-color: rgba(255,105,136,.28); }
.health-operational-card[data-tone="env"],
.health-operational-card[data-tone="missing"] { border-style: dashed; }
.local-preview-badge {
    position: fixed;
    z-index: 10000;
    inset: auto auto 12px 12px;
    padding: 7px 10px;
    border: 1px solid rgba(232,164,81,.42);
    border-radius: 9px;
    color: #e8b36f;
    background: rgba(24,16,7,.94);
    box-shadow: 0 8px 26px rgba(0,0,0,.32);
    font: 600 .48rem/1 var(--font-mono);
    letter-spacing: .06em;
}

.health-console-grid { grid-template-columns: minmax(225px, 250px) minmax(0, 1fr); min-height: 480px; }
.health-alert-panel { padding: 22px 18px; border-color: var(--line); background: var(--surface-1); }
.health-alert-panel h4 { color: #c9dce8; }
.health-alert-panel p { color: #5f788e; font-size: .65rem; }
.health-alert-panel .health-channel {
    border-color: rgba(91, 147, 195, .12);
    background: rgba(8, 18, 30, .72);
}
.health-evidence-legend { margin-top: 18px; padding-top: 14px; display: grid; gap: 7px; border-top: 1px solid var(--line); }
.health-evidence-legend span { display: flex; align-items: center; gap: 8px; color: #526b80; font-size: .51rem; }
.health-evidence-legend i { width: 7px; height: 7px; border-radius: 50%; background: #657b8c; }
.health-evidence-legend i[data-tone="ok"] { background: #63c7f5; }
.health-evidence-legend i[data-tone="warning"] { background: #e8a451; }
.health-evidence-legend i[data-tone="bad"] { background: #ef75a9; }
.health-evidence-legend i[data-tone="missing"] { background: #e7a75e; }
.health-evidence-legend i[data-tone="env"] { background: #9a80d9; }

.health-systems { min-width: 0; padding: 22px 24px 30px; }
.health-systems-head { margin-bottom: 17px; display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.health-systems-head h3 { margin: 5px 0 0; color: #cfe0eb; font-size: 1.18rem; }
.health-systems-head > small { color: #50697d; font-size: .52rem; }
.health-service-groups { display: grid; gap: 20px; }
.health-service-group { min-width: 0; }
.health-service-group-head { margin-bottom: 9px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.health-service-group-head h4 { margin: 0; color: #7894a8; font-size: .61rem; }
.health-service-group-head span { color: #435c70; font: .47rem/1 var(--font-mono); }
.health-service-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

.health-service-card {
    min-width: 0;
    min-height: 132px;
    padding: 13px;
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: 35px minmax(0, 1fr) auto;
    align-content: start;
    gap: 10px;
    border: 1px solid rgba(91, 147, 195, .13);
    border-radius: 15px;
    background: linear-gradient(145deg, rgba(9, 21, 35, .82), rgba(5, 13, 22, .92));
}
.health-service-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 2px;
    background: #5d768a;
}
.health-service-card[data-tone="ok"]::before { background: #5fc3f0; }
.health-service-card[data-tone="warning"]::before { background: #e8a451; }
.health-service-card[data-tone="bad"]::before { background: #ed6fa5; }
.health-service-card[data-tone="missing"]::before { background: #e5a358; }
.health-service-card[data-tone="env"]::before { background: #947bd4; }
.health-service-mark {
    width: 35px;
    height: 35px;
    display: grid;
    place-items: center;
    color: #6f8ca1;
    border: 1px solid rgba(91, 147, 195, .14);
    border-radius: 10px;
    background: rgba(52, 117, 164, .07);
    font: 650 .48rem/1 var(--font-mono);
}
.health-service-card[data-tone="ok"] .health-service-mark { color: #7ed0f7; }
.health-service-card[data-tone="warning"] .health-service-mark { color: #e8a451; }
.health-service-card[data-tone="bad"] .health-service-mark { color: #ef83b2; }
.health-service-copy { min-width: 0; }
.health-service-copy strong { display: block; overflow: hidden; color: #bacfdd; font-size: .63rem; text-overflow: ellipsis; white-space: nowrap; }
.health-service-copy p { min-height: 32px; margin: 7px 0 0; color: #536c80; font-size: .52rem; line-height: 1.45; }
.health-service-copy small { display: block; margin-top: 8px; color: #40596c; font-size: .47rem; }
.health-service-state { padding: 4px 7px; color: #647e91; border-radius: 99px; background: rgba(89, 121, 145, .08); font-size: .47rem; white-space: nowrap; }
.health-service-card[data-tone="ok"] .health-service-state { color: #75cdf4; background: rgba(75, 173, 224, .08); }
.health-service-card[data-tone="warning"] .health-service-state { color: #e8a451; background: rgba(232, 164, 81, .08); }
.health-service-card[data-tone="bad"] .health-service-state { color: #ed82b1; background: rgba(206, 78, 135, .08); }
.health-service-card[data-tone="missing"] .health-service-state { color: #e4ad6b; background: rgba(200, 132, 58, .08); }
.health-service-card[data-tone="env"] .health-service-state { color: #a38bdc; background: rgba(119, 88, 188, .08); }
.health-service-foot {
    grid-column: 1 / -1;
    margin-top: auto;
    padding-top: 10px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    border-top: 1px solid rgba(91, 147, 195, .08);
}
.health-latency { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.health-latency > i { height: 3px; overflow: hidden; border-radius: 99px; background: rgba(81, 125, 158, .12); }
.health-latency > i::after { content: ""; display: block; width: var(--latency); height: 100%; border-radius: inherit; background: #5fbae8; }
.health-latency span { color: #496277; font: .46rem/1 var(--font-mono); }
.health-service-checked { color: #567087; font: .46rem/1 var(--font-mono); white-space: nowrap; }
.health-service-test { min-height: 27px; padding: 5px 9px; color: #6fa8ca; border: 1px solid rgba(91, 147, 195, .15); border-radius: 8px; background: transparent; font-size: .49rem; }
.health-service-test:disabled { opacity: .55; }
.health-service-card[data-state="scanning"] { border-color: rgba(79, 180, 236, .3); }
.health-service-card[data-state="scanning"]::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, transparent 30%, rgba(91, 189, 242, .08) 50%, transparent 70%);
    animation: health-card-scan 1.1s linear infinite;
}

@keyframes health-stage {
    0%, 100% { box-shadow: inset 0 0 0 10px rgba(76, 176, 231, .03); }
    50% { box-shadow: inset 0 0 0 10px rgba(76, 176, 231, .14), 0 0 18px rgba(65, 168, 224, .18); }
}
@keyframes health-card-scan { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* Chat — native conversation workspace */
#page-chat {
    width: 100%;
    max-width: none;
    height: calc(100vh - 72px);
    padding: 0;
    overflow: hidden;
}

#page-chat > .page-intro {
    display: none;
}

.chat-stage {
    height: 100%;
    display: grid;
    grid-template-columns: 292px minmax(0,1fr);
    background: var(--canvas);
}

.chat-library {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: auto auto auto auto minmax(0,1fr);
    border-inline-end: 1px solid var(--line);
    background: var(--chrome);
}

.chat-library-head {
    min-height: 78px;
    padding: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-library-head > span {
    font-size: 18px;
    font-weight: 650;
}

.btn-new-chat {
    width: auto;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid rgba(124,140,255,.2);
    background: var(--diane-soft);
    color: #8fe3ff;
}

.btn-new-chat svg,
.chat-context-tools svg,
.chat-composer svg,
.chat-library-search svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chat-library-search,
.chat-inline-search {
    height: 42px;
    margin: 0 14px 14px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: var(--r-2);
    background: var(--surface-1);
    color: var(--ink-3);
}

.chat-library-search input,
.chat-inline-search input {
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.conversations-list {
    min-height: 0;
    min-width: 0;
    padding: 0 8px 16px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

.chat-list-loading {
    display: grid;
    gap: 8px;
}

.chat-list-loading i {
    height: 50px;
    border-radius: 10px;
    background: linear-gradient(90deg,var(--surface-1),var(--surface-2),var(--surface-1));
    background-size: 220% 100%;
    animation: shimmer 1.5s linear infinite;
}

.conv-item {
    min-height: 60px;
    min-width: 0;
    margin: 2px 0;
    padding: 11px 12px;
    border-radius: 10px;
    overflow: hidden;
    transition: var(--transition);
}

.conv-item:hover {
    background: var(--surface-1);
}

.conv-item.active {
    background: var(--surface-2);
    box-shadow: inset -2px 0 var(--diane);
}

.conv-title {
    display: block;
    min-width: 0;
    overflow: hidden;
    color: var(--ink);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conv-meta {
    display: block;
    min-width: 0;
    overflow: hidden;
    color: var(--ink-3);
    font-size: 10px;
    font-variant-numeric: tabular-nums;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-canvas {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: 78px auto minmax(0,1fr) auto;
    background: radial-gradient(circle at 50% 30%,rgba(57,141,255,.07),transparent 34%);
}

/* Pinned canvas rows: the live-activity shelf is display:none while idle.
   Without explicit placement the messages fall into the auto track and the
   composer floats above the empty 1fr track instead of sticking to bottom. */
.chat-context-bar { grid-row: 1; }
.chat-live-activity { grid-row: 2; }
.chat-messages-container { grid-row: 3; }
.chat-composer { grid-row: 4; }

.chat-context-bar {
    padding: 12px clamp(16px,3vw,36px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border-bottom: 1px solid var(--line);
}

.chat-active-copy {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-active-copy h3,
.chat-active-copy p {
    margin: 0;
}

.chat-active-copy h3 {
    font-size: 14px;
}

.chat-active-copy p {
    margin-top: 3px;
    color: var(--ink-3);
    font-size: 10px;
}

.chat-presence {
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    position: relative;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
}

.chat-presence i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--diane);
    box-shadow: 0 0 12px var(--diane);
    animation: presence 2s ease-in-out infinite;
}

.chat-context-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-library-toggle {
    display: none;
}

.chat-inline-search {
    width: 180px;
    margin: 0;
}

.chat-channel-select {
    min-height: 44px;
    padding: 2px 4px 2px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: var(--r-2);
    background: var(--surface-1);
}

.chat-channel-select span {
    color: var(--ink-3);
    font-size: 10px;
}

.chat-channel-select select {
    width: auto;
    min-height: 40px;
    padding: 0 10px;
    border: 0;
    background: transparent;
    box-shadow: none;
    font-size: 11px;
}

.chat-messages-container {
    min-height: 0;
    min-width: 0;
    padding: 28px max(24px,calc((100% - 820px)/2));
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

.chat-zero-state {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.diane-listening-orb {
    width: 112px;
    aspect-ratio: 1;
    margin-bottom: 24px;
    display: grid;
    place-items: center;
    position: relative;
}

.diane-listening-orb::before {
    content: "";
    position: absolute;
    inset: 34%;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%,#d3f6ff,var(--diane) 25%,#1b65ae 62%,#091428);
    box-shadow: 0 0 32px rgba(124,140,255,.25);
    animation: orb 4s ease-in-out infinite;
}

.diane-listening-orb span {
    position: absolute;
    border: 1px solid rgba(124,140,255,.16);
    border-radius: 50%;
}

.diane-listening-orb span:nth-child(1) { inset: 20%; }
.diane-listening-orb span:nth-child(2) { inset: 8%; }
.diane-listening-orb span:nth-child(3) { inset: -4%; }

.chat-zero-state p {
    margin: 0;
    font-size: clamp(24px,3vw,34px);
    font-weight: 550;
}

.chat-zero-state small {
    max-width: 430px;
    margin-top: 9px;
    color: var(--ink-3);
    line-height: 1.7;
}

.chat-composer {
    width: min(calc(100% - 40px),860px);
    margin: 0 auto;
    padding-bottom: 18px;
}

.chat-compose-shell {
    min-height: 62px;
    padding: 8px 9px 8px 17px;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    border: 1px solid var(--line-strong);
    border-radius: 22px;
    background: var(--surface-1);
    box-shadow: 0 18px 48px rgba(0,0,0,.3);
}

.chat-compose-shell:focus-within {
    border-color: var(--diane);
    box-shadow: 0 0 0 3px var(--diane-soft),0 18px 52px rgba(0,0,0,.35);
}

.chat-compose-shell textarea {
    min-height: 44px;
    max-height: 140px;
    padding: 11px 4px;
    resize: none;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.btn-send-chat {
    width: 44px;
    height: 44px;
    min-height: 44px;
    flex: 0 0 auto;
    padding: 0;
    display: grid;
    place-items: center;
    border-radius: 15px;
}

.chat-composer-meta {
    padding: 7px 8px 0;
    display: flex;
    justify-content: space-between;
    color: #4d5c70;
    font-size: 9px;
}

.quoted-preview-box {
    display: none;
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--surface-2);
}

.chat-bubble-wrapper {
    max-width: min(78%,700px);
    margin-bottom: 20px;
    animation: message-enter 320ms var(--ease) both;
}

.chat-bubble-wrapper.user { margin-inline-start: auto; }
.chat-bubble-wrapper.assistant { margin-inline-end: auto; }

.chat-bubble {
    padding: 13px 16px;
    border-radius: 18px;
    background: var(--surface-2);
    color: #dce5f0;
    line-height: 1.75;
}

.chat-bubble-wrapper.user .chat-bubble {
    background: #103252;
}

.chat-bubble-header {
    margin-bottom: 5px;
    color: var(--ink-3);
    font-size: 9px;
}

/* Phone and sleep */
.phone-page.active {
    display: grid;
    gap: 12px;
}

.phone-hero-card {
    min-height: 520px;
    background: radial-gradient(circle at 22% 40%,rgba(124,140,255,.09),transparent 28%),var(--surface-1);
}

.phone-hero-layout {
    display: grid;
    grid-template-columns: 1.3fr .7fr;
    align-items: center;
    gap: 44px;
}

.phone-hero-copy h2 {
    margin: 16px 0;
    font-size: clamp(42px,6vw,74px);
    line-height: .98;
    letter-spacing: -.055em;
}

.phone-device-visual {
    width: 220px;
    aspect-ratio: 1;
    margin-inline: auto;
    display: grid;
    place-items: center;
    position: relative;
}

.phone-device-visual svg {
    width: 64px;
    height: 64px;
    fill: none;
    stroke: var(--ink);
    stroke-width: 1.2;
}

.phone-device-ring {
    position: absolute;
    inset: 14%;
    border: 1px solid var(--line);
    border-radius: 50%;
}

.phone-device-ring-b {
    inset: 0;
    border-style: dashed;
    animation: rotate 24s linear infinite;
}

.phone-link-state,
.sleep-wear {
    width: fit-content;
    margin-top: 18px;
    padding: 7px 11px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 99px;
    background: var(--surface-2);
    color: var(--ink-2);
    font-size: 11px;
}

.phone-link-dot,
.sleep-wear-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ink-3);
}

[data-state="connected"] .phone-link-dot,
.sleep-wear[data-state="on"] .sleep-wear-dot {
    background: var(--ok);
}

.phone-link-state[data-state="loading"] .phone-link-dot {
    animation: live-pulse 1s ease-out infinite;
}

.phone-hero-actions {
    margin-top: 24px;
    padding-top: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--line);
}

.vault-actions {
    display: flex;
    gap: 8px;
}

.phone-link-steps,
.phone-checks,
.phone-signal-grid {
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: 1px;
    overflow: hidden;
    border-radius: var(--r-2);
    background: var(--line);
    list-style: none;
}

.phone-link-step,
.phone-check,
.phone-signal {
    padding: 16px;
    background: var(--surface-input);
}

.phone-link-step {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
}

.phone-link-step-mark {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    counter-increment: phone-step;
}

.phone-link-step[data-state="done"] .phone-link-step-mark {
    border-color: var(--ok);
    background: var(--ok);
    color: #05140e;
}

.phone-link-step small,
.phone-check small,
.phone-signal span,
.phone-link-hint,
.phone-doc-note {
    color: var(--ink-3);
    font-size: 10px;
}

.phone-link-grid {
    margin: 18px 0;
    display: grid;
    grid-template-columns: repeat(2,1fr);
    gap: 1px;
    overflow: hidden;
    border-radius: var(--r-2);
    background: var(--line);
}

.phone-link-field {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--surface-input);
}

.phone-config-card {
    padding: 0;
}

.phone-config-summary {
    padding: 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    list-style: none;
    cursor: pointer;
}

.phone-config-content {
    padding: 22px;
    border-top: 1px solid var(--line);
}

.sleep-night-map,
.sleep-empty-state {
    min-height: 280px;
    padding: 28px;
    border-radius: var(--r-3);
    background: radial-gradient(circle at 20% 40%,rgba(139,124,255,.1),transparent 30%),#070d18;
}

.sleep-night-map {
    display: grid;
    grid-template-columns: .8fr 1.2fr;
    align-items: center;
    gap: 48px;
}

.sleep-dial {
    width: 220px;
    aspect-ratio: 1;
    margin-inline: auto;
    display: grid;
    place-items: center;
    position: relative;
}

.sleep-dial > svg {
    width: 100%;
    transform: rotate(-90deg);
}

.sleep-dial circle {
    fill: none;
    stroke-width: 5;
}

.sleep-dial-track { stroke: var(--line); }
.sleep-dial-value {
    stroke: var(--diane);
    stroke-linecap: round;
    stroke-dasharray: 427;
    stroke-dashoffset: calc(427 - (427 * var(--sleep-ratio)));
    filter: drop-shadow(0 0 8px rgba(124,140,255,.55));
}

.sleep-dial-core {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.sleep-dial-core strong {
    margin: 6px 0;
    font: 650 30px/1 "JetBrains Mono",monospace;
}

.sleep-dial-core span,
.sleep-dial-core small {
    color: var(--ink-3);
    font-size: 10px;
}

.sleep-night-times {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
}

.sleep-time-event {
    display: grid;
    justify-items: center;
    gap: 5px;
}

.sleep-time-event strong {
    font: 600 20px/1 "JetBrains Mono",monospace;
}

.sleep-time-event span {
    color: var(--ink-3);
    font-size: 10px;
}

.sleep-time-line {
    height: 1px;
    background: var(--line);
}

.sleep-flow {
    margin-top: 14px;
    padding: 18px;
    border-radius: var(--r-2);
    background: var(--surface-input);
}

.sleep-track {
    height: 46px;
    margin-top: 14px;
    position: relative;
    overflow: hidden;
    border-radius: var(--r-1);
    background: #03070d;
}

.sleep-block {
    position: absolute;
    inset-block: 7px;
    border-radius: 6px;
    background: linear-gradient(90deg,var(--diane-blue),var(--diane));
}

.sleep-week-bars {
    min-height: 120px;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    align-items: end;
    gap: 7px;
}

.sleep-bar {
    height: 120px;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    background: transparent;
}

.sleep-bar-fill {
    width: 58%;
    max-width: 30px;
    border-radius: 6px 6px 2px 2px;
    background: linear-gradient(var(--diane),#195c96);
}

/* Device command center */
.phone-page.active {
    display: grid;
    gap: 14px;
}

.phone-command-center,
.sleep-observatory,
.phone-signal-console,
.phone-config-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid rgba(91, 147, 195, .16);
    border-radius: 18px;
    background: var(--surface-1);
    box-shadow: none;
}

.phone-command-center {
    background: var(--surface-1);
}

.phone-command-head,
.sleep-observatory-head,
.phone-signal-console > header {
    padding: 25px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    border-bottom: 1px solid rgba(91, 147, 195, .12);
}

.phone-command-head h2,
.sleep-observatory-head h3,
.phone-signal-console h3 {
    margin: 6px 0 7px;
    color: #e4f2fc;
    letter-spacing: -.035em;
}

.phone-command-head h2 { font-size: clamp(1.55rem, 2.4vw, 2.15rem); }
.sleep-observatory-head h3,
.phone-signal-console h3 { font-size: clamp(1.25rem, 2.2vw, 1.75rem); }
.phone-command-head p,
.sleep-observatory-head p,
.phone-signal-console header p {
    max-width: 680px;
    margin: 0;
    color: #698198;
    font-size: .68rem;
    line-height: 1.7;
}

.phone-command-actions {
    display: flex;
    align-items: center;
    justify-content: end;
    gap: 8px;
    flex-wrap: wrap;
}

.phone-link-state {
    margin: 0;
    border: 1px solid rgba(93, 145, 190, .16);
    background: rgba(6, 14, 24, .7);
}

.phone-link-state[data-state="connected"] {
    color: #9edfff;
    border-color: rgba(72, 185, 255, .3);
    background: rgba(30, 126, 184, .1);
}

.phone-link-state[data-state="pending"],
.phone-link-state[data-state="error"] { color: #e1a8ff; }

.phone-command-layout {
    min-height: 390px;
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(250px, .65fr);
    border-bottom: 1px solid rgba(91, 147, 195, .12);
}

.phone-bridge-stage {
    min-width: 0;
    position: relative;
    overflow: hidden;
    isolation: isolate;
    background:
        linear-gradient(rgba(61, 120, 171, .055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(61, 120, 171, .055) 1px, transparent 1px);
    background-size: 34px 34px;
}

.phone-bridge-stage::before {
    content: "";
    position: absolute;
    inset: 18% 28%;
    border-radius: 50%;
    background: rgba(58, 172, 244, .08);
    filter: blur(48px);
}

.phone-bridge-paths {
    position: absolute;
    inset: 20px 4%;
    width: 92%;
    height: calc(100% - 40px);
    overflow: visible;
}

.bridge-path {
    fill: none;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-dasharray: 5 9;
}
.bridge-path-out { stroke: rgba(65, 189, 255, .4); }
.bridge-path-back { stroke: rgba(142, 101, 255, .36); }

.bridge-node,
.phone-device-visual {
    position: absolute;
    z-index: 2;
}

.bridge-node {
    width: 116px;
    min-height: 76px;
    padding: 12px;
    display: grid;
    grid-template-columns: 28px 1fr;
    align-items: center;
    gap: 3px 8px;
    border: 1px solid rgba(91, 147, 195, .2);
    border-radius: 16px;
    background: rgba(5, 13, 23, .9);
    box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
}
.bridge-node svg { width: 27px; height: 27px; grid-row: 1 / 3; fill: none; stroke: #86cff7; stroke-width: 1.5; }
.bridge-node span { color: #d6e7f3; font-size: .63rem; font-weight: 720; }
.bridge-node small { color: #597288; font-size: .5rem; }
.bridge-node-diane { inset: 36% auto auto 5%; }
.bridge-node-cloud { inset: 12% auto auto 42%; }
.bridge-node-watch { inset: auto 4% 8% auto; }
.bridge-node-watch svg { stroke: #ad8cff; }

.phone-device-visual {
    inset: 31% 8% auto auto;
    width: 148px;
    margin: 0;
}
.phone-device-visual > svg { width: 54px; height: 54px; stroke: #dcf2ff; }
.phone-device-visual strong {
    position: absolute;
    inset: auto 50% 17% auto;
    max-width: 110px;
    color: #7893a8;
    font: 620 .53rem/1.2 var(--font-mono);
    text-align: center;
    transform: translateX(50%);
}
.phone-device-ring-a { border-color: rgba(62, 181, 243, .34); }
.phone-device-ring-b { border-color: rgba(132, 94, 255, .22); }

.bridge-packet {
    position: absolute;
    z-index: 3;
    width: 8px;
    height: 8px;
    border: 2px solid #07121d;
    border-radius: 50%;
    background: #5bc6ff;
    box-shadow: 0 0 16px rgba(67, 189, 255, .8);
    opacity: 0;
}
.bridge-packet-b { background: #a179ff; box-shadow: 0 0 16px rgba(148, 103, 255, .75); }

.phone-bridge-stage[data-state="loading"] .bridge-path-out { animation: bridge-dash 1.1s linear infinite; }
.phone-bridge-stage[data-state="loading"] .bridge-path-back { animation: bridge-dash-reverse 1.25s linear infinite; }
.phone-bridge-stage[data-state="loading"] .phone-device-ring-a { animation: bridge-check-pulse .9s ease-in-out infinite; }
.phone-bridge-stage[data-state="loading"] .phone-device-ring-b { animation: bridge-check-pulse .9s .18s ease-in-out infinite; }
.phone-bridge-stage[data-state="loading"] .bridge-packet-a { animation: bridge-packet-a 1.45s ease-in-out infinite; }
.phone-bridge-stage[data-state="loading"] .bridge-packet-b { animation: bridge-packet-b 1.7s .2s ease-in-out infinite; }
.phone-bridge-stage[data-state="connected"] .bridge-path { stroke-dasharray: none; }

.phone-live-panel {
    min-width: 0;
    padding: 20px;
    border-inline-start: 1px solid rgba(91, 147, 195, .12);
    background: rgba(2, 8, 15, .54);
}
.phone-live-panel-head { margin-bottom: 12px; display: flex; justify-content: space-between; gap: 12px; }
.phone-live-panel-head span { color: #bcd2e2; font-size: .66rem; font-weight: 700; }
.phone-live-panel-head small { color: #4f687d; font-size: .51rem; }
.phone-live-panel .phone-checks { display: grid; grid-template-columns: 1fr; gap: 7px; overflow: visible; background: transparent; }
.phone-live-panel .phone-check {
    min-width: 0;
    padding: 12px;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    border: 1px solid rgba(91, 147, 195, .13);
    border-radius: 12px;
    background: rgba(8, 19, 32, .7);
}
.phone-check-icon {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    color: #5f819a;
    border-radius: 8px;
    background: rgba(54, 126, 177, .09);
    font: 650 .43rem/1 var(--font-mono);
}
.phone-check[data-tone="ok"] .phone-check-icon { color: #72cdfa; background: rgba(53, 172, 234, .12); }
.phone-check[data-tone="bad"] .phone-check-icon { color: #ef8fc5; background: rgba(210, 73, 145, .1); }
.phone-check-badge {
    padding: 4px 7px;
    color: #668096;
    border-radius: 99px;
    background: rgba(70, 105, 133, .1);
    font-size: .48rem;
}
.phone-check[data-tone="ok"] .phone-check-badge { color: #80d8ff; }
.phone-link-result { margin-top: 12px; padding: 13px; border: 1px solid rgba(91, 147, 195, .16); border-radius: 12px; background: rgba(8, 19, 32, .84); }
.phone-link-result-head { display: flex; justify-content: space-between; gap: 12px; }
.phone-link-result p { margin: 8px 0 0; color: #68839a; font-size: .58rem; line-height: 1.6; }
.phone-link-result-close { width: 24px; height: 24px; padding: 0; border: 0; border-radius: 7px; background: rgba(77, 111, 139, .12); color: #7893a8; }

.phone-console-metrics,
.sleep-insights {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}
.phone-console-metrics > div,
.sleep-insights > div {
    min-width: 0;
    padding: 18px 20px;
    display: grid;
    gap: 5px;
    border-inline-start: 1px solid rgba(91, 147, 195, .1);
}
.phone-console-metrics > div:first-child,
.sleep-insights > div:first-child { border-inline-start: 0; }
.phone-console-metrics span,
.sleep-insights span { color: #587187; font-size: .54rem; }
.phone-console-metrics strong,
.sleep-insights strong { overflow: hidden; color: #d9ebf7; font: 650 1.12rem/1.2 var(--font-mono); text-overflow: ellipsis; white-space: nowrap; }
.phone-console-metrics small,
.sleep-insights small { color: #425b70; font-size: .49rem; line-height: 1.4; }

.phone-command-center .phone-link-steps {
    margin: 0;
    border-top: 1px solid rgba(91, 147, 195, .1);
    border-radius: 0;
    background: transparent;
}
.phone-command-center .phone-link-step {
    min-width: 0;
    padding: 17px 20px;
    position: relative;
    border-inline-start: 1px solid rgba(91, 147, 195, .1);
    background: rgba(4, 11, 19, .56);
}
.phone-command-center .phone-link-step:first-child { border-inline-start: 0; }
.phone-command-center .phone-link-step-mark {
    width: 29px;
    height: 29px;
    color: #526d82;
    border-color: rgba(91, 147, 195, .22);
    background: #07111d;
    font: 650 .47rem/1 var(--font-mono);
}
.phone-command-center .phone-link-step[data-state="done"] .phone-link-step-mark {
    color: #07111d;
    border-color: #63c8f8;
    background: #63c8f8;
    box-shadow: 0 0 18px rgba(74, 187, 244, .22);
}
.phone-command-center .phone-link-step[data-state="active"] .phone-link-step-mark {
    color: #d1bfff;
    border-color: #916dff;
}

.sleep-observatory {
    padding-bottom: 24px;
    background: var(--surface-1);
}
.sleep-observatory-head > div:last-child { display: flex; align-items: center; justify-content: end; gap: 8px; flex-wrap: wrap; }
.sleep-range-picker { display: inline-flex; align-items: center; gap: 7px; color: #627d91; font-size: .52rem; }
.sleep-range-picker select { min-height: 34px; width: 86px; padding: 0 9px; color: #a9bfd0; border: 1px solid rgba(91,147,195,.18); border-radius: 9px; background: rgba(4,11,19,.72); }
.sleep-observatory .sleep-wear { margin: 0; border: 1px solid rgba(121, 93, 222, .2); background: rgba(65, 40, 133, .12); }
.sleep-wear[data-state="on"] { color: #c8b8ff; }
.sleep-wear[data-state="on"] .sleep-wear-dot { background: #9b7aff; box-shadow: 0 0 0 5px rgba(135, 97, 255, .08); }
.sleep-insights { border-bottom: 1px solid rgba(91, 147, 195, .1); }
.sleep-observatory .sleep-hero { padding: 20px 24px 0; }
.sleep-observatory .sleep-night-map,
.sleep-observatory .sleep-empty-state {
    min-height: 250px;
    border: 1px solid rgba(98, 119, 190, .13);
    background:
        radial-gradient(circle at 20% 40%, rgba(139, 124, 255, .12), transparent 31%),
        linear-gradient(145deg, rgba(8, 17, 30, .9), rgba(4, 10, 18, .96));
}
.sleep-dial-value { stroke: #8f72ff; filter: drop-shadow(0 0 8px rgba(124, 91, 255, .58)); }
.sleep-dial-orbit {
    position: absolute;
    inset: 16%;
    border: 1px dashed rgba(142, 114, 255, .21);
    border-radius: 50%;
}
.sleep-time-line { position: relative; overflow: visible; }
.sleep-time-line::after {
    content: "";
    position: absolute;
    inset: 50% auto auto 0;
    width: 18px;
    height: 3px;
    border-radius: 99px;
    background: #8c70ff;
    box-shadow: 0 0 12px rgba(140, 112, 255, .65);
}
.sleep-block { background: linear-gradient(90deg, #456ca7, #8f72ff); box-shadow: 0 0 18px rgba(116, 89, 238, .18); }
.sleep-stage[data-stage*="awake"] { background: #d79273; }
.sleep-stage[data-stage*="rem"] { background: #9a78ff; }
.sleep-stage[data-stage*="deep"] { background: #315a9c; }
.sleep-stage[data-stage*="light"] { background: #5688c7; }
.phone-device-facts { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); border-bottom: 1px solid rgba(91,147,195,.1); }
.phone-device-facts > div { min-width: 0; padding: 12px 18px; border-inline-start: 1px solid rgba(91,147,195,.08); }
.phone-device-facts > div:first-child { border-inline-start: 0; }
.phone-device-facts span { display: block; color: #526d82; font-size: .49rem; }
.phone-device-facts strong { display: block; margin-top: 5px; overflow-wrap: anywhere; color: #a8bfd0; font-size: .58rem; }
.sleep-observatory .sleep-week { margin: 16px 24px 0; padding: 18px; border: 1px solid rgba(91, 147, 195, .12); border-radius: 17px; background: rgba(3, 9, 16, .6); }
.sleep-week-head { display: flex; justify-content: space-between; gap: 16px; color: #6b8499; font-size: .59rem; }
.sleep-week-chart { height: 180px; margin-top: 12px; position: relative; overflow-x: auto; overflow-y: hidden; scrollbar-gutter: stable; }
.sleep-target-band {
    position: absolute;
    z-index: 0;
    inset: 10% 0 30%;
    border-block: 1px dashed rgba(129, 101, 241, .22);
    background: rgba(119, 89, 222, .045);
    pointer-events: none;
}
.sleep-target-band small { position: absolute; inset: 5px auto auto 8px; color: #5e548f; font: .46rem/1 var(--font-mono); }
.sleep-week-bars { height: 100%; position: relative; z-index: 1; direction: ltr; }
.sleep-week[data-range="month"] .sleep-week-bars { min-width: 720px; }
.sleep-bar { height: 100%; cursor: pointer; }
.sleep-bar-fill { width: min(36px, 58%); background: linear-gradient(#9477ff, #315f98); transition: filter .2s ease, transform .2s ease; }
.sleep-bar:hover .sleep-bar-fill,
.sleep-bar.active .sleep-bar-fill { filter: brightness(1.25); transform: translateY(-3px); }
.sleep-bar-val,
.sleep-bar-day { color: #647f95; font: .5rem/1 var(--font-mono); }
.sleep-day-detail { margin-top: 14px; padding: 14px; border-radius: 12px; background: rgba(16, 28, 44, .65); }
.sleep-detail-head { margin-bottom: 8px; color: #8ba4b8; font-size: .56rem; }
.sleep-seg { padding: 7px 0; display: flex; justify-content: space-between; color: #607b91; border-top: 1px solid rgba(91, 147, 195, .08); font-size: .55rem; }
.sleep-seg strong { color: #b8a8ff; font-family: var(--font-mono); }

.phone-signal-console > header { min-height: 120px; }
.phone-signal-live { display: inline-flex; align-items: center; gap: 7px; color: #6d8aa1; font-size: .56rem; white-space: nowrap; }
.phone-signal-live i { width: 7px; height: 7px; border-radius: 50%; background: #5dbff0; }
.phone-live-signal-stream { min-height: 94px; padding: 8px 20px; display: grid; }
.phone-signal-event {
    min-width: 0;
    padding: 10px 8px;
    display: grid;
    grid-template-columns: 88px 10px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(91, 147, 195, .08);
}
.phone-signal-event:last-child { border-bottom: 0; }
.phone-signal-event time { color: #567187; font: .51rem/1 var(--font-mono); direction: ltr; }
.phone-signal-event > i { width: 7px; height: 7px; border-radius: 50%; background: #5fc3f4; box-shadow: 0 0 0 4px rgba(77, 178, 232, .06); }
.phone-signal-event strong { display: block; color: #afc5d5; font-size: .59rem; }
.phone-signal-event small { display: block; margin-top: 3px; overflow: hidden; color: #526d82; font-size: .51rem; text-overflow: ellipsis; white-space: nowrap; }
.phone-signal-event > span:last-child { color: #6b8aa0; font: .49rem/1 var(--font-mono); white-space: nowrap; }
.phone-signal-console .phone-signal-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-top: 1px solid rgba(91, 147, 195, .1);
    border-radius: 0;
    background: transparent;
}
.phone-signal-console .phone-signal {
    min-width: 0;
    display: grid;
    grid-template-columns: 31px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    border-inline-start: 1px solid rgba(91, 147, 195, .08);
    background: rgba(4, 11, 19, .54);
}
.phone-signal-console .phone-signal:first-child { border-inline-start: 0; }
.phone-signal svg { width: 27px; height: 27px; fill: none; stroke: #769bb5; stroke-width: 1.4; }
.phone-signal strong { display: block; color: #aac0d0; font-size: .59rem; }
.phone-signal span { display: block; margin-top: 4px; line-height: 1.45; }

.phone-config-card { background: rgba(5, 12, 21, .84); }
.phone-config-summary { padding: 20px 24px; justify-content: start; gap: 12px; }
.phone-config-summary > span:nth-child(2) { flex: 1; display: grid; gap: 4px; }
.phone-config-summary strong { color: #b9cfdd; font-size: .68rem; }
.phone-config-summary small { color: #536d82; font-size: .53rem; }
.phone-config-summary-icon { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 10px; background: rgba(63, 133, 181, .09); }
.phone-config-chevron { color: #627d91; transition: transform .2s ease; }
.phone-config-card[open] .phone-config-chevron { transform: rotate(180deg); }

@keyframes bridge-dash { to { stroke-dashoffset: -140; } }
@keyframes bridge-dash-reverse { to { stroke-dashoffset: 140; } }
@keyframes bridge-breathe { 50% { opacity: .45; transform: scale(.96); } }
@keyframes bridge-check-pulse { 50% { opacity: .42; transform: scale(.9); } }
@keyframes bridge-packet-a {
    0%, 8% { left: 12%; top: 47%; opacity: 0; }
    20% { opacity: 1; }
    48% { left: 49%; top: 18%; }
    80% { left: 78%; top: 42%; opacity: 1; }
    92%, 100% { left: 84%; top: 54%; opacity: 0; }
}
@keyframes bridge-packet-b {
    0%, 7% { left: 84%; top: 59%; opacity: 0; }
    18% { opacity: 1; }
    52% { left: 48%; top: 74%; }
    82% { left: 16%; top: 52%; opacity: 1; }
    94%, 100% { left: 10%; top: 46%; opacity: 0; }
}
@keyframes sleep-line-travel {
    0%, 100% { left: 0; opacity: .2; }
    50% { left: calc(100% - 18px); opacity: 1; }
}

/* Catalogs, logs, tables */
.services-grid,
.books-grid,
.tools-list {
    display: grid;
    grid-template-columns: repeat(auto-fill,minmax(220px,1fr));
    gap: 8px;
}

#page-tools {
    --tool-rail: 300px;
}

.tools-registry-console.card,
.tools-deployment-console.card {
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
}

.tools-registry-console.card {
    padding: clamp(22px,3vw,38px);
    background:
        radial-gradient(circle at 85% 0,rgba(124,140,255,.085),transparent 32%),
        var(--surface-1);
}

.tools-toolbar {
    margin: 24px 0 12px;
    padding: 7px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--surface-input);
}

.tools-toolbar input {
    min-width: 240px;
    flex: 1;
    border: 0;
    background: transparent;
}

.tools-count {
    padding: 7px 11px;
    color: var(--diane);
    border-radius: 10px;
    background: rgba(124,140,255,.08);
    font: 700 .72rem/1 var(--font-mono);
}

.tools-category-filter {
    display: flex;
    gap: 6px;
    padding: 3px 0 16px;
    overflow-x: auto;
    scrollbar-width: none;
}

.tools-category-filter::-webkit-scrollbar { display: none; }

.tools-category-chip {
    min-height: 34px;
    min-width: max-content;
    padding: 6px 12px;
    color: var(--ink-muted);
    border: 1px solid var(--line);
    border-radius: 999px;
    background: transparent;
    font-size: .76rem;
}

.tools-category-chip.is-active {
    color: var(--ink);
    border-color: rgba(124,140,255,.32);
    background: rgba(124,140,255,.1);
    box-shadow: inset 0 0 18px rgba(124,140,255,.04);
}

.tools-category {
    grid-column: 1 / -1;
}

.tools-category > h4 {
    margin: 22px 0 9px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ink);
    font-size: .9rem;
}

.tools-category > h4 span {
    color: var(--diane);
    font: 700 .68rem/1 var(--font-mono);
}

.tools-category-list {
    display: grid;
    grid-template-columns: repeat(auto-fill,minmax(260px,1fr));
    gap: 8px;
}

.tool-item {
    position: relative;
    padding: 16px;
    padding-right: 64px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--surface-input);
    transition: var(--transition);
}

.tool-item:hover {
    border-color: rgba(124,140,255,.28);
    transform: translateY(-2px);
}

.tool-item-header {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: start;
}

.tool-item-header code { color: var(--diane); }
.tool-item-header span,
.tool-params { color: var(--ink-faint); font-size: .7rem; }
.tool-item p { color: var(--ink-muted); font-size: .82rem; line-height: 1.6; }

.tools-deployment-console.card {
    margin-top: 12px;
    background: var(--chrome);
}

/* Tools v2 — compact searchable registry. */
.page#page-tools.active { --tool-rail: 300px; display: grid; gap: 12px; }
.tools-registry-console.card,
.tools-deployment-console.card { padding: 18px; border-radius: 16px; background: var(--surface-1); box-shadow: 0 10px 28px rgba(0,0,0,.1); }
.tools-deployment-console.card { margin-top: 0; }
.tools-toolbar { margin: 14px 0 10px; padding: 5px; border-radius: 11px; }
.tools-toolbar input { min-width: 240px; padding-inline: 7px; }
.tools-category-filter { padding: 2px 0 11px; }
.tools-category-chip { min-height: 31px; border-radius: 9px; }
.tools-category > h4 { margin: 15px 0 8px; }
.tools-category-list { grid-template-columns: repeat(auto-fill,minmax(240px,1fr)); }
.tool-item { padding: 13px; padding-right: 58px; border-radius: 12px; }
.tool-item:hover { background: var(--surface-2); transform: none; }
.tools-loading-state { grid-column: 1 / -1; min-height: 88px; }
.tools-readiness-grid { margin-top: 14px; border: 1px solid var(--line); gap: 0; background: transparent; }
.tools-readiness-item { min-width: 0; border-inline-end: 1px solid var(--line); }
.tools-readiness-item:last-child { border-inline-end: 0; }
.tools-readiness-item strong,
.tools-readiness-item span { display: block; }
.tools-readiness-item strong { margin-bottom: 5px; font-size: .8rem; }
.tools-readiness-item span { color: var(--ink-muted); font-size: .7rem; line-height: 1.5; }

@media (max-width: 760px) {
    .tools-registry-console.card,
    .tools-deployment-console.card { padding: 14px; border-radius: 13px; }
    .tools-toolbar input { min-width: 0; }
    .tools-category-list,
    .tools-readiness-grid { grid-template-columns: 1fr; }
    .tools-readiness-item { border-inline-end: 0; border-bottom: 1px solid var(--line); }
    .tools-readiness-item:last-child { border-bottom: 0; }
}

/* Services are launchable products, not inventory cards. */
.service-launcher {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 26px;
    background: radial-gradient(circle at 85% 0,rgba(124,140,255,.08),transparent 30%),var(--surface-1);
    box-shadow: var(--shadow-lg);
}
.service-launcher-head {
    padding: clamp(24px,3vw,40px);
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    border-bottom: 1px solid var(--line);
}
.service-launcher-head h3 { margin: 7px 0; font-size: clamp(1.35rem,2.2vw,2rem); }
.service-launcher-head p { margin: 0; color: var(--ink-muted); }
.service-launcher-count { min-width: max-content; color: var(--diane); font: 700 .72rem/1 var(--font-mono); }
.service-launcher .services-grid { padding: clamp(18px,3vw,36px); display: grid; grid-template-columns: 1fr; background: transparent; }
.service-module {
    position: relative;
    min-height: 230px;
    padding: 24px;
    display: grid;
    grid-template-columns: 112px 1fr 24px;
    align-items: center;
    gap: 24px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--surface-input);
    cursor: pointer;
    transition: var(--transition);
}
.service-module:hover,
.service-module:focus-visible { border-color: rgba(124,140,255,.32); transform: translateY(-3px); }
.service-module-visual { position: relative; width: 106px; height: 106px; display: grid; place-items: center; }
.service-module-visual::before,
.service-module-visual::after {
    content: "";
    position: absolute;
    inset: 4px;
    border: 1px solid rgba(124,140,255,.22);
    border-radius: 50%;
}
.service-module-visual::after { inset: 17px; border-style: dashed; }
.service-module:nth-child(3n + 2) .service-module-visual::after { border-color: var(--violet-line); }
.service-module-visual svg { width: 38px; height: 38px; color: var(--diane); fill: none; stroke: currentColor; stroke-width: 1.5; filter: drop-shadow(0 0 12px rgba(124,140,255,.6)); }
.service-module-visual i { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--diane); box-shadow: 0 0 14px rgba(124,140,255,.8); }
.service-module-visual i:first-of-type { inset: 4px 50% auto auto; }
.service-module-visual i:last-of-type { inset: auto auto 14px 8px; }
.service-module-state { color: var(--ink-muted); font-size: .72rem; }
.service-module-state i { display: inline-block; width: 6px; height: 6px; margin-inline-end: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px rgba(71,215,154,.6); }
.service-module-copy h4 { margin: 10px 0 7px; font-size: 1.25rem; }
.service-module-copy p { margin: 0; color: var(--ink-muted); line-height: 1.65; }
.service-module-enter { color: var(--diane); font-size: 1.5rem; transition: transform var(--fast) var(--ease); }
.service-module:hover .service-module-enter { transform: translateX(-4px); }

/* Services v2 — a live autonomy workspace, not a capabilities catalogue. */
.services-v2 {
    --autonomy-cyan: #7c8cff;
    --autonomy-blue: #4287ff;
    --autonomy-violet: #8c72ff;
}

.services-v2.active {
    overflow: visible;
}

.services-v2 > .page-intro {
    display: none;
}

.autonomy-stage {
    min-width: 0;
    overflow: hidden;
    border: 1px solid rgba(126, 166, 211, .15);
    border-radius: 30px;
    background:
        radial-gradient(circle at 84% -8%, rgba(124, 140, 255, .13), transparent 32%),
        radial-gradient(circle at 16% 12%, rgba(140, 114, 255, .08), transparent 25%),
        #07101d;
    box-shadow: 0 34px 90px rgba(0, 0, 0, .3);
}

.autonomy-hero {
    position: relative;
    min-height: 270px;
    padding: clamp(28px, 4vw, 54px);
    display: grid;
    grid-template-columns: 138px minmax(0, 1fr) auto;
    align-items: center;
    gap: clamp(24px, 4vw, 50px);
    overflow: hidden;
    border-bottom: 1px solid rgba(126, 166, 211, .13);
}

.autonomy-hero::after {
    content: "";
    position: absolute;
    inset: auto 7% 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(124, 140, 255, .4), rgba(140, 114, 255, .2), transparent);
    transform: translateX(70%);
    animation: autonomy-scan 7s ease-in-out infinite;
}

.autonomy-orbit {
    position: relative;
    width: 132px;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
}

.autonomy-orbit::before {
    content: "";
    width: 54px;
    aspect-ratio: 1;
    border-radius: 19px;
    background: linear-gradient(145deg, rgba(124, 140, 255, .2), rgba(66, 135, 255, .06));
    box-shadow: 0 0 45px rgba(124, 140, 255, .2), inset 0 0 0 1px rgba(106, 219, 255, .24);
    transform: rotate(45deg);
}

.autonomy-orbit svg {
    position: absolute;
    width: 26px;
    height: 26px;
    color: #8be3ff;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.45;
    filter: drop-shadow(0 0 11px rgba(124, 140, 255, .72));
}

.autonomy-orbit span {
    position: absolute;
    inset: 10px;
    border: 1px solid rgba(124, 140, 255, .23);
    border-radius: 44% 56% 52% 48%;
    animation: rotate 14s linear infinite;
}

.autonomy-orbit span:nth-child(2) {
    inset: 23px;
    border-color: rgba(140, 114, 255, .3);
    border-style: dashed;
    animation-duration: 9s;
    animation-direction: reverse;
}

.autonomy-orbit span:nth-child(3) {
    inset: 1px;
    border-color: rgba(124, 140, 255, .09);
    animation-duration: 21s;
}

.autonomy-hero-copy {
    min-width: 0;
}

.autonomy-hero-copy h3 {
    max-width: 760px;
    margin: 9px 0 12px;
    font-size: clamp(1.7rem, 3.2vw, 3rem);
    line-height: 1.12;
    letter-spacing: -.04em;
}

.autonomy-hero-copy p {
    max-width: 720px;
    margin: 0;
    color: var(--ink-muted);
    font-size: clamp(.9rem, 1.15vw, 1.03rem);
    line-height: 1.8;
}

.autonomy-verdict {
    min-width: 176px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid rgba(126, 166, 211, .16);
    border-radius: 17px;
    background: rgba(3, 10, 19, .52);
}

.autonomy-verdict > i {
    width: 9px;
    height: 9px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--ink-faint);
    box-shadow: 0 0 0 5px rgba(126, 166, 211, .06);
}

.autonomy-verdict[data-tone="ok"] > i {
    background: var(--ok);
    box-shadow: 0 0 0 5px rgba(71, 215, 154, .09), 0 0 15px rgba(71, 215, 154, .55);
    animation: presence 2.2s ease-in-out infinite;
}

.autonomy-verdict[data-tone="warn"] > i {
    background: var(--warn);
    box-shadow: 0 0 0 5px rgba(255, 188, 87, .08);
}

.autonomy-verdict small,
.autonomy-verdict strong {
    display: block;
}

.autonomy-verdict small {
    margin-bottom: 5px;
    color: var(--ink-faint);
    font-size: .65rem;
}

.autonomy-verdict strong {
    font-size: .82rem;
}

.autonomy-pulseboard {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-bottom: 1px solid rgba(126, 166, 211, .13);
    background: rgba(2, 8, 16, .34);
}

.autonomy-pulseboard > div {
    min-width: 0;
    padding: 22px clamp(16px, 2.5vw, 30px);
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    border-inline-end: 1px solid rgba(126, 166, 211, .1);
}

.autonomy-pulseboard > div:last-child {
    border-inline-end: 0;
}

.autonomy-pulseboard small {
    color: var(--ink-muted);
    font-size: .75rem;
}

.autonomy-pulseboard strong {
    color: var(--ink);
    font: 650 1.2rem/1 var(--font-mono);
}

.autonomy-pulse {
    position: relative;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(124, 140, 255, .18);
    border-radius: 50%;
}

.autonomy-pulse::before,
.autonomy-pulse i {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--autonomy-cyan);
    box-shadow: 0 0 13px rgba(124, 140, 255, .7);
}

.autonomy-pulse::before {
    position: absolute;
    animation: autonomy-ping 2.4s ease-out infinite;
}

.autonomy-pulse.is-violet {
    border-color: rgba(140, 114, 255, .25);
}

.autonomy-pulse.is-violet::before,
.autonomy-pulse.is-violet i {
    background: var(--autonomy-violet);
    box-shadow: 0 0 13px rgba(140, 114, 255, .65);
}

.autonomy-pulse.is-quiet::before {
    display: none;
}

.autonomy-pulse.is-quiet i {
    background: #4b6079;
    box-shadow: none;
}

.autonomy-workspace {
    min-height: 580px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 310px;
}

.autonomy-main {
    min-width: 0;
    padding: clamp(22px, 3vw, 38px);
}

.autonomy-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    border-bottom: 1px solid rgba(126, 166, 211, .12);
    scrollbar-width: none;
}

.autonomy-tabs::-webkit-scrollbar {
    display: none;
}

.autonomy-tabs button {
    position: relative;
    min-width: max-content;
    min-height: 48px;
    padding: 0 16px;
    border: 0;
    color: var(--ink-faint);
    background: transparent;
    font-size: .78rem;
}

.autonomy-tabs button::after {
    content: "";
    position: absolute;
    inset: auto 15px -1px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--autonomy-cyan), var(--autonomy-blue));
    transform: scaleX(0);
    transition: transform .3s var(--ease);
}

.autonomy-tabs button[aria-selected="true"] {
    color: var(--ink);
}

.autonomy-tabs button[aria-selected="true"]::after {
    transform: scaleX(1);
}

.autonomy-view {
    padding-top: 24px;
    animation: autonomy-view-in .36s var(--ease) both;
}

.autonomy-view[hidden] {
    display: none;
}

.autonomy-service-feature {
    width: 100%;
    min-height: 164px;
    padding: 24px;
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr) auto;
    align-items: center;
    gap: 22px;
    text-align: start;
    border: 1px solid rgba(124, 140, 255, .17);
    border-radius: 22px;
    background:
        linear-gradient(110deg, rgba(124, 140, 255, .075), transparent 45%),
        rgba(4, 13, 24, .72);
    box-shadow: inset 0 1px rgba(255, 255, 255, .025);
    transition: border-color .25s ease, transform .25s ease, background .25s ease;
}

.autonomy-service-feature:hover,
.autonomy-service-feature:focus-visible {
    border-color: rgba(124, 140, 255, .38);
    background:
        linear-gradient(110deg, rgba(124, 140, 255, .11), transparent 50%),
        rgba(4, 13, 24, .84);
    transform: translateY(-2px);
}

.autonomy-service-icon {
    position: relative;
    width: 74px;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    border: 1px solid rgba(124, 140, 255, .2);
    border-radius: 18px;
    background: rgba(124, 140, 255, .06);
}

.autonomy-service-icon svg {
    width: 31px;
    height: 31px;
    color: var(--autonomy-cyan);
    fill: none;
    stroke: currentColor;
    stroke-width: 1.45;
}

.autonomy-service-icon i {
    position: absolute;
    inset: 7px 7px auto auto;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ok);
    box-shadow: 0 0 12px rgba(71, 215, 154, .65);
}

.autonomy-service-copy {
    min-width: 0;
}

.autonomy-service-copy > small {
    color: var(--ink-faint);
    font-size: .67rem;
}

.autonomy-service-copy > small i {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-inline-end: 6px;
    border-radius: 50%;
    background: var(--ok);
}

.autonomy-service-copy > strong,
.autonomy-service-copy > span {
    display: block;
}

.autonomy-service-copy > strong {
    margin: 10px 0 8px;
    color: var(--ink);
    font-size: 1.2rem;
}

.autonomy-service-copy > span {
    max-width: 650px;
    color: var(--ink-muted);
    font-size: .82rem;
    line-height: 1.7;
}

.autonomy-service-meta {
    color: var(--ink-faint);
    text-align: end;
}

.autonomy-service-meta small,
.autonomy-service-meta b {
    display: block;
}

.autonomy-service-meta small {
    font-size: .65rem;
}

.autonomy-service-meta b {
    margin-top: 8px;
    color: var(--autonomy-cyan);
    font-size: 1.25rem;
    transition: transform .25s ease;
}

.autonomy-service-feature:hover .autonomy-service-meta b {
    transform: translateX(-5px);
}

.autonomy-runtime-list,
.autonomy-flow-list {
    margin-top: 24px;
}

.autonomy-runtime-row,
.autonomy-flow-row {
    min-width: 0;
    padding: 16px 4px;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid rgba(126, 166, 211, .09);
}

.autonomy-runtime-row:last-child,
.autonomy-flow-row:last-child {
    border-bottom: 0;
}

.autonomy-runtime-code,
.autonomy-flow-code {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    color: #9fceec;
    border: 1px solid rgba(126, 166, 211, .16);
    border-radius: 11px;
    background: rgba(126, 166, 211, .045);
    font: 700 .62rem/1 var(--font-mono);
}

.autonomy-runtime-copy strong,
.autonomy-runtime-copy small,
.autonomy-flow-copy strong,
.autonomy-flow-copy small {
    display: block;
}

.autonomy-runtime-copy strong,
.autonomy-flow-copy strong {
    margin-bottom: 5px;
    font-size: .82rem;
}

.autonomy-runtime-copy small,
.autonomy-flow-copy small {
    overflow: hidden;
    color: var(--ink-faint);
    font-size: .68rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.autonomy-row-state {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--ink-muted);
    font-size: .68rem;
    white-space: nowrap;
}

.autonomy-row-state i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ink-faint);
}

.autonomy-row-state[data-tone="ok"] i {
    background: var(--ok);
    box-shadow: 0 0 8px rgba(71, 215, 154, .45);
}

.autonomy-row-state[data-tone="wait"] i {
    background: var(--autonomy-violet);
    box-shadow: 0 0 8px rgba(140, 114, 255, .45);
}

.autonomy-row-state[data-tone="bad"] i {
    background: var(--bad);
}

.autonomy-inline-action {
    width: 100%;
    min-height: 50px;
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid rgba(124, 140, 255, .16);
    border-radius: 14px;
    color: var(--ink-2);
    background: rgba(124, 140, 255, .045);
}

.autonomy-inline-action span {
    color: var(--autonomy-cyan);
}

.autonomy-task-empty {
    min-height: 350px;
    padding: clamp(26px, 5vw, 54px);
    display: grid;
    place-items: center;
    align-content: center;
    text-align: center;
}

.autonomy-task-empty > div {
    max-width: 560px;
}

.autonomy-task-empty strong {
    display: block;
    margin: 22px 0 8px;
    font-size: 1.05rem;
}

.autonomy-task-empty p {
    margin: 0;
    color: var(--ink-muted);
    font-size: .8rem;
    line-height: 1.75;
}

.autonomy-task-empty button {
    min-height: 46px;
    margin-top: 22px;
    padding-inline: 20px;
    border: 1px solid rgba(124, 140, 255, .3);
    border-radius: 14px;
    color: var(--ink);
    background: rgba(124, 140, 255, .09);
}

.autonomy-task-mark {
    position: relative;
    width: 72px;
    height: 72px;
}

.autonomy-task-mark i {
    position: absolute;
    width: 16px;
    height: 16px;
    border: 1px solid rgba(140, 114, 255, .5);
    border-radius: 6px;
    background: rgba(140, 114, 255, .08);
}

.autonomy-task-mark i:nth-child(1) {
    inset: 3px auto auto 50%;
}

.autonomy-task-mark i:nth-child(2) {
    inset: auto 4px 6px auto;
}

.autonomy-task-mark i:nth-child(3) {
    inset: auto auto 6px 4px;
}

.autonomy-task-mark::before,
.autonomy-task-mark::after {
    content: "";
    position: absolute;
    background: linear-gradient(90deg, rgba(140, 114, 255, .5), transparent);
    transform-origin: right center;
}

.autonomy-task-mark::before {
    width: 42px;
    height: 1px;
    inset: 26px 14px auto auto;
    transform: rotate(54deg);
}

.autonomy-task-mark::after {
    width: 42px;
    height: 1px;
    inset: 45px 16px auto auto;
    transform: rotate(-54deg);
}

.autonomy-rail {
    min-width: 0;
    padding: 30px 24px;
    border-inline-start: 1px solid rgba(126, 166, 211, .12);
    background: rgba(2, 8, 16, .34);
}

.autonomy-rail-head h4 {
    margin: 7px 0 0;
    font-size: 1.05rem;
}

.autonomy-now-list {
    margin: 26px 0 0;
    padding: 0;
    list-style: none;
}

.autonomy-now-list li {
    position: relative;
    min-width: 0;
    padding: 0 22px 24px 0;
    display: flex;
    gap: 11px;
}

.autonomy-now-list li:not(:last-child)::after {
    content: "";
    position: absolute;
    inset: 15px 3px -1px auto;
    width: 1px;
    background: linear-gradient(rgba(124, 140, 255, .25), rgba(124, 140, 255, .03));
}

.autonomy-now-list li > i {
    position: absolute;
    inset: 4px 0 auto auto;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--autonomy-cyan);
    box-shadow: 0 0 11px rgba(124, 140, 255, .6);
}

.autonomy-now-list strong,
.autonomy-now-list small {
    display: block;
}

.autonomy-now-list strong {
    margin-bottom: 5px;
    font-size: .76rem;
    font-weight: 600;
}

.autonomy-now-list small {
    color: var(--ink-faint);
    font-size: .65rem;
    line-height: 1.55;
}

.autonomy-boundary {
    margin-top: 18px;
    padding: 18px;
    display: flex;
    gap: 12px;
    border: 1px solid rgba(140, 114, 255, .18);
    border-radius: 17px;
    background: rgba(140, 114, 255, .045);
}

.autonomy-boundary svg {
    width: 21px;
    height: 21px;
    flex: 0 0 auto;
    color: #aa98ff;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.45;
}

.autonomy-boundary strong,
.autonomy-boundary span {
    display: block;
}

.autonomy-boundary strong {
    margin-bottom: 6px;
    font-size: .76rem;
}

.autonomy-boundary span {
    color: var(--ink-faint);
    font-size: .66rem;
    line-height: 1.6;
}

.autonomy-empty {
    min-height: 0;
    display: grid;
    place-items: center;
    color: var(--ink-faint);
    font-size: .77rem;
    text-align: center;
}

@keyframes autonomy-scan {
    0%, 100% { transform: translateX(75%); opacity: 0; }
    30%, 70% { opacity: 1; }
    50% { transform: translateX(-75%); }
}

@keyframes autonomy-ping {
    0% { transform: scale(.7); opacity: .8; }
    80%, 100% { transform: scale(3); opacity: 0; }
}

@keyframes autonomy-view-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 980px) {
    .autonomy-hero {
        grid-template-columns: 104px minmax(0, 1fr);
    }

    .autonomy-orbit {
        width: 100px;
    }

    .autonomy-verdict {
        grid-column: 1 / -1;
        width: max-content;
        margin-inline-start: 128px;
    }

    .autonomy-pulseboard {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .autonomy-pulseboard > div:nth-child(2) {
        border-inline-end: 0;
    }

    .autonomy-pulseboard > div:nth-child(-n + 2) {
        border-bottom: 1px solid rgba(126, 166, 211, .1);
    }

    .autonomy-workspace {
        grid-template-columns: 1fr;
    }

    .autonomy-rail {
        border-top: 1px solid rgba(126, 166, 211, .12);
        border-inline-start: 0;
    }

    .autonomy-now-list {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 12px;
    }

    .autonomy-now-list li {
        padding: 14px 22px 14px 12px;
        border: 1px solid rgba(126, 166, 211, .1);
        border-radius: 14px;
    }

    .autonomy-now-list li::after {
        display: none;
    }
}

@media (max-width: 640px) {
    #page-services.services-v2 {
        width: 100%;
        max-width: 100%;
        margin-inline: 0;
    }

    .autonomy-stage {
        width: 100%;
        border-inline: 0;
        border-radius: 0;
    }

    .autonomy-hero {
        min-height: 0;
        padding: 28px 18px 24px;
        grid-template-columns: 72px minmax(0, 1fr);
        gap: 16px;
    }

    .autonomy-orbit {
        width: 70px;
    }

    .autonomy-orbit span {
        inset: 4px;
    }

    .autonomy-orbit span:nth-child(2) {
        inset: 13px;
    }

    .autonomy-orbit::before {
        width: 38px;
        border-radius: 13px;
    }

    .autonomy-orbit svg {
        width: 20px;
        height: 20px;
    }

    .autonomy-hero-copy h3 {
        margin-top: 5px;
        font-size: 1.45rem;
    }

    .autonomy-hero-copy p {
        grid-column: 1 / -1;
        font-size: .78rem;
    }

    .autonomy-verdict {
        grid-column: 1 / -1;
        width: 100%;
        margin: 0;
    }

    .autonomy-pulseboard > div {
        padding: 16px 13px;
        grid-template-columns: 30px minmax(0, 1fr);
        gap: 9px;
    }

    .autonomy-pulseboard strong {
        grid-column: 2;
        font-size: 1rem;
    }

    .autonomy-main {
        padding: 18px 14px 24px;
    }

    .autonomy-tabs {
        margin-inline: -14px;
        padding-inline: 10px;
        justify-content: space-between;
    }

    .autonomy-tabs button {
        padding-inline: 6px;
        font-size: .69rem;
    }

    .autonomy-service-feature {
        padding: 18px;
        grid-template-columns: 58px minmax(0, 1fr);
        gap: 14px;
    }

    .autonomy-service-icon {
        width: 56px;
        border-radius: 18px;
    }

    .autonomy-service-copy > strong {
        font-size: 1rem;
    }

    .autonomy-service-copy > span {
        font-size: .75rem;
    }

    .autonomy-service-meta {
        display: none;
    }

    .autonomy-runtime-row,
    .autonomy-flow-row {
        grid-template-columns: 34px minmax(0, 1fr);
    }

    .autonomy-row-state {
        grid-column: 2;
        justify-self: start;
    }

    .autonomy-rail {
        padding: 24px 18px;
    }

    .autonomy-now-list {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .autonomy-orbit span,
    .autonomy-hero::after,
    .autonomy-pulse::before {
        animation: none;
    }
}

/* Services v3 — compact operations workspace. */
.autonomy-stage {
    border-radius: 18px;
    background: #081321;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .18);
}

.autonomy-hero {
    min-height: 82px;
    padding: 15px 18px;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 13px;
}

.autonomy-hero::after,
.autonomy-pulse::before {
    display: none;
}

.autonomy-header-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    color: #a89aff;
    border: 1px solid rgba(140, 114, 255, .22);
    border-radius: 12px;
    background: rgba(140, 114, 255, .08);
}

.autonomy-header-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.65;
}

.autonomy-hero-copy h3 {
    margin: 0 0 3px;
    font-size: 1.12rem;
    letter-spacing: 0;
}

.autonomy-hero-copy p {
    font-size: .76rem;
    line-height: 1.45;
}

.autonomy-verdict {
    min-width: 154px;
    padding: 9px 12px;
    border-radius: 11px;
    background: rgba(3, 10, 19, .34);
}

.autonomy-verdict small {
    margin-bottom: 2px;
}

.autonomy-pulseboard {
    padding: 12px;
    gap: 8px;
    background: transparent;
}

.autonomy-pulseboard > div {
    min-height: 56px;
    padding: 9px 12px;
    grid-template-columns: 8px minmax(0, 1fr) auto;
    gap: 9px;
    border: 1px solid rgba(126, 166, 211, .1);
    border-radius: 11px;
    background: rgba(3, 10, 19, .28);
}

.autonomy-pulseboard > div:last-child {
    border-inline-end: 1px solid rgba(126, 166, 211, .1);
}

.autonomy-pulse {
    width: 8px;
    height: 8px;
    border: 0;
}

.autonomy-pulse i {
    width: 6px;
    height: 6px;
    box-shadow: none;
}

.autonomy-pulseboard small {
    font-size: .68rem;
}

.autonomy-pulseboard strong {
    font-size: .96rem;
}

.autonomy-workspace {
    min-height: 500px;
    grid-template-columns: minmax(0, 1fr) 276px;
}

.autonomy-main {
    padding: 20px;
}

.autonomy-tabs button {
    min-height: 42px;
}

.autonomy-view {
    padding-top: 18px;
    animation-duration: .18s;
}

.autonomy-service-feature {
    min-height: 106px;
    padding: 15px;
    grid-template-columns: 54px minmax(0, 1fr) auto;
    gap: 14px;
    border-radius: 14px;
    background: rgba(4, 13, 24, .5);
    box-shadow: none;
}

.autonomy-service-feature:hover,
.autonomy-service-feature:focus-visible {
    background: rgba(12, 29, 47, .72);
    transform: none;
}

.autonomy-service-icon {
    width: 52px;
    border-radius: 13px;
}

.autonomy-service-icon svg {
    width: 23px;
    height: 23px;
}

.autonomy-service-copy > strong {
    margin: 5px 0 4px;
    font-size: .98rem;
}

.autonomy-service-copy > span {
    font-size: .73rem;
    line-height: 1.5;
}

.autonomy-runtime-list,
.autonomy-flow-list {
    margin-top: 15px;
}

.autonomy-runtime-row,
.autonomy-flow-row {
    padding: 12px 4px;
}

.autonomy-task-empty {
    min-height: 240px;
    padding: 28px 20px;
}

.autonomy-task-empty strong {
    margin: 0 0 6px;
}

.autonomy-task-empty p {
    max-width: 420px;
    line-height: 1.55;
}

.autonomy-task-empty button {
    min-height: 40px;
    margin-top: 16px;
    border-radius: 11px;
}

.autonomy-rail {
    padding: 22px 18px;
    background: rgba(2, 8, 16, .22);
}

.autonomy-rail-head h4 {
    margin: 0;
    font-size: .9rem;
}

.autonomy-now-list {
    margin-top: 18px;
}

.autonomy-now-list li {
    padding-bottom: 19px;
}

html[data-theme="light"] .autonomy-stage,
html[data-theme="light"] .autonomy-hero,
html[data-theme="light"] .autonomy-workspace,
html[data-theme="light"] .autonomy-main,
html[data-theme="light"] .autonomy-rail {
    color: var(--ink-1);
    border-color: var(--line);
    background: var(--surface-1);
}

html[data-theme="light"] .autonomy-stage {
    box-shadow: 0 10px 28px rgba(46, 50, 73, .08);
}

html[data-theme="light"] .autonomy-pulseboard,
html[data-theme="light"] .autonomy-tabs {
    border-color: var(--line);
    background: transparent;
}

html[data-theme="light"] .autonomy-pulseboard > div,
html[data-theme="light"] .autonomy-verdict,
html[data-theme="light"] .autonomy-service-feature,
html[data-theme="light"] .autonomy-now-list li {
    color: var(--ink-1);
    border-color: var(--line);
    background: var(--surface-input);
}

html[data-theme="light"] .autonomy-service-feature:hover,
html[data-theme="light"] .autonomy-service-feature:focus-visible {
    background: var(--surface-2);
}

html[data-theme="light"] .autonomy-pulseboard strong,
html[data-theme="light"] .autonomy-service-copy > strong,
html[data-theme="light"] .autonomy-runtime-copy strong,
html[data-theme="light"] .autonomy-flow-copy strong,
html[data-theme="light"] .autonomy-now-list strong,
html[data-theme="light"] .autonomy-task-empty strong {
    color: var(--ink-1);
}

html[data-theme="light"] .autonomy-pulseboard small,
html[data-theme="light"] .autonomy-service-copy > span,
html[data-theme="light"] .autonomy-runtime-copy small,
html[data-theme="light"] .autonomy-flow-copy small,
html[data-theme="light"] .autonomy-now-list small,
html[data-theme="light"] .autonomy-task-empty p {
    color: var(--ink-3);
}

@media (max-width: 980px) {
    .autonomy-hero {
        grid-template-columns: 44px minmax(0, 1fr) auto;
    }

    .autonomy-verdict {
        grid-column: auto;
        margin-inline-start: 0;
    }
}

@media (max-width: 640px) {
    .autonomy-stage {
        border-inline: 1px solid rgba(126, 166, 211, .15);
        border-radius: 14px;
    }

    .autonomy-hero {
        padding: 12px;
        grid-template-columns: 40px minmax(0, 1fr);
        gap: 10px;
    }

    .autonomy-header-icon {
        width: 38px;
        height: 38px;
    }

    .autonomy-hero-copy h3 {
        margin: 0 0 2px;
        font-size: 1rem;
    }

    .autonomy-hero-copy p {
        font-size: .69rem;
    }

    .autonomy-verdict {
        grid-column: 1 / -1;
        width: 100%;
    }

    .autonomy-pulseboard {
        padding: 8px;
    }

    .autonomy-pulseboard > div {
        padding: 8px 9px;
        grid-template-columns: 7px minmax(0, 1fr) auto;
    }

    .autonomy-pulseboard strong {
        grid-column: auto;
    }

    .autonomy-main {
        padding: 14px 12px 18px;
    }

    .autonomy-service-feature {
        padding: 13px;
        grid-template-columns: 44px minmax(0, 1fr);
    }

    .autonomy-service-icon {
        width: 42px;
    }

    .autonomy-service-copy > span {
        display: none;
    }

    .autonomy-rail {
        padding: 18px 14px;
    }
}

/* Shared application feedback primitives */
.dashboard-toast {
    position: fixed;
    z-index: 10020;
    inset-inline-start: max(18px, env(safe-area-inset-left));
    inset-block-end: max(18px, env(safe-area-inset-bottom));
    width: min(430px, calc(100vw - 36px));
    min-height: 54px;
    padding: 11px 12px;
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) auto 30px;
    gap: 10px;
    align-items: center;
    color: var(--ink);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    background: rgba(8, 18, 32, .96);
    box-shadow: 0 20px 55px rgba(0, 0, 0, .4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity var(--normal) var(--ease), transform var(--normal) var(--ease), visibility var(--normal);
}

.dashboard-toast.visible { opacity: 1; visibility: visible; transform: none; }
.dashboard-toast-icon {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--diane);
    background: var(--diane-soft);
    font-weight: 800;
}
.dashboard-toast-icon::before { content: "i"; }
.dashboard-toast[data-tone="success"] { border-color: rgba(66, 211, 146, .32); }
.dashboard-toast[data-tone="success"] .dashboard-toast-icon { color: var(--ok); background: rgba(66, 211, 146, .12); }
.dashboard-toast[data-tone="success"] .dashboard-toast-icon::before { content: "✓"; }
.dashboard-toast[data-tone="warning"] { border-color: rgba(255, 190, 84, .34); }
.dashboard-toast[data-tone="warning"] .dashboard-toast-icon { color: var(--wait); background: rgba(255, 190, 84, .12); }
.dashboard-toast[data-tone="warning"] .dashboard-toast-icon::before { content: "!"; }
.dashboard-toast[data-tone="error"] { border-color: rgba(255, 94, 122, .4); }
.dashboard-toast[data-tone="error"] .dashboard-toast-icon { color: var(--bad); background: rgba(255, 94, 122, .12); }
.dashboard-toast[data-tone="error"] .dashboard-toast-icon::before { content: "×"; }

.inline-feedback {
    min-width: 0;
    color: var(--muted);
    font-size: .66rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.inline-feedback[data-feedback-tone="success"] { color: var(--ok); }
.inline-feedback[data-feedback-tone="warning"] { color: var(--wait); }
.inline-feedback[data-feedback-tone="error"] { color: var(--bad); }
.inline-feedback[data-feedback-tone="info"] { color: var(--accent); }
.dashboard-toast-copy { min-width: 0; line-height: 1.45; overflow-wrap: anywhere; }
.dashboard-toast-action,
.dashboard-toast-close {
    min-height: 32px;
    border: 0;
    border-radius: 9px;
    color: var(--ink-2);
    background: transparent;
    cursor: pointer;
}
.dashboard-toast-action { padding-inline: 9px; color: var(--diane); font-weight: 700; white-space: nowrap; }
.dashboard-toast-action:hover,
.dashboard-toast-action:focus-visible,
.dashboard-toast-close:hover,
.dashboard-toast-close:focus-visible { color: var(--ink); background: rgba(255, 255, 255, .07); outline: 0; }

.dashboard-confirm-dialog {
    width: min(470px, calc(100vw - 28px));
    padding: 0;
    color: var(--ink);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg);
    background: rgba(7, 17, 31, .985);
    box-shadow: 0 30px 90px rgba(0, 0, 0, .62);
}
.dashboard-confirm-dialog::backdrop { background: rgba(0, 5, 14, .72); backdrop-filter: blur(6px); }
.dashboard-confirm-dialog form {
    padding: 24px;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 16px;
}
.dashboard-confirm-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    color: var(--bad);
    background: rgba(255, 94, 122, .12);
    font-size: 1.2rem;
    font-weight: 800;
}
.dashboard-confirm-copy { min-width: 0; }
.dashboard-confirm-copy > span { color: var(--bad); font-size: .72rem; font-weight: 800; letter-spacing: .06em; }
.dashboard-confirm-copy h2 { margin: 5px 0 8px; font-size: 1.12rem; }
.dashboard-confirm-copy p { margin: 0; color: var(--ink-2); line-height: 1.65; overflow-wrap: anywhere; }
.dashboard-confirm-actions {
    grid-column: 1 / -1;
    margin-top: 8px;
    display: flex;
    justify-content: flex-end;
    gap: 9px;
}
.dashboard-confirm-actions button { min-width: 112px; }
.dashboard-prompt-field { display: block; }
.dashboard-prompt-field input {
    width: 100%; padding: 10px var(--s-3);
    border: 1px solid var(--line-strong); border-radius: var(--r-1);
    background: var(--surface-input); color: var(--ink); font: inherit;
}
.dashboard-prompt-field input:focus { outline: none; border-color: var(--diane); }

button[aria-busy="true"] { cursor: progress; }
button[aria-busy="true"]::before {
    content: "";
    width: 13px;
    height: 13px;
    margin-inline-end: 8px;
    display: inline-block;
    vertical-align: -2px;
    border: 2px solid currentColor;
    border-inline-end-color: transparent;
    border-radius: 50%;
    animation: sharedControlSpin .7s linear infinite;
}
@keyframes sharedControlSpin { to { transform: rotate(360deg); } }

.temporal-picker-shell {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
}
.temporal-picker-shell > input {
    min-width: 0;
    border-start-end-radius: 0;
    border-end-end-radius: 0;
}
.temporal-picker-button {
    min-width: 58px;
    border-inline-start: 0;
    border-start-start-radius: 0;
    border-end-start-radius: 0;
}
.file-picker-status {
    margin-top: 6px;
    display: block;
    color: var(--ink-3);
    font-size: .76rem;
    overflow-wrap: anywhere;
}

.permission-center {
    padding: 22px;
    display: grid;
    gap: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface-1);
}
.permission-center > header { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.permission-center h3 { margin: 5px 0 7px; }
.permission-center p { margin: 0; color: var(--ink-3); line-height: 1.55; }
.permission-center-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.permission-card {
    min-width: 0;
    padding: 14px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
    align-items: start;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-input);
}
.permission-card strong { font-size: .84rem; }
.permission-card p { margin-top: 5px; font-size: .72rem; overflow-wrap: anywhere; }
.permission-card .permission-state { color: var(--ink-3); font-size: .68rem; white-space: nowrap; }
.permission-card[data-state="granted"] .permission-state,
.permission-card[data-state="native"] .permission-state { color: var(--ok); }
.permission-card[data-state="denied"] .permission-state { color: var(--bad); }
.permission-card[data-state="prompt"] .permission-state { color: var(--wait); }
.permission-card button { grid-column: 1 / -1; width: 100%; }

.dashboard-tile-grid .dashboard-live-stat[data-tile-size="wide"] { grid-column: span 2; }
.dashboard-tile-editor-row[draggable="true"] { cursor: grab; }
.dashboard-tile-editor-row.is-dragging { opacity: .46; cursor: grabbing; }
.dashboard-tile-editor-row select { min-height: 30px; padding: 4px 7px; font-size: .68rem; }
.brain-memory-card.is-archived { opacity: .58; border-style: dashed; }
.brain-memory-card-top > div { display: flex; gap: 6px; }
.subagents-toolbar { padding: 14px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); }
.subagents-toolbar > div { display: grid; gap: 4px; }
.subagents-toolbar small { color: var(--ink-3); }
.subagents-list { padding: 12px; display: grid; gap: 9px; }
.subagent-card { min-width: 0; padding: 15px; display: grid; gap: 13px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-input); }
.subagent-card header, .subagent-card footer { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.subagent-card header > div { min-width: 0; }
.subagent-card header span { color: var(--ok); font-size: .66rem; }
.subagent-card[data-state="disabled"] header span, .subagent-card[data-state="error"] header span { color: var(--bad); }
.subagent-card h4 { margin: 4px 0; }
.subagent-card p, .subagent-card footer { margin: 0; color: var(--ink-3); font-size: .72rem; overflow-wrap: anywhere; }
.subagent-runtime { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.subagent-runtime span { min-width: 0; padding: 9px; display: grid; gap: 3px; border: 1px solid var(--line); border-radius: 9px; }
.subagent-runtime b, .subagent-runtime small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subagent-runtime small { color: var(--ink-3); font-size: .65rem; }
.subagent-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.subagent-dialog { width: min(760px, calc(100vw - 28px)); max-height: calc(100vh - 28px); padding: 0; color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--radius-lg); background: var(--surface-1); }
.subagent-dialog::backdrop { background: rgba(0, 5, 14, .74); backdrop-filter: blur(6px); }
.subagent-dialog form > header, .subagent-dialog form > footer { padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); }
.subagent-dialog form > footer { border-top: 1px solid var(--line); border-bottom: 0; }
.subagent-form-grid { padding: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; overflow-y: auto; }
.subagent-form-grid > label:not(.flow-switch-row) { display: grid; gap: 6px; color: var(--ink-2); font-size: .72rem; }
.subagent-form-wide { grid-column: 1 / -1; }

@media (max-width: 980px) { .permission-center-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) {
    .permission-center { padding: 16px; }
    .permission-center > header { flex-direction: column; }
    .permission-center-grid { grid-template-columns: 1fr; }
    .dashboard-tile-grid .dashboard-live-stat[data-tile-size="wide"] { grid-column: auto; }
    .subagents-toolbar, .subagent-card header, .subagent-card footer { align-items: stretch; flex-direction: column; }
    .subagent-runtime, .subagent-form-grid { grid-template-columns: 1fr; }
    .subagent-form-wide { grid-column: auto; }
}

@media (max-width: 520px) {
    .dashboard-toast {
        inset-inline: 12px;
        inset-block-end: max(12px, env(safe-area-inset-bottom));
        width: auto;
        grid-template-columns: 28px minmax(0, 1fr) 28px;
    }
    .dashboard-toast-action { grid-column: 2; justify-self: start; }
    .dashboard-toast-close { grid-column: 3; grid-row: 1; }
    .dashboard-confirm-dialog form { padding: 20px 17px; }
    .dashboard-confirm-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .dashboard-confirm-actions button { min-width: 0; }
}

/* Integrations are a connection control room, not a stack of settings cards. */
.integration-workspace { display: grid; gap: 14px; }
.integration-workspace-head {
    min-height: 82px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface-1);
}
.integration-workspace-head h2 { margin: 0 0 5px; font-size: clamp(1.35rem, 2vw, 1.75rem); }
.integration-workspace-head p { margin: 0; max-width: 720px; color: var(--ink-muted); font-size: .72rem; line-height: 1.5; }
.integration-refresh-all { min-height: 38px; padding: 0 15px; color: #fff; border: 1px solid transparent; border-radius: 10px; background: linear-gradient(135deg, var(--diane-blue), var(--diane-violet)); }
.integration-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.provider-control-surface,
.ai-usage-surface,
.account-connections,
.infrastructure-connections,
.integration-workspace .vault-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: var(--surface-1);
    box-shadow: none;
}
.provider-control-head,
.ai-usage-head,
.account-connections-head {
    min-height: 68px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    border-bottom: 1px solid var(--line);
}
.provider-control-head h3,
.ai-usage-head h3,
.account-connections-head h3 { margin: 0; font-size: 1.08rem; }
.provider-control-head p,
.account-connections-head p { margin: 5px 0 0; color: var(--ink-muted); font-size: .73rem; }
.provider-control-facts { display: flex; gap: 8px; }
.provider-control-facts span { min-width: 76px; padding: 8px 10px; display: grid; gap: 2px; color: var(--ink-faint); border: 1px solid var(--line); border-radius: 10px; background: var(--surface-input); font-size: .58rem; }
.provider-control-facts strong { color: var(--ink); font: 600 .9rem/1 var(--font-mono); }
.provider-connection-grid { padding: 14px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.provider-connection-card {
    min-height: 118px;
    padding: 13px;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(75, 132, 181, .16);
    border-radius: 13px;
    background: var(--surface-input);
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.22s ease,
                box-shadow 0.22s ease,
                background-color 0.22s ease;
    cursor: pointer;
}
.provider-connection-card:hover {
    transform: translateY(-2px);
    border-color: rgba(84, 202, 255, 0.38);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.25);
}
.provider-connection-card.is-connected {
    border-color: rgba(72, 187, 246, .32);
    background: linear-gradient(180deg, rgba(84, 202, 255, 0.05), var(--surface-input));
}
.provider-connection-card.is-connected:hover {
    border-color: rgba(84, 202, 255, 0.55);
    box-shadow: 0 6px 24px rgba(84, 202, 255, 0.18);
}
.provider-unconfigured { grid-column: 1 / -1; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-input); }
.provider-unconfigured summary { min-height: 44px; padding: 9px 12px; display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 8px; color: var(--ink-2); cursor: pointer; list-style: none; }
.provider-unconfigured summary::-webkit-details-marker { display: none; }
.provider-unconfigured summary::before { content: "+"; width: 22px; height: 22px; display: grid; place-items: center; color: var(--diane-violet); border: 1px solid var(--violet-line); border-radius: 7px; background: var(--violet-soft); }
.provider-unconfigured[open] summary::before { content: "−"; }
.provider-unconfigured summary span { font-size: .72rem; font-weight: 700; }
.provider-unconfigured summary small { color: var(--ink-3); font-size: .6rem; }
.provider-unconfigured summary b { min-width: 26px; padding: 5px 7px; color: var(--ink-2); border-radius: 7px; background: var(--surface-2); font: 600 .62rem/1 var(--font-mono); text-align: center; }
.provider-unconfigured-grid { padding: 0 10px 10px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.provider-identity { display: grid; grid-template-columns: 38px 1fr; align-items: center; gap: 10px; }
.provider-logo,
.provider-logo-mark {
    position: relative;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    overflow: hidden;
    color: #ffffff;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 11px;
    background: linear-gradient(145deg, #1e293b, #0f172a);
    font: 800 .65rem/1 var(--font-ui);
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease;
}
.provider-connection-card:hover .provider-logo,
.provider-connection-card:hover .provider-logo-mark {
    transform: scale(1.05);
}
.provider-logo svg,
.provider-logo-mark svg {
    width: 22px;
    height: 22px;
    display: block;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}
.provider-logo b,
.provider-logo-mark b {
    font: 750 .54rem/1 var(--font-mono);
    color: #9bcff0;
}
.provider-logo img,
.provider-logo-mark img {
    position: absolute;
    inset: 50% auto auto 50%;
    width: 22px;
    height: 22px;
    object-fit: contain;
    transform: translate(-50%, -50%);
}
.provider-identity div { min-width: 0; display: grid; gap: 3px; }
.provider-identity strong { overflow: hidden; color: var(--ink); font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.provider-identity small { color: #557086; font-size: .58rem; }
.provider-capabilities { margin-top: 9px; display: flex; gap: 5px; flex-wrap: wrap; }
.provider-capabilities span { padding: 4px 6px; color: #5f7b93; border-radius: 6px; background: rgba(52, 102, 143, .1); font-size: .53rem; }
.provider-connection-state { margin-top: auto; padding-top: 9px; display: flex; align-items: center; gap: 6px; color: #5f778d; font-size: .58rem; }
.provider-connection-state i { width: 6px; height: 6px; border-radius: 50%; background: #42586b; }
.provider-connection-card.is-connected .provider-connection-state { color: #7fd8ff; }
.provider-connection-card.is-connected .provider-connection-state i { background: #53caff; box-shadow: 0 0 9px rgba(83,202,255,.65); }
.provider-endpoint-action { margin-top: 9px; min-height: 32px; color: #9bdcff; border: 1px solid rgba(83,202,255,.22); border-radius: 8px; background: rgba(83,202,255,.07); }
.provider-grid-loading { min-height: 180px; grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 10px; color: #5e778d; }
.ai-usage-head select { width: 130px; }
.ai-usage-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.ai-usage-summary > div { min-height: 72px; padding: 13px 16px; display: grid; align-content: center; gap: 4px; border-inline-end: 1px solid var(--line); }
.ai-usage-summary > div:last-child { border-inline-end: 0; }
.ai-usage-summary span { color: var(--ink-faint); font-size: .63rem; }
.ai-usage-summary strong { color: var(--ink); font: 600 1.05rem/1.15 var(--font-mono); }
.ai-usage-summary small { color: #486177; font-size: .58rem; }
.ai-usage-chart { min-height: 116px; padding: 14px 20px 18px; display: flex; align-items: end; gap: 5px; }
.ai-usage-bar { min-width: 6px; flex: 1; display: grid; align-items: end; gap: 6px; height: 92px; }
.ai-usage-bar i { min-height: 3px; height: var(--bar-height); border-radius: 4px 4px 1px 1px; background: linear-gradient(180deg, #5fcfff, #3a70d1 70%, #765bd6); box-shadow: 0 0 12px rgba(75, 177, 244, .12); transform-origin: bottom; animation: usage-rise .55s ease-out both; }
.ai-usage-bar span { overflow: hidden; color: #3f586d; font: 500 .48rem/1 var(--font-mono); text-align: center; white-space: nowrap; }
@keyframes usage-rise { from { transform: scaleY(.08); opacity: .3; } }

/* Cost panel — wide tables scroll inside their own box so the page never does. */
.table-wrap { overflow-x: auto; padding: 0 20px 16px; }
.data-table { min-width: 520px; font-size: .78rem; }
.data-table td { font-variant-numeric: tabular-nums; }
.data-table .cost-unknown { color: var(--ink-3); }
/* The pulse runs only while a price check is actually in flight. */
.price-check-progress { display: flex; align-items: center; gap: 6px; padding: 0 20px 12px; color: var(--ink-3); font-size: .72rem; }
.price-check-progress[hidden] { display: none; }
.price-check-progress i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent, #7c8cff); animation: price-dot 1.1s ease-in-out infinite; }
.price-check-progress i:nth-child(2) { animation-delay: .18s; }
.price-check-progress i:nth-child(3) { animation-delay: .36s; }
@keyframes price-dot { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }

/* ── Live AI Price Check Inspector Panel ────────────────────────────────── */
.price-check-live-panel {
    margin: 12px 20px 20px;
    padding: 16px 20px;
    background: var(--surface-1, rgba(255, 255, 255, 0.03));
    border: 1px solid var(--line, rgba(255, 255, 255, 0.08));
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    gap: 14px;
    animation: live-panel-slide-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.price-check-live-panel[hidden] {
    display: none;
}

@keyframes live-panel-slide-in {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.99);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.price-check-live-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.price-check-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.price-check-pulse-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #7c8cff;
    box-shadow: 0 0 10px #7c8cff;
    animation: live-pulse 1.4s infinite ease-in-out;
}

@keyframes live-pulse {
    0%, 100% {
        transform: scale(0.9);
        opacity: 0.7;
        box-shadow: 0 0 4px #7c8cff;
    }
    50% {
        transform: scale(1.3);
        opacity: 1;
        box-shadow: 0 0 14px #7c8cff, 0 0 22px rgba(124, 140, 255, 0.5);
    }
}

.price-check-live-head strong {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--ink, #fff);
}

.price-check-badge {
    font-size: 0.72rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(124, 140, 255, 0.12);
    color: #7c8cff;
    border: 1px solid rgba(124, 140, 255, 0.25);
}

.price-check-head-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.price-check-percent {
    font-size: 0.85rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #7c8cff;
}

.price-check-btn-icon {
    background: transparent;
    border: none;
    color: var(--ink-3, #888);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}

.price-check-btn-icon:hover {
    color: var(--ink, #fff);
    background: rgba(255, 255, 255, 0.08);
}

/* Progress bar */
.price-check-progress-bar-wrap {
    height: 6px;
    width: 100%;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 99px;
    overflow: hidden;
    position: relative;
}

.price-check-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #7c8cff, #6875f5, #10b981);
    border-radius: 99px;
    transition: width 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 0 12px rgba(124, 140, 255, 0.4);
}

/* AI Ticker / Action Bar */
.price-check-ai-ticker {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(124, 140, 255, 0.05);
    border: 1px solid rgba(124, 140, 255, 0.15);
    border-radius: 10px;
}

.price-check-ticker-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 2px;
}

.price-check-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(124, 140, 255, 0.2);
    border-top-color: #7c8cff;
    border-radius: 50%;
    display: inline-block;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.price-check-ticker-content {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
}

.price-check-ticker-stage {
    font-size: 0.8rem;
    font-weight: 600;
    color: #7c8cff;
}

.price-check-ticker-msg {
    font-size: 0.74rem;
    color: var(--ink-2, #ccc);
    line-height: 1.35;
}

/* Providers Grid */
.price-check-providers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
    max-height: 380px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    padding-inline-start: 4px;
}

.price-check-provider-card {
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--line, rgba(255, 255, 255, 0.07));
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.25s ease;
}

.price-check-provider-card.status-active {
    border-color: #7c8cff;
    background: rgba(124, 140, 255, 0.06);
    box-shadow: 0 0 16px rgba(124, 140, 255, 0.15);
    animation: active-glow 1.5s infinite alternate;
}

@keyframes active-glow {
    from { border-color: rgba(124, 140, 255, 0.5); box-shadow: 0 0 8px rgba(124, 140, 255, 0.1); }
    to { border-color: rgba(124, 140, 255, 1); box-shadow: 0 0 20px rgba(124, 140, 255, 0.25); }
}

.price-check-provider-card.status-updated {
    border-color: rgba(16, 185, 129, 0.35);
    background: rgba(16, 185, 129, 0.04);
}

.price-check-provider-card.status-free {
    border-color: rgba(168, 85, 247, 0.35);
    background: rgba(168, 85, 247, 0.04);
}

.price-check-provider-card.status-unchanged {
    border-color: rgba(255, 255, 255, 0.1);
    opacity: 0.85;
}

.price-check-provider-card.status-failed {
    border-color: rgba(245, 158, 11, 0.35);
    background: rgba(245, 158, 11, 0.04);
}

.price-check-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.price-check-card-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ink, #fff);
}

.price-check-status-pill {
    font-size: 0.68rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

.status-active .price-check-status-pill {
    background: rgba(124, 140, 255, 0.2);
    color: #7c8cff;
}

.status-updated .price-check-status-pill {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.status-free .price-check-status-pill {
    background: rgba(168, 85, 247, 0.2);
    color: #a855f7;
}

.status-unchanged .price-check-status-pill {
    background: rgba(255, 255, 255, 0.1);
    color: var(--ink-3, #aaa);
}

.status-failed .price-check-status-pill {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.price-check-card-summary {
    font-size: 0.72rem;
    color: var(--ink-2, #ccc);
    line-height: 1.35;
}

.price-check-models-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.price-check-model-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 7px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-size: 0.68rem;
}

.price-check-model-name {
    font-weight: 600;
    color: var(--ink, #fff);
}

.price-check-model-rates {
    font-family: var(--font-mono, monospace);
    color: #7c8cff;
    direction: ltr;
}

.price-check-summary-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 10px;
    font-size: 0.78rem;
    font-weight: 500;
    color: #10b981;
}

/* ── Secret Vault & Key Containers ────────────────────────────────────────── */
.integration-workspace .vault-card {
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface-1);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

.vault-head {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
    flex-wrap: wrap;
}

.vault-head h3 {
    margin: 0;
    font-size: 1.18rem;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.01em;
}

.vault-subtitle {
    margin: 4px 0 0;
    color: var(--ink-muted);
    font-size: 0.75rem;
    line-height: 1.4;
}

.vault-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.vault-search {
    min-width: 240px;
    min-height: 38px;
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-input);
    color: var(--ink);
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.vault-search:focus {
    border-color: var(--diane-blue);
    box-shadow: 0 0 0 3px rgba(84, 202, 255, 0.18);
    background: var(--surface-2);
}

.vault-btn {
    min-height: 38px;
    padding: 8px 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 10px;
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
    border: 1px solid transparent;
}

.vault-btn svg {
    flex-shrink: 0;
}

.vault-btn-ghost {
    background: var(--surface-input);
    border-color: var(--line);
    color: var(--ink-2);
}

.vault-btn-ghost:hover:not(:disabled) {
    background: var(--surface-3);
    color: var(--ink);
    border-color: rgba(84, 202, 255, 0.3);
    transform: translateY(-1px);
}

.vault-btn-primary {
    background: linear-gradient(135deg, #1fa2ff, #12d8fa);
    color: #03111b;
    border: none;
    font-weight: 700;
    box-shadow: 0 2px 10px rgba(18, 216, 250, 0.25);
}

.vault-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #2eb5ff, #29e2ff);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(18, 216, 250, 0.4);
}

.vault-btn-danger {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #fca5a5;
}

.vault-btn-danger:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.22);
    border-color: rgba(239, 68, 68, 0.45);
    color: #fecaca;
    transform: translateY(-1px);
}

.vault-link {
    min-height: 38px;
    padding: 8px 14px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #7fd8ff;
    border: 1px solid rgba(84, 202, 255, 0.2);
    border-radius: 10px;
    background: rgba(84, 202, 255, 0.06);
    font-size: 0.72rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.vault-link:hover {
    background: rgba(84, 202, 255, 0.14);
    border-color: rgba(84, 202, 255, 0.4);
    color: #d8f4ff;
    transform: translateY(-1px);
}

/* Vault Summary Stat Cards */
.vault-summary {
    padding: 16px 24px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    border-bottom: 1px solid var(--line);
    background: rgba(4, 11, 20, 0.25);
}

.vault-fact {
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-input);
    transition: all 0.25s ease;
}

.vault-fact:hover {
    transform: translateY(-1px);
    border-color: rgba(84, 202, 255, 0.25);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.vault-fact-icon {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 800;
    background: rgba(84, 202, 255, 0.1);
    color: #54caff;
    border: 1px solid rgba(84, 202, 255, 0.2);
    flex-shrink: 0;
}

.vault-fact[data-tone="ok"] .vault-fact-icon {
    background: rgba(16, 185, 129, 0.12);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.25);
}

.vault-fact[data-tone="missing"] .vault-fact-icon {
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.25);
}

.vault-fact[data-tone="bad"] .vault-fact-icon {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.25);
}

.vault-fact-content {
    display: grid;
    gap: 2px;
}

.vault-fact strong {
    color: var(--ink);
    font: 700 1.25rem/1.15 var(--font-mono);
}

.vault-fact span {
    color: var(--ink-faint);
    font-size: 0.68rem;
    font-weight: 500;
}

/* Category Filter Chips */
.vault-filters {
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    border-bottom: 1px solid var(--line);
    background: var(--surface-1);
    scrollbar-width: thin;
}

.vault-chip {
    min-height: 34px;
    padding: 6px 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-input);
    color: var(--ink-2);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
}

.vault-chip:hover {
    background: var(--surface-3);
    color: var(--ink);
    border-color: rgba(84, 202, 255, 0.3);
    transform: translateY(-1px);
}

.vault-chip[data-active="true"] {
    background: linear-gradient(135deg, rgba(31, 162, 255, 0.18), rgba(18, 216, 250, 0.18));
    border-color: rgba(84, 202, 255, 0.5);
    color: #d8f4ff;
    box-shadow: 0 0 14px rgba(84, 202, 255, 0.15);
}

.vault-chip-count {
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--ink-3);
    font: 650 0.62rem/1 var(--font-mono);
}

.vault-chip[data-active="true"] .vault-chip-count {
    background: rgba(84, 202, 255, 0.25);
    color: #e3f6ff;
}

/* Vault Body & Key Groups */
.vault-body {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    min-height: 200px;
}

.vault-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.vault-group-title {
    margin: 0 0 4px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--ink-2);
    letter-spacing: -0.01em;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(75, 132, 181, 0.14);
}

.vault-group-icon {
    font-size: 1.05rem;
    line-height: 1;
}

.vault-group-count {
    margin-inline-start: auto;
    padding: 3px 9px;
    border-radius: 8px;
    background: var(--surface-input);
    border: 1px solid var(--line);
    color: var(--ink-3);
    font: 600 0.62rem/1 var(--font-mono);
}

.vault-group-items {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

/* Individual Secret Key Card (Container) */
.vault-row.vault-card-item {
    position: relative;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    border: 1px solid rgba(75, 132, 181, 0.16);
    border-inline-start: 4px solid var(--line);
    border-radius: 14px;
    background: rgba(13, 23, 38, 0.7);
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.2);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.25s ease,
                box-shadow 0.25s ease,
                background-color 0.25s ease;
    animation: vaultCardEnter 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: var(--card-delay, 0s);
}

@keyframes vaultCardEnter {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.vault-row.vault-card-item:hover {
    transform: translateY(-2px);
    border-color: rgba(84, 202, 255, 0.35);
    box-shadow: 0 8px 30px rgba(10, 25, 45, 0.4);
    background: rgba(16, 28, 46, 0.85);
}

.vault-row.vault-card-item[data-tone="ok"] {
    border-inline-start-color: #10b981;
}

.vault-row.vault-card-item[data-tone="env"] {
    border-inline-start-color: #38bdf8;
}

.vault-row.vault-card-item[data-tone="missing"] {
    border-inline-start-color: #f59e0b;
}

.vault-row.vault-card-item[data-tone="bad"] {
    border-inline-start-color: #ef4444;
}

/* Saved flash animation */
.vault-row.vault-card-item.is-saved-flash {
    animation: saveFlash 1.2s ease-out;
}

@keyframes saveFlash {
    0% { border-color: #10b981; box-shadow: 0 0 24px rgba(16, 185, 129, 0.6); }
    100% { border-color: rgba(75, 132, 181, 0.16); box-shadow: 0 4px 18px rgba(0, 0, 0, 0.2); }
}

/* Card Header */
.vault-row-header {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.vault-brand-avatar {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font: 800 0.82rem/1 var(--font-ui);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
    letter-spacing: -0.02em;
    transition: transform 0.2s ease;
}

.vault-row.vault-card-item:hover .vault-brand-avatar {
    transform: scale(1.06);
}

.vault-brand-avatar svg,
.vault-brand-avatar img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.vault-identity {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1;
}

.vault-name {
    margin: 0;
    font-size: 0.96rem;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.01em;
}

.vault-env-chip {
    align-self: flex-start;
    padding: 2px 7px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--ink-3);
    font: 600 0.64rem/1.2 var(--font-mono);
    overflow-wrap: anywhere;
}

.vault-badges {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-inline-start: auto;
}

/* Status Pill with Live Dot */
.vault-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.vault-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.vault-pill[data-tone="ok"] {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.3);
    color: #34d399;
}

.vault-pill[data-tone="ok"] .vault-status-dot {
    background: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.8);
    animation: statusPulseOk 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes statusPulseOk {
    0%, 100% { transform: scale(1); opacity: 1; box-shadow: 0 0 6px rgba(16, 185, 129, 0.6); }
    50% { transform: scale(1.3); opacity: 0.8; box-shadow: 0 0 14px rgba(16, 185, 129, 1); }
}

.vault-pill[data-tone="env"] {
    background: rgba(56, 189, 248, 0.12);
    border-color: rgba(56, 189, 248, 0.3);
    color: #7dd3fc;
}

.vault-pill[data-tone="env"] .vault-status-dot {
    background: #38bdf8;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.8);
}

.vault-pill[data-tone="missing"] {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.3);
    color: #fbbf24;
}

.vault-pill[data-tone="missing"] .vault-status-dot {
    background: #f59e0b;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.6);
}

.vault-pill[data-tone="bad"] {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.vault-pill[data-tone="bad"] .vault-status-dot {
    background: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.8);
}

/* Key Preview Wrap & Copy Button */
.vault-preview-wrap {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.vault-preview {
    color: #93c5fd;
    font: 650 0.68rem/1 var(--font-mono);
    letter-spacing: 0.04em;
    direction: ltr;
}

.vault-copy-btn {
    width: 22px;
    height: 22px;
    min-height: unset;
    padding: 0;
    display: grid;
    place-items: center;
    border: none;
    border-radius: 5px;
    background: transparent;
    color: var(--ink-3);
    cursor: pointer;
    transition: all 0.2s ease;
}

.vault-copy-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--ink);
    transform: scale(1.1);
}

.vault-copy-btn.is-copied {
    color: #34d399;
    background: rgba(16, 185, 129, 0.2);
}

.vault-tag-deploy {
    padding: 4px 9px;
    border-radius: 8px;
    background: rgba(168, 85, 247, 0.14);
    border: 1px solid rgba(168, 85, 247, 0.3);
    color: #c084fc;
    font-size: 0.65rem;
    font-weight: 700;
}

/* Guidance & Facts */
.vault-row-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.vault-guidance {
    padding: 10px 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border-radius: 10px;
    background: rgba(84, 202, 255, 0.05);
    border: 1px solid rgba(84, 202, 255, 0.12);
}

.vault-guidance-icon {
    font-size: 0.85rem;
    line-height: 1.3;
    flex-shrink: 0;
}

.vault-note {
    margin: 0;
    color: var(--ink-2);
    font-size: 0.74rem;
    line-height: 1.5;
}

.vault-connection-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.vault-fact-chip {
    padding: 4px 9px;
    border-radius: 7px;
    background: var(--surface-input);
    border: 1px solid var(--line);
    color: var(--ink-3);
    font-size: 0.65rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.vault-fact-chip[data-tone="ok"] {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.22);
    color: #6ee7b7;
}

.vault-fact-chip[data-tone="bad"] {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.22);
    color: #fca5a5;
}

/* Action Drawer & Inputs */
.vault-row-edit {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 6px;
    border-top: 1px solid rgba(75, 132, 181, 0.1);
}

.vault-input-wrap {
    position: relative;
    flex: 1;
    min-width: 220px;
    display: flex;
    align-items: center;
}

.vault-input {
    width: 100%;
    min-height: 38px;
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-input);
    color: var(--ink);
    font-size: 0.78rem;
    transition: all 0.2s ease;
}

.vault-input:focus {
    border-color: var(--diane-blue);
    box-shadow: 0 0 0 3px rgba(84, 202, 255, 0.18);
    background: var(--surface-2);
}

.vault-toggle-visibility {
    position: absolute;
    inset-inline-end: 6px;
    width: 26px;
    height: 26px;
    min-height: unset;
    padding: 0;
    display: grid;
    place-items: center;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--ink-3);
    cursor: pointer;
    transition: all 0.2s ease;
}

.vault-toggle-visibility:hover {
    color: var(--ink);
    background: rgba(255, 255, 255, 0.08);
}

.vault-toggle-visibility.is-visible {
    color: var(--diane-blue);
}

.vault-btn-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.vault-envonly-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 10px;
    background: rgba(56, 189, 248, 0.06);
    border: 1px solid rgba(56, 189, 248, 0.18);
    color: #7dd3fc;
    font-size: 0.72rem;
    font-weight: 600;
}

.vault-envonly-badge svg {
    flex-shrink: 0;
    color: #38bdf8;
}

/* Animated Status Alert Box */
.vault-row-status {
    display: none;
    padding: 9px 14px;
    border-radius: 9px;
    font-size: 0.74rem;
    font-weight: 600;
    animation: slideDownAlert 0.25s ease-out;
}

@keyframes slideDownAlert {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.vault-row-status.is-active {
    display: block;
}

.vault-row-status[data-tone="ok"] {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

.vault-row-status[data-tone="bad"] {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.vault-row-status[data-tone="warn"] {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fde68a;
}

.vault-row-status:not([data-tone="ok"]):not([data-tone="bad"]):not([data-tone="warn"]) {
    background: rgba(84, 202, 255, 0.1);
    border: 1px solid rgba(84, 202, 255, 0.25);
    color: #bae6fd;
}

.vault-empty {
    padding: 36px 20px;
    text-align: center;
    color: var(--ink-3);
    font-size: 0.85rem;
    border: 1px dashed var(--line);
    border-radius: 12px;
    background: var(--surface-input);
}

.account-connections { padding-bottom: 16px; }
.account-connections-head { justify-content: start; }
.account-connection-grid { padding: 16px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.account-connection-card {
    min-height: 190px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(75, 132, 181, 0.16);
    border-radius: 14px;
    background: var(--surface-input);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}
.account-connection-card:hover {
    transform: translateY(-2px);
    border-color: rgba(84, 202, 255, 0.35);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.connection-brand { display: flex; align-items: center; gap: 12px; }
.connection-letter {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    color: #ffffff;
    border-radius: 12px;
    background: #1e293b;
    font: 800 .92rem/1 var(--font-ui);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}
.account-connection-card:hover .connection-letter {
    transform: scale(1.06);
}
.connection-letter svg,
.connection-letter img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}
.account-connection-card.google .connection-letter { background: #ffffff; }
.account-connection-card.spotify .connection-letter { background: #121212; }
.account-connection-card.whatsapp .connection-letter { background: #075e54; }
.account-connection-card.home .connection-letter { background: linear-gradient(135deg, #0284c7, #6366f1); }
.connection-brand h4 { margin: 0 0 4px; color: var(--ink); }
.connection-brand small { color: #557086; font-size: .61rem; }
.connection-permissions { margin: 14px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.connection-permissions span { padding: 8px; color: #728aa0; border: 1px solid rgba(82, 137, 184, .1); border-radius: 8px; background: rgba(4, 11, 20, .42); font-size: .59rem; }
.connection-fields { margin: 14px 0 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.connection-fields textarea { grid-column: 1 / -1; min-height: 58px; }
.connection-card-actions { margin-top: auto; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.connection-card-actions button { min-height: 36px; padding: 0 11px; color: #bfeeff; border: 1px solid rgba(75, 176, 235, .2); border-radius: 9px; background: rgba(41, 127, 183, .11); font-size: .61rem; }
.connection-card-actions span { color: var(--ok); font-size: .59rem; }
.google-contacts-browser { margin-top: 14px; overflow: hidden; border: 1px solid rgba(77, 139, 188, .13); border-radius: 11px; background: rgba(4, 11, 19, .5); }
.google-contacts-browser > div:first-child { padding: 9px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); }
.google-contacts-browser > div:first-child strong { color: #839db3; font-size: .62rem; }
.google-contacts-browser > div:first-child > span { display: grid; gap: 3px; }
.google-contacts-browser > div:first-child small { color: #50697e; font-size: .52rem; }
#google-contacts-search { width: 180px; min-height: 32px; }
#google-contacts-list { max-height: 220px; padding: 6px; overflow-y: auto; }
.google-contact-row { padding: 7px; display: grid; grid-template-columns: 30px 1fr; align-items: center; gap: 8px; border-radius: 8px; }
.google-contact-row:hover { background: rgba(61, 130, 180, .08); }
.google-contact-row > span { width: 28px; height: 28px; display: grid; place-items: center; color: #06121d; border-radius: 9px; background: #a9def8; font-size: .62rem; font-weight: 800; }
.google-contact-row div { min-width: 0; display: grid; gap: 2px; }
.google-contact-row strong,
.google-contact-row small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.google-contact-row strong { color: #b8cddd; font-size: .62rem; }
.google-contact-row small { color: #536d82; font-size: .54rem; direction: ltr; text-align: right; }
.google-contacts-empty { padding: 18px; color: #567085; font-size: .61rem; text-align: center; }
.infrastructure-connections { display: grid; grid-template-columns: 1fr 1fr; }
.infrastructure-card { min-height: 200px; padding: 18px; display: grid; grid-template-columns: minmax(150px, .55fr) minmax(0, 1fr); align-items: center; gap: 18px; }
.infrastructure-card + .infrastructure-card { border-inline-start: 1px solid var(--line); }
.infrastructure-card h3 { margin: 6px 0; }
.infrastructure-card p { margin: 0; color: var(--ink-muted); font-size: .7rem; line-height: 1.6; }
.infrastructure-fields { display: grid; gap: 8px; }
.infrastructure-fields button { min-height: 40px; color: #dff5ff; border-radius: 10px; background: linear-gradient(135deg, #278fca, #576cd1); }
.infrastructure-fields span { min-height: 15px; color: var(--ok); font-size: .6rem; }
.model-control-center { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-1); box-shadow: none; }
.model-control-center > header { min-height: 94px; padding: 20px 24px; display: flex; align-items: center; justify-content: space-between; gap: 22px; border-bottom: 1px solid var(--line); }
.model-control-center h2 { margin: 0 0 5px; font-size: clamp(1.3rem, 2vw, 1.65rem); }
.model-control-center header p { margin: 0; color: var(--ink-muted); }
.model-runtime-state { min-width: 160px; padding: 13px 15px; display: grid; grid-template-columns: 13px 1fr; gap: 3px 8px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-input); }
.model-runtime-state i { width: 8px; height: 8px; align-self: center; grid-row: 1 / 3; border-radius: 50%; background: #54caff; box-shadow: 0 0 11px rgba(84,202,255,.6); }
.model-runtime-state span { color: #546f85; font-size: .56rem; }
.model-runtime-state strong { color: #bfeaff; font: 600 .66rem/1.2 var(--font-mono); }
.model-control-body { padding: 20px 24px; display: grid; grid-template-columns: 230px minmax(0,1fr) auto; align-items: end; gap: 18px; }
.active-provider-identity { min-height: 70px; padding: 13px; display: grid; grid-template-columns: 42px 1fr; align-items: center; gap: 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-input); }
.active-provider-identity .provider-logo-mark { width: 46px; height: 46px; }
.active-provider-identity .provider-logo-mark svg { width: 26px; height: 26px; }
.active-provider-identity div { min-width: 0; display: grid; gap: 3px; }
.active-provider-identity small { color: #506a80; font-size: .55rem; }
.active-provider-identity strong { color: #e3f3fc; font-size: .8rem; }
.active-provider-identity span:last-child { overflow: hidden; color: #688198; font-size: .57rem; text-overflow: ellipsis; white-space: nowrap; }
.model-control-fields { display: grid; grid-template-columns: minmax(170px,.7fr) minmax(230px,1.3fr); gap: 10px; }
.model-control-fields label { display: grid; gap: 7px; color: #718aa1; font-size: .63rem; }
.model-control-action { min-width: 150px; display: grid; gap: 7px; }
.model-control-action span { min-height: 17px; color: var(--ok); font-size: .58rem; }
.model-control-action button { min-height: 46px; padding: 0 18px; color: white; border-radius: 11px; background: linear-gradient(135deg,#289bd5,#5c6bd7); }
.model-control-center > footer { min-height: 45px; padding: 0 24px; display: flex; align-items: center; gap: 25px; color: #526a7f; border-top: 1px solid var(--line); font-size: .59rem; }
.model-control-center footer strong { color: #7893a9; font-family: var(--font-mono); }
.model-control-center footer button { margin-inline-start: auto; min-height: 32px; color: #6baed4; border: 0; background: transparent; font-size: .6rem; }

/* Brain is a cognitive workspace, not a raw settings textarea. */
.brain-workspace {
    overflow: hidden;
    border: 1px solid rgba(89, 148, 205, .18);
    border-radius: 18px;
    background: var(--surface-input);
    box-shadow: none;
}
.brain-header {
    min-height: 76px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid var(--line);
}
.brain-header h2 { margin: 0 0 5px; font-size: clamp(1.35rem, 2vw, 1.75rem); letter-spacing: -.025em; }
.brain-header p { margin: 0; color: var(--ink-muted); font-size: .72rem; line-height: 1.5; }
.brain-layout { min-height: 620px; display: grid; grid-template-columns: 200px minmax(0, 1fr); }
.brain-layer-rail {
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-inline-end: 1px solid var(--line);
    background: var(--surface-1);
}
#persona-select { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.brain-layer-button {
    width: 100%;
    min-height: 44px;
    padding: 8px 10px;
    display: grid;
    grid-template-columns: 28px 1fr;
    align-items: center;
    gap: 8px;
    color: #7890a8;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    text-align: start;
}
.brain-layer-button:hover { color: #cdeeff; background: rgba(38, 91, 138, .1); }
.brain-layer-button.is-active {
    color: #eaf8ff;
    border-color: rgba(74, 185, 255, .24);
    background: linear-gradient(110deg, rgba(31, 99, 154, .24), rgba(100, 76, 196, .08));
    box-shadow: inset -2px 0 #4ec7ff;
}
.brain-layer-button > i {
    width: 28px;
    height: 28px;
    position: relative;
    display: grid;
    place-items: center;
    border: 1px solid rgba(104, 164, 214, .16);
    border-radius: 10px;
    background: rgba(4, 11, 20, .66);
}
.brain-layer-button > i::before {
    content: "";
    width: 10px;
    height: 10px;
    border: 1px solid currentColor;
    border-radius: 3px 7px 4px 7px;
    transform: rotate(20deg);
}
.brain-layer-button.is-active > i {
    color: #5fd0ff;
    border-color: rgba(87, 202, 255, .3);
    box-shadow: 0 0 18px rgba(67, 177, 255, .12);
}
.brain-layer-button span { min-width: 0; display: grid; gap: 4px; }
.brain-layer-button b { font-size: .78rem; }
.brain-layer-button small { overflow: hidden; color: var(--ink-faint); font-size: .63rem; text-overflow: ellipsis; white-space: nowrap; }
.brain-main-stage { min-width: 0; }
.brain-prompt-view,
.brain-memory-view { min-height: 620px; }
.brain-stage-toolbar {
    min-height: 72px;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    border-bottom: 1px solid var(--line);
}
.brain-stage-toolbar h3 { margin: 0 0 2px; font-size: 1.16rem; }
.brain-stage-toolbar p { margin: 6px 0 0; color: var(--ink-muted); font-size: .76rem; line-height: 1.65; }
.persona-help { max-width: 760px; min-height: 20px; }
.persona-status { color: var(--ok); font-size: .7rem; }
.brain-editor-layout { min-height: 558px; display: grid; grid-template-columns: 160px minmax(0, 1fr); }
.brain-outline { padding: 18px 10px; border-inline-end: 1px solid var(--line); background: rgba(4, 10, 18, .38); }
.brain-outline > strong { padding: 0 8px; color: #8199b0; font-size: .68rem; letter-spacing: .04em; }
#brain-outline-list { margin-top: 14px; display: grid; gap: 4px; }
#brain-outline-list button {
    min-height: 38px;
    padding: 6px 8px;
    display: grid;
    grid-template-columns: 24px 1fr;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    color: #687f96;
    border: 0;
    border-radius: 8px;
    background: transparent;
    font-size: .64rem;
    text-align: start;
}
#brain-outline-list button:hover { color: #cbefff; background: rgba(57, 137, 198, .1); }
#brain-outline-list button span { color: #354d65; font: 500 .56rem/1 var(--font-mono); }
.brain-outline-empty { padding: 10px 8px; color: #455a6f; font-size: .62rem; line-height: 1.6; }
#brain-document-stats { display: block; margin: 20px 8px 0; color: #3e5266; font: 500 .58rem/1.5 var(--font-mono); }
.brain-document { min-width: 0; padding: 16px 20px 20px; }
.brain-document-top {
    min-height: 38px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #607990;
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 13px 13px 0 0;
    background: #060d18;
    font-size: .62rem;
}
.brain-document-top span i { display: inline-block; width: 5px; height: 5px; margin-inline-end: 6px; border-radius: 50%; background: #55caff; box-shadow: 0 0 9px rgba(85, 202, 255, .7); }
.brain-document-top button { min-height: 26px; padding: 3px 8px; color: #6f8da8; border: 0; background: transparent; font-size: .61rem; }
#persona-editor {
    width: 100%;
    min-height: 380px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 0 0 13px 13px;
    background:
        linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px) 0 0 / 100% 31px,
        #07101b;
    color: #c5d5e5;
    font: 400 .8rem/1.9 var(--font-mono);
    direction: rtl;
    text-align: start;
    resize: vertical;
}
#persona-editor:focus { border-color: rgba(69, 183, 255, .35); box-shadow: inset 0 0 0 1px rgba(69, 183, 255, .06); }
.persona-editor-actions { padding-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 14px; color: var(--ink-faint); font-size: .68rem; }
.persona-editor-actions button,
.brain-add-memory { min-height: 40px; padding: 0 16px; border-radius: 11px; background: linear-gradient(135deg, #2d9ddb, #576fd4); color: white; box-shadow: 0 8px 24px rgba(42, 136, 208, .18); }
.brain-memory-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.brain-memory-summary > div { min-height: 64px; padding: 12px 16px; display: grid; align-content: center; gap: 4px; border-inline-end: 1px solid var(--line); }
.brain-memory-summary > div:last-child { border-inline-end: 0; }
.brain-memory-summary strong { color: var(--ink); font: 600 1.2rem/1 var(--font-mono); }
.brain-memory-summary span { color: var(--ink-faint); font-size: .65rem; }
.brain-memory-controls { padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.brain-memory-filters { display: flex; gap: 5px; flex-wrap: wrap; }
.brain-memory-filters button { min-height: 32px; padding: 5px 11px; color: #6c859d; border: 1px solid transparent; border-radius: 9px; background: transparent; font-size: .64rem; }
.brain-memory-filters button.is-active { color: #d9f4ff; border-color: rgba(76, 184, 250, .2); background: rgba(47, 138, 201, .13); }
#brain-memory-search { width: min(260px, 100%); min-height: 38px; }
.brain-memory-grid { padding: 14px 18px 22px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.brain-memory-card {
    min-height: 160px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(80, 137, 188, .15);
    border-radius: 14px;
    background: var(--surface-1);
    transition: transform .18s ease, border-color .18s ease;
}
.brain-memory-card:hover { border-color: rgba(83, 183, 244, .28); }
.brain-memory-card.project { border-top-color: rgba(129, 101, 255, .45); }
.brain-memory-card.preference { border-top-color: rgba(79, 183, 255, .45); }
.brain-memory-card.inferred { border-top-color: rgba(236, 175, 81, .36); }
.brain-memory-card-top { display: flex; align-items: center; justify-content: space-between; }
.brain-memory-kind { display: inline-flex; align-items: center; gap: 7px; color: #7893aa; font-size: .62rem; }
.brain-memory-kind i { width: 6px; height: 6px; border-radius: 50%; background: #50c7ff; box-shadow: 0 0 9px rgba(80, 199, 255, .5); }
.brain-memory-card.inferred .brain-memory-kind i { background: #e5ad62; box-shadow: 0 0 9px rgba(229, 173, 98, .4); }
.brain-memory-card.project .brain-memory-kind i { background: #8f7cff; box-shadow: 0 0 9px rgba(143, 124, 255, .45); }
.brain-memory-card-top button { min-height: 28px; padding: 3px 8px; color: #67829b; border: 0; background: transparent; font-size: .6rem; }
.brain-memory-card-top button.brain-memory-delete {
    color: #f3a0a7;
    border: 1px solid rgba(224, 91, 103, .28);
    border-radius: 8px;
    background: rgba(173, 47, 58, .12);
    padding-inline: 10px;
}
.brain-memory-card-top button.brain-memory-delete:hover {
    color: #ffd4d8;
    border-color: rgba(240, 120, 130, .45);
    background: rgba(173, 47, 58, .22);
}
.brain-memory-card h4 { margin: 12px 0 6px; color: var(--ink); font-size: .92rem; }
.brain-memory-card p { margin: 0; color: #8ea3b7; font-size: .73rem; line-height: 1.75; white-space: pre-wrap; }
.brain-memory-card footer { margin-top: auto; padding-top: 14px; display: flex; align-items: center; gap: 12px; color: #486076; border-top: 1px solid rgba(84, 132, 173, .09); font-size: .56rem; }
.brain-confidence { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 5px; }
.brain-confidence i { width: 34px; height: 3px; overflow: hidden; border-radius: 4px; background: linear-gradient(90deg, #49bcf5 var(--confidence), #182b3d var(--confidence)); }
.brain-memory-card.event { border-top-color: rgba(96, 209, 168, .45); }
.brain-memory-card.event .brain-memory-kind i { background: #5fd3a9; box-shadow: 0 0 9px rgba(95, 211, 169, .45); }
.brain-memory-search-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.brain-memory-date-filter { display: inline-flex; align-items: center; gap: 6px; color: #6c859d; font-size: .62rem; }
.brain-memory-date-filter input { min-height: 34px; }
.brain-memory-clear-date { min-height: 32px; padding: 5px 11px; color: #6c859d; border: 1px solid var(--line); border-radius: 9px; background: transparent; font-size: .62rem; }
.brain-memory-clear-date:hover { color: #d9f4ff; border-color: rgba(76, 184, 250, .28); }
.brain-memory-tags { margin: 10px 0 0; padding: 0; display: flex; gap: 6px; flex-wrap: wrap; list-style: none; }
.brain-memory-tags li { padding: 2px 8px; color: #7ea6c4; border: 1px solid rgba(84, 132, 173, .22); border-radius: 999px; font-size: .56rem; }
.brain-memory-date { color: #6f8ba3; font-variant-numeric: tabular-nums; }
.brain-memory-tier { padding: 2px 7px; border-radius: 999px; font-size: .54rem; }
.brain-memory-tier.is-always { color: #cfeaff; background: rgba(47, 138, 201, .18); }
.brain-memory-tier.is-general { color: #8fa8bd; background: rgba(84, 132, 173, .12); }
.brain-memory-toggle { display: flex; align-items: center; gap: 9px; color: #a9bfd2; font-size: .72rem; }
.brain-memory-toggle input { width: 16px; height: 16px; }
.brain-memory-hint { margin: -8px 0 0; color: #5e768c; font-size: .62rem; line-height: 1.7; }
.brain-memory-empty,
.brain-memory-loading { min-height: 220px; padding: 30px; grid-column: 1 / -1; }
.brain-memory-empty strong { color: #a9bfd2; }
.brain-memory-dialog {
    width: min(620px, calc(100vw - 28px));
    padding: 0;
    color: var(--ink);
    border: 1px solid rgba(87, 169, 229, .24);
    border-radius: 22px;
    background: #091421;
    box-shadow: 0 32px 90px rgba(0, 0, 0, .6);
}
.brain-memory-dialog::backdrop { background: rgba(1, 5, 10, .74); backdrop-filter: blur(8px); }
.brain-memory-dialog form { padding: 24px; display: grid; gap: 16px; }
.brain-dialog-head { display: flex; align-items: start; justify-content: space-between; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.brain-dialog-head h3 { margin: 5px 0 0; }
.brain-dialog-head button { min-width: 34px; min-height: 34px; padding: 0; color: #7991a8; border: 0; background: transparent; font-size: 1.3rem; }
.brain-memory-dialog label { display: grid; gap: 7px; color: #8099b0; font-size: .68rem; }
.brain-memory-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.brain-memory-form-row label:last-child { grid-template-columns: 1fr auto; align-items: center; }
.brain-memory-form-row label:last-child span { grid-column: 1 / -1; }
.brain-memory-dialog output { color: #67cfff; font: 600 .65rem/1 var(--font-mono); }
.brain-dialog-actions { padding-top: 8px; display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 8px; }
.brain-dialog-actions button { min-height: 38px; padding: 0 13px; }
.brain-dialog-actions .danger-action { color: #f0a3aa; border: 1px solid rgba(224, 91, 103, .2); background: rgba(173, 47, 58, .08); }

/* Logs are an operational trace explorer. */
.log-console { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-1); box-shadow: none; }
.log-console-head { padding: 20px 24px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.log-console-head h3 { margin: 0; font-size: 1.25rem; }
.log-console-live { color: var(--ink-muted); font-size: .72rem; }
.log-console-live i { display: inline-block; width: 7px; height: 7px; margin-inline-end: 7px; border-radius: 50%; background: var(--diane); box-shadow: 0 0 12px rgba(124,140,255,.7); animation: presence 2s infinite; }
.log-console .log-filters { padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--surface-input); }
.log-console .status-text { padding-inline: 20px; }
.log-console .logs-container { padding: 20px; }

#page-logs { width: min(100%, 1380px); }
.log-console { background: var(--surface-input); }
.log-console-head { min-height: 94px; background: var(--surface-1); }
.log-console-head h3 { font-size: clamp(1.2rem,2vw,1.55rem); letter-spacing: -.02em; }
.log-console-head p { max-width: 620px; margin: 5px 0 0; color: var(--ink-3); font-size: .68rem; line-height: 1.5; }
.log-head-actions { display: flex; align-items: center; gap: 10px; }
.log-head-actions .btn { min-height: 38px; }
.log-source-switch { padding: 10px 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; border-bottom: 1px solid var(--line); background: var(--surface-input); }
.log-source-switch > button { min-height: 46px; padding: 10px 14px; display: grid; gap: 2px; text-align: start; color: var(--ink-3); border: 1px solid var(--line); border-radius: 11px; background: var(--surface-1); transition: .2s ease; }
.log-source-switch > button span { color: var(--ink-2); font-weight: 700; }
.log-source-switch > button small { font-size: .64rem; }
.log-source-switch > button[aria-pressed="true"] { color: var(--diane); border-color: var(--violet-line); background: var(--violet-soft); box-shadow: inset -2px 0 0 var(--diane-violet); }
.log-source-switch > button[aria-pressed="true"] span { color: var(--ink); }
.log-source-switch select { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.log-console .log-filters { display: grid; grid-template-columns: minmax(140px,.4fr) minmax(240px,1fr) repeat(3,auto); align-items: end; gap: 8px; background: var(--surface-1); }
.log-filters label { display: grid; gap: 6px; color: #637d94; font-size: .62rem; }
.log-filters select,.log-filters input { width: 100%; min-height: 42px; color: #bbcedd; border: 1px solid #183147; border-radius: 11px; background: #040d19; }
.log-filters .btn { min-height: 42px; white-space: nowrap; }
.log-advanced-filters { border-bottom: 1px solid #142a3d; background: #06101c; }
.log-diagnosis { padding: 14px 20px; border-bottom: 1px solid #142a3d; background: #050f1b; color: #bbcedd; font-size: .72rem; display: grid; gap: 14px; }
.log-diagnosis-summary { display: grid; grid-template-columns: repeat(5,minmax(80px,1fr)); gap: 10px; }
.log-diagnosis-summary div { display: grid; gap: 3px; }
.log-diagnosis-summary span { color: #637d94; font-size: .6rem; }
.log-diagnosis h4 { margin: 0 0 8px; color: #7fa4c0; font-size: .68rem; }
.log-diagnosis-error { padding: 8px 10px; margin-bottom: 8px; border: 1px solid #2a1620; border-radius: 10px; background: #10070c; }
.log-diagnosis-error p { margin: 4px 0; color: #d99; word-break: break-word; }
.log-diagnosis-error small { color: #637d94; }
.log-diagnosis-turn { padding: 8px 10px; margin-bottom: 8px; border: 1px solid #183147; border-radius: 10px; background: #040d19; }
.log-diagnosis-turn ol { margin: 6px 0; padding-inline-start: 18px; display: grid; gap: 4px; }
.log-diagnosis-turn li[data-status="failed"] { color: #e08a8a; }
.log-diagnosis ul { margin: 0; padding-inline-start: 18px; display: grid; gap: 4px; }
@media (max-width: 720px) { .log-diagnosis-summary { grid-template-columns: 1fr 1fr; } }
.log-advanced-filters > summary { padding: 11px 20px; cursor: pointer; color: #6f8aa0; font-size: .65rem; }
.log-advanced-filters > div { padding: 0 20px 16px; display: grid; grid-template-columns: repeat(4,minmax(130px,1fr)); align-items: end; gap: 10px; }
.log-advanced-filters label { min-width: 0; display: grid; gap: 6px; color: #637d94; font-size: .62rem; }
.log-advanced-filters input,.log-advanced-filters select { width: 100%; min-width: 0; min-height: 40px; color: #bbcedd; border: 1px solid #183147; border-radius: 10px; background: #040d19; }
.log-overview { display: grid; grid-template-columns: repeat(4,1fr); border-bottom: 1px solid var(--line); background: var(--surface-input); }
.log-overview > div { min-height: 70px; padding: 13px 17px; display: grid; align-content: center; gap: 4px; border-inline-end: 1px solid var(--line); }
.log-overview > div:last-child { border-inline-end: 0; }
.log-overview span { color: #59738a; font-size: .61rem; }
.log-overview strong { color: var(--ink); font: 650 .92rem/1 var(--font-mono); }
.log-loading-block { height: 240px; border-radius: 18px; }
.log-load-error { color: #ff8fa5; }
.log-console .logs-container { min-height: 300px; padding: 18px; background: var(--surface-input); }
.log-pagination { min-height: 74px; padding: 14px 22px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #5f788f; border-top: 1px solid var(--line); background: #06101c; font-size: .66rem; }
.log-trace { margin-bottom: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-1); transition: border-color .2s ease, transform .2s ease; }
.log-trace:hover { transform: translateY(-1px); border-color: #21435e; }
.log-trace[data-tone="bad"] { border-inline-start: 3px solid #ef647e; }
.log-trace[data-tone="ok"] { border-inline-start: 3px solid #42c7fa; }
.log-trace-head { min-height: 58px; display: grid; grid-template-columns: minmax(125px,.55fr) auto 1fr auto; background: linear-gradient(90deg, rgba(23,60,88,.28), rgba(8,18,31,.78)); }
.log-trace-time { color: #8ea6ba; font: 600 .65rem/1.3 var(--font-mono); }
.log-trace-verdict { width: fit-content; padding: 5px 8px; border-radius: 999px; font-size: .59rem; }
.log-trace-verdict[data-tone="ok"] { color: #61d4ff; background: rgba(56,185,239,.1); }
.log-trace-verdict[data-tone="bad"] { color: #ff91a5; background: rgba(239,85,113,.1); }
.log-trace-facts { color: #607c94; font-size: .62rem; }
.log-trace-trigger { margin: 0; padding: 14px 18px; color: #b7cad9; border-block: 1px solid #12273a; background: rgba(3,10,18,.48); font-size: .71rem; line-height: 1.65; }
.log-step { border-bottom: 1px solid #102437; }
.log-step:last-child { border-bottom: 0; }
.log-step-head { min-height: 50px; cursor: pointer; list-style: none; }
.log-step-head::-webkit-details-marker { display: none; }
.log-step-icon,.log-line-icon { width: 31px; height: 31px; flex: 0 0 auto; display: grid; place-items: center; color: #68d1ff; border: 1px solid rgba(62,189,246,.24); border-radius: 9px; background: rgba(45,160,219,.09); font: 700 .55rem/1 var(--font-mono); }
.log-step[data-tone="bad"] .log-step-icon { color: #ff8da1; border-color: rgba(236,91,115,.25); background: rgba(190,50,74,.09); }
.log-step[data-tone="warn"] .log-step-icon { color: #ffc472; border-color: rgba(239,166,64,.25); background: rgba(197,122,27,.09); }
.log-step-title { min-width: 130px; color: #aabfd0; font-size: .68rem; font-weight: 700; }
.log-step-action { color: #7bd4ff; background: transparent; font-size: .62rem; }
.log-step-gist { min-width: 0; overflow: hidden; color: #5e788f; text-overflow: ellipsis; white-space: nowrap; font-size: .62rem; }
.log-step-duration { margin-inline-start: auto; color: #738da4; font: 600 .58rem/1 var(--font-mono); }
.log-step-body { color: #829aaf; border: 1px solid #132b40; font: .61rem/1.65 var(--font-mono); }
.log-line { min-height: 60px; padding: 11px 12px; display: grid; grid-template-columns: 34px minmax(130px,.65fr) 72px minmax(110px,.55fr) minmax(240px,1.7fr) auto auto; align-items: center; gap: 10px; border-bottom: 1px solid #102437; background: #07111e; }
.log-line:first-child { border-radius: 15px 15px 0 0; }
.log-line:last-child { border-bottom: 0; border-radius: 0 0 15px 15px; }
.log-line[data-level="error"],.log-line[data-level="critical"] { box-shadow: inset -3px 0 #ef647e; }
.log-line[data-level="warning"] { box-shadow: inset -3px 0 #e8a445; }
.log-line-time { color: #718a9f; font: .58rem/1.4 var(--font-mono); }
.log-line-level { color: #6ecfff; font: 700 .55rem/1 var(--font-mono); }
.log-line[data-level="error"] .log-line-level,.log-line[data-level="critical"] .log-line-level { color: #ff8da1; }
.log-line[data-level="warning"] .log-line-level { color: #ffc472; }
.log-line-service { color: #aabfd0; font-size: .65rem; font-weight: 700; }
.log-line-message { min-width: 0; color: #71899e; font-size: .64rem; line-height: 1.5; overflow-wrap: anywhere; }
.log-copy-button { min-height: 30px; padding: 5px 9px; color: #7190a9; border: 1px solid #19344a; border-radius: 8px; background: rgba(7,18,31,.82); font-size: .56rem; white-space: nowrap; }
.log-copy-button:hover { color: #7ed7ff; border-color: rgba(66,195,246,.38); }
.log-protect-button { min-height: 30px; padding: 5px 9px; color: #7890a3; border: 1px solid #19344a; border-radius: 8px; background: transparent; font-size: .56rem; white-space: nowrap; }
.log-protect-button[data-protected="true"] { color: #ffd281; border-color: rgba(238,177,74,.34); background: rgba(128,85,19,.12); }
.log-step-head .log-protect-button { margin-inline-start: auto; }
.log-maintenance-dialog { width: min(610px,calc(100vw - 24px)); max-height: calc(100vh - 30px); padding: 0; color: var(--ink); border: 1px solid #23445f; border-radius: 24px; background: #07121f; box-shadow: 0 35px 100px rgba(0,0,0,.66); }
.log-maintenance-dialog::backdrop { background: rgba(1,5,10,.78); backdrop-filter: blur(9px); }
.log-maintenance-card { padding: 24px; display: grid; gap: 16px; }
.log-maintenance-card > header { display: flex; align-items: start; justify-content: space-between; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.log-maintenance-card h3 { margin: 5px 0 0; }
.log-maintenance-card header button { width: 36px; height: 36px; padding: 0; color: #7891a7; border: 0; background: transparent; font-size: 1.4rem; }
.log-maintenance-card > p { margin: 0; color: #6d859a; font-size: .68rem; line-height: 1.65; }
.log-retention-toggle { min-height: 74px; padding: 15px; display: flex; align-items: center; gap: 12px; border: 1px solid #173149; border-radius: 15px; background: #050e1a; }
.log-retention-toggle input { width: 38px; height: 20px; accent-color: #48c8ff; }
.log-retention-toggle span { display: grid; gap: 4px; }
.log-retention-toggle strong { color: #b8cbd9; font-size: .72rem; }
.log-retention-toggle small,.log-danger-zone small { color: #647c91; font-size: .61rem; line-height: 1.5; }
.log-maintenance-field { display: grid; gap: 7px; color: #6f879b; font-size: .63rem; }
.log-maintenance-field select,.log-maintenance-field input { min-height: 42px; color: #b9ccda; border: 1px solid #18344b; border-radius: 10px; background: #040d18; }
.log-maintenance-field input[type="number"] { direction: ltr; text-align: start; font-variant-numeric: tabular-nums; }
.log-maintenance-field small { color: #5d778d; font-size: .58rem; line-height: 1.5; }
.log-storage-status { padding: 12px 14px; color: #7da0b8; border: 1px solid #17364d; border-radius: 11px; background: #050f1b; font-size: .64rem; }
.log-storage-status[data-tone="warning"] { color: #ffc879; border-color: rgba(230,158,57,.3); }
.log-storage-status[data-tone="critical"] { color: #ff9aab; border-color: rgba(239,100,126,.35); }
.log-danger-zone { margin-top: 4px; padding: 17px; display: grid; gap: 13px; border: 1px solid rgba(226,85,110,.22); border-radius: 16px; background: rgba(105,22,39,.08); }
.log-danger-zone > div { display: grid; gap: 4px; }
.log-danger-zone strong { color: #e6a0ad; font-size: .71rem; }
.btn-danger { color: #ffc2cc; border: 1px solid rgba(229,85,111,.35); background: rgba(171,42,67,.18); }

@media (max-width: 760px) {
    .log-console { border-radius: 18px; }
    .log-console-head { min-height: 0; padding: 22px 16px; align-items: flex-start; gap: 16px; }
    .log-console-head p { font-size: .67rem; }
    .log-head-actions { display: grid; justify-items: end; }
    .log-source-switch { padding: 12px; grid-template-columns: 1fr; }
    .log-source-switch > button { min-height: 64px; }
    .log-console .log-filters { grid-template-columns: 1fr 1fr; padding: 12px; }
    .log-search-box { grid-column: 1 / -1; }
    .log-advanced-filters > div { padding: 0 12px 14px; grid-template-columns: 1fr 1fr; }
    .log-overview { grid-template-columns: 1fr 1fr; }
    .log-overview > div { min-height: 72px; padding: 13px 14px; border-bottom: 1px solid var(--line); }
    .log-console .logs-container { padding: 12px; }
    .log-trace-head { grid-template-columns: 1fr auto; gap: 8px; }
    .log-trace-facts { grid-column: 1 / -1; }
    .log-step-head { display: grid; grid-template-columns: 32px 1fr auto; }
    .log-step-action,.log-step-gist { grid-column: 2 / -1; }
    .log-step-duration { grid-column: 3; grid-row: 1; }
    .log-line { grid-template-columns: 34px 1fr auto; gap: 7px; }
    .log-line-time { grid-column: 2; }
    .log-line-level { grid-column: 3; grid-row: 1; }
    .log-line-service { grid-column: 2; }
    .log-line-message { grid-column: 2 / -1; }
    .log-line .log-copy-button { grid-column: 3; grid-row: 2; }
    .log-line .log-protect-button { grid-column: 3; grid-row: 3; }
    .log-pagination { align-items: stretch; flex-direction: column; }
    .log-pagination .btn { width: 100%; }
}

/* Response Runtime Studio */
#page-chat-runtime { width: min(100%, 1320px); }
.runtime-studio { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-1); box-shadow: none; }
.runtime-studio-hero { min-height: 108px; padding: 22px 26px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); background: var(--surface-1); }
.runtime-studio-hero h2 { max-width: 720px; margin: 0 0 6px; color: var(--ink); font-size: clamp(1.4rem,2vw,1.75rem); letter-spacing: -.025em; line-height: 1.15; }
.runtime-studio-hero p { max-width: 710px; margin: 0; color: var(--ink-3); font-size: .72rem; line-height: 1.55; }
.runtime-target { min-width: 150px; padding: 11px 13px; display: grid; gap: 4px; border: 1px solid var(--violet-line); border-radius: 12px; background: var(--violet-soft); }
.runtime-target span { color: var(--ink-3); font-size: .58rem; }
.runtime-target strong { color: var(--diane-violet); font: 700 .8rem/1.2 var(--font-mono); }
.runtime-studio-grid { padding: 20px; display:grid; grid-template-columns:minmax(0,.8fr) minmax(0,1.2fr); gap:14px; background:var(--surface-1); }
.runtime-control-panel { padding:20px; display:grid; align-content:start; gap:16px; border:1px solid var(--line); border-radius:15px; background:var(--surface-input); }
.runtime-control-panel > header { display:flex; justify-content:space-between; align-items:flex-start; gap:15px; padding-bottom:13px; border-bottom:1px solid var(--line); }
.runtime-control-panel h3 { margin:0; color:var(--ink); font-size:1rem; }
.runtime-interim-panel { background:var(--surface-input); }
.runtime-wording-panel { grid-column:1 / -1; }
.runtime-switch { min-height:70px; padding:13px; display:flex; align-items:center; gap:13px; border:1px solid var(--line); border-radius:12px; background:var(--surface-1); }
.runtime-switch input { width:40px; height:21px; flex:0 0 auto; accent-color:#49caff; }
.runtime-switch span { display:grid; gap:4px; }
.runtime-switch strong { color:var(--ink); font-size:.69rem; }
.runtime-switch small { color:var(--ink-3); font-size:.59rem; line-height:1.5; }
.runtime-field,.runtime-prompt-field { display:grid; gap:7px; color:var(--ink-2); font-size:.62rem; }
.runtime-field > div { display:grid; grid-template-columns:1fr auto; align-items:center; overflow:hidden; border:1px solid var(--line); border-radius:11px; background:var(--surface-1); }
.runtime-field input,.runtime-field select { min-width:0; min-height:42px; color:var(--ink); border:0; background:transparent; }
.runtime-field > input,.runtime-field > select { width:100%; min-height:42px; color:var(--ink); border:1px solid var(--line); border-radius:11px; background:var(--surface-1); }
.runtime-field b { padding:0 11px; color:var(--ink-3); font:500 .55rem/1 var(--font-mono); }
.runtime-field small { color:var(--ink-3); font-size:.57rem; line-height:1.55; }
.runtime-number-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.runtime-prompt-field textarea { width:100%; min-height:220px; resize:vertical; padding:14px; color:var(--ink); border:1px solid var(--line); border-radius:12px; background:var(--surface-1); font: .63rem/1.7 var(--font-mono); direction:rtl; }
.runtime-prompt-field small { color:var(--ink-3); line-height:1.6; }
.runtime-prompt-actions { display:flex; align-items:center; justify-content:space-between; gap:12px; color:var(--ink-3); font-size:.61rem; }
.runtime-save-bar { position:sticky; bottom:0; z-index:4; min-height:68px; padding:12px 20px; display:flex; align-items:center; justify-content:space-between; gap:20px; border-top:1px solid var(--line); background:var(--surface-1); }
.runtime-save-bar > div { display:flex; align-items:center; gap:10px; }
.runtime-save-bar > div:first-child { display:grid; gap:4px; }
.runtime-save-bar strong { color:var(--ink-2); font-size:.68rem; }

@media (max-width: 900px) {
    .runtime-studio-grid { grid-template-columns:1fr; }
    .runtime-wording-panel { grid-column:auto; }
}

@media (min-width: 981px) and (max-width: 1380px) {
    .flow-studio {
        position: relative;
        grid-template-columns: 220px minmax(0, 1fr);
    }
    .flow-inspector {
        position: absolute;
        z-index: 9;
        inset: 0 0 0 auto;
        width: min(340px, 42vw);
        border-left: 1px solid var(--flow-line);
        box-shadow: -26px 0 70px rgba(0,0,0,.42);
        transform: translateX(105%);
        transition: transform .22s var(--ease);
    }
    .flow-studio.has-inspector .flow-inspector { transform: translateX(0); }
}
@media (max-width: 620px) {
    .runtime-studio { border-radius:18px; }
    .runtime-studio-hero { min-height:0; padding:18px 16px; align-items:stretch; flex-direction:column; }
    .runtime-studio-hero h2,.runtime-studio-hero p { max-width:none; }
    .runtime-target { width:100%; min-width:0; }
    .runtime-studio-grid { padding:12px; }
    .runtime-control-panel { padding:16px; }
    .runtime-number-grid { grid-template-columns:1fr; }
    .runtime-prompt-actions,.runtime-save-bar { align-items:stretch; flex-direction:column; }
    .runtime-save-bar > div:last-child { display:grid; grid-template-columns:1fr 1fr; width:100%; }
}

/* Book tracker is a focused service console. */
.books-service-console {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 26px;
    background: var(--surface-1);
    box-shadow: var(--shadow-lg);
}
.books-service-topline { padding: 18px 28px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: var(--chrome); }
.back-service-button { min-height: 36px; padding: 6px 12px; color: var(--ink-muted); border: 1px solid var(--line); border-radius: 10px; background: transparent; }
.back-service-button:hover { color: var(--diane); border-color: rgba(124,140,255,.3); }
.books-service-hero { min-height: 170px; padding: clamp(26px,4vw,48px); background: radial-gradient(circle at 80% 0,rgba(124,140,255,.1),transparent 34%); }
.books-service-hero h3 { margin: 0 0 9px; font-size: clamp(1.5rem,2.8vw,2.4rem); }
.books-operations { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(260px,.6fr); border-block: 1px solid var(--line); background: var(--surface-input); }
.books-operations .books-summary { min-height: 110px; padding: 20px 28px; border: 0; }
.books-operations .books-sync-panel { margin: 0; padding: 20px 24px; border: 0; border-inline-start: 1px solid var(--line); border-radius: 0; background: var(--chrome); }
.books-add-bar { margin: 26px 28px 10px; padding: 7px; display: flex; gap: 8px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface-input); }
.books-add-bar input { flex: 1; border: 0; background: transparent; }
.books-settings-bar { margin: 0 28px 22px; padding: 12px 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--ink-muted); border-bottom: 1px solid var(--line); }
.books-settings-bar input { width: 92px; }
.books-settings-bar .books-filter { margin-inline-start: auto; }
.books-service-console > .books-grid { padding: 0 28px 30px; }

/* News and learning use focused work surfaces. */
.news-console,
.learning-studio {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--surface-1);
    box-shadow: none;
}
.news-console-head,
.learning-studio-head { min-height: 130px; padding: 26px 30px; border-bottom: 1px solid var(--line); background: radial-gradient(circle at 85% 0,rgba(124,140,255,.08),transparent 34%); }
.news-console-head h3,
.learning-studio-head h3 { margin: 6px 0; font-size: 1.4rem; }
.news-console .news-add-bar { margin: 22px 28px 12px; padding: 7px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface-input); }
.news-console .news-add-bar input { border: 0; background: transparent; }
.news-console .news-channels-list { padding: 8px 28px 28px; }
.learning-studio-head .language-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#language-code-input { width: 110px; direction: ltr; }
.learning-studio > .books-summary { margin: 0; padding: 18px 28px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: var(--surface-input); }
.learning-studio .learning-grid { padding: 24px 28px 28px; background: transparent; }
.learning-studio .learning-panel { min-height: 240px; padding: 22px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface-input); }

/* News is a source library: every channel owns its own visual and action boundary. */
.news-console {
    background:
        radial-gradient(circle at 86% -8%, rgba(67, 170, 255, .1), transparent 30%),
        var(--surface-1);
}
.news-console-head {
    min-height: 184px;
    align-items: center;
    gap: 28px;
}
.news-console-title { max-width: 680px; }
.news-console-title h3 { margin: 8px 0 10px; font-size: clamp(1.6rem, 3vw, 2.5rem); }
.news-console-title p { margin: 0; max-width: 620px; color: var(--ink-muted); line-height: 1.75; }
.news-head-actions { margin-inline-start: auto; display: grid; justify-items: end; gap: 10px; }
.news-source-overview {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-bottom: 1px solid var(--line);
    background: rgba(5, 12, 22, .48);
}
.news-source-overview > div {
    min-height: 96px;
    padding: 20px 28px;
    display: grid;
    align-content: center;
    gap: 5px;
    border-inline-end: 1px solid var(--line);
}
.news-source-overview > div:last-child { border-inline-end: 0; }
.news-source-overview span { color: #d9efff; font: 550 1.2rem/1.1 var(--font-ui); }
.news-source-overview small { color: var(--ink-faint); font-size: .72rem; }
.news-add-source {
    margin: 28px;
    padding: 22px;
    display: grid;
    grid-template-columns: minmax(190px, .45fr) minmax(0, 1fr);
    align-items: end;
    gap: 28px;
    border: 1px solid rgba(91, 176, 238, .14);
    border-radius: 20px;
    background: linear-gradient(145deg, rgba(18, 34, 55, .72), rgba(9, 19, 33, .76));
}
.news-add-source h4,
.news-source-library h4 { margin: 6px 0; font-size: 1.08rem; }
.news-add-source p { margin: 0; color: var(--ink-muted); font-size: .78rem; line-height: 1.6; }
.news-console .news-add-bar {
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: minmax(150px, .8fr) minmax(210px, 1.2fr) auto;
    align-items: end;
    gap: 10px;
    border: 0;
    background: transparent;
}
.news-add-bar label { display: grid; gap: 7px; color: var(--ink-faint); font-size: .68rem; }
.news-console .news-add-bar input {
    min-height: 46px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(4, 10, 18, .58);
}
.news-console .news-add-bar button { min-height: 46px; border-radius: 12px; }
.news-source-library { padding: 4px 28px 30px; }
.news-library-heading {
    padding: 8px 0 16px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
}
.news-library-heading small { color: var(--ink-faint); }
.news-console .news-channels-list { padding: 0; display: grid; gap: 10px; }
.content-wikipedia-card {
    margin: 0 28px 30px;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
    border-radius: 20px;
    background:
        radial-gradient(circle at 8% 0, color-mix(in srgb, var(--accent) 12%, transparent), transparent 34%),
        var(--surface-input);
}
.content-wikipedia-head {
    min-height: 128px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 24px;
    border-bottom: 1px solid var(--line);
}
.content-wikipedia-head > div:first-child { max-width: 660px; }
.content-wikipedia-head h4 { margin: 6px 0; font-size: 1.25rem; }
.content-wikipedia-head p,
.content-wikipedia-footer p { margin: 0; color: var(--ink-muted); line-height: 1.65; }
.content-wikipedia-state {
    margin-inline-start: auto;
    display: grid;
    justify-items: end;
    gap: 10px;
}
#wikipedia-daily-status[data-state="success"] { color: var(--success); }
#wikipedia-daily-status[data-state="error"] { color: var(--danger); }
#wikipedia-daily-status[data-state="loading"] { color: var(--accent); }
.content-wikipedia-card .wikipedia-settings {
    padding: 22px 24px;
    display: grid;
    grid-template-columns: minmax(180px, 1.3fr) minmax(140px, .7fr) minmax(190px, 1fr);
    gap: 16px;
}
.content-wikipedia-card .wikipedia-settings > label:not(.wikipedia-toggle) {
    min-width: 0;
    display: grid;
    align-content: start;
    gap: 8px;
    color: var(--ink);
    font-size: .78rem;
    font-weight: 700;
}
.content-wikipedia-card .wikipedia-settings select,
.content-wikipedia-card .wikipedia-settings input[type="number"],
.content-wikipedia-card .wikipedia-settings input[type="time"] {
    width: 100%;
    min-height: 44px;
}
.content-wikipedia-card .wikipedia-settings small {
    color: var(--ink-faint);
    font-size: .7rem;
    font-weight: 500;
    line-height: 1.5;
}
.content-wikipedia-card .wikipedia-toggle {
    grid-column: 1 / -1;
    min-height: 70px;
    padding: 15px 17px;
    display: flex;
    align-items: center;
    gap: 13px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-1);
    cursor: pointer;
}
.content-wikipedia-card .wikipedia-toggle input { width: 20px; height: 20px; accent-color: var(--accent); }
.content-wikipedia-card .wikipedia-toggle > span { display: grid; gap: 3px; }
.content-wikipedia-footer {
    padding: 0 24px 24px;
    display: flex;
    align-items: center;
    gap: 22px;
}
.content-wikipedia-footer p { max-width: 720px; font-size: .75rem; }
.content-wikipedia-footer button { margin-inline-start: auto; flex: 0 0 auto; }
.news-source-card {
    min-height: 126px;
    padding: 18px 20px;
    display: grid;
    grid-template-columns: 44px minmax(230px, .9fr) minmax(200px, 1fr) auto;
    align-items: center;
    gap: 18px;
    border: 1px solid rgba(105, 164, 218, .12);
    border-radius: 18px;
    background:
        linear-gradient(100deg, rgba(24, 56, 91, .15), transparent 42%),
        rgba(6, 14, 25, .66);
    transition: transform .22s ease, border-color .22s ease, background .22s ease;
}
.news-source-card:hover {
    transform: translateY(-2px);
    border-color: rgba(73, 193, 255, .27);
    background:
        linear-gradient(100deg, rgba(31, 95, 149, .2), rgba(100, 72, 186, .07) 70%),
        rgba(7, 16, 28, .82);
}
.news-source-index { color: #425870; font: 500 .68rem/1 var(--font-mono); }
.news-source-identity { min-width: 0; display: flex; align-items: center; gap: 13px; }
.news-source-mark {
    width: 48px;
    height: 48px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border: 1px solid rgba(86, 190, 255, .2);
    border-radius: 15px;
    background: linear-gradient(145deg, rgba(54, 173, 244, .2), rgba(115, 82, 218, .12));
    color: #bfeaff;
    font-size: 1rem;
}
.news-source-network { display: inline-flex; align-items: center; gap: 6px; color: #668099; font-size: .62rem; text-transform: uppercase; }
.news-source-network i { width: 5px; height: 5px; border-radius: 50%; background: #4bc8ff; box-shadow: 0 0 10px rgba(75, 200, 255, .55); }
.news-source-identity h5 { margin: 4px 0 3px; color: #e4f2ff; font-size: .92rem; }
.news-channel-ref { color: #6e89a3; font: 400 .7rem/1.3 var(--font-mono); direction: ltr; unicode-bidi: plaintext; }
.news-source-state { display: grid; gap: 5px; }
.news-source-state span { color: #a9bed2; font-size: .78rem; }
.news-source-state small { max-width: 360px; color: #566d84; font-size: .66rem; line-height: 1.55; }
.news-source-actions { display: flex; align-items: center; gap: 8px; }
.news-source-actions a,
.news-source-actions button { min-height: 34px; padding: 0 11px; display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 9px; background: transparent; color: #829bb4; font-size: .68rem; }
.news-source-actions a:hover { border-color: rgba(73, 193, 255, .3); color: #bdeaff; }
.news-source-empty {
    min-height: 150px;
    padding: 28px;
    display: flex;
    align-items: center;
    gap: 18px;
    border: 1px dashed rgba(99, 161, 217, .18);
    border-radius: 18px;
    color: var(--ink-muted);
}
.news-source-empty > span { color: #3d5369; font: 500 .7rem/1 var(--font-mono); }
.news-source-empty strong { color: #b4c7d9; }
.news-source-empty p { margin: 5px 0 0; font-size: .76rem; }

/* News v2 — compact source management. */
.news-console { border-radius: 16px; background: var(--surface-1); }
.news-console-head { min-height: 82px; padding: 15px 18px; gap: 16px; background: transparent; }
.news-console-title h3 { margin: 0 0 3px; font-size: 1.12rem; }
.news-console-title p { font-size: .75rem; line-height: 1.45; }
.news-head-actions { display: flex; align-items: center; gap: 9px; }
.news-source-overview { grid-template-columns: repeat(2,minmax(0,1fr)); padding: 10px 12px; gap: 8px; background: transparent; }
.news-source-overview > div { min-height: 54px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-input); }
.news-source-overview > div:last-child { border-inline-end: 1px solid var(--line); }
.news-source-overview span { color: var(--ink); font-size: .95rem; }
.news-add-source { margin: 16px 18px; padding: 15px; grid-template-columns: 150px minmax(0,1fr); gap: 16px; border-color: var(--line); border-radius: 14px; background: var(--surface-input); }
.news-add-source h4,
.news-source-library h4 { margin: 0; font-size: .92rem; }
.news-console .news-add-bar input { min-height: 40px; color: var(--ink); background: var(--surface-1); }
.news-console .news-add-bar button { min-height: 40px; border-radius: 10px; }
.news-source-library { padding: 2px 18px 20px; }
.news-library-heading { padding: 5px 0 11px; }
.news-source-card { min-height: 94px; padding: 13px 15px; grid-template-columns: 32px minmax(200px,.9fr) minmax(180px,1fr) auto; gap: 13px; border-color: var(--line); border-radius: 13px; background: var(--surface-input); }
.news-source-card:hover { transform: none; border-color: rgba(73,193,255,.27); background: var(--surface-2); }
.news-source-mark { width: 40px; height: 40px; border-radius: 11px; }
.news-source-identity h5 { color: var(--ink); }
.news-source-state span { color: var(--ink-2); }
.news-source-state small,
.news-channel-ref { color: var(--ink-3); }
.content-wikipedia-card { margin: 0 18px 20px; border-radius: 14px; background: var(--surface-input); }
.content-wikipedia-head { min-height: 82px; padding: 15px 18px; gap: 16px; }
.content-wikipedia-head h4 { margin: 0 0 3px; font-size: .95rem; }
.content-wikipedia-head p { font-size: .74rem; }
.content-wikipedia-card .wikipedia-settings { padding: 16px 18px; gap: 12px; }
.content-wikipedia-card .wikipedia-toggle { min-height: 58px; padding: 11px 13px; border-radius: 11px; }
.content-wikipedia-footer { padding: 0 18px 16px; gap: 14px; }

@media (max-width: 760px) {
    .news-console-head { padding: 14px; }
    .news-head-actions { width: 100%; justify-content: space-between; }
    .news-source-overview { grid-template-columns: 1fr 1fr; padding: 8px; }
    .news-add-source { margin: 12px; padding: 13px; grid-template-columns: 1fr; }
    .news-source-library { padding: 2px 12px 15px; }
    .news-source-card { grid-template-columns: 28px minmax(0,1fr); }
    .news-source-state,
    .news-source-actions { grid-column: 2; }
    .news-source-actions { flex-wrap: wrap; }
    .content-wikipedia-card { margin: 0 12px 15px; }
    .content-wikipedia-head { padding: 14px; align-items: flex-start; flex-direction: column; }
    .content-wikipedia-state { width: 100%; margin-inline-start: 0; display: flex; align-items: center; justify-content: space-between; }
    .content-wikipedia-card .wikipedia-settings { padding: 14px; grid-template-columns: 1fr; }
    .content-wikipedia-card .wikipedia-toggle { grid-column: auto; }
    .content-wikipedia-footer { padding: 0 14px 14px; align-items: stretch; flex-direction: column; }
    .content-wikipedia-footer button { width: 100%; margin-inline-start: 0; }
}

/* Language Studio is a progression workspace, not a pair of generic cards. */
.learning-studio {
    background:
        radial-gradient(circle at 84% -6%, rgba(104, 83, 230, .12), transparent 27%),
        radial-gradient(circle at 18% 0, rgba(49, 166, 242, .08), transparent 24%),
        var(--surface-1);
}
.learning-studio-head {
    min-height: 210px;
    align-items: flex-end;
    gap: 30px;
}
.learning-hero-copy { max-width: 720px; }
.learning-hero-copy h3 { margin: 8px 0 11px; font-size: clamp(1.8rem, 3.4vw, 2.8rem); }
.learning-hero-copy p { margin: 0; max-width: 650px; color: var(--ink-muted); line-height: 1.75; }
.learning-hero-actions { margin-inline-start: auto; display: grid; justify-items: end; gap: 10px; }
.language-picker-zone { padding: 26px 30px; border-bottom: 1px solid var(--line); background: rgba(6, 14, 25, .4); }
.language-picker-head,
.learning-section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.language-picker-head h4,
.learning-section-heading h4 { margin: 6px 0 0; font-size: 1.12rem; }
.language-choice-grid { margin-top: 18px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.language-choice {
    min-height: 110px;
    padding: 16px;
    display: grid;
    align-content: center;
    justify-items: start;
    gap: 4px;
    border: 1px solid rgba(101, 159, 211, .12);
    border-radius: 17px;
    background: rgba(5, 12, 22, .62);
    text-align: start;
    transition: transform .2s ease, border-color .2s ease, background .2s ease;
}
.language-choice:hover { transform: translateY(-2px); border-color: rgba(77, 190, 255, .25); }
.language-choice.active {
    border-color: rgba(89, 191, 255, .36);
    background: linear-gradient(145deg, rgba(42, 133, 203, .19), rgba(104, 73, 205, .12));
    box-shadow: inset 0 0 0 1px rgba(123, 101, 235, .07);
}
.language-choice > span { color: #bfe8ff; font: 500 1.25rem/1.2 var(--font-ui); direction: ltr; }
.language-choice > b { color: #dcebf8; font-size: .84rem; }
.language-choice > small { color: #587087; font-size: .65rem; }
.language-mode-controls { margin-top: 13px; display: grid; grid-template-columns: .75fr 1.25fr; gap: 10px; }
.language-toggle-row {
    min-height: 82px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: rgba(7, 16, 28, .7);
    cursor: pointer;
}
.language-toggle-row > span { flex: 1; display: grid; gap: 4px; }
.language-toggle-row b { color: #bcd0e2; font-size: .76rem; }
.language-toggle-row small { color: #526a81; font-size: .64rem; line-height: 1.45; }
.language-toggle-row input { position: absolute; opacity: 0; pointer-events: none; }
.language-toggle-row > i {
    width: 43px;
    height: 24px;
    flex: 0 0 auto;
    position: relative;
    border: 1px solid #2e4258;
    border-radius: 999px;
    background: #101c2b;
    transition: .2s ease;
}
.language-toggle-row > i::after {
    content: "";
    width: 16px;
    height: 16px;
    position: absolute;
    inset: 3px auto 3px 4px;
    border-radius: 50%;
    background: #60758b;
    transition: .2s ease;
}
.language-toggle-row input:checked + i { border-color: rgba(77, 191, 255, .5); background: rgba(43, 143, 216, .28); }
.language-toggle-row input:checked + i::after { transform: translateX(18px); background: #65d1ff; box-shadow: 0 0 12px rgba(101, 209, 255, .5); }
.language-mode-picker { padding: 6px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; border: 1px solid var(--line); border-radius: 15px; background: rgba(7, 16, 28, .7); }
.language-mode-picker button { padding: 11px 13px; display: grid; justify-items: start; gap: 4px; border: 1px solid transparent; border-radius: 11px; background: transparent; text-align: start; }
.language-mode-picker button.active { border-color: rgba(117, 98, 228, .25); background: linear-gradient(145deg, rgba(51, 137, 204, .14), rgba(105, 75, 205, .12)); }
.language-mode-picker b { color: #9fb5ca; font-size: .73rem; }
.language-mode-picker button.active b { color: #d6e9f8; }
.language-mode-picker small { color: #50667c; font-size: .62rem; line-height: 1.4; }
.language-processing-settings { margin-top: 12px; padding: 18px; display: grid; gap: 15px; border: 1px solid rgba(92, 160, 219, .13); border-radius: 17px; background: rgba(4, 12, 22, .58); }
.language-processing-settings > header { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.language-processing-settings h5 { margin: 5px 0 0; color: #c8dbea; font-size: .9rem; }
.language-processing-settings .status-text { padding: 0; color: #668299; font-size: .61rem; }
.language-processing-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.language-processing-grid > label { min-width: 0; display: grid; align-content: start; gap: 7px; color: #718aa1; font-size: .64rem; }
.language-processing-grid select { width: 100%; min-width: 0; min-height: 43px; color: #bfd1df; border: 1px solid #19364d; border-radius: 11px; background: #050e19; }
.language-processing-grid small { color: #536c82; font-size: .58rem; line-height: 1.5; }
.language-save-preference { grid-column: 1 / -1; min-height: 66px; padding: 12px 14px; display: flex !important; align-items: center; gap: 12px !important; border: 1px solid #142e43; border-radius: 12px; background: rgba(7,17,29,.7); }
.language-save-preference input { width: 18px; height: 18px; accent-color: #50caff; }
.language-save-preference > span { display: grid; gap: 4px; }
.language-save-preference b { color: #acc1d2; font-size: .68rem; }
.language-mode-impact { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); border: 1px solid #142d42; border-radius: 13px; overflow: hidden; }
.language-mode-impact > div { min-height: 66px; padding: 12px 14px; display: grid; align-content: center; gap: 5px; border-inline-end: 1px solid #142d42; }
.language-mode-impact > div:last-child { border-inline-end: 0; }
.language-mode-impact span { color: #526c82; font-size: .56rem; }
.language-mode-impact strong { color: #a9c1d3; font-size: .65rem; font-weight: 600; line-height: 1.45; }
.learning-command-deck {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(260px, .6fr);
    border-bottom: 1px solid var(--line);
}
.learning-progress-hero { min-height: 250px; padding: 30px; display: flex; align-items: center; gap: 28px; }
.learning-progress-orbit { width: 152px; height: 152px; flex: 0 0 auto; display: grid; place-items: center; position: relative; }
.learning-progress-orbit svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.learning-progress-orbit circle { fill: none; stroke: rgba(90, 133, 173, .12); stroke-width: 7; }
.learning-progress-orbit circle.is-progress { stroke: url("#none"); stroke: #52c9ff; stroke-linecap: round; filter: drop-shadow(0 0 8px rgba(82, 201, 255, .35)); transition: stroke-dashoffset .8s ease; }
.learning-progress-orbit > div { position: absolute; display: grid; justify-items: center; gap: 4px; }
.learning-progress-orbit strong { color: #e2f4ff; font-size: 1.65rem; }
.learning-progress-orbit small { color: #597086; font-size: .6rem; }
.learning-progress-copy h4 { margin: 7px 0 9px; color: #e5f2fc; font-size: 1.35rem; }
.learning-progress-copy p { margin: 0 0 17px; max-width: 520px; color: #698198; line-height: 1.65; }
.learning-progress-copy button { min-height: 42px; border: 0; border-radius: 12px; background: linear-gradient(145deg, #48c6ff, #397fd0 60%, #705ce0); color: #fff; box-shadow: 0 10px 30px rgba(49, 147, 223, .2); }
.duolingo-reference { padding: 26px; display: grid; align-content: center; gap: 13px; border-inline-start: 1px solid var(--line); background: rgba(7, 14, 25, .62); }
.duolingo-reference > div { display: flex; align-items: flex-end; gap: 10px; }
.duolingo-reference strong { color: #d8eeff; font: 550 2.4rem/1 var(--font-ui); }
.duolingo-reference small { max-width: 90px; color: #678097; font-size: .65rem; }
.duolingo-reference p { margin: 0; color: #597086; font-size: .7rem; line-height: 1.6; }
.integration-state-manual { display: inline-flex; align-items: center; gap: 7px; color: #7f91a5; font-size: .63rem; }
.integration-state-manual i { width: 6px; height: 6px; border-radius: 50%; background: #e6a957; box-shadow: 0 0 9px rgba(230, 169, 87, .4); }
.duolingo-data-link { min-height: 42px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; justify-self: stretch; border-radius: 12px; background: linear-gradient(145deg, #48c6ff, #397fd0 60%, #705ce0); color: #fff; font-size: .78rem; font-weight: 600; text-decoration: none; box-shadow: 0 10px 30px rgba(49, 147, 223, .2); box-sizing: border-box; }
.duolingo-data-link:hover { filter: brightness(1.08); color: #fff; }
.duolingo-data-link:focus-visible { outline: 2px solid #48c6ff; outline-offset: 2px; }
.language-learning-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line); background: rgba(5, 12, 22, .55); }
.language-learning-summary > div { min-height: 105px; padding: 20px 24px; display: grid; align-content: center; gap: 6px; border-inline-end: 1px solid var(--line); }
.language-learning-summary > div:last-child { border-inline-end: 0; }
.language-learning-summary span { color: #d8ecfb; font-size: 1.35rem; }
.language-learning-summary small { color: #587087; font-size: .65rem; }
.language-learning-summary i { width: 100%; height: 2px; position: relative; overflow: hidden; border-radius: 99px; background: #152538; }
.language-learning-summary i::after { content: ""; width: var(--metric, 0%); height: 100%; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(90deg, #45c7ff, #7765e3); transition: width .7s ease; }
.learning-path-section { padding: 30px; border-bottom: 1px solid var(--line); }
.learning-section-heading small { color: #536a81; font-size: .67rem; }
.language-learning-path { margin-top: 19px; display: grid; grid-template-columns: repeat(6, minmax(150px, 1fr)); gap: 7px; overflow-x: auto; padding-bottom: 5px; }
.language-path-stage {
    min-height: 156px;
    padding: 15px;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 10px;
    border: 1px solid rgba(97, 150, 198, .11);
    border-radius: 16px;
    background: rgba(6, 14, 24, .62);
}
.language-path-stage > span { color: #3d5269; font: 500 .65rem/1 var(--font-mono); }
.language-path-stage small { color: #526a81; font-size: .58rem; text-transform: uppercase; }
.language-path-stage h5 { margin: 4px 0 5px; color: #899fb5; font-size: .73rem; }
.language-path-stage p { margin: 0; color: #4f657a; font-size: .61rem; line-height: 1.45; }
.language-path-stage > i { width: 8px; height: 8px; border: 1px solid #31465c; border-radius: 50%; }
.language-path-stage.completed > i { border-color: #45c8ff; background: #45c8ff; }
.language-path-stage.current { border-color: rgba(84, 194, 255, .3); background: linear-gradient(145deg, rgba(37, 117, 183, .17), rgba(100, 72, 193, .1)); }
.language-path-stage.current h5 { color: #d3e8f7; }
.language-path-stage.current > i { border-color: #9078f4; background: #9078f4; box-shadow: 0 0 12px rgba(144, 120, 244, .5); animation: chat-step-live 1.3s ease-in-out infinite; }
.learning-studio .learning-grid { padding: 30px; display: grid; grid-template-columns: 1.15fr .85fr; gap: 12px; }
.learning-studio .learning-panel { min-height: 360px; padding: 0; overflow: hidden; border-radius: 20px; background: rgba(6, 14, 24, .68); }
.learning-panel-head { min-height: 82px; padding: 17px 20px; display: flex; align-items: center; gap: 13px; border-bottom: 1px solid var(--line); }
.learning-panel-head > span { color: #40566d; font: 500 .65rem/1 var(--font-mono); }
.learning-panel-head small { color: #536b82; font-size: .59rem; text-transform: uppercase; }
.learning-panel-head h4 { margin: 3px 0 0; color: #c3d8e8; font-size: .9rem; }
.learning-card-body { padding: 20px; }
.learning-today-panel .learning-card-body { display: grid; grid-template-columns: minmax(150px, .7fr) minmax(200px, 1.3fr); gap: 22px; }
.learning-word-stage { min-height: 190px; display: grid; place-content: center; justify-items: center; border: 1px solid rgba(80, 187, 250, .14); border-radius: 17px; background: radial-gradient(circle, rgba(58, 159, 226, .13), transparent 66%); }
.learning-word-stage .learning-token { color: #eff8ff; font-size: 2.35rem; line-height: 1.15; }
.learning-word-stage .learning-reading { color: #79bfe6; font: 400 .78rem/1.2 var(--font-mono); }
.learning-word-stage small { margin-top: 11px; color: #536b82; font-size: .6rem; }
.learning-word-context { display: grid; align-content: center; gap: 7px; }
.learning-word-context > span { color: #4f687e; font-size: .6rem; text-transform: uppercase; }
.learning-word-context strong { margin-bottom: 12px; color: #c7dbea; font-size: 1rem; }
.learning-word-context p { margin: 0; color: #93aabd; line-height: 1.75; direction: ltr; text-align: left; }
.learning-today-panel .learning-actions { grid-column: 1 / -1; padding-top: 14px; border-top: 1px solid var(--line); }
.learning-actions button { min-height: 36px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: #8199b0; font-size: .68rem; }
.learning-actions button:last-child { margin-inline-start: auto; border-color: rgba(92, 190, 255, .25); background: rgba(47, 133, 199, .13); color: #bce7ff; }
.learning-review-row { min-height: 58px; padding: 10px 0; display: grid; grid-template-columns: minmax(100px, 1fr) 1fr 74px 34px; align-items: center; gap: 10px; border-bottom: 1px solid rgba(94, 140, 181, .08); }
.learning-review-row > div { display: grid; }
.learning-review-row b { color: #c7dae9; font-size: .8rem; }
.learning-review-row span,
.learning-review-row small { color: #5e758c; font-size: .62rem; }
.learning-review-row > i { height: 3px; overflow: hidden; border-radius: 99px; background: #142437; }
.learning-review-row > i span { height: 100%; display: block; border-radius: inherit; background: linear-gradient(90deg, #49c8ff, #806ae8); }
.learning-review-row em { color: #5c738a; font: normal .6rem/1 var(--font-mono); }
.learning-empty-state { min-height: 190px; display: grid; place-content: center; justify-items: center; text-align: center; }
.learning-empty-state strong { color: #9fb5c9; }
.learning-empty-state p { max-width: 330px; color: #586f85; font-size: .7rem; line-height: 1.6; }
.learning-empty-state button { min-height: 38px; border-radius: 10px; }

.service-card,
.book-card,
.tool-card {
    padding: 18px;
    transition: var(--transition);
}

.service-card:hover,
.book-card:hover,
.tool-card:hover {
    transform: translateY(-2px);
    background: var(--surface-2);
}

.books-header,
.tools-toolbar,
.books-controls,
.news-add-bar,
.learning-actions,
.log-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.log-trace {
    margin-bottom: 8px;
    overflow: hidden;
    border-radius: var(--r-2);
    background: var(--surface-1);
}

.log-trace-head,
.log-step-head {
    padding: 11px 14px;
    display: flex;
    align-items: center;
    gap: 9px;
}

.log-trace-head {
    background: var(--surface-2);
}

.log-step-body {
    margin: 0 14px 10px;
    padding: 12px;
    border-radius: var(--r-1);
    background: var(--surface-input);
    white-space: pre-wrap;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px 8px;
    border-bottom: 1px solid var(--line);
    text-align: start;
}

th {
    color: var(--ink-3);
    font-size: 10px;
    letter-spacing: .08em;
}

/* Animations */
@keyframes page-enter { from { opacity: 0; transform: translateY(10px); } }
@keyframes float { 50% { transform: translateY(-8px); } }
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 currentColor; } 70%,100% { box-shadow: 0 0 0 8px transparent; } }
@keyframes shimmer { to { background-position: -220% 0; } }
@keyframes presence { 50% { transform: scale(1.25); filter: brightness(1.3); } }
@keyframes orb { 50% { transform: scale(1.1); filter: hue-rotate(16deg); } }
@keyframes rotate { to { transform: rotate(360deg); } }
@keyframes message-enter { from { opacity: 0; transform: translateY(8px); } }

/* Dashboard cockpit — operational home, not a marketing landing page */
#page-dashboard {
    width: min(100%, 1320px);
    padding-top: 34px;
}

.tool-identity-mark {
    position: absolute;
    right: 14px;
    top: 14px;
    width: 36px;
    height: 36px;
    border: 1px solid color-mix(in srgb, var(--tool-accent) 34%, transparent);
    border-radius: 11px;
    background: color-mix(in srgb, var(--tool-accent) 9%, transparent);
    display: grid;
    place-items: center;
}

.tool-identity-mark svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: var(--tool-accent);
    stroke-width: 1.7;
}

.tool-identity-mark b {
    position: absolute;
    left: -4px;
    bottom: -4px;
    border: 2px solid var(--surface-input);
    border-radius: 5px;
    padding: 2px 3px;
    background: color-mix(in srgb, var(--tool-accent) 18%, #06101d);
    color: var(--tool-accent);
    font: 600 6px/1 var(--font-mono);
}

.dashboard-masthead {
    min-height: 126px;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface-1);
    box-shadow: 0 10px 28px rgba(0,0,0,.1);
}

.dashboard-masthead::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(90deg, var(--violet-soft), transparent 32%);
    opacity: .45;
}

.dashboard-date-line {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px;
    color: var(--ink-3);
    font-size: 10px;
}

.dashboard-date-separator {
    color: var(--line-strong);
}

.dashboard-date-line i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--diane);
    box-shadow: 0 0 14px rgba(124,140,255,.65);
}

.dashboard-sync-control {
    width: 34px;
    min-width: 34px;
    min-height: 34px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 50%;
    background: rgba(255,255,255,.035);
    color: var(--ink-3);
}

.dashboard-sync-control:hover {
    background: rgba(124,140,255,.08);
    color: var(--diane);
    transform: none;
}

.dashboard-sync-control svg {
    width: 13px;
    height: 13px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.dashboard-sync-control.is-refreshing svg {
    animation: rotate .7s linear infinite;
}

.dashboard-masthead h2 {
    max-width: 820px;
    margin: 0;
    font-size: clamp(25px,2.4vw,32px);
    font-weight: 620;
    line-height: 1.08;
    letter-spacing: -.04em;
}

.dashboard-masthead-copy,
.dashboard-masthead-meta {
    position: relative;
    z-index: 2;
}

.dashboard-masthead-copy {
    flex: 1 1 auto;
    min-width: 0;
}

.dashboard-masthead p {
    max-width: 760px;
    margin: 9px 0 0;
    color: var(--ink-2);
    font-size: 13px;
    line-height: 1.5;
}

.dashboard-masthead-meta {
    min-width: 0;
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--ink-3);
    font: 500 9px/1.5 "JetBrains Mono", monospace;
    text-align: start;
}

.dashboard-masthead-meta span {
    padding-inline-end: 10px;
    border-inline-end: 1px solid var(--line);
}

.dashboard-diane-presence {
    width: 58px;
    height: 58px;
    flex: 0 0 auto;
    position: relative;
    z-index: 1;
    object-fit: contain;
    filter: drop-shadow(0 8px 14px rgba(98,65,205,.2));
}

.dashboard-action-rail {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(4,minmax(0,1fr));
    gap: 8px;
}

.dashboard-action-rail button {
    min-width: 0;
    min-height: 48px;
    padding: 10px 13px;
    display: grid;
    grid-template-columns: 20px minmax(0,1fr);
    align-items: center;
    gap: 9px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-1);
    text-align: start;
    overflow: hidden;
    position: relative;
}

.dashboard-action-rail button:hover {
    border-color: var(--violet-line);
    background: var(--violet-soft);
    transform: translateY(-1px);
}

.dashboard-action-rail svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: var(--diane);
    stroke-width: 1.5;
}

.dashboard-action-rail strong {
    overflow: hidden;
    color: var(--ink);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-priority-grid {
    margin-top: 12px;
    display: grid;
    grid-template-columns: minmax(0,1.15fr) minmax(0,.85fr);
    border-bottom: 1px solid var(--line);
}

.dashboard-priority,
.dashboard-day {
    min-width: 0;
    min-height: 280px;
    padding: 24px;
}

.dashboard-priority {
    border-inline-end: 1px solid var(--line);
    background:
        radial-gradient(circle at 8% 0, rgba(139,124,255,.075), transparent 32%),
        linear-gradient(135deg,rgba(124,140,255,.025),transparent 54%);
}

.dashboard-section-head,
.dashboard-telemetry-head {
    min-height: 42px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.dashboard-section-head > div,
.dashboard-telemetry-head > div {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.dashboard-section-head h3,
.dashboard-telemetry-head h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.dashboard-section-head > small {
    color: var(--ink-3);
    font-size: 9px;
}

.dashboard-priority-body,
.dashboard-day-body {
    margin-top: 18px;
}

.dashboard-day-meta {
    display: flex;
    align-items: center;
    gap: 9px;
}

.dashboard-day-meta time {
    color: var(--diane);
    font: 600 10px/1 "JetBrains Mono", monospace;
    direction: ltr;
}

.dashboard-priority .dashboard-attention-row {
    position: relative;
    min-height: 84px;
    padding: 15px 0;
    grid-template-columns: 9px minmax(0,1fr) 22px;
    border-bottom: 1px solid rgba(255,255,255,.055);
    border-radius: 0;
    background: transparent;
    isolation: isolate;
    overflow: hidden;
}

.dashboard-priority .dashboard-attention-row::before {
    content: "";
    position: absolute;
    inset: 10px -1px 10px auto;
    z-index: -1;
    width: 2px;
    border-radius: 2px;
    background: var(--diane);
    opacity: 0;
    transform: scaleY(.2);
    transition: opacity var(--fast) ease, transform var(--normal) var(--ease);
}

.dashboard-priority .dashboard-attention-row[data-tone="bad"]::before { background: var(--bad); }
.dashboard-priority .dashboard-attention-row[data-tone="wait"]::before { background: var(--wait); }
.dashboard-priority .dashboard-attention-row[data-tone="ok"]::before { background: var(--ok); }

.dashboard-priority .dashboard-attention-row[data-rank="1"]::before,
.dashboard-priority .dashboard-attention-row:hover::before,
.dashboard-priority .dashboard-attention-row:focus-visible::before {
    opacity: 1;
    transform: scaleY(1);
}

.dashboard-priority .dashboard-attention-row[data-rank="1"] {
    background: linear-gradient(90deg,rgba(124,140,255,.025),transparent 56%);
}

.dashboard-priority .dashboard-attention-row:last-child {
    border-bottom: 0;
}

.dashboard-priority .dashboard-attention-row:hover {
    padding-inline: 10px;
    background: rgba(255,255,255,.025);
}

.dashboard-priority .dashboard-attention-row strong {
    font-size: 14px;
}

.dashboard-priority .dashboard-attention-row small {
    margin-top: 6px;
    font-size: 10px;
    line-height: 1.55;
}

.dashboard-priority .dashboard-attention-row > i {
    display: grid;
    justify-items: end;
    gap: 5px;
}

.dashboard-priority .dashboard-attention-row > i small {
    color: var(--ink-3);
    font: 500 7px/1 "JetBrains Mono", monospace;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(4px);
    transition: opacity var(--fast) ease, transform var(--normal) var(--ease);
}

.dashboard-priority .dashboard-attention-row:hover > i small,
.dashboard-priority .dashboard-attention-row:focus-visible > i small {
    opacity: 1;
    transform: none;
}

.dashboard-attention-passive {
    color: var(--line-strong) !important;
}

.dashboard-day .dashboard-reminder-row {
    position: relative;
    min-height: 68px;
    padding: 11px 0;
    grid-template-columns: 28px minmax(0,1fr) auto;
    border-bottom: 1px solid rgba(255,255,255,.055);
}

.dashboard-day .dashboard-reminder-row::before {
    content: "";
    position: absolute;
    inset: 0 -28px 0 auto;
    width: 1px;
    background: var(--line);
}

.dashboard-day .dashboard-reminder-row::after {
    content: "";
    position: absolute;
    inset: 50% -31px auto auto;
    width: 7px;
    height: 7px;
    border: 2px solid var(--surface-1);
    border-radius: 50%;
    background: var(--line-strong);
    transform: translateY(-50%);
}

.dashboard-day .dashboard-reminder-row[data-state="soon"]::after {
    background: var(--diane);
    box-shadow: 0 0 14px rgba(124,140,255,.7);
    animation: presence 1.8s ease-in-out infinite;
}

.dashboard-day .dashboard-reminder-row[data-state="overdue"]::after {
    background: var(--bad);
    box-shadow: 0 0 12px rgba(242,118,112,.42);
}

.dashboard-day .dashboard-reminder-row[data-state="overdue"] time {
    color: var(--bad);
}

.dashboard-day .dashboard-reminder-index {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    display: grid;
    place-items: center;
    position: relative;
    color: var(--ink-3);
    font-size: 8px;
}

.dashboard-day .dashboard-reminder-index::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: conic-gradient(var(--diane) var(--reminder-urgency),rgba(255,255,255,.07) 0);
    opacity: .7;
    transform: rotate(-90deg);
}

.dashboard-reminder-row[data-urgency="low"] { --reminder-urgency: 35%; }
.dashboard-reminder-row[data-urgency="medium"] { --reminder-urgency: 66%; }
.dashboard-reminder-row[data-urgency="high"] { --reminder-urgency: 92%; }

.dashboard-day .dashboard-reminder-index i {
    position: absolute;
    inset: 2px;
    z-index: 1;
    border-radius: inherit;
    background: var(--surface-1);
}

.dashboard-day .dashboard-reminder-index b {
    position: relative;
    z-index: 2;
    font: inherit;
}

.dashboard-day .dashboard-reminder-row[data-state="soon"] .dashboard-reminder-index::before {
    filter: drop-shadow(0 0 5px rgba(124,140,255,.5));
    animation: reminder-dial-pulse 1.8s ease-in-out infinite;
}

.dashboard-day .dashboard-reminder-row[data-state="overdue"] .dashboard-reminder-index::before {
    background: conic-gradient(var(--bad) 100%,rgba(255,255,255,.07) 0);
}

.dashboard-reminder-when {
    min-width: 48px;
    display: grid;
    justify-items: end;
    gap: 5px;
}

.dashboard-reminder-when small {
    margin: 0 !important;
    color: var(--ink-3) !important;
    font: 500 7px/1 "JetBrains Mono", monospace !important;
    white-space: nowrap;
}

.dashboard-day .dashboard-reminder-row[data-state="soon"] .dashboard-reminder-when small {
    color: var(--diane) !important;
}

.dashboard-day .dashboard-reminder-row[data-state="overdue"] .dashboard-reminder-when small {
    color: var(--bad) !important;
}

@keyframes reminder-dial-pulse {
    0%, 100% { opacity: .62; transform: rotate(-90deg) scale(.96); }
    50% { opacity: 1; transform: rotate(-90deg) scale(1.04); }
}

.dashboard-telemetry {
    padding: 24px 24px 0;
    border-bottom: 1px solid var(--line);
}

.dashboard-telemetry > .stats-grid {
    margin-top: 18px;
    grid-template-columns: repeat(4,minmax(0,1fr));
    border: 1px solid var(--line);
    border-radius: 16px 16px 0 0;
    background: var(--line);
}

.dashboard-telemetry .stat-card {
    min-height: 108px;
    padding: 17px;
    background: var(--surface-input);
}

.dashboard-telemetry .dashboard-live-stat {
    --live-color: var(--diane);
    --live-progress: 8%;
    display: grid;
    grid-template-columns: minmax(0,1fr) 48px;
    align-items: center;
    gap: 14px;
    position: relative;
    overflow: hidden;
}

.dashboard-live-stat::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 1px;
    background: linear-gradient(90deg,transparent,var(--live-color),transparent);
    opacity: .22;
    transform: scaleX(.3);
    transition: transform 700ms var(--ease), opacity var(--normal) ease;
}

.dashboard-live-stat:hover::after {
    opacity: .58;
    transform: scaleX(1);
}

.dashboard-live-stat[data-state="ok"] { --live-color: var(--ok); }
.dashboard-live-stat[data-state="wait"] { --live-color: var(--wait); }
.dashboard-live-stat[data-state="bad"] { --live-color: var(--bad); }
.dashboard-live-stat[data-state="unknown"],
.dashboard-live-stat[data-state="idle"] { --live-color: var(--ink-3); }
.dashboard-live-stat[data-progress="low"] { --live-progress: 18%; }
.dashboard-live-stat[data-progress="mid"] { --live-progress: 58%; }
.dashboard-live-stat[data-progress="high"] { --live-progress: 84%; }
.dashboard-live-stat[data-progress="full"] { --live-progress: 100%; }

.dashboard-stat-orbit {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    position: relative;
    border-radius: 50%;
    background: conic-gradient(var(--live-color) var(--live-progress),rgba(255,255,255,.055) 0);
    box-shadow: 0 0 22px color-mix(in srgb,var(--live-color) 14%,transparent);
    transform: rotate(-90deg);
    transition: background 600ms var(--ease), box-shadow var(--normal) ease;
}

.dashboard-stat-orbit::before {
    content: "";
    position: absolute;
    inset: 3px;
    border-radius: inherit;
    background: var(--surface-input);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
}

.dashboard-stat-orbit i {
    width: 6px;
    height: 6px;
    position: relative;
    z-index: 1;
    border-radius: 50%;
    background: var(--live-color);
    box-shadow: 0 0 12px var(--live-color);
    animation: presence 2s ease-in-out infinite;
}

.dashboard-live-stat[data-state="unknown"] .dashboard-stat-orbit i,
.dashboard-live-stat[data-state="idle"] .dashboard-stat-orbit i {
    animation: none;
    box-shadow: none;
}

.dashboard-telemetry .stat-card:first-child {
    background: linear-gradient(135deg,rgba(124,140,255,.09),var(--surface-input) 64%);
}

.dashboard-telemetry .stat-value {
    margin-top: 8px;
    font-size: 23px;
}

.dashboard-telemetry-actions {
    display: flex;
    align-items: center;
    gap: 9px;
}
.dashboard-telemetry-actions .dashboard-inline-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.dashboard-telemetry-actions svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.5; }

.dashboard-telemetry > .dashboard-tile-grid {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.dashboard-tile-grid .dashboard-live-stat {
    min-width: 0;
    animation: dashboard-tile-in .32s var(--ease) both;
}
.dashboard-tile-code {
    position: absolute;
    inset: 13px auto auto 14px;
    color: color-mix(in srgb, var(--live-color) 68%, #506579);
    font: 600 .46rem/1 var(--font-mono);
    opacity: .64;
}

.dashboard-tile-dialog {
    width: min(760px, calc(100vw - 28px));
    max-height: min(820px, calc(100vh - 28px));
    padding: 0;
    overflow: hidden;
    color: var(--ink);
    border: 1px solid rgba(91, 147, 195, .22);
    border-radius: 23px;
    background: #07111d;
    box-shadow: 0 40px 120px rgba(0, 0, 0, .62);
}
.dashboard-tile-dialog::backdrop { background: rgba(1, 5, 10, .76); backdrop-filter: blur(8px); }
.dashboard-tile-dialog-shell { min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.dashboard-tile-dialog header {
    min-height: 126px;
    padding: 23px 25px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid rgba(91, 147, 195, .12);
    background: radial-gradient(circle at 82% 0, rgba(67, 174, 235, .1), transparent 36%);
}
.dashboard-tile-dialog h3 { margin: 6px 0 7px; color: #dcecf6; font-size: 1.35rem; }
.dashboard-tile-dialog header p { margin: 0; color: #5f788d; font-size: .58rem; }
.dashboard-tile-dialog-close {
    width: 31px;
    height: 31px;
    padding: 0;
    color: #718da1;
    border: 1px solid rgba(91, 147, 195, .14);
    border-radius: 9px;
    background: rgba(9, 21, 35, .72);
}
.dashboard-tile-editor {
    max-height: calc(100vh - 280px);
    padding: 13px 17px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}
.dashboard-tile-editor-row {
    min-width: 0;
    min-height: 70px;
    padding: 10px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    border: 1px solid rgba(91, 147, 195, .1);
    border-radius: 13px;
    background: rgba(5, 13, 23, .72);
}
.dashboard-tile-editor-row.is-selected { border-color: rgba(73, 183, 240, .26); background: rgba(30, 106, 153, .08); }
.dashboard-tile-editor-row label { min-width: 0; display: grid; grid-template-columns: auto 32px minmax(0, 1fr); align-items: center; gap: 9px; cursor: pointer; }
.dashboard-tile-editor-row input { accent-color: #5cbef0; }
.dashboard-tile-editor-code {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    color: #7fb5d4;
    border-radius: 9px;
    background: rgba(67, 143, 190, .1);
    font: 600 .46rem/1 var(--font-mono);
}
.dashboard-tile-editor-row strong { display: block; overflow: hidden; color: #afc5d3; font-size: .59rem; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-tile-editor-row small { display: block; margin-top: 4px; overflow: hidden; color: #4f687c; font-size: .48rem; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-tile-editor-row > div { display: flex; gap: 4px; }
.dashboard-tile-editor-row > div button {
    width: 26px;
    height: 26px;
    padding: 0;
    color: #68869b;
    border: 1px solid rgba(91, 147, 195, .12);
    border-radius: 7px;
    background: transparent;
}
.dashboard-tile-editor-row > div button:disabled { opacity: .25; }
.dashboard-tile-dialog footer {
    min-height: 70px;
    padding: 14px 20px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    border-top: 1px solid rgba(91, 147, 195, .12);
}
#dashboard-tiles-status { color: #6d899c; font-size: .52rem; text-align: center; }

@keyframes dashboard-tile-in {
    from { opacity: 0; transform: translateY(6px); }
}

.dashboard-signal-grid {
    display: grid;
    grid-template-columns: 1.2fr .8fr;
    border-inline: 1px solid var(--line);
    background: var(--surface-input);
}

.dashboard-signal {
    min-width: 0;
    min-height: 190px;
    padding: 22px;
    border-inline-end: 1px solid var(--line);
}

.dashboard-signal:last-child {
    border-inline-end: 0;
}

.dashboard-signal h3 {
    margin: 5px 0 0;
    font-size: 14px;
}

.dashboard-heading-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dashboard-data-updated {
    animation: dashboard-data-land 700ms var(--ease) var(--update-delay,0ms) both;
}

@keyframes dashboard-data-land {
    0% { box-shadow: inset 0 1px 0 rgba(124,140,255,.34); filter: brightness(1.09); }
    100% { box-shadow: inset 0 1px 0 transparent; filter: none; }
}

.dashboard-context-grid {
    display: grid;
    grid-template-columns: 1.05fr .8fr 1.15fr;
}

.dashboard-context {
    min-width: 0;
    min-height: 230px;
    padding: 24px;
    border-inline-end: 1px solid var(--line);
}

.dashboard-context:last-child {
    border-inline-end: 0;
}

.dashboard-context-body {
    margin-top: 22px;
}

.dashboard-context .dashboard-connection-row {
    min-height: 58px;
    padding-inline: 0;
    border-bottom: 1px solid rgba(255,255,255,.055);
}

.dashboard-context .weather-now {
    min-height: 112px;
}

.dashboard-context .weather-reading strong {
    font-size: 34px;
}

.dashboard-activity .activity-item {
    min-width: 0;
    padding: 13px 0;
    display: grid;
    grid-template-columns: 7px minmax(0,1fr) auto;
    align-items: start;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,.055);
    background: transparent;
}

.dashboard-activity .activity-item > span:nth-child(2) {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.dashboard-activity .activity-item strong,
.dashboard-activity .activity-item small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-activity .activity-item strong {
    color: var(--ink);
    font-size: 10px;
}

.dashboard-activity .activity-item small,
.dashboard-activity .activity-time {
    color: var(--ink-3);
    font-size: 8px;
}

.dashboard-data-state {
    min-height: 150px;
    padding: 22px 4px;
    display: grid;
    grid-template-columns: 10px minmax(0,1fr) auto;
    align-items: center;
    gap: 13px;
    color: var(--ink-2);
}

.dashboard-data-state-mark {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--line-strong);
}

.dashboard-data-state[data-tone="error"] .dashboard-data-state-mark {
    background: var(--bad);
    box-shadow: 0 0 14px rgba(242,118,112,.4);
}

.dashboard-data-state strong,
.dashboard-data-state small {
    display: block;
}

.dashboard-data-state strong {
    color: var(--ink);
    font-size: 12px;
}

.dashboard-data-state small {
    margin-top: 5px;
    color: var(--ink-3);
    font-size: 9px;
    line-height: 1.5;
}

.dashboard-data-state button {
    min-height: 36px;
    padding: 7px 12px;
    border: 1px solid var(--line-strong);
    background: transparent;
    color: var(--ink-2);
    font-size: 10px;
}

/* Responsive application layout */
@media (max-width: 900px) {
    :root { --sidebar: 0px; }
    .sidebar {
        inset: 0 0 0 auto;
        width: var(--nav-drawer);
        height: 100dvh;
        max-height: 100dvh;
        padding: 14px 12px calc(14px + env(safe-area-inset-bottom, 0px));
        display: grid;
        grid-template-rows: auto minmax(0, 1fr) auto;
        border: 0;
        border-inline-end: 1px solid var(--line);
        transform: translateX(110%);
    }
    .app.nav-open .sidebar { transform: translateX(0); }
    .sidebar-header { display: flex; }
    .sidebar-footer { display: grid; }
    .nav {
        height: auto;
        min-height: 0;
        padding: 6px 2px;
        flex-direction: column;
        overflow-x: hidden;
        overflow-y: auto;
        scrollbar-width: thin;
    }
    .nav::-webkit-scrollbar { width: 8px; display: block; }
    .nav-item {
        min-width: 0;
        height: auto;
        min-height: 42px;
        padding: 9px 12px;
        flex-direction: row;
        justify-content: flex-start;
        gap: 11px;
        font-size: 13px;
        white-space: nowrap;
    }
    .nav-item.active { box-shadow: none; }
    .main { margin: 0; padding-bottom: 0; }
    .topbar { height: 60px; }
    #page-chat { height: calc(100dvh - 60px); }
    .chat-stage { grid-template-columns: 220px 1fr; }
    .stats-grid { grid-template-columns: repeat(2,1fr); }
    .dashboard-action-rail { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .dashboard-priority-grid { grid-template-columns: 1fr; }
    .dashboard-priority { border-inline-end: 0; border-bottom: 1px solid var(--line); }
    .dashboard-context-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .dashboard-context:nth-child(2) { border-inline-end: 0; }
    .dashboard-context:last-child { grid-column: 1 / -1; border-top: 1px solid var(--line); }
    .brain-layout { min-height: 0; grid-template-columns: 1fr; }
    .brain-layer-rail {
        display: flex;
        overflow-x: auto;
        flex-direction: row;
        border-inline-end: 0;
        border-bottom: 1px solid var(--line);
        scrollbar-width: none;
    }
    .brain-layer-rail::-webkit-scrollbar { display: none; }
    .brain-layer-button { min-width: 178px; }
    .brain-layer-button.is-active { box-shadow: inset 0 -2px #4ec7ff; }
    .provider-connection-grid,
    .provider-unconfigured-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .account-connection-grid { grid-template-columns: 1fr; }
    .infrastructure-connections { grid-template-columns: 1fr; }
    .infrastructure-card + .infrastructure-card { border-inline-start: 0; border-top: 1px solid var(--line); }
    .model-control-body { grid-template-columns: 220px minmax(0,1fr); }
    .model-control-action { grid-column: 1 / -1; grid-template-columns: 1fr auto; align-items: center; }
}

@media (max-width: 640px) {
    .topbar { padding-inline: 14px; }
    .command-center-trigger {
        width: 36px;
        min-width: 36px;
        padding: 0;
        justify-content: center;
    }
    .command-center-trigger span,
    .command-center-trigger kbd { display: none; }
    .command-center { padding: 12px; place-items: center; }
    .command-center-panel {
        max-height: calc(100vh - 90px);
        border-radius: 18px;
    }
    .command-center-head { min-height: 70px; padding: 14px 16px; }
    .command-center-search { padding-inline: 14px; }
    .command-center-results { padding: 8px; }
    .command-center-results button { grid-template-columns: 28px 1fr; }
    .command-center-results button small { display: none; }
    .command-center-foot span:last-child { display: none; }
    .page { padding: 24px 14px 80px; }
    #page-dashboard { padding: 8px 14px 80px; }
    .dashboard-masthead {
        min-height: 0;
        padding: 20px 18px;
        align-items: center;
        flex-direction: row;
        justify-content: space-between;
        gap: 14px;
        border-radius: 20px;
    }
    .dashboard-date-line { margin-bottom: 10px; }
    .dashboard-masthead h2 { font-size: 28px; }
    .dashboard-masthead p {
        max-width: 100%;
        margin-top: 8px;
        font-size: 13px;
    }
    .dashboard-masthead-meta {
        width: 100%;
        min-width: 0;
        text-align: start;
    }
    .dashboard-diane-presence {
        width: 46px;
        height: 46px;
    }
    .dashboard-action-rail { grid-template-columns: 1fr 1fr; }
    .dashboard-action-rail button {
        min-height: 46px;
        padding: 10px 11px;
        grid-template-columns: 20px minmax(0,1fr);
    }
    .dashboard-priority,
    .dashboard-day,
    .dashboard-telemetry,
    .dashboard-context { padding: 24px 18px; }
    .dashboard-priority,
    .dashboard-day { min-height: 0; }
    .dashboard-section-head > small { display: none; }
    .dashboard-telemetry > .stats-grid { grid-template-columns: 1fr 1fr; }
    .dashboard-telemetry .stat-card { min-height: 112px; padding: 16px; }
    .dashboard-signal-grid { grid-template-columns: 1fr; }
    .dashboard-signal { min-height: 0; border-inline-end: 0; border-bottom: 1px solid var(--line); }
    .dashboard-signal:last-child { border-bottom: 0; }
    .dashboard-context-grid { grid-template-columns: 1fr; }
    .dashboard-context,
    .dashboard-context:nth-child(2),
    .dashboard-context:last-child {
        min-height: 0;
        grid-column: auto;
        border-inline-end: 0;
        border-bottom: 1px solid var(--line);
        border-top: 0;
    }
    .phone-page,
    .phone-page > * { min-width: 0; max-width: 100%; }
    .phone-page h2,
    .phone-page h3,
    .phone-page p,
    .phone-page code { overflow-wrap: anywhere; }
    .page-intro { min-height: 0; }
    .page-intro::after { display: none; }
    .page-intro h2 { font-size: 30px; }
    .grid-2col,
    .insight-grid,
    .proactive-settings-grid,
    .stats-grid,
    .health-metrics-grid,
    .learning-grid,
    .phone-link-steps,
    .phone-checks,
    .phone-signal-grid,
    .phone-link-grid,
    .sleep-night-map {
        grid-template-columns: 1fr;
    }
    .phone-hero-layout { grid-template-columns: 1fr; }
    .phone-device-visual { display: none; }
    .phone-hero-actions { align-items: stretch; flex-direction: column; }
    .news-add-bar { display: grid; grid-template-columns: 1fr; }
    .chat-stage { grid-template-columns: 1fr; }
    .chat-library {
        position: absolute;
        inset: 0 0 0 auto;
        z-index: 20;
        width: min(86vw,320px);
        display: grid;
        transform: translateX(105%);
        box-shadow: -24px 0 70px rgba(0,0,0,.45);
        transition: transform var(--normal) var(--ease);
    }
    #page-chat.chat-library-open .chat-library { transform: translateX(0); }
    .chat-stage { position: relative; overflow: hidden; }
    .chat-library-toggle {
        width: 40px;
        min-width: 40px;
        height: 40px;
        min-height: 40px;
        padding: 0;
        display: grid;
        place-items: center;
        border-radius: 12px;
        background: var(--surface-1);
    }
    .chat-context-bar { padding: 10px 12px; }
    .chat-inline-search { display: none; }
    .chat-channel-select > span { display: none; }
    .chat-messages-container { padding: 20px 12px; }
    .chat-composer { width: calc(100% - 18px); padding-bottom: 9px; }
    .chat-composer-meta span:last-child { display: none; }
    .chat-bubble-wrapper { max-width: 88%; }
    .application-workspace {
        min-height: 0;
        grid-template-columns: 1fr;
        border-radius: 18px;
        overflow: hidden;
    }
    .application-workspace-rail {
        padding: 14px 12px 10px;
        border-inline-end: 0;
        border-bottom: 1px solid var(--line);
    }
    .application-workspace-rail-head {
        padding: 0 4px 12px;
    }
    .application-workspace-tabs {
        margin-inline: -2px;
        padding: 0 2px 4px;
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
    }
    .application-workspace-tabs::-webkit-scrollbar { display: none; }
    .application-workspace-tab {
        width: auto;
        min-width: max-content;
        min-height: 42px;
        grid-template-columns: auto 6px;
        scroll-snap-align: start;
    }
    .application-workspace-stage {
        padding: 22px 16px 28px;
    }
    .application-workspace-panel > .card-title,
    .application-workspace-panel > .books-header,
    .application-workspace-panel > .vault-head {
        padding-bottom: 16px;
        margin-bottom: 18px;
    }
    .health-command-strip,
    .health-console-grid {
        grid-template-columns: 1fr;
    }
    .health-command-strip {
        gap: 14px;
        padding: 18px 16px;
    }
    .health-pulse-visual { height: 56px; }
    .health-alert-panel {
        padding: 20px 16px;
        border-inline-end: 0;
        border-bottom: 1px solid var(--line);
    }
    .health-systems { padding: 16px; }
    .service-launcher-head { align-items: start; flex-direction: column; }
    .service-launcher .services-grid { grid-template-columns: 1fr; }
    .service-module { min-height: 0; grid-template-columns: 78px 1fr; gap: 16px; }
    .service-module-visual { width: 72px; height: 72px; }
    .service-module-enter { display: none; }
    .brain-workspace { border-radius: 20px; }
    .brain-header { min-height: 0; padding: 16px; align-items: start; }
    .brain-layout { min-height: 0; grid-template-columns: 1fr; }
    .brain-layer-rail {
        padding: 10px;
        display: flex;
        overflow-x: auto;
        flex-direction: row;
        border-inline-end: 0;
        border-bottom: 1px solid var(--line);
        scroll-snap-type: x proximity;
        scrollbar-width: none;
    }
    .brain-layer-rail::-webkit-scrollbar { display: none; }
    .brain-layer-button { min-width: 145px; min-height: 48px; scroll-snap-align: start; }
    .brain-layer-button.is-active { box-shadow: inset 0 -2px #4ec7ff; }
    .brain-prompt-view,
    .brain-memory-view { min-height: 0; }
    .brain-stage-toolbar { min-height: 0; padding: 20px 16px; align-items: start; flex-direction: column; }
    .brain-editor-layout { min-height: 0; grid-template-columns: 1fr; }
    .brain-outline {
        padding: 12px 14px;
        overflow-x: auto;
        border-inline-end: 0;
        border-bottom: 1px solid var(--line);
    }
    .brain-outline > strong,
    #brain-document-stats { display: none; }
    #brain-outline-list { margin: 0; display: flex; gap: 6px; }
    #brain-outline-list button { min-width: max-content; min-height: 32px; }
    .brain-document { padding: 14px; }
    #persona-editor { min-height: 440px; padding: 18px 16px; font-size: .74rem; }
    .persona-editor-actions { align-items: stretch; flex-direction: column; }
    .brain-memory-summary { grid-template-columns: 1fr 1fr; }
    .brain-memory-summary > div { min-height: 76px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
    .brain-memory-controls { padding: 14px; align-items: stretch; flex-direction: column; }
    .brain-memory-filters { overflow-x: auto; flex-wrap: nowrap; }
    .brain-memory-filters button { min-width: max-content; }
    #brain-memory-search { width: 100%; }
    .brain-memory-grid { padding: 14px; grid-template-columns: 1fr; }
    .brain-memory-card { min-height: 160px; }
    .brain-memory-form-row { grid-template-columns: 1fr; }
    .brain-dialog-actions { grid-template-columns: 1fr 1fr; }
    .brain-dialog-actions span { display: none; }
    .integration-workspace-head,
    .provider-control-head,
    .ai-usage-head,
    .account-connections-head,
    .model-control-center > header { min-height: 0; padding: 22px 16px; align-items: stretch; flex-direction: column; }
    .integration-refresh-all { width: 100%; }
    .provider-control-facts { width: 100%; }
    .provider-control-facts span { flex: 1; }
    .provider-connection-grid { padding: 12px; grid-template-columns: 1fr 1fr; }
    .provider-unconfigured-grid { grid-template-columns: 1fr 1fr; }
    .provider-unconfigured summary { grid-template-columns: auto 1fr auto; }
    .provider-unconfigured summary small { display: none; }
    .provider-connection-card { min-height: 132px; }
    .ai-usage-summary { grid-template-columns: 1fr 1fr; }
    .ai-usage-summary > div { min-height: 86px; padding: 14px; border-bottom: 1px solid var(--line); }
    .ai-usage-chart { padding-inline: 14px; overflow-x: auto; }
    .ai-usage-bar { min-width: 12px; }
    .account-connection-grid { padding: 12px; }
    .connection-fields,
    .connection-permissions { grid-template-columns: 1fr; }
    .connection-fields textarea { grid-column: auto; }
    .infrastructure-card { min-height: 0; padding: 22px 16px; grid-template-columns: 1fr; }
    .model-control-body { padding: 16px; grid-template-columns: 1fr; }
    .model-control-fields { grid-template-columns: 1fr; }
    .model-control-action { grid-column: auto; grid-template-columns: 1fr; }
    .model-control-center > footer { padding: 12px 16px; align-items: start; flex-direction: column; gap: 8px; }
    .model-control-center footer button { margin: 0; }
    .log-console-head { padding: 20px 16px; }
    .log-console .log-filters { display: grid; grid-template-columns: 1fr; padding: 12px; }
    .log-console .logs-container { padding: 12px; }
    .books-service-topline { padding: 14px 16px; }
    .books-service-hero { min-height: 0; padding: 24px 16px; align-items: stretch; flex-direction: column; }
    .books-service-hero .books-controls { width: 100%; }
    .books-operations { grid-template-columns: 1fr; }
    .books-operations .books-sync-panel { border-inline-start: 0; border-top: 1px solid var(--line); }
    .books-add-bar { margin: 18px 14px 8px; align-items: stretch; flex-direction: column; }
    .books-settings-bar { margin: 0 14px 18px; align-items: stretch; display: grid; grid-template-columns: 1fr 90px; }
    .books-settings-bar .books-filter { width: 100%; margin: 0; grid-column: 1 / -1; }
    .books-service-console > .books-grid { padding: 0 14px 22px; }
    .news-console-head,
    .learning-studio-head { min-height: 0; padding: 22px 16px; align-items: stretch; flex-direction: column; }
    .news-console .news-add-bar { margin: 16px 14px 8px; }
    .news-console .news-channels-list { padding: 8px 14px 20px; }
    .learning-studio-head .language-controls { display: grid; grid-template-columns: 1fr 1fr; }
    #language-code-input { width: 100%; }
    .learning-studio > .books-summary { padding: 16px; }
    .learning-studio .learning-grid { padding: 16px; }
    #page-users .application-workspace-panel table { min-width: 0; }
    #page-users .application-workspace-panel thead { display: none; }
    #page-users .application-workspace-panel tbody,
    #page-users .application-workspace-panel tr,
    #page-users .application-workspace-panel td { display: block; width: 100%; }
    #page-users .application-workspace-panel tr {
        margin-bottom: 9px;
        padding: 10px 12px;
        border: 1px solid var(--line);
        border-radius: 13px;
        background: var(--surface-input);
    }
    #page-users .application-workspace-panel td {
        padding: 7px 0 !important;
        border-bottom: 1px solid var(--line);
        overflow-wrap: anywhere;
    }
    #page-users .application-workspace-panel td[data-label]::before {
        margin-bottom: 3px;
        display: block;
        color: var(--ink-3);
        content: attr(data-label);
        font-size: 10px;
        font-weight: 600;
    }
    #page-users .application-workspace-panel td[data-label="פעולות"] {
        text-align: start !important;
    }
    #page-users .users-table-state {
        padding: 0;
        border: 0;
        background: transparent;
    }
    #page-users .users-table-state td {
        padding: 20px 8px !important;
        border-bottom: 0;
    }
    #page-users .application-workspace-panel td:last-child { border-bottom: 0; }
    #page-users .application-workspace-panel > div[style*="display: flex"] {
        align-items: stretch !important;
        flex-direction: column !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
/* ============================================================
   Durable Flow Studio — graph-first application workspace
   ============================================================ */

.flow-page {
    --flow-blue: #37b9ff;
    --flow-cyan: #78ddff;
    --flow-violet: #8b72ff;
    --flow-ink: #07101f;
    --flow-panel: rgba(9, 19, 36, .92);
    --flow-line: rgba(129, 174, 224, .16);
    min-height: calc(100vh - 132px);
    padding-bottom: 92px;
}

.flow-page > .page-intro {
    display: none;
}

.flow-page.active {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.flow-command-bar,
.flow-run-dock {
    border: 1px solid var(--flow-line);
    background: rgba(8, 18, 33, .96);
    box-shadow: 0 10px 28px rgba(0, 0, 0, .16);
}

.flow-command-bar {
    min-height: 58px;
    padding: 8px 11px 8px 14px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.flow-command-copy,
.flow-command-actions,
.flow-inspector-head,
.flow-run-summary {
    display: flex;
    align-items: center;
}

.flow-command-copy {
    gap: 11px;
    min-width: 0;
    border: 0;
    padding: 0;
    background: transparent;
    color: inherit;
    text-align: right;
    font: inherit;
    cursor: pointer;
}

.flow-command-copy > div {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.flow-command-copy strong {
    font-size: 14px;
    color: #edf7ff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.flow-command-copy span:not(.flow-live-mark) {
    font-size: 11px;
    color: #7690ac;
}

.flow-live-mark {
    width: 26px;
    height: 26px;
    border: 1px solid rgba(139, 114, 255, .24);
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: rgba(139, 114, 255, .08);
}

.flow-live-mark i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--flow-violet);
    box-shadow: 0 0 0 3px rgba(139,114,255,.09);
    animation: flowBreathe 2.4s ease-in-out infinite;
}

.flow-command-actions {
    gap: 8px;
}

.flow-icon-button,
.flow-secondary-button,
.flow-primary-button,
.flow-trace-button {
    border: 1px solid rgba(128, 175, 226, .18);
    color: #ddecfa;
    background: rgba(8, 17, 31, .7);
    border-radius: 11px;
    height: 40px;
    cursor: pointer;
    transition: border-color .2s ease, background .2s ease, transform .2s ease, box-shadow .2s ease;
}

.flow-icon-button:hover,
.flow-secondary-button:hover,
.flow-trace-button:hover {
    border-color: rgba(55,185,255,.45);
    background: rgba(22,45,72,.8);
    transform: translateY(-1px);
}

.flow-icon-button {
    width: 40px;
    display: grid;
    place-items: center;
    padding: 0;
}

.flow-icon-button svg,
.flow-secondary-button svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
}

.flow-secondary-button,
.flow-primary-button {
    padding: 0 15px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
}

.flow-primary-button {
    color: #06101d;
    border-color: rgba(112,216,255,.6);
    background: linear-gradient(135deg, #73dcff, #45b9ff 58%, #747dff);
    box-shadow: 0 8px 26px rgba(42,160,239,.22), inset 0 1px rgba(255,255,255,.55);
}

.flow-primary-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 11px 32px rgba(42,160,239,.3), inset 0 1px rgba(255,255,255,.65);
}

.flow-toggle-light {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #06101d;
    box-shadow: 0 0 0 3px rgba(6,16,29,.12);
}

.flow-studio {
    flex: 1;
    min-height: 630px;
    display: grid;
    grid-template-columns: 250px minmax(480px, 1fr) 300px;
    direction: ltr;
    overflow: hidden;
    border: 1px solid var(--flow-line);
    border-radius: 16px;
    background: #07101d;
    box-shadow: 0 14px 36px rgba(0, 0, 0, .2);
}

.flow-library,
.flow-inspector,
.flow-canvas-shell {
    min-width: 0;
}

.flow-library,
.flow-inspector {
    direction: rtl;
    background: #081322;
}

.flow-library {
    border-right: 1px solid var(--flow-line);
    display: flex;
    flex-direction: column;
}

.flow-library-head {
    min-height: 72px;
    padding: 17px 17px 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.flow-library-head > div {
    display: grid;
    gap: 4px;
}

.flow-library-head span {
    font-size: 10px;
    color: #718aa5;
}

.flow-library-head strong {
    font-size: 15px;
    color: #f1f7fd;
}

.flow-library-head button {
    width: 34px;
    height: 34px;
    border: 1px solid rgba(55,185,255,.24);
    border-radius: 11px;
    background: rgba(33,111,166,.13);
    color: var(--flow-cyan);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

.flow-search {
    margin: 0 13px 12px;
    height: 39px;
    border: 1px solid rgba(125,164,207,.14);
    border-radius: 11px;
    background: rgba(3,10,20,.64);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 11px;
}

.flow-search:focus-within {
    border-color: rgba(55,185,255,.42);
    box-shadow: 0 0 0 3px rgba(55,185,255,.06);
}

.flow-search svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: #67819e;
    stroke-width: 1.8;
}

.flow-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: #dcebf8;
    font: inherit;
    font-size: 11px;
}

.flow-filter-row {
    padding: 0 13px 11px;
    display: flex;
    gap: 4px;
}

.flow-filter-row button {
    flex: 1;
    border: 0;
    border-radius: 8px;
    padding: 7px 4px;
    background: transparent;
    color: #69819a;
    font: inherit;
    font-size: 10px;
    cursor: pointer;
}

.flow-filter-row button.is-active {
    color: #cdefff;
    background: rgba(55,185,255,.1);
}

.flow-list {
    flex: 1;
    min-height: 0;
    min-width: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    padding: 0 9px 12px;
}

.flow-list-item {
    position: relative;
    width: 100%;
    border: 1px solid transparent;
    border-radius: 14px;
    background: transparent;
    color: inherit;
    padding: 12px 12px 12px 10px;
    text-align: right;
    cursor: pointer;
    display: grid;
    grid-template-columns: 35px 1fr auto;
    gap: 9px;
    align-items: center;
    transition: background .18s ease, border-color .18s ease, transform .18s ease;
}

.flow-list-item:hover {
    background: rgba(29,58,91,.28);
    transform: translateX(-2px);
}

.flow-list-item.is-active {
    border-color: rgba(55,185,255,.2);
    background: linear-gradient(100deg, rgba(32,103,157,.19), rgba(83,62,155,.08));
}

.flow-list-item.is-active::before {
    content: "";
    position: absolute;
    inset-inline-start: 2px;
    top: 15px;
    bottom: 15px;
    width: 3px;
    border-radius: 999px;
    background: var(--flow-blue);
    box-shadow: 0 0 11px var(--flow-blue);
    pointer-events: none;
}

.flow-list-symbol {
    width: 35px;
    height: 35px;
    display: grid;
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--item-accent, #37b9ff) 32%, transparent);
    border-radius: 11px;
    background: color-mix(in srgb, var(--item-accent, #37b9ff) 11%, transparent);
}

.flow-list-symbol svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: var(--item-accent, #37b9ff);
    stroke-width: 1.7;
}

.flow-list-copy {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.flow-list-copy strong {
    color: #dceaf7;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.flow-list-copy small {
    color: #667d96;
    font-size: 9px;
}

.flow-list-state {
    width: 7px;
    height: 7px;
    border: 1px solid #52708e;
    border-radius: 50%;
}

.flow-list-item[data-state="active"] .flow-list-state {
    border-color: var(--flow-blue);
    background: var(--flow-blue);
    box-shadow: 0 0 9px rgba(55,185,255,.65);
}

.flow-list-item[data-state="waiting"] .flow-list-state {
    border-color: var(--flow-violet);
    background: var(--flow-violet);
    box-shadow: 0 0 9px rgba(139,114,255,.55);
    animation: flowBreathe 1.8s ease-in-out infinite;
}

.flow-list-loading {
    display: grid;
    gap: 8px;
    padding: 8px 4px;
}

.flow-list-loading i {
    height: 55px;
    border-radius: 12px;
    background: linear-gradient(90deg, rgba(39,62,89,.18), rgba(62,102,144,.3), rgba(39,62,89,.18));
    background-size: 220% 100%;
    animation: flowShimmer 1.5s linear infinite;
}

.flow-library-foot {
    padding: 12px 14px;
    border-top: 1px solid rgba(128,175,226,.09);
    color: #60758d;
    font-size: 9px;
}

.flow-library-foot span {
    display: flex;
    align-items: center;
    gap: 7px;
}

.flow-library-foot i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--flow-blue);
    box-shadow: 0 0 8px var(--flow-blue);
}

.flow-canvas-shell {
    display: flex;
    flex-direction: column;
    direction: rtl;
    background: #060e1b;
}

.flow-canvas-toolbar {
    height: 52px;
    flex: 0 0 52px;
    border-bottom: 1px solid var(--flow-line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    background: rgba(8,18,32,.88);
}

.flow-breadcrumb {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #688097;
    font-size: 10px;
}

.flow-breadcrumb i {
    color: #3f566e;
}

.flow-breadcrumb strong {
    color: #bccdde;
    font-weight: 600;
}

.flow-zoom-controls {
    direction: ltr;
    display: flex;
    align-items: center;
    height: 30px;
    border: 1px solid rgba(128,175,226,.12);
    border-radius: 9px;
    overflow: hidden;
}

.flow-zoom-controls button {
    width: 30px;
    height: 100%;
    border: 0;
    color: #8da5bd;
    background: rgba(14,28,47,.65);
    cursor: pointer;
}

.flow-zoom-controls output {
    width: 48px;
    color: #7d94ab;
    text-align: center;
    font-size: 9px;
}

.flow-canvas {
    position: relative;
    flex: 1;
    min-height: 570px;
    overflow: hidden;
    direction: ltr;
    cursor: grab;
    outline: none;
    touch-action: none;
    user-select: none;
    background:
        radial-gradient(circle at 40% 42%, rgba(40, 98, 158, .09), transparent 34%),
        radial-gradient(circle at 72% 65%, rgba(103, 77, 196, .07), transparent 31%),
        #050d19;
}

.flow-canvas:active {
    cursor: grabbing;
}

.flow-grid {
    position: absolute;
    inset: -60px;
    opacity: .5;
    background-image: radial-gradient(circle, rgba(107,147,188,.25) 1px, transparent 1.2px);
    background-size: 24px 24px;
    transform: translate(var(--flow-pan-x, 0), var(--flow-pan-y, 0)) scale(var(--flow-zoom, 1));
    transform-origin: 0 0;
}

.flow-edge-layer,
.flow-node-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: translate(var(--flow-pan-x, 0), var(--flow-pan-y, 0)) scale(var(--flow-zoom, 1));
    transform-origin: 0 0;
}

.flow-edge-layer {
    overflow: visible;
    pointer-events: auto;
    z-index: 1;
}

.flow-edge-hit {
    fill: none;
    stroke: transparent;
    stroke-width: 18;
    vector-effect: non-scaling-stroke;
    pointer-events: stroke;
    cursor: crosshair;
}

.flow-edge {
    fill: none;
    stroke: rgba(88,135,180,.42);
    stroke-width: 1.6;
    vector-effect: non-scaling-stroke;
    pointer-events: none;
}

.flow-edge-halo {
    fill: none;
    stroke: rgba(55,185,255,.07);
    stroke-width: 7;
    vector-effect: non-scaling-stroke;
    pointer-events: none;
}

.flow-edge.is-live {
    stroke: var(--flow-blue);
    stroke-dasharray: 4 8;
    animation: flowDash 1.05s linear infinite;
    filter: drop-shadow(0 0 4px rgba(55,185,255,.45));
}

.flow-edge.is-loop {
    stroke: rgba(139,114,255,.63);
}

.flow-edge-label {
    fill: #7088a0;
    font: 9px "Assistant", sans-serif;
    paint-order: stroke;
    stroke: #060e1b;
    stroke-width: 4px;
    pointer-events: none;
}

.flow-node-layer {
    pointer-events: none;
    z-index: 2;
}

.flow-node {
    --node-accent: #37b9ff;
    position: absolute;
    width: 160px;
    min-height: 76px;
    padding: 11px 12px;
    border: 1px solid rgba(122,168,215,.2);
    border-radius: 15px;
    color: #dcebf8;
    background:
        linear-gradient(140deg, color-mix(in srgb, var(--node-accent) 8%, transparent), transparent 52%),
        rgba(9,19,35,.96);
    box-shadow: 0 13px 26px rgba(0,0,0,.22), inset 0 1px rgba(255,255,255,.025);
    pointer-events: auto;
    cursor: pointer;
    display: grid;
    grid-template-columns: 35px 1fr;
    align-items: center;
    gap: 10px;
    text-align: right;
    direction: rtl;
    transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
    touch-action: none;
    user-select: none;
}

.flow-node:hover:not(.is-dragging) {
    border-color: color-mix(in srgb, var(--node-accent) 52%, transparent);
    transform: translateY(-2px);
}

.flow-node.is-dragging {
    cursor: grabbing;
    transition: none;
    z-index: 3;
}

.flow-node.is-connecting {
    border-color: var(--node-accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--node-accent) 12%, transparent), 0 0 28px color-mix(in srgb, var(--node-accent) 18%, transparent);
}

.flow-node.is-selected {
    border-color: var(--node-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--node-accent) 9%, transparent), 0 16px 35px rgba(0,0,0,.32);
}

.flow-node[data-state="completed"] {
    opacity: .76;
}

.flow-node[data-state="live"] {
    border-color: color-mix(in srgb, var(--node-accent) 70%, transparent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--node-accent) 8%, transparent), 0 0 25px color-mix(in srgb, var(--node-accent) 13%, transparent);
}

.flow-node[data-state="live"]::after {
    content: "";
    position: absolute;
    inset: -1px;
    border: 1px solid var(--node-accent);
    border-radius: inherit;
    animation: flowNodePulse 2s ease-out infinite;
    pointer-events: none;
}

.flow-node[data-type="condition"] {
    border-radius: 19px 7px 19px 7px;
}

.flow-node[data-type="complete"] {
    width: 150px;
    border-radius: 38px;
}

.flow-node-symbol {
    width: 35px;
    height: 35px;
    display: grid;
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--node-accent) 38%, transparent);
    border-radius: 11px;
    background: color-mix(in srgb, var(--node-accent) 10%, transparent);
}

.flow-node-symbol svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: var(--node-accent);
    stroke-width: 1.75;
}

.flow-node-copy {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.flow-node-copy small {
    color: var(--node-accent);
    font-size: 8px;
    letter-spacing: .04em;
}

.flow-node-copy strong {
    color: #e8f2fb;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.flow-node-copy span {
    color: #70869c;
    font-size: 8.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.flow-port {
    position: absolute;
    width: 9px;
    height: 9px;
    border: 2px solid #07101d;
    border-radius: 50%;
    background: var(--node-accent);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--node-accent) 45%, transparent), 0 0 8px color-mix(in srgb, var(--node-accent) 35%, transparent);
    pointer-events: auto;
    cursor: crosshair;
    z-index: 4;
}

.flow-port::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.flow-port.in {
    left: -5px;
    top: calc(50% - 4px);
}

.flow-node-ports {
    position: absolute;
    right: -5px;
    top: 10px;
    bottom: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 13px;
    pointer-events: none;
}

.flow-node-ports .flow-port.out {
    position: relative;
    right: auto;
    top: auto;
    flex: 0 0 9px;
}

.flow-port b {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    padding: 2px 5px;
    border: 1px solid color-mix(in srgb, var(--node-accent) 20%, transparent);
    border-radius: 5px;
    color: #8ca4bb;
    background: rgba(5,13,25,.92);
    font-size: 7px;
    font-weight: 600;
    white-space: nowrap;
    opacity: .76;
    pointer-events: none;
}

.flow-port:focus-visible {
    outline: 2px solid #eef8ff;
    outline-offset: 4px;
}

.flow-signal-fieldset {
    border: 0;
    margin: 0;
    padding: 0;
}

.flow-signal-fieldset legend {
    margin-bottom: 8px;
    color: #8097ad;
    font-size: 9px;
}

.flow-signal-types {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.flow-signal-types label {
    cursor: pointer;
}

.flow-signal-types input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.flow-signal-types span {
    display: block;
    padding: 6px 8px;
    border: 1px solid rgba(119,164,206,.15);
    border-radius: 8px;
    color: #7f96ab;
    background: rgba(6,15,27,.7);
    font-size: 8px;
    transition: .18s ease;
}

.flow-signal-types input:checked + span {
    border-color: rgba(139,114,255,.5);
    color: #e9e4ff;
    background: rgba(119,91,238,.15);
    box-shadow: inset 0 0 16px rgba(139,114,255,.08);
}

.flow-matcher-list {
    display: grid;
    gap: 7px;
}

.flow-matcher-row {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(92px, .8fr) minmax(0, 1fr) 28px;
    gap: 6px;
}

.flow-matcher-row input,
.flow-matcher-row select {
    min-width: 0;
}

.flow-matcher-row button {
    border: 1px solid rgba(255,120,149,.2);
    border-radius: 8px;
    color: #ff90a8;
    background: rgba(255,120,149,.06);
    cursor: pointer;
}

.flow-add-matcher {
    align-self: end;
    min-height: 36px;
}

.flow-add-node {
    position: absolute;
    left: 18px;
    bottom: 18px;
    height: 40px;
    border: 1px solid rgba(55,185,255,.25);
    border-radius: 12px;
    padding: 0 14px;
    background: rgba(11,29,50,.9);
    color: #bce9ff;
    font: inherit;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 12px 30px rgba(0,0,0,.24);
}

.flow-add-node span {
    font-size: 18px;
    color: var(--flow-blue);
}

.flow-canvas-hint {
    position: absolute;
    right: 17px;
    bottom: 17px;
    direction: rtl;
    color: #50667d;
    font-size: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.flow-canvas-hint i {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #3e5369;
}

.flow-node-palette {
    position: absolute;
    z-index: 12;
    left: 18px;
    bottom: 67px;
    width: 310px;
    max-height: calc(100% - 90px);
    overflow: auto;
    direction: rtl;
    border: 1px solid rgba(103,168,224,.24);
    border-radius: 16px;
    padding: 11px;
    background: rgba(8,18,33,.98);
    box-shadow: 0 24px 65px rgba(0,0,0,.48), inset 0 1px rgba(255,255,255,.035);
    animation: flowPaletteIn .18s ease-out;
}

.flow-node-palette header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 3px 4px 10px;
}

.flow-node-palette header strong {
    color: #dceaf6;
    font-size: 11px;
}

.flow-node-palette header button {
    border: 0;
    background: transparent;
    color: #70879e;
    cursor: pointer;
}

.flow-node-palette > div {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
}

.flow-node-palette [data-add-flow-node] {
    min-width: 0;
    border: 1px solid rgba(119,164,206,.12);
    border-radius: 11px;
    padding: 8px;
    background: rgba(3,10,20,.54);
    color: inherit;
    text-align: right;
    cursor: pointer;
    display: grid;
    grid-template-columns: 31px 1fr;
    gap: 8px;
    align-items: center;
}

.flow-node-palette [data-add-flow-node]:hover {
    border-color: color-mix(in srgb, var(--node-accent) 46%, transparent);
    background: color-mix(in srgb, var(--node-accent) 7%, #06101d);
}

.flow-node-palette .flow-node-symbol {
    width: 31px;
    height: 31px;
    --node-accent: inherit;
}

.flow-node-palette [data-add-flow-node] > span:last-child {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.flow-node-palette [data-add-flow-node] strong {
    color: #cbdbe8;
    font-size: 9px;
}

.flow-node-palette [data-add-flow-node] small {
    color: #62788e;
    font-size: 7.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.flow-list-empty {
    margin: 8px 4px;
    min-height: 128px;
    border: 1px dashed rgba(112,158,201,.16);
    border-radius: 13px;
    padding: 18px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.flow-list-empty strong {
    color: #b9cad9;
    font-size: 10px;
}

.flow-list-empty span {
    margin-top: 5px;
    color: #637a90;
    font-size: 8px;
    line-height: 1.55;
}

.flow-list-empty button {
    margin-top: 10px;
    border: 1px solid rgba(55,185,255,.24);
    border-radius: 8px;
    padding: 6px 10px;
    background: rgba(55,185,255,.08);
    color: #9edfff;
    font: inherit;
    font-size: 8px;
    cursor: pointer;
}

.flow-tool-dialog {
    position: fixed;
    z-index: 1000;
    inset: 0;
    padding: 24px;
    display: grid;
    place-items: center;
    background: rgba(1,6,13,.68);
    backdrop-filter: blur(10px);
}

.flow-tool-dialog-card {
    direction: rtl;
    width: min(620px, 94vw);
    max-height: min(700px, 86vh);
    border: 1px solid rgba(102,170,226,.24);
    border-radius: 20px;
    padding: 17px;
    background: linear-gradient(145deg, rgba(12,25,44,.99), rgba(6,14,27,.99));
    box-shadow: 0 32px 100px rgba(0,0,0,.55), inset 0 1px rgba(255,255,255,.035);
    display: flex;
    flex-direction: column;
}

.flow-tool-dialog-card > header {
    padding: 2px 4px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.flow-tool-dialog-card > header > div {
    display: grid;
    gap: 4px;
}

.flow-tool-dialog-card > header small {
    color: var(--flow-blue);
    font-size: 8px;
    letter-spacing: .12em;
}

.flow-tool-dialog-card > header strong {
    color: #edf6fc;
    font-size: 15px;
}

.flow-tool-dialog-card > header button {
    width: 32px;
    height: 32px;
    border: 1px solid rgba(113,157,198,.12);
    border-radius: 9px;
    background: rgba(20,40,64,.4);
    color: #7790a8;
    cursor: pointer;
}

.flow-tool-dialog .flow-search {
    margin: 0 0 12px;
}

.flow-tool-results {
    min-height: 180px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
}

.flow-tool-results > button {
    min-width: 0;
    border: 1px solid rgba(119,164,206,.12);
    border-radius: 12px;
    padding: 9px;
    background: rgba(3,10,20,.48);
    color: inherit;
    text-align: right;
    cursor: pointer;
    display: grid;
    grid-template-columns: 35px minmax(0,1fr) auto;
    align-items: center;
    gap: 9px;
}

.flow-tool-results > button:hover {
    border-color: rgba(55,185,255,.38);
    background: rgba(28,78,117,.18);
}

.flow-tool-results > button > span:nth-child(2) {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.flow-tool-results > button strong {
    direction: ltr;
    text-align: left;
    color: #d8e6f2;
    font-size: 9px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.flow-tool-results > button small {
    color: #667d93;
    font-size: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.flow-tool-results > button > i {
    color: #597187;
    font-size: 7px;
}

.flow-new-dialog-card {
    width: min(560px, 94vw);
}

.flow-new-dialog-card > p {
    margin: -2px 4px 16px;
    color: #6f859b;
    font-size: 10px;
    line-height: 1.65;
}

.flow-new-dialog-card textarea {
    min-height: 126px;
    resize: vertical;
    line-height: 1.6;
}

.flow-new-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 3px;
}

.flow-new-actions .flow-primary-button svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
}

.flow-trigger-manual-note {
    min-height: 72px;
    margin-bottom: 9px;
    border: 1px solid rgba(55,185,255,.12);
    border-radius: 12px;
    padding: 12px;
    background: rgba(55,185,255,.045);
    display: flex;
    align-items: center;
    gap: 11px;
}

.flow-trigger-manual-note > div {
    display: grid;
    gap: 4px;
}

.flow-trigger-manual-note strong {
    color: #cbdce9;
    font-size: 10px;
}

.flow-trigger-manual-note small {
    color: #667d92;
    font-size: 8px;
}

.flow-trace-dialog-card {
    width: min(620px, 94vw);
}

.flow-trace-meta {
    margin-bottom: 12px;
    padding: 8px 10px;
    border: 1px solid rgba(113,157,198,.12);
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #688096;
    font-size: 8px;
}

.flow-trace-meta button {
    margin-right: auto;
    border: 0;
    background: transparent;
    color: #8fdcff;
    font: inherit;
    cursor: pointer;
}

.flow-trace-list {
    overflow-y: auto;
    padding: 3px;
}

.flow-trace-list article {
    position: relative;
    min-height: 62px;
    display: grid;
    grid-template-columns: 35px minmax(0,1fr) auto;
    gap: 10px;
    align-items: center;
}

.flow-trace-list article:not(:last-child)::after {
    content: "";
    position: absolute;
    right: 17px;
    top: 48px;
    height: 27px;
    width: 1px;
    background: rgba(69,160,213,.28);
}

.flow-trace-list article > div {
    min-width: 0;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2px 8px;
}

.flow-trace-list article small {
    grid-column: 1 / -1;
    color: #71889e;
    font-size: 8px;
}

.flow-trace-list article strong {
    color: #cbdbe8;
    font-size: 10px;
    font-weight: 600;
}

.flow-trace-list article time {
    color: #60768b;
    font-size: 8px;
}

.flow-trace-list article > b {
    color: #42586d;
    font: 8px ui-monospace, monospace;
}

.flow-inspector {
    border-left: 1px solid var(--flow-line);
    overflow-y: auto;
    overflow-x: hidden;
}

.flow-inspector-empty {
    min-height: 100%;
    padding: 36px 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.flow-inspector-empty[hidden],
.flow-inspector-content[hidden] {
    display: none !important;
}

.flow-inspector-empty strong {
    margin-top: 14px;
    color: #cddbea;
    font-size: 13px;
}

.flow-inspector-empty p {
    max-width: 205px;
    margin: 7px 0 0;
    color: #667c93;
    font-size: 10px;
    line-height: 1.65;
}

.flow-inspector-empty-icon {
    width: 44px;
    height: 44px;
    border: 1px solid rgba(139,114,255,.22);
    border-radius: 13px;
    display: grid;
    place-items: center;
    color: #a89aff;
    background: rgba(139,114,255,.08);
}

.flow-inspector-empty-icon svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
}

.flow-inspector-content {
    padding: 18px;
    min-width: 0;
    overflow-x: hidden;
}

.flow-inspector-head {
    gap: 10px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(128,175,226,.1);
}

.flow-inspector-head > div:nth-child(2) {
    flex: 1;
    min-width: 0;
}

.flow-inspector-head small {
    color: #6d849b;
    font-size: 8px;
}

.flow-inspector-head h3 {
    margin: 3px 0 0;
    color: #e7f1fa;
    font-size: 13px;
}

.flow-inspector-head button {
    width: 27px;
    height: 27px;
    border: 0;
    border-radius: 8px;
    background: rgba(91,124,160,.09);
    color: #7389a0;
    cursor: pointer;
}

.flow-inspector-status {
    margin: 12px 0 16px;
    border: 1px solid rgba(55,185,255,.12);
    border-radius: 9px;
    background: rgba(55,185,255,.05);
    color: #89a8c1;
    padding: 8px 10px;
    font-size: 9px;
    display: flex;
    align-items: center;
    gap: 7px;
}

.flow-inspector-status i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--flow-blue);
    box-shadow: 0 0 7px var(--flow-blue);
}

.flow-field {
    margin: 0 0 13px;
    display: grid;
    gap: 6px;
}

.flow-field[hidden] {
    display: none !important;
}

.flow-node-config-fields {
    display: contents;
}

.flow-field > span {
    color: #71879d;
    font-size: 9px;
}

.flow-field input,
.flow-field textarea,
.flow-field select,
.flow-picker {
    width: 100%;
    border: 1px solid rgba(125,167,210,.14);
    border-radius: 10px;
    background: rgba(3,10,20,.65);
    color: #d5e5f3;
    padding: 9px 10px;
    outline: 0;
    font: inherit;
    font-size: 10px;
}

.flow-field input:focus,
.flow-field textarea:focus,
.flow-field select:focus {
    border-color: rgba(55,185,255,.43);
    box-shadow: 0 0 0 3px rgba(55,185,255,.055);
}

.flow-field textarea {
    resize: vertical;
    line-height: 1.55;
}

.flow-picker {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    text-align: right;
}

.flow-field-row {
    display: grid;
    grid-template-columns: 1fr 84px;
    gap: 9px;
}

.flow-switch-row {
    min-height: 52px;
    margin: 2px 0 14px;
    padding: 9px 10px;
    border: 1px solid rgba(125,167,210,.12);
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.flow-switch-row > span {
    display: grid;
    gap: 3px;
}

.flow-switch-row strong {
    color: #cbdbe9;
    font-size: 10px;
}

.flow-switch-row small {
    color: #61778e;
    font-size: 8px;
}

.flow-switch-row input {
    accent-color: var(--flow-blue);
}

.flow-save-node {
    width: 100%;
    justify-content: center;
}

.flow-delete-node {
    width: 100%;
    margin-top: 8px;
    border: 0;
    padding: 7px;
    background: transparent;
    color: #8a6370;
    font: inherit;
    font-size: 8px;
    cursor: pointer;
}

.flow-delete-node:hover,
.flow-delete-node[data-confirming="true"] {
    color: #ff8ea4;
}

.flow-delete-node[hidden] {
    display: none !important;
}

.flow-run-dock {
    min-height: 62px;
    border-radius: 14px;
    display: grid;
    grid-template-columns: minmax(210px, 1fr) minmax(360px, 1.8fr) auto;
    align-items: center;
    padding: 10px 13px;
    gap: 18px;
}

.flow-run-summary {
    border: 0;
    background: transparent;
    color: inherit;
    text-align: right;
    gap: 10px;
    cursor: pointer;
}

.flow-run-summary > span:nth-child(2) {
    display: grid;
    gap: 2px;
}

.flow-run-summary small {
    color: #6e849b;
    font-size: 8px;
}

.flow-run-summary strong {
    color: #d8e7f4;
    font-size: 10px;
}

.flow-run-summary time {
    color: #60758b;
    font-size: 8px;
    margin-right: auto;
}

.flow-run-pulse {
    position: relative;
    width: 30px;
    height: 30px;
    border: 1px solid rgba(139,114,255,.28);
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(139,114,255,.08);
}

.flow-run-pulse i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--flow-violet);
    box-shadow: 0 0 12px rgba(139,114,255,.8);
    animation: flowBreathe 1.8s ease-in-out infinite;
}

.flow-run-progress {
    direction: ltr;
    display: flex;
    align-items: flex-start;
}

.flow-run-progress span {
    position: relative;
    flex: 1;
    display: grid;
    justify-items: center;
    gap: 5px;
    color: #536a81;
    font-size: 8px;
}

.flow-run-progress span:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 4px;
    left: 50%;
    width: 100%;
    height: 1px;
    background: rgba(98,133,169,.18);
}

.flow-run-progress i {
    position: relative;
    z-index: 1;
    width: 9px;
    height: 9px;
    border: 2px solid #152940;
    border-radius: 50%;
    background: #07101e;
}

.flow-run-progress .is-done {
    color: #7891aa;
}

.flow-run-progress .is-done i {
    border-color: #357da9;
    background: #4aaee4;
}

.flow-run-progress .is-done::after {
    background: rgba(55,185,255,.4) !important;
}

.flow-run-progress .is-live {
    color: #bdadff;
}

.flow-run-progress .is-live i {
    border-color: var(--flow-violet);
    background: var(--flow-violet);
    box-shadow: 0 0 0 4px rgba(139,114,255,.09), 0 0 12px rgba(139,114,255,.55);
    animation: flowBreathe 1.8s ease-in-out infinite;
}

.flow-trace-button {
    padding: 0 12px;
    font: inherit;
    font-size: 9px;
    white-space: nowrap;
}

.flow-trace-button span {
    color: var(--flow-blue);
    margin-right: 5px;
}

@keyframes flowBreathe {
    0%, 100% { opacity: .6; transform: scale(.86); }
    50% { opacity: 1; transform: scale(1.1); }
}

@keyframes flowShimmer {
    to { background-position: -220% 0; }
}

@keyframes flowDash {
    to { stroke-dashoffset: -24; }
}

@keyframes flowNodePulse {
    0% { opacity: .65; transform: scale(1); }
    70%, 100% { opacity: 0; transform: scale(1.07); }
}

@keyframes flowPaletteIn {
    from { opacity: 0; transform: translateY(8px) scale(.98); }
}

@media (max-width: 1180px) {
    .flow-studio {
        grid-template-columns: 220px minmax(430px, 1fr) 270px;
    }

    .flow-node {
        width: 152px;
    }
}

@media (max-width: 1180px) {
    .flow-page {
        padding-bottom: 76px;
    }

    .flow-studio {
        position: relative;
        grid-template-columns: 230px minmax(0, 1fr);
        min-height: 660px;
    }

    .flow-inspector {
        position: absolute;
        z-index: 8;
        top: 0;
        bottom: 0;
        right: 0;
        width: min(330px, 90vw);
        border-left: 1px solid var(--flow-line);
        box-shadow: -24px 0 60px rgba(0,0,0,.38);
        transform: translateX(105%);
        transition: transform .25s ease;
    }

    .flow-studio.has-inspector .flow-inspector {
        transform: translateX(0);
    }

    .flow-run-dock {
        grid-template-columns: 1fr auto;
    }

    .flow-run-progress {
        grid-column: 1 / -1;
        grid-row: 2;
        padding: 2px 16px 4px;
    }
}

@media (max-width: 700px) {
    .flow-page.active {
        gap: 8px;
    }

    .flow-command-bar {
        min-height: 58px;
        padding: 9px 10px;
    }

    .flow-command-copy span:not(.flow-live-mark),
    #flow-run,
    .flow-icon-button {
        display: none;
    }

    #flow-trigger-settings {
        width: 36px;
        padding: 0;
        justify-content: center;
        font-size: 0;
    }

    .flow-primary-button {
        height: 36px;
        padding: 0 12px;
    }

    .flow-studio {
        display: block;
        min-height: calc(100vh - 255px);
        border-radius: 17px;
    }

    .flow-library {
        position: absolute;
        z-index: 10;
        inset: 0 auto 0 0;
        width: min(310px, 88vw);
        transform: translateX(-105%);
        transition: transform .25s ease;
        box-shadow: 25px 0 65px rgba(0,0,0,.4);
    }

    .flow-studio.has-library .flow-library {
        transform: translateX(0);
    }

    .flow-canvas-shell {
        height: calc(100vh - 255px);
    }

    .flow-canvas {
        min-height: 480px;
    }

    .flow-breadcrumb > span,
    .flow-breadcrumb > i {
        display: none;
    }

    .flow-node {
        width: 146px;
        min-height: 68px;
        padding: 9px 10px;
    }

    .flow-field-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .flow-add-matcher {
        width: 100%;
        white-space: normal;
    }

    .flow-matcher-row {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 28px;
    }

    .flow-matcher-row [data-matcher-path] {
        grid-column: 1 / -1;
    }

    .flow-canvas-hint {
        display: none;
    }

    .flow-add-node {
        bottom: 12px;
        left: 12px;
    }

    .flow-run-dock {
        min-height: 62px;
        grid-template-columns: 1fr auto;
        gap: 8px;
        padding: 8px 9px;
    }

    .flow-run-progress {
        overflow-x: auto;
        padding-inline: 4px;
    }

    .flow-run-progress span {
        min-width: 68px;
    }

    .flow-run-summary time {
        display: none;
    }

    .flow-trace-button {
        width: 40px;
        font-size: 0;
        padding: 0;
    }

    .flow-trace-button span {
        font-size: 16px;
        margin: 0;
    }

    .flow-tool-results {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .flow-live-mark i,
    .flow-list-item[data-state="waiting"] .flow-list-state,
    .flow-edge.is-live,
    .flow-node[data-state="live"]::after,
    .flow-run-pulse i,
    .flow-run-progress .is-live i {
        animation: none;
    }
}

/* Chat v2 — conversation-first workspace */
.chat-v2 {
    --chat-line: rgba(137, 183, 226, .13);
    --chat-line-strong: rgba(91, 194, 255, .28);
    --chat-blue: #4cc7ff;
    --chat-blue-soft: rgba(50, 176, 255, .11);
    --chat-violet: #8c73ff;
    --chat-panel: rgba(7, 14, 26, .94);
    --chat-canvas: #070d18;
}

#page-chat.chat-v2 {
    height: calc(100vh - 72px);
    background: var(--chat-canvas);
}

.chat-v2 .chat-stage {
    grid-template-columns: 276px minmax(0, 1fr);
    background: var(--chat-canvas);
}

.chat-v2 .chat-library {
    min-height: 0;
    overflow: hidden;
    grid-template-rows: auto auto auto auto minmax(0, 1fr);
    border-inline-end: 1px solid var(--chat-line);
    background: var(--chat-panel);
    backdrop-filter: none;
}

/* Five sidebar blocks share the library grid: head, search, date, caption,
   then the scrolling list. Every child is pinned so nothing overflows into
   an implicit row and overlaps its neighbour. */
.chat-v2 .chat-library-head { grid-row: 1; }
.chat-v2 .chat-library-search { grid-row: 2; }
.chat-v2 .chat-library-date { grid-row: 3; }
.chat-v2 .chat-library-caption { grid-row: 4; }
.chat-v2 .conversations-list { grid-row: 5; }

.chat-v2 .chat-library-head {
    min-height: 70px;
    padding: 14px 16px 10px;
}

.chat-library-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-library-title > div {
    display: grid;
    gap: 1px;
}

.chat-library-title small { display: flex; align-items: center; gap: 8px; padding: 0 4px 8px; }
.chat-v2 .chat-library-date { margin: 0 12px 10px; padding: 0; display: flex; align-items: center; gap: 8px; }
.chat-library-date input { flex: 1; min-width: 0; min-height: 32px; padding: 5px 9px; color: #cfe6f7; border: 1px solid var(--line); border-radius: 9px; background: transparent; font-size: .64rem; }
.chat-date-clear { min-height: 30px; padding: 4px 10px; color: #6c859d; border: 1px solid var(--line); border-radius: 9px; background: transparent; font-size: .6rem; }
.chat-date-clear:hover { color: #d9f4ff; border-color: rgba(76, 184, 250, .28); }

.chat-library-caption,
.chat-library-foot {
    color: #667b94;
    font-size: 9px;
    letter-spacing: .04em;
}

.chat-library-title strong {
    font-size: 17px;
    font-weight: 650;
}

.chat-library-mark {
    width: 27px;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    position: relative;
    border: 1px solid rgba(77, 190, 255, .18);
    border-radius: 9px;
    background: linear-gradient(145deg, rgba(76, 199, 255, .14), rgba(140, 115, 255, .1));
}

.chat-library-mark::before,
.chat-library-mark::after,
.chat-library-mark i {
    content: "";
    position: absolute;
    border-radius: 50%;
}

.chat-library-mark::before {
    width: 9px;
    height: 9px;
    border: 1px solid rgba(110, 216, 255, .65);
}

.chat-library-mark::after {
    width: 3px;
    height: 3px;
    background: #9d83ff;
    box-shadow: -7px 5px #4cc7ff, 7px -4px #4cc7ff;
}

.chat-library-mark i {
    inset: 4px;
    border: 1px solid rgba(123, 118, 255, .2);
    animation: chat-core-spin 9s linear infinite;
}

.chat-v2 .btn-new-chat {
    min-height: 36px;
    padding: 0 10px;
    gap: 6px;
    border-color: rgba(73, 192, 255, .22);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(50, 174, 255, .17), rgba(116, 95, 242, .11));
    color: #ccefff;
}

.chat-v2 .btn-new-chat > span {
    font-size: 18px;
    font-weight: 300;
}

.chat-v2 .btn-new-chat b {
    font-size: 10px;
}

.chat-v2 .chat-library-search {
    height: 38px;
    margin: 0 12px 10px;
    border: 1px solid transparent;
    border-radius: 11px;
    background: rgba(12, 23, 39, .75);
    transition: border-color .2s ease, background .2s ease;
}

.chat-v2 .chat-library-search:focus-within {
    border-color: rgba(75, 195, 255, .28);
    background: rgba(13, 27, 46, .94);
}

.chat-v2 .chat-library-search input {
    font-size: 11px;
}

.chat-library-caption {
    padding: 6px 17px 8px;
    display: flex;
    justify-content: space-between;
    text-transform: uppercase;
}

.chat-library-caption span:last-child {
    min-width: 22px;
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(77, 175, 255, .08);
    text-align: center;
}

.chat-v2 .conversations-list {
    min-height: 0;
    min-width: 0;
    margin: 0;
    padding: 0 8px 14px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--chat-violet) 46%, var(--chat-line-strong)) transparent;
}

.chat-v2 .conversations-list::-webkit-scrollbar {
    width: 10px;
}

.chat-v2 .conversations-list::-webkit-scrollbar-track {
    background: transparent;
}

.chat-v2 .conversations-list::-webkit-scrollbar-thumb {
    border: 3px solid transparent;
    border-width: 0 3px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--chat-violet) 46%, var(--chat-line-strong));
    background-clip: padding-box;
}

.chat-v2 .conv-item {
    min-height: 62px;
    margin: 2px 0;
    padding: 10px 11px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 13px;
    cursor: pointer;
}

.chat-v2 .conv-item:hover {
    border-color: rgba(114, 172, 224, .1);
    background: rgba(18, 32, 52, .55);
}

.chat-v2 .conv-item.active {
    border-color: rgba(74, 191, 255, .17);
    background:
        linear-gradient(90deg, rgba(56, 155, 255, .13), rgba(108, 88, 237, .06)),
        rgba(13, 25, 43, .8);
    box-shadow: none;
}

.chat-v2 .conv-item.active::before {
    content: "";
    position: absolute;
    inset-inline-start: 2px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 28px;
    border-radius: 999px;
    background: linear-gradient(#4cc7ff, #8c73ff);
    box-shadow: 0 0 14px rgba(76, 199, 255, .45);
    pointer-events: none;
}

.chat-v2 .conv-item {
    position: relative;
}

.chat-v2 .conv-info {
    min-width: 0;
    display: grid;
    gap: 5px;
    overflow: hidden;
}

.chat-v2 .conv-title {
    min-width: 0;
    overflow: hidden;
    color: #d9e6f5;
    font-size: 11px;
    font-weight: 560;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-v2 .conv-meta {
    min-width: 0;
    overflow: hidden;
    color: #5f7186;
    font-size: 9px;
    font-variant-numeric: tabular-nums;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-v2 .btn-delete-conv {
    width: 28px;
    height: 28px;
    min-height: 28px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #64778e;
    font-size: 0;
    opacity: 0;
    transition: opacity .2s ease, background .2s ease, color .2s ease;
}

.chat-v2 .btn-delete-conv::before {
    content: "×";
    font-size: 16px;
}

.chat-v2 .conv-item:hover .btn-delete-conv,
.chat-v2 .btn-delete-conv:focus-visible {
    opacity: 1;
}

.chat-v2 .btn-delete-conv:hover {
    background: rgba(255, 100, 130, .08);
    color: #ff89a2;
}

.chat-v2 .chat-library-foot {
    min-height: 44px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    border-top: 1px solid rgba(121, 162, 203, .08);
}

.chat-v2 .chat-library-foot span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.chat-v2 .chat-library-foot i,
.chat-zero-kicker i,
.chat-channel-light i {
    width: 5px;
    height: 5px;
    display: inline-block;
    border-radius: 50%;
    background: #4cc7ff;
    box-shadow: 0 0 10px rgba(76, 199, 255, .7);
}

.chat-v2 .chat-canvas {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 68px auto minmax(0, 1fr) auto;
    background: var(--chat-canvas);
}

.chat-v2 .chat-context-bar {
    min-height: 68px;
    padding: 10px clamp(16px, 2.6vw, 34px);
    border-color: var(--chat-line);
    background: var(--chat-panel);
    backdrop-filter: none;
}

.chat-v2 .chat-active-copy {
    gap: 11px;
}

.chat-v2 .chat-active-copy h3 {
    color: #eef7ff;
    font-size: 13px;
    font-weight: 610;
}

.chat-v2 .chat-active-copy p {
    max-width: 460px;
    color: #687b91;
    font-size: 9px;
}

.chat-v2 .chat-presence {
    width: 38px;
    height: 38px;
    border-color: rgba(81, 191, 255, .18);
    border-radius: 13px;
    background: linear-gradient(145deg, rgba(63, 172, 255, .12), rgba(120, 91, 242, .08));
    overflow: visible;
}

.chat-v2 .chat-presence img {
    width: 26px;
    height: 26px;
    border-radius: 9px;
    object-fit: cover;
}

.chat-v2 .chat-presence i {
    width: 7px;
    height: 7px;
    position: absolute;
    inset-inline-end: -2px;
    bottom: -1px;
    border: 2px solid #07101d;
    background: #4cc7ff;
    animation: chat-presence 2.4s ease-in-out infinite;
}

.chat-v2 .chat-context-tools {
    gap: 7px;
}

.chat-v2 .chat-inline-search {
    width: 170px;
    height: 38px;
    border: 1px solid transparent;
    border-radius: 11px;
    background: rgba(14, 25, 41, .7);
}

.chat-v2 .chat-inline-search:focus-within {
    border-color: rgba(76, 199, 255, .22);
}

.chat-v2 .chat-channel-select {
    min-height: 38px;
    padding: 0 6px 0 9px;
    border: 1px solid rgba(111, 165, 214, .1);
    border-radius: 11px;
    background: rgba(14, 25, 41, .7);
}

.chat-v2 .chat-channel-select select {
    min-height: 36px;
    padding: 0 4px;
    color: #a8bad0;
    font-size: 10px;
}

.chat-live-activity {
    width: min(calc(100% - 42px), 820px);
    min-height: 54px;
    margin: 8px auto 0;
    padding: 9px 12px;
    display: grid;
    grid-template-columns: auto minmax(120px, auto) minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(77, 190, 255, .17);
    border-radius: 12px;
    background: var(--chat-panel);
    box-shadow: none;
    animation: chat-activity-in .26s ease both;
}

.chat-live-activity[hidden] {
    display: none;
}

.chat-activity-indicator {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--chat-violet);
    box-shadow: 0 0 10px color-mix(in srgb, var(--chat-violet) 55%, transparent);
    animation: chat-step-live 1.2s ease-in-out infinite;
}

.chat-activity-copy {
    display: grid;
    gap: 1px;
}

.chat-activity-copy small {
    color: #657b93;
    font-size: 8px;
}

.chat-activity-copy strong {
    color: #ccecff;
    font-size: 10px;
    font-weight: 570;
}

.chat-live-steps {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.chat-live-steps span {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #60748b;
    font-size: 8px;
    white-space: nowrap;
    position: relative;
}

.chat-live-steps span:not(:last-child)::after {
    content: "";
    width: 24px;
    height: 1px;
    margin-inline: 7px;
    background: linear-gradient(90deg, rgba(76, 199, 255, .5), rgba(140, 115, 255, .2));
}

.chat-live-steps span > i {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-radius: 50%;
    border: 1px solid #34465b;
    background: #0a1422;
}

.chat-live-steps span.is-done {
    color: #8fa8bf;
}

.chat-live-steps span.is-done > i {
    border-color: rgba(76, 199, 255, .7);
    background: #4cc7ff;
    box-shadow: 0 0 9px rgba(76, 199, 255, .35);
}

.chat-live-steps span.is-live {
    color: #dcefff;
}

.chat-live-steps span.is-live > i {
    border-color: #9a82ff;
    background: #9a82ff;
    box-shadow: 0 0 10px rgba(154, 130, 255, .7);
    animation: chat-step-live 1.2s ease-in-out infinite;
}

.chat-live-steps span > b {
    max-width: 190px;
    overflow: hidden;
    font: inherit;
    text-overflow: ellipsis;
}

.chat-live-activity > time {
    color: #53667c;
    font-size: 8px;
}

.chat-v2 .chat-messages-container {
    padding: 22px max(22px, calc((100% - 840px) / 2)) 20px;
    scroll-behavior: smooth;
}

.chat-v2 .chat-zero-state {
    min-height: 100%;
    padding: 28px 0 52px;
}

.chat-zero-logo {
    width: 48px;
    height: 48px;
    margin-bottom: 14px;
    border-radius: 15px;
    object-fit: cover;
}

.chat-zero-kicker {
    margin-bottom: 9px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #7b91aa;
    font-size: 9px;
}

.chat-v2 .chat-zero-state p {
    color: #edf7ff;
    font-size: clamp(26px, 3.2vw, 38px);
    font-weight: 520;
    letter-spacing: -.035em;
}

.chat-v2 .chat-zero-state > small {
    max-width: 520px;
    color: #71849b;
    font-size: 11px;
}

.chat-starter-grid {
    width: min(100%, 680px);
    margin-top: 30px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.chat-starter-grid button {
    min-height: 82px;
    padding: 13px 14px;
    display: grid;
    align-content: center;
    justify-items: start;
    gap: 5px;
    border: 1px solid rgba(111, 165, 214, .1);
    border-radius: 15px;
    background: rgba(12, 22, 37, .55);
    text-align: start;
    transition: transform .2s ease, border-color .2s ease, background .2s ease;
}

.chat-starter-grid button:hover {
    transform: translateY(-2px);
    border-color: rgba(72, 192, 255, .24);
    background: linear-gradient(145deg, rgba(34, 112, 190, .12), rgba(86, 69, 179, .07));
}

.chat-starter-grid span {
    color: #cbdced;
    font-size: 11px;
    font-weight: 580;
}

.chat-starter-grid small {
    color: #5e7289;
    font-size: 9px;
    line-height: 1.45;
}

.chat-v2 .chat-bubble-wrapper {
    width: 100%;
    max-width: 100%;
    margin: 0 0 26px;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: start;
    column-gap: 12px;
}

.chat-v2 .chat-bubble-wrapper.user {
    width: min(78%, 660px);
    margin-inline-start: auto;
    grid-template-columns: minmax(0, 1fr);
}

.chat-v2 .chat-bubble-header {
    grid-column: 2;
    margin: 0 0 6px;
    display: flex;
    align-items: center;
    gap: 7px;
    color: #657a91;
    font-size: 8px;
}

.chat-v2 .chat-message-metrics {
    color: #52677e;
    font-variant-numeric: tabular-nums;
}

.chat-message-details {
    position: relative;
    color: var(--ink-3);
}

.chat-message-details summary {
    cursor: pointer;
    list-style: none;
}

.chat-message-details summary::-webkit-details-marker {
    display: none;
}

.chat-message-details > span {
    width: max-content;
    max-width: min(360px, 72vw);
    padding: 7px 9px;
    position: absolute;
    z-index: 4;
    inset-block-start: calc(100% + 5px);
    inset-inline-start: 0;
    color: var(--ink-2);
    border: 1px solid var(--chat-line);
    border-radius: 9px;
    background: var(--chat-panel);
    box-shadow: var(--shadow-md);
    line-height: 1.5;
}

.chat-v2 .chat-bubble-wrapper.user .chat-bubble-header {
    grid-column: 1;
    justify-content: flex-end;
}

.chat-v2 .assistant-mini-mark {
    width: 28px;
    height: 28px;
    position: absolute;
    margin-inline-start: -46px;
    border-radius: 9px;
}

.chat-v2 .chat-bubble {
    grid-column: 2;
    padding: 0;
    border-radius: 0;
    background: transparent;
    color: #d8e5f2;
    font-size: 12px;
    line-height: 1.85;
}

.chat-v2 .chat-bubble-wrapper.user .chat-bubble {
    grid-column: 1;
    padding: 12px 15px;
    border: 1px solid rgba(79, 185, 255, .15);
    border-radius: 17px 17px 5px 17px;
    background: linear-gradient(145deg, rgba(28, 91, 149, .32), rgba(42, 63, 115, .24));
    color: #e7f4ff;
}

.chat-v2 .chat-bubble pre {
    padding: 14px;
    overflow-x: auto;
    border: 1px solid var(--chat-line);
    border-radius: 12px;
    background: #0b0f16;
}

.chat-v2 .chat-bubble code {
    color: #a8c0ff;
}

.chat-v2 .bubble-quote {
    margin-bottom: 9px;
    padding: 8px 10px;
    display: block;
    border-inline-start: 2px solid #8c73ff;
    border-radius: 7px;
    background: rgba(116, 93, 223, .08);
    color: #94a9bf;
    font-size: 10px;
}

.chat-v2 .bubble-actions-trigger {
    grid-column: 2;
    margin-top: 7px;
    opacity: 0;
    transition: opacity .2s ease;
}

.chat-v2 .chat-bubble-wrapper.user .bubble-actions-trigger {
    grid-column: 1;
    justify-self: end;
}

.chat-v2 .chat-bubble-wrapper:hover .bubble-actions-trigger {
    opacity: 1;
}

.chat-v2 .btn-reply-bubble {
    min-height: 26px;
    padding: 0 8px;
    border: 1px solid var(--chat-line);
    border-radius: 8px;
    background: transparent;
    color: #71869c;
    font-size: 9px;
}

.chat-v2 .chat-composer {
    width: min(calc(100% - 38px), 860px);
    padding-bottom: 10px;
}

.chat-v2 .quoted-preview-box {
    margin-bottom: 7px;
    padding: 9px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(132, 104, 239, .18);
    border-radius: 12px;
    background: rgba(82, 63, 166, .09);
}
.chat-v2 .quoted-preview-box[hidden] {
    display: none;
}

.chat-v2 .chat-compose-shell {
    min-height: 64px;
    padding: 8px 9px 8px 12px;
    gap: 10px;
    border-color: rgba(113, 172, 224, .16);
    border-radius: 20px;
    background:
        linear-gradient(145deg, rgba(17, 32, 52, .92), rgba(9, 20, 35, .94));
    box-shadow: 0 22px 65px rgba(0, 0, 0, .34);
}

.chat-v2 .chat-compose-shell:focus-within {
    border-color: rgba(73, 194, 255, .46);
    box-shadow:
        0 0 0 3px rgba(66, 181, 255, .07),
        0 22px 70px rgba(0, 0, 0, .38);
}

.chat-compose-spark {
    width: 28px;
    height: 44px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
}

.chat-compose-spark i {
    width: 7px;
    height: 7px;
    position: relative;
    border-radius: 50%;
    background: linear-gradient(145deg, #6fd9ff, #8c73ff);
    box-shadow: 0 0 15px rgba(76, 199, 255, .42);
}

.chat-compose-spark i::before,
.chat-compose-spark i::after {
    content: "";
    position: absolute;
    inset: -5px;
    border: 1px solid rgba(76, 199, 255, .13);
    border-radius: 50%;
}

.chat-compose-spark i::after {
    inset: -10px;
    border-color: rgba(140, 115, 255, .08);
}

.chat-v2 .chat-compose-shell textarea {
    color: #e5f1fb;
    font-size: 12px;
}

.chat-v2 .btn-send-chat {
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 15px;
    background: linear-gradient(145deg, #43c4ff, #347cca 58%, #6756d6);
    color: white;
    box-shadow: 0 8px 26px rgba(49, 148, 230, .24);
    transition: transform .2s ease, filter .2s ease, opacity .2s ease;
}

.chat-v2 .btn-send-chat:not(:disabled):hover {
    transform: translateY(-1px) scale(1.02);
    filter: brightness(1.08);
}

.chat-v2 .btn-send-chat:disabled {
    background: #172538;
    color: #52667e;
    box-shadow: none;
}

.chat-v2 .chat-composer-meta {
    padding: 7px 8px 0;
    color: #506278;
    font-size: 8px;
}

.chat-v2 .chat-composer-meta kbd {
    padding: 1px 4px;
    border: 1px solid rgba(119, 159, 200, .13);
    border-radius: 4px;
    background: rgba(11, 20, 33, .7);
    color: #71869d;
    font: inherit;
}

.chat-v2 .chat-list-empty,
.chat-v2 .chat-zero-state-error {
    padding: 30px 16px;
    color: #6c8097;
    text-align: center;
}

.chat-v2 .chat-list-empty {
    display: grid;
    gap: 5px;
}

.chat-v2 .chat-list-empty strong {
    color: #a9bbce;
    font-size: 11px;
}

.chat-v2 .chat-list-empty span {
    font-size: 9px;
}

.chat-system-notice {
    width: min(100%, 620px);
    margin: 16px auto;
    padding: 12px 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: 1px solid rgba(255, 116, 144, .16);
    border-radius: 13px;
    background: rgba(94, 31, 48, .1);
    color: #d4a4b0;
    font-size: 10px;
}

.chat-system-notice i {
    width: 7px;
    height: 7px;
    margin-top: 4px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #ff7895;
    box-shadow: 0 0 12px rgba(255, 120, 149, .45);
}

.chat-system-notice--retry {
    align-items: center;
    flex-wrap: wrap;
}

.chat-notice-retry-btn {
    margin-inline-start: auto;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 120, 149, .45);
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.chat-notice-retry-btn:hover:not(:disabled) {
    background: rgba(255, 120, 149, .14);
}

.chat-notice-retry-btn:disabled {
    opacity: .55;
    cursor: wait;
}

@keyframes chat-core-spin {
    to { transform: rotate(360deg); }
}

@keyframes chat-presence {
    50% { box-shadow: 0 0 15px rgba(76, 199, 255, .72); }
}

@keyframes chat-core-pulse {
    0% { opacity: .8; transform: scale(.7); }
    75%, 100% { opacity: 0; transform: scale(1.2); }
}

@keyframes chat-thinking-core {
    50% { transform: scale(.72); filter: brightness(1.35); }
}

@keyframes chat-step-live {
    50% { transform: scale(1.45); }
}

@keyframes chat-activity-in {
    from { opacity: 0; transform: translateY(-5px) scale(.99); }
}

@keyframes chat-orbit-breathe {
    50% { opacity: .45; transform: scale(1.035); }
}

@media (max-width: 980px) {
    .chat-v2 .chat-stage {
        grid-template-columns: 230px minmax(0, 1fr);
    }

    .chat-v2 .chat-inline-search {
        display: none;
    }

    .chat-live-steps span:nth-child(n+3) {
        display: none;
    }
}

@media (max-width: 700px) {
    #page-chat.chat-v2 {
        height: calc(100dvh - 136px);
    }

    .chat-v2 .chat-stage {
        display: block;
        position: relative;
    }

    .chat-v2 .chat-library {
        width: min(318px, 89vw);
        position: absolute;
        z-index: 20;
        inset: 0 auto 0 0;
        transform: translateX(-104%);
        transition: transform .25s ease;
        box-shadow: 25px 0 70px rgba(0, 0, 0, .44);
    }

    .chat-v2.chat-library-open .chat-library {
        transform: translateX(0);
    }

    .chat-v2 .chat-canvas {
        height: 100%;
        min-width: 0;
        grid-template-rows: 64px auto minmax(0, 1fr) auto;
        contain: inline-size;
        container-type: inline-size;
        overflow: hidden;
    }

    .chat-v2 .chat-context-bar {
        min-height: 64px;
        padding: 8px 11px;
    }

    .chat-v2 .chat-library-toggle {
        width: 36px;
        height: 36px;
        padding: 0;
        display: grid;
        place-items: center;
        border: 1px solid var(--chat-line);
        border-radius: 11px;
        background: rgba(14, 25, 41, .72);
        color: #84a2bd;
    }

    .chat-v2 .chat-library-toggle svg {
        width: 17px;
        height: 17px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.7;
    }

    .chat-v2 .chat-active-copy {
        flex: 1;
    }

    .chat-v2 .chat-presence {
        width: 34px;
        height: 34px;
    }

    .chat-v2 .chat-active-copy p {
        max-width: 180px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .chat-v2 .chat-channel-select {
        width: auto;
        min-width: 72px;
        padding: 0 7px;
        justify-content: center;
    }

    .chat-v2 .chat-channel-select select {
        width: auto;
        max-width: 58px;
        padding: 0;
        color: #8196ad;
        appearance: none;
        background-image: none;
    }

    .chat-live-activity {
        width: calc(100cqi - 18px);
        max-width: calc(100cqi - 18px);
        min-width: 0;
        margin: 7px 0 0;
        justify-self: center;
        grid-template-columns: auto minmax(0, 1fr) auto;
        overflow: hidden;
    }

    .chat-live-steps {
        display: none;
    }

    .chat-v2 .chat-messages-container {
        width: 100cqi;
        min-width: 0;
        padding: 20px 13px 12px;
        overflow-x: hidden;
    }

    .chat-v2 .chat-zero-state {
        justify-content: flex-start;
        padding-top: 42px;
    }

    .chat-v2 .chat-zero-state p {
        font-size: 25px;
    }

    .chat-v2 .chat-zero-state > small {
        padding-inline: 18px;
        font-size: 10px;
    }

    .chat-starter-grid {
        margin-top: 22px;
        padding: 0 4px;
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .chat-starter-grid button {
        min-height: 58px;
        padding: 10px 12px;
    }

    .chat-v2 .chat-bubble-wrapper.user {
        width: 88%;
    }

    .chat-v2 .chat-bubble-wrapper {
        grid-template-columns: 28px minmax(0, 1fr);
        column-gap: 9px;
    }

    .chat-v2 .assistant-mini-mark {
        width: 24px;
        height: 24px;
        margin-inline-start: -37px;
    }

    .chat-v2 .chat-composer {
        width: calc(100cqi - 14px);
        max-width: calc(100cqi - 14px);
        min-width: 0;
        margin-inline: 0;
        justify-self: center;
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }

    .chat-v2 .chat-compose-shell {
        width: 100%;
        min-width: 0;
        min-height: 58px;
        border-radius: 18px;
    }

    .chat-v2 .chat-compose-shell textarea {
        width: 100%;
        min-width: 0;
    }

    .chat-compose-spark {
        display: none;
    }

    .chat-v2 .chat-composer-meta span:last-child {
        display: none;
    }
}

/* ──── Chat redesign: quiet, minimal, ChatGPT-grade (overrides above) ──── */

/* Canvas: flat, no decorative glow. */
.chat-v2 .chat-canvas {
    background: var(--chat-canvas);
}

/* Sidebar head: one calm row. */
.chat-v2 .chat-library-head {
    min-height: 64px;
    padding: 14px 14px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.chat-library-title {
    margin: 0;
    font-size: 16px;
    font-weight: 650;
}
.chat-v2 .btn-new-chat {
    min-height: 34px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--chat-line-strong);
    border-radius: 10px;
    background: transparent;
    color: var(--ink);
    box-shadow: none;
}
.chat-v2 .btn-new-chat svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}
.chat-v2 .btn-new-chat b {
    font-size: 11px;
    font-weight: 600;
}
.chat-v2 .btn-new-chat:hover {
    border-color: rgba(76, 199, 255, .35);
    background: rgba(76, 199, 255, .06);
}
.chat-v2 .chat-library-date {
    margin: 0 12px 8px;
    display: flex;
    gap: 6px;
}
.chat-v2 .chat-library-date input {
    flex: 1;
    min-width: 0;
}
.chat-date-clear {
    flex: 0 0 auto;
}

/* Header: no logo, no glow — the chat is the center. */
.chat-v2 .chat-context-bar {
    background: transparent;
    border-color: var(--chat-line);
}
.chat-context-start {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}
.chat-v2 .chat-active-copy h3 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chat-title-fresh {
    animation: chat-title-in .45s ease both;
}
@keyframes chat-title-in {
    from { opacity: 0; transform: translateY(3px); }
}
.chat-details-btn {
    min-height: 36px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--ink-3);
    font-size: 11px;
    white-space: nowrap;
}
.chat-details-btn svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
}
.chat-details-btn:hover:not(:disabled) {
    border-color: var(--chat-line);
    color: var(--ink);
}
.chat-details-btn:disabled {
    opacity: .45;
    cursor: default;
}
.chat-find-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}
.chat-find-nav {
    display: flex;
    align-items: center;
    gap: 2px;
}
.chat-find-nav[hidden] {
    display: none;
}
.chat-find-count {
    padding: 0 6px;
    color: var(--ink-3);
    font-size: 10px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.chat-find-btn {
    width: 26px;
    height: 26px;
    min-height: 26px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--ink-3);
    font-size: 15px;
    line-height: 1;
}
.chat-find-btn:hover {
    background: var(--surface-2);
    color: var(--ink);
}

/* Messages: direction-correct bubbles. */
.chat-v2 .chat-messages-container {
    max-width: 100%;
}
.chat-msg {
    max-width: min(78%, 700px);
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    animation: message-enter 300ms var(--ease) both;
}
html[dir="rtl"] .chat-msg.is-user { margin-left: auto; margin-right: 0; }
html[dir="rtl"] .chat-msg.is-diane { margin-right: auto; margin-left: 0; }
html[dir="ltr"] .chat-msg.is-user { margin-right: 0; margin-left: auto; }
html[dir="ltr"] .chat-msg.is-diane { margin-right: auto; margin-left: 0; }
.chat-msg .chat-bubble {
    width: fit-content;
    max-width: 100%;
    min-width: 0;
    padding: 12px 15px;
    border-radius: 16px;
    line-height: 1.8;
    overflow-wrap: break-word;
    word-break: break-word;
}
/* A bubble takes its natural width and is pinned to its own side of the
   message column on every direction, so a short reply hugs its text instead
   of stretching across the reading column. */
html[dir="rtl"] .chat-msg.is-user .chat-bubble { margin-inline-end: auto; }
html[dir="rtl"] .chat-msg.is-diane .chat-bubble { margin-inline-start: auto; }
html[dir="ltr"] .chat-msg.is-user .chat-bubble { margin-inline-start: auto; }
html[dir="ltr"] .chat-msg.is-diane .chat-bubble { margin-inline-end: auto; }
html[dir="rtl"] .chat-msg.is-user .chat-bubble {
    border-bottom-right-radius: 5px;
    border: 1px solid rgba(79, 185, 255, .14);
    background: rgba(24, 78, 128, .42);
    color: #e7f4ff;
}
html[dir="ltr"] .chat-msg.is-user .chat-bubble {
    border-bottom-left-radius: 5px;
    border: 1px solid rgba(79, 185, 255, .14);
    background: rgba(24, 78, 128, .42);
    color: #e7f4ff;
}
.chat-msg.is-diane .chat-bubble {
    padding: 2px 0;
    background: transparent;
    color: #d8e5f2;
}
.chat-msg .chat-bubble pre {
    max-width: 100%;
    overflow-x: auto;
}
.chat-msg img.chat-frame-image,
.chat-msg img.chat-generated-image,
.chat-msg video {
    max-width: 100%;
    border-radius: 12px;
    margin-top: 8px;
    display: block;
}
.chat-msg audio {
    width: 100%;
    margin-top: 8px;
    display: block;
}
.chat-msg-meta {
    width: fit-content;
    max-width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ink-3);
    font-size: 9px;
    font-variant-numeric: tabular-nums;
}
/* Meta and the hover toolbar sit under the bubble and are pinned to the same
   side as the bubble itself: right for the owner, left for Diane — in both
   directions. The old align-self rules inverted on RTL and stranded the
   toolbar on the opposite edge; the margin pins keep it in place. */
html[dir="rtl"] .chat-msg.is-user .chat-msg-meta { margin-inline-end: auto; }
html[dir="rtl"] .chat-msg.is-user .chat-msg-tools { margin-inline-end: auto; }
html[dir="rtl"] .chat-msg.is-diane .chat-msg-meta { margin-inline-start: auto; }
html[dir="rtl"] .chat-msg.is-diane .chat-msg-tools { margin-inline-start: auto; }
html[dir="ltr"] .chat-msg.is-user .chat-msg-meta { margin-inline-start: auto; }
html[dir="ltr"] .chat-msg.is-user .chat-msg-tools { margin-inline-start: auto; }
html[dir="ltr"] .chat-msg.is-diane .chat-msg-meta { margin-inline-end: auto; }
html[dir="ltr"] .chat-msg.is-diane .chat-msg-tools { margin-inline-end: auto; }
.chat-tools-chip {
    padding: 1px 8px;
    border: 1px solid var(--chat-line);
    border-radius: 999px;
    font-size: 8px;
}
.chat-cost-chip {
    padding: 1px 8px;
    border: 1px solid rgba(126, 229, 170, .2);
    border-radius: 999px;
    color: #7fd4a0;
    font-size: 8px;
    font-variant-numeric: tabular-nums;
}
/* Per-message usage disclosure: a quiet "פרטים" pill that opens the exact
   tokens, the cost from the price table, and the response time. */
.chat-msg .chat-message-details {
    position: relative;
    display: inline-block;
    color: var(--ink-3);
}
.chat-msg .chat-message-details summary {
    cursor: pointer;
    list-style: none;
    padding: 1px 8px;
    border: 1px solid var(--chat-line);
    border-radius: 999px;
    font-size: 8px;
    letter-spacing: .03em;
    transition: border-color .16s ease, color .16s ease;
}
.chat-msg .chat-message-details summary::-webkit-details-marker { display: none; }
.chat-msg .chat-message-details summary:hover {
    border-color: rgba(76, 199, 255, .3);
    color: #cfe4f7;
}
.chat-msg .chat-message-details[open] summary {
    border-color: rgba(76, 199, 255, .32);
    color: #cfe4f7;
}
.chat-msg .chat-message-details > span {
    width: max-content;
    max-width: min(380px, 72vw);
    padding: 8px 11px;
    position: absolute;
    z-index: 5;
    inset-block-start: calc(100% + 6px);
    inset-inline-start: 0;
    color: var(--ink-2);
    border: 1px solid var(--chat-line);
    border-radius: 10px;
    background: var(--chat-panel);
    box-shadow: 0 10px 28px rgba(2, 8, 16, .38);
    font-size: 9px;
    line-height: 1.65;
    white-space: normal;
}
.chat-msg-tools {
    width: fit-content;
    max-width: 100%;
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity .18s ease;
}
.chat-msg:hover .chat-msg-tools,
.chat-msg:focus-within .chat-msg-tools {
    opacity: 1;
}
@media (hover: none) {
    .chat-msg-tools { opacity: 1; }
}
.chat-tool-btn {
    width: 28px;
    height: 28px;
    min-height: 28px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ink-3);
}
.chat-tool-btn svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.chat-tool-btn:hover {
    background: var(--surface-2);
    color: var(--ink);
}
.chat-tool-btn:focus-visible {
    outline: 2px solid rgba(76, 199, 255, .6);
    outline-offset: 1px;
    opacity: 1;
}
.chat-msg.find-active .chat-bubble {
    outline: 1px solid rgba(76, 199, 255, .4);
    outline-offset: 2px;
}
.chat-msg.flash .chat-bubble {
    animation: chat-flash 1.8s ease both;
}
@keyframes chat-flash {
    0%, 100% { background-color: transparent; }
    15%, 55% { background-color: rgba(76, 199, 255, .12); }
}
.chat-msg.is-user.flash .chat-bubble {
    animation-name: chat-flash-user;
}
@keyframes chat-flash-user {
    0%, 100% { filter: none; }
    15%, 55% { filter: brightness(1.5); }
}
mark.chat-find-hit {
    padding: 0 1px;
    border-radius: 3px;
    background: rgba(232, 197, 71, .32);
    color: inherit;
}
mark.chat-find-hit.is-active {
    background: rgba(76, 199, 255, .5);
    color: #fff;
}

/* Inline agent activity: quiet trace, not a debug console. */
.chat-activity {
    max-width: min(78%, 700px);
    margin: 0 0 20px;
    padding: 10px 12px;
    border: 1px solid var(--chat-line);
    border-inline-start: 2px solid rgba(120, 130, 255, .55);
    border-radius: 12px;
    background: rgba(13, 24, 40, .5);
    box-shadow: none;
}
html[dir="rtl"] .chat-activity { margin-right: 0; margin-left: auto; }
html[dir="ltr"] .chat-activity { margin-right: auto; margin-left: 0; }
.chat-activity-head {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ink-3);
    font-size: 10px;
}
.chat-activity-title {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chat-activity-dots {
    display: inline-flex;
    gap: 3px;
    flex: 0 0 auto;
}
.chat-activity-dots i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #8c83ff;
}
.chat-activity.is-live .chat-activity-dots i {
    animation: chat-step-live 1.1s ease-in-out infinite;
}
.chat-activity.is-live .chat-activity-dots i:nth-child(2) { animation-delay: .18s; }
.chat-activity.is-live .chat-activity-dots i:nth-child(3) { animation-delay: .36s; }
.chat-activity-list {
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 6px;
}
.chat-activity:not(.is-open):not(.is-live) .chat-activity-list {
    display: none;
}
.chat-activity-row {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ink-2);
    font-size: 10px;
    min-width: 0;
}
.chat-activity-row > span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chat-activity-dot {
    width: 6px;
    height: 6px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #3c4f66;
}
.chat-activity-row.is-running .chat-activity-dot {
    background: #8c83ff;
    animation: chat-step-live 1.1s ease-in-out infinite;
}
.chat-activity-row.is-done .chat-activity-dot {
    background: #4cc7a5;
}
.chat-activity-row.is-failed .chat-activity-dot {
    background: #ff7895;
}
.chat-tool-badge {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px 2px 6px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--tool-color, #6f9dc5) 14%, transparent);
    color: var(--ink);
    font-size: 9px;
}
.chat-tool-badge svg {
    width: 12px;
    height: 12px;
    fill: none;
    stroke: var(--tool-color, #6f9dc5);
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.chat-tool-badge b {
    font-weight: 600;
}
.chat-tool-action {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--ink-3);
}
.chat-tool-state {
    flex: 0 0 auto;
    font-size: 8px;
    color: var(--ink-3);
}
.chat-tool-state.is-done { color: #4cc7a5; }
.chat-tool-state.is-failed { color: #ff7895; }
.chat-tool-state.is-running { color: #9a82ff; }
.chat-activity-summary {
    width: 100%;
    min-height: 32px;
    padding: 0 2px;
    display: none;
    align-items: center;
    gap: 7px;
    border: 0;
    background: transparent;
    color: var(--ink-3);
    font-size: 10px;
    cursor: pointer;
}
.chat-activity:not(.is-live) .chat-activity-summary {
    display: inline-flex;
}
.chat-activity-summary svg {
    width: 13px;
    height: 13px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    transform: rotate(-90deg);
    transition: transform .2s ease;
}
.chat-activity.is-open .chat-activity-summary svg {
    transform: rotate(0deg);
}
.chat-activity-summary:hover {
    color: var(--ink);
}
.chat-activity:not(.is-open):not(.is-live) .chat-activity-head {
    display: none;
}

/* Composer: breathing room, stop state, hint. */
.chat-v2 .chat-composer {
    width: min(calc(100% - 48px), 760px);
    padding-bottom: 26px;
}
.chat-v2 .chat-compose-shell {
    border-color: var(--chat-line-strong);
    background: var(--surface-1);
    box-shadow: 0 14px 40px rgba(0, 0, 0, .28);
}
.chat-v2 .chat-compose-shell:focus-within {
    border-color: rgba(76, 199, 255, .4);
    box-shadow: 0 0 0 3px rgba(76, 199, 255, .08), 0 14px 40px rgba(0, 0, 0, .3);
}
.chat-v2 .chat-compose-shell textarea {
    max-height: 160px;
}
.btn-stop-chat {
    width: 44px;
    height: 44px;
    min-height: 44px;
    flex: 0 0 auto;
    padding: 0;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 15px;
    background: #b3374f;
    color: #fff;
}
.btn-stop-chat[hidden] {
    display: none;
}
.btn-stop-chat svg {
    width: 15px;
    height: 15px;
}
.btn-stop-chat:hover {
    background: #c7435e;
}
.chat-v2 .btn-send-chat {
    background: #2f7fc4;
    box-shadow: none;
}
.chat-v2 .btn-send-chat:not(:disabled):hover {
    transform: none;
    filter: brightness(1.12);
}
.chat-v2 .btn-send-chat.is-interrupt:not(:disabled) {
    background: #8a5cf6;
}
.chat-composer-hint {
    margin: 6px 4px 0;
    color: var(--ink-3);
    font-size: 9px;
    opacity: .8;
}
.chat-v2 .btn-voice-chat {
    width: 44px;
    height: 44px;
    min-height: 44px;
    flex: 0 0 auto;
    padding: 0;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 15px;
    background: transparent;
    color: var(--ink-3);
}
.chat-v2 .btn-voice-chat svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
}
.chat-v2 .btn-voice-chat:hover {
    background: var(--surface-2);
    color: var(--ink);
}

/* Empty state: greeting + centered composer, no hero. */
.chat-v2 .chat-zero-state {
    min-height: auto;
    padding: 12px 0 8px;
}
.chat-zero-title {
    margin: 0;
    color: var(--ink);
    font-size: clamp(22px, 3vw, 32px);
    font-weight: 600;
}
.chat-zero-sub {
    margin-top: 8px;
    color: var(--ink-3);
    font-size: 11px;
}
.chat-v2.chat-is-empty .chat-canvas {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding-top: 64px;
}
.chat-v2.chat-is-empty .chat-context-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    border-color: transparent;
    background: transparent;
}
.chat-v2.chat-is-empty .chat-messages-container {
    flex: none;
    width: min(680px, calc(100% - 48px));
    max-height: 46%;
    overflow: hidden;
    padding: 0;
    animation: chat-empty-in .35s ease both;
}
.chat-v2.chat-is-empty .chat-composer {
    width: min(680px, calc(100% - 48px));
    padding-bottom: 0;
    animation: chat-empty-in .35s ease both;
}
.chat-v2.chat-is-empty .chat-composer-hint {
    text-align: center;
}
@keyframes chat-empty-in {
    from { opacity: 0; transform: translateY(8px); }
}

/* Details drawer: wide side panel, bottom sheet on mobile. */
.chat-canvas {
    position: relative;
}
.chat-details-drawer {
    width: min(370px, 94%);
    max-height: calc(100% - 84px);
    display: flex;
    flex-direction: column;
    position: absolute;
    z-index: 30;
    inset-block: 76px 8px;
    inset-inline-end: 8px;
    border: 1px solid var(--chat-line-strong);
    border-radius: 16px;
    background: var(--chat-panel);
    box-shadow: 0 24px 70px rgba(0, 0, 0, .45);
    overflow: hidden;
    animation: chat-activity-in .22s ease both;
}
.chat-details-drawer[hidden] {
    display: none;
}
.chat-details-head {
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--chat-line);
    font-size: 12px;
}
.chat-details-close {
    width: 28px;
    height: 28px;
    min-height: 28px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ink-3);
    font-size: 17px;
    line-height: 1;
}
.chat-details-close:hover {
    background: var(--surface-2);
    color: var(--ink);
}
.chat-details-body {
    padding: 12px 14px 16px;
    overflow-y: auto;
}
.chat-details-loading,
.chat-details-error {
    color: var(--ink-3);
    font-size: 11px;
}
.chat-detail-title-edit {
    margin-bottom: 12px;
    padding-bottom: 12px;
    display: grid;
    gap: 7px;
    border-bottom: 1px solid var(--chat-line);
    font-size: 10px;
    color: var(--ink-3);
}
.chat-detail-title-row {
    display: flex;
    gap: 6px;
}
.chat-detail-title-row input {
    flex: 1;
    min-width: 0;
    min-height: 34px;
    font-size: 11px;
}
.chat-detail-save {
    min-height: 34px;
    padding: 0 14px;
    flex: 0 0 auto;
    border: 1px solid var(--chat-line-strong);
    border-radius: 9px;
    background: transparent;
    color: var(--ink);
    font-size: 10px;
}
.chat-detail-save:hover:not(:disabled) {
    border-color: rgba(76, 199, 255, .4);
}
.chat-detail-title-mode {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.chat-detail-link {
    padding: 0;
    min-height: 0;
    border: 0;
    background: transparent;
    color: #6fc2ff;
    font-size: 10px;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.chat-details-list {
    margin: 0;
    display: grid;
    gap: 2px;
}
.chat-detail-row {
    margin: 0;
    padding: 7px 0;
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 10px;
    border-bottom: 1px dashed rgba(120, 145, 170, .12);
    font-size: 10px;
}
.chat-detail-row:last-child {
    border-bottom: 0;
}
.chat-detail-row dt {
    color: var(--ink-3);
}
.chat-detail-row dd {
    margin: 0;
    color: var(--ink);
    overflow-wrap: break-word;
}

/* Context menu. */
.chat-context-menu {
    min-width: 215px;
    max-width: 260px;
    padding: 5px;
    position: fixed;
    z-index: 200;
    border: 1px solid var(--chat-line-strong);
    border-radius: 12px;
    background: var(--chat-panel);
    box-shadow: 0 18px 55px rgba(0, 0, 0, .5);
}
.chat-context-menu[hidden] {
    display: none;
}
.chat-menu-item {
    width: 100%;
    min-height: 36px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ink);
    font-size: 11px;
    text-align: start;
}
.chat-menu-item svg {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.chat-menu-item:hover,
.chat-menu-item:focus-visible {
    background: var(--surface-2);
    outline: none;
}
.chat-menu-item:focus-visible {
    box-shadow: inset 0 0 0 2px rgba(76, 199, 255, .5);
}

/* Global search results. */
.chat-search-head {
    padding: 8px 12px 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.chat-search-count {
    color: var(--ink-3);
    font-size: 10px;
}
.chat-search-smart {
    min-height: 28px;
    padding: 0 10px;
    border: 1px solid var(--chat-line);
    border-radius: 999px;
    background: transparent;
    color: var(--ink-3);
    font-size: 9px;
    white-space: nowrap;
}
.chat-search-smart.is-on {
    border-color: rgba(140, 115, 255, .5);
    color: #b9a8ff;
}
.chat-search-note {
    margin: 0 12px 6px;
    color: var(--ink-3);
    font-size: 9px;
}
.chat-search-result .conv-info {
    gap: 4px;
}
.conv-snippet {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--ink-3);
    font-size: 10px;
    line-height: 1.6;
    white-space: normal;
}
.conv-item.title-fresh .conv-title {
    animation: chat-title-in .6s ease both;
}

/* System notice: calm, no glow. */
.chat-system-notice {
    border-color: var(--chat-line);
    background: var(--surface-1);
    color: var(--ink-2);
}
.chat-system-notice i {
    background: var(--ink-3);
    box-shadow: none;
}

/* Conv delete button reachable on touch. */
@media (hover: none) {
    .chat-v2 .btn-delete-conv {
        opacity: .7;
    }
}

@media (max-width: 980px) {
    .chat-v2 .chat-inline-search {
        width: 130px;
    }
    .chat-details-btn span {
        display: none;
    }
    .chat-details-btn {
        padding: 0 9px;
    }
    .chat-msg {
        max-width: 88%;
    }
    .chat-activity {
        max-width: 88%;
    }
}

@media (max-width: 700px) {
    .chat-v2 .chat-inline-search {
        display: none;
    }
    .chat-find-wrap {
        margin-inline-start: auto;
    }
    .chat-v2 .chat-msg {
        max-width: 94%;
    }
    .chat-activity {
        max-width: 94%;
    }
    .chat-v2 .chat-composer {
        width: calc(100cqi - 20px);
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
    .chat-v2.chat-is-empty .chat-messages-container,
    .chat-v2.chat-is-empty .chat-composer {
        width: calc(100% - 32px);
    }
    .chat-starter-grid {
        grid-template-columns: 1fr;
    }
    .chat-details-drawer {
        width: auto;
        max-height: 72%;
        inset-block: auto 0;
        inset-inline: 0;
        border-radius: 18px 18px 0 0;
    }
    .chat-composer-hint {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .chat-msg,
    .chat-activity,
    .chat-details-drawer,
    .chat-title-fresh,
    .chat-v2.chat-is-empty .chat-messages-container,
    .chat-v2.chat-is-empty .chat-composer {
        animation: none;
    }
    .chat-activity.is-live .chat-activity-dots i,
    .chat-activity-row.is-running .chat-activity-dot {
        animation: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .chat-v2 .chat-presence i,
    .chat-activity-indicator,
    .chat-live-steps span.is-live > i,
    .chat-zero-kicker i {
        animation: none;
    }
}

@media (max-width: 900px) {
    .news-add-source { grid-template-columns: 1fr; }
    .news-source-card { grid-template-columns: 36px minmax(0, 1fr) auto; }
    .news-source-state { grid-column: 2 / -1; }
    .language-choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .language-mode-controls { grid-template-columns: 1fr; }
    .language-processing-grid { grid-template-columns: 1fr 1fr; }
    .learning-command-deck { grid-template-columns: 1fr; }
    .duolingo-reference { border-inline-start: 0; border-top: 1px solid var(--line); }
    .learning-studio .learning-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
    .news-console { border-radius: 18px; }
    .news-console-head { min-height: 0; padding: 22px 18px; align-items: flex-start; flex-direction: column; }
    .news-head-actions { width: 100%; margin: 0; grid-template-columns: 1fr auto; align-items: center; justify-items: start; }
    .news-source-overview { grid-template-columns: 1fr; }
    .news-source-overview > div { min-height: 68px; padding: 14px 18px; border-inline-end: 0; border-bottom: 1px solid var(--line); }
    .news-add-source { margin: 14px; padding: 17px; gap: 18px; }
    .news-console .news-add-bar { grid-template-columns: 1fr; }
    .news-source-library { padding: 8px 14px 20px; }
    .news-library-heading { align-items: flex-start; }
    .news-library-heading > small { display: none; }
    .news-source-card { padding: 16px; grid-template-columns: 1fr; gap: 13px; }
    .news-source-index { display: none; }
    .content-wikipedia-card { margin: 0 14px 20px; border-radius: 17px; }
    .content-wikipedia-head { min-height: 0; padding: 19px 17px; align-items: flex-start; flex-direction: column; }
    .content-wikipedia-state { width: 100%; margin: 0; grid-template-columns: 1fr auto; align-items: center; justify-items: start; }
    .content-wikipedia-card .wikipedia-settings { padding: 17px; grid-template-columns: 1fr; }
    .content-wikipedia-card .wikipedia-toggle { grid-column: auto; }
    .content-wikipedia-footer { padding: 0 17px 17px; align-items: stretch; flex-direction: column; }
    .content-wikipedia-footer button { width: 100%; margin: 0; }
    .news-source-state { grid-column: auto; padding-top: 11px; border-top: 1px solid var(--line); }
    .news-source-actions { justify-content: space-between; }
    .learning-studio { border-radius: 18px; }
    .learning-studio-head { min-height: 0; padding: 23px 18px; align-items: flex-start; flex-direction: column; }
    .learning-hero-actions { width: 100%; margin: 0; grid-template-columns: 1fr auto; align-items: center; justify-items: start; }
    .language-picker-zone { padding: 20px 14px; }
    .language-picker-head { align-items: flex-start; }
    .language-choice-grid { gap: 7px; }
    .language-choice { min-height: 92px; padding: 13px; }
    .language-mode-picker { grid-template-columns: 1fr; }
    .language-processing-settings { padding: 14px; }
    .language-processing-settings > header { align-items: start; flex-direction: column; }
    .language-processing-grid,.language-mode-impact { grid-template-columns: 1fr; }
    .language-mode-impact > div { border-inline-end: 0; border-bottom: 1px solid #142d42; }
    .language-mode-impact > div:last-child { border-bottom: 0; }
    .learning-progress-hero { min-height: 0; padding: 24px 17px; align-items: flex-start; flex-direction: column; }
    .learning-progress-orbit { width: 128px; height: 128px; align-self: center; }
    .duolingo-reference { padding: 22px 18px; }
    .language-learning-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .language-learning-summary > div { min-height: 88px; padding: 15px; }
    .language-learning-summary > div:nth-child(2) { border-inline-end: 0; }
    .language-learning-summary > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
    .learning-path-section { padding: 24px 14px; }
    .learning-section-heading { align-items: flex-start; }
    .learning-section-heading > small { display: none; }
    .language-learning-path { grid-template-columns: repeat(6, 175px); scroll-snap-type: x proximity; }
    .language-path-stage { scroll-snap-align: start; }
    .learning-studio .learning-grid { padding: 14px; }
    .learning-today-panel .learning-card-body { grid-template-columns: 1fr; }
    .learning-today-panel .learning-actions { grid-column: auto; }
    .learning-actions button:last-child { width: 100%; margin-inline-start: 0; }
    .learning-review-row { grid-template-columns: 1fr 1fr 28px; }
    .learning-review-row > i { grid-column: 1 / 3; }
}

@media (max-width: 980px) {
    .phone-command-layout { grid-template-columns: 1fr; }
    .phone-bridge-stage { min-height: 340px; }
    .phone-live-panel { border-inline-start: 0; border-top: 1px solid rgba(91, 147, 195, .12); }
    .phone-console-metrics,
    .sleep-insights { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .phone-console-metrics > div:nth-child(3),
    .sleep-insights > div:nth-child(3) { border-inline-start: 0; }
    .phone-console-metrics > div:nth-child(n+3),
    .sleep-insights > div:nth-child(n+3) { border-top: 1px solid rgba(91, 147, 195, .1); }
    .phone-signal-console .phone-signal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .phone-signal-console .phone-signal:nth-child(3) { border-inline-start: 0; }
    .phone-signal-console .phone-signal:nth-child(n+3) { border-top: 1px solid rgba(91, 147, 195, .08); }
}

@media (max-width: 640px) {
    .phone-command-center,
    .sleep-observatory,
    .phone-signal-console,
    .phone-config-card { border-radius: 19px; }
    .phone-command-head,
    .sleep-observatory-head,
    .phone-signal-console > header {
        padding: 21px 17px;
        align-items: flex-start;
        flex-direction: column;
    }
    .phone-command-head h2 { font-size: 1.8rem; }
    .phone-command-actions,
    .sleep-observatory-head > div:last-child { width: 100%; justify-content: stretch; }
    .phone-command-actions .phone-link-state { width: 100%; }
    .phone-command-actions button { flex: 1; }
    .phone-bridge-stage { min-height: 300px; }
    .phone-device-visual {
        display: grid;
        inset: 35% 3% auto auto;
        width: 118px;
    }
    .phone-device-visual strong { bottom: 11%; }
    .bridge-node { width: 103px; min-height: 68px; padding: 9px; grid-template-columns: 23px 1fr; }
    .bridge-node svg { width: 22px; height: 22px; }
    .bridge-node-diane { left: 3%; top: 38%; }
    .bridge-node-cloud { left: 34%; top: 7%; }
    .bridge-node-watch { right: 4%; bottom: 5%; }
    .phone-live-panel { padding: 15px; }
    .phone-console-metrics,
    .sleep-insights { grid-template-columns: 1fr 1fr; }
    .phone-device-facts { grid-template-columns: 1fr 1fr; }
    .phone-device-facts > div:nth-child(3) { border-inline-start: 0; }
    .phone-device-facts > div:nth-child(n+3) { border-top: 1px solid rgba(91,147,195,.1); }
    .phone-console-metrics > div,
    .sleep-insights > div { padding: 15px 13px; }
    .phone-console-metrics strong,
    .sleep-insights strong { font-size: .94rem; }
    .phone-command-center .phone-link-steps { grid-template-columns: 1fr; }
    .phone-command-center .phone-link-step {
        border-inline-start: 0;
        border-top: 1px solid rgba(91, 147, 195, .1);
    }
    .sleep-observatory .sleep-hero { padding: 14px 13px 0; }
    .sleep-observatory .sleep-night-map { min-height: 0; padding: 20px 14px; grid-template-columns: 1fr; gap: 20px; }
    .sleep-dial { width: 170px; }
    .sleep-observatory .sleep-week { margin: 13px 13px 0; padding: 13px; }
    .sleep-week-chart { height: 160px; }
    .phone-signal-event { grid-template-columns: 62px 8px minmax(0, 1fr); gap: 7px; }
    .phone-signal-event > span:last-child { display: none; }
    .phone-live-signal-stream { padding-inline: 12px; }
    .phone-signal-console .phone-signal-grid { grid-template-columns: 1fr; }
    .phone-signal-console .phone-signal,
    .phone-signal-console .phone-signal:nth-child(3) {
        border-inline-start: 0;
        border-top: 1px solid rgba(91, 147, 195, .08);
    }
    .phone-link-grid { grid-template-columns: 1fr; }
    .phone-config-content { padding: 17px; }
}

@media (prefers-reduced-motion: reduce) {
    .bridge-path,
    .bridge-packet,
    .phone-device-ring,
    .sleep-dial-orbit,
    .sleep-time-line::after { animation: none; }
}

@media (max-width: 1100px) {
    .health-diagnostic-runner { grid-template-columns: 1fr 1fr; }
    .health-summary { grid-column: 1 / -1; }
    .health-operational-overview { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .health-console-head { min-height: 0; padding: 23px 18px; align-items: flex-start; flex-direction: column; }
    .health-console-actions { width: 100%; justify-content: space-between; }
    .health-diagnostic-runner { padding: 21px 17px; grid-template-columns: 1fr; }
    .health-summary { grid-column: auto; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .health-operational-section { padding: 17px 15px; }
    .health-operational-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .health-console-grid { grid-template-columns: 1fr; }
    .health-alert-panel { border-inline-end: 0; border-bottom: 1px solid rgba(91, 147, 195, .11); }
    .health-systems { padding: 22px 15px 28px; }
    .health-systems-head { align-items: flex-start; flex-direction: column; }
    .health-service-grid { grid-template-columns: 1fr; }
}

@media (max-width: 430px) {
    .health-console { border-radius: 19px; }
    .health-verdict { grid-template-columns: 69px minmax(0, 1fr); }
    .health-orbit { width: 66px; height: 66px; }
    .health-scan-route small { display: none; }
    .health-scan-route::before { top: 18px; }
    .health-service-card { grid-template-columns: 32px minmax(0, 1fr); }
    .health-service-mark { width: 32px; height: 32px; }
    .health-service-state { grid-column: 2; justify-self: start; }
    .health-service-foot { grid-template-columns: 1fr auto; }
    .health-service-checked { grid-column: 1 / -1; grid-row: 2; }
}

@media (prefers-reduced-motion: reduce) {
    .health-orbit::before,
    .health-orbit > span,
    .health-orbit i,
    .health-scan-route i,
    .health-service-card,
    .health-service-card::after { animation: none; }
}

@media (max-width: 640px) {
    .dashboard-telemetry-head { align-items: flex-start; }
    .dashboard-telemetry-actions { align-items: flex-end; flex-direction: column; }
    .dashboard-telemetry-actions .dashboard-today-live { font-size: .48rem; }
    .dashboard-telemetry > .dashboard-tile-grid { grid-template-columns: 1fr 1fr; }
    .dashboard-tile-grid .dashboard-live-stat { min-height: 116px; grid-template-columns: minmax(0, 1fr) 38px; }
    .dashboard-tile-grid .dashboard-stat-orbit { width: 38px; height: 38px; }
    .dashboard-tile-grid .stat-value { font-size: 1.25rem; }
    .dashboard-tile-dialog { width: calc(100vw - 18px); max-height: calc(100vh - 18px); border-radius: 18px; }
    .dashboard-tile-dialog header { min-height: 0; padding: 20px 17px; }
    .dashboard-tile-editor { max-height: calc(100vh - 250px); padding: 10px; grid-template-columns: 1fr; }
    .dashboard-tile-dialog footer { padding: 12px; grid-template-columns: 1fr 1fr; }
    #dashboard-tiles-status { grid-column: 1 / -1; grid-row: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .dashboard-tile-grid .dashboard-live-stat { animation: none; }
}

/* Flow Studio V3 — direct manipulation, nested scenarios, and test console */
.flow-edit-actions {
    display: flex;
    align-items: center;
    gap: 3px;
    direction: ltr;
}

.flow-edit-actions > span { width: 1px; height: 18px; margin: 0 4px; background: var(--flow-line); }

.flow-edit-actions button {
    width: 31px;
    height: 31px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #7890a8;
    background: transparent;
    cursor: pointer;
}

.flow-edit-actions button:hover:not(:disabled),
.flow-edit-actions button:focus-visible { border-color: rgba(55,185,255,.28); color: #c8edff; background: rgba(55,185,255,.08); }
.flow-edit-actions button:disabled { opacity: .28; cursor: default; }
.flow-edit-actions svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; }

#flow-save-state[data-tone="saving"] { color: var(--flow-cyan); animation: flowBreathe 1.25s ease-in-out infinite; }
#flow-save-state[data-tone="saved"] { color: #7f9bb4; }
#flow-save-state[data-tone="error"] { color: #ff91a8; }

.flow-edge.is-selected { stroke: #eef9ff; stroke-width: 2.7; filter: drop-shadow(0 0 6px rgba(55,185,255,.7)); }
.flow-edge-hit.is-selected { stroke: rgba(55,185,255,.04); }

.flow-selection-box {
    position: absolute;
    z-index: 5;
    border: 1px solid rgba(55,185,255,.68);
    background: rgba(55,185,255,.08);
    pointer-events: none;
}

.flow-minimap {
    position: absolute;
    z-index: 6;
    inset: auto auto 67px 18px;
    width: 142px;
    height: 92px;
    padding: 6px;
    overflow: hidden;
    border: 1px solid rgba(115,165,211,.18);
    border-radius: 11px;
    background: rgba(4,11,21,.82);
    box-shadow: 0 12px 30px rgba(0,0,0,.28);
    pointer-events: none;
}

.flow-minimap svg { width: 100%; height: 100%; }
.flow-minimap line { stroke: rgba(91,139,183,.36); stroke-width: 2; vector-effect: non-scaling-stroke; }
.flow-minimap rect { fill: rgba(55,185,255,.13); stroke: rgba(55,185,255,.5); stroke-width: 1; vector-effect: non-scaling-stroke; }
.flow-minimap rect.is-selected { fill: rgba(139,114,255,.34); stroke: #b7a8ff; stroke-width: 2; }

.flow-node[data-type="filter"] { border-radius: 19px 7px 19px 7px; }
.flow-node[data-type="foreach"],
.flow-node[data-type="subflow"] { background: linear-gradient(140deg, rgba(139,114,255,.13), transparent 55%), rgba(9,19,35,.98); }

.flow-node-palette { width: min(620px, calc(100% - 36px)); }
.flow-node-palette header > div { display: grid; gap: 3px; }
.flow-node-palette header small { color: #57728c; font: 600 8px/1 var(--font-mono); letter-spacing: .12em; }
.flow-node-palette-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.flow-node-palette-groups section { min-width: 0; padding: 9px; border: 1px solid rgba(112,157,201,.1); border-radius: 12px; background: rgba(3,10,20,.36); }
.flow-node-palette-groups h4 { margin: 0 0 7px; color: #617b93; font-size: 9px; font-weight: 600; }
.flow-node-palette-groups section > div { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }

.flow-assignment-row { display: grid; grid-template-columns: minmax(90px,.7fr) minmax(0,1.3fr) 28px; gap: 6px; }
.flow-assignment-row input { min-width: 0; }
.flow-assignment-row button { border: 1px solid rgba(255,120,149,.2); border-radius: 8px; color: #ff90a8; background: rgba(255,120,149,.06); cursor: pointer; }
.flow-inline-title { align-self: center; color: #728ba3; font-size: 9px; }
.flow-model-picker-status {
    display: flex;
    align-items: center;
    gap: 10px;
}
.flow-model-picker-status small {
    min-width: 0;
    flex: 1;
    color: #6f879d;
    font-size: 9px;
    line-height: 1.5;
}
.flow-model-picker-status button { flex: 0 0 auto; }

.flow-run-actions { display: flex; align-items: center; gap: 6px; }
.flow-run-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.flow-run-mode label { cursor: pointer; }
.flow-run-mode input { position: absolute; opacity: 0; pointer-events: none; }
.flow-run-mode span { min-height: 74px; display: grid; align-content: center; gap: 5px; padding: 13px; border: 1px solid rgba(112,157,201,.15); border-radius: 12px; background: rgba(4,12,23,.6); }
.flow-run-mode strong { color: #d8e9f7; font-size: 11px; }
.flow-run-mode small { color: #61798f; font-size: 9px; line-height: 1.5; }
.flow-run-mode input:checked + span { border-color: rgba(55,185,255,.48); background: rgba(55,185,255,.09); box-shadow: inset 0 0 24px rgba(55,185,255,.05); }
.flow-run-warning { padding: 11px 13px; border-inline-start: 2px solid var(--flow-violet); color: #8da0b5; background: rgba(139,114,255,.06); font-size: 9px; line-height: 1.55; }
.flow-run-dialog-card { width: min(620px, calc(100vw - 28px)); }

.flow-trace-list article > div { min-width: 0; }
.flow-trace-list details { margin-top: 8px; }
.flow-trace-list summary { color: #7892aa; font-size: 9px; cursor: pointer; }
.flow-trace-payload { margin-top: 7px; display: grid; grid-template-columns: 1fr 1fr; gap: 7px; direction: ltr; }
.flow-trace-payload label { min-width: 0; color: #506b82; font: 600 8px/1.4 var(--font-mono); }
.flow-trace-payload pre { max-height: 180px; margin: 4px 0 0; padding: 8px; overflow: auto; border: 1px solid rgba(102,149,192,.12); border-radius: 8px; color: #93a9bb; background: #040b14; font: 8px/1.5 var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 900px) {
    .flow-edit-actions { order: 3; width: 100%; justify-content: center; padding-block: 4px; border-top: 1px solid var(--flow-line); }
    .flow-canvas-toolbar { height: auto; min-height: 52px; flex-wrap: wrap; padding-block: 8px; }
    .flow-minimap { display: none; }
}

@media (max-width: 620px) {
    .flow-node-palette { left: 9px; bottom: 62px; width: calc(100% - 18px); max-height: calc(100% - 74px); }
    .flow-node-palette-groups { grid-template-columns: 1fr; }
    .flow-node-palette-groups section > div { grid-template-columns: 1fr 1fr; }
    .flow-run-mode, .flow-trace-payload { grid-template-columns: 1fr; }
    .flow-edit-actions button { width: 38px; height: 38px; }
    .flow-run-actions { width: 100%; justify-content: flex-end; flex-wrap: wrap; }
    .flow-assignment-row, .flow-matcher-row { grid-template-columns: 1fr 1fr 32px; }
    .flow-matcher-row > :first-child { grid-column: 1 / 3; }
    .flow-model-picker-status { align-items: stretch; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
    #flow-save-state[data-tone="saving"] { animation: none; }
}

/* Flow Studio light theme — the graph remains an editor, not a dark promo panel. */
html[data-theme="light"] .flow-page {
    --flow-line: rgba(72, 78, 103, .14);
}

html[data-theme="light"] .flow-command-bar,
html[data-theme="light"] .flow-run-dock,
html[data-theme="light"] .flow-library,
html[data-theme="light"] .flow-inspector,
html[data-theme="light"] .flow-canvas-shell,
html[data-theme="light"] .flow-canvas-toolbar {
    color: var(--ink-1);
    border-color: var(--line);
    background: var(--surface-1);
}

html[data-theme="light"] .flow-command-bar,
html[data-theme="light"] .flow-run-dock,
html[data-theme="light"] .flow-studio {
    box-shadow: 0 10px 28px rgba(46, 50, 73, .08);
}

html[data-theme="light"] .flow-command-copy strong,
html[data-theme="light"] .flow-library-head strong,
html[data-theme="light"] .flow-list-copy strong,
html[data-theme="light"] .flow-breadcrumb strong,
html[data-theme="light"] .flow-inspector-empty strong,
html[data-theme="light"] .flow-inspector-head h3,
html[data-theme="light"] .flow-switch-row strong,
html[data-theme="light"] .flow-run-summary strong,
html[data-theme="light"] .flow-run-mode strong {
    color: var(--ink-1);
}

html[data-theme="light"] .flow-command-copy span:not(.flow-live-mark),
html[data-theme="light"] .flow-library-head span,
html[data-theme="light"] .flow-list-copy small,
html[data-theme="light"] .flow-breadcrumb,
html[data-theme="light"] .flow-inspector-empty p,
html[data-theme="light"] .flow-field > span,
html[data-theme="light"] .flow-switch-row small,
html[data-theme="light"] .flow-run-summary small,
html[data-theme="light"] .flow-run-summary time,
html[data-theme="light"] .flow-run-progress span {
    color: var(--ink-3);
}

html[data-theme="light"] .flow-live-mark,
html[data-theme="light"] .flow-inspector-empty-icon,
html[data-theme="light"] .flow-run-pulse {
    border-color: rgba(112, 87, 226, .22);
    background: rgba(112, 87, 226, .07);
}

html[data-theme="light"] .flow-icon-button,
html[data-theme="light"] .flow-secondary-button,
html[data-theme="light"] .flow-trace-button,
html[data-theme="light"] .flow-search,
html[data-theme="light"] .flow-zoom-controls,
html[data-theme="light"] .flow-field input,
html[data-theme="light"] .flow-field textarea,
html[data-theme="light"] .flow-field select,
html[data-theme="light"] .flow-picker,
html[data-theme="light"] .flow-switch-row,
html[data-theme="light"] .flow-run-mode span {
    color: var(--ink-2);
    border-color: var(--line);
    background: var(--surface-input);
}

html[data-theme="light"] .flow-search input {
    color: var(--ink-1);
}

html[data-theme="light"] .flow-search svg,
html[data-theme="light"] .flow-edit-actions button,
html[data-theme="light"] .flow-zoom-controls button,
html[data-theme="light"] .flow-zoom-controls output {
    color: var(--ink-3);
}

html[data-theme="light"] .flow-zoom-controls button,
html[data-theme="light"] .flow-edit-actions button:hover:not(:disabled),
html[data-theme="light"] .flow-edit-actions button:focus-visible {
    background: transparent;
}

html[data-theme="light"] .flow-filter-row button.is-active,
html[data-theme="light"] .flow-list-item.is-active {
    color: #4d3fa7;
    border-color: rgba(112, 87, 226, .18);
    background: rgba(112, 87, 226, .07);
}

html[data-theme="light"] .flow-list-item:hover {
    background: var(--surface-2);
}

html[data-theme="light"] .flow-library-foot,
html[data-theme="light"] .flow-inspector-head,
html[data-theme="light"] .flow-canvas-toolbar {
    border-color: var(--line);
}

html[data-theme="light"] .flow-studio {
    border-color: var(--line);
    background: var(--surface-1);
}

html[data-theme="light"] .flow-canvas {
    background:
        radial-gradient(circle at 38% 40%, rgba(84, 151, 220, .06), transparent 35%),
        radial-gradient(circle at 72% 64%, rgba(112, 87, 226, .05), transparent 32%),
        #f7f8fc;
}

html[data-theme="light"] .flow-grid {
    opacity: .65;
    background-image: radial-gradient(circle, rgba(84, 91, 118, .22) 1px, transparent 1.2px);
}

html[data-theme="light"] .flow-node,
html[data-theme="light"] .flow-node[data-type="foreach"],
html[data-theme="light"] .flow-node[data-type="subflow"],
html[data-theme="light"] .flow-node-palette,
html[data-theme="light"] .flow-minimap {
    color: var(--ink-1);
    border-color: rgba(72, 78, 103, .16);
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 8px 22px rgba(46, 50, 73, .1);
}

html[data-theme="light"] .flow-node-copy strong,
html[data-theme="light"] .flow-node-palette [data-add-flow-node] strong {
    color: var(--ink-1);
}

html[data-theme="light"] .flow-node-copy span,
html[data-theme="light"] .flow-node-palette [data-add-flow-node] small,
html[data-theme="light"] .flow-node-palette-groups h4 {
    color: var(--ink-3);
}

html[data-theme="light"] .flow-port {
    border-color: #fff;
}

html[data-theme="light"] .flow-port b,
html[data-theme="light"] .flow-node-palette-groups section,
html[data-theme="light"] .flow-trace-payload pre {
    color: var(--ink-2);
    border-color: var(--line);
    background: var(--surface-input);
}

html[data-theme="light"] .flow-edge-label {
    fill: #657087;
    stroke: #f7f8fc;
}

html[data-theme="light"] .flow-run-progress i {
    border-color: #dce1ec;
    background: #f7f8fc;
}

/* ============================================================
   App mode — the dashboard running inside the native shell
   ============================================================ */

/* The shell provides the app bar and bottom navigation, so the web sidebar
   would be a second, conflicting navigation. */
.diane-app-mode .sidebar { display: none !important; }

.diane-app-mode .app,
.diane-app-mode .main {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
}

/* The native bar already names the screen; the web topbar duplicates it. */
.diane-app-mode .topbar { display: none !important; }

.diane-app-mode .page {
    padding-inline: 14px !important;
    padding-bottom: max(24px, env(safe-area-inset-bottom)) !important;
}

/* Nothing may scroll sideways on a phone. Wide content scrolls inside itself. */
.diane-app-mode body { overflow-x: hidden !important; }

.diane-app-mode table {
    display: block;
    overflow-x: auto;
    max-width: 100%;
}

/* Multi-column grids collapse rather than squeezing columns to unreadable widths. */
.diane-app-mode .stats-grid,
.diane-app-mode .proactive-settings-grid,
.diane-app-mode .phone-link-grid,
.diane-app-mode .phone-signal-grid,
.diane-app-mode .health-metrics-grid {
    grid-template-columns: 1fr !important;
}

/* Modals stay on screen instead of overflowing a small viewport. */
.diane-app-mode .modal,
.diane-app-mode .dialog {
    max-width: calc(100vw - 24px) !important;
    max-height: calc(100vh - 96px) !important;
    overflow-y: auto;
}

.diane-app-mode .card { scroll-margin-top: 12px; }

/* Theme reference surface: the shell and chat are fully mapped first. Each
   remaining workspace receives focused light-mode overrides as it is audited. */
html[data-theme="light"] .sidebar,
html[data-theme="light"] .main,
html[data-theme="light"] .page {
    background-color: var(--canvas);
}

html[data-theme="light"] .sidebar {
    background: var(--chrome);
}

html[data-theme="light"] .dashboard-masthead,
html[data-theme="light"] .dashboard-action-rail button,
html[data-theme="light"] .dashboard-priority,
html[data-theme="light"] .dashboard-day,
html[data-theme="light"] .dashboard-telemetry,
html[data-theme="light"] .dashboard-context,
html[data-theme="light"] .dashboard-signal {
    background-color: var(--surface-1);
    border-color: var(--line);
}

html[data-theme="light"] .dashboard-masthead {
    box-shadow: 0 12px 30px rgba(44, 48, 69, .08);
}

html[data-theme="light"] .dashboard-priority {
    background: var(--surface-1);
}

html[data-theme="light"] .dashboard-action-rail button:hover,
html[data-theme="light"] .dashboard-priority .dashboard-attention-row:hover {
    background: var(--violet-soft);
}

html[data-theme="light"] .dashboard-telemetry > .stats-grid,
html[data-theme="light"] .dashboard-signal-grid {
    background: var(--line);
}

html[data-theme="light"] .dashboard-telemetry .stat-card,
html[data-theme="light"] .dashboard-stat-orbit::before {
    background: var(--bg-surface);
}

html[data-theme="light"] .dashboard-telemetry .stat-card:first-child {
    background: var(--surface-1);
}

html[data-theme="light"] .dashboard-tile-dialog {
    color: var(--ink);
    border-color: var(--line-strong);
    background: var(--bg-surface-elevated);
    box-shadow: 0 30px 90px rgba(40, 44, 64, .22);
}

html[data-theme="light"] .dashboard-tile-dialog header,
html[data-theme="light"] .dashboard-tile-dialog footer {
    border-color: var(--line);
    background: var(--bg-surface-elevated);
}

html[data-theme="light"] .dashboard-tile-dialog h3,
html[data-theme="light"] .dashboard-tile-editor-row strong {
    color: var(--ink);
}

html[data-theme="light"] .dashboard-tile-editor-row {
    border-color: var(--line);
    background: var(--bg-surface-elevated);
}

html[data-theme="light"] .dashboard-tile-editor-row.is-selected {
    border-color: var(--violet-line);
    background: var(--violet-soft);
}

html[data-theme="light"] .health-console,
html[data-theme="light"] .health-console-head,
html[data-theme="light"] .health-diagnostic-runner,
html[data-theme="light"] .health-operational-section,
html[data-theme="light"] .health-alert-panel,
html[data-theme="light"] .health-systems {
    color: var(--ink);
    border-color: var(--line);
    background: var(--surface-1);
}

html[data-theme="light"] .health-diagnostic-runner {
    background: var(--surface-1);
}

html[data-theme="light"] .health-console-head h2,
html[data-theme="light"] .health-verdict strong,
html[data-theme="light"] .health-summary .vault-fact strong,
html[data-theme="light"] .health-operational-card strong,
html[data-theme="light"] .health-alert-panel h4,
html[data-theme="light"] .health-systems-head h3,
html[data-theme="light"] .health-service-group-head h4,
html[data-theme="light"] .health-service-copy strong {
    color: var(--ink);
}

html[data-theme="light"] .health-summary .vault-fact,
html[data-theme="light"] .health-operational-card,
html[data-theme="light"] .health-alert-principle,
html[data-theme="light"] .health-alert-panel .health-channel,
html[data-theme="light"] .health-service-card {
    border-color: var(--line);
    background: var(--bg-surface);
}

html[data-theme="light"] .health-scan-route i {
    border-color: var(--line-strong);
    background: var(--bg-surface-elevated);
}

html[data-theme="light"] .health-diagnostic-runner:not([data-state="idle"]):not([data-state="scanning"]) .health-scan-route i {
    background: radial-gradient(circle, #5bb7e5 0 17%, #fff 19%);
}

html[data-theme="light"] .health-service-copy p,
html[data-theme="light"] .health-service-copy small,
html[data-theme="light"] .health-verdict p,
html[data-theme="light"] .health-alert-panel p,
html[data-theme="light"] .health-systems-head > small {
    color: var(--ink-3);
}

html[data-theme="light"] .integration-workspace-head,
html[data-theme="light"] .provider-control-surface,
html[data-theme="light"] .ai-usage-surface,
html[data-theme="light"] .account-connections,
html[data-theme="light"] .infrastructure-connections,
html[data-theme="light"] .integration-workspace .vault-card {
    color: var(--ink);
    border-color: var(--line);
    background: var(--bg-surface);
}

html[data-theme="light"] .provider-control-head,
html[data-theme="light"] .ai-usage-head,
html[data-theme="light"] .account-connections-head,
html[data-theme="light"] .vault-head {
    border-color: var(--line);
    background: var(--bg-surface);
}

html[data-theme="light"] .provider-connection-card,
html[data-theme="light"] .account-connection-card,
html[data-theme="light"] .connection-permissions span,
html[data-theme="light"] .google-contacts-browser {
    color: var(--ink);
    border-color: var(--line);
    background: #f8f9fc;
}

html[data-theme="light"] .provider-connection-card.is-connected {
    border-color: var(--violet-line);
    background: linear-gradient(145deg, var(--violet-soft), #f8f9fc 48%);
}

html[data-theme="light"] .provider-identity strong,
html[data-theme="light"] .ai-usage-summary strong,
html[data-theme="light"] .connection-brand h4,
html[data-theme="light"] .vault-card h3,
html[data-theme="light"] .infrastructure-card h3 {
    color: var(--ink);
}

html[data-theme="light"] .provider-capabilities span,
html[data-theme="light"] .provider-control-facts span,
html[data-theme="light"] .vault-connection-facts span {
    background: #f0f2f7;
}

html[data-theme="light"] .vault-row.vault-card-item {
    background: var(--bg-surface);
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

html[data-theme="light"] .vault-row.vault-card-item:hover {
    background: #fcfdfe;
    border-color: rgba(31, 162, 255, 0.4);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .vault-summary {
    background: #f8f9fc;
}

html[data-theme="light"] .vault-fact {
    background: var(--bg-surface);
    border-color: var(--line);
}

html[data-theme="light"] .vault-chip {
    background: var(--bg-surface);
    color: var(--ink-2);
}

html[data-theme="light"] .vault-chip[data-active="true"] {
    background: var(--accent-muted);
    border-color: var(--accent);
    color: var(--accent-hover);
}

html[data-theme="light"] .vault-env-chip {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #475569;
}

html[data-theme="light"] .vault-preview-wrap {
    background: #f1f5f9;
    border-color: #e2e8f0;
}

html[data-theme="light"] .vault-preview {
    color: #0369a1;
}

html[data-theme="light"] .vault-guidance {
    background: #f0f9ff;
    border-color: #bae6fd;
}

html[data-theme="light"] .vault-guidance .vault-note {
    color: #0369a1;
}

html[data-theme="light"] .vault-fact-chip {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #475569;
}

html[data-theme="light"] .vault-input {
    background: var(--surface-input);
    border-color: #cbd5e1;
    color: #0f172a;
}

html[data-theme="light"] .vault-envonly-badge {
    background: #f0f9ff;
    border-color: #bae6fd;
    color: #0369a1;
}

html[data-theme="light"] .infrastructure-card + .infrastructure-card,
html[data-theme="light"] .ai-usage-summary,
html[data-theme="light"] .ai-usage-summary > div {
    border-color: var(--line);
}

html[data-theme="light"] .brain-workspace,
html[data-theme="light"] .brain-header,
html[data-theme="light"] .brain-layer-rail,
html[data-theme="light"] .brain-main-stage,
html[data-theme="light"] .brain-memory-view,
html[data-theme="light"] .brain-prompt-view,
html[data-theme="light"] .brain-outline,
html[data-theme="light"] .brain-document,
html[data-theme="light"] .brain-memory-card {
    color: var(--ink);
    border-color: var(--line);
    background: var(--bg-surface);
}

html[data-theme="light"] .brain-layer-button:hover,
html[data-theme="light"] .brain-layer-button.is-active,
html[data-theme="light"] .brain-memory-filters button.is-active {
    color: var(--ink);
    border-color: var(--violet-line);
    background: var(--violet-soft);
}

html[data-theme="light"] .brain-layer-button > i,
html[data-theme="light"] .brain-document-top,
html[data-theme="light"] #persona-editor {
    color: var(--ink-2);
    border-color: var(--line);
    background: #f8f9fc;
}

html[data-theme="light"] #persona-editor {
    background-image: linear-gradient(rgba(60, 68, 90, .035) 1px, transparent 1px);
}

html[data-theme="light"] .brain-memory-card h4,
html[data-theme="light"] .brain-memory-summary strong {
    color: var(--ink);
}

html[data-theme="light"] .brain-memory-card p,
html[data-theme="light"] .brain-stage-toolbar p,
html[data-theme="light"] .brain-layer-button {
    color: var(--ink-3);
}

html[data-theme="light"] .log-console,
html[data-theme="light"] .log-console-head,
html[data-theme="light"] .log-source-switch,
html[data-theme="light"] .log-console .log-filters,
html[data-theme="light"] .log-overview,
html[data-theme="light"] .log-console .logs-container,
html[data-theme="light"] .log-trace {
    color: var(--ink);
    border-color: var(--line);
    background: var(--bg-surface);
}

html[data-theme="light"] .log-source-switch > button,
html[data-theme="light"] .log-trace-head,
html[data-theme="light"] .log-trace-trigger {
    color: var(--ink-2);
    border-color: var(--line);
    background: #f8f9fc;
}

html[data-theme="light"] .log-source-switch > button[aria-pressed="true"] {
    border-color: var(--violet-line);
    background: var(--violet-soft);
}

html[data-theme="light"] .log-trace-time,
html[data-theme="light"] .log-trace-facts,
html[data-theme="light"] .log-overview span {
    color: var(--ink-3);
}

html[data-theme="light"] .model-control-center,
html[data-theme="light"] .model-control-center > header,
html[data-theme="light"] .model-control-center > footer,
html[data-theme="light"] .application-workspace,
html[data-theme="light"] .application-workspace-stage,
html[data-theme="light"] .application-workspace-rail {
    color: var(--ink);
    border-color: var(--line);
    background: var(--bg-surface);
}

html[data-theme="light"] .application-workspace-rail {
    background: var(--bg-sidebar);
}

html[data-theme="light"] .application-workspace-tab:hover,
html[data-theme="light"] .application-workspace-tab.is-active {
    color: var(--ink);
    border-color: var(--violet-line);
    background: var(--violet-soft);
}

html[data-theme="light"] .active-provider-identity,
html[data-theme="light"] .model-runtime-state {
    border-color: var(--line);
    background: #f8f9fc;
}

html[data-theme="light"] .active-provider-identity strong,
html[data-theme="light"] .model-runtime-state strong {
    color: var(--ink);
}

html[data-theme="light"] .chat-v2 {
    --chat-line: rgba(70, 79, 104, .16);
    --chat-line-strong: rgba(78, 105, 176, .30);
    --chat-blue: #5867D8;
    --chat-blue-soft: rgba(88, 103, 216, .12);
    --chat-violet: #6757C7;
    --chat-panel: rgba(232, 234, 238, .96);
    --chat-canvas: #D6D9DF;
}

html[data-theme="light"] .chat-v2 .chat-stage,
html[data-theme="light"] .chat-v2 .chat-canvas {
    background: var(--chat-canvas);
}

html[data-theme="light"] .chat-v2 .chat-library,
html[data-theme="light"] .chat-v2 .chat-context-bar,
html[data-theme="light"] .chat-v2 .chat-composer {
    background: rgba(232, 234, 238, .92);
    border-color: var(--chat-line);
    box-shadow: none;
}

html[data-theme="light"] .chat-v2 .chat-library-search,
html[data-theme="light"] .chat-v2 .chat-inline-search,
html[data-theme="light"] .chat-v2 .chat-channel-select,
html[data-theme="light"] .chat-v2 .chat-compose-shell,
html[data-theme="light"] .chat-starter-grid button {
    background: #EDF0F6;
    border-color: rgba(76, 82, 104, .12);
}

html[data-theme="light"] .chat-v2 .conv-title,
html[data-theme="light"] .chat-v2 .chat-active-copy h3,
html[data-theme="light"] .chat-v2 .chat-zero-state p,
html[data-theme="light"] .chat-v2 .chat-bubble,
html[data-theme="light"] .chat-v2 .chat-bubble-wrapper.user .chat-bubble,
html[data-theme="light"] .chat-starter-grid span {
    color: var(--ink);
}

html[data-theme="light"] .chat-v2 .conv-item:hover {
    background: #f2f3f8;
}

html[data-theme="light"] .chat-v2 .conv-item.active {
    border-color: var(--violet-line);
    background: linear-gradient(90deg, rgba(116, 87, 219, .1), rgba(41, 127, 199, .06));
}

html[data-theme="light"] .chat-v2 .chat-bubble-wrapper.user .chat-bubble {
    border-color: rgba(65, 110, 177, .18);
    background: linear-gradient(145deg, rgba(71, 137, 221, .12), rgba(116, 87, 219, .08));
}

html[data-theme="light"] .chat-v2 .chat-bubble pre {
    background: #eef0f5;
}

html[data-theme="light"] .chat-live-activity {
    border-color: var(--violet-line);
    background: var(--bg-surface);
    box-shadow: 0 14px 38px rgba(65, 57, 93, .09);
}

html[data-theme="light"] .chat-activity-copy strong,
html[data-theme="light"] .chat-live-steps span.is-live {
    color: var(--ink);
}

/* Phone device summary: operational state, without an ambient marketing map. */
.phone-bridge-stage {
    min-height: 0;
    display: grid;
    background: var(--surface-input);
}

.phone-command-layout {
    min-height: 220px;
}

.phone-command-head {
    padding: 16px 20px;
}

.phone-command-head h2 {
    font-size: clamp(1.45rem, 2vw, 1.8rem);
}

.phone-bridge-stage::before {
    display: none;
}

.phone-device-summary {
    min-width: 0;
    padding: 18px 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-content: center;
    gap: 14px;
}

.phone-device-primary,
.phone-watch-summary {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 13px;
}

.phone-device-icon {
    width: 52px;
    height: 52px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    position: relative;
    border: 1px solid var(--violet-line);
    border-radius: 15px;
    background: var(--violet-soft);
    color: var(--diane-violet);
}

.phone-device-icon svg,
.phone-watch-summary svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
}

.phone-device-icon i {
    width: 8px;
    height: 8px;
    position: absolute;
    inset-inline-end: -2px;
    inset-block-end: -2px;
    border: 2px solid var(--surface-input);
    border-radius: 50%;
    background: var(--ink-3);
}

.phone-bridge-stage[data-state="connected"] .phone-device-icon i {
    background: var(--ok);
}

.phone-bridge-stage[data-state="error"] .phone-device-icon i,
.phone-bridge-stage[data-state="pending"] .phone-device-icon i {
    background: var(--wait);
}

.phone-device-primary > div,
.phone-watch-summary > div {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.phone-device-primary span,
.phone-watch-summary span,
.phone-route-status small {
    color: var(--ink-3);
    font-size: 10px;
}

.phone-device-primary strong {
    color: var(--ink);
    font-size: 18px;
}

.phone-watch-summary {
    padding-inline-start: 18px;
    border-inline-start: 1px solid var(--line);
    color: var(--diane-violet);
}

.phone-watch-summary strong {
    color: var(--ink-2);
    font-size: 12px;
}

.phone-watch-summary small {
    color: var(--ink-3);
    font-size: 10px;
}

.phone-live-panel { padding: 14px; }
.phone-console-metrics > div,
.sleep-insights > div { padding: 13px 16px; }
.phone-command-center .phone-link-step { padding: 12px 16px; }
.sleep-observatory { padding-bottom: 16px; }
.sleep-observatory-head,
.phone-signal-console > header { min-height: 72px; padding: 15px 18px; }
.phone-signal-console > header { min-height: 72px; }
.sleep-observatory-head h3,
.phone-signal-console h3 { font-size: 1.12rem; }

html[data-theme="light"] .phone-command-center,
html[data-theme="light"] .sleep-observatory,
html[data-theme="light"] .phone-signal-console,
html[data-theme="light"] .phone-config-card {
    border-color: var(--line);
    background: var(--surface-1);
    box-shadow: 0 18px 44px rgba(51, 47, 72, .07);
}

html[data-theme="light"] .phone-command-head,
html[data-theme="light"] .sleep-observatory-head,
html[data-theme="light"] .phone-signal-console > header,
html[data-theme="light"] .phone-command-layout,
html[data-theme="light"] .phone-console-metrics,
html[data-theme="light"] .sleep-insights,
html[data-theme="light"] .phone-device-facts {
    border-color: var(--line);
}

html[data-theme="light"] .phone-command-head h2,
html[data-theme="light"] .sleep-observatory-head h3,
html[data-theme="light"] .phone-signal-console h3,
html[data-theme="light"] .phone-console-metrics strong,
html[data-theme="light"] .sleep-insights strong,
html[data-theme="light"] .phone-config-summary strong,
html[data-theme="light"] .phone-check strong,
html[data-theme="light"] .phone-signal strong {
    color: var(--ink);
}

html[data-theme="light"] .phone-live-panel,
html[data-theme="light"] .phone-live-panel .phone-check,
html[data-theme="light"] .phone-link-result,
html[data-theme="light"] .sleep-observatory .sleep-week,
html[data-theme="light"] .phone-live-signal-stream,
html[data-theme="light"] .phone-signal-console .phone-signal,
html[data-theme="light"] .phone-config-content {
    background: var(--surface-input);
    border-color: var(--line);
}

html[data-theme="light"] .sleep-range-picker select,
html[data-theme="light"] .phone-link-state {
    background: var(--surface-input);
    color: var(--ink-2);
    border-color: var(--line);
}

html[data-theme="light"] .dashboard-toast {
    border-color: var(--line);
    background: var(--bg-surface-elevated);
    color: var(--ink);
    box-shadow: 0 16px 42px rgba(51, 47, 72, .13);
}

@media (max-width: 640px) {
    .phone-device-summary {
        padding: 20px 16px;
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .phone-watch-summary {
        padding: 14px 0 0;
        border-inline-start: 0;
        border-top: 1px solid var(--line);
    }
}

/* Learning v2 — compact progression and settings. */
.learning-studio { border-radius: 16px; background: var(--surface-1); }
.learning-studio-head { min-height: 82px; padding: 15px 18px; align-items: center; gap: 16px; background: transparent; }
.learning-hero-copy h3 { margin: 0 0 3px; font-size: 1.12rem; }
.learning-hero-copy p { font-size: .75rem; line-height: 1.45; }
.learning-hero-actions { display: flex; align-items: center; gap: 9px; }
.language-picker-zone { padding: 18px; background: transparent; }
.language-picker-head h4 { margin: 0; font-size: .92rem; }
.language-choice-grid { margin-top: 12px; gap: 7px; }
.language-choice { min-height: 68px; padding: 10px 12px; border-color: var(--line); border-radius: 11px; background: var(--surface-input); }
.language-choice:hover { transform: none; background: var(--surface-2); }
.language-choice.active { border-color: rgba(117,98,228,.28); background: rgba(117,98,228,.08); box-shadow: none; }
.language-choice > span { font-size: 1rem; }
.language-choice > b { color: var(--ink); font-size: .77rem; }
.language-choice > small { color: var(--ink-3); }
.language-mode-controls { margin-top: 9px; gap: 8px; }
.language-toggle-row { min-height: 62px; padding: 10px 12px; border-radius: 11px; background: var(--surface-input); }
.language-toggle-row b { color: var(--ink-2); }
.language-toggle-row small { color: var(--ink-3); }
.language-mode-picker { padding: 4px; border-radius: 11px; background: var(--surface-input); }
.language-mode-picker button { padding: 8px 10px; border-radius: 8px; }
.language-mode-picker button.active { background: rgba(117,98,228,.08); }
.language-mode-picker b,
.language-mode-picker button.active b { color: var(--ink-2); }
.language-mode-picker small { color: var(--ink-3); }
.language-processing-settings { margin-top: 9px; padding: 0; display: block; border-color: var(--line); border-radius: 12px; background: var(--surface-input); }
.language-processing-settings > summary { min-height: 52px; padding: 11px 13px; display: flex; align-items: center; justify-content: space-between; gap: 14px; cursor: pointer; list-style: none; }
.language-processing-settings > summary::-webkit-details-marker { display: none; }
.language-processing-settings > summary::after { content: "+"; color: var(--ink-3); font-size: 1rem; }
.language-processing-settings[open] > summary { border-bottom: 1px solid var(--line); }
.language-processing-settings[open] > summary::after { content: "−"; }
.language-processing-settings h5 { margin: 0; color: var(--ink-2); font-size: .78rem; }
.language-processing-settings .status-text { margin-inline-start: auto; color: var(--ink-3); }
.language-processing-grid { margin: 13px; }
.language-processing-grid > label { color: var(--ink-3); }
.language-processing-grid select { color: var(--ink-2); border-color: var(--line); background: var(--surface-1); }
.language-processing-grid small { color: var(--ink-3); }
.language-save-preference { border-color: var(--line); background: var(--surface-1); }
.language-save-preference b { color: var(--ink-2); }
.language-mode-impact { margin: 0 13px 13px; border-color: var(--line); }
.language-mode-impact > div { min-height: 54px; padding: 9px 11px; border-color: var(--line); }
.language-mode-impact span { color: var(--ink-3); }
.language-mode-impact strong { color: var(--ink-2); }
.learning-command-deck { grid-template-columns: minmax(0,1.5fr) minmax(220px,.5fr); }
.learning-progress-hero { min-height: 156px; padding: 18px; gap: 18px; }
.learning-progress-orbit { width: 90px; height: 90px; }
.learning-progress-orbit circle { stroke-width: 6; }
.learning-progress-orbit strong { color: var(--ink); font-size: 1.15rem; }
.learning-progress-orbit small { color: var(--ink-3); }
.learning-progress-copy h4 { margin: 0 0 5px; color: var(--ink); font-size: 1rem; }
.learning-progress-copy p { margin-bottom: 12px; color: var(--ink-3); font-size: .74rem; }
.learning-progress-copy button { min-height: 38px; border-radius: 10px; background: var(--accent); box-shadow: none; }
.duolingo-reference { padding: 18px; gap: 8px; background: var(--surface-input); }
.duolingo-data-link { min-height: 38px; border-radius: 10px; background: var(--accent); box-shadow: none; }
.duolingo-title { color: var(--ink-2); font-size: .78rem; }
.duolingo-reference strong { color: var(--ink); font-size: 1.65rem; }
.duolingo-reference small,
.duolingo-reference p { color: var(--ink-3); }
.language-learning-summary { background: transparent; }
.language-learning-summary > div { min-height: 70px; padding: 11px 15px; }
.language-learning-summary span { color: var(--ink); font-size: 1rem; }
.language-learning-summary small { color: var(--ink-3); }
.learning-path-section { padding: 18px; }
.learning-section-heading h4 { margin: 0; font-size: .92rem; }
.language-learning-path { margin-top: 12px; grid-template-columns: repeat(6,minmax(130px,1fr)); }
.language-path-stage { min-height: 112px; padding: 11px; border-color: var(--line); border-radius: 11px; background: var(--surface-input); }
.language-path-stage h5 { color: var(--ink-2); }
.language-path-stage p,
.language-path-stage small { color: var(--ink-3); }
.language-path-stage.current { background: rgba(117,98,228,.08); }
.language-path-stage.current h5 { color: var(--ink); }
.learning-studio .learning-grid { padding: 18px; gap: 9px; }
.learning-studio .learning-panel { min-height: 270px; border-radius: 13px; background: var(--surface-input); }
.learning-panel-head { min-height: 54px; padding: 12px 15px; }
.learning-panel-head h4 { margin: 0; color: var(--ink-2); font-size: .82rem; }
.learning-card-body { padding: 15px; }
.learning-word-stage { min-height: 150px; border-radius: 12px; background: var(--surface-1); }
.learning-word-stage .learning-token,
.learning-word-context strong,
.learning-review-row b { color: var(--ink); }
.learning-word-stage .learning-reading,
.learning-word-context p,
.learning-review-row span,
.learning-review-row small { color: var(--ink-3); }

@media (max-width: 760px) {
    .learning-studio { border-radius: 14px; }
    .learning-studio-head { min-height: 0; padding: 14px; align-items: flex-start; flex-direction: column; }
    .learning-hero-actions { width: 100%; justify-content: space-between; }
    .language-picker-zone { padding: 14px 12px; }
    .language-choice-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .language-mode-controls,
    .learning-command-deck,
    .language-processing-grid,
    .learning-studio .learning-grid { grid-template-columns: 1fr; }
    .language-processing-settings { padding: 0; }
    .language-processing-settings > summary { align-items: flex-start; flex-wrap: wrap; }
    .language-mode-impact { grid-template-columns: 1fr; }
    .language-mode-impact > div { border-inline-end: 0; border-bottom: 1px solid var(--line); }
    .language-mode-impact > div:last-child { border-bottom: 0; }
    .learning-progress-hero { padding: 16px; align-items: center; flex-direction: row; }
    .learning-progress-orbit { width: 76px; height: 76px; }
    .duolingo-reference { padding: 15px; border-inline-start: 0; border-top: 1px solid var(--line); }
    .learning-path-section { padding: 15px 12px; }
    .language-learning-path { grid-template-columns: repeat(6,140px); }
    .learning-studio .learning-grid { padding: 12px; }
    .learning-today-panel .learning-card-body { grid-template-columns: 1fr; }
}

/* Books v2 — focused tracking controls. */
.books-service-console { border-radius: 16px; box-shadow: 0 10px 28px rgba(0,0,0,.1); }
.books-service-topline { min-height: 48px; padding: 8px 14px; background: var(--surface-1); }
.books-source-label { color: var(--ink-3); font: 600 .68rem/1 var(--font-mono); }
.books-service-hero { min-height: 82px; padding: 15px 18px; background: transparent; }
.books-service-hero h3 { margin: 0 0 4px; font-size: 1.08rem; }
.books-operations .books-summary { min-height: 76px; padding: 14px 18px; }
.books-operations .books-sync-panel { padding: 14px 18px; background: var(--surface-1); }
.books-add-bar { margin: 16px 18px 8px; padding: 5px; border-radius: 11px; }
.books-add-bar input { min-width: 0; }
.books-settings-bar { margin: 0 18px 14px; padding: 10px 0; }
.books-service-console > .books-grid { padding: 0 18px 20px; }

@media (max-width: 640px) {
    .books-service-console { border-radius: 14px; }
    .books-service-topline { padding: 8px 12px; }
    .books-service-hero { min-height: 0; padding: 14px 12px; align-items: stretch; flex-direction: column; }
    .books-controls { width: 100%; }
    .books-operations { grid-template-columns: 1fr; }
    .books-operations .books-sync-panel { border-inline-start: 0; border-top: 1px solid var(--line); }
    .books-add-bar { margin: 12px; align-items: stretch; flex-direction: column; }
    .books-settings-bar { margin: 0 12px 12px; display: grid; grid-template-columns: auto 1fr auto; }
    .books-settings-bar .books-filter { width: 100%; margin: 0; grid-column: 1 / -1; }
    .books-service-console > .books-grid { padding: 0 12px 15px; }
}

/* ──── Diane Code Studio ──── */
.code-studio-page { padding: 0 !important; height: calc(100vh - 64px); min-height: 560px; }
.code-studio-shell { display: grid; grid-template-columns: 52px 260px 1fr; height: 100%; background: var(--bg-primary); border-top: 1px solid var(--border); }
.code-studio-rail { display: flex; flex-direction: column; gap: 6px; padding: 10px 8px; background: var(--bg-secondary); border-inline-end: 1px solid var(--border); }
.code-studio-rail-btn { width: 36px; height: 36px; border: 0; border-radius: var(--radius-xs); background: transparent; color: var(--text-muted); display: grid; place-items: center; cursor: pointer; }
.code-studio-rail-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.code-studio-rail-btn.active, .code-studio-rail-btn:hover { color: var(--accent); background: var(--surface-raised); }
.code-studio-sidebar { display: flex; flex-direction: column; border-inline-end: 1px solid var(--border); background: var(--bg-secondary); min-width: 0; }
.code-studio-side-head { display: flex; flex-direction: column; gap: 4px; padding: 14px 14px 10px; border-bottom: 1px solid var(--border); }
.code-studio-side-head strong { font-size: .92rem; }
.code-studio-meta { color: var(--text-muted); font: 500 .72rem/1.3 "JetBrains Mono", monospace; }
.code-studio-side-panel { display: none; flex: 1; overflow: auto; padding: 10px; }
.code-studio-side-panel.active { display: block; }
.code-studio-tree, .code-studio-session-list, .code-studio-engine-health { display: flex; flex-direction: column; gap: 4px; }
.code-studio-tree button, .code-studio-session-list button { text-align: start; border: 0; background: transparent; color: var(--text-secondary); padding: 7px 8px; border-radius: var(--radius-xs); cursor: pointer; font: 500 .78rem/1.3 "JetBrains Mono", monospace; }
.code-studio-tree button:hover, .code-studio-session-list button:hover, .code-studio-tree button.active { background: var(--surface-raised); color: var(--text-primary); }
.code-studio-engine-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; background: var(--bg-card); }
.code-studio-engine-card strong { display: block; margin-bottom: 4px; }
.code-studio-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.code-studio-toolbar { display: flex; justify-content: space-between; gap: 12px; align-items: end; padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--bg-secondary); flex-wrap: wrap; }
.code-studio-toolbar-start, .code-studio-toolbar-end { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.code-studio-field { display: flex; flex-direction: column; gap: 4px; min-width: 120px; }
.code-studio-field.grow { flex: 1; min-width: 180px; }
.code-studio-field span { font-size: .72rem; color: var(--text-muted); }
.code-studio-field select, .code-studio-field input, .code-studio-composer textarea { border: 1px solid var(--border); background: var(--surface-sunken); color: var(--text-primary); border-radius: var(--radius-xs); padding: 8px 10px; font: 500 .85rem/1.3 "Heebo", sans-serif; }
.code-studio-field input, .code-studio-field select { font-family: "JetBrains Mono", monospace; font-size: .78rem; }
.code-studio-btn { border: 1px solid var(--border); background: var(--surface-raised); color: var(--text-primary); border-radius: var(--radius-xs); padding: 8px 12px; cursor: pointer; font: 600 .82rem/1 Heebo, sans-serif; }
.code-studio-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.code-studio-btn.ghost { background: transparent; }
.code-studio-btn:disabled { opacity: .45; cursor: not-allowed; }
.code-studio-status { font: 600 .78rem/1 "JetBrains Mono", monospace; color: var(--text-secondary); padding-bottom: 8px; }
.code-studio-work { flex: 1; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, .85fr); min-height: 0; }
.code-studio-editor-pane, .code-studio-agent-pane { min-height: 0; display: flex; flex-direction: column; border-inline-start: 1px solid var(--border); }
.code-studio-editor-pane { border-inline-start: 0; }
.code-studio-tabs { display: flex; gap: 2px; padding: 8px 10px 0; background: var(--bg-secondary); border-bottom: 1px solid var(--border); }
.code-studio-tab { border: 0; background: transparent; color: var(--text-muted); padding: 8px 12px; cursor: pointer; border-radius: var(--radius-xs) var(--radius-xs) 0 0; font: 600 .8rem/1 Heebo, sans-serif; }
.code-studio-tab.active { color: var(--text-primary); background: var(--bg-primary); }
.code-studio-code { display: none; flex: 1; margin: 0; overflow: auto; padding: 14px; background: var(--bg-primary); color: var(--text-secondary); font: 500 .78rem/1.45 "JetBrains Mono", monospace; white-space: pre-wrap; word-break: break-word; }
.code-studio-code.active { display: block; }
.code-studio-agent-head { display: flex; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--bg-secondary); }
.code-studio-events { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.code-studio-event { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--bg-card); }
.code-studio-event .type { font: 600 .72rem/1 "JetBrains Mono", monospace; color: var(--accent); margin-bottom: 6px; }
.code-studio-event .body { color: var(--text-secondary); font-size: .86rem; white-space: pre-wrap; }
.code-studio-composer { border-top: 1px solid var(--border); padding: 12px; display: flex; flex-direction: column; gap: 10px; background: var(--bg-secondary); }
.code-studio-composer textarea { resize: vertical; min-height: 88px; }
.code-studio-composer-actions { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
@media (max-width: 1100px) {
  .code-studio-shell { grid-template-columns: 52px 1fr; }
  .code-studio-sidebar { display: none; }
  .code-studio-work { grid-template-columns: 1fr; }
  .code-studio-editor-pane { min-height: 280px; }
}

/* ──────────────────────────────────────────────────────────────
   Transport — "תחבורה"
   One hero (the stop you are standing at), then what is coming.
   Every number is mono so a changing ETA does not shift the row.
   ────────────────────────────────────────────────────────────── */
.transport-page.active { display: flex; flex-direction: column; gap: var(--s-5); }

.transport-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--s-5);
    flex-wrap: wrap;
    padding: var(--s-5) var(--s-5) var(--s-4);
    border: 1px solid var(--line);
    border-radius: var(--r-4);
    background:
        radial-gradient(120% 160% at 100% 0%, var(--diane-soft), transparent 62%),
        var(--surface-1);
}
.transport-hero-main { min-width: 0; flex: 1 1 320px; }
.transport-hero h2 { margin: var(--s-2) 0 var(--s-1); font-size: 1.65rem; line-height: 1.15; }
.transport-hero-name { margin: 0; color: var(--ink-2); font-size: .84rem; line-height: 1.5; max-width: 60ch; }
.transport-hero-meta {
    display: flex; align-items: center; gap: var(--s-2);
    flex-wrap: wrap; margin-top: var(--s-4);
}
.transport-hero-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }

.transport-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-pill, 999px);
    color: var(--ink-2);
    font: 600 .68rem/1 var(--font-mono, "JetBrains Mono", monospace);
    direction: ltr;
}
.transport-chip[data-kind="city"] { direction: rtl; font-family: inherit; font-weight: 600; }

/* Freshness is the honesty signal: never a live dot without a timestamp. */
.transport-freshness {
    display: inline-flex; align-items: center; gap: 7px;
    color: var(--ink-3); font-size: .72rem;
}
.transport-freshness::before {
    content: ""; width: 7px; height: 7px; border-radius: 50%;
    background: var(--ink-3); flex: 0 0 auto;
}
.transport-freshness[data-state="live"] { color: var(--ok); }
.transport-freshness[data-state="live"]::before { background: var(--ok); box-shadow: 0 0 8px rgba(71, 215, 154, .55); }
.transport-freshness[data-state="stale"] { color: var(--wait); }
.transport-freshness[data-state="stale"]::before { background: var(--wait); }
.transport-freshness[data-state="error"] { color: var(--bad); }
.transport-freshness[data-state="error"]::before { background: var(--bad); }

.transport-search { display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap; }
.transport-search-field {
    position: relative; flex: 1 1 260px; display: flex; align-items: center;
}
.transport-search-icon {
    position: absolute; inset-inline-start: 12px; width: 16px; height: 16px;
    fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
    color: var(--ink-3); pointer-events: none;
}
.transport-search-field input {
    width: 100%; min-height: 44px;
    padding: 10px 38px 10px var(--s-4);
    border: 1px solid var(--line); border-radius: var(--r-2);
    background: var(--surface-input); color: var(--ink); font-size: .86rem;
    transition: border-color var(--fast) var(--ease);
}
.transport-search-field input:focus { outline: none; border-color: var(--diane); }
.transport-search-field input:focus-visible {
    outline: 2px solid var(--diane);
    outline-offset: 2px;
}

.transport-results {
    display: flex; flex-direction: column; gap: 2px;
    max-height: 320px; overflow-y: auto;
    padding: var(--s-2);
    border: 1px solid var(--line); border-radius: var(--r-2);
    background: var(--surface-1);
}

.transport-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
    gap: var(--s-5);
    align-items: start;
}
.transport-col { display: flex; flex-direction: column; gap: var(--s-5); min-width: 0; }

.transport-panel {
    padding: var(--s-4);
    border: 1px solid var(--line); border-radius: var(--r-3);
    background: var(--surface-1);
    min-width: 0;
}
.transport-panel-head {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: var(--s-3); margin-bottom: var(--s-3);
}
.transport-panel-head h3 { margin: 0; font-size: .95rem; }
.transport-placeholder { margin: 0; color: var(--ink-3); font-size: .78rem; line-height: 1.55; }

/* ── Arrivals ── */
.transport-arrivals { display: flex; flex-direction: column; gap: var(--s-2); }
.transport-arrival {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--s-3);
    width: 100%;
    min-height: 62px;
    padding: var(--s-3);
    border: 1px solid var(--line); border-radius: var(--r-2);
    background: var(--surface-2);
    color: inherit; text-align: start; cursor: pointer;
    transition: border-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.transport-arrival:hover { border-color: var(--line-strong); }
.transport-arrival:focus-visible { outline: 2px solid var(--diane); outline-offset: 2px; }

.transport-line-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 46px; min-height: 34px; padding: 0 8px;
    border: 1px solid var(--violet-line); border-radius: var(--r-1);
    background: var(--violet-soft); color: var(--ink);
    font: 700 1rem/1 var(--font-mono);
    direction: ltr;
}
.transport-arrival-body { min-width: 0; }
.transport-arrival-dest {
    display: block; font-size: .85rem; font-weight: 600; color: var(--ink);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.transport-arrival-sub {
    display: flex; flex-wrap: wrap; gap: 4px 10px;
    margin-top: 3px; color: var(--ink-3); font-size: .68rem;
}
.transport-arrival-sub b { color: var(--ink-2); font-weight: 600; }
.transport-arrival-sub .mono { font-family: var(--font-mono, "JetBrains Mono", monospace); direction: ltr; }

.transport-eta { text-align: center; min-width: 74px; }
.transport-eta strong {
    display: block;
    font: 700 1.35rem/1 var(--font-mono);
    color: var(--diane); direction: ltr;
}
.transport-eta small { display: block; margin-top: 3px; color: var(--ink-3); font-size: .64rem; }
.transport-arrival[data-confidence="low"] .transport-eta strong { color: var(--wait); }
.transport-arrival[data-live="false"] .transport-eta strong { color: var(--ink-2); }

/* ── Saved / nearby rows ── */
.transport-saved, .transport-nearby { display: flex; flex-direction: column; gap: 2px; }
.transport-stop-row {
    display: flex; align-items: center; gap: var(--s-3);
    width: 100%; min-height: 46px; padding: var(--s-2) var(--s-3);
    border: 1px solid transparent; border-radius: var(--r-2);
    background: transparent; color: inherit; text-align: start; cursor: pointer;
    transition: background var(--fast) var(--ease);
}
.transport-stop-row:hover { background: var(--surface-2); }
.transport-stop-row:focus-visible { outline: 2px solid var(--diane); outline-offset: -2px; }
.transport-stop-row[aria-current="true"] { border-color: var(--diane); background: var(--diane-soft); }
.transport-stop-row .title-icon,
.transport-stop-row .transport-row-icon {
    width: 16px; height: 16px; flex: 0 0 auto;
    fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
    color: var(--ink-3);
}
.transport-stop-row-body { min-width: 0; flex: 1 1 auto; }
.transport-stop-row-body strong { display: block; font-size: .82rem; font-weight: 600; }
.transport-stop-row-body span {
    display: block; margin-top: 2px; color: var(--ink-3); font-size: .67rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.transport-stop-row-body .mono { font-family: var(--font-mono, "JetBrains Mono", monospace); direction: ltr; }
.transport-row-actions { display: flex; gap: 2px; flex: 0 0 auto; }
.transport-icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 44px; min-height: 44px; padding: 0;
    border: 1px solid transparent; border-radius: var(--r-1);
    background: transparent; color: var(--ink-3); cursor: pointer;
    transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.transport-icon-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.transport-icon-btn:focus-visible {
    outline: 2px solid var(--diane);
    outline-offset: 2px;
}
.transport-icon-btn svg {
    width: 15px; height: 15px; fill: none; stroke: currentColor;
    stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}

/* ── Map: OSM raster tiles, drawn locally, no third-party script ── */
.transport-map-frame { position: relative; }
.transport-map {
    position: relative; overflow: hidden;
    height: 340px;
    touch-action: none; cursor: grab;
    border: 1px solid var(--line); border-radius: var(--r-2);
    background: var(--surface-3);
    direction: ltr;
}
.transport-map-tiles { position: absolute; inset: 0; }
.transport-map-tiles img { position: absolute; width: 256px; height: 256px; user-select: none; }
.transport-map:active { cursor: grabbing; }
.transport-map-tiles img { pointer-events: none; }
.transport-map-marker {
    position: absolute; transform: translate(-50%, -50%);
    display: flex; align-items: center; justify-content: center;
    padding: 0; margin: 0; font: inherit; color: inherit;
    pointer-events: auto; cursor: pointer;
}
.transport-map-marker[data-kind="me"] { pointer-events: none; cursor: default; }
.transport-map-marker:focus-visible { outline: 2px solid var(--diane); outline-offset: 3px; }
.transport-map-marker[aria-pressed="true"] { z-index: 3; box-shadow: 0 0 0 4px rgba(124, 140, 255, .38); }
.transport-map-marker[data-kind="stop"] {
    width: 16px; height: 16px; border-radius: 50%;
    border: 3px solid var(--diane); background: var(--canvas);
    box-shadow: 0 0 0 4px rgba(124, 140, 255, .22);
}
.transport-map-marker[data-kind="bus"] {
    min-width: 30px; height: 22px; padding: 0 6px;
    border-radius: var(--r-1);
    border: 1px solid var(--violet-line);
    background: var(--diane-violet); color: #fff;
    font: 700 .68rem/1 var(--font-mono, "JetBrains Mono", monospace);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .45);
}
.transport-map-marker[data-kind="bus"][data-stale="true"] { background: var(--ink-3); border-color: var(--line-strong); }
.transport-map-marker[data-kind="near"] {
    width: 10px; height: 10px; border-radius: 50%;
    border: 2px solid var(--line-strong); background: var(--surface-1);
}
.transport-map-marker[data-kind="me"] {
    width: 12px; height: 12px; border-radius: 50%;
    border: 2px solid var(--canvas); background: var(--diane-violet);
    box-shadow: 0 0 0 5px rgba(124, 92, 255, .20);
}
.transport-map-empty {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    padding: var(--s-4); text-align: center;
    color: var(--ink-3); font-size: .78rem;
}
.transport-map-zoom {
    position: absolute; top: var(--s-3); inset-inline-start: var(--s-3);
    display: flex; flex-direction: column; gap: 2px;
}
.transport-map-zoom button {
    width: 30px; height: 30px;
    border: 1px solid var(--line-strong); border-radius: var(--r-1);
    background: rgba(6, 11, 20, .85); color: var(--ink);
    font: 600 1rem/1 var(--font-mono, "JetBrains Mono", monospace); cursor: pointer;
}
.transport-map-zoom button:hover { border-color: var(--diane); }
.transport-map-credit { margin: var(--s-2) 0 0; color: var(--ink-3); font-size: .62rem; }
.transport-map-credit a { color: var(--ink-2); }

/* ── Marker card: what a tap on the map opens ── */
.transport-map-card {
    position: absolute; inset-inline: var(--s-3); bottom: var(--s-3); z-index: 4;
    display: flex; flex-direction: column; gap: var(--s-3);
    max-height: calc(100% - 2 * var(--s-3)); overflow-y: auto;
    padding: var(--s-4);
    border: 1px solid var(--line-strong); border-radius: var(--r-2);
    background: rgba(6, 11, 20, .94); backdrop-filter: blur(6px);
    box-shadow: 0 12px 34px rgba(0, 0, 0, .5);
    direction: rtl; font-size: .78rem;
}
.transport-pin-head { display: flex; align-items: flex-start; gap: var(--s-3); }
.transport-pin-title { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; }
.transport-pin-title strong { font-size: .95rem; line-height: 1.25; }
.transport-pin-title span { color: var(--ink-3); font-size: .68rem; }
.transport-pin-lines { display: flex; flex-direction: column; gap: 0; }
.transport-pin-line {
    display: flex; align-items: center; gap: var(--s-3); width: 100%;
    padding: 7px 0; border: 0; border-bottom: 1px solid var(--line);
    background: none; color: inherit; font: inherit; text-align: start; cursor: pointer;
}
.transport-pin-line:last-child { border-bottom: 0; }
.transport-pin-line:hover .transport-pin-line-no { border-color: var(--diane); }
.transport-pin-line-no {
    flex: 0 0 auto; min-width: 38px; padding: 3px 6px; text-align: center;
    border: 1px solid var(--violet-line); border-radius: var(--r-1);
    background: var(--violet-soft); color: var(--ink);
    font: 700 .74rem/1.2 var(--font-mono, "JetBrains Mono", monospace);
}
.transport-pin-line-body { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; }
.transport-pin-line-body span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transport-pin-line-eta { flex: 0 0 auto; text-align: end; display: flex; flex-direction: column; gap: 2px; }
.transport-pin-eta { color: var(--diane); font: 700 .82rem/1 var(--font-mono, "JetBrains Mono", monospace); direction: ltr; }
.transport-countdown { color: var(--ink-2); font: 550 .66rem/1 var(--font-mono, "JetBrains Mono", monospace); direction: ltr; }
.transport-pin-reason { margin: 0; color: var(--ink-3); font-size: .66rem; line-height: 1.45; }
.transport-pin-facts { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.transport-pin-fact {
    padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px;
    background: var(--surface-2); color: var(--ink-2); font-size: .66rem;
}
.transport-pin-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.transport-pin-actions .vault-btn { flex: 1 1 auto; justify-content: center; }
.transport-pin-empty { margin: 0; color: var(--ink-3); font-size: .7rem; }

/* ── Line detail ── */
.transport-line-detail { display: flex; flex-direction: column; gap: var(--s-3); font-size: .78rem; }
.transport-line-facts { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.transport-line-stops { display: flex; flex-direction: column; gap: 0; max-height: 260px; overflow-y: auto; }
.transport-line-stop {
    display: flex; align-items: baseline; gap: var(--s-3);
    padding: 6px 0; border-bottom: 1px solid var(--line);
}
button.transport-line-stop {
    width: 100%;
    margin: 0;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: start;
    cursor: pointer;
}
button.transport-line-stop:hover,
button.transport-line-stop:focus-visible {
    color: var(--diane);
}
button.transport-line-stop:focus-visible {
    outline: 2px solid var(--diane);
    outline-offset: 2px;
}
.transport-line-stop:last-child { border-bottom: 0; }
.transport-line-stop time {
    color: var(--ink-3); font: 550 .68rem/1 var(--font-mono, "JetBrains Mono", monospace);
    direction: ltr; flex: 0 0 auto;
}
.transport-line-stop span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transport-line-stop[aria-current="true"] { color: var(--diane); }

.transport-error {
    margin: 0; padding: var(--s-3);
    border: 1px solid rgba(242, 118, 112, .35); border-radius: var(--r-2);
    background: rgba(242, 118, 112, .08); color: var(--bad); font-size: .78rem;
}

@media (max-width: 1080px) {
    .transport-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
    .transport-hero { padding: var(--s-4); border-radius: var(--r-3); }
    .transport-hero h2 { font-size: 1.35rem; }
    .transport-hero-actions { width: 100%; }
    .transport-hero-actions .vault-btn { flex: 1 1 auto; }
    .transport-arrival { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "badge body" "eta eta"; }
    .transport-arrival .transport-line-badge { grid-area: badge; }
    .transport-arrival .transport-arrival-body { grid-area: body; }
    .transport-arrival .transport-eta { grid-area: eta; text-align: start; display: flex; align-items: baseline; gap: var(--s-2); }
    .transport-arrival .transport-eta small { margin-top: 0; }
    .transport-map { height: 260px; }
    .transport-map-card { max-height: calc(100% - var(--s-3)); padding: var(--s-3); font-size: .74rem; }
    .transport-pin-actions .vault-btn { flex: 1 1 100%; }
}

/* ============================================================
   Diane Voice — immersive call screen + composer button
   Near-black stage, living orb canvas, minimal controls.
   ============================================================ */

.chat-v2 .btn-voice-chat {
    width: 46px;
    height: 46px;
    flex: 0 0 auto;
    align-self: center;
    display: grid;
    place-items: center;
    border: 1px solid rgba(113, 172, 224, .22);
    border-radius: 15px;
    background: rgba(23, 37, 56, .6);
    color: #8fd6ff;
    cursor: pointer;
    transition: transform .2s ease, filter .2s ease, border-color .2s ease;
}

.chat-v2 .btn-voice-chat svg {
    display: block;
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chat-v2 .btn-voice-chat:not(:disabled):hover {
    transform: translateY(-1px) scale(1.03);
    border-color: rgba(73, 194, 255, .55);
    filter: brightness(1.15);
}

.chat-v2 .btn-voice-chat:disabled {
    opacity: .35;
    cursor: default;
}

.voice-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    flex-direction: column;
    background: #05070d;
    color: #e5f1fb;
    overflow: hidden;
}

.voice-overlay[hidden] {
    display: none;
}

.voice-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.voice-bg i {
    position: absolute;
    width: 60vmax;
    height: 60vmax;
    border-radius: 50%;
    filter: blur(90px);
    opacity: .16;
}

.voice-bg i:first-child {
    top: -20vmax;
    inset-inline-start: -15vmax;
    background: radial-gradient(circle, #1d5f8a, transparent 65%);
}

.voice-bg i:last-child {
    bottom: -25vmax;
    inset-inline-end: -15vmax;
    background: radial-gradient(circle, #4b3a8f, transparent 65%);
}

.voice-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    z-index: 1;
}

.voice-identity {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.voice-identity strong {
    font-size: 17px;
    font-weight: 600;
}

.voice-status {
    font-size: 12px;
    color: #8fd6ff;
    padding: 3px 12px;
    border: 1px solid rgba(73, 194, 255, .3);
    border-radius: 999px;
    background: rgba(23, 60, 90, .35);
    transition: color .3s ease, border-color .3s ease;
}

.voice-status[data-state="speaking"] {
    color: #b7a6ff;
    border-color: rgba(140, 115, 255, .45);
}

.voice-status[data-state="thinking"] {
    color: #ffd98a;
    border-color: rgba(255, 200, 100, .35);
}

.voice-status[data-state="error"] {
    color: #ff9d9d;
    border-color: rgba(255, 120, 120, .45);
}

.voice-close {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(119, 159, 200, .2);
    border-radius: 50%;
    background: transparent;
    color: #8fa5bb;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.voice-close:hover {
    color: #e5f1fb;
    border-color: rgba(119, 159, 200, .45);
}

.voice-stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 0 24px;
    z-index: 1;
    min-height: 0;
}

.voice-orb {
    flex: 0 0 auto;
    width: min(58vw, 320px);
    height: min(58vw, 320px);
    transition: width .28s ease, height .28s ease;
}

.voice-caption {
    flex: 0 0 auto;
    min-height: 1.7em;
    max-width: 30em;
    margin: 0;
    text-align: center;
    font-size: clamp(17px, 2.4vw, 21px);
    font-weight: 500;
    line-height: 1.6;
    letter-spacing: -.01em;
    text-wrap: balance;
    color: #eaf5ff;
}

.voice-caption:empty {
    display: none;
}

.voice-overlay[data-captions="off"] .voice-caption {
    display: none;
}

.voice-interim {
    flex: 0 0 auto;
    min-height: 1.5em;
    margin: 0;
    text-align: center;
    font-size: 13px;
    color: #6c8097;
}

.voice-interim:empty {
    display: none;
}

.voice-meta {
    flex: 0 0 auto;
    min-height: 1.4em;
    margin: 0;
    text-align: center;
    font-size: 11px;
    color: #506278;
}

.voice-meta:empty {
    display: none;
}

.voice-error {
    margin: 0 24px;
    text-align: center;
    font-size: 13px;
    color: #ff9d9d;
    z-index: 1;
}

.voice-error[hidden] {
    display: none;
}

/* Tone chip: the personality she is actually running with, and the exact
   prompt behind it, one tap away. */
.voice-tone-chip {
    align-self: center;
    margin: 0;
    padding: 4px 12px;
    border: 1px solid rgba(73, 194, 255, .3);
    border-radius: 999px;
    background: rgba(23, 60, 90, .45);
    color: #8fd6ff;
    font: inherit;
    font-size: 11px;
    letter-spacing: .02em;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease;
}

.voice-tone-chip:hover {
    background: rgba(28, 74, 110, .7);
    border-color: rgba(73, 194, 255, .55);
}

.voice-tone-chip[hidden] {
    display: none;
}

.voice-tone-prompt {
    max-width: 34em;
    margin: 0 auto;
    padding: 10px 14px;
    border: 1px solid rgba(80, 98, 120, .3);
    border-radius: 12px;
    background: rgba(12, 26, 40, .6);
    text-align: start;
    font-size: 12px;
    line-height: 1.7;
    color: #9fb4c9;
    white-space: pre-wrap;
}

.voice-tone-prompt[hidden] {
    display: none;
}

/* Transcript: a long call cannot be read off a single replaced caption,
   so every turn also lands here with who said it. */
.voice-transcript {
    flex: 1 1 auto;
    width: min(100%, 38em);
    min-height: 0;
    margin: 0 auto;
    padding: 4px 2px;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(73, 194, 255, .3) transparent;
}

.voice-transcript[hidden],
.voice-overlay[data-captions="off"] .voice-transcript {
    display: none;
}

.voice-transcript:empty {
    display: none;
}

.voice-overlay[data-transcript="1"] .voice-stage {
    justify-content: flex-start;
    gap: 12px;
    padding-block-start: 8px;
}

.voice-overlay[data-transcript="1"] .voice-orb {
    width: min(34vw, 168px);
    height: min(34vw, 168px);
}

/* The caption is the same sentence the transcript already shows in full,
   so it steps aside instead of repeating itself above the panel. */
.voice-overlay[data-transcript="1"] .voice-caption {
    display: none;
}

.vt-line {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .03);
    animation: vt-in .18s ease both;
}

.vt-line[data-role="user"] {
    background: rgba(73, 194, 255, .07);
}

.vt-line[data-live="1"] {
    background: rgba(73, 194, 255, .12);
}

.vt-line[data-live="1"] .vt-text {
    color: #ffffff;
}

.vt-line[data-live="1"] .vt-text::after {
    content: "";
    display: inline-block;
    width: 2px;
    height: 1em;
    margin-inline-start: 3px;
    vertical-align: -.15em;
    background: #49c2ff;
    animation: vt-caret 1s steps(2, start) infinite;
}

@keyframes vt-caret {
    to { visibility: hidden; }
}

.vt-who {
    flex: 0 0 auto;
    font-size: 10px;
    letter-spacing: .04em;
    color: #6c8097;
}

.vt-line[data-role="user"] .vt-who {
    color: #6fc2f0;
}

.vt-text {
    margin: 0;
    font-size: 13px;
    line-height: 1.65;
    color: #dcebf9;
    overflow-wrap: anywhere;
}

@keyframes vt-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}

/* Tool badges: on the live path her tools run server-side, so this strip
   is the only place the operator sees that something just happened. */
.voice-toasts {
    position: absolute;
    inset-block-start: 72px;
    inset-inline-end: 20px;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    pointer-events: none;
}

.voice-toast {
    padding: 7px 14px;
    border: 1px solid rgba(73, 194, 255, .35);
    border-radius: 999px;
    background: rgba(15, 40, 62, .88);
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
    font-size: 12px;
    color: #9fdcff;
    animation: voice-toast-in .22s ease both;
}

.voice-toast[data-kind="error"] {
    border-color: rgba(255, 120, 120, .45);
    background: rgba(70, 20, 24, .88);
    color: #ffb4b4;
}

.voice-toast[data-leaving="1"] {
    animation: voice-toast-out .3s ease both;
}

@keyframes voice-toast-in {
    from { opacity: 0; transform: translateY(-6px) scale(.96); }
    to { opacity: 1; transform: none; }
}

@keyframes voice-toast-out {
    from { opacity: 1; transform: none; }
    to { opacity: 0; transform: translateY(-6px) scale(.96); }
}

@media (prefers-reduced-motion: reduce) {
    .vt-line,
    .vt-line[data-live="1"] .vt-text::after,
    .voice-toast {
        animation: none;
    }

    .voice-orb {
        transition: none;
    }
}

.voice-unmute {
    margin: 0 auto;
    padding: 10px 26px;
    border: 1px solid rgba(73, 194, 255, .55);
    border-radius: 999px;
    background: rgba(23, 60, 90, .6);
    color: #8fd6ff;
    font-size: 14px;
    cursor: pointer;
    z-index: 1;
}

.voice-unmute[hidden] {
    display: none;
}

.voice-unmute:hover {
    background: rgba(73, 194, 255, .2);
}

.voice-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 26px 24px calc(30px + env(safe-area-inset-bottom, 0px));
    z-index: 1;
}

.voice-ctl {
    width: 60px;
    height: 60px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(119, 159, 200, .25);
    border-radius: 50%;
    background: rgba(23, 37, 56, .7);
    color: #cfe6f8;
    cursor: pointer;
    transition: transform .18s ease, background .18s ease, border-color .18s ease;
}

.voice-ctl svg {
    display: block;
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.voice-ctl:hover {
    transform: scale(1.05);
    border-color: rgba(73, 194, 255, .5);
}

.voice-ctl[aria-pressed="true"] {
    background: rgba(73, 194, 255, .18);
    border-color: rgba(73, 194, 255, .55);
    color: #8fd6ff;
}

.voice-ctl.voice-end {
    width: 72px;
    height: 72px;
    border: 0;
    background: linear-gradient(145deg, #e05656, #b03232);
    color: #fff;
    box-shadow: 0 10px 34px rgba(224, 86, 86, .35);
}

.voice-ctl.voice-end:hover {
    filter: brightness(1.1);
}

@media (max-width: 640px) {
    .voice-orb {
        width: min(72vw, 280px);
        height: min(72vw, 280px);
    }

    .voice-overlay[data-transcript="1"] .voice-orb {
        width: min(30vw, 112px);
        height: min(30vw, 112px);
    }

    .voice-caption {
        font-size: 15px;
    }

    .voice-controls {
        gap: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .voice-bg i {
        display: none;
    }

    .chat-v2 .btn-voice-chat:not(:disabled):hover,
    .voice-ctl:hover {
        transform: none;
    }
}

/* Diane ringing: she asked for a call, the operator has not answered yet. */

.voice-ring {
    position: fixed;
    inset-inline: 0;
    top: 18px;
    z-index: 9000;
    display: flex;
    justify-content: center;
    pointer-events: none;
}

.voice-ring[hidden] {
    display: none;
}

.voice-ring-card {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: min(92vw, 520px);
    padding: 14px 18px;
    border-radius: 20px;
    border: 1px solid rgba(73, 194, 255, .35);
    background: linear-gradient(150deg, rgba(12, 32, 52, .96), rgba(8, 20, 34, .96));
    box-shadow: 0 18px 50px rgba(0, 0, 0, .45);
    animation: voice-ring-in .28s ease-out;
}

@keyframes voice-ring-in {
    from { opacity: 0; transform: translateY(-14px); }
    to { opacity: 1; transform: none; }
}

.voice-ring-avatar {
    position: relative;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #8fd6ff, #2f7fb5);
}

.voice-ring-avatar span {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid rgba(73, 194, 255, .5);
    animation: voice-ring-pulse 1.6s ease-out infinite;
}

@keyframes voice-ring-pulse {
    from { opacity: .8; transform: scale(.85); }
    to { opacity: 0; transform: scale(1.25); }
}

.voice-ring-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.voice-ring-text strong {
    font-size: 15px;
    color: #eaf6ff;
}

.voice-ring-text span {
    font-size: 13px;
    color: #9fc3dc;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.voice-ring-actions {
    display: flex;
    gap: 8px;
    margin-inline-start: auto;
}

.voice-ring-actions button {
    padding: 9px 16px;
    border-radius: 999px;
    border: 0;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.voice-ring-answer {
    background: linear-gradient(145deg, #43c47a, #2c9358);
    color: #fff;
}

.voice-ring-decline {
    background: rgba(255, 255, 255, .08);
    color: #cfe6f8;
    border: 1px solid rgba(255, 255, 255, .14) !important;
}

.voice-ring-actions button:hover {
    filter: brightness(1.08);
}

@media (max-width: 560px) {
    .voice-ring-card {
        flex-wrap: wrap;
    }

    .voice-ring-actions {
        width: 100%;
        margin-inline-start: 0;
    }

    .voice-ring-actions button {
        flex: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .voice-ring-card,
    .voice-ring-avatar span {
        animation: none;
    }
}

/* Voice switch inside the call + settings voice browser. */

.voice-switch {
    max-width: 150px;
    padding: 7px 10px;
    border: 1px solid rgba(73, 194, 255, .3);
    border-radius: 999px;
    background: rgba(23, 60, 90, .5);
    color: #cfe6f8;
    font-size: 12px;
}

.voice-switch:disabled {
    opacity: .5;
}

.voice-browser {
    margin-top: 14px;
    border-top: 1px solid rgba(119, 159, 200, .12);
    padding-top: 12px;
}

.voice-browser-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.voice-browser-bar input {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid rgba(119, 159, 200, .18);
    border-radius: 10px;
    background: rgba(11, 20, 33, .7);
    color: #e5f1fb;
    font-size: 12px;
}

.voice-browser-bar span {
    font-size: 11px;
    color: #6c8097;
    white-space: nowrap;
}

.voice-browser-list {
    display: grid;
    gap: 8px;
    max-height: 260px;
    overflow-y: auto;
}

.voice-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border: 1px solid rgba(119, 159, 200, .14);
    border-radius: 12px;
    background: rgba(17, 32, 52, .5);
    cursor: pointer;
    text-align: start;
    width: 100%;
    color: #e5f1fb;
}

.voice-row:hover {
    border-color: rgba(73, 194, 255, .4);
}

.voice-row[data-active="true"] {
    border-color: rgba(73, 194, 255, .6);
    background: rgba(23, 60, 90, .5);
}

.voice-row .voice-name {
    font-size: 13px;
    font-weight: 600;
}

.voice-row .voice-meta {
    font-size: 11px;
    color: #8fa5bb;
}

.voice-row .voice-grow {
    flex: 1;
    min-width: 0;
}

.voice-row .voice-play {
    padding: 6px 12px;
    border: 1px solid rgba(73, 194, 255, .35);
    border-radius: 999px;
    background: transparent;
    color: #8fd6ff;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.voice-row .voice-play:hover {
    background: rgba(73, 194, 255, .15);
}


/* ──── Smart home (בית חכם) ──────────────────────────────────────────────
   Device cards, filters, controls and camera stage. Reuses transport hero,
   panel and placeholder rules; everything here is home-specific polish. */

/* ── Layout & filters ─────────────────────────────────────────────────── */

.home-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: var(--s-4);
    align-items: start;
}

.home-col {
    display: flex;
    flex-direction: column;
    gap: var(--s-4);
    min-width: 0;
}

.home-col-wide {
    min-width: 0;
}

.home-alert {
    padding: var(--s-3) var(--s-4);
    margin-bottom: var(--s-3);
    border: 1px solid color-mix(in srgb, var(--bad) 55%, var(--line));
    border-radius: var(--r-3);
    background: color-mix(in srgb, var(--bad) 10%, var(--surface-1));
    color: var(--ink);
    font-size: .82rem;
    line-height: 1.6;
    white-space: pre-wrap;
    box-shadow: 0 8px 28px -18px color-mix(in srgb, var(--bad) 40%, transparent);
}

.home-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-2);
    margin-bottom: var(--s-3);
    padding: 2px 0;
}

.home-filter {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 5px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-1);
    color: var(--ink-2);
    font: inherit;
    font-size: .74rem;
    font-weight: 600;
    cursor: pointer;
    transition:
        border-color var(--fast) var(--ease),
        background-color var(--fast) var(--ease),
        color var(--fast) var(--ease),
        transform var(--fast) var(--ease),
        box-shadow var(--fast) var(--ease);
}

.home-filter:hover {
    border-color: var(--line-strong);
    color: var(--ink);
    background: var(--surface-2);
}

.home-filter[data-active="true"] {
    border-color: color-mix(in srgb, var(--diane) 55%, var(--line));
    color: var(--ink);
    background: linear-gradient(135deg, var(--diane-soft), color-mix(in srgb, var(--diane-violet) 8%, var(--surface-1)));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--diane) 18%, transparent);
}

.home-filter:focus-visible {
    outline: 2px solid var(--diane);
    outline-offset: 2px;
}

.home-filter:active {
    transform: scale(.97);
}

/* ── Device grid & cards ──────────────────────────────────────────────── */

.home-devices {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--s-3);
}

.home-devices:has(.home-room) {
    display: flex;
    flex-direction: column;
    gap: var(--s-5);
}

.home-room-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--s-3);
    margin-bottom: var(--s-3);
}

.home-room-head h4 {
    margin: 0;
    font-size: .82rem;
    font-weight: 600;
    color: var(--ink-2);
}

.home-room-count {
    font-size: .72rem;
    color: var(--ink-3);
}

.home-room-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--s-3);
}

.home-device[data-busy="true"] {
    opacity: .78;
    pointer-events: none;
}

.home-device[data-busy="true"]::after {
    content: "";
    position: absolute;
    inset-block-start: 10px;
    inset-inline-start: 10px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--diane);
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--diane) 45%, transparent);
    animation: home-pulse 1.2s var(--ease) infinite;
}

.home-devices[data-state="empty"] {
    display: block;
}

.home-device {
    --home-card-glow: transparent;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
    padding: var(--s-3);
    border: 1px solid var(--line);
    border-radius: var(--r-3);
    background:
        radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--diane) 6%, transparent), transparent 58%),
        linear-gradient(180deg, color-mix(in srgb, var(--surface-2) 40%, transparent), transparent 42%),
        var(--canvas);
    min-width: 0;
    overflow: hidden;
    box-shadow: 0 10px 28px -22px rgba(0, 0, 0, .55);
    transition:
        border-color var(--normal) var(--ease),
        box-shadow var(--normal) var(--ease),
        transform var(--normal) var(--ease),
        opacity var(--normal) var(--ease);
    animation: home-card-in .42s var(--ease) both;
}

.home-devices .home-device:nth-child(1) { animation-delay: 0ms; }
.home-devices .home-device:nth-child(2) { animation-delay: 35ms; }
.home-devices .home-device:nth-child(3) { animation-delay: 70ms; }
.home-devices .home-device:nth-child(4) { animation-delay: 105ms; }
.home-devices .home-device:nth-child(5) { animation-delay: 140ms; }
.home-devices .home-device:nth-child(6) { animation-delay: 175ms; }
.home-devices .home-device:nth-child(7) { animation-delay: 210ms; }
.home-devices .home-device:nth-child(8) { animation-delay: 245ms; }
.home-devices .home-device:nth-child(n+9) { animation-delay: 280ms; }

@keyframes home-card-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.home-device::after {
    content: "";
    position: absolute;
    inset-inline: 0;
    top: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--home-card-glow), transparent);
    opacity: .85;
    pointer-events: none;
}

.home-device:hover {
    border-color: var(--line-strong);
    box-shadow: 0 14px 36px -20px rgba(0, 0, 0, .65);
    transform: translateY(-1px);
}

.home-devices:not([data-state="empty"]) .home-device--ac {
    grid-column: span 2;
}

.home-room-grid .home-device--ac {
    grid-column: span 2;
}

.home-device[data-online="false"] {
    opacity: .58;
    filter: saturate(.65);
}

/* Kind accent states */

.home-device--light[data-on="true"] {
    --home-card-glow: var(--wait);
    border-color: color-mix(in srgb, var(--wait) 42%, var(--line));
    background:
        radial-gradient(90% 120% at 0% 0%, color-mix(in srgb, var(--wait) 14%, transparent), transparent 55%),
        linear-gradient(180deg, color-mix(in srgb, var(--surface-2) 40%, transparent), transparent 42%),
        var(--canvas);
}

.home-device--light[data-on="true"] .home-device-glyph {
    color: var(--wait);
    background: color-mix(in srgb, var(--wait) 16%, var(--surface-1));
    border-color: color-mix(in srgb, var(--wait) 35%, var(--line));
    box-shadow: 0 0 18px color-mix(in srgb, var(--wait) 35%, transparent);
}

.home-device--ac[data-on="true"] {
    --home-card-glow: var(--diane);
    border-color: color-mix(in srgb, var(--diane) 40%, var(--line));
}

.home-device--ac[data-on="true"] .home-device-glyph {
    color: var(--diane);
    background: var(--diane-soft);
    border-color: color-mix(in srgb, var(--diane) 35%, var(--line));
}

.home-device--lock[data-locked="true"] {
    --home-card-glow: var(--ok);
    border-color: color-mix(in srgb, var(--ok) 38%, var(--line));
}

.home-device--lock[data-locked="false"] {
    --home-card-glow: var(--wait);
    border-color: color-mix(in srgb, var(--wait) 38%, var(--line));
}

.home-device--lock[data-locked="true"] .home-device-glyph {
    color: var(--ok);
    background: color-mix(in srgb, var(--ok) 12%, var(--surface-1));
}

.home-device--lock[data-locked="false"] .home-device-glyph {
    color: var(--wait);
    background: color-mix(in srgb, var(--wait) 12%, var(--surface-1));
}

.home-device--camera .home-device-glyph {
    color: var(--diane-violet);
    background: var(--violet-soft);
    border-color: var(--violet-line);
}

/* ── Device head ──────────────────────────────────────────────────────── */

.home-device-head {
    display: flex;
    align-items: flex-start;
    gap: var(--s-2);
    min-width: 0;
}

.home-device-icon-wrap {
    position: relative;
    flex: none;
    width: 42px;
    height: 42px;
}

.home-device-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: var(--r-2);
    background: var(--surface-1);
}

.home-device-img[hidden] {
    display: none;
}

.home-device-glyph {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: var(--r-2);
    background: var(--surface-1);
    color: var(--diane);
    transition:
        color var(--fast) var(--ease),
        background-color var(--fast) var(--ease),
        border-color var(--fast) var(--ease),
        box-shadow var(--fast) var(--ease);
}

.home-device-glyph svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.65;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.home-device-glyph[data-kind="light"] { color: var(--wait); }
.home-device-glyph[data-kind="ac"] { color: var(--diane); }
.home-device-glyph[data-kind="lock"] { color: var(--ok); }
.home-device-glyph[data-kind="plug"],
.home-device-glyph[data-kind="switch"] { color: var(--diane-blue); }
.home-device-glyph[data-kind="sensor"] { color: var(--ink-2); }
.home-device-glyph[data-kind="camera"] { color: var(--diane-violet); }

.home-device-titles {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.home-device-name {
    font-size: .88rem;
    font-weight: 650;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    letter-spacing: -.01em;
}

.home-device-meta {
    font-size: .72rem;
    color: var(--ink-3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-mono {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.02em;
}

/* Legacy icon span (pre-snippet cards) */
.home-device-icon {
    font-size: 1.15rem;
    line-height: 1;
    flex: none;
}

.home-device-summary {
    font-size: .76rem;
    color: var(--ink-2);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}

/* ── Status dot ───────────────────────────────────────────────────────── */

.home-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ink-3);
    flex: none;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15);
}

.home-dot[data-online="true"] {
    background: var(--ok);
    box-shadow: 0 0 10px color-mix(in srgb, var(--ok) 55%, transparent);
}

.home-dot[data-online="false"] {
    background: var(--ink-3);
}

.home-dot--pulse {
    position: relative;
}

.home-dot--pulse[data-online="true"]::before {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--ok) 35%, transparent);
    animation: home-pulse 2.2s ease-out infinite;
}

@keyframes home-pulse {
    0% {
        transform: scale(.65);
        opacity: .75;
    }
    70% {
        transform: scale(2.2);
        opacity: 0;
    }
    100% {
        transform: scale(2.2);
        opacity: 0;
    }
}

/* ── Controls shell ───────────────────────────────────────────────────── */

.home-controls {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
    min-width: 0;
}

.home-controls--light,
.home-controls--power,
.home-controls--curtain {
    gap: var(--s-3);
}

.home-controls--ac {
    gap: var(--s-3);
}

.home-controls--lock,
.home-controls--sensor,
.home-controls--camera,
.home-controls--generic {
    gap: var(--s-2);
}

.home-device-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-2);
    margin-top: auto;
    padding-top: var(--s-2);
}

/* ── Power switch (RTL-aware thumb) ───────────────────────────────────── */

.home-power {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    padding: 0;
    border: none;
    background: none;
    color: var(--ink-2);
    font: inherit;
    font-size: .72rem;
    cursor: pointer;
    transition: opacity var(--fast) var(--ease);
}

.home-power:disabled {
    opacity: .45;
    cursor: default;
}

.home-power-track {
    position: relative;
    width: 44px;
    height: 24px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    transition:
        background-color var(--fast) var(--ease),
        border-color var(--fast) var(--ease),
        box-shadow var(--fast) var(--ease);
}

.home-power-thumb {
    position: absolute;
    top: 2px;
    inset-inline-start: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--ink-3);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
    transition:
        inset-inline-start var(--normal) var(--ease),
        background-color var(--fast) var(--ease),
        transform var(--fast) var(--ease);
}

.home-power[data-on="true"] .home-power-track {
    border-color: color-mix(in srgb, var(--ok) 50%, var(--line));
    background: color-mix(in srgb, var(--ok) 18%, var(--surface-2));
    box-shadow: inset 0 0 12px color-mix(in srgb, var(--ok) 12%, transparent);
}

.home-power[data-on="true"] .home-power-thumb {
    inset-inline-start: calc(100% - 20px);
    background: var(--ok);
}

.home-power:not(:disabled):hover .home-power-thumb {
    transform: scale(1.06);
}

.home-power-label {
    font-weight: 600;
    color: var(--ink-3);
}

.home-power[data-on="true"] .home-power-label {
    color: var(--ink);
}

/* ── AC & temperature ─────────────────────────────────────────────────── */

.home-ac-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-3);
    flex-wrap: wrap;
}

.home-temp-block {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    min-width: 0;
}

.home-temp-current {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--ink);
    line-height: 1;
}

.home-temp-target {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.home-temp-set {
    min-width: 2.4ch;
    text-align: center;
    font-size: .95rem;
    font-weight: 650;
    color: var(--diane);
}

.home-temp-step {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--r-1);
    background: var(--surface-1);
    color: var(--ink-2);
    font: inherit;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    transition:
        border-color var(--fast) var(--ease),
        background-color var(--fast) var(--ease),
        color var(--fast) var(--ease),
        transform var(--fast) var(--ease);
}

.home-temp-step:hover:not(:disabled) {
    border-color: var(--diane);
    color: var(--ink);
    background: var(--diane-soft);
}

.home-temp-step:active:not(:disabled) {
    transform: scale(.94);
}

.home-temp-step:disabled {
    opacity: .4;
    cursor: default;
}

.home-temp-caption {
    font-size: .64rem;
    color: var(--ink-3);
    letter-spacing: .02em;
}

/* ── Sliders ──────────────────────────────────────────────────────────── */

.home-slider-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.home-slider-label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--s-2);
    font-size: .72rem;
    color: var(--ink-3);
}

.home-slider-label b {
    color: var(--ink);
    font-weight: 650;
}

.home-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 999px;
    border: none;
    background: linear-gradient(
        to inline-end,
        var(--diane) 0%,
        var(--diane) var(--home-slider-pct, 50%),
        var(--surface-3) var(--home-slider-pct, 50%),
        var(--surface-3) 100%
    );
    cursor: pointer;
}

.home-slider:focus-visible {
    outline: 2px solid var(--diane);
    outline-offset: 3px;
}

.home-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--canvas);
    background: var(--diane);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
    transition: transform var(--fast) var(--ease);
}

.home-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--canvas);
    background: var(--diane);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
}

.home-slider:active::-webkit-slider-thumb {
    transform: scale(1.12);
}

.home-slider:disabled {
    opacity: .45;
    cursor: default;
}

/* Light cards tie slider fill to brightness custom property */
.home-device--light .home-slider {
    --home-slider-pct: calc(var(--home-bright, 50) * 1%);
    background: linear-gradient(
        to inline-end,
        var(--wait) 0%,
        var(--wait) var(--home-slider-pct),
        var(--surface-3) var(--home-slider-pct),
        var(--surface-3) 100%
    );
}

.home-device--light .home-slider::-webkit-slider-thumb {
    background: var(--wait);
}

.home-device--light .home-slider::-moz-range-thumb {
    background: var(--wait);
}

/* ── Mode / fan chips ─────────────────────────────────────────────────── */

.home-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.home-chip-btn {
    min-height: 28px;
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-1);
    color: var(--ink-2);
    font: inherit;
    font-size: .7rem;
    font-weight: 600;
    cursor: pointer;
    transition:
        border-color var(--fast) var(--ease),
        background-color var(--fast) var(--ease),
        color var(--fast) var(--ease),
        transform var(--fast) var(--ease);
}

.home-chip-btn:hover:not(:disabled) {
    border-color: var(--line-strong);
    color: var(--ink);
    background: var(--surface-2);
}

.home-chip-btn[data-active="true"] {
    border-color: color-mix(in srgb, var(--diane) 50%, var(--line));
    color: var(--ink);
    background: var(--diane-soft);
}

.home-chip-btn:active:not(:disabled) {
    transform: scale(.96);
}

.home-chip-btn:disabled {
    opacity: .45;
    cursor: default;
}

/* ── Lock control ─────────────────────────────────────────────────────── */

.home-lock-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-2);
    min-height: 38px;
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: var(--r-2);
    background: var(--surface-1);
    color: var(--ink);
    font: inherit;
    font-size: .78rem;
    font-weight: 650;
    cursor: pointer;
    transition:
        border-color var(--fast) var(--ease),
        background-color var(--fast) var(--ease),
        box-shadow var(--fast) var(--ease),
        transform var(--fast) var(--ease);
}

.home-lock-btn:hover:not(:disabled) {
    border-color: var(--diane);
    background: var(--diane-soft);
}

.home-lock-btn[data-locked="true"] {
    border-color: color-mix(in srgb, var(--ok) 45%, var(--line));
    background: color-mix(in srgb, var(--ok) 10%, var(--surface-1));
}

.home-lock-btn[data-locked="false"] {
    border-color: color-mix(in srgb, var(--wait) 45%, var(--line));
    background: color-mix(in srgb, var(--wait) 10%, var(--surface-1));
}

.home-lock-btn:disabled {
    opacity: .45;
    cursor: default;
}

.home-lock-icon {
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-radius: 3px;
    position: relative;
}

.home-lock-icon::before {
    content: "";
    position: absolute;
    inset-inline: 2px;
    bottom: 100%;
    height: 7px;
    border: 2px solid currentColor;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
}

.home-lock-btn[data-locked="false"] .home-lock-icon::before {
    transform: translateY(2px) rotate(-12deg);
    transform-origin: bottom center;
}

/* ── Battery, watt, reading, badges ───────────────────────────────────── */

.home-battery {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: .72rem;
    color: var(--ink-2);
}

.home-battery-ring {
    position: relative;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background:
        radial-gradient(farthest-side, var(--surface-1) 72%, transparent 73%),
        conic-gradient(
            var(--home-bat-color, var(--ok)) calc(var(--home-bat, 0) * 1%),
            var(--surface-3) 0
        );
}

.home-battery[data-tone="ok"] { --home-bat-color: var(--ok); }
.home-battery[data-tone="wait"] { --home-bat-color: var(--wait); }
.home-battery[data-tone="bad"] { --home-bat-color: var(--bad); }

.home-battery-val {
    font-family: var(--font-mono);
    font-size: .7rem;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}

.home-watt {
    align-self: center;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface-1);
    color: var(--diane);
    font-size: .72rem;
}

.home-reading {
    padding: var(--s-2) var(--s-3);
    border: 1px solid var(--line);
    border-radius: var(--r-2);
    background: var(--surface-1);
    color: var(--ink);
    font-size: .82rem;
    line-height: 1.4;
}

.home-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.home-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--ink-2);
    font-size: .68rem;
    font-weight: 600;
}

/* ── Card foot & toggles ───────────────────────────────────────────────── */

.home-device-foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--s-2);
    margin-top: auto;
    padding-top: var(--s-2);
    border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.home-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-1);
    color: var(--ink-2);
    font-size: .72rem;
    font-family: inherit;
    cursor: pointer;
    transition:
        border-color var(--fast) var(--ease),
        background-color var(--fast) var(--ease),
        color var(--fast) var(--ease);
}

.home-toggle[data-on="true"] {
    border-color: color-mix(in srgb, var(--ok) 45%, var(--line));
    color: var(--ink);
    background: color-mix(in srgb, var(--ok) 12%, var(--surface-1));
}

.home-toggle:hover:not(:disabled) {
    border-color: var(--line-strong);
    color: var(--ink);
}

.home-toggle:disabled {
    opacity: .5;
    cursor: default;
}

.home-link-btn {
    padding: 4px 10px;
    border: 1px dashed var(--line);
    border-radius: 999px;
    background: none;
    color: var(--ink-3);
    font-size: .72rem;
    font-family: inherit;
    cursor: pointer;
    transition:
        color var(--fast) var(--ease),
        border-color var(--fast) var(--ease),
        background-color var(--fast) var(--ease);
}

.home-link-btn:hover {
    color: var(--diane);
    border-color: var(--diane);
    background: var(--diane-soft);
}

.home-camera-open {
    align-self: flex-start;
}

/* ── Cameras ──────────────────────────────────────────────────────────── */

.home-cameras {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-2);
}

.home-camera-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--canvas);
    color: var(--ink-2);
    font-size: .76rem;
    font-family: inherit;
    cursor: pointer;
    transition:
        border-color var(--fast) var(--ease),
        background-color var(--fast) var(--ease),
        color var(--fast) var(--ease),
        transform var(--fast) var(--ease);
}

.home-camera-chip:hover {
    border-color: var(--line-strong);
    color: var(--ink);
}

.home-camera-chip[data-active="true"] {
    border-color: var(--diane);
    color: var(--ink);
    background: var(--diane-soft);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--diane) 20%, transparent);
}

.home-camera-chip:active {
    transform: scale(.97);
}

.home-camera-stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 230px;
    gap: var(--s-4);
    margin-top: var(--s-4);
    padding-top: var(--s-4);
    border-top: 1px solid var(--line);
}

.home-camera-title {
    margin: 0 0 var(--s-2);
    font-size: .9rem;
    color: var(--ink);
}

.home-camera-frame {
    position: relative;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-3);
    background: #000;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .04), 0 16px 40px -28px rgba(0, 0, 0, .9);
}

.home-camera-video,
.home-camera-still {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.home-camera-msg {
    margin: 0;
    padding: var(--s-3);
    color: var(--ink-3);
    font-size: .78rem;
    line-height: 1.6;
    text-align: center;
    white-space: pre-wrap;
}

.home-camera-canvas {
    display: none;
}

.home-camera-side {
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
    min-width: 0;
}

.home-camera-actions {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
}

.home-side-label {
    display: block;
    margin-bottom: var(--s-2);
    font-size: .72rem;
    color: var(--ink-3);
}

.home-ptz {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}

.home-ptz-btn {
    padding: 8px 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--canvas);
    color: var(--ink-2);
    font-size: .85rem;
    font-family: inherit;
    cursor: pointer;
    transition:
        border-color var(--fast) var(--ease),
        background-color var(--fast) var(--ease),
        color var(--fast) var(--ease),
        transform var(--fast) var(--ease);
}

.home-ptz-btn:hover {
    border-color: var(--diane);
    color: var(--ink);
    background: var(--diane-soft);
}

.home-ptz-btn:active {
    transform: scale(.94);
}

.home-ptz-stop {
    color: var(--bad);
}

.home-features {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s-2);
}

.home-feat {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 64px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--r-3);
    background:
        linear-gradient(160deg, color-mix(in srgb, var(--surface-2) 70%, transparent), var(--canvas));
    color: var(--ink-2);
    font: inherit;
    text-align: start;
    cursor: pointer;
    transition:
        border-color var(--fast) ease,
        background-color var(--fast) ease,
        transform var(--fast) var(--ease),
        box-shadow var(--normal) var(--ease);
}

.home-feat:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: var(--line-strong);
}

.home-feat:active:not(:disabled) {
    transform: scale(.98);
}

.home-feat:disabled {
    opacity: .55;
    cursor: default;
}

.home-feat-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--ink-3);
}

.home-feat-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.home-feat-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.home-feat-label {
    font-size: .78rem;
    font-weight: 600;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-feat-state {
    font-size: .68rem;
    color: var(--ink-3);
}

.home-feat-switch {
    width: 34px;
    height: 20px;
    border-radius: 999px;
    background: var(--surface-3);
    border: 1px solid var(--line);
    position: relative;
    flex: none;
}

.home-feat-switch i {
    position: absolute;
    top: 1px;
    inset-inline-start: 1px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--ink-3);
    transition: inset-inline-start var(--normal) var(--ease), background-color var(--fast) ease;
}

.home-feat[data-on="true"] {
    border-color: color-mix(in srgb, var(--ok) 45%, var(--line));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--ok) 12%, transparent);
}

.home-feat[data-on="true"] .home-feat-state {
    color: var(--ok);
}

.home-feat[data-on="true"] .home-feat-switch {
    background: color-mix(in srgb, var(--ok) 28%, var(--surface-2));
    border-color: color-mix(in srgb, var(--ok) 50%, var(--line));
}

.home-feat[data-on="true"] .home-feat-switch i {
    inset-inline-start: calc(100% - 17px);
    background: var(--ok);
}

.home-feat[data-tone="ok"][data-on="true"] .home-feat-icon {
    color: var(--ok);
    background: color-mix(in srgb, var(--ok) 16%, var(--surface-2));
    border-color: color-mix(in srgb, var(--ok) 40%, var(--line));
}

.home-feat[data-tone="bad"][data-on="true"] {
    border-color: color-mix(in srgb, var(--bad) 45%, var(--line));
}
.home-feat[data-tone="bad"][data-on="true"] .home-feat-icon {
    color: var(--bad);
    background: color-mix(in srgb, var(--bad) 16%, var(--surface-2));
    border-color: color-mix(in srgb, var(--bad) 40%, var(--line));
}
.home-feat[data-tone="bad"][data-on="true"] .home-feat-state,
.home-feat[data-tone="bad"][data-on="true"] .home-feat-switch i { color: var(--bad); }
.home-feat[data-tone="bad"][data-on="true"] .home-feat-switch {
    background: color-mix(in srgb, var(--bad) 24%, var(--surface-2));
    border-color: color-mix(in srgb, var(--bad) 45%, var(--line));
}
.home-feat[data-tone="bad"][data-on="true"] .home-feat-switch i { background: var(--bad); }

.home-feat[data-tone="wait"][data-on="true"] .home-feat-icon {
    color: var(--wait);
    background: color-mix(in srgb, var(--wait) 16%, var(--surface-2));
    border-color: color-mix(in srgb, var(--wait) 40%, var(--line));
}

.home-feat[data-tone="diane"][data-on="true"] .home-feat-icon,
.home-feat[data-tone="blue"][data-on="true"] .home-feat-icon {
    color: var(--diane);
    background: var(--diane-soft);
    border-color: color-mix(in srgb, var(--diane) 40%, var(--line));
}

.home-feat[data-tone="violet"][data-on="true"] .home-feat-icon {
    color: var(--diane-violet);
    background: var(--violet-soft);
    border-color: var(--violet-line);
}

.home-feat[data-tone="violet"][data-on="true"] {
    border-color: var(--violet-line);
}

.home-answer {
    margin-top: var(--s-3);
    padding: var(--s-3);
    border: 1px solid var(--line);
    border-radius: var(--r-3);
    background: var(--surface-1);
    color: var(--ink);
    font-size: .82rem;
    line-height: 1.65;
    white-space: pre-wrap;
}

.home-events {
    margin-top: var(--s-3);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.home-event {
    display: flex;
    justify-content: space-between;
    gap: var(--s-3);
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--canvas);
    font-size: .74rem;
    color: var(--ink-2);
    transition: border-color var(--fast) var(--ease), background-color var(--fast) var(--ease);
}

.home-event:hover {
    border-color: var(--line-strong);
    background: var(--surface-1);
}

.home-event time {
    color: var(--ink-3);
    flex: none;
    font-family: var(--font-mono);
    font-size: .68rem;
    font-variant-numeric: tabular-nums;
}

/* ── Scenes & connection ──────────────────────────────────────────────── */

.home-scenes {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
}

.home-scene {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: var(--r-3);
    background: var(--canvas);
    color: var(--ink-2);
    font-size: .8rem;
    font-family: inherit;
    text-align: start;
    cursor: pointer;
    transition:
        border-color var(--fast) var(--ease),
        background-color var(--fast) var(--ease),
        color var(--fast) var(--ease),
        transform var(--fast) var(--ease);
}

.home-scene:hover {
    border-color: var(--diane);
    color: var(--ink);
    background: var(--diane-soft);
}

.home-scene:active {
    transform: scale(.99);
}

.home-scene-glyph {
    flex: none;
    width: 28px;
    height: 28px;
    border-radius: var(--r-1);
    border: 1px solid var(--line);
    background:
        radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--diane) 35%, transparent), transparent 62%),
        var(--surface-1);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .04);
}

.home-scenes-error {
    color: var(--bad);
    border-color: color-mix(in srgb, var(--bad) 35%, var(--line));
    background: color-mix(in srgb, var(--bad) 8%, var(--surface-1));
}

.home-connection {
    margin: 0;
    padding: var(--s-3);
    border: 1px solid var(--line);
    border-radius: var(--r-3);
    background: var(--canvas);
    color: var(--ink-2);
    font-size: .76rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: var(--font-mono);
}

/* ── Device drawer ─────────────────────────────────────────────────────── */

.home-drawer {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--s-4);
    background: rgba(0, 0, 0, .48);
    backdrop-filter: blur(4px);
    animation: home-card-in .28s var(--ease) both;
}

.home-drawer-panel {
    width: min(620px, 100%);
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-3);
    background: var(--surface-1);
    overflow: hidden;
    box-shadow: 0 24px 64px -28px rgba(0, 0, 0, .75);
}

.home-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-3);
    padding: var(--s-3) var(--s-4);
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, color-mix(in srgb, var(--surface-2) 50%, transparent), transparent);
}

.home-drawer-head h3 {
    margin: 0;
    font-size: .95rem;
    color: var(--ink);
}

.home-drawer-body {
    padding: var(--s-4);
    overflow-y: auto;
    font-size: .8rem;
    color: var(--ink-2);
    line-height: 1.65;
}

.home-dp-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: var(--s-2);
}

.home-dp-table th,
.home-dp-table td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--line);
    text-align: start;
    font-size: .76rem;
    vertical-align: top;
}

.home-dp-table th {
    color: var(--ink-3);
    font-weight: 500;
}

.home-dp-table td code,
.home-dp-table td .home-mono {
    font-family: var(--font-mono);
    font-size: .72rem;
}

.home-drawer-section {
    margin-top: var(--s-4);
}

.home-drawer-section h4 {
    margin: 0 0 var(--s-2);
    font-size: .82rem;
    color: var(--ink);
}

/* ── Connections panel ─────────────────────────────────────────────────── */

.home-connect {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
}

.home-connect-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-2);
}

.home-connect-name {
    font-size: .82rem;
    font-weight: 600;
    color: var(--ink);
}

.home-connect-link {
    font-size: .74rem;
    color: var(--accent);
    text-decoration: none;
}

.home-connect-link:hover {
    text-decoration: underline;
}

.home-connect-state {
    margin: 0;
    font-size: .76rem;
    line-height: 1.6;
    color: var(--ink-2);
    white-space: pre-wrap;
    word-break: break-word;
}

.home-connect-hint {
    margin: 0;
    font-size: .72rem;
    line-height: 1.55;
    color: var(--ink-3);
}

.home-connect-sep {
    height: 1px;
    margin: var(--s-1) 0;
    background: var(--line);
}

.home-connect-field {
    display: flex;
    align-items: center;
    gap: var(--s-2);
}

.home-connect-field input {
    flex: 1;
    min-width: 0;
    padding: var(--s-2);
    border: 1px solid var(--line);
    border-radius: var(--r-2);
    background: var(--canvas);
    color: var(--ink);
    font: inherit;
    font-size: .78rem;
}

.home-connect-field input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--diane-soft);
}

.home-connect-note {
    margin: 0;
    padding: var(--s-2);
    border-radius: var(--r-2);
    background: var(--canvas);
    color: var(--ink-2);
    font-size: .74rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

.home-connect-note[data-tone="error"] {
    color: var(--danger);
    background: color-mix(in srgb, var(--bad) 8%, var(--canvas));
    border: 1px solid color-mix(in srgb, var(--bad) 30%, var(--line));
}

/* ── Responsive ───────────────────────────────────────────────────────── */

@media (max-width: 1100px) {
    .home-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .home-camera-stage {
        grid-template-columns: minmax(0, 1fr);
    }

    .home-devices:not([data-state="empty"]) .home-device--ac {
        grid-column: span 1;
    }
}

@media (max-width: 720px) {
    .home-devices {
        grid-template-columns: minmax(0, 1fr);
    }

    .home-filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: var(--s-2);
        scrollbar-width: none;
    }

    .home-filters::-webkit-scrollbar {
        display: none;
    }

    .home-filter {
        flex: 0 0 auto;
    }

    .home-ac-top {
        flex-direction: column;
        align-items: stretch;
    }

    .home-temp-block {
        align-items: flex-start;
    }

    .home-device-foot {
        justify-content: stretch;
    }

    .home-link-btn {
        flex: 1;
        text-align: center;
    }

    .home-drawer {
        padding: var(--s-3);
        align-items: flex-end;
    }

    .home-drawer-panel {
        max-height: 88vh;
        border-end-start-radius: var(--r-3);
        border-end-end-radius: var(--r-3);
    }
}

/* ── Reduced motion ───────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .home-device,
    .home-drawer {
        animation: none;
    }

    .home-dot--pulse[data-online="true"]::before {
        animation: none;
    }

    .home-device,
    .home-filter,
    .home-camera-chip,
    .home-scene,
    .home-ptz-btn,
    .home-chip-btn,
    .home-temp-step,
    .home-power-thumb {
        transition: none;
    }
}
/* ══ Transport polish ═══════════════════════════════════════════════
   The map went from "a grid of images redrawn on every pointer move" to
   two persistent layers. These rules are what make that visible: markers
   glide to their new position instead of blinking there, and every control
   answers the finger it was pressed with. */

.transport-map-markers { position: absolute; inset: 0; pointer-events: none; }
.transport-map-markers > * { pointer-events: auto; }
.transport-map-tiles { will-change: transform; }
.transport-map-tiles img { background: var(--surface-2); }

/* A marker keeps its element between polls, so moving it is an animation
   rather than a redraw. The easing is the settle of something with weight. */
.transport-map-marker {
    transition:
        left .5s cubic-bezier(.22, .61, .36, 1),
        top .5s cubic-bezier(.22, .61, .36, 1),
        transform .16s ease,
        box-shadow .18s ease,
        background-color .2s ease,
        border-color .2s ease;
}
@media (prefers-reduced-motion: reduce) {
    .transport-map-marker { transition: none; }
    .transport-map-marker[data-kind="me"]::before { animation: none; }
}

.transport-map-marker[data-kind="bus"] {
    height: 24px; padding: 0 8px;
    border-radius: 999px;
    font-size: .7rem; letter-spacing: .02em;
    box-shadow: 0 3px 12px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.transport-map-marker[data-kind="bus"]::after {
    content: ""; position: absolute; top: 100%; inset-inline-start: 50%;
    width: 0; height: 0; transform: translateX(-50%);
    border-inline: 4px solid transparent;
    border-top: 5px solid var(--diane-violet);
}
.transport-map-marker[data-kind="bus"][data-stale="true"]::after { border-top-color: var(--ink-3); }

.transport-map-marker[data-kind="bus"]:hover,
.transport-map-marker[data-kind="stop"]:hover { transform: translate(-50%, -50%) scale(1.14); z-index: 5; }
.transport-map-marker[data-kind="near"]:hover { transform: translate(-50%, -50%) scale(1.35); }
.transport-map-marker:active { transform: translate(-50%, -50%) scale(.94); }
.transport-map-marker[data-open="true"] { z-index: 6; }

/* The bus the map is tracking. A ring rather than a colour change, so the
   line number stays as readable as every other pin. */
.transport-map-marker[data-follow="true"] {
    z-index: 7;
    box-shadow: 0 0 0 3px var(--canvas), 0 0 0 6px var(--diane), 0 3px 14px rgba(0, 0, 0, .55);
}

/* The device fix, breathing. Nothing here is a guess: the dot only exists
   once the browser has handed over a real position. */
.transport-map-marker[data-kind="me"] { overflow: visible; }
.transport-map-marker[data-kind="me"]::before {
    content: ""; position: absolute; inset: -5px;
    border-radius: 50%; background: rgba(124, 92, 255, .30);
    animation: transport-pulse 2.4s ease-out infinite;
}
@keyframes transport-pulse {
    0% { transform: scale(.7); opacity: .75; }
    70% { transform: scale(2.1); opacity: 0; }
    100% { transform: scale(2.1); opacity: 0; }
}

/* Map controls: same size, now with a state for every input a finger or a
   keyboard can produce. */
.transport-map-zoom { gap: 4px; }
.transport-map-zoom button {
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(6px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .4);
    transition: border-color .15s ease, background-color .15s ease, transform .12s ease, color .15s ease;
}
.transport-map-zoom button:hover { background: rgba(11, 19, 32, .95); color: var(--diane); }
.transport-map-zoom button:active { transform: scale(.92); }
.transport-map-zoom button:focus-visible { outline: 2px solid var(--diane); outline-offset: 2px; }
.transport-map-here { font-size: 1.05rem; line-height: 1; }
.transport-map-here:hover { color: var(--diane-violet); border-color: var(--diane-violet); }

/* The uncertainty band, in words. The badge above it carries one number so
   it can be read at a glance; this line says how wide the engine's window
   actually is, which is what "0-6" was failing to communicate. */
.transport-arrival-range {
    display: inline-flex; align-items: center;
    padding: 1px 7px; border-radius: 999px;
    border: 1px solid var(--line); background: var(--surface-2);
    color: var(--ink-3); font-size: .66rem; white-space: nowrap;
}

/* Arrival rows respond to a press. A live row also carries a quiet edge, so
   the eye can tell reported from scheduled without reading the label. */
.transport-arrival {
    transition: border-color .15s ease, background-color .15s ease, transform .12s ease, box-shadow .15s ease;
}
.transport-arrival:hover { background: var(--surface-2); box-shadow: 0 2px 12px rgba(0, 0, 0, .28); }
.transport-arrival:active { transform: scale(.995); }
.transport-arrival[data-live="true"] { border-inline-start: 2px solid var(--diane); }
.transport-eta strong { font-variant-numeric: tabular-nums; }
.transport-line-badge { transition: transform .12s ease; }
.transport-arrival:hover .transport-line-badge { transform: scale(1.06); }
/* The last minute before a bus reaches the stop. Derived from the same
   arrival time the badge counts down, never from a separate guess. */
.transport-arrival[data-imminent="true"] {
    border-color: var(--diane);
    background: linear-gradient(90deg, rgba(124, 92, 255, .14), transparent 62%);
}
.transport-arrival[data-imminent="true"] .transport-eta strong {
    color: var(--diane);
    animation: transport-imminent 1.6s ease-in-out infinite;
}
@keyframes transport-imminent {
    0%, 100% { opacity: 1; }
    50% { opacity: .55; }
}
@media (prefers-reduced-motion: reduce) {
    .transport-arrival[data-imminent="true"] .transport-eta strong { animation: none; }
}

/* The check's cadence, its report channel and the trail it leaves behind. */
.price-schedule { margin: 0 20px 16px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.price-schedule > summary { cursor: pointer; font-weight: 600; font-size: .82rem; color: var(--ink-1); }
.price-schedule > summary::marker { color: var(--ink-3); }
.price-schedule-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.price-schedule-grid label { display: flex; flex-direction: column; gap: 4px; font-size: .72rem; color: var(--ink-3); }
.price-schedule-grid select,
.price-schedule-grid input { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2, transparent); color: var(--ink-1); font-size: .78rem; }
.price-schedule-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
#price-schedule-status { font-size: .72rem; color: var(--ink-3); }
#media-generation-status { font-size: .72rem; color: var(--ink-3); }
.media-generation-prompt { display: flex; flex-direction: column; gap: 4px; font-size: .72rem; color: var(--ink-3); margin-top: 10px; }
.media-generation-prompt textarea { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2, transparent); color: var(--ink-1); font-size: .78rem; font-family: inherit; resize: vertical; }
#price-runs-table { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: .72rem; }
#price-runs-table th,
#price-runs-table td { padding: 6px 8px; text-align: start; border-bottom: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
#price-runs-table th { color: var(--ink-3); font-weight: 600; }

/* ──────────── Transport: the delight pass ────────────
   The owner's verdict on the previous look was "ממש גרוע ולא כייפי".
   These rules come last on purpose, so they win without disturbing the
   structural transport block above. */

.transport-page.active { gap: var(--s-4); }

.transport-hero {
    position: relative; overflow: hidden;
    border-radius: var(--r-3);
    background:
        radial-gradient(120% 160% at 100% 0%, rgba(56, 189, 248, .16), transparent 58%),
        radial-gradient(120% 160% at 0% 100%, rgba(167, 139, 250, .14), transparent 60%),
        var(--surface-1);
    border: 1px solid var(--line-strong);
}
.transport-hero::after {
    content: ""; position: absolute; inset-inline: 0; bottom: 0; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(56, 189, 248, .55), transparent);
}

.transport-panel {
    position: relative;
    border-radius: var(--r-3);
    background: linear-gradient(180deg, rgba(255, 255, 255, .035), transparent 42%), var(--surface-1);
    transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.transport-panel:hover {
    border-color: var(--line-strong);
    box-shadow: 0 10px 30px -22px rgba(0, 0, 0, .9);
}
.transport-panel-head h3 {
    font-size: 1rem; letter-spacing: -.01em;
}

/* An arrival row should read like a departure board, and react to a hover. */
.transport-arrival {
    border-radius: var(--r-2);
    transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.transport-arrival:hover {
    background: rgba(56, 189, 248, .07);
    border-color: rgba(56, 189, 248, .35);
    transform: translateX(-2px);
}
.transport-arrival[data-imminent="true"] {
    background: rgba(248, 113, 113, .09);
    border-color: rgba(248, 113, 113, .38);
}

/* The map is the centrepiece, so it gets the room and the frame. */
.transport-map {
    height: 420px;
    border-radius: var(--r-3);
    border-color: var(--line-strong);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .03), 0 18px 40px -32px rgba(0, 0, 0, 1);
}
.transport-map-tiles img {
    background: transparent;
}

.transport-map-zoom {
    gap: 6px;
    padding: 4px;
    border-radius: var(--r-2);
    background: rgba(6, 11, 20, .55);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, .07);
}
.transport-map-zoom button {
    width: 32px; height: 32px;
    border-radius: var(--r-2);
    background: rgba(14, 22, 36, .9);
    transition: background .15s ease, border-color .15s ease, transform .12s ease;
}
.transport-map-zoom button:hover { background: rgba(56, 189, 248, .18); transform: scale(1.06); }
.transport-map-zoom button:active { transform: scale(.94); }

.transport-map-credit { opacity: .75; }

@media (max-width: 900px) {
    .transport-map { height: 320px; }
}

/* ──────────── Transport: AAA loading + cohesion pass ────────────
   Fixes the Esri placeholder-zoom look, replaces bare "טוען…" with
   motion that matches the board, and tightens empty states so the
   screen feels intentional before data arrives. */

.transport-hero[data-state="loading"] {
    opacity: .92;
}
.transport-hero[data-state="loading"] h2 {
    background: linear-gradient(90deg, var(--ink-3), var(--ink), var(--ink-3));
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: transport-skel-shine 1.4s ease-in-out infinite;
}

.transport-spinner {
    width: 18px; height: 18px; flex: 0 0 auto;
    border: 2px solid rgba(56, 189, 248, .22);
    border-top-color: rgba(56, 189, 248, .95);
    border-radius: 50%;
    animation: transport-spin .7s linear infinite;
}
.transport-spinner-inline {
    width: 14px; height: 14px;
    border-width: 1.5px;
}
.vault-btn.is-busy,
.vault-btn.is-busy {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    pointer-events: none; opacity: .88;
}
@keyframes transport-spin {
    to { transform: rotate(360deg); }
}

.transport-skel {
    display: grid; gap: 8px;
    padding: var(--s-3);
    border: 1px solid var(--line);
    border-radius: var(--r-2);
    background: var(--surface-2);
    overflow: hidden;
}
.transport-skel-arrival {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center; min-height: 62px;
}
.transport-skel-stop {
    min-height: 46px; align-content: center;
}
.transport-skel-badge,
.transport-skel-eta,
.transport-skel-bar {
    display: block; border-radius: 8px;
    background: linear-gradient(90deg,
        rgba(255, 255, 255, .04),
        rgba(56, 189, 248, .14),
        rgba(255, 255, 255, .04));
    background-size: 200% 100%;
    animation: transport-skel-shine 1.35s ease-in-out infinite;
}
.transport-skel-badge { width: 46px; height: 34px; }
.transport-skel-eta { width: 54px; height: 28px; }
.transport-skel-bar-lg { height: 12px; width: 72%; }
.transport-skel-bar-sm { height: 9px; width: 48%; opacity: .85; }
.transport-skel-copy { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
@keyframes transport-skel-shine {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

.transport-empty {
    display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
    padding: var(--s-4) var(--s-3);
    border: 1px dashed rgba(56, 189, 248, .22);
    border-radius: var(--r-2);
    background:
        radial-gradient(120% 140% at 100% 0%, rgba(56, 189, 248, .08), transparent 55%),
        rgba(255, 255, 255, .015);
}
.transport-empty-mark {
    width: 28px; height: 28px; border-radius: 9px;
    background:
        linear-gradient(135deg, rgba(56, 189, 248, .35), rgba(167, 139, 250, .28));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
    position: relative;
}
.transport-empty-mark::after {
    content: ""; position: absolute; inset: 8px;
    border: 2px solid rgba(255, 255, 255, .72);
    border-radius: 50%;
    border-top-color: transparent;
}
.transport-empty-title {
    margin: 0; font-size: .88rem; font-weight: 700; color: var(--ink);
    letter-spacing: -.01em;
}
.transport-empty-body {
    margin: 0; max-width: 42ch;
    color: var(--ink-3); font-size: .76rem; line-height: 1.55;
}

.transport-arrivals.is-refreshing {
    opacity: .72;
    transition: opacity .18s ease;
}
.transport-arrivals[data-state="loading"],
.transport-saved[data-state="loading"],
.transport-nearby[data-state="loading"] {
    display: flex; flex-direction: column; gap: var(--s-2);
}

.transport-map-loading {
    position: absolute; inset: 0; z-index: 2;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
    background:
        radial-gradient(80% 80% at 50% 40%, rgba(14, 22, 36, .55), rgba(6, 11, 20, .82));
    color: var(--ink-2); font-size: .78rem;
    backdrop-filter: blur(2px);
    pointer-events: none;
}
.transport-map-loading[hidden] { display: none !important; }

.transport-search-field input {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .03);
}
.transport-search-field input::placeholder { color: var(--ink-3); opacity: .85; }

.transport-stop-row {
    border-radius: 12px;
    padding-inline: 10px;
}
.transport-stop-row:hover {
    background: rgba(56, 189, 248, .07);
}
.transport-stop-row[aria-current="true"] {
    box-shadow: inset 0 0 0 1px rgba(56, 189, 248, .28);
}

.transport-panel-head {
    margin-bottom: var(--s-4);
    padding-bottom: var(--s-2);
    border-bottom: 1px solid rgba(255, 255, 255, .04);
}
.transport-panel-head .vault-subtitle {
    font-size: .68rem; color: var(--ink-3);
}

.transport-map-frame {
    isolation: isolate;
}
.transport-map {
    background:
        radial-gradient(120% 100% at 50% 0%, rgba(56, 189, 248, .08), transparent 55%),
        #0b1220;
}

@media (prefers-reduced-motion: reduce) {
    .transport-spinner,
    .transport-skel-badge,
    .transport-skel-eta,
    .transport-skel-bar,
    .transport-hero[data-state="loading"] h2 {
        animation: none !important;
    }
}

/* ──────────── Transport: AAA pass 2 — markers, search, distance ──────────── */

.transport-hero[data-state="empty"] {
    padding-block: var(--s-4);
}
.transport-hero[data-state="empty"] h2 {
    font-size: 1.35rem;
    letter-spacing: -.02em;
}
.transport-hero[data-state="ready"] h2 {
    letter-spacing: -.025em;
}

.transport-results {
    margin-top: 2px;
    border-color: rgba(56, 189, 248, .28);
    box-shadow: 0 18px 40px -28px rgba(0, 0, 0, .95), 0 0 0 1px rgba(56, 189, 248, .08);
    background: linear-gradient(180deg, rgba(14, 22, 36, .98), rgba(8, 14, 26, .98));
    z-index: 5;
}
.transport-results[data-state="loading"] {
    padding: var(--s-3);
    gap: var(--s-2);
}
.transport-results .transport-stop-open {
    display: flex; align-items: center; gap: var(--s-3);
    width: 100%; min-height: 46px;
    padding: 8px 10px;
    border: 0; border-radius: 10px;
    background: transparent; color: inherit; text-align: start; cursor: pointer;
}
.transport-results .transport-stop-open:hover {
    background: rgba(56, 189, 248, .08);
}

.transport-nearby .transport-stop-open {
    display: flex; align-items: center; gap: var(--s-3);
    width: 100%; min-height: 46px;
    padding: 8px 4px; border: 0; background: transparent;
    color: inherit; text-align: start; cursor: pointer;
}
.transport-distance {
    flex: 0 0 auto;
    min-width: 52px; padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--ink-2);
    font: 600 .68rem/1 var(--font-mono, "JetBrains Mono", monospace);
    direction: ltr; text-align: center;
}
.transport-distance.is-near {
    border-color: rgba(56, 189, 248, .45);
    background: rgba(56, 189, 248, .12);
    color: #7dd3fc;
}
.transport-stop-row.is-closest {
    background: rgba(56, 189, 248, .05);
}

.transport-map-marker[data-kind="bus"] {
    z-index: 4;
    border: 1px solid rgba(255, 255, 255, .22);
    background: linear-gradient(180deg, #8b7cff, #6d5efc);
    text-shadow: 0 1px 0 rgba(0, 0, 0, .35);
    box-shadow: 0 2px 12px rgba(0, 0, 0, .55), 0 0 0 1px rgba(109, 94, 252, .35);
}
.transport-map-marker[data-kind="bus"][data-stale="true"] {
    background: linear-gradient(180deg, #6b7280, #4b5563);
    opacity: .88;
}
.transport-map-marker[data-kind="stop"] {
    z-index: 5;
    width: 18px; height: 18px;
    border-width: 3px;
    box-shadow: 0 0 0 4px rgba(56, 189, 248, .28), 0 2px 10px rgba(0, 0, 0, .45);
}
.transport-map-marker[data-kind="near"] {
    z-index: 3;
    width: 11px; height: 11px;
    border-color: rgba(125, 211, 252, .7);
    background: rgba(14, 22, 36, .95);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, .18);
}
.transport-map-marker[data-kind="me"] {
    z-index: 6;
    width: 14px; height: 14px;
    box-shadow: 0 0 0 5px rgba(167, 139, 250, .28), 0 2px 8px rgba(0, 0, 0, .5);
}
.transport-map-marker[data-follow="true"] {
    animation: transport-follow-ring 1.8s ease-in-out infinite;
}
@keyframes transport-follow-ring {
    0%, 100% { box-shadow: 0 0 0 3px var(--canvas), 0 0 0 6px var(--diane), 0 3px 14px rgba(0, 0, 0, .55); }
    50% { box-shadow: 0 0 0 3px var(--canvas), 0 0 0 9px rgba(56, 189, 248, .55), 0 3px 18px rgba(0, 0, 0, .6); }
}

.transport-arrivals.is-refreshing {
    position: relative;
}
.transport-arrivals.is-refreshing::after {
    content: "";
    position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 2px;
    background: linear-gradient(180deg, transparent, rgba(56, 189, 248, .8), transparent);
    animation: transport-refresh-edge 1.1s ease-in-out infinite;
}
@keyframes transport-refresh-edge {
    0%, 100% { opacity: .35; }
    50% { opacity: 1; }
}

@media (max-width: 640px) {
    .transport-page.active { gap: var(--s-3); }
    .transport-grid { gap: var(--s-3); }
    .transport-distance { min-width: 48px; font-size: .64rem; }
}

@media (prefers-reduced-motion: reduce) {
    .transport-map-marker[data-follow="true"],
    .transport-arrivals.is-refreshing::after {
        animation: none !important;
    }
}

/* ──────────── Transport: AAA pass 3 — keyboard search + row parity ──────────── */

.transport-saved .transport-stop-open {
    display: flex; align-items: center; gap: var(--s-3);
    width: 100%; min-height: 46px;
    padding: 8px 4px; border: 0; background: transparent;
    color: inherit; text-align: start; cursor: pointer;
    min-width: 0; flex: 1 1 auto;
}
.transport-saved .transport-stop-row {
    display: flex; align-items: center; gap: 4px;
}
.transport-results .transport-stop-row[data-active="true"],
.transport-results .transport-stop-row:has(.transport-stop-open:focus-visible),
.transport-saved .transport-stop-row:has(.transport-stop-open:focus-visible),
.transport-nearby .transport-stop-row:has(.transport-stop-open:focus-visible) {
    background: rgba(56, 189, 248, .12);
    box-shadow: inset 0 0 0 1px rgba(56, 189, 248, .35);
    border-radius: 10px;
}
.transport-results .transport-stop-row[data-active="true"] .transport-stop-open {
    background: transparent;
}

.transport-map-zoom {
    inset-inline-start: auto;
    inset-inline-end: var(--s-3);
}
.transport-map-credit {
    display: flex; flex-wrap: wrap; gap: 4px 10px;
    justify-content: space-between;
    direction: rtl;
    opacity: .7;
}
.transport-map-credit a:hover { color: var(--diane); }

.transport-line-detail[data-state="loading"] {
    display: flex; flex-direction: column; gap: var(--s-2);
}

/* ──────────── Transport: AAA pass 4 — board density + light theme ──────────── */

.transport-arrivals { gap: 6px; }
.transport-arrival {
    min-height: 54px;
    padding: 10px 12px;
    gap: 10px;
    border-radius: 12px;
}
.transport-arrival[data-live="true"] {
    border-inline-start: 2px solid var(--ok);
}
.transport-line-badge {
    position: relative;
    min-width: 42px; min-height: 32px;
    font-size: .92rem;
}
.transport-line-badge[data-live="true"]::after {
    content: "";
    position: absolute; top: -3px; inset-inline-end: -3px;
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--ok);
    box-shadow: 0 0 0 2px var(--surface-2), 0 0 8px rgba(71, 215, 154, .55);
}
.transport-arrival-dest { font-size: .82rem; }
.transport-arrival-sub {
    gap: 4px 6px;
    margin-top: 4px;
}
.transport-meta-chip {
    display: inline-flex; align-items: center;
    padding: 1px 7px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface-1);
    color: var(--ink-3);
    font-size: .64rem;
    white-space: nowrap;
}
.transport-live-chip {
    display: inline-flex; align-items: center; gap: 5px;
    margin-top: 5px;
    color: var(--ink-3);
    font-size: .64rem;
}
.transport-live-chip::before {
    content: ""; width: 6px; height: 6px; border-radius: 50%;
    background: var(--ink-3); flex: 0 0 auto;
}
.transport-live-chip[data-live="true"] { color: var(--ok); }
.transport-live-chip[data-live="true"]::before {
    background: var(--ok);
    box-shadow: 0 0 6px rgba(71, 215, 154, .55);
}
.transport-eta { min-width: 64px; }
.transport-eta strong { font-size: 1.2rem; }

html[data-theme="light"] .transport-hero {
    background:
        radial-gradient(120% 160% at 100% 0%, rgba(41, 127, 199, .12), transparent 58%),
        radial-gradient(120% 160% at 0% 100%, rgba(116, 87, 219, .08), transparent 60%),
        var(--surface-1);
}
html[data-theme="light"] .transport-hero::after {
    background: linear-gradient(90deg, transparent, rgba(41, 127, 199, .4), transparent);
}
html[data-theme="light"] .transport-panel {
    background: linear-gradient(180deg, rgba(41, 127, 199, .03), transparent 42%), var(--surface-1);
    box-shadow: 0 10px 28px -24px rgba(23, 24, 36, .45);
}
html[data-theme="light"] .transport-map {
    background:
        radial-gradient(120% 100% at 50% 0%, rgba(41, 127, 199, .08), transparent 55%),
        #d7dce8;
    box-shadow: inset 0 0 0 1px rgba(23, 24, 36, .04);
}
html[data-theme="light"] .transport-map-loading {
    background:
        radial-gradient(80% 80% at 50% 40%, rgba(255, 255, 255, .72), rgba(235, 238, 246, .92));
    color: var(--ink-2);
}
html[data-theme="light"] .transport-map-zoom {
    background: rgba(255, 255, 255, .82);
    border-color: var(--line-strong);
}
html[data-theme="light"] .transport-map-zoom button {
    background: rgba(255, 255, 255, .95);
    color: var(--ink);
}
html[data-theme="light"] .transport-map-card {
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 14px 34px rgba(23, 24, 36, .18);
}
html[data-theme="light"] .transport-empty {
    border-color: rgba(41, 127, 199, .28);
    background:
        radial-gradient(120% 140% at 100% 0%, rgba(41, 127, 199, .08), transparent 55%),
        rgba(41, 127, 199, .02);
}
html[data-theme="light"] .transport-skel,
html[data-theme="light"] .transport-skel-badge,
html[data-theme="light"] .transport-skel-eta,
html[data-theme="light"] .transport-skel-bar {
    background: linear-gradient(90deg,
        rgba(23, 24, 36, .04),
        rgba(41, 127, 199, .12),
        rgba(23, 24, 36, .04));
    background-size: 200% 100%;
}
html[data-theme="light"] .transport-results {
    background: var(--bg-surface);
    border-color: rgba(41, 127, 199, .28);
    box-shadow: 0 18px 40px -28px rgba(23, 24, 36, .35);
}
html[data-theme="light"] .transport-map-marker[data-kind="bus"] {
    background: linear-gradient(180deg, #8b74ef, #7457db);
}
html[data-theme="light"] .transport-arrival:hover {
    background: rgba(41, 127, 199, .06);
    border-color: rgba(41, 127, 199, .28);
}

/* ──────────── Transport: AAA pass 5 — empty hero CTAs + pin card ──────────── */

.transport-hero[data-state="empty"] .transport-hero-actions {
    align-items: stretch;
}
.transport-hero[data-state="empty"] #btn-transport-hero-nearby {
    min-width: 140px;
}
.transport-pin-title {
    display: flex; align-items: flex-start; gap: 10px;
}
.transport-pin-title-copy {
    min-width: 0; display: flex; flex-direction: column; gap: 2px;
}
.transport-pin-title .transport-line-badge {
    flex: 0 0 auto; margin-top: 2px;
}
.transport-pin-eta-block {
    display: flex; align-items: baseline; gap: 10px;
    padding: 4px 0 2px;
}
.transport-pin-eta {
    color: var(--diane);
    font: 700 1.35rem/1 var(--font-mono, "JetBrains Mono", monospace);
    direction: ltr;
}
.transport-pin-loading {
    display: flex; flex-direction: column; gap: 6px;
}
.transport-pin-lines {
    list-style: none; margin: 0; padding: 0;
    display: flex; flex-direction: column; gap: 2px;
}
.transport-pin-line {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center; gap: 10px;
    padding: 8px 6px;
    border-radius: 10px;
}
.transport-pin-line[data-live="true"] {
    background: rgba(71, 215, 154, .06);
}
.transport-pin-line-no[data-live="true"] {
    box-shadow: 0 0 0 1px rgba(71, 215, 154, .35);
}
.transport-map-card .transport-empty {
    padding: var(--s-3);
}
.transport-map-card[data-kind="bus"],
.transport-map-card[data-kind="stop"] {
    animation: transport-pin-in .18s ease-out;
}
@keyframes transport-pin-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
    .transport-map-card[data-kind="bus"],
    .transport-map-card[data-kind="stop"] { animation: none; }
}

/* ──────────── Transport: AAA pass 6 — empty CTAs everywhere ──────────── */

.transport-empty-actions {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-top: 4px;
}
.transport-empty-actions .vault-btn {
    min-height: 40px;
}
.transport-map-empty {
    inset: 0;
    padding: var(--s-4);
    background:
        radial-gradient(90% 80% at 50% 30%, rgba(56, 189, 248, .08), transparent 60%),
        rgba(6, 11, 20, .35);
}
.transport-map-empty .transport-empty {
    max-width: 360px;
    margin: 0 auto;
    backdrop-filter: blur(4px);
}
.transport-map-zoom button[data-active="true"] {
    border-color: rgba(56, 189, 248, .55);
    color: #7dd3fc;
    background: rgba(56, 189, 248, .14);
}
.transport-map-here[data-has-fix="true"] {
    color: #c4b5fd;
    border-color: rgba(167, 139, 250, .45);
}
.transport-page.active .transport-panel {
    animation: transport-panel-in .22s ease-out both;
}
.transport-page.active .transport-col > .transport-panel:nth-child(2) { animation-delay: .04s; }
.transport-page.active .transport-col-side > .transport-panel:nth-child(1) { animation-delay: .06s; }
.transport-page.active .transport-col-side > .transport-panel:nth-child(2) { animation-delay: .1s; }
@keyframes transport-panel-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
    .transport-page.active .transport-panel { animation: none; }
}
html[data-theme="light"] .transport-map-empty {
    background:
        radial-gradient(90% 80% at 50% 30%, rgba(41, 127, 199, .1), transparent 60%),
        rgba(255, 255, 255, .55);
}

/* ──────────── Transport: AAA pass 7 — follow chip + zoom-to-cursor ──────────── */

.transport-follow-chip {
    position: absolute; z-index: 5;
    top: var(--s-3); inset-inline-start: var(--s-3);
    display: flex; align-items: center; gap: 8px;
    max-width: calc(100% - 72px);
    padding: 6px 8px 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(56, 189, 248, .35);
    background: rgba(6, 11, 20, .88);
    backdrop-filter: blur(8px);
    color: var(--ink);
    font-size: .72rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}
.transport-follow-chip[hidden] { display: none !important; }
.transport-follow-chip #transport-follow-label {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.transport-follow-stop {
    flex: 0 0 auto;
    min-height: 30px; padding: 0 10px;
    border: 1px solid rgba(56, 189, 248, .35);
    border-radius: 999px;
    background: rgba(56, 189, 248, .12);
    color: #7dd3fc;
    font: 600 .68rem/1 inherit;
    cursor: pointer;
}
.transport-follow-stop:hover {
    background: rgba(56, 189, 248, .22);
}
html[data-theme="light"] .transport-follow-chip {
    background: rgba(255, 255, 255, .94);
    border-color: rgba(41, 127, 199, .28);
    box-shadow: 0 8px 24px rgba(23, 24, 36, .12);
}
html[data-theme="light"] .transport-follow-stop {
    color: var(--diane);
    border-color: rgba(41, 127, 199, .3);
    background: rgba(41, 127, 199, .08);
}

/* ──────────── Transport: AAA pass 8 — search clear + empty saved ──────────── */

.transport-search-field { position: relative; }
.transport-search-clear {
    position: absolute; inset-inline-end: 8px; top: 50%;
    transform: translateY(-50%);
    width: 28px; height: 28px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 0; border-radius: 8px;
    background: transparent; color: var(--ink-3);
    font: 600 1.1rem/1 inherit; cursor: pointer;
}
.transport-search-clear:hover {
    color: var(--ink); background: rgba(255, 255, 255, .06);
}
.transport-search-clear:focus-visible {
    outline: 2px solid var(--diane);
    outline-offset: 2px;
}
.transport-search-field input {
    padding-inline-end: 40px;
}
.transport-results[data-state="empty"] {
    padding: var(--s-3);
}
.transport-results .transport-empty {
    border-style: solid;
}
html[data-theme="light"] .transport-search-clear:hover {
    background: rgba(23, 24, 36, .06);
}

/* ──────────── Transport: AAA pass 9 — error CTAs + follow row + line panel ──────────── */

.transport-arrival[data-follow="true"] {
    border-color: rgba(91, 140, 255, .55);
    background: linear-gradient(180deg, rgba(91, 140, 255, .12), rgba(91, 140, 255, .04));
    box-shadow: inset 3px 0 0 rgba(91, 140, 255, .85);
}
.transport-arrivals[data-state="error"] .transport-empty,
.transport-nearby[data-state="error"] .transport-empty,
.transport-saved[data-state="error"] .transport-empty,
.transport-line-detail[data-state="error"] .transport-empty {
    border-color: rgba(242, 118, 112, .35);
    background: rgba(242, 118, 112, .07);
}
.transport-arrivals[data-state="error"] .transport-empty-title,
.transport-nearby[data-state="error"] .transport-empty-title,
.transport-saved[data-state="error"] .transport-empty-title,
.transport-line-detail[data-state="error"] .transport-empty-title {
    color: var(--bad);
}
.transport-line-facts .transport-empty,
.transport-line-stops .transport-empty {
    padding: var(--s-3);
    border-style: dashed;
}
#transport-line-panel:not([hidden]) {
    animation: transport-panel-in .28s ease both;
}
html[data-theme="light"] .transport-arrival[data-follow="true"] {
    background: linear-gradient(180deg, rgba(61, 99, 214, .1), rgba(61, 99, 214, .03));
    border-color: rgba(61, 99, 214, .4);
}

/* ──────────── Transport: AAA pass 10 — zoom limits, copy code, Esc pin ──────────── */

.transport-map-zoom button:disabled {
    opacity: .35;
    cursor: not-allowed;
    transform: none;
}
.transport-map-here:not([data-has-fix="true"]) {
    opacity: .55;
}
.transport-chip.is-copyable {
    cursor: pointer;
}
.transport-chip.is-copyable:hover {
    border-color: rgba(56, 189, 248, .55);
    color: #7dd3fc;
}
.transport-chip.is-copyable:focus-visible {
    outline: 2px solid var(--diane);
    outline-offset: 2px;
}
html[data-theme="light"] .transport-chip.is-copyable:hover {
    color: #297fc7;
    border-color: rgba(41, 127, 199, .45);
}

/* ──────────── Transport: AAA pass 11 — current stop + fresh flash + Esc line ──────────── */

.transport-current-pill {
    display: inline-flex; align-items: center;
    margin-inline-start: 8px;
    padding: 1px 7px;
    border-radius: 999px;
    border: 1px solid rgba(56, 189, 248, .4);
    background: rgba(56, 189, 248, .12);
    color: #7dd3fc;
    font: 600 .62rem/1.3 var(--font-ui, inherit);
    letter-spacing: .02em;
    vertical-align: middle;
}
.transport-stop-row-body strong {
    display: flex; align-items: center; flex-wrap: wrap; gap: 2px;
}
.transport-arrivals.is-fresh {
    animation: transport-fresh-glow .7s ease;
}
@keyframes transport-fresh-glow {
    0% { box-shadow: inset 0 0 0 1px rgba(71, 215, 154, .55); }
    100% { box-shadow: inset 0 0 0 0 transparent; }
}
html[data-theme="light"] .transport-current-pill {
    color: #297fc7;
    border-color: rgba(41, 127, 199, .35);
    background: rgba(41, 127, 199, .1);
}
@media (prefers-reduced-motion: reduce) {
    .transport-arrivals.is-fresh { animation: none; }
}

/* ──────────── Transport: AAA pass 12 — confidence chips, pin copy, credit, scroll ──────────── */

.transport-confidence-chip[data-confidence="medium"] {
    border-color: rgba(250, 204, 21, .35);
    color: #facc15;
}
.transport-confidence-chip[data-confidence="low"] {
    border-color: rgba(248, 113, 113, .35);
    color: #f87171;
}
.transport-pin-code {
    display: inline; padding: 0 2px;
    border: 0; border-radius: 4px;
    background: transparent; color: inherit;
    font: inherit; cursor: pointer;
}
.transport-pin-code:hover {
    color: #7dd3fc;
    text-decoration: underline;
}
.transport-pin-code:focus-visible {
    outline: 2px solid var(--diane);
    outline-offset: 2px;
}
.transport-arrivals,
.transport-saved,
.transport-nearby {
    max-height: min(380px, 52vh);
    overflow-y: auto;
    padding-inline-end: 2px;
    scrollbar-gutter: stable;
}
.transport-panel-head {
    position: sticky;
    top: 0;
    z-index: 2;
    margin: calc(var(--s-4) * -1) calc(var(--s-4) * -1) var(--s-3);
    padding: var(--s-4) var(--s-4) var(--s-3);
    background: color-mix(in srgb, var(--surface-1) 88%, transparent);
    backdrop-filter: blur(8px);
}
.transport-credit-short { display: none; }
@media (max-width: 640px) {
    .transport-credit-long { display: none; }
    .transport-credit-short { display: inline; }
    .transport-arrivals,
    .transport-saved,
    .transport-nearby {
        max-height: min(300px, 46vh);
    }
}
html[data-theme="light"] .transport-confidence-chip[data-confidence="medium"] {
    color: #a16207;
    border-color: rgba(161, 98, 7, .3);
}
html[data-theme="light"] .transport-confidence-chip[data-confidence="low"] {
    color: #b91c1c;
    border-color: rgba(185, 28, 28, .28);
}
html[data-theme="light"] .transport-pin-code:hover { color: #297fc7; }
html[data-theme="light"] .transport-panel-head {
    background: color-mix(in srgb, var(--surface-1) 92%, #fff);
}

/* ──────────── Transport: AAA pass 13 — method chips, hero load, R refresh ──────────── */

.transport-method-chip[data-method="live_delay"],
.transport-method-chip[data-method="live_delay_peer"] {
    border-color: rgba(71, 215, 154, .35);
    color: var(--ok);
}
.transport-method-chip[data-method="scheduled"] {
    border-color: var(--line);
    color: var(--ink-3);
}
.transport-method-chip[data-method="live_stale"] {
    border-color: rgba(250, 204, 21, .35);
    color: #facc15;
}
.transport-freshness:has(.transport-spinner) {
    display: inline-flex; align-items: center; gap: 8px;
}
.transport-hero[data-state="loading"] .transport-freshness {
    opacity: .9;
}
html[data-theme="light"] .transport-method-chip[data-method="live_stale"] {
    color: #a16207;
}

/* ──────────── Transport: AAA pass 14 — pin follow, / search, map follow frame ──────────── */

.transport-map-frame[data-follow="true"] {
    box-shadow: 0 0 0 1px rgba(91, 140, 255, .45), 0 12px 28px rgba(91, 140, 255, .12);
}
.transport-map-frame[data-follow="true"] .transport-map {
    outline: 1px solid rgba(91, 140, 255, .35);
}
.transport-arrivals,
.transport-saved,
.transport-nearby {
    mask-image: linear-gradient(#000 calc(100% - 18px), transparent);
}
html[data-theme="light"] .transport-map-frame[data-follow="true"] {
    box-shadow: 0 0 0 1px rgba(61, 99, 214, .35), 0 12px 28px rgba(61, 99, 214, .1);
}
@media (prefers-reduced-motion: reduce) {
    .transport-map-frame[data-follow="true"] { box-shadow: 0 0 0 1px rgba(91, 140, 255, .45); }
}

/* ──────────── Transport: AAA pass 15 — announcements + reduced motion ──────────── */

#transport-arrivals:focus-visible {
    outline: 2px solid rgba(56, 189, 248, .55);
    outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
    .transport-skel,
    .transport-skel-badge,
    .transport-skel-eta,
    .transport-skel-bar,
    .transport-hero[data-state="loading"] h2,
    .transport-spinner,
    .transport-arrival[data-imminent="true"],
    .transport-map-marker[data-follow="true"],
    .transport-arrivals.is-fresh,
    #transport-line-panel:not([hidden]),
    .transport-page.active .transport-panel {
        animation: none !important;
    }
    .transport-arrivals,
    .transport-saved,
    .transport-nearby {
        mask-image: none;
    }
}

/* ──────────── Transport: AAA pass 16 — a11y + saved error + hero nearby busy ──────────── */

.transport-map-marker[aria-pressed="true"] {
    z-index: 7;
}

#btn-transport-hero-nearby.is-busy {
    pointer-events: none;
    opacity: .72;
}

#transport-search-input[aria-expanded="true"] {
    box-shadow: 0 0 0 2px rgba(56, 189, 248, .28);
}

html[data-theme="light"] #transport-search-input[aria-expanded="true"] {
    box-shadow: 0 0 0 2px rgba(37, 99, 235, .22);
}

/* ──────────── Transport: AAA pass 17 — line focus, arrival a11y, pin dialog, Esc clear, geo CTA ──────────── */

.transport-arrival[aria-pressed="true"] {
    outline: 2px solid rgba(91, 140, 255, .45);
    outline-offset: 1px;
}

#transport-map-card[role="dialog"]:not([hidden]) {
    z-index: 8;
}

#transport-line-panel:not([hidden]) #btn-transport-line-close:focus-visible {
    outline: 2px solid rgba(56, 189, 248, .55);
    outline-offset: 2px;
}

/* ──────────── Transport: AAA pass 18 — pin line buttons, search error, touch zoom, line region, focus trap ──────────── */

button.transport-pin-line {
    width: 100%;
    appearance: none;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: inherit;
    cursor: pointer;
    padding: 10px 4px;
    min-height: 44px;
}

button.transport-pin-line:focus-visible {
    outline: 2px solid rgba(56, 189, 248, .55);
    outline-offset: 1px;
}

.transport-search-results[data-state="error"] .transport-empty,
#transport-search-results[data-state="error"] .transport-empty {
    border-color: rgba(248, 113, 113, .35);
}

@media (max-width: 720px) {
    .transport-map-zoom button {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        font-size: 1.1rem;
    }
    .transport-map-zoom {
        gap: 6px;
    }
}

/* ──────────── Transport: AAA pass 19 — map keyboard, line trap, aria-busy, imminent label ──────────── */

.transport-map[role="application"]:focus-visible {
    outline: 2px solid rgba(56, 189, 248, .55);
    outline-offset: 2px;
}

#btn-transport-refresh[aria-busy="true"] {
    opacity: .78;
}

.transport-arrival[data-imminent="true"] {
    box-shadow: inset 0 0 0 1px rgba(56, 189, 248, .28);
}

/* ──────────── Transport: AAA pass 20 — nearby labels, nearby aria-busy, select announce, pin retry, clear touch ──────────── */

#transport-map-card[aria-busy="true"] {
    opacity: .92;
}

@media (max-width: 720px) {
    .transport-search-clear {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        inset-inline-end: 4px;
        border-radius: 10px;
    }
    .transport-search-field input {
        padding-inline-end: 52px;
    }
}

/* ──────────── Transport: AAA pass 21 — saved action labels, recenter label, pin follow pressed, busy boxes, unfollow touch ──────────── */

@media (max-width: 720px) {
    .transport-follow-stop {
        min-height: 44px;
        min-width: 44px;
        padding: 0 14px;
        font-size: .78rem;
    }
}

#transport-line-detail[aria-busy="true"],
#transport-nearby[aria-busy="true"],
#transport-arrivals[aria-busy="true"],
#transport-saved[aria-busy="true"] {
    opacity: .92;
}

/* ──────────── Transport: AAA pass 22 — saved/search labels, zoom labels, hero busy, here busy ──────────── */

.transport-hero[aria-busy="true"] {
    opacity: .92;
}

#btn-transport-here[aria-busy="true"] {
    opacity: .72;
    pointer-events: none;
}

/* ──────────── Transport: AAA pass 23 — live regions, copy labels, map SR, 44px icons ──────────── */

.transport-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ──────────── Transport: AAA pass 24 — page/panel landmarks, unfollow focus ──────────── */

.transport-follow-stop:focus-visible {
    outline: 2px solid var(--diane);
    outline-offset: 2px;
}

/* ──────────── Transport: AAA pass 25 — follow label, search role, pin imminent ──────────── */

.transport-pin-line[data-imminent="true"] {
    border-color: color-mix(in srgb, var(--diane) 45%, var(--line));
    background: color-mix(in srgb, var(--diane) 8%, transparent);
}

.transport-pin-line[data-imminent="true"] .transport-pin-line-eta b {
    color: var(--diane);
}

/* ──────────── Transport: AAA pass 26 — refresh label, imminent announce, zoom group ──────────── */

.transport-line-stops[role="list"] {
    margin: 0;
    padding: 0;
}

/* ──────────── Transport: AAA pass 27 — Esc search, zoom announce, board lists, pin open ──────────── */

#transport-arrivals[role="list"],
#transport-saved[role="list"],
#transport-nearby[role="list"] {
    margin: 0;
    padding: 0;
}

/* ──────────── Transport: AAA pass 28 — row focus, geo live, nearby busy label, recenter, search count ──────────── */

.transport-search-field input:focus-visible {
    outline: 2px solid var(--diane);
    outline-offset: 2px;
}

/* ──────────── Transport: AAA pass 29 — keyshortcuts, here/pin announce, clear focus, pin describedby ──────────── */

#transport-map-card[aria-describedby="transport-pin-body"]:not([hidden]) #transport-pin-body {
    min-width: 0;
}

/* ──────────── Transport: AAA pass 30 — hero scope, zoom 44px, pin list, notes live, line close, wheel ──────────── */

.transport-map-zoom button {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
}

.transport-pin-lines[role="list"] {
    display: flex;
    flex-direction: column;
    gap: inherit;
}

/* ──────────── Transport: AAA pass 31 — pin inert, map-note live, line current, drag announce, search label ──────────── */

.transport-map-frame > [inert] {
    pointer-events: none;
}

.transport-line-stop[aria-current="true"] {
    border-color: rgba(56, 189, 248, .55);
    box-shadow: 0 0 0 1px rgba(56, 189, 248, .25);
}

/* ──────────── Transport: AAA pass 32 — follow lost, line error/note, stale label, arrivals note ──────────── */

#transport-line-note[data-state="error"],
#transport-arrivals-note[data-state="error"] {
    color: rgba(248, 113, 113, .95);
}

.transport-map-marker[data-kind="bus"][data-stale="true"] {
    opacity: .85;
}

/* ──────────── Transport: AAA pass 33 — countdown aria, line inert, save label, search error, saved note ──────────── */

#transport-saved-note[data-state="error"] {
    color: rgba(248, 113, 113, .95);
}

#transport-nearby-note[data-state="error"] {
    color: rgba(248, 113, 113, .95);
}

#page-transport [inert] {
    pointer-events: none;
}

/* ──────────── Transport: AAA pass 34 — empty map role, pin ETA live, pin action labels, search presentation, name dialog ──────────── */

.transport-map[data-state="empty"][role="region"] {
    outline: none;
}

.transport-pin-eta-block[data-imminent="true"] {
    color: rgba(251, 191, 36, .98);
}

.transport-pin-eta-block[role="status"] {
    min-width: 0;
}

/* ──────────── Transport: AAA pass 35 — tiles hidden, search alert/invalid, line buses title, dialog modal, nearby blocked ──────────── */

.transport-map-tiles[aria-hidden="true"] {
    pointer-events: none;
}

#transport-search-results[role="alert"] {
    border-color: rgba(248, 113, 113, .4);
}

#transport-search-input[aria-invalid="true"] {
    border-color: rgba(248, 113, 113, .55);
}

/* ──────────── Transport: AAA pass 36 — bus announce, pin reason, page busy, hero describedby, alias validate, zoom shortcuts ──────────── */

#page-transport[aria-busy="true"] {
    cursor: progress;
}

.dashboard-prompt-error {
    margin: 0;
    color: rgba(248, 113, 113, .95);
    font-size: .85rem;
}

.dashboard-prompt-error[hidden] {
    display: none;
}

/* ──────────── Transport: AAA pass 37 — search clear on line, nav current, combobox busy, map roledescription, line alert, hero / ──────────── */

.nav-item[aria-current="page"] {
    outline: none;
}

#transport-line-detail[role="alert"] {
    border-color: rgba(248, 113, 113, .35);
}

#transport-search-input[aria-busy="true"] {
    opacity: .92;
}

/* ──────────── Transport: AAA pass 38 — arrivals/pin focus restore, marker keys, setsize, atomic live, forced-colors ──────────── */

@media (forced-colors: active) {
    .transport-map-marker {
        forced-color-adjust: none;
        border: 2px solid CanvasText;
        outline: 1px solid Canvas;
        background: Canvas;
        color: CanvasText;
    }
    .transport-map-marker[data-kind="bus"][data-stale="true"] {
        border-style: dashed;
        opacity: 1;
    }
    .transport-arrival[data-imminent="true"],
    .transport-pin-line[data-imminent="true"],
    .transport-pin-eta-block[data-imminent="true"] {
        outline: 2px solid Highlight;
        outline-offset: 2px;
    }
}

/* ──────────── Transport: AAA pass 39 — list setsize, pin page inert, single-focus trap, reduced-transparency ──────────── */

@media (prefers-reduced-transparency: reduce) {
    .transport-map-card,
    .transport-follow-chip,
    .transport-map-zoom button,
    .transport-map-empty .transport-empty {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
}

/* ──────────── Transport: AAA pass 40 — alias dialog trap, zoom shortcuts, pin live load, search focus, skip-map, reduced-motion tiles ──────────── */

.transport-skip-link {
    position: absolute;
    inset-inline-start: 12px;
    top: 12px;
    z-index: 40;
    padding: 8px 12px;
    border-radius: 10px;
    background: var(--surface-1);
    color: var(--ink);
    border: 1px solid var(--line-strong);
    text-decoration: none;
    transform: translateY(-160%);
    transition: transform .18s ease;
}
.transport-skip-link:focus,
.transport-skip-link:focus-visible {
    transform: translateY(0);
    outline: 2px solid var(--diane);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .transport-map-tiles { will-change: auto; }
    .transport-skip-link { transition: none; }
}

/* ──────────── Transport: AAA pass 41 — nearby note error, skip focus, page relative, map Home/End, search describedby, marker setsize ──────────── */

#page-transport.transport-page {
    position: relative;
}

/* ──────────── Transport: AAA pass 42 — geo note error, marker Enter, skip arrivals, me hidden, busy label, arrivals loading ──────────── */

#transport-arrivals-note[data-state="loading"] {
    color: var(--ink-2);
}

.transport-skip-link + .transport-skip-link {
    inset-inline-start: 148px;
}

/* ──────────── Transport: AAA pass 43 — note loading/ready sync, map empty skip CTA, map-note state ──────────── */

#transport-saved-note[data-state="loading"],
#transport-nearby-note[data-state="loading"],
#transport-line-note[data-state="loading"],
#transport-arrivals-note[data-state="loading"] {
    color: var(--ink-2);
}

#transport-map-note[data-state="empty"] {
    color: var(--ink-3);
}

/* ──────────── Transport: AAA pass 44 — skip arrivals CTA, nearby/map note states, hero refresh, ready colors ──────────── */

#transport-nearby-note[data-state="ready"],
#transport-saved-note[data-state="ready"],
#transport-map-note[data-state="ready"] {
    color: var(--ink-2);
}

#transport-map-note[data-state="loading"] {
    color: var(--ink-2);
}

#transport-nearby-note[data-state="empty"] {
    color: var(--ink-3);
}

/* ──────────── Transport: AAA pass 45 — saved empty note, nearby say states, hero loading, ready notes, empty-map zoom ──────────── */

#transport-saved-note[data-state="empty"] {
    color: var(--ink-3);
}

#transport-arrivals-note[data-state="ready"],
#transport-line-note[data-state="ready"] {
    color: var(--ink-2);
}

.transport-freshness[data-state="loading"] {
    color: var(--ink-2);
}
.transport-freshness[data-state="loading"]::before {
    background: var(--ink-2);
    opacity: .55;
}

/* ──────────── Transport: AAA pass 46 — arrivals empty note, hero error restore, map-note after tiles, here idle, map error CSS, tiles live ──────────── */

#transport-arrivals-note[data-state="empty"] {
    color: var(--ink-3);
}

#transport-map-note[data-state="error"] {
    color: rgba(248, 113, 113, .95);
}

/* ──────────── Transport: AAA pass 47 — arrivals empty sync, hero error freshness, tile fail note, framed recenter, line empty, search empty ──────────── */

#transport-line-note[data-state="empty"] {
    color: var(--ink-3);
}

#transport-search-results[data-state="empty"] {
    color: var(--ink-3);
}

/* ──────────── Transport: AAA pass 48 — hero error preserve, search loading, framed recenter CSS, unfollow Esc, credit focus, idle freshness ──────────── */

.transport-hero[data-state="error"] {
    border-color: rgba(248, 113, 113, .35);
}

#transport-search-results[data-state="loading"] {
    color: var(--ink-2);
}

.transport-map-zoom button[data-active="true"]:disabled,
.transport-map-zoom button[data-active="true"][aria-disabled="true"] {
    border-color: var(--line);
    color: var(--ink-3);
    background: transparent;
    box-shadow: none;
}

#page-transport .transport-map-credit a:focus-visible {
    outline: 2px solid var(--diane);
    outline-offset: 2px;
    border-radius: 2px;
}

.transport-freshness[data-state="idle"] {
    color: var(--ink-3);
}
.transport-freshness[data-state="idle"]::before {
    background: var(--ink-3);
    opacity: .7;
}

/* ──────────── Transport: AAA pass 49 — skip saved, search error color/focus, nearby geo error, hero refresh loading, hero error title ──────────── */

#transport-search-results[data-state="error"] {
    color: rgba(248, 113, 113, .95);
}

.transport-hero[data-state="error"] h2 {
    color: rgba(248, 113, 113, .95);
}

.transport-hero[data-state="error"] #transport-hero-freshness {
    color: rgba(248, 113, 113, .95);
}

/* ──────────── Transport: AAA pass 50 — skip nearby, error retry focus, skip error CTA ──────────── */

#transport-nearby[data-state="error"] {
    color: rgba(248, 113, 113, .95);
}

#transport-saved[data-state="error"] {
    color: rgba(248, 113, 113, .95);
}

/* ──────────── Transport: AAA pass 51 — pin retry focus, search helper, arrivals alert/color, skip-saved error ──────────── */

#transport-arrivals[data-state="error"] {
    color: rgba(248, 113, 113, .95);
}

#transport-line-detail[data-state="error"] {
    color: rgba(248, 113, 113, .95);
}

/* ──────────── Transport: AAA pass 52 — saved/nearby alert, pin error, map retry, skip-map helper ──────────── */

#transport-saved[data-state="error"] .transport-empty-title,
#transport-nearby[data-state="error"] .transport-empty-title {
    color: rgba(248, 113, 113, .95);
}

#transport-map-card[data-state="error"] {
    border-color: rgba(248, 113, 113, .35);
}

#transport-map-card[data-state="error"] #transport-pin-body {
    color: rgba(248, 113, 113, .95);
}

.transport-map-tile-error {
    position: absolute;
    inset-inline: 12px;
    bottom: 12px;
    z-index: 4;
    display: flex;
    justify-content: center;
}

/* ──────────── Transport: AAA pass 53 — arrivals recovery, skip focus parity, map/line/saved alert, search landmark ──────────── */

#transport-map[data-state="error"] {
    outline: 1px solid rgba(248, 113, 113, .35);
    outline-offset: -1px;
}

.transport-map-tile-error .vault-btn {
    min-height: 44px;
}

/* ──────────── Transport: AAA pass 54 — map-retry force, alert clear on load, nearby recovery, skip-search, search empty focus ──────────── */

#transport-search-results[data-state="error"] .transport-empty {
    border-color: rgba(248, 113, 113, .35);
}

#transport-search-results[data-state="error"] .transport-empty-title {
    color: rgba(248, 113, 113, .95);
}

/* ──────────── Transport: AAA pass 55 — stop/line/search alert clear, arrivals empty focus, line-detail landmark ──────────── */

#transport-line-detail:focus-visible {
    outline: 2px solid rgba(56, 189, 248, .55);
    outline-offset: 2px;
}

#transport-arrivals[data-state="empty"] .transport-empty-actions .vault-btn-primary {
    min-height: 44px;
}

/* ──────────── Transport: AAA pass 56 — empty focus transitions, search busy clear, saved load alert, landmark rings ──────────── */

#transport-saved:focus-visible,
#transport-nearby:focus-visible,
#transport-search-results:focus-visible,
#transport-map[data-state="empty"]:focus-visible {
    outline: 2px solid rgba(56, 189, 248, .55);
    outline-offset: 2px;
}

#transport-saved[data-state="empty"] .transport-empty-actions .vault-btn-primary,
#transport-nearby[data-state="empty"] .transport-empty-actions .vault-btn-primary,
#transport-map[data-state="empty"] .transport-empty-actions .vault-btn-primary {
    min-height: 44px;
}

/* ──────────── Transport: AAA pass 57 — map empty focus, soft refresh, error focus transitions, retry touch ──────────── */

#transport-arrivals[data-state="error"] .transport-empty-actions .vault-btn-primary,
#transport-search-results[data-state="error"] .transport-empty-actions .vault-btn-primary,
#transport-line-detail[data-state="error"] .transport-empty-actions .vault-btn-primary,
#transport-saved[data-state="error"] .transport-empty-actions .vault-btn-primary,
#transport-nearby[data-state="error"] .transport-empty-actions .vault-btn-primary {
    min-height: 44px;
}

/* ──────────── Chat shell polish — hamburger nav + soft GPT-like motion ──────────── */

@keyframes chat-soft-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-v2 .chat-library {
    transition: transform .28s var(--ease), box-shadow .28s var(--ease);
}

.chat-v2 .btn-new-chat {
    border-radius: 999px;
    padding: 8px 14px;
    transition: transform .18s var(--ease), background-color .18s ease, border-color .18s ease;
}

.chat-v2 .btn-new-chat:hover {
    transform: translateY(-1px);
}

.chat-compose-spark { display: none; }

.chat-channel-select {
    border-radius: 999px;
}

html[data-theme="light"] .chat-compose-shell {
    background: #fff;
    box-shadow: 0 10px 28px rgba(23, 24, 36, .08);
}

html[data-theme="light"] .nav-drawer-backdrop {
    background: rgba(20, 24, 40, .28);
}

body.nav-lock {
    overflow: hidden;
}

/* ===== CHAT GPT-SCALE REDESIGN + PROFILE FIX ===== */

.nav-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 70;
    border: 0;
    background: rgba(2, 6, 14, .55);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .28s var(--ease);
}
.app.nav-open .nav-drawer-backdrop,
.app.nav-open .nav-drawer-backdrop[hidden] {
    opacity: 1;
    pointer-events: auto;
}
.nav-drawer-backdrop[hidden] {
    display: block !important;
    opacity: 0;
    pointer-events: none;
}

.nav-menu-toggle {
    width: 42px;
    height: 42px;
    min-height: 42px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: var(--surface-1);
    color: var(--ink-2);
    cursor: pointer;
    transition: var(--transition);
}
.nav-menu-toggle:hover {
    color: var(--ink);
    border-color: color-mix(in srgb, var(--diane) 40%, var(--line-strong));
    background: var(--surface-2);
}
.nav-menu-bars {
    width: 16px;
    height: 12px;
    display: grid;
    gap: 3px;
}
.nav-menu-bars i {
    display: block;
    height: 1.5px;
    border-radius: 99px;
    background: currentColor;
    transition: transform .28s var(--ease), opacity .2s ease;
}
.app.nav-open .nav-menu-bars i:nth-child(1) { transform: translateY(4.5px) rotate(45deg); }
.app.nav-open .nav-menu-bars i:nth-child(2) { opacity: 0; }
.app.nav-open .nav-menu-bars i:nth-child(3) { transform: translateY(-4.5px) rotate(-45deg); }

.nav-drawer-close {
    width: 34px;
    height: 34px;
    margin-inline-start: 4px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--ink-3);
    cursor: pointer;
}
.nav-drawer-close:hover { color: var(--ink); background: var(--surface-1); }
.nav-drawer-close svg { width: 18px; height: 18px; }

.topbar-leading {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-footer {
    flex-shrink: 0;
    min-width: 0;
    padding: 12px 8px 2px;
    border-top: 1px solid var(--line);
    display: grid;
    gap: 10px;
}

/* Restore compact profile — avatar was unconstrained and blew up */
.user-profile-card {
    min-width: 0;
    width: 100%;
    display: flex !important;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 0 0 10px;
    border-bottom: 1px solid var(--line);
    overflow: hidden;
}
.user-profile-card[style*="display: none"] {
    display: none !important;
}
.user-profile-avatar,
#user-avatar.user-profile-avatar,
#user-avatar {
    width: 36px !important;
    height: 36px !important;
    max-width: 36px !important;
    max-height: 36px !important;
    flex: 0 0 36px !important;
    border-radius: 50% !important;
    border: 2px solid color-mix(in srgb, var(--diane) 45%, var(--line-strong)) !important;
    object-fit: cover !important;
    display: block !important;
}
.user-profile-copy {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}
.user-profile-name,
#user-name {
    overflow: hidden;
    font-size: 13px !important;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.user-profile-email,
#user-email {
    overflow: hidden;
    color: var(--text-secondary);
    font-size: 11px !important;
    white-space: nowrap;
    text-overflow: ellipsis;
    direction: ltr;
    text-align: right;
}
.user-profile-logout,
#btn-logout {
    flex: 0 0 auto;
    padding: 6px 8px !important;
    border: 0 !important;
    border-radius: 8px;
    background: transparent !important;
    color: var(--text-muted) !important;
    cursor: pointer;
    font-size: 12px;
}
.user-profile-logout:hover,
#btn-logout:hover {
    color: var(--ink) !important;
    background: var(--surface-1) !important;
}

/* ——— Massive ChatGPT-scale chat shell ——— */
#page-chat.chat-v2 {
    height: calc(100dvh - 72px);
    background:
        radial-gradient(ellipse 70% 45% at 50% 0%, rgba(124, 140, 255, .07), transparent 55%),
        #05070f;
}

.chat-v2 .chat-stage {
    grid-template-columns: 248px minmax(0, 1fr);
    gap: 0;
}

.chat-v2 .chat-library {
    background: rgba(6, 10, 18, .92);
    border-inline-end: 1px solid rgba(255, 255, 255, .06);
}

.chat-v2 .chat-library-head {
    min-height: 64px;
    padding: 16px 14px 8px;
}

.chat-v2 .chat-library-title strong {
    font-size: 15px;
    letter-spacing: -.02em;
}

.chat-v2 .btn-new-chat {
    min-height: 36px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid rgba(124, 140, 255, .22);
    background: rgba(124, 140, 255, .1);
    font-size: 12px;
}

.chat-v2 .chat-library-search {
    height: 38px;
    margin: 0 12px 10px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, .04);
}
.chat-v2 .chat-library-search:focus-within {
    border-color: rgba(124, 140, 255, .35);
    background: rgba(255, 255, 255, .06);
    box-shadow: 0 0 0 3px rgba(124, 140, 255, .08);
}

.chat-v2 .conv-item {
    min-height: 48px;
    margin: 1px 6px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 0;
    background: transparent;
    box-shadow: none !important;
}
.chat-v2 .conv-item:hover {
    background: rgba(255, 255, 255, .04);
    transform: none;
}
.chat-v2 .conv-item.active {
    background: rgba(124, 140, 255, .1);
    box-shadow: none !important;
}
.chat-v2 .conv-item.active::before { display: none; }
.chat-v2 .conv-title {
    font-size: 13px;
    font-weight: 500;
}

.chat-v2 .chat-canvas {
    background: transparent;
    grid-template-rows: 56px auto minmax(0, 1fr) auto;
}

.chat-v2 .chat-context-bar {
    min-height: 56px;
    padding: 8px clamp(16px, 4vw, 48px);
    border-bottom: 1px solid rgba(255, 255, 255, .05);
    background: transparent;
}

.chat-v2 .chat-active-copy h3 {
    font-size: 15px;
    font-weight: 560;
    letter-spacing: -.02em;
}

.chat-v2 .chat-inline-search {
    height: 36px;
    width: min(220px, 28vw);
    border-radius: 999px;
    background: rgba(255, 255, 255, .04);
}

.chat-v2 .chat-channel-select {
    min-height: 36px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .04);
}

.chat-v2 .chat-messages-container {
    padding: 28px max(20px, calc((100% - 720px) / 2)) 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(124, 140, 255, .28) transparent;
}

.chat-v2 .chat-zero-state {
    padding: 8vh 12px 10vh;
    animation: chat-soft-in .5s var(--ease) both;
}
.chat-v2 .chat-zero-state p {
    font-size: clamp(32px, 4.5vw, 46px);
    font-weight: 500;
    letter-spacing: -.04em;
    color: #f3f8ff;
}
.chat-v2 .chat-zero-state > small {
    margin-top: 12px;
    font-size: 14px;
    color: #7a8ca3;
}
.chat-zero-logo {
    width: 56px;
    height: 56px;
    margin-bottom: 18px;
}
.chat-starter-grid {
    width: min(100%, 720px);
    margin-top: 36px;
    gap: 10px;
}
.chat-starter-grid button {
    min-height: 92px;
    padding: 16px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, .08);
    background: rgba(255, 255, 255, .03);
}
.chat-starter-grid button:hover {
    background: rgba(124, 140, 255, .08);
    border-color: rgba(124, 140, 255, .28);
    transform: translateY(-3px);
}
.chat-starter-grid span { font-size: 13px; }
.chat-starter-grid small { font-size: 11px; color: #6d8096; }

.chat-v2 .chat-bubble-wrapper {
    width: 100%;
    max-width: 720px;
    margin: 0 auto 28px;
    animation: message-enter .38s var(--ease) both;
}
.chat-v2 .chat-bubble-wrapper.assistant {
    grid-template-columns: 32px minmax(0, 1fr);
    column-gap: 14px;
}
.chat-v2 .chat-bubble-wrapper.user {
    width: fit-content;
    max-width: min(85%, 560px);
    margin-inline-start: auto;
    margin-inline-end: max(0px, calc((100% - 720px) / 2));
    grid-template-columns: minmax(0, 1fr);
}
.chat-v2 .chat-bubble {
    font-size: 15px;
    line-height: 1.75;
    color: #e8f0f8;
}
.chat-v2 .chat-bubble-wrapper.user .chat-bubble {
    padding: 14px 18px;
    border: 0;
    border-radius: 22px;
    background: #1a4d7a;
    color: #f2f8ff;
    box-shadow: 0 8px 28px rgba(0, 0, 0, .18);
}
.chat-v2 .assistant-mini-mark {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}

.chat-v2 .chat-composer {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 10px max(16px, calc((100% - 720px) / 2)) max(18px, env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, transparent, rgba(5, 7, 15, .92) 36%);
}
.chat-v2 .chat-compose-shell {
    min-height: 58px;
    max-width: 720px;
    margin: 0 auto;
    padding: 10px 10px 10px 16px;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 28px;
    background: rgba(14, 20, 32, .92);
    box-shadow: 0 16px 48px rgba(0, 0, 0, .35);
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s var(--ease);
}
.chat-v2 .chat-compose-shell:focus-within {
    border-color: rgba(124, 140, 255, .45);
    box-shadow: 0 0 0 4px rgba(124, 140, 255, .1), 0 18px 52px rgba(0, 0, 0, .4);
    transform: translateY(-1px);
}
.chat-v2 .chat-compose-shell textarea {
    flex: 1;
    min-height: 38px;
    max-height: 180px;
    padding: 9px 4px;
    font-size: 15px;
    line-height: 1.45;
}
.chat-compose-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}
.chat-v2 .btn-voice-chat,
.btn-voice-chat {
    width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 0;
    background: transparent;
    color: #7f93a8;
}
.chat-v2 .btn-voice-chat:hover { color: var(--diane); background: var(--diane-soft); }
.chat-v2 .btn-send-chat {
    width: 40px;
    height: 40px;
    min-height: 40px;
    border-radius: 50%;
}
.chat-v2 .chat-composer-meta {
    max-width: 720px;
    margin: 0 auto;
    padding-top: 8px;
    color: #4d5d70;
    font-size: 11px;
}

@media (max-width: 900px) {
    #page-chat.chat-v2 { height: calc(100dvh - 60px); }
    .chat-v2 .chat-stage { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
    #page-chat.chat-v2 { height: calc(100dvh - 60px); }
    .chat-starter-grid { grid-template-columns: 1fr; }
    .chat-v2 .chat-bubble-wrapper.user {
        margin-inline-end: 0;
        max-width: 88%;
    }
    .chat-v2 .chat-messages-container,
    .chat-v2 .chat-composer {
        padding-inline: 12px;
    }
}

html[data-theme="light"] #page-chat.chat-v2 {
    background: radial-gradient(ellipse 70% 40% at 50% 0%, rgba(41, 127, 199, .08), transparent 55%), #f5f6fb;
}
html[data-theme="light"] .chat-v2 .chat-library { background: var(--bg-sidebar); }
html[data-theme="light"] .chat-v2 .chat-bubble-wrapper.user .chat-bubble {
    background: #d7ebff;
    color: #12304d;
}
html[data-theme="light"] .chat-v2 .chat-compose-shell {
    background: #fff;
    border-color: #d5dae6;
    box-shadow: 0 10px 28px rgba(23, 24, 36, .08);
}

#chat-active-title.chat-title-fresh { animation: chat-soft-in .45s var(--ease); }
body.nav-lock { overflow: hidden; }

/* Voice settings: live-call section */
.voice-section-title {
    margin: 14px 0 8px;
    font-size: 0.95rem;
}
.voice-live-warnings {
    margin: 0 0 10px;
    color: var(--warning, #b7791f);
}
.voice-inline-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.voice-inline-row select {
    flex: 1;
    min-width: 0;
}
.voice-live-advanced {
    margin: 10px 0;
}
.voice-live-advanced summary {
    cursor: pointer;
    margin-bottom: 8px;
}
.voice-note-sub {
    margin: 0 0 8px;
    opacity: 0.75;
    font-size: 0.85rem;
}

/* ── Interface-polish pass (plain-CSS system; no new framework) ──
   Principles: explicit transitions, 0.96 press scale, tabular live
   numbers, balanced headings, root font smoothing, neutral image
   outlines, 40px hit areas, one icon weight per surface, CSS-only
   icon cross-fade, shadow rings for elevation. */

/* 8. Font smoothing at the root (macOS only; ignored elsewhere). */
html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 10. Balanced headings; pretty wrap for short UI text only. */
h1, h2, h3 {
    text-wrap: balance;
}
.page-intro p,
.card-body,
.vault-subtitle,
.books-subtitle,
.dashboard-reminder-row small,
.dashboard-connection-row small,
.dashboard-attention-row small,
.chat-starter-grid small,
.autonomy-service-copy span {
    text-wrap: pretty;
}

/* 9. Tabular numerals on every live-updating readout. */
.clock,
.stat-value,
.health-metric strong,
.weather-reading strong,
.vault-fact strong,
.health-summary .vault-fact strong,
.health-operational-card strong,
.dashboard-reminder-row time,
#dashboard-now-time,
#chat-live-elapsed,
.flow-zoom-controls output,
.transport-eta strong {
    font-variant-numeric: tabular-nums;
}

/* 14. Never `transition: all` — explicit properties per rule. */
.price-check-provider-card {
    transition-property: border-color, background-color, box-shadow, opacity;
    transition-duration: .25s;
    transition-timing-function: ease;
}
.vault-search {
    transition-property: border-color, box-shadow, background-color;
    transition-duration: .2s;
    transition-timing-function: ease;
}
.vault-btn {
    transition-property: background-color, border-color, color, transform, box-shadow;
    transition-duration: .2s;
    transition-timing-function: cubic-bezier(.16, 1, .3, 1);
}
.vault-link {
    transition-property: background-color, border-color, color, transform;
    transition-duration: .2s;
    transition-timing-function: ease;
}
.vault-fact {
    transition-property: transform, border-color, box-shadow;
    transition-duration: .25s;
    transition-timing-function: ease;
}
.vault-chip {
    transition-property: background-color, border-color, color, transform, box-shadow;
    transition-duration: .2s;
    transition-timing-function: cubic-bezier(.16, 1, .3, 1);
}
.vault-pill {
    transition-property: background-color, border-color, color;
    transition-duration: .2s;
    transition-timing-function: ease;
}
.vault-copy-btn {
    transition-property: background-color, color, transform;
    transition-duration: .2s;
    transition-timing-function: ease;
}
.vault-input {
    transition-property: border-color, box-shadow, background-color;
    transition-duration: .2s;
    transition-timing-function: ease;
}
.vault-toggle-visibility {
    transition-property: color, background-color;
    transition-duration: .2s;
    transition-timing-function: ease;
}
.log-source-switch > button {
    transition-property: border-color, background-color, color, box-shadow;
    transition-duration: .2s;
    transition-timing-function: ease;
}
.language-toggle-row > i {
    transition-property: border-color, background-color;
    transition-duration: .2s;
    transition-timing-function: ease;
}
.language-toggle-row > i::after {
    transition-property: transform, background-color, box-shadow;
    transition-duration: .2s;
    transition-timing-function: ease;
}

/* 12. One press scale everywhere: 0.96 (never below 0.95). */
button:active:not(:disabled) {
    transform: scale(.96);
}
.home-filter:active,
.home-temp-step:active:not(:disabled),
.home-ptz-btn:active,
.home-feat:active:not(:disabled),
.home-scene:active,
.home-camera-chip:active,
.home-chip-btn:active:not(:disabled),
.transport-map-zoom button:active {
    transform: scale(.96);
}
.transport-map-marker:active {
    transform: translate(-50%, -50%) scale(.96);
}
/* 19. High-frequency hover gets color only — no pop scale. */
.vault-copy-btn:hover {
    transform: none;
}

/* 16. 40px hit areas (dense desktop) for sub-40px icon controls. */
.vault-copy-btn,
.vault-toggle-visibility,
.dashboard-sync-control,
.nav-drawer-close,
.code-studio-rail-btn,
.flow-zoom-controls button {
    position: relative;
}
.vault-copy-btn::after,
.vault-toggle-visibility::after,
.dashboard-sync-control::after,
.nav-drawer-close::after,
.code-studio-rail-btn::after,
.flow-zoom-controls button::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
}

/* Neutral outlines are for photos and avatars, not the transparent Diane mark. */
img.user-profile-avatar,
.chat-presence img {
    outline: 1px solid oklch(1 0 0 / .1);
    outline-offset: -1px;
}
html[data-theme="light"] img.user-profile-avatar,
html[data-theme="light"] .chat-presence img {
    outline-color: oklch(0 0 0 / .1);
}

/* The mark moves as a single silhouette, with no box or animated decoration. */
@keyframes diane-mark-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(calc(-1 * var(--diane-float-distance, 3px))); }
}

img.logo-icon,
img.login-logo-icon,
img.dashboard-diane-presence {
    animation: diane-mark-float 4.8s ease-in-out infinite;
}

img.logo-icon { --diane-float-distance: 2px; }
img.login-logo-icon { --diane-float-distance: 5px; }
img.dashboard-diane-presence { --diane-float-distance: 4px; }

@media (prefers-reduced-motion: reduce) {
    img.logo-icon,
    img.login-logo-icon,
    img.dashboard-diane-presence {
        animation: none;
    }
}

/* 17. One icon weight per surface: match the 1.7px dashboard set. */
.dashboard-telemetry-actions svg,
.dashboard-sync-control svg {
    stroke-width: 1.7;
}

/* 7. Theme sun/moon cross-fade (CSS only: opacity/scale/blur,
   cubic-bezier(0.2, 0, 0, 1)); collapsed icon keeps flex stable. */
.theme-icon {
    transition-property: opacity, transform, filter, width, margin;
    transition-duration: .3s;
    transition-timing-function: cubic-bezier(.2, 0, 0, 1);
}
.theme-icon-sun {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
}
.theme-icon-moon,
html[data-theme="light"] .theme-icon-sun {
    display: block;
    opacity: 0;
    transform: scale(.25);
    filter: blur(4px);
    width: 0;
    margin: 0;
    margin-inline-start: -7px;
    overflow: hidden;
    pointer-events: none;
}
html[data-theme="light"] .theme-icon-moon {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
    width: 16px;
}

/* 3. Elevation rings for flat cards; structural borders untouched. */
.card {
    box-shadow: 0 0 0 1px oklch(1 0 0 / .06);
    transition-property: box-shadow;
    transition-duration: 150ms;
    transition-timing-function: ease-out;
}
html[data-theme="light"] .card {
    box-shadow:
        0 0 0 1px oklch(0 0 0 / .06),
        0 1px 2px -1px oklch(0 0 0 / .06),
        0 2px 4px 0 oklch(0 0 0 / .04);
}

/* ── Chat top-bar refresh (chat-v2 system; plain CSS, no new framework) ──
   Search becomes an icon button that expands on focus; the channel
   picker becomes a labeled connection chip with a custom chevron. */

/* Tools row breathing room. */
.chat-v2 .chat-context-tools {
    gap: 8px;
}

/* In-chat search: icon button at rest, expands on focus (interruptible
   transition; icon takes the diane cue so color isn't motion-only). */
.chat-v2 .chat-inline-search {
    width: 40px;
    height: 40px;
    min-height: 40px;
    margin: 0;
    padding: 0;
    justify-content: center;
    overflow: hidden;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: var(--ink-3);
    cursor: text;
    transition-property: width, border-color, background-color, box-shadow, color;
    transition-duration: 220ms;
    transition-timing-function: var(--ease);
}
.chat-v2 .chat-inline-search svg {
    flex: 0 0 auto;
}
.chat-v2 .chat-inline-search input {
    width: 0;
    flex: 0 1 auto;
    opacity: 0;
    padding: 0;
    color: var(--ink);
    font-size: 12px;
    transition-property: opacity, width;
    transition-duration: 220ms;
    transition-timing-function: var(--ease);
}
.chat-v2 .chat-inline-search:hover {
    border-color: var(--line);
    background: rgba(255, 255, 255, .04);
    color: var(--ink-2);
}
.chat-v2 .chat-inline-search:focus-within {
    width: min(230px, 26vw);
    padding: 0 14px;
    justify-content: flex-start;
    border-color: rgba(124, 140, 255, .35);
    background: rgba(255, 255, 255, .05);
    box-shadow: 0 0 0 3px rgba(124, 140, 255, .1);
    color: var(--diane);
}
.chat-v2 .chat-inline-search:focus-within input {
    width: 100%;
    flex: 1 1 auto;
    opacity: 1;
}
.chat-v2 .chat-inline-search input:focus {
    border-color: transparent;
    box-shadow: none;
    background: transparent;
}

/* Library search: icon joins the focus cue; explicit transition props. */
.chat-v2 .chat-library-search {
    transition-property: border-color, background-color, box-shadow;
    transition-duration: 180ms;
    transition-timing-function: ease-out;
}
.chat-v2 .chat-library-search svg {
    transition-property: color;
    transition-duration: 150ms;
    transition-timing-function: ease-out;
}
.chat-v2 .chat-library-search:focus-within svg {
    color: var(--diane);
}
.chat-v2 .chat-library-caption span:last-child {
    font-variant-numeric: tabular-nums;
}

/* Library date row: pill coherence + color-scheme so the native
   calendar glyph stays visible on dark backgrounds. */
.chat-v2 .chat-library-date input {
    min-height: 34px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: rgba(255, 255, 255, .04);
    color: var(--ink-2);
    color-scheme: dark;
    transition-property: border-color, background-color, box-shadow;
    transition-duration: 180ms;
    transition-timing-function: ease-out;
}
.chat-v2 .chat-library-date input:focus {
    border-color: rgba(124, 140, 255, .35);
    background: rgba(255, 255, 255, .06);
    box-shadow: 0 0 0 3px rgba(124, 140, 255, .08);
}
.chat-v2 .chat-date-clear {
    position: relative;
    min-height: 34px;
    border-radius: 999px;
}
.chat-v2 .chat-date-clear::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
}

/* Light-mode surfaces for the refreshed controls. */
html[data-theme="light"] .chat-v2 .chat-inline-search {
    border-color: rgba(76, 82, 104, .12);
    background: #eef0f6;
}
html[data-theme="light"] .chat-v2 .chat-inline-search:hover {
    background: #e6e9f1;
}
html[data-theme="light"] .chat-v2 .chat-library-date input {
    background: #eef0f6;
    border-color: rgba(76, 82, 104, .1);
    color-scheme: light;
}

/* ── Chat empty-state structure (chat-v2 system; plain CSS) ──
   An extra spacer track parks the composer slightly above middle
   while the conversation is empty; textarea shows no scrollbar. */

/* Empty conversation: spacer .55fr < hero 1fr. */
#page-chat.chat-is-empty .chat-canvas {
    grid-template-rows: auto auto minmax(0, 1fr) auto minmax(0, .55fr);
}
#page-chat.chat-is-empty .chat-composer {
    background: transparent;
}
#page-chat.chat-is-empty .chat-messages-container {
    align-content: center;
}

/* Composer textarea: no visible scrollbar, auto-grow still applies. */
.chat-v2 .chat-compose-shell textarea {
    overflow-y: auto;
    scrollbar-width: none;
}
.chat-v2 .chat-compose-shell textarea::-webkit-scrollbar {
    display: none;
}

@media (max-width: 700px) {
    #page-chat.chat-is-empty .chat-canvas {
        grid-template-rows: auto auto minmax(0, 1fr) auto minmax(0, .35fr);
    }
}

/* Light-mode completeness pass.
   The chat restyles above layer dark hardcoded surfaces/text; this trailing
   block re-asserts correct light colors so no white-on-white can survive,
   regardless of layer order. Keep selectors >= the dark ones they override. */
html[data-theme="light"] .chat-v2 .conv-title {
    color: var(--ink);
}
html[data-theme="light"] .chat-v2 .conv-meta {
    color: var(--ink-3);
}
html[data-theme="light"] .chat-library-date input {
    color: var(--ink);
    color-scheme: light;
}
html[data-theme="light"] .chat-date-clear:hover {
    color: var(--ink);
    border-color: var(--chat-line-strong);
}
html[data-theme="light"] .chat-v2 .chat-library {
    border-inline-end-color: var(--chat-line);
}
html[data-theme="light"] .chat-v2 .chat-library-search input,
html[data-theme="light"] .chat-v2 .chat-inline-search input {
    color: var(--ink);
}
html[data-theme="light"] .chat-v2 .chat-channel-select select {
    color: var(--ink-2);
}
html[data-theme="light"] #page-chat.chat-v2 .chat-context-bar {
    background: rgba(232, 234, 238, .92);
    border-bottom-color: var(--chat-line);
}
html[data-theme="light"] .chat-v2 .chat-active-copy h3 {
    color: var(--ink);
}
html[data-theme="light"] .chat-v2 .chat-active-copy p {
    color: var(--ink-2);
}
html[data-theme="light"] .chat-v2 .chat-inline-search,
html[data-theme="light"] .chat-v2 .chat-channel-select {
    background: #f0f2f7;
    border-color: rgba(76, 82, 104, .1);
}
html[data-theme="light"] .chat-v2 .chat-zero-state p {
    color: var(--ink);
}
html[data-theme="light"] .chat-v2 .chat-zero-state > small {
    color: var(--ink-2);
}
html[data-theme="light"] .chat-starter-grid small {
    color: var(--ink-3);
}
html[data-theme="light"] .chat-v2 .chat-bubble {
    color: var(--ink);
}
html[data-theme="light"] .chat-v2 .chat-bubble code {
    color: #1b5fa0;
}
html[data-theme="light"] .chat-v2 .chat-bubble pre {
    background: #eef0f5;
    border-color: var(--chat-line);
}
html[data-theme="light"] .chat-v2 .bubble-quote {
    background: rgba(116, 87, 219, .07);
    color: var(--ink-2);
}
html[data-theme="light"] .chat-v2 .btn-reply-bubble {
    color: var(--ink-2);
    border-color: var(--chat-line);
    background: transparent;
}
html[data-theme="light"] .chat-v2 .chat-bubble-header,
html[data-theme="light"] .chat-v2 .chat-message-metrics {
    color: var(--ink-3);
}
html[data-theme="light"] .chat-v2 .chat-list-empty strong {
    color: var(--ink-2);
}
html[data-theme="light"] .chat-v2 .chat-list-empty span,
html[data-theme="light"] .chat-v2 .chat-zero-state-error {
    color: var(--ink-3);
}
html[data-theme="light"] #page-chat.chat-v2 .chat-composer {
    background: var(--bg-app);
}
html[data-theme="light"] .chat-v2 .chat-compose-shell textarea {
    color: var(--ink);
}
html[data-theme="light"] .chat-v2 .chat-compose-shell textarea::placeholder {
    color: var(--ink-3);
}
html[data-theme="light"] .chat-v2 .chat-composer-meta {
    color: var(--ink-3);
}
html[data-theme="light"] .chat-v2 .chat-composer-meta kbd {
    background: #f0f2f7;
    border-color: var(--chat-line);
    color: var(--ink-2);
}
html[data-theme="light"] .chat-v2 .btn-send-chat:disabled {
    background: #e3e6ee;
    color: #8a93a8;
}
html[data-theme="light"] .chat-v2 .quoted-preview-box {
    background: #f0f2f7;
    border-color: var(--chat-line);
    color: var(--ink-2);
}
html[data-theme="light"] .chat-v2 .conv-item {
    border-color: transparent;
}
html[data-theme="light"] .chat-v2 .conv-item:hover {
    background: #eef0f6;
    border-color: rgba(76, 82, 104, .08);
}
html[data-theme="light"] .chat-v2 .conv-item.active {
    background: var(--bg-active);
    border-color: var(--accent-line, var(--border-strong));
}
html[data-theme="light"] .chat-activity-copy small,
html[data-theme="light"] .chat-live-steps span,
html[data-theme="light"] .chat-live-activity > time {
    color: var(--ink-3);
}
html[data-theme="light"] .chat-live-steps span.is-done {
    color: var(--ink-2);
}

/* ============================================================
   Light completeness — hardcoded dark surfaces / text / tracks.
   Standalone light values only (tokens or explicit light literals).
   No filter, invert, brightness, white overlays, or gradient washes.
   ============================================================ */

/* Command palette: flat panel, soft shadow only. */
html[data-theme="light"] .command-center-panel {
    background: var(--surface-1);
    border-color: var(--line);
    box-shadow: var(--shadow-lg);
}

/* Dashboard masthead: no tinted sheen over the card. */
html[data-theme="light"] .dashboard-masthead::before {
    background: none;
}

/* Dashboard context rows / activity feed: keep hairlines visible. */
html[data-theme="light"] .dashboard-context .dashboard-connection-row,
html[data-theme="light"] .dashboard-activity .activity-item {
    border-bottom-color: var(--border-subtle);
}

/* Micro-text must stay readable: secondary (6.1:1) instead of muted. */
html[data-theme="light"] .topbar h1,
html[data-theme="light"] .clock,
html[data-theme="light"] th,
html[data-theme="light"] .dashboard-activity .activity-item small,
html[data-theme="light"] .dashboard-activity .activity-time {
    color: var(--ink-2);
}

/* Reminder / live gauge tracks: dark track on light, accent sweep kept. */
html[data-theme="light"] .dashboard-day .dashboard-reminder-index::before,
html[data-theme="light"] .dashboard-day .dashboard-reminder-row[data-state="overdue"] .dashboard-reminder-index::before,
html[data-theme="light"] .dashboard-stat-orbit {
    background: conic-gradient(var(--live-color) var(--live-progress), rgba(23, 26, 31, .1) 0);
}
html[data-theme="light"] .dashboard-day .dashboard-reminder-row[data-state="overdue"] .dashboard-reminder-index::before {
    background: conic-gradient(var(--bad) 100%, rgba(23, 26, 31, .1) 0);
}

/* Health service tones: dark text / soft tinted pills on white cards. */
html[data-theme="light"] .health-service-card[data-tone="ok"] .health-service-mark { color: #177245; }
html[data-theme="light"] .health-service-card[data-tone="warning"] .health-service-mark { color: #92610F; }
html[data-theme="light"] .health-service-card[data-tone="bad"] .health-service-mark { color: #B3373F; }
html[data-theme="light"] .health-service-card[data-tone="missing"] .health-service-mark { color: #8A5A17; }
html[data-theme="light"] .health-service-card[data-tone="env"] .health-service-mark { color: #7986E6; }
html[data-theme="light"] .health-service-card[data-tone="ok"] .health-service-state {
    color: #177245; background: rgba(23, 114, 69, .1);
}
html[data-theme="light"] .health-service-card[data-tone="warning"] .health-service-state {
    color: #92610F; background: rgba(146, 97, 15, .1);
}
html[data-theme="light"] .health-service-card[data-tone="bad"] .health-service-state {
    color: #B3373F; background: rgba(179, 55, 63, .1);
}
html[data-theme="light"] .health-service-card[data-tone="missing"] .health-service-state {
    color: #8A5A17; background: rgba(138, 90, 23, .1);
}
html[data-theme="light"] .health-service-card[data-tone="env"] .health-service-state {
    color: #7986E6; background: rgba(106, 90, 201, .1);
}

/* Danger buttons: dark red text on light. */
html[data-theme="light"] .vault-btn-danger {
    background: rgba(179, 55, 63, .08);
    border-color: rgba(179, 55, 63, .3);
    color: #B3373F;
}
html[data-theme="light"] .vault-btn-danger:hover:not(:disabled) {
    background: rgba(179, 55, 63, .14);
    border-color: rgba(179, 55, 63, .45);
    color: #B3373F;
}

/* Switches: light track, white knob, accent when on. */
html[data-theme="light"] input[type="checkbox"] {
    background: #DDE2EA;
    border-color: var(--border-strong);
}
html[data-theme="light"] input[type="checkbox"]::after {
    background: #FFFFFF;
    box-shadow: 0 1px 2px rgba(23, 26, 31, .25);
}

/* Login: flat light backdrop, soft card shadow. */
html[data-theme="light"] #login-overlay {
    background: var(--bg-app);
}
html[data-theme="light"] .login-card {
    box-shadow: var(--shadow-md);
}

/* Login launch film: label ink and the returning-visitor link follow theme
   (the frame/player stay literal black either way — see .login-film-frame). */
html[data-theme="light"] .login-film-eyebrow {
    color: var(--diane);
}
html[data-theme="light"] .login-film-time,
html[data-theme="light"] .login-film-link {
    color: var(--ink-3);
}
html[data-theme="light"] .login-film-link:hover,
html[data-theme="light"] .login-film-link:focus-visible {
    color: var(--ink);
}

/* Phone checks: readable tones on light. */
html[data-theme="light"] .phone-check[data-tone="ok"] .phone-check-icon {
    color: #4655C4; background: rgba(88, 103, 216, .1);
}
html[data-theme="light"] .phone-check[data-tone="bad"] .phone-check-icon {
    color: #B3373F; background: rgba(179, 55, 63, .1);
}
html[data-theme="light"] .phone-check-badge {
    color: var(--ink-2);
    background: rgba(23, 26, 31, .06);
}
html[data-theme="light"] .phone-check[data-tone="ok"] .phone-check-badge { color: #4655C4; }
html[data-theme="light"] .phone-link-result p {
    color: var(--ink-2);
}

/* Sleep observatory: flat light panels instead of night gradients. */
html[data-theme="light"] .sleep-observatory .sleep-night-map,
html[data-theme="light"] .sleep-observatory .sleep-empty-state,
html[data-theme="light"] .sleep-night-map,
html[data-theme="light"] .sleep-empty-state {
    border-color: var(--line);
    background: var(--surface-2);
}
html[data-theme="light"] .sleep-range-picker {
    color: var(--ink-2);
}
html[data-theme="light"] .sleep-range-picker select {
    color: var(--ink);
    border-color: var(--line);
}
html[data-theme="light"] .sleep-observatory .sleep-wear {
    border-color: var(--line);
    background: var(--surface-2);
}
html[data-theme="light"] .sleep-wear[data-state="on"] {
    color: var(--ink);
}

/* Learning review + empty states: readable text, light track. */
html[data-theme="light"] .language-learning-summary {
    background: var(--surface-2);
}
html[data-theme="light"] .language-learning-summary span {
    color: var(--diane);
}
html[data-theme="light"] .language-learning-summary small {
    color: var(--ink-2);
}
html[data-theme="light"] .language-learning-summary i {
    background: var(--border-default);
}
html[data-theme="light"] .learning-review-row b { color: var(--ink); }
html[data-theme="light"] .learning-review-row span,
html[data-theme="light"] .learning-review-row small,
html[data-theme="light"] .learning-review-row em,
html[data-theme="light"] .learning-empty-state p { color: var(--ink-2); }
html[data-theme="light"] .learning-empty-state strong { color: var(--ink); }
html[data-theme="light"] .learning-review-row > i { background: var(--border-default); }

/* Light character pass — mirror the dark identity (cyan glow, violet
   secondary, layered mist) instead of flat grey. Trailing block wins ties. */
html[data-theme="light"] body {
    background:
        radial-gradient(1100px 420px at 50% -160px, rgba(88, 103, 216, .08), transparent 60%),
        radial-gradient(800px 340px at 85% -120px, rgba(103, 87, 199, .06), transparent 60%),
        var(--bg-app);
}

html[data-theme="light"] #page-chat.chat-v2 {
    background:
        radial-gradient(ellipse 70% 42% at 50% 0%, rgba(88, 103, 216, .10), transparent 55%),
        radial-gradient(ellipse 45% 30% at 85% 0%, rgba(103, 87, 199, .07), transparent 60%),
        #E8ECF3;
}

html[data-theme="light"] .chat-v2 .chat-library {
    background: linear-gradient(180deg, #F2F4F9 0%, #E9EDF4 100%);
    border-inline-end: 1px solid var(--chat-line-strong);
}

html[data-theme="light"] .chat-v2 .chat-library-search,
html[data-theme="light"] .chat-v2 .chat-inline-search {
    background: #FFFFFF;
    border-color: var(--chat-line);
    box-shadow: var(--shadow-sm);
}

html[data-theme="light"] .chat-v2 .chat-library-search:focus-within,
html[data-theme="light"] .chat-v2 .chat-inline-search:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-muted);
}

html[data-theme="light"] .chat-v2 .btn-new-chat {
    border: 0;
    background: linear-gradient(135deg, #2E9BD6 0%, #6757C7 100%);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 6px 18px rgba(88, 103, 216, .30);
}

html[data-theme="light"] .chat-v2 .btn-new-chat:hover {
    filter: brightness(1.06);
    box-shadow: 0 8px 22px rgba(88, 103, 216, .36);
}

html[data-theme="light"] .chat-v2 .conv-item {
    border: 1px solid transparent;
}

html[data-theme="light"] .chat-v2 .conv-item:hover {
    background: var(--bg-hover);
    border-color: var(--chat-line);
    box-shadow: var(--shadow-sm);
}

html[data-theme="light"] .chat-v2 .conv-item.active {
    background: var(--bg-active);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
}

html[data-theme="light"] .chat-v2 .chat-zero-state {
    position: relative;
}

html[data-theme="light"] .chat-v2 .chat-zero-state::before {
    background: none;
}

html[data-theme="light"] .chat-v2 .chat-zero-kicker {
    background: var(--accent-muted);
    border: 1px solid rgba(88, 103, 216, .28);
    color: var(--accent-hover);
}

html[data-theme="light"] .chat-v2 .chat-zero-kicker i {
    background: var(--accent);
    box-shadow: 0 0 10px rgba(88, 103, 216, .5);
}

html[data-theme="light"] .chat-v2 .chat-context-bar {
    background: rgba(232, 234, 238, .85);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--chat-line);
}

html[data-theme="light"] .chat-v2 .chat-bubble-wrapper.user .chat-bubble {
    background: #DEE3FA;
    border-color: rgba(88, 103, 216, .22);
    color: #12304D;
    box-shadow: var(--shadow-sm);
}

html[data-theme="light"] #page-chat.chat-v2 .chat-composer {
    background: var(--bg-app);
}

html[data-theme="light"] .chat-v2 .chat-compose-shell {
    background: var(--bg-surface);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
}

html[data-theme="light"] .chat-v2 .chat-compose-shell:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-muted), var(--shadow-md);
}

html[data-theme="light"] .chat-v2 .chat-starter-grid button {
    background: var(--bg-surface);
    border-color: var(--chat-line);
    box-shadow: var(--shadow-sm);
}

html[data-theme="light"] .chat-v2 .chat-starter-grid button:hover {
    border-color: var(--accent);
    background: var(--accent-muted);
    box-shadow: var(--shadow-sm);
}

html[data-theme="light"] .chat-v2 .chat-starter-grid span {
    color: var(--ink);
}

/* ============================================================
   Light gaps — bright-on-dark text that must stay readable.
   Flat light values only. Voice overlay / maps / terminals keep
   their deliberate dark surfaces and are out of scope here.
   ============================================================ */

/* Vault / integrations tones, links and status text. */
html[data-theme="light"] .provider-connection-card.is-connected .provider-connection-state { color: #4655C4; }
html[data-theme="light"] .vault-link { color: #4655C4; }
html[data-theme="light"] .vault-fact[data-tone="ok"] .vault-fact-icon { color: #177245; }
html[data-theme="light"] .vault-fact[data-tone="missing"] .vault-fact-icon { color: #92610F; }
html[data-theme="light"] .vault-fact[data-tone="bad"] .vault-fact-icon { color: #B3373F; }
html[data-theme="light"] .vault-pill[data-tone="ok"] { color: #177245; }
html[data-theme="light"] .vault-pill[data-tone="missing"] { color: #92610F; }
html[data-theme="light"] .vault-pill[data-tone="bad"] { color: #B3373F; }
html[data-theme="light"] .vault-tag-deploy { color: #6757C7; }
html[data-theme="light"] .vault-envonly-badge svg { color: #4655C4; }
html[data-theme="light"] .vault-row-status:not([data-tone="ok"]):not([data-tone="bad"]):not([data-tone="warn"]) {
    color: var(--ink-2);
}

/* Phones / services / model runtime accents. */
html[data-theme="light"] .phone-link-state[data-state="connected"] { color: #4655C4; }
html[data-theme="light"] .autonomy-orbit svg {
    color: #4655C4;
    filter: drop-shadow(0 0 8px rgba(88, 103, 216, .35));
}
html[data-theme="light"] .model-runtime-state span { color: var(--ink-2); }

/* Price check pills: dark text on the kept tinted chips. */
html[data-theme="light"] .status-active .price-check-status-pill { color: #4D3FA7; }
html[data-theme="light"] .status-updated .price-check-status-pill { color: #177245; }
html[data-theme="light"] .status-free .price-check-status-pill { color: #6D28D9; }
html[data-theme="light"] .status-unchanged .price-check-status-pill {
    background: rgba(23, 26, 31, .06);
    color: var(--ink-2);
}
html[data-theme="light"] .status-failed .price-check-status-pill { color: #92610F; }

/* Log viewer internals: readable ink on the light console. */
html[data-theme="light"] .log-step-icon,
html[data-theme="light"] .log-line-icon { color: #4655C4; }
html[data-theme="light"] .log-step[data-tone="bad"] .log-step-icon { color: #B3373F; }
html[data-theme="light"] .log-step[data-tone="warn"] .log-step-icon { color: #92610F; }
html[data-theme="light"] .log-step-title { color: var(--ink); }
html[data-theme="light"] .log-step-action { color: #4655C4; }
html[data-theme="light"] .log-step-gist { color: var(--ink-2); }
html[data-theme="light"] .log-step-duration { color: var(--ink-2); }
html[data-theme="light"] .log-step-body {
    color: var(--ink-2);
    border-color: var(--line);
    background: var(--surface-2);
}
html[data-theme="light"] .log-filters select,
html[data-theme="light"] .log-filters input,
html[data-theme="light"] .log-advanced-filters input,
html[data-theme="light"] .log-advanced-filters select {
    color: var(--ink);
    color-scheme: light;
}
html[data-theme="light"] .log-filters label,
html[data-theme="light"] .log-advanced-filters label { color: var(--ink-2); }
html[data-theme="light"] .log-advanced-filters {
    border-bottom-color: var(--line);
    background: var(--surface-2);
}
html[data-theme="light"] .log-diagnosis { border-bottom-color: var(--line); }

/* News source marks and headlines. */
html[data-theme="light"] .news-source-mark {
    border-color: rgba(88, 103, 216, .25);
    background: rgba(88, 103, 216, .08);
    color: #4655C4;
}
html[data-theme="light"] .news-source-identity h5 { color: var(--ink); }
html[data-theme="light"] .news-source-network { color: var(--ink-2); }

/* Flow empty-state action. */
html[data-theme="light"] .flow-list-empty button { color: #4655C4; }

/* ============================================================
   Chat top-right cleanup (date filter removed) and message
   details restore. The library head and search go minimal and
   airy; the details drawer is gone and its facts now live on
   each message. Trailing block wins ties by construction.
   ============================================================ */

.chat-v2 .chat-library {
    grid-template-rows: auto auto auto auto minmax(0, 1fr);
}

.chat-v2 .chat-library-head {
    grid-row: 1;
    min-height: 56px;
    padding: 12px 14px 6px;
}

.chat-v2 .chat-library-search {
    grid-row: 2;
}

.chat-v2 .chat-library-date {
    grid-row: 3;
}

.chat-v2 .chat-library-caption {
    grid-row: 4;
}

.chat-v2 .conversations-list {
    grid-row: 5;
}

.chat-v2 .chat-library-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.chat-v2 .chat-library-title {
    margin: 0;
    font-size: 15px;
    font-weight: 620;
    letter-spacing: -.01em;
    color: #e7f1fa;
}

.chat-v2 .btn-new-chat {
    width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 1px solid rgba(137, 183, 226, .16);
    border-radius: 10px;
    background: transparent;
    color: #8fa6bd;
}

.chat-v2 .btn-new-chat svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chat-v2 .btn-new-chat:hover {
    border-color: rgba(76, 199, 255, .38);
    background: var(--chat-blue-soft);
    color: #e6f4ff;
}

.chat-v2 .chat-library-search {
    height: 36px;
    margin: 0 12px 8px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(137, 183, 226, .12);
    border-radius: 12px;
    background: rgba(16, 28, 46, .48);
    transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.chat-v2 .chat-library-search:focus-within {
    border-color: rgba(76, 199, 255, .32);
    background: rgba(16, 28, 46, .92);
    box-shadow: 0 0 0 3px rgba(76, 199, 255, .08);
}

.chat-v2 .chat-library-search svg {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    color: #7d93aa;
    transition: color .18s ease;
}

.chat-v2 .chat-library-search:focus-within svg {
    color: #4cc7ff;
}

.chat-v2 .chat-library-search input {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    font-size: 12px;
    color: #dbe9f6;
}

.chat-v2 .chat-library-search input::placeholder {
    color: #63798f;
}

/* Date filter: one calm pill — calendar icon, borderless native input,
   round clear chip that appears only while a day is chosen. */
.chat-v2 .chat-library-date {
    height: 36px;
    margin: 0 12px 8px;
    padding-block: 0;
    padding-inline-start: 10px;
    padding-inline-end: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(137, 183, 226, .12);
    border-radius: 12px;
    background: rgba(16, 28, 46, .48);
    color: #7d93aa;
    transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.chat-v2 .chat-library-date:focus-within {
    border-color: rgba(76, 199, 255, .32);
    background: rgba(16, 28, 46, .92);
    box-shadow: 0 0 0 3px rgba(76, 199, 255, .08);
}

.chat-v2 .chat-library-date > svg {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chat-v2 .chat-library-date input[type="date"] {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: #cfe0f0;
    font-size: 12px;
    color-scheme: dark;
}

.chat-v2 .chat-library-date input[type="date"]:focus {
    border: 0;
    box-shadow: none;
    background: transparent;
}

.chat-v2 .chat-library-date input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: .55;
    cursor: pointer;
}

.chat-v2 .chat-date-clear {
    width: 22px;
    height: 22px;
    min-height: 0;
    padding: 0;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: rgba(137, 183, 226, .16);
    color: #cfe0f0;
    font-size: 13px;
    line-height: 1;
}

.chat-v2 .chat-date-clear:hover {
    background: rgba(240, 121, 111, .28);
    color: #ffe2de;
}

.chat-v2 .chat-context-tools .chat-find-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* In-conversation find: always a visible field (never a bare icon), gently
   wider while typing. The old icon-only pattern left the input at width 0
   with a centered glyph, which read as a broken control. */
.chat-v2 .chat-inline-search {
    width: 200px;
    height: 36px;
    padding: 0 12px;
    justify-content: flex-start;
    gap: 8px;
    overflow: visible;
    border: 1px solid rgba(137, 183, 226, .12);
    border-radius: 12px;
    background: rgba(16, 28, 46, .5);
}

.chat-v2 .chat-inline-search svg {
    flex: 0 0 auto;
}

.chat-v2 .chat-inline-search input {
    width: 100%;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    padding: 0;
    opacity: 1;
    font-size: 12px;
}

.chat-v2 .chat-inline-search input::placeholder {
    color: #63798f;
}

.chat-v2 .chat-inline-search:hover {
    border-color: rgba(137, 183, 226, .22);
}

.chat-v2 .chat-inline-search:focus-within {
    width: min(240px, 30vw);
    border-color: rgba(76, 199, 255, .32);
    background: rgba(16, 28, 46, .92);
    box-shadow: 0 0 0 3px rgba(76, 199, 255, .08);
}

.chat-v2 .chat-inline-search:focus-within input {
    width: 100%;
    flex: 1 1 auto;
    opacity: 1;
}

.chat-v2 .chat-active-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.chat-v2 .chat-active-title-row h3 {
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-v2 .chat-title-rename {
    width: 24px;
    height: 24px;
    padding: 0;
    flex: none;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #5f7590;
    opacity: 0;
    transition: opacity .16s ease, color .16s ease, background .16s ease;
}

.chat-v2 .chat-active-title-row:hover .chat-title-rename,
.chat-v2 .chat-title-rename:focus-visible {
    opacity: 1;
}

.chat-v2 .chat-title-rename:hover {
    background: var(--surface-2);
    color: #cfe4f7;
}

.chat-v2 .chat-title-rename svg {
    width: 13px;
    height: 13px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Message detail popover and cost chip stay legible in both themes. */
html[data-theme="light"] .chat-msg .chat-message-details summary {
    border-color: rgba(88, 103, 216, .25);
    color: var(--ink-2);
}

html[data-theme="light"] .chat-msg .chat-message-details summary:hover,
html[data-theme="light"] .chat-msg .chat-message-details[open] summary {
    border-color: var(--accent);
    color: var(--accent-hover);
}

html[data-theme="light"] .chat-msg .chat-message-details > span {
    background: #FFFFFF;
    border-color: var(--chat-line);
    color: var(--ink-2);
    box-shadow: var(--shadow-md);
}

html[data-theme="light"] .chat-cost-chip {
    border-color: rgba(23, 114, 69, .25);
    color: #177245;
}

html[data-theme="light"] .chat-msg.is-user .chat-bubble {
    background: #DEE3FA;
    border-color: rgba(88, 103, 216, .22);
    color: #12304D;
}

html[data-theme="light"] .chat-v2 .chat-library-head {
    color: #1c2a3a;
}

html[data-theme="light"] .chat-v2 .chat-library-title {
    color: var(--ink);
}

html[data-theme="light"] .chat-v2 .btn-new-chat {
    border-color: var(--chat-line);
    background: #FFFFFF;
    color: #4655C4;
    box-shadow: var(--shadow-sm);
}

html[data-theme="light"] .chat-v2 .btn-new-chat:hover {
    border-color: var(--accent);
    background: var(--accent-muted);
    color: var(--accent-hover);
}

html[data-theme="light"] .chat-v2 .chat-library-search,
html[data-theme="light"] .chat-v2 .chat-inline-search {
    background: #FFFFFF;
    border-color: var(--chat-line);
    box-shadow: var(--shadow-sm);
}

html[data-theme="light"] .chat-v2 .chat-title-rename {
    color: var(--ink-3);
}

html[data-theme="light"] .chat-v2 .chat-title-rename:hover {
    background: var(--bg-hover);
    color: var(--accent-hover);
}

.chat-v2 .chat-title-rename-input {
    width: min(340px, 46vw);
    min-height: 30px;
    padding: 3px 9px;
    border: 1px solid rgba(76, 199, 255, .32);
    border-radius: 9px;
    background: rgba(16, 28, 46, .9);
    color: #eef7ff;
    font-size: 13px;
    font-weight: 610;
}

.chat-v2 .chat-title-rename-input:focus {
    outline: 2px solid rgba(76, 199, 255, .45);
    outline-offset: 1px;
}

html[data-theme="light"] .chat-v2 .chat-title-rename-input {
    background: #FFFFFF;
    border-color: var(--accent);
    color: var(--ink);
}

html[data-theme="light"] .chat-v2 .chat-title-rename-input:focus {
    outline-color: var(--accent-muted);
}

/* Empty-state composer must stay full-bleed: the 680px empty width would
   otherwise combine with the full-bleed side padding ((100% - 720px) / 2 per
   side) and leave ~100px for the shell, squeezing the textarea into a
   vertical strip. */
.chat-v2.chat-is-empty .chat-composer {
    width: 100%;
}

/* Refreshed sidebar controls in light mode: white pills, ink text. */
html[data-theme="light"] .chat-v2 .chat-library-search input {
    color: var(--ink);
}

html[data-theme="light"] .chat-v2 .chat-library-search input::placeholder,
html[data-theme="light"] .chat-v2 .chat-inline-search input::placeholder {
    color: var(--ink-faint);
}

html[data-theme="light"] .chat-v2 .chat-library-search svg {
    color: var(--ink-3);
}

html[data-theme="light"] .chat-v2 .chat-library-search:focus-within svg {
    color: var(--accent);
}

html[data-theme="light"] .chat-v2 .chat-library-search:focus-within,
html[data-theme="light"] .chat-v2 .chat-library-date:focus-within,
html[data-theme="light"] .chat-v2 .chat-inline-search:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-muted);
}

html[data-theme="light"] .chat-v2 .chat-library-date {
    background: #FFFFFF;
    border-color: var(--chat-line);
    box-shadow: var(--shadow-sm);
    color: var(--ink-3);
}

html[data-theme="light"] .chat-v2 .chat-library-date input[type="date"] {
    color: var(--ink);
    color-scheme: light;
}

html[data-theme="light"] .chat-v2 .chat-date-clear {
    background: var(--bg-hover);
    color: var(--ink-2);
}

html[data-theme="light"] .chat-v2 .chat-date-clear:hover {
    background: #F6D9D5;
    color: #B3373F;
}

html[data-theme="light"] .chat-v2 .chat-inline-search input {
    color: var(--ink);
}

/* ──── Brand loader (dashboard/diane-loader.js is the only markup source) ────
   Hierarchy: boot + waiting/processing regions use this mark; content whose
   shape is known keeps a skeleton; buttons keep a minimal inline spinner. */
.diane-loader {
    --diane-loader-size: clamp(48px, 3vw + 36px, 64px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-width: 0;
    color: var(--ink-3);
    font-size: .78rem;
    text-align: center;
    /* Hold back briefly so near-instant loads never flash a loader. */
    animation: diane-loader-in 180ms ease-out 200ms both;
}
.diane-loader--full { --diane-loader-size: clamp(84px, 6vw + 56px, 120px); gap: 16px; font-size: .86rem; }
.diane-loader--section { min-height: 120px; padding: 12px; grid-column: 1 / -1; }
.diane-loader--compact { --diane-loader-size: clamp(28px, 1vw + 24px, 40px); gap: 8px; font-size: .74rem; }
.diane-loader-mark {
    position: relative;
    display: block;
    flex: none;
    width: var(--diane-loader-size);
    height: var(--diane-loader-size);
    /* Frame 0 of the animation: shown until the shared animation decodes. */
    background: url("assets/diane-loader-still.png?v=2") center / contain no-repeat;
}
.diane-loader-mark picture,
.diane-loader-anim {
    display: block;
    width: 100%;
    height: 100%;
}
.diane-loader-anim { opacity: 0; user-select: none; -webkit-user-drag: none; }
:root[data-diane-loader="ready"] .diane-loader-mark { background-image: none; }
:root[data-diane-loader="ready"] .diane-loader-anim { opacity: 1; }
.diane-loader-label { max-width: 32ch; line-height: 1.5; }
.diane-loader-sr {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
@keyframes diane-loader-in { from { opacity: 0; } to { opacity: 1; } }

/* App boot: the shell is hidden until auth resolves, so the canvas carries the mark. */
.app-boot {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 16px;
    background: var(--canvas);
    transition: opacity 180ms ease-out, visibility 0s linear 180ms;
}
.app-boot .diane-loader { animation-delay: 150ms; }
body.boot-done .app-boot { opacity: 0; visibility: hidden; pointer-events: none; }

/* Skeletons for content whose shape is known (lists, message threads, cards). */
.loading-shimmer,
.dashboard-skeleton {
    display: block;
    border-radius: 12px;
    background: linear-gradient(90deg, var(--surface-1), var(--surface-2), var(--surface-1));
    background-size: 220% 100%;
    animation: shimmer 1.5s linear infinite;
}
.dashboard-skeleton { min-height: 72px; width: 100%; }

@media (prefers-reduced-motion: reduce) {
    .diane-loader { animation-duration: 1ms; animation-delay: 150ms; }
    .diane-loader-mark { background-image: none; }
    .diane-loader-anim { opacity: 1; }
    .loading-shimmer,
    .dashboard-skeleton,
    .chat-list-loading i,
    .flow-list-loading i { animation: none; }
    .app-boot { transition: none; }
}

/* Undo the critical first-paint hold in index.html once this sheet has loaded. */
:where(body > :not(.app-boot)) { visibility: inherit; }

/* ============================================================
   ChatGPT-replica pass: one centered 768px reading column.
   - Empty: greeting centered, composer centered mid-canvas.
   - Active: oldest at top, newest at bottom, auto-stick to latest.
   - Owner bubble pinned physical-right; Diane plain full-column text
     with its hover toolbar on physical-left (both directions).
   - Bottom composer: pill + fade + centered disclaimer.
   - Sidebar search/date: no overlapping native controls.
   Trailing block wins ties by construction; contract rules above stay.
   ============================================================ */

.chat-v2 .chat-messages-container {
    padding: 28px max(20px, calc((100% - 768px) / 2)) 12px;
}

/* Owner row: hug the text, pinned to the physical right edge of the
   reading column in BOTH directions (ChatGPT puts the owner right). */
html[dir="rtl"] .chat-msg.is-user,
html[dir="ltr"] .chat-msg.is-user {
    width: fit-content;
    max-width: min(85%, 600px);
    margin-inline-start: auto;
    margin-inline-end: 0;
}

/* Diane row: the full reading column, centered — never stranded left. */
html[dir="rtl"] .chat-msg.is-diane,
html[dir="ltr"] .chat-msg.is-diane {
    width: 100%;
    max-width: 768px;
    margin-inline-start: auto;
    margin-inline-end: auto;
}

html[dir="rtl"] .chat-msg.is-user .chat-bubble,
html[dir="ltr"] .chat-msg.is-user .chat-bubble {
    width: fit-content;
    max-width: 100%;
    margin-inline-start: auto;
    margin-inline-end: 0;
    padding: 13px 17px;
    border: 1px solid rgba(79, 185, 255, .16);
    border-radius: 20px 20px 6px 20px;
    background: linear-gradient(145deg, rgba(30, 96, 155, .55), rgba(38, 66, 118, .42));
    color: #f0f8ff;
    font-size: 14.5px;
    line-height: 1.75;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .22);
}

html[dir="rtl"] .chat-msg.is-diane .chat-bubble,
html[dir="ltr"] .chat-msg.is-diane .chat-bubble {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 2px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: #dbe7f3;
    font-size: 15px;
    line-height: 1.85;
    text-align: start;
}

/* Owner meta/tools under the bubble on the physical right;
   Diane meta/tools on the physical left — like the reference. */
html[dir="rtl"] .chat-msg.is-user .chat-msg-meta,
html[dir="ltr"] .chat-msg.is-user .chat-msg-meta,
html[dir="rtl"] .chat-msg.is-user .chat-msg-tools,
html[dir="ltr"] .chat-msg.is-user .chat-msg-tools {
    margin-inline-start: auto;
    margin-inline-end: 0;
}
html[dir="rtl"] .chat-msg.is-diane .chat-msg-meta,
html[dir="ltr"] .chat-msg.is-diane .chat-msg-meta,
html[dir="rtl"] .chat-msg.is-diane .chat-msg-tools,
html[dir="ltr"] .chat-msg.is-diane .chat-msg-tools {
    margin-inline-start: 0;
    margin-inline-end: auto;
}

.chat-msg {
    animation: message-enter 300ms var(--ease) both;
}

/* Inline activity trace follows the same reading column. */
.chat-v2 .chat-activity {
    width: 100%;
    max-width: 768px;
    margin-inline-start: auto;
    margin-inline-end: auto;
}
html[dir="rtl"] .chat-activity,
html[dir="ltr"] .chat-activity {
    margin-inline-start: auto;
    margin-inline-end: auto;
}

/* Bottom composer: full-bleed fade, pill centered on the column. */
.chat-v2 .chat-composer {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 10px max(16px, calc((100% - 768px) / 2)) max(16px, env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, transparent, var(--chat-canvas) 42%);
}
.chat-v2 .chat-compose-shell {
    max-width: 768px;
    margin: 0 auto;
    min-height: 58px;
    border-radius: 28px;
}
.chat-v2 .chat-compose-shell textarea {
    font-size: 14.5px;
    line-height: 1.6;
}
.chat-composer-hint {
    max-width: 768px;
    margin: 7px auto 0;
    text-align: center;
}

/* Empty state: greeting + centered composer, starters as calm cards. */
.chat-v2.chat-is-empty .chat-composer {
    width: 100%;
    max-width: none;
    background: transparent;
}
.chat-v2.chat-is-empty .chat-messages-container {
    width: min(768px, calc(100% - 48px));
    margin: 0 auto;
    padding-inline: 0;
}
.chat-v2 .chat-zero-state {
    animation: chat-soft-in .5s var(--ease) both;
}
.chat-v2 .chat-starter-grid button {
    text-align: start;
}
.chat-v2 .chat-starter-grid button:focus-visible {
    outline: 2px solid rgba(76, 199, 255, .6);
    outline-offset: 2px;
}

/* Sidebar search: no native cancel glyph, no autofill overlay bubble,
   nothing absolutely positioned above the field. */
.chat-v2 .chat-library-search {
    position: relative;
    isolation: isolate;
    overflow: hidden;
}
.chat-v2 .chat-library-search input[type="search"]::-webkit-search-cancel-button,
.chat-v2 .chat-library-search input[type="search"]::-webkit-search-decoration,
.chat-v2 .chat-library-search input[type="search"]::-webkit-search-results-button,
.chat-v2 .chat-library-search input[type="search"]::-webkit-search-results-decoration,
.chat-v2 .chat-inline-search input[type="search"]::-webkit-search-cancel-button,
.chat-v2 .chat-inline-search input[type="search"]::-webkit-search-decoration {
    -webkit-appearance: none;
    appearance: none;
    display: none;
    width: 0;
    height: 0;
    margin: 0;
}
.chat-v2 .chat-library-search input::-ms-clear,
.chat-v2 .chat-inline-search input::-ms-clear {
    display: none;
    width: 0;
    height: 0;
}
.chat-v2 .chat-library-search input:-webkit-autofill,
.chat-v2 .chat-library-search input:-webkit-autofill:hover,
.chat-v2 .chat-library-search input:-webkit-autofill:focus,
.chat-v2 .chat-inline-search input:-webkit-autofill,
.chat-v2 .chat-inline-search input:-webkit-autofill:hover,
.chat-v2 .chat-inline-search input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 100px transparent inset;
    -webkit-text-fill-color: inherit;
    caret-color: auto;
    transition: background-color 9999s ease-out;
}

/* Date pill: ONE visible calendar glyph (the label svg). The native
   indicator turns invisible yet covers the pill so the whole pill
   opens the picker — no more double icons / overlapping text. */
.chat-v2 .chat-library-date {
    position: relative;
    overflow: hidden;
}
.chat-v2 .chat-library-date input[type="date"] {
    position: relative;
    z-index: 1;
}
.chat-v2 .chat-library-date input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: 0;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    cursor: pointer;
}
.chat-v2 .chat-library-date input[type="date"]::-webkit-datetime-edit {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chat-v2 .chat-date-clear {
    position: relative;
    z-index: 2;
}

html[data-theme="light"] .chat-msg.is-diane .chat-bubble {
    color: #24384d;
}
html[data-theme="light"] .chat-v2 .chat-composer {
    background: linear-gradient(180deg, transparent, var(--canvas) 42%);
}

@media (max-width: 700px) {
    .chat-v2 .chat-msg {
        min-width: 0;
    }
    html[dir="rtl"] .chat-msg.is-user,
    html[dir="ltr"] .chat-msg.is-user {
        max-width: 88%;
    }
    .chat-v2 .chat-messages-container,
    .chat-v2 .chat-composer {
        padding-inline: 12px;
    }
    .chat-v2.chat-is-empty .chat-messages-container {
        width: calc(100% - 24px);
    }
}

/* ============================================================
   Chat fix pass 2: physical pins, date pill retired, search suite.
   - Owner bubble: physical RIGHT in both directions (the previous
     pass mixed logical/physical margins and stranded it left).
   - Date filter retired from view (markup+logic stay for contracts):
     the sidebar keeps only the chats search.
   - Sidebar search becomes a real suite: clear control, result
     cards with highlighted hits, kind chips, jump affordance.
   Trailing block wins ties by construction.
   ============================================================ */

/* Date pill retired: sidebar keeps only the chats search. */
html .chat-v2 .chat-library-date {
    display: none;
}

/* Owner row hugs its text on the physical right; Diane centers full. */
#page-chat .chat-msg.is-user {
    width: fit-content;
    max-width: min(85%, 600px);
    margin-left: auto;
    margin-right: 0;
}
#page-chat .chat-msg.is-diane {
    width: 100%;
    max-width: 768px;
    margin-left: auto;
    margin-right: auto;
}
#page-chat .chat-msg.is-user .chat-bubble {
    width: fit-content;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    padding: 13px 17px;
    border: 1px solid rgba(79, 185, 255, .18);
    border-radius: 20px 20px 6px 20px;
    background: linear-gradient(145deg, rgba(30, 96, 155, .6), rgba(38, 66, 118, .45));
    color: #f0f8ff;
    font-size: 14.5px;
    line-height: 1.75;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
    text-align: start;
}
#page-chat .chat-msg.is-diane .chat-bubble {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 2px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: #dbe7f3;
    font-size: 15px;
    line-height: 1.85;
    text-align: start;
}
/* Owner meta/tools under the bubble on the right; Diane's on left. */
#page-chat .chat-msg.is-user .chat-msg-meta,
#page-chat .chat-msg.is-user .chat-msg-tools {
    margin-left: auto;
    margin-right: 0;
}
#page-chat .chat-msg.is-diane .chat-msg-meta,
#page-chat .chat-msg.is-diane .chat-msg-tools {
    margin-left: 0;
    margin-right: auto;
}

/* Messages canvas: newest lands at the bottom, no smooth-fighting. */
#page-chat .chat-messages-container {
    scroll-behavior: auto;
    overscroll-behavior-y: contain;
}

/* ──── Sidebar search suite ──── */
#page-chat .chat-library-search {
    height: 42px;
    border-radius: 14px;
    border: 1px solid rgba(137, 183, 226, .16);
    background: rgba(16, 28, 46, .6);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}
#page-chat .chat-library-search:focus-within {
    border-color: rgba(76, 199, 255, .45);
    background: rgba(16, 28, 46, .95);
    box-shadow: 0 0 0 3px rgba(76, 199, 255, .12), inset 0 1px 0 rgba(255, 255, 255, .05);
}
#page-chat .chat-library-search input {
    font-size: 13px;
}
#page-chat .chat-library-search input::placeholder {
    color: #7d93aa;
}
.chat-search-clear {
    width: 24px;
    height: 24px;
    min-height: 0;
    padding: 0;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: rgba(137, 183, 226, .18);
    color: #d7e7f5;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: background-color .16s ease, color .16s ease, transform .16s ease;
}
.chat-search-clear:hover {
    background: rgba(76, 199, 255, .3);
    color: #fff;
    transform: scale(1.06);
}
.chat-search-clear:active {
    transform: scale(.96);
}

/* Result cards: nothing like the plain conversation rows. */
#page-chat .chat-search-head {
    position: sticky;
    top: -8px;
    z-index: 2;
    margin: 0 6px 10px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border: 1px solid rgba(76, 199, 255, .18);
    border-radius: 12px;
    background: rgba(12, 24, 40, .92);
    backdrop-filter: blur(8px);
}
#page-chat .chat-search-count {
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(76, 199, 255, .14);
    color: #aee2ff;
    font-size: 11px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
#page-chat .chat-search-smart {
    min-height: 0;
    padding: 5px 12px;
    border: 1px solid rgba(137, 183, 226, .2);
    border-radius: 999px;
    background: transparent;
    color: #8fa6bd;
    font-size: 11px;
    cursor: pointer;
    transition: all .16s ease;
}
#page-chat .chat-search-smart:hover {
    border-color: rgba(76, 199, 255, .4);
    color: #d7f0ff;
}
#page-chat .chat-search-smart.is-on {
    border-color: rgba(76, 199, 255, .5);
    background: rgba(76, 199, 255, .14);
    color: #aee2ff;
}
#page-chat .chat-search-note {
    margin: 0 8px 10px;
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(240, 178, 111, .08);
    border: 1px solid rgba(240, 178, 111, .2);
    color: #e8c48a;
    font-size: 11px;
    line-height: 1.6;
}
#page-chat .conv-item.chat-search-result {
    margin: 0 6px 8px;
    padding: 12px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
    gap: 10px;
    border: 1px solid rgba(137, 183, 226, .14);
    border-inline-start: 3px solid rgba(76, 199, 255, .4);
    border-radius: 14px;
    background: rgba(16, 28, 46, .55);
    cursor: pointer;
    transition: border-color .16s ease, background-color .16s ease, transform .16s ease, box-shadow .16s ease;
}
#page-chat .conv-item.chat-search-result:hover {
    border-color: rgba(76, 199, 255, .35);
    background: rgba(20, 36, 58, .8);
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
}
#page-chat .conv-item.chat-search-result:focus-visible {
    outline: 2px solid rgba(76, 199, 255, .65);
    outline-offset: 2px;
    border-color: rgba(76, 199, 255, .5);
}
#page-chat .chat-search-result.is-user {
    border-inline-start-color: rgba(124, 140, 255, .55);
}
#page-chat .chat-search-result.is-title {
    border-inline-start-color: rgba(240, 178, 111, .55);
}
#page-chat .chat-search-kind {
    margin-top: 1px;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(76, 199, 255, .12);
    color: #8fd4ff;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
}
#page-chat .chat-search-result.is-user .chat-search-kind {
    background: rgba(124, 140, 255, .14);
    color: #b9c4ff;
}
#page-chat .chat-search-result.is-title .chat-search-kind {
    background: rgba(240, 178, 111, .12);
    color: #eec27f;
}
#page-chat .chat-search-result .conv-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
#page-chat .chat-search-result .conv-title {
    font-size: 12.5px;
    font-weight: 650;
}
#page-chat .chat-search-result .conv-snippet {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: #9db4c9;
    font-size: 11.5px;
    line-height: 1.65;
}
#page-chat .chat-search-result .conv-meta {
    font-size: 10px;
}
#page-chat .chat-search-result mark.chat-find-hit {
    padding: 0 2px;
    border-radius: 4px;
    background: rgba(76, 199, 255, .28);
    color: #eaf7ff;
}
#page-chat .chat-search-result mark.chat-find-hit.is-active {
    background: rgba(76, 199, 255, .5);
}
#page-chat .chat-search-jump {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(76, 199, 255, .1);
    color: #8fd4ff;
    opacity: 0;
    transform: translateX(4px);
    transition: opacity .16s ease, transform .16s ease, background-color .16s ease;
}
#page-chat .chat-search-jump svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    transform: scaleX(-1);
}
#page-chat .conv-item.chat-search-result:hover .chat-search-jump,
#page-chat .conv-item.chat-search-result:focus-visible .chat-search-jump {
    opacity: 1;
    transform: none;
}

html[data-theme="light"] #page-chat .chat-library-search {
    background: #fff;
    border-color: var(--chat-line);
}
html[data-theme="light"] .chat-search-clear {
    background: rgba(23, 26, 31, .07);
    color: var(--ink-2);
}
html[data-theme="light"] #page-chat .chat-search-head {
    background: rgba(255, 255, 255, .94);
    border-color: var(--chat-line);
}
html[data-theme="light"] #page-chat .chat-search-count {
    background: var(--accent-muted);
    color: var(--accent-hover);
}
html[data-theme="light"] #page-chat .conv-item.chat-search-result {
    background: #fff;
    border-color: var(--chat-line);
}
html[data-theme="light"] #page-chat .conv-item.chat-search-result:hover {
    background: var(--accent-muted);
}
html[data-theme="light"] #page-chat .chat-search-result .conv-snippet {
    color: var(--ink-2);
}
html[data-theme="light"] #page-chat .chat-search-result mark.chat-find-hit {
    background: rgba(88, 103, 216, .2);
    color: #2c3690;
}
html[data-theme="light"] #page-chat .chat-msg.is-user .chat-bubble {
    background: #dee3fa;
    border-color: rgba(88, 103, 216, .25);
    color: #12304d;
}
html[data-theme="light"] #page-chat .chat-msg.is-diane .chat-bubble {
    color: #24384d;
}

/* ============================================================
   Per-conversation menu + pins.
   - Each sidebar row gets a ⋯ button (hover/focus) with rename,
     pin/unpin, delete. Pinned chats group under a "נעוצות"
     header with an accent rail + pin mark so they read different.
   ============================================================ */

#page-chat .chat-library {
    position: relative;
}
#page-chat .conv-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 4px;
}
#page-chat .conv-item.is-pinned {
    grid-template-columns: auto minmax(0, 1fr) auto;
}
#page-chat .conv-info {
    min-width: 0;
}
#page-chat .conv-section-head {
    margin: 10px 12px 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #8fd4ff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .02em;
}
#page-chat .conv-section-head svg {
    width: 13px;
    height: 13px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
#page-chat .conv-item.is-pinned {
    border: 1px solid rgba(76, 199, 255, .28);
    border-inline-start: 3px solid rgba(76, 199, 255, .65);
    background: rgba(76, 199, 255, .07);
}
#page-chat .conv-item.is-pinned:hover {
    background: rgba(76, 199, 255, .12);
}
#page-chat .conv-item.is-pinned.active {
    background: rgba(76, 199, 255, .14);
}
#page-chat .conv-pin-mark {
    display: grid;
    place-items: center;
    color: #8fd4ff;
}
#page-chat .conv-pin-mark svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.conv-menu-btn {
    width: 28px;
    height: 28px;
    min-height: 0;
    padding: 0;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #7d93aa;
    cursor: pointer;
    opacity: 0;
    transition: opacity .15s ease, color .15s ease, background-color .15s ease;
}
#page-chat .conv-item:hover .conv-menu-btn,
#page-chat .conv-item:focus-within .conv-menu-btn,
.conv-menu-btn[aria-expanded="true"] {
    opacity: 1;
}
.conv-menu-btn:hover {
    background: rgba(137, 183, 226, .16);
    color: #d7e7f5;
}
.conv-menu-btn:focus-visible {
    opacity: 1;
    outline: 2px solid rgba(76, 199, 255, .6);
    outline-offset: 1px;
}
.conv-menu-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    stroke: none;
}
@media (hover: none) {
    .conv-menu-btn {
        opacity: 1;
    }
}
.conv-menu {
    position: absolute;
    z-index: 30;
    min-width: 172px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border: 1px solid rgba(137, 183, 226, .2);
    border-radius: 14px;
    background: rgba(12, 24, 40, .97);
    box-shadow: 0 18px 48px rgba(0, 0, 0, .5);
    animation: chat-soft-in .16s var(--ease) both;
}
.conv-menu-item {
    min-height: 36px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    gap: 9px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #d7e7f5;
    font-size: 12.5px;
    cursor: pointer;
    text-align: start;
    transition: background-color .14s ease;
}
.conv-menu-item:hover,
.conv-menu-item:focus-visible {
    background: rgba(76, 199, 255, .12);
    outline: none;
}
.conv-menu-item svg {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.conv-menu-item.is-delete {
    color: #f0a9a3;
}
.conv-menu-item.is-delete:hover,
.conv-menu-item.is-delete:focus-visible {
    background: rgba(240, 121, 111, .14);
}
.conv-title-rename-input {
    width: 100%;
    min-width: 0;
    min-height: 30px;
    padding: 3px 8px;
    border: 1px solid rgba(76, 199, 255, .45);
    border-radius: 8px;
    background: rgba(10, 20, 34, .95);
    color: #eef7ff;
    font-size: 13px;
}
.conv-title-rename-input:focus {
    outline: 2px solid rgba(76, 199, 255, .5);
    outline-offset: 1px;
}

html[data-theme="light"] #page-chat .conv-section-head {
    color: var(--accent-hover);
}
html[data-theme="light"] #page-chat .conv-item.is-pinned {
    background: var(--accent-muted);
    border-color: var(--accent);
}
html[data-theme="light"] #page-chat .conv-pin-mark {
    color: var(--accent-hover);
}
html[data-theme="light"] .conv-menu {
    background: #fff;
    border-color: var(--chat-line);
    box-shadow: var(--shadow-md);
}
html[data-theme="light"] .conv-menu-item {
    color: var(--ink);
}
html[data-theme="light"] .conv-menu-item:hover,
html[data-theme="light"] .conv-menu-item:focus-visible {
    background: var(--bg-hover);
}
html[data-theme="light"] .conv-menu-item.is-delete {
    color: #b3373f;
}
html[data-theme="light"] .conv-title-rename-input {
    background: #fff;
    border-color: var(--accent);
    color: var(--ink);
}

/* Rich conversational UI blocks (dashboard/ui-blocks.js). Shared primitives
   for every widget: card, button, input, badge, metric, progress. Semantic
   tokens only so dark/light follow the theme. Logical properties keep RTL
   correct; code stays LTR via dir attributes in the markup. */
.diane-ui-blocks { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; max-width: 100%; }
.diane-ui-card { padding: 10px 12px; border: 1px solid var(--border-default); border-radius: var(--r-2); background: var(--bg-surface); box-shadow: var(--shadow-sm); max-width: 100%; min-width: 0; }
.diane-ui-card-title { font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.diane-ui-muted { color: var(--text-secondary); font-size: 0.85em; line-height: 1.6; }
.diane-ui-text { margin: 0; line-height: 1.8; color: var(--text-primary); }
.diane-ui-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.diane-ui-btn { min-height: 40px; padding: 8px 16px; border: 1px solid var(--border-strong); border-radius: var(--r-pill); background: var(--bg-surface-elevated); color: var(--text-primary); font: inherit; font-size: 0.9em; cursor: pointer; text-decoration: none; display: inline-block; transition-property: background-color, border-color, transform; transition-duration: .2s; transition-timing-function: ease; }
.diane-ui-btn:hover { background: var(--bg-hover); }
.diane-ui-btn:active { transform: scale(0.96); }
.diane-ui-btn:disabled { opacity: 0.55; cursor: default; }
.diane-ui-btn.is-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.diane-ui-btn.is-danger { background: var(--error); border-color: var(--error); color: #fff; }
.diane-ui-btn.is-danger-ghost { border-color: var(--error); color: var(--error); background: transparent; }
.diane-ui-btn:focus-visible, .diane-ui-input:focus-visible, .diane-ui-option input:focus-visible, select.diane-ui-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.diane-ui-input { width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--border-default); border-radius: var(--radius-sm); background: var(--surface-input); color: var(--text-primary); font: inherit; }
.diane-ui-kind { font-size: 0.75em; padding: 1px 8px; border: 1px solid var(--border-default); border-radius: var(--r-pill); color: var(--text-secondary); font-family: var(--font-mono); }
.diane-ui-link { color: var(--accent); }
.diane-ui-options { display: flex; flex-wrap: wrap; gap: 8px; }
.diane-ui-option { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 12px; border: 1px solid var(--border-default); border-radius: var(--r-pill); cursor: pointer; color: var(--text-primary); }
.diane-ui-option input { width: 18px; height: 18px; accent-color: var(--accent); }
.diane-ui-confirm.is-destructive { border-color: var(--error); }
.diane-ui-code { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--code-bg); color: var(--code-ink); font-family: var(--font-mono); font-size: 0.82em; overflow-x: auto; white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow-y: auto; }
.diane-ui-code.is-stderr { color: var(--error); }
.diane-ui-cmd { color: var(--text-primary); }
.diane-ui-table-scroll { overflow-x: auto; }
.diane-ui-table { width: 100%; border-collapse: collapse; font-size: 0.88em; }
.diane-ui-table th, .diane-ui-table td { padding: 6px 10px; border-bottom: 1px solid var(--border-subtle); text-align: start; }
.diane-ui-table th { color: var(--text-secondary); font-weight: 600; }
.diane-ui-bar { height: 8px; border-radius: var(--r-pill); background: var(--gauge-track); overflow: hidden; margin-top: 8px; }
.diane-ui-bar-fill { height: 100%; background: var(--accent); border-radius: var(--r-pill); }
.diane-ui-state { font-size: 0.78em; padding: 2px 10px; border-radius: var(--r-pill); border: 1px solid var(--border-default); color: var(--text-secondary); white-space: nowrap; }
.diane-ui-state.is-ok { color: var(--success); border-color: var(--success); }
.diane-ui-state.is-bad { color: var(--error); border-color: var(--error); }
.diane-ui-state.is-warn { color: var(--warning); border-color: var(--warning); }
.diane-ui-state.is-loading { color: var(--info); border-color: var(--info); }
.diane-ui-state.is-muted, .diane-ui-state.is-idle { color: var(--text-muted); }
.diane-ui-stale { font-size: 0.75em; padding: 2px 10px; border-radius: var(--r-pill); border: 1px dashed var(--warning); color: var(--warning); white-space: nowrap; }
.diane-ui-exec-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.diane-ui-state-grid { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 8px 0 0; font-size: 0.88em; }
.diane-ui-state-grid dt { color: var(--text-secondary); }
.diane-ui-state-grid dd { margin: 0; color: var(--text-primary); }
.diane-ui-controls { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.diane-ui-slider-row { display: flex; align-items: center; gap: 10px; }
.diane-ui-slider-row input[type="range"] { flex: 1; accent-color: var(--accent); min-height: 40px; }
.diane-ui-switch { width: 40px; height: 24px; accent-color: var(--accent); }
.diane-ui-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.diane-ui-field-label { font-size: 0.85em; color: var(--text-secondary); }
.diane-ui-metric-value { font-size: 1.6em; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.diane-ui-metric-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.diane-ui-delta.is-up { color: var(--success); }
.diane-ui-delta.is-down { color: var(--error); }
.diane-ui-delta.is-flat { color: var(--text-muted); }
.diane-ui-details summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; color: var(--text-secondary); }
.diane-ui-timeline-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.diane-ui-timeline-item { padding-inline-start: 14px; border-inline-start: 2px solid var(--accent); }
.diane-ui-time { font-variant-numeric: tabular-nums; color: var(--text-secondary); font-size: 0.85em; }
.diane-ui-checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.diane-ui-note.is-info { border-inline-start: 3px solid var(--info); }
.diane-ui-note.is-success { border-inline-start: 3px solid var(--success); }
.diane-ui-note.is-warning { border-inline-start: 3px solid var(--warning); }
.diane-ui-note.is-error { border-inline-start: 3px solid var(--error); }
.diane-ui-svg { width: 100%; max-height: 200px; }
.diane-ui-svg-label { fill: var(--text-muted); font-size: 10px; }
.diane-ui-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; font-size: 0.8em; color: var(--text-secondary); }
.diane-ui-legend-chip { display: inline-flex; align-items: center; gap: 6px; }
.diane-ui-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.diane-ui-cover { width: 56px; height: 56px; border-radius: var(--radius-sm); object-fit: cover; }
.diane-ui-media { display: flex; gap: 12px; align-items: center; }
.diane-ui-media-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.diane-ui-map-point { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border-subtle); }
.diane-ui-event-when { color: var(--text-primary); font-weight: 600; margin-bottom: 4px; }
.diane-ui-search { display: flex; flex-direction: column; gap: 8px; }
.diane-ui-result-title { font-weight: 600; color: var(--text-primary); }
a.diane-ui-result-title { color: var(--accent); text-decoration: none; }
.diane-ui-spinner { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--accent); animation: diane-ui-spin 0.9s linear infinite; margin-top: 8px; }
@keyframes diane-ui-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .diane-ui-spinner { animation: none; } .diane-ui-btn:active { transform: none; } }
@media (max-width: 640px) { .diane-ui-card { padding: 8px 10px; } .diane-ui-metric-value { font-size: 1.35em; } }

/* Connected devices — the same roster in Settings and on the phone page. */
.device-roster-body { padding: 18px 22px 22px; display: grid; gap: 14px; }
.device-roster-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; overflow: hidden; border-radius: 14px; background: var(--line); }
.device-roster-metrics div { min-height: 72px; padding: 12px 16px 14px; background: var(--surface-1); }
.device-roster-metrics span { display: block; color: var(--ink-3); font-size: 11px; }
.device-roster-metrics strong { display: block; margin-top: 6px; color: var(--ink); font: 600 22px/1 var(--font-mono); font-variant-numeric: tabular-nums; }
.device-roster-list { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-input); }
.device-roster-row + .device-roster-row { border-top: 1px solid var(--line); }
.device-roster-main { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; }
.device-roster-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; background: var(--surface-3); color: var(--ink-3); }
.device-roster-mark[data-state="on"] { background: color-mix(in srgb, var(--diane) 16%, transparent); color: var(--diane); }
.device-roster-mark svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.device-roster-copy { min-width: 0; }
.device-roster-copy strong { display: block; overflow: hidden; color: var(--ink); font-size: 14px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.device-roster-copy strong span { color: var(--ink-3); font-weight: 500; }
.device-roster-copy small { display: block; margin-top: 3px; overflow: hidden; color: var(--ink-3); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.device-roster-actions { display: flex; align-items: center; gap: 6px; }
.device-roster-presence { min-height: 28px; padding: 0 10px; display: inline-flex; align-items: center; border-radius: 999px; background: var(--surface-3); color: var(--ink-3); font-size: 11px; font-weight: 600; }
.device-roster-presence[data-state="on"] { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.device-roster-actions button,
.device-roster-edit button { min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--ink); font: 600 12px/1 var(--font-ui); transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease; }
.device-roster-actions button:hover,
.device-roster-edit button:hover { background: var(--surface-3); transform: none; }
.device-roster-actions button:active,
.device-roster-edit button:active { transform: scale(0.96); }
.device-roster-actions button.is-danger { color: var(--danger, #f0796f); border-color: transparent; }
.device-roster-actions button.is-danger:hover { background: color-mix(in srgb, var(--danger, #f0796f) 12%, transparent); }
.device-roster-edit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px; align-items: end; padding: 0 14px 14px; padding-inline-start: 68px; }
.device-roster-edit label { display: grid; gap: 6px; color: var(--ink-3); font-size: 12px; font-weight: 500; }
.device-roster-edit-actions { display: flex; gap: 8px; }
.device-roster-edit button.is-primary { border: 0; color: #fff; background: linear-gradient(135deg, #289bd5, #5c6bd7); }
.device-roster-edit button.is-primary:hover { background: linear-gradient(135deg, #36a9e2, #6a79e4); }
.device-roster-empty { padding: 22px 16px; }
.device-roster-empty strong { display: block; color: var(--ink); font-size: 13px; }
.device-roster-empty span { display: block; margin-top: 4px; color: var(--ink-3); font-size: 12px; line-height: 1.5; }
#connected-devices-feedback { min-height: 18px; }
@media (max-width: 760px) {
    .device-roster-metrics { grid-template-columns: 1fr; }
    .device-roster-main { grid-template-columns: 42px minmax(0, 1fr); }
    .device-roster-actions { grid-column: 1 / -1; flex-wrap: wrap; }
    .device-roster-edit { grid-template-columns: 1fr; padding-inline-start: 14px; }
}
@media (prefers-reduced-motion: reduce) {
    .device-roster-actions button:active,
    .device-roster-edit button:active { transform: none; }
}
