/* ================================================================
   Wolf You Feed — Mobile-First Responsive Styles
   ================================================================
   Custom properties for theming (light / dark / tactical).
   CSS Grid layout. No frameworks, no utilities.

/* ── Screen-reader only (a11y) ─────────────────────────────────── */
.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;
}
   Mobile-first: base styles are for narrow viewports.
   Desktop overrides via media query at 768px.

   Color philosophy: trust, warmth, groundedness, quiet authority.
   Typography: Inter (headings + body), JetBrains Mono (data).
   ================================================================ */

/* ----------------------------------------------------------------
   Custom Properties (Light theme)
   ---------------------------------------------------------------- */
:root {
    --color-bg: #f8f6f3;
    --color-surface: #efecea;
    --color-surface-raised: #e2dfdc;
    --color-text: #1a1a1a;
    --color-text-muted: #6b6b6b;
    --color-border: #d6d3d0;
    --color-primary: #1e3a5f;
    --color-primary-hover: #2a4f7a;
    --color-primary-text: #ffffff;
    --color-accent: #c9a227;
    --color-user-msg: #1e3a5f;
    --color-user-msg-text: #ffffff;
    --color-bot-msg: #efecea;
    --color-bot-msg-text: #1a1a1a;
    --color-system-msg: transparent;
    --color-system-msg-text: #6b6b6b;
    --color-domain-health: #0077b6;
    --color-domain-money: #85bb65;
    --color-domain-relationships: #a8a9ad;
    --color-sidebar-bg: #f0eeeb;
    --color-input-bg: #ffffff;
    --color-input-border: #c8c5c2;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.08);
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: "JetBrains Mono", "SF Mono", "Fira Code", monospace;
    --footer-height: 60px;
    --header-height: 56px;
    --input-height: 64px;
}

/* ----------------------------------------------------------------
   Dark theme (default for first-time visitors)
   ---------------------------------------------------------------- */
.dark {
    --color-bg: #121820;
    --color-surface: #1a2332;
    --color-surface-raised: #243044;
    --color-text: #e8e6e1;
    --color-text-muted: #8a9bb0;
    --color-border: #2a3648;
    --color-primary: #3a7bd5;
    --color-primary-hover: #5a9be6;
    --color-accent: #c9a227;
    --color-user-msg: #1e3a5f;
    --color-user-msg-text: #e8e6e1;
    --color-bot-msg: #1a2332;
    --color-bot-msg-text: #e8e6e1;
    --color-system-msg-text: #8a9bb0;
    --color-sidebar-bg: #141c28;
    --color-input-bg: #1a2332;
    --color-input-border: #2a3648;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
}

/* ----------------------------------------------------------------
   Tactical theme (military / first-responder mode)
   ---------------------------------------------------------------- */
.tactical {
    --color-bg: #0c1a0c;
    --color-surface: #1a2a1a;
    --color-surface-raised: #243824;
    --color-text: #b8d4a8;
    --color-text-muted: #7a9a6a;
    --color-border: #2d3d2d;
    --color-primary: #c9a227;
    --color-primary-hover: #e0b830;
    --color-primary-text: #0c1a0c;
    --color-accent: #c9a227;
    --color-user-msg: #2d4a2d;
    --color-user-msg-text: #b8d4a8;
    --color-bot-msg: #1a2a1a;
    --color-bot-msg-text: #b8d4a8;
    --color-system-msg-text: #7a9a6a;
    --color-domain-health: #4db8db;
    --color-domain-money: #a4d474;
    --color-domain-relationships: #c0c0c0;
    --color-sidebar-bg: #0e1e0e;
    --color-input-bg: #1a2a1a;
    --color-input-border: #2d3d2d;
    --shadow-sm: none;
    --shadow-md: none;
    --radius-sm: 0;
    --radius-md: 0;
    --radius-lg: 0;
    --font-sans: "Share Tech Mono", "JetBrains Mono", monospace;
    --font-mono: "Share Tech Mono", "JetBrains Mono", monospace;
}

/* ----------------------------------------------------------------
   Reset + Base
   ---------------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
    -webkit-text-size-adjust: 100%;
}

body {
    height: 100%;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.5;
    color: var(--color-text);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

input {
    font-family: inherit;
    font-size: inherit;
}

/* ----------------------------------------------------------------
   App Layout
   Mobile: header | content | footer-nav (single column)
   Desktop: header spanning 3 cols, then sidebar | chat | ledger
   ---------------------------------------------------------------- */
