/* ============================================================
   Alik v7 — visual redesign.
   Palette: violet primary (cognition / AI brain) + amber accent
   (warmth / personal). Animations are state-driven, not decorative
   — the logo's pulse speed reflects the model's warm/cold state,
   and streaming tokens get a brief glow as they arrive so the
   chat feels alive.
   ============================================================ */

:root {
    /* Brand */
    --brand: #a78bfa;
    --brand-deep: #7c3aed;
    --brand-deepest: #5b21b6;
    --brand-soft: rgba(167, 139, 250, 0.18);
    --brand-glow: rgba(167, 139, 250, 0.42);

    --accent: #fb923c;
    --accent-deep: #ea580c;
    --accent-soft: rgba(251, 146, 60, 0.18);

    /* Surface (4 levels of depth) */
    --bg: #0e0f1a;
    --bg-elevated: #161826;
    --panel: #1f2237;
    --panel-hover: #2a2d4a;
    --border: #2e3252;
    --border-strong: #4b4f7a;

    /* Text */
    --text: #ecedf6;
    --text-soft: #b8bcd0;
    --muted: #888aa3;

    /* Messaging */
    --user-bg: linear-gradient(135deg, #5b21b6 0%, #7c3aed 60%, #8b5cf6 100%);
    --user-text: #f5f3ff;
    --ai-bg: #1f2237;

    /* Semantic */
    --ok: #34d399;
    --warn: #fbbf24;
    --error: #f87171;
    --error-bg: rgba(248, 113, 113, 0.12);
    --core: #fb923c;
    --tool: #38bdf8;
    --tool-bg: rgba(56, 189, 248, 0.12);

    /* Effects */
    --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.32);
    --shadow-elevated: 0 8px 32px rgba(0, 0, 0, 0.45);
    --shadow-brand: 0 0 24px var(--brand-glow);
    --radius: 12px;
    --radius-lg: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body, #root { height: 100%; width: 100%; }

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    touch-action: manipulation;
}

body {
    background:
        radial-gradient(ellipse 80% 50% at 50% 0%, rgba(124, 58, 237, 0.08), transparent 70%),
        var(--bg);
    color: var(--text);
    font-family: "Heebo", -apple-system, "Segoe UI", "Arial Hebrew", "Rubik", sans-serif;
    font-size: 16px;
    overflow: hidden;
    overscroll-behavior: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    line-height: 1.5;
}

#root { display: flex; flex-direction: column; }

/* ===== Header + Brand ===== */
header {
    background: linear-gradient(180deg, var(--bg-elevated) 0%, rgba(22, 24, 38, 0.85) 100%);
    border-bottom: 1px solid var(--border);
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    backdrop-filter: blur(8px);
    position: relative;
    z-index: 5;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    transition: transform 0.15s ease;
}
.brand:active { transform: scale(0.97); }

.brand-mark {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 8px rgba(124, 58, 237, 0.35));
}

.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name {
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, #ddd6fe 0%, #a78bfa 60%, #fb923c 130%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.2px;
}
.brand-tagline {
    font-size: 11px;
    color: var(--muted);
    font-weight: 500;
    margin-top: 1px;
}

/* ===== Logo animations =====
   The logo is a passive state indicator: pulse speed maps to model
   readiness so glance-readability matches the status dot. */
.brand-glyph { transform-origin: center; animation: brand-breath 4s ease-in-out infinite; }
@keyframes brand-breath {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(1.045); opacity: 0.92; }
}

.wave-line { animation: wave-slide 9s linear infinite; }
.wave-b    { animation-duration: 13s; animation-direction: reverse; }
.wave-c    { animation-duration: 17s; }
@keyframes wave-slide {
    from { transform: translateX(0);    }
    to   { transform: translateX(-40px); }
}

/* Pulse circles. Default = "warm" tempo (slow, calm).
   Cold mode (`brand-mark.cold`) speeds them up + intensifies stroke
   to communicate "model loading". Error is muted/red. */
.brand-pulse {
    stroke: var(--brand);
    transform-origin: center;
    transform-box: fill-box;
    opacity: 0;
    animation: pulse-out 3.6s ease-out infinite;
}
.brand-pulse-2 { animation-delay: 1.2s; }
.brand-pulse-3 { animation-delay: 2.4s; }

@keyframes pulse-out {
    0%   { transform: scale(1);    opacity: 0;   stroke-width: 1.5; }
    25%  { opacity: 0.45; }
    100% { transform: scale(1.45); opacity: 0;   stroke-width: 0.4; }
}

.brand-mark.cold .brand-pulse {
    stroke: var(--accent);
    animation-duration: 1.8s;
}
.brand-mark.err .brand-pulse {
    stroke: var(--error);
    animation-duration: 2.2s;
    opacity: 0.6;
}