.app {
    display: grid;
    grid-template-rows: var(--header-height) 1fr var(--footer-height);
    grid-template-columns: 1fr;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* ================================================================
   Lucide icon base
   Lucide replaces <i data-lucide="…"> with an inline <svg>.
   The class is preserved on the generated SVG so these rules apply.
   ================================================================ */
.lc,
svg.lc {
    display: inline-block;
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    vertical-align: -0.15em;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}
.lc-sm { width: 14px; height: 14px; }
.lc-lg { width: 20px; height: 20px; }
.lc-xl { width: 22px; height: 22px; }

/* Heavier stroke for nav-pill icons — reads as "solid" without fill */
.lc-solid       { stroke-width: 2.25; }

/* Truly filled silhouette — works for icons whose paths form closed shapes
   (shield, moon, bookmark …).  CSS overrides SVG presentation attributes. */
.lc-solid-fill  { fill: currentColor; stroke: none; }

/* Domain icon colour overrides */
.history-card__domain-icon--health        { stroke: var(--color-domain-health); }
.history-card__domain-icon--money         { stroke: var(--color-domain-money); }
.history-card__domain-icon--relationships { stroke: var(--color-domain-relationships); }

/* ── Full-width app header ─────────────────────────────────────── */
.app-header {
    grid-column: 1 / -1;
    grid-row: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    z-index: 10;
}

.app-header__brand {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--color-text);
}

.app-header__greeting {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-muted);
    letter-spacing: -0.01em;
}

.app-header__greeting--tactical {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 13px;
    color: var(--color-primary);
}

.app-header__actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

/* ----------------------------------------------------------------
   Sidebar (hidden on mobile, slide-in overlay)
   ---------------------------------------------------------------- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 85%;
    max-width: 320px;
    height: 100%;
    background: var(--color-sidebar-bg);
    border-right: 1px solid var(--color-border);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar--open {
    transform: translateX(0);
}

.sidebar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--color-border);
}

.sidebar__title {
    font-size: 18px;
    font-weight: 600;
}

.sidebar__close {
    font-size: 24px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.sidebar__close:hover {
    background: var(--color-surface-raised);
}

.sidebar__content {
    padding: 16px;
    flex: 1;
}

/* ----------------------------------------------------------------
   Chat Area  (the header row is now in .app-header, not here)
   ---------------------------------------------------------------- */
.chat {
    display: grid;
    grid-template-rows: 1fr auto;   /* messages | input */
    overflow: hidden;
    min-height: 0;
    min-width: 0;
    grid-row: 2;
}

.chat__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
}

/* Shared pill base for all header action buttons */
.chat__menu-btn,
.chat__theme-btn,
.chat__mode-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;               /* icon ↔ label breathing room */
    padding: 4px 12px;
    height: 30px;
    border-radius: 20px;
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    background: transparent;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.chat__menu-btn:hover,
.chat__theme-btn:hover,
.chat__mode-btn:hover {
    background: var(--color-surface-raised);
    color: var(--color-text);
}

.chat__theme-label,
.chat__mode-btn span {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

/* Tactical mode pill is highlighted */
.chat__mode-btn--tactical {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}
.chat__mode-btn--tactical:hover {
    background: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
    color: #fff;
}

/* Icon-only settings button */
.chat__icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.chat__icon-btn:hover {
    background: var(--color-surface-raised);
    color: var(--color-text);
}

.chat__title {
    flex: 1;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.chat__header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

/* ----------------------------------------------------------------
   Messages
   ---------------------------------------------------------------- */
.chat__messages {
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    /* scroll-behavior: smooth removed — JS handles scroll-to-top on done
       event with explicit auto-behavior to avoid async animation conflicts */
}

.message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    word-wrap: break-word;
    /* pre-wrap removed: it causes leading/trailing newlines from the model
       to render as blank space. Markdown content handles its own whitespace. */
    white-space: normal;
    line-height: 1.55;
    font-size: 15px;
}

.message--user {
    align-self: flex-end;
    background: var(--color-user-msg);
    color: var(--color-user-msg-text);
    border-bottom-right-radius: var(--radius-sm);
    /* User messages are short — keep the bubble narrow */
    max-width: 75%;
}

.message--bot {
    align-self: flex-start;
    background: var(--color-bot-msg);
    color: var(--color-bot-msg-text);
    border-bottom-left-radius: var(--radius-sm);
    /* Bot responses are decision panels, not chat bubbles — use full width */
    max-width: 100%;
    width: 100%;
}

.message--system {
    align-self: center;
    text-align: center;
    color: var(--color-system-msg-text);
    font-size: 14px;
    max-width: 100%;
    padding: 8px;
}

.message__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    gap: 8px;
}

.message__meta {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

.message__domain,
.message__type {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--color-surface-raised);
}

.message__timer {
    margin-left: auto;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    color: var(--color-text-muted);
}

/* ----------------------------------------------------------------
   Chat Input
   ---------------------------------------------------------------- */
.chat__input-form {
    padding: 8px 12px max(20px, env(safe-area-inset-bottom, 20px));
    border-top: 1px solid var(--color-border);
    background: var(--color-bg);
    min-width: 0;
    overflow: hidden;
    box-sizing: border-box;
}

.chat__input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--color-input-bg);
    border: 1px solid var(--color-input-border);
    border-radius: var(--radius-lg);
    padding: 4px 4px 4px 16px;
    min-width: 0;
    box-sizing: border-box;
}

.chat__input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    color: var(--color-text);
    padding: 8px 0;
    min-width: 0;
    width: 0;
}

.chat__input::placeholder {
    color: var(--color-text-muted);
}

.chat__send-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--color-primary);
    color: var(--color-primary-text);
    flex-shrink: 0;
    transition: background 0.15s ease;
}

.chat__send-btn:hover {
    background: var(--color-primary-hover);
}

/* ----------------------------------------------------------------
   HTMX Loading Indicator
   ---------------------------------------------------------------- */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: flex;
}

.htmx-request .chat__send-icon {
    display: none;
}

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

.spinner {
    animation: spin 0.8s linear infinite;
}

/* ----------------------------------------------------------------
   Thinking placeholder (during inference)
   ---------------------------------------------------------------- */
.message--thinking {
    opacity: 0.9;
}

/* Streaming bot message — shown while token events are arriving */
.message--streaming {
    opacity: 1;
}

.message--streaming .streaming-text {
    white-space: normal;
    word-break: break-word;
    font-size: 15px;
    line-height: 1.6;
    color: var(--color-text);
}

/* Blinking cursor appended to the streaming container */
.streaming-cursor {
    display: inline-block;
    width: 2px;
    height: 1.1em;
    background: var(--color-primary);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: blink-cursor 0.75s step-end infinite;
}

@keyframes blink-cursor {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}

.message__content--thinking {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px;
}

.thinking-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.thinking-spinner {
    display: inline-flex;
    flex-shrink: 0;
}

.thinking-spinner svg {
    animation: spin 1.2s linear infinite;
}

.thinking-stage {
    flex: 1;
    color: var(--color-text-muted);
    font-size: 13px;
}

.thinking-timer {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
    font-size: 13px;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.thinking-progress {
    height: 3px;
    background: var(--color-border, rgba(255,255,255,0.1));
    border-radius: 2px;
    overflow: hidden;
}

.thinking-progress-bar {
    height: 100%;
    background: var(--color-accent, #4f8ef7);
    border-radius: 2px;
    transition: width 0.4s ease;
    width: 5%;
}

.thinking-joke {
    font-size: 12px;
    color: var(--color-text-muted);
    font-style: italic;
    min-height: 1.4em;
    opacity: 1;
    transition: opacity 0.5s ease;
}

/* ----------------------------------------------------------------
   Footer Nav (mobile only)
   ---------------------------------------------------------------- */
.footer-nav {
    display: flex;
    align-items: center;
    justify-content: space-around;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: 4px 0;
    padding-bottom: env(safe-area-inset-bottom, 4px);
}

.footer-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 16px;
    font-size: 11px;
    color: var(--color-text-muted);
    border-radius: var(--radius-sm);
    transition: color 0.15s ease;
}

.footer-nav__item:hover,
.footer-nav__item--active {
    color: var(--color-primary);
}

/* ----------------------------------------------------------------
   Commitments (sidebar content, loaded via HTMX)
   ---------------------------------------------------------------- */
.commitments-empty {
    text-align: center;
    color: var(--color-text-muted);
    padding: 24px 0;
    font-size: 14px;
}

.commitment-card {
    padding: 12px;
    margin-bottom: 8px;
    background: var(--color-surface);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--color-border);
}

.commitment-card--health {
    border-left-color: var(--color-domain-health);
}

.commitment-card--money {
    border-left-color: var(--color-domain-money);
}

.commitment-card--relationships {
    border-left-color: var(--color-domain-relationships);
}

.commitment-card__title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.commitment-card__meta {
    font-size: 12px;
    color: var(--color-text-muted);
}

.commitment-card__progress {
    margin-top: 8px;
}

.commitment-card__progress-label {
    display: block;
    font-size: 11px;
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

.commitment-card__bar {
    height: 4px;
    background: var(--color-surface-raised);
    border-radius: 2px;
    overflow: hidden;
}

.commitment-card__bar-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* ----------------------------------------------------------------
   Proposed Commitments (ratification cards in chat)
   ---------------------------------------------------------------- */
.proposed-commitments {
    align-self: stretch;   /* full width, aligned with bot message */
    max-width: 100%;
    padding: 0;
    border-top: 1px solid var(--color-border);
    margin-top: 4px;
    padding-top: 12px;
}

.proposed-commitments__header {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: 8px;
}

.proposed-card {
    padding: 12px 14px;
    margin-bottom: 8px;
    background: var(--color-surface);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--color-border);
}

.proposed-card--health {
    border-left-color: var(--color-domain-health);
}