/* ===== Status block (right side of header) ===== */
.status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--text-soft);
}

.dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--warn);
    transition: background 0.25s, box-shadow 0.25s;
    flex-shrink: 0;
    cursor: pointer;
}
.dot:hover { transform: scale(1.2); }

.dot.ok {
    background: var(--ok);
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18), 0 0 12px rgba(52, 211, 153, 0.28);
}
.dot.err {
    background: var(--error);
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.18);
}
.dot.warming {
    background: var(--warn);
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.22);
    animation: dot-pulse 1.4s ease-in-out infinite;
}
@keyframes dot-pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.18); }
    50%      { box-shadow: 0 0 0 8px rgba(251, 191, 36, 0.10); }
}

.mem-count {
    background: var(--brand-soft);
    border: 1px solid rgba(167, 139, 250, 0.3);
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    color: var(--brand);
    white-space: nowrap;
    font-weight: 500;
}

#model-select {
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 5px 10px;
    border-radius: var(--radius);
    font-size: 12px;
    max-width: 160px;
    font-family: inherit;
}

/* ===== Engine bar ===== */
.engine-bar {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 6px 14px;
    font-size: 12px;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.3s, color 0.3s;
}
.engine-bar.tool-active {
    background: var(--tool-bg);
    color: var(--tool);
    border-bottom-color: rgba(56, 189, 248, 0.3);
}
.engine-bar.claude-active {
    background: var(--accent-soft);
    color: var(--accent);
    border-bottom-color: rgba(251, 146, 60, 0.3);
}
.engine-icon { display: inline-flex; align-items: center; }
.engine-text { font-weight: 500; }

/* ===== Tabs ===== */
#tabs {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    align-items: center;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
#tabs::-webkit-scrollbar { display: none; }
#tabs .tab { flex-shrink: 0; }

.tab {
    background: transparent;
    color: var(--muted);
    border: 1px solid transparent;
    padding: 7px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.tab:hover { color: var(--text); background: var(--panel); }
.tab.active {
    background: var(--brand-soft);
    color: var(--brand);
    border-color: rgba(167, 139, 250, 0.45);
}

.tab-action {
    margin-inline-start: auto;
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
    padding: 5px 12px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.tab-action:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
}

.tab-pane { display: none; flex: 1; flex-direction: column; overflow: hidden; }
.tab-pane.active { display: flex; }

/* ===== Messages ===== */
main#messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg);
}
main::-webkit-scrollbar, .scrollable::-webkit-scrollbar { width: 6px; }
main::-webkit-scrollbar-thumb, .scrollable::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}
main::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

.msg {
    max-width: 86%;
    padding: 11px 15px;
    border-radius: var(--radius-lg);
    line-height: 1.55;
    word-wrap: break-word;
    white-space: pre-wrap;
    box-shadow: var(--shadow-card);
    animation: msg-slide-in 0.32s cubic-bezier(.22,1,.36,1);
}
@keyframes msg-slide-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0);   }
}

.msg.user {
    align-self: flex-end;
    background: var(--user-bg);
    color: var(--user-text);
    border-bottom-left-radius: 4px;
    font-weight: 500;
}

.msg.ai {
    align-self: flex-start;
    background: var(--ai-bg);
    border: 1px solid var(--border);
    border-bottom-right-radius: 4px;
}

.msg.error {
    align-self: stretch;
    background: var(--error-bg);
    border: 1px solid var(--error);
    color: #ffd7d7;
    font-size: 13px;
    text-align: center;
}

.msg.system {
    align-self: stretch;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
    padding: 4px;
    box-shadow: none;
}

/* Streaming token glow: each token pops in with a short violet-amber
   highlight, then settles to the base text color. Adds visible "pulse
   of life" to slow CPU generation without being distracting. */
.tok {
    display: inline;
    transition: color 0.6s ease, text-shadow 0.6s ease;
}
.tok-fresh {
    color: #fde7b8;
    text-shadow: 0 0 6px rgba(251, 146, 60, 0.55), 0 0 12px rgba(167, 139, 250, 0.3);
    animation: tok-fade 0.7s ease-out forwards;
}
@keyframes tok-fade {
    0%   { color: #fde7b8; }
    100% { color: inherit; text-shadow: none; }
}

.msg-stats {
    display: block;
    margin-top: 8px;
    font-size: 11px;
    color: var(--muted);
    opacity: 0.75;
    border-top: 1px dashed var(--border);
    padding-top: 6px;
}

/* ===== Empty state (no messages yet) ===== */
.empty-state {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 36px 16px 12px;
    text-align: center;
    animation: msg-slide-in 0.4s ease-out;
}
.empty-headline {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}
.empty-sub {
    font-size: 13px;
    color: var(--muted);
    max-width: 320px;
    line-height: 1.6;
}
.empty-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 4px;
    max-width: 380px;
}
.empty-chip {
    background: var(--panel);
    border: 1px solid var(--border);
    color: var(--text-soft);
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
}
.empty-chip:hover {
    border-color: var(--brand);
    color: var(--brand);
    background: var(--brand-soft);
    transform: translateY(-1px);
}
.empty-chip .ic { color: var(--brand); }

/* ===== Tool events ===== */
.tool-event {
    align-self: stretch;
    background: var(--tool-bg);
    border: 1px solid rgba(56, 189, 248, 0.32);
    border-radius: 12px;
    padding: 9px 13px;
    font-size: 13px;
    color: var(--tool);
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: none;
    animation: msg-slide-in 0.3s ease-out;
}
.tool-event-head { display: flex; align-items: center; gap: 8px; }
.tool-event-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid var(--tool);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.tool-event.done .tool-event-spinner { display: none; }
.tool-event.done::before { content: "✓ "; color: var(--ok); }
.tool-event-name { font-weight: 600; }
.tool-event-args { font-size: 11px; color: rgba(56, 189, 248, 0.75); }
.tool-event-result {
    background: var(--bg-elevated);
    color: var(--text-soft);
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    margin-top: 4px;
}

/* ===== Thinking card =====
   Layout simplified: no overflow:hidden + pseudo-element shimmer (it was
   masking the spinner on some renderers). Bigger spinner so the user can
   actually see the activity even on a small screen. */
.thinking-card {
    align-self: stretch;
    background: var(--bg-elevated);
    border: 1px solid var(--brand-soft);
    border-radius: 14px;
    padding: 14px 16px;
    font-size: 13px;
    color: var(--text-soft);
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: msg-slide-in 0.3s ease-out;
    box-shadow: 0 2px 12px rgba(124, 58, 237, 0.12);
}
.thinking-head {
    display: flex;
    align-items: center;
    gap: 12px;
}
.thinking-spinner {
    display: inline-block;
    width: 22px;
    height: 22px;
    border: 2.5px solid var(--brand);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}
/* min-width:0 + word-break required so a long label can wrap inside a
   flex row instead of forcing the card to overflow horizontally. */
.thinking-label {
    flex: 1 1 auto;
    min-width: 0;
    font-weight: 500;
    word-break: break-word;
    overflow-wrap: anywhere;
}
.thinking-time {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    font-size: 11px;
    flex-shrink: 0;
}
.thinking-detail {
    font-size: 11px;
    color: var(--muted);
    position: relative;
    z-index: 1;
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* ===== Composer ===== */
#composer {
    display: flex;
    gap: 8px;
    padding: 10px 12px 12px;
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
    align-items: end;
}

#input {
    flex: 1 1 auto;
    min-width: 0;
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 10px 14px;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    min-height: 42px;
    max-height: 160px;
    line-height: 1.4;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    /* Force RTL inside the textarea so Hebrew flows naturally and the
       cursor doesn't jump to the wrong edge while typing. */
    direction: rtl;
    text-align: right;
    word-break: break-word;
    overflow-wrap: anywhere;
    overflow-y: auto;
}
#input::placeholder { color: var(--muted); }
#input:focus {
    outline: none;
    border-color: var(--brand);
    background: var(--panel-hover);
    box-shadow: 0 0 0 3px var(--brand-soft);
}

#send-btn {
    background: linear-gradient(135deg, var(--brand-deep) 0%, var(--brand) 100%);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    font-family: inherit;
    cursor: pointer;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
}
#send-btn:hover:not(:disabled) {
    transform: translateY(-1px) scale(1.05);
    box-shadow: 0 6px 18px rgba(124, 58, 237, 0.55);
}
#send-btn:active:not(:disabled) { transform: scale(0.95); }
#send-btn:disabled { opacity: 0.4; cursor: not-allowed; }
#send-btn .ic {
    width: 20px;
    height: 20px;
    /* No mirror. Universal messenger convention (WhatsApp/Telegram/iMessage)
       keeps the paper-plane pointing top-right regardless of UI direction —
       it reads as "sending into the air" rather than "sending in the
       reading direction". rotate / scaleX both made it look skewed. */
}

/* ===== Memory tab ===== */
.memory-toolbar {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    align-items: center;
}

.memory-toolbar button.primary {
    background: linear-gradient(135deg, var(--brand-deep) 0%, var(--brand) 100%);
    color: #fff;
    border: none;
    padding: 8px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
    transition: transform 0.12s, box-shadow 0.12s;
}
.memory-toolbar button.primary:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(124, 58, 237, 0.45); }