.proposed-card--money {
    border-left-color: var(--color-domain-money);
}

.proposed-card--relationships {
    border-left-color: var(--color-domain-relationships);
}

.proposed-card--accepted {
    border-left-color: var(--color-domain-health);
    opacity: 0.7;
}

.proposed-card__title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.proposed-card__meta {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

.proposed-card__desc {
    font-size: 13px;
    color: var(--color-text-muted);
    margin-bottom: 8px;
    line-height: 1.4;
}

.proposed-card__actions {
    display: flex;
    gap: 8px;
}

.proposed-card__btn {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 14px;
    border-radius: 4px;
    border: 1px solid var(--color-border);
    transition: all 0.15s ease;
}

.proposed-card__btn--accept {
    background: var(--color-primary);
    color: var(--color-primary-text);
    border-color: var(--color-primary);
}

.proposed-card__btn--accept:hover {
    background: var(--color-primary-hover);
}

.proposed-card__btn--dismiss {
    background: transparent;
    color: var(--color-text-muted);
}

.proposed-card__btn--dismiss:hover {
    color: var(--color-text);
}

/* ----------------------------------------------------------------
   Desktop / large landscape tablet (>= 1024px)
   Side panels only appear at this breakpoint and above.
   Phones and portrait tablets get mobile footer nav + slide-in panels.
   ---------------------------------------------------------------- */
@media (min-width: 1024px) {
    .app {
        grid-template-rows: var(--header-height) 1fr;
        grid-template-columns: 280px 1fr 260px;
    }

    .app-header { grid-column: 1 / -1; grid-row: 1; }

    .footer-nav { display: none; }

    .sidebar {
        grid-column: 1;
        grid-row: 2;
        position: static;
        transform: none;
        width: 100%;
        max-width: none;
        border-right: 1px solid var(--color-border);
    }

    .chat   { grid-column: 2; grid-row: 2; }

    .ledger {
        grid-column: 3;
        grid-row: 2;
        position: static;
        transform: none;
        width: 100%;
        max-width: none;
    }

    .sidebar__close { display: none; }
    .ledger__close  { display: none; }
    .chat__menu-btn { display: none; }

    .message--user { max-width: 65%; }
    .message--bot  { max-width: 100%; width: 100%; }
}

/* ----------------------------------------------------------------
   Large desktop (>= 1200px)
   ---------------------------------------------------------------- */
@media (min-width: 1200px) {
    .app {
        grid-template-rows: var(--header-height) 1fr;
        grid-template-columns: 340px 1fr 300px;
    }

    .message--user { max-width: 55%; }
    .message--bot  { max-width: 100%; width: 100%; font-size: 16px; }
}

/* ================================================================
   Landing state  (no messages yet — centered form like competitors)
   ================================================================ */

/* The chat area switches between two layouts controlled by Alpine. */
.chat--landing {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
}

/* In landing mode the messages area is hidden entirely */
.chat--landing .chat__messages { display: none; }

/* (header is now .app-header, not inside .chat) */
.chat--landing .chat__header-legacy {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: transparent;
    border-bottom-color: transparent;
    z-index: 5;
}

/* Hero text (brand + tagline) — visible in landing state */
.chat__landing-hero {
    display: none;           /* hidden by Alpine x-show, but also hidden via CSS */
    text-align: center;
    margin-bottom: 28px;
}

.chat--landing .chat__landing-hero { display: block; }

.chat__landing-logo {
    width: 120px;
    height: auto;
    display: block;
    margin: 0 auto 16px;
}

.chat__landing-logo--tactical { display: none; }
.tactical .chat__landing-logo--default { display: none; }
.tactical .chat__landing-logo--tactical { display: block; margin: 0 auto 16px; }

.chat__landing-brand {
    font-size: 42px;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--color-text);
    line-height: 1;
    margin-bottom: 10px;
}

.chat__landing-tagline {
    font-size: 16px;
    color: var(--color-text-muted);
    font-weight: 400;
}

/* Landing form: wider, centered, override the generous bottom padding */
.chat--landing .chat__input-form {
    padding-bottom: 8px;
    width: 100%;
    max-width: 640px;
    border-top: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    box-shadow: var(--shadow-md);
    padding: 4px 8px 8px;
}

/* ================================================================
   Ledger panel  (right sidebar — desktop only)
   ================================================================ */

.ledger {
    display: flex;
    flex-direction: column;
    overflow: hidden;        /* .ledger__body handles the actual scroll */
    border-left: 1px solid var(--color-border);
    background: var(--color-sidebar-bg);
}

/* Mobile + tablet: ledger is a slide-in overlay from the right */
@media (max-width: 1023px) {
    .ledger {
        position: fixed;
        top: 0;
        right: 0;
        width: 85%;
        max-width: 320px;
        height: 100%;
        transform: translateX(100%);
        transition: transform 0.25s ease;
        z-index: 100;
    }
    .ledger--open {
        transform: translateX(0);
    }
}