.search-wrap {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}
.search-wrap .search-ic {
    position: absolute;
    inset-inline-end: 12px;
    color: var(--muted);
    pointer-events: none;
}
#mem-search {
    flex: 1;
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 8px 14px;
    padding-inline-end: 36px;
    border-radius: 10px;
    font-size: 13px;
    font-family: inherit;
}
#mem-search:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft);
}

#memory-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mem-item {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.mem-item:hover { border-color: var(--brand); background: var(--panel-hover); transform: translateX(-2px); }
.mem-item.is-core { border-inline-start: 3px solid var(--accent); }
.mem-item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}
.mem-item-name { font-weight: 600; color: var(--text); font-size: 14px; }
.mem-item-type {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--brand);
    background: var(--brand-soft);
    padding: 2px 8px;
    border-radius: 999px;
}
.mem-item-desc { font-size: 12px; color: var(--text-soft); line-height: 1.5; }

/* ===== Overlay (memory editor) ===== */
.overlay {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 16px;
    animation: fade-in 0.18s ease-out;
}
.overlay.hidden { display: none; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.overlay-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-elevated);
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: card-up 0.22s cubic-bezier(.22,1,.36,1);
}
@keyframes card-up {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.overlay-card h3 { font-size: 16px; font-weight: 600; }
.overlay-card label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--text-soft); }
.overlay-card input[type=text],
.overlay-card input[type=search],
.overlay-card select,
.overlay-card textarea {
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 13px;
    font-family: inherit;
}
.overlay-card textarea { resize: vertical; min-height: 100px; }
.overlay-card input:focus, .overlay-card select:focus, .overlay-card textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft);
}
.overlay-card .checkbox-row {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}
.overlay-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}
.overlay-actions button {
    background: var(--brand-deep);
    color: #fff;
    border: none;
    padding: 9px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    transition: background 0.12s, transform 0.12s;
}
.overlay-actions button:hover { background: var(--brand); transform: translateY(-1px); }
.overlay-actions .secondary { background: var(--panel); color: var(--text-soft); }
.overlay-actions .secondary:hover { background: var(--panel-hover); }
.overlay-actions .danger { background: var(--error); }
.overlay-actions .danger:hover { background: #ef4444; }
.hidden { display: none !important; }

/* ===== Status panel ===== */
.status-panel {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 40;
    pointer-events: none;
    display: flex;
    justify-content: center;
    padding: 12px;
}
.status-panel:not(.hidden) { pointer-events: auto; }
.status-panel-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    max-width: 420px;
    width: 100%;
    box-shadow: var(--shadow-elevated);
    transform: translateY(-12px);
    opacity: 0;
    transition: transform 0.22s cubic-bezier(.22,1,.36,1), opacity 0.22s;
    margin-top: 64px;
}
.status-panel:not(.hidden) .status-panel-card {
    transform: translateY(0);
    opacity: 1;
}
.status-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.status-panel-head h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--brand);
}
.status-close {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 30px; height: 30px;
    cursor: pointer;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.12s;
}
.status-close:hover { color: var(--error); border-color: var(--error); }
.status-grid {
    display: grid;
    grid-template-columns: minmax(110px, 1fr) 2fr;
    gap: 6px 14px;
    font-size: 12.5px;
}
.status-grid dt { color: var(--muted); }
.status-grid dd { color: var(--text); font-variant-numeric: tabular-nums; }
.status-panel-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.status-panel-actions .primary {
    background: linear-gradient(135deg, var(--accent-deep) 0%, var(--accent) 100%);
    color: #fff;
    border: none;
    padding: 8px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(251, 146, 60, 0.32);
    transition: transform 0.12s;
}
.status-panel-actions .primary:hover { transform: translateY(-1px); }
.status-panel-actions .secondary {
    background: var(--panel);
    color: var(--text-soft);
    border: 1px solid var(--border);
    padding: 8px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.status-panel-actions .secondary:hover {
    color: var(--brand);
    border-color: var(--brand);
}

/* ===== Generic icon ===== */
.ic {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}
.ic-sm { width: 14px; height: 14px; }

/* ===== Toast ===== */
#toast-host {
    position: fixed;
    top: 16px;
    inset-inline-start: 50%;
    transform: translateX(-50%);
    z-index: 60;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.toast {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 13px;
    box-shadow: var(--shadow-elevated);
    pointer-events: auto;
    animation: toast-in 0.2s ease-out;
}
.toast.ok { border-color: var(--ok); }
.toast.err { border-color: var(--error); }
@keyframes toast-in {
    from { transform: translateY(-20px); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}

/* ===== Mobile / safe areas ===== */
@supports (padding: env(safe-area-inset-bottom)) {
    #composer { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
}