.ledger__header {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    padding: 16px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    background: var(--color-sidebar-bg);
    z-index: 1;
}

.ledger__close {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 4px;
    margin-left: auto;
}

.ledger__title {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text);
}

.ledger__body {
    flex: 1;            /* fill remaining height below the header */
    min-height: 0;      /* allow flex child to shrink below its content height */
    overflow-y: auto;   /* panel-level scroll lives here, not on .ledger */
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ledger__empty {
    font-size: 12px;
    color: var(--color-text-muted);
    text-align: center;
    padding: 24px 12px;
    line-height: 1.6;
}

/* Individual ledger event cards */
.ledger-event {
    border-left: 3px solid var(--color-border);
    padding: 9px 10px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--color-surface);
}

.ledger-event--committed { border-left-color: var(--color-primary); }
.ledger-event--delivered { border-left-color: #2d9e5f; }
.ledger-event--conflict  { border-left-color: var(--color-accent); }

.ledger-event__kind {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 3px;
}

.ledger-event__icon {
    font-size: 11px;
    line-height: 1;
}

.ledger-event__label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-muted);
}

.ledger-event__title {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.4;
    margin-bottom: 4px;
}

.ledger-event__meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 4px;
}

.ledger-event__domain {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
}

.ledger-event__time {
    font-size: 10px;
    color: var(--color-text-muted);
    white-space: nowrap;
}

/* ================================================================
   Tactical camo background
   ================================================================
   Organic blotch pattern simulating field camouflage.
   Applied to the html/body layer so it shows through transparent
   app containers.
   ================================================================ */

.tactical {
    /* Override base-color to a slightly warmer green */
    --color-bg: #1c2e12;
}

/* The camo is layered radial gradients creating irregular patches.
   Three tonal layers: dark green, mid green, and sand/desert. */
.tactical body {
    background-color: #2a3a1a;
    background-image:
        /* ── Dark green blotches ── */
        radial-gradient(ellipse 45% 35% at  8% 18%, #0b1807 0%, transparent 100%),
        radial-gradient(ellipse 30% 40% at 58%  6%, #0f2009 0%, transparent 100%),
        radial-gradient(ellipse 50% 30% at 92% 28%, #091405 0%, transparent 100%),
        radial-gradient(ellipse 35% 45% at 22% 55%, #0d1a08 0%, transparent 100%),
        radial-gradient(ellipse 40% 35% at 72% 62%, #0b1807 0%, transparent 100%),
        radial-gradient(ellipse 30% 40% at 12% 88%, #0f2009 0%, transparent 100%),
        radial-gradient(ellipse 50% 30% at 82% 92%, #091405 0%, transparent 100%),
        radial-gradient(ellipse 35% 25% at 45% 78%, #0d1a08 0%, transparent 100%),
        /* ── Sand / desert patches ── */
        radial-gradient(ellipse 28% 22% at 38% 12%, rgba(180, 148, 90, 0.38) 0%, transparent 100%),
        radial-gradient(ellipse 22% 30% at 83% 35%, rgba(165, 132, 75, 0.32) 0%, transparent 100%),
        radial-gradient(ellipse 32% 20% at 55% 52%, rgba(190, 155, 95, 0.35) 0%, transparent 100%),
        radial-gradient(ellipse 25% 28% at 20% 78%, rgba(170, 138, 82, 0.30) 0%, transparent 100%),
        radial-gradient(ellipse 30% 22% at 70% 85%, rgba(160, 128, 70, 0.33) 0%, transparent 100%),
        /* ── Brown / earth patches ── */
        radial-gradient(ellipse 18% 24% at 50% 28%, rgba(100, 68, 30, 0.28) 0%, transparent 100%),
        radial-gradient(ellipse 22% 18% at 14% 44%, rgba(90, 62, 25, 0.25) 0%, transparent 100%),
        radial-gradient(ellipse 20% 25% at 88% 70%, rgba(110, 72, 32, 0.27) 0%, transparent 100%),
        radial-gradient(ellipse 25% 18% at 42% 92%, rgba(95, 65, 28, 0.24) 0%, transparent 100%);
    background-attachment: fixed;
}

/* Make structural containers transparent so the camo shows through */
.tactical .app,
.tactical .chat,
.tactical .chat__messages {
    background: transparent;
}

/* Tactical header matches sidebar background — creates a unified dark
   frame around the camo chat area, like a cockpit instrument panel. */
.tactical .app-header {
    background: var(--color-sidebar-bg);
    border-bottom-color: var(--color-border);
}

/* Sidebar and ledger panel: semi-opaque with blur for legibility */
.tactical .sidebar,
.tactical .ledger {
    background: rgba(12, 26, 10, 0.88);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.tactical .ledger__header,
.tactical .sidebar__content {
    background: transparent;
}

/* Input area: visible against camo */
.tactical .chat__input-form {
    background: rgba(26, 42, 18, 0.92);
    border-top-color: rgba(45, 61, 35, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* ----------------------------------------------------------------
   Auth pages (login, register)
   ---------------------------------------------------------------- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--color-bg);
    color: var(--color-text);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    padding: 40px 32px;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    text-align: center;
}

.auth-logo {
    margin-bottom: 16px;
}

.auth-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--color-text-muted);
    margin-bottom: 32px;
}

.auth-field {
    text-align: left;
    margin-bottom: 16px;
}

.auth-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--color-text-muted);
}

.auth-field input,
.auth-field select {
    width: 100%;
    padding: 10px 14px;
    font-size: 15px;
    font-family: inherit;
    background: var(--color-input-bg);
    color: var(--color-text);
    border: 1px solid var(--color-input-border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color 0.15s ease;
}

.auth-field input:focus,
.auth-field select:focus {
    border-color: var(--color-primary);
}

.auth-field input::placeholder {
    color: var(--color-text-muted);
}

.auth-submit {
    width: 100%;
    padding: 12px;
    margin-top: 8px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    background: var(--color-primary);
    color: var(--color-primary-text);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s ease;
}

.auth-submit:hover {
    background: var(--color-primary-hover);
}

.auth-link {
    margin-top: 20px;
    font-size: 13px;
    color: var(--color-text-muted);
}

.auth-link a {
    color: var(--color-accent, var(--color-primary));
    text-decoration: none;
    font-weight: 600;
}

.auth-link a:hover {
    text-decoration: underline;
}

/* ── Wolf-splash login ─────────────────────────────────────────────────── */

.wolf-splash-page {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: #030507;
}

#wolf-engine-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

#wolf-engine-container canvas {
    display: block;
}

.wolf-splash-ui {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    transform: translateZ(0);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 18vh;
}

.wolf-splash-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wolf-splash-controls input {
    padding: 10px 16px;
    font-size: 14px;
    font-family: var(--font-sans);
    color: #e8e6e1;
    background: rgba(3, 5, 7, 0.6);
    border: 1px solid rgba(201, 162, 39, 0.2);
    border-radius: var(--radius-sm);
    outline: none;
    width: 200px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.wolf-splash-controls input:focus {
    border-color: #c9a227;
    box-shadow: 0 0 0 2px rgba(201, 162, 39, 0.15);
}

.wolf-splash-controls input::placeholder {
    color: rgba(138, 155, 176, 0.5);
}

.wolf-splash-controls button {
    padding: 10px 28px;
    font-size: 14px;
    font-weight: 700;
    font-family: var(--font-sans);
    letter-spacing: 0.05em;
    background: #c9a227;
    color: #030507;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease;
}

.wolf-splash-controls button:hover {
    background: #e0b830;
}

.wolf-splash-feedback {
    margin-top: 8px;
    min-height: 20px;
}

.wolf-splash-register {
    margin-top: 10px;
    font-size: 12px;
    color: rgba(138, 155, 176, 0.6);
}

.wolf-splash-register a {
    color: rgba(201, 162, 39, 0.7);
    text-decoration: none;
    font-weight: 600;
}

.wolf-splash-register a:hover {
    color: #c9a227;
    text-decoration: underline;
}

@media (max-width: 640px) {
    .wolf-splash-ui {
        padding-top: 6vh;
        padding-left: 24px;
        padding-right: 24px;
    }

    .wolf-splash-register {
        order: -1;
        margin-top: 0;
        margin-bottom: 14px;
    }

    .wolf-splash-controls {
        margin-bottom: 8vh;
    }

    .wolf-splash-controls {
        flex-direction: column;
        width: 100%;
        max-width: 300px;
    }

    .wolf-splash-controls input {
        width: 100%;
    }

    .wolf-splash-controls button {
        width: 100%;
    }
}

/* ── Onboarding explainer (step 1) ──────────────────────────────────────── */

.auth-card.onboarding-explainer {
    max-width: 560px;
    text-align: left;
}

.auth-card.onboarding-calibration {
    max-width: 560px;
    text-align: left;
}

.onboarding-domain-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-border, rgba(255,255,255,0.08));
}

.onboarding-domain-section:last-of-type {
    border-bottom: none;
    margin-bottom: 8px;
}

.onboarding-domain-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.onboarding-domain-label {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-primary);
}

.onboarding-domain-hint {
    font-size: 12px;
    line-height: 1.5;
    color: var(--color-text-muted);
    margin: 0 0 12px;
    opacity: 0.7;
}

.onboarding-section {
    margin: 20px 0;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--color-border, rgba(255,255,255,0.08));
}

.onboarding-section:last-of-type {
    border-bottom: none;
}

.onboarding-heading {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-primary);
    margin: 0 0 8px;
}

.onboarding-section p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--color-text-muted);
    margin: 0 0 12px;
}

.onboarding-rule {
    margin-bottom: 16px;
}

.onboarding-rule__label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 6px;
}

.onboarding-examples {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.onboarding-example {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    line-height: 1.5;
    padding: 6px 10px;
    border-radius: 6px;
}

.onboarding-example .lc {
    flex-shrink: 0;
    margin-top: 2px;
    width: 14px;
    height: 14px;
}

.onboarding-example--bad {
    background: rgba(220, 60, 60, 0.08);
    color: var(--color-text-muted);
}

.onboarding-example--bad .lc {
    color: #e05555;
}

.onboarding-example--good {
    background: rgba(60, 180, 100, 0.08);
    color: var(--color-text);
}

.onboarding-example--good .lc {
    color: #4caf7a;
}

.onboarding-domains {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 16px 0 24px;
    padding: 16px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--color-border, rgba(255,255,255,0.08));
    border-radius: 8px;
}

.onboarding-modes {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}
.onboarding-mode {
    border: 1px solid var(--color-border, rgba(255,255,255,0.1));
    border-radius: 8px;
    padding: 14px 16px;
    background: rgba(255,255,255,0.03);
}
.onboarding-mode--tactical {
    border-color: var(--color-tactical-accent, #c9a227);
    background: rgba(201, 162, 39, 0.06);
}
.onboarding-mode__header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.onboarding-mode__header strong {
    font-size: 14px;
    color: var(--color-text);
}
.onboarding-mode__icon {
    width: 16px;
    height: 16px;
    color: var(--color-text-muted);
}
.onboarding-mode--tactical .onboarding-mode__icon {
    color: var(--color-tactical-accent, #c9a227);
}
.onboarding-mode p {
    font-size: 13px;
    line-height: 1.55;
    color: var(--color-text-muted);
    margin: 0;
}

.onboarding-domain {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 13px;
}

.onboarding-domain__icon {
    flex-shrink: 0;
    margin-top: 1px;
    width: 18px;
    height: 18px;
}

.onboarding-domain strong {
    display: block;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 2px;
}

.onboarding-domain span {
    color: var(--color-text-muted);
    line-height: 1.4;
}

.auth-error {
    padding: 8px 12px;
    margin-bottom: 8px;
    font-size: 13px;
    color: #e55;
    background: rgba(238, 85, 85, 0.1);
    border-radius: var(--radius-sm);
    text-align: left;
}

/* ================================================================
   Header pills  (Profile / Logout)
   ================================================================ */
.chat__header-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border: 1px solid var(--color-border);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    background: transparent;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-family: var(--font-sans);
}
.chat__header-pill:hover {
    background: var(--color-surface-raised);
    color: var(--color-text);
}
.chat__header-pill--muted { opacity: 0.65; }
.chat__logout-form { display: contents; }

/* ================================================================
   Markdown prose  (.message__content--md and .lineage-analysis)
   ================================================================ */
.message__content--md,
.lineage-analysis {
    line-height: 1.6;
}
.message__content--md > *:first-child,
.lineage-analysis    > *:first-child { margin-top: 0; }
.message__content--md > *:last-child,
.lineage-analysis    > *:last-child  { margin-bottom: 0; }

.message__content--md h1,
.message__content--md h2,
.message__content--md h3,
.lineage-analysis h1,
.lineage-analysis h2,
.lineage-analysis h3 {
    font-weight: 650;
    line-height: 1.3;
    margin: 0.8em 0 0.3em;
}
.message__content--md h1, .lineage-analysis h1 { font-size: 1.15em; }
.message__content--md h2, .lineage-analysis h2 { font-size: 1.02em; }
.message__content--md h3, .lineage-analysis h3 {
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.8;
}

/* Reasoning section dividers — draw a subtle rule before every h2/h3 that
   has at least one sibling element preceding it.  This breaks the monolithic
   wall of text into clearly delineated sections without touching the markup. */
.lineage-analysis > * + h2,
.lineage-analysis > * + h3 {
    border-top: 1px solid var(--color-border, rgba(255, 255, 255, 0.1));
    padding-top: 16px;
    margin-top: 22px;
}
.message__content--md p,
.lineage-analysis p    { margin: 0.45em 0; }
.message__content--md ul,
.message__content--md ol,
.lineage-analysis ul,
.lineage-analysis ol   { padding-left: 1.3em; margin: 0.4em 0; }
.message__content--md li,
.lineage-analysis li   { margin: 0.2em 0; }
.message__content--md strong,
.lineage-analysis strong { font-weight: 650; }
.message__content--md hr,
.lineage-analysis hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 0.9em 0;
}
.message__content--md code,
.lineage-analysis code {
    font-family: var(--font-mono);
    font-size: 0.84em;
    background: rgba(0, 0, 0, 0.12);
    padding: 0.1em 0.3em;
    border-radius: 3px;
}
.light .message__content--md code,
.light .lineage-analysis code { background: rgba(0, 0, 0, 0.07); }
.message__content--md blockquote,
.lineage-analysis blockquote {
    border-left: 3px solid var(--color-primary);
    margin: 0.5em 0;
    padding: 0.15em 0.75em;
    opacity: 0.85;
}

/* ================================================================
   Collapsible analysis toggle (.message__lineage-*)
   ================================================================ */
.message__lineage-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 10px;
    padding: 3px 8px;
    border: 1px solid var(--color-border);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-muted);
    background: transparent;
    cursor: pointer;
    transition: background 0.15s;
    font-family: var(--font-sans);
}
.message__lineage-btn:hover { background: var(--color-surface-raised); }
.message__lineage-icon { transition: transform 0.2s ease; }

.message__lineage-body {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--color-border);
}
.lineage-analysis {
    font-size: 13px;
    color: var(--color-text);
    margin-bottom: 12px;
}
.lineage-divider {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 10px 0 12px;
}
.lineage-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 12px;
    font-size: 12px;
}
.lineage-grid dt { color: var(--color-text-muted); font-weight: 600; }
.lineage-grid dd { color: var(--color-text); }

/* ================================================================
   History panel cards
   ================================================================ */
.history-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 10px 11px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex-shrink: 0;
}

.history-card--decision {
    border-left: 3px solid var(--color-primary);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.history-card--decision:hover {
    box-shadow: var(--shadow-md);
    border-left-color: var(--color-primary-hover);
}

.history-card--overdue {
    border-left: 3px solid var(--color-accent);
}

.history-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.history-card__badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--color-surface-raised);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}

.history-card__badge--domain {
    background: rgba(45, 106, 79, 0.12);
    color: var(--color-domain-health);
    border-color: rgba(45, 106, 79, 0.2);
}

.history-card__time {
    font-size: 10px;
    color: var(--color-text-muted);
    margin-left: auto;
    white-space: nowrap;
}

.history-card__query {
    font-size: 12px;
    color: var(--color-text);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-card__title {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.4;
}

.history-card__domain-icon {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.history-card__indicators {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 5px;
}

.history-card__indicator {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 1px 6px;
}

.history-card__indicator--delivered {
    color: #2d9e5f;
    border-color: rgba(45, 158, 95, 0.3);
    background: rgba(45, 158, 95, 0.08);
}

.history-card__overdue-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-accent);
}

/* New Decision button in header */
.chat__new-decision-btn {
    gap: 5px;
    color: var(--color-primary);
    border-color: var(--color-primary);
}
.chat__new-decision-btn:hover {
    background: rgba(58, 123, 213, 0.1);
}

/* New Decision pill — uses mode-btn base, gets an accent left border */
.chat__new-decision-btn {
    border-color: var(--color-primary);
    color: var(--color-primary);
}
.chat__new-decision-btn:hover {
    background: rgba(58, 123, 213, 0.1);
    color: var(--color-primary);
}

/* Clickable history cards */
.history-card--decision {
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.12s;
}
.history-card--decision:hover {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 1px var(--color-primary);
}
.history-card--decision:active { opacity: 0.85; }

/* Deadline badge on proposed commitment cards */
.proposed-card__deadline {
    font-size: 10px;
    color: var(--color-accent);
    font-style: italic;
}

/* ================================================================
   HTMX indicator  (spinner visible while request is in flight)
   ================================================================ */
.htmx-indicator { opacity: 0; transition: opacity 200ms ease-in; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { opacity: 1; }

/* Hide the paper-plane icon while the spinner is showing so they
   don't both overlap in the button. */
.htmx-request .chat__send-icon { opacity: 0; }

/* Settings icon button in the header */
.chat__icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.chat__icon-btn:hover {
    background: var(--color-surface-raised);
    color: var(--color-text);
}

/* ================================================================
   Sidebar footer  (Profile + Logout — static, not replaced by HTMX)
   ================================================================ */
.sidebar__footer {
    border-top: 1px solid var(--color-border);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
}

.sidebar-footer__link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-muted);
    text-decoration: none;
    background: none;
    border: none;
    font-family: var(--font-sans);
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, color 0.15s;
    width: 100%;
}
.sidebar-footer__link:hover {
    background: var(--color-surface-raised);
    color: var(--color-text);
}
.sidebar-footer__link--danger { color: #c0392b; }
.sidebar-footer__link--danger:hover {
    background: rgba(192, 57, 43, 0.08);
    color: #e74c3c;
}
