/* style.css */

/* Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: Candara, "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
}

html, body { height: 100%; }

/* ── Theme colors (Nord) ──────────────────────────────────────────────────── */
/* Nord palette: https://www.nordtheme.com/docs/colors-and-palettes           */
:root {
    /* Dark theme (default) */
    --bg-main:       #2e3440;  /* Nord0 — Polar Night darkest */
    --bg-panel:      #3b4252;  /* Nord1 */
    --bg-panel-soft: #373d4a;  /* Nord1 mid */
    --bg-card:       #3b4252;  /* Nord1 */
    --bg-input:      #242933;  /* darker than Nord0 */
    --bg-sidebar:    #272c36;  /* between Nord0 and Nord1 */
    --border:        #4c566a;
    --border-soft:   #4c566a;  /* Nord3 */
    --border-hard:   #242933;  /* darker than Nord0 */
    --border-subtle: rgba(255,255,255,0.06);
    --hover-bg:      rgba(255,255,255,0.03);
    --text-primary:  #eceff4;  /* Nord6 — Snow Storm brightest */
    --text-muted:    #9099a6;  /* Nord4 muted */
    --text-secondary:#c0c7d4;
    --text-tertiary: #8d96a6;
    --accent:        #88c0d0;  /* Nord8 — Frost cyan */
    --accent-hover:  #81a1c1;  /* Nord9 — Frost blue */
    --accent-dim:    rgba(136,192,208,0.12);
    --accent-border: rgba(136,192,208,0.38);
    --accent-text:   #cce8f0;  /* light tint of Nord8 */
    --active-bg:     rgba(136,192,208,0.10);
    --danger-soft:   #3b2a2e;  /* dark red tint */
    --danger-border: #bf616a;  /* Nord11 — Aurora red */
    --danger-text:   #f4a7ab;  /* light Nord11 tint */
    --user-msg-bg:   linear-gradient(135deg, #5e81ac, #81a1c1);
    --user-msg-text: #ffffff;
    --sidebar-width: 170px;
    --content-width: 344px;
}

/* Light theme */
[data-theme="light"] {
    --bg-main:       #ffffff;
    --bg-panel:      #f7f7f8;
    --bg-panel-soft: #ececf1;
    --bg-card:       #ffffff;
    --bg-input:      #ffffff;
    --bg-sidebar:    #f9f9fa;
    --border:        #d1d1d1;
    --border-soft:   #e0e0e0;
    --border-hard:   #d1d1d1;
    --border-subtle: rgba(0,0,0,0.06);
    --hover-bg:      rgba(0,0,0,0.03);
    --text-primary:  #1f1f1f;
    --text-muted:    #666666;
    --text-secondary:#454545;
    --text-tertiary: #777777;
    --accent:        #2b7de9;
    --accent-hover:  #1e6bd6;
    --accent-dim:    rgba(43,125,233,0.08);
    --accent-border: rgba(43,125,233,0.25);
    --accent-text:   #1e6bd6;
    --active-bg:     rgba(43,125,233,0.08);
    --danger-soft:   #fff0f0;
    --danger-border: #ef4444;
    --danger-text:   #dc2626;
    --user-msg-bg:   #2b7de9;
    --user-msg-text: #ffffff;
}

/* ── Password page ────────────────────────────────────────────────────────── */

.auth-body {
    background: radial-gradient(circle at top, #3b4252, var(--bg-main));
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-wrapper { width: 100%; max-width: 440px; padding: 18px; }

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    padding: 28px 24px 24px;
    box-shadow: 0 18px 45px rgba(0,0,0,0.55);
}

.auth-card h1 { font-size: 30px; line-height: 1.1; margin-bottom: 8px; letter-spacing: 0.02em; }
.auth-card p  { color: var(--text-muted); font-size: 14px; line-height: 1.4; margin-bottom: 16px; }

.auth-error {
    background: var(--danger-soft);
    border: 1px solid var(--danger-border);
    color: var(--danger-text);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    margin-bottom: 10px;
}

.auth-input {
    width: 100%;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 15px;
    margin-bottom: 12px;
    outline: none;
    font-family: inherit;
}
.auth-input:focus        { border-color: #5e6a7e; }
.auth-input::placeholder { color: #616e7e; }

.auth-button {
    width: 100%; border: none; border-radius: 10px; padding: 11px 14px;
    background: var(--accent); color: #fff; font-size: 15px; font-weight: 600;
    cursor: pointer; font-family: inherit;
}
.auth-button:hover { background: var(--accent-hover); }
.auth-note { color: #8892a0; font-size: 12px; margin-top: 10px; margin-bottom: 0; }

/* ── App shell ────────────────────────────────────────────────────────────── */

.app-body {
    background:
        radial-gradient(circle at 10% 0%, rgba(136,192,208,0.16), transparent 28%),
        radial-gradient(circle at 90% 10%, rgba(94,129,172,0.12), transparent 24%),
        var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
}

.app-root {
    display: flex;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

.app-root::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(120deg, rgba(255,255,255,0.03), transparent 28%),
        linear-gradient(300deg, rgba(0,0,0,0.08), transparent 34%);
    mix-blend-mode: soft-light;
    opacity: 0.65;
    z-index: 0;
}

.sidebar,
.content-panel,
.right-panel {
    position: relative;
}

.split-panel {
    min-width: 0;
    min-height: 0;
    transition: opacity 0.15s ease, width 0.18s ease, height 0.18s ease, flex-basis 0.18s ease;
}

.split-panel.split-panel-collapsed {
    overflow: hidden;
    min-width: 0 !important;
    min-height: 0 !important;
    width: 0 !important;
    height: 0 !important;
    padding: 0 !important;
    border: 0 !important;
}

.split-panel.split-panel-collapsed > * {
    opacity: 0;
    pointer-events: none;
}

.pane-splitter {
    position: relative;
    flex: 0 0 auto;
    z-index: 20;
    color: var(--text-muted);
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0;
    user-select: none;
    touch-action: none;
}

.pane-splitter:hover,
.pane-splitter.dragging {
    color: var(--accent);
    background: var(--accent-dim);
}

.pane-splitter::before,
.pane-splitter::after {
    content: "";
    position: absolute;
    background: currentColor;
    border-radius: 999px;
    opacity: 0.8;
}

.pane-splitter-x {
    width: 10px;
    align-self: stretch;
    cursor: col-resize;
}

.pane-splitter-x::before,
.pane-splitter-x::after {
    top: 50%;
    width: 2px;
    height: 18px;
    transform: translateY(-50%);
}

.pane-splitter-x::before {
    left: 3px;
}

.pane-splitter-x::after {
    right: 3px;
}

.pane-splitter-y {
    height: 10px;
    align-self: stretch;
    cursor: row-resize;
}

.pane-splitter-y::before,
.pane-splitter-y::after {
    left: 50%;
    width: 18px;
    height: 2px;
    transform: translateX(-50%);
}

.pane-splitter-y::before {
    top: 3px;
}

.pane-splitter-y::after {
    bottom: 3px;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */

.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent 26%), var(--bg-sidebar);
    border-right: 1px solid var(--border-hard);
    display: flex;
    flex-direction: column;
    padding: 18px 10px 14px;
    transition: width 0.25s ease, padding 0.25s ease;
    position: relative;
    z-index: 3;
    box-shadow: 10px 0 30px rgba(0,0,0,0.12);
}

/* Collapsed state - icon-only sidebar */
.sidebar.collapsed {
    width: 64px;
    padding: 12px 8px;
}

/* Collapse toggle button (desktop only) */
.sidebar-collapse-toggle {
    position: absolute;
    top: 12px;
    right: -12px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-hard);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
    z-index: 10;
}

.sidebar-collapse-toggle:hover {
    background: var(--bg-panel);
    color: var(--text-primary);
    border-color: var(--border-soft);
}

/* Light theme collapse button - very light blue */
[data-theme="light"] .sidebar-collapse-toggle {
    background: #e3f0ff;
    border-color: #a8d0ff;
}

[data-theme="light"] .sidebar-collapse-toggle:hover {
    background: #cfe4ff;
    color: #1e6bd6;
    border-color: #6eb4ff;
}

.sidebar-collapse-toggle .collapse-icon {
    transition: transform 0.25s ease;
}

.sidebar.collapsed .sidebar-collapse-toggle .collapse-icon {
    transform: rotate(180deg);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 14px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
    transition: all 0.25s ease;
}

/* Hide logo text when collapsed */
.sidebar.collapsed .sidebar-logo {
    gap: 0;
    padding-bottom: 10px;
    margin-bottom: 10px;
    justify-content: center;
}

.sidebar.collapsed .sidebar-brand {
    display: none;
}

.sidebar-favicon { width: 36px; height: 36px; border-radius: 8px; object-fit: contain; flex-shrink: 0; }

.sidebar-brand { display: flex; flex-direction: column; gap: 2px; min-width: 0; max-width: 100%; }

.sidebar-brand-name {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.2;
    white-space: nowrap;
    text-transform: uppercase;
}

.sidebar-brand-tagline {
    color: var(--text-muted);
    font-size: 9px;
    line-height: 1.2;
    white-space: normal;
    overflow-wrap: anywhere;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    min-height: 0;
}

.sidebar-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 8px;
}

.sidebar-group:first-child {
    padding-top: 0;
}

.sidebar-group + .sidebar-group {
    border-top: 1px solid rgba(255,255,255,0.04);
}

.sidebar-group.active-workflow {
    position: relative;
}

.sidebar-group.active-workflow::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 8px;
    bottom: 2px;
    width: 2px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(136,192,208,0.85), rgba(94,129,172,0.25));
    opacity: 0.9;
}

.sidebar-group-label {
    color: var(--text-tertiary);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    padding: 0 10px 2px;
}

.nav-item {
    display: flex; align-items: center; gap: 8px;
    width: 100%; padding: 8px 11px;
    border-radius: 12px; border: 1px solid transparent;
    background: transparent; color: var(--text-muted);
    font-family: inherit; font-size: 12.5px; font-weight: 500;
    cursor: pointer; text-align: left;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
    white-space: nowrap;
    backdrop-filter: blur(10px);
}

/* Collapsed sidebar - center icons, hide labels */
.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 10px;
}

.sidebar.collapsed .nav-label {
    display: none;
}

.sidebar.collapsed .sidebar-group-label {
    display: none;
}

.sidebar.collapsed .sidebar-group {
    gap: 4px;
}

.nav-item:hover  {
    background: rgba(255,255,255,0.04);
    color: var(--text-primary);
    border-color: rgba(255,255,255,0.08);
    transform: translateX(2px);
}
.nav-item.active {
    background: linear-gradient(135deg, rgba(136,192,208,0.16), rgba(94,129,172,0.12));
    border-color: var(--accent-border);
    color: var(--accent-text);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}
.nav-item.active .nav-icon svg { stroke: var(--accent-text); }

/* Light theme nav item hovers */
[data-theme="light"] .nav-item:hover {
    background: rgba(43,125,233,0.1);
    color: #1e6bd6;
    border-color: rgba(43,125,233,0.3);
}

.nav-icon { display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nav-icon svg { width: 14px; height: 14px; stroke: currentColor; transition: stroke 0.15s; }
.nav-label { line-height: 1.15; font-size: 12.5px; }

.sidebar-footer { 
    flex-shrink: 0; 
    padding-top: 12px; 
    border-top: 1px solid var(--border-subtle); 
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-theme-toggle {
    display: flex; 
    align-items: center; 
    gap: 8px;
    width: 100%; 
    padding: 7px 12px;
    border-radius: 14px; 
    border: 1px solid transparent;
    background: transparent; 
    color: #8892a0;
    font-family: inherit; 
    font-size: 12px; 
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.sidebar.collapsed .sidebar-theme-toggle {
    justify-content: center;
    padding: 10px;
}

.sidebar.collapsed .theme-label {
    display: none;
}

.sidebar-theme-toggle:hover { 
    background: rgba(255,255,255,0.04); 
    color: var(--text-muted); 
    border-color: var(--border-soft); 
}

/* Light theme hover for theme toggle */
[data-theme="light"] .sidebar-theme-toggle:hover {
    background: rgba(43,125,233,0.1);
    color: #1e6bd6;
    border-color: rgba(43,125,233,0.3);
}

.sidebar-theme-toggle svg { 
    flex-shrink: 0; 
}

.sidebar-logout {
    display: flex; align-items: center; gap: 8px;
    width: 100%; padding: 7px 12px;
    border-radius: 14px; border: 1px solid transparent;
    background: transparent; color: #8892a0;
    font-family: inherit; font-size: 12px; text-decoration: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.sidebar.collapsed .sidebar-logout {
    justify-content: center;
    padding: 10px;
}

.sidebar.collapsed .sidebar-logout span {
    display: none;
}

.sidebar-logout:hover { 
    background: rgba(255,255,255,0.04); 
    color: var(--text-muted); 
    border-color: var(--border-soft); 
}

/* Light theme hover for logout */
[data-theme="light"] .sidebar-logout:hover {
    background: rgba(43,125,233,0.1);
    color: #1e6bd6;
    border-color: rgba(43,125,233,0.3);
}

.sidebar-logout svg  { flex-shrink: 0; opacity: 0.65; }

/* ── Content panel ────────────────────────────────────────────────────────── */

.content-panel {
    width: var(--content-width);
    flex-shrink: 0;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.02), transparent 22%),
        var(--bg-panel);
    border-right: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 2;
    box-shadow: inset -1px 0 0 rgba(255,255,255,0.03);
}

.content-panel-hud {
    padding: 18px 16px 14px;
    border-bottom: 1px solid var(--border-subtle);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.04), transparent 80%),
        rgba(255,255,255,0.01);
    flex-shrink: 0;
}

.content-panel-hud-kicker {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent-text);
    margin-bottom: 6px;
}

.content-panel-hud-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: 1.05;
    margin-bottom: 4px;
}

.content-panel-hud-meta {
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-secondary);
    max-width: 28ch;
}

/* ── Resize handle ─────────────────────────────────────────────────────── */
.panel-resize-handle {
    width: 4px;
    flex-shrink: 0;
    cursor: col-resize;
    background: var(--border-hard);
    transition: background 0.15s;
    position: relative;
    z-index: 5;
}

.panel-resize-handle:hover,
.panel-resize-handle.dragging {
    background: var(--accent-border);
}

/* Wider invisible hit area */
.panel-resize-handle::before {
    content: '';
    position: absolute;
    top: 0;
    left: -4px;
    right: -4px;
    bottom: 0;
}

.panel-section { display: none; flex-direction: column; height: 100%; overflow: hidden; }
.panel-section.active { display: flex; }

.panel-header {
    padding: 18px 16px 12px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
    background: rgba(255,255,255,0.01);
}
.panel-title    { font-size: 14px; font-weight: 700; letter-spacing: 0.08em; line-height: 1.2; margin-bottom: 4px; color: var(--text-primary); text-transform: uppercase; }
.panel-subtitle { color: var(--text-secondary); font-size: 12px; line-height: 1.45; max-width: 30ch; }

/* AI Chat form */
.question-form { display: flex; flex-direction: column; gap: 10px; padding: 16px 20px; flex-shrink: 0; }

.input-label-row { display: flex; align-items: center; justify-content: space-between; }
.input-label     { color: var(--text-muted); font-size: 13px; letter-spacing: 0.02em; }

.new-chat-button {
    border-radius: 999px; border: 1px solid var(--border-soft);
    background: transparent; color: var(--text-muted);
    padding: 6px 12px; font-size: 12px; font-family: inherit;
    cursor: pointer; transition: background 0.15s, color 0.15s; white-space: nowrap;
}
.new-chat-button:hover { background: #3d4558; color: var(--text-primary); }

.question-input {
    width: 100%; background: var(--bg-input); color: var(--text-primary);
    border: 1px solid var(--border-soft); border-radius: 12px;
    padding: 12px 14px; font-size: 15px; line-height: 1.45;
    resize: vertical; min-height: 130px; outline: none; font-family: inherit;
}
.question-input:focus        { border-color: #5e6a7e; }
.question-input::placeholder { color: #616e7e; }

.button-row { display: flex; gap: 10px; align-items: center; }

.ask-button {
    border: none; border-radius: 999px; background: var(--accent); color: #fff;
    padding: 10px 18px; font-size: 15px; font-weight: 600; font-family: inherit;
    cursor: pointer; transition: background 0.15s;
}
.ask-button:hover:not(:disabled) { background: var(--accent-hover); }
.ask-button:disabled             { opacity: 0.65; cursor: default; }

.clear-button {
    border-radius: 999px; border: 1px solid var(--border-soft);
    background: transparent; color: var(--text-muted);
    padding: 9px 14px; font-size: 14px; font-family: inherit;
    cursor: pointer; transition: background 0.15s, color 0.15s;
}
.clear-button:hover { background: #3d4558; color: var(--text-primary); }

.helper-text      { color: var(--text-muted); font-size: 12px; line-height: 1.4; padding: 0 20px; flex-shrink: 0; }
.panel-footer-note {
    margin-top: auto; color: #8892a0; font-size: 11px;
    border-top: 1px solid var(--border-subtle); padding: 10px 20px; flex-shrink: 0;
}

/* Scrollable panel content */
.panel-scrollable {
    flex: 1; min-height: 0; overflow-y: auto;
    padding: 14px 16px; display: flex; flex-direction: column; gap: 0;
}
.panel-scrollable::-webkit-scrollbar       { width: 4px; }
.panel-scrollable::-webkit-scrollbar-track { background: transparent; }
.panel-scrollable::-webkit-scrollbar-thumb { background: #4c566a; border-radius: 2px; }
.panel-scrollable::-webkit-scrollbar-thumb:hover { background: #5e6a7e; }

/* Section labels */
.tool-section-label {
    color: #8892a0; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
    padding: 12px 0 5px; border-bottom: 1px solid var(--border-subtle); margin-bottom: 2px;
}
.tool-section-label:first-child { padding-top: 0; }

/* Form rows — now clickable, View button replaces PDF link */
.tool-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; border-bottom: 1px solid var(--border-subtle); padding: 8px 0;
    cursor: pointer; transition: background 0.12s; border-radius: 6px; padding: 8px 6px;
    margin: 0 -6px;
}
.tool-row:hover { background: var(--hover-bg); }
.tool-row.active-row { background: var(--accent-dim); }

.tool-info  { flex: 1; min-width: 0; }
.tool-name  { color: var(--text-primary); font-size: 12px; font-weight: 600; line-height: 1.3; }
.tool-source { color: #8892a0; font-size: 10px; margin-top: 2px; }

/* View button — same pill language */
.tool-view-btn {
    border: 1px solid var(--border-soft); border-radius: 999px;
    background: transparent; color: var(--text-muted);
    padding: 4px 10px; font-size: 11px; white-space: nowrap; flex-shrink: 0;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.tool-row:hover    .tool-view-btn { background: #3d4558; color: var(--text-primary); border-color: var(--border-soft); }
.tool-row.active-row .tool-view-btn { background: var(--accent-dim); border-color: var(--accent-border); color: var(--accent-text); }


.insight-card-title  { color: var(--text-primary); font-size: 12px; font-weight: 600; line-height: 1.35; }
.insight-card-meta   { color: #8892a0; font-size: 10px; letter-spacing: 0.02em; line-height: 1.4; }
.insight-card-blurb  { color: var(--text-muted); font-size: 11.5px; line-height: 1.5; margin-top: 2px; }

/* News cards — clickable */
.news-card {
    border-bottom: 1px solid var(--border-subtle); padding: 10px 6px;
    display: flex; flex-direction: column; gap: 4px;
    cursor: pointer; border-radius: 6px; margin: 0 -6px;
    transition: background 0.12s;
}
.news-card:last-child { border-bottom: none; }
.news-card:hover      { background: var(--hover-bg); }
.news-card.active-row { background: var(--accent-dim); }

.news-card-title { color: var(--text-primary); font-size: 13px; font-weight: 600; line-height: 1.35; }
.news-card-meta  { color: #8892a0; font-size: 10px; }

/* Replace "Read article →" text with a subtle cue */
.news-card-read  { color: var(--accent); font-size: 11px; margin-top: 2px; }

.insight-empty { color: #8892a0; font-size: 12px; font-style: italic; padding: 6px 0; }

.panel-refresh-btn {
    margin-left: auto;
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    padding: 4px 10px;
    font-size: 11px;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
}

.panel-refresh-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
    border-color: var(--border-subtle);
}

.panel-refresh-btn:disabled {
    opacity: 0.55;
    cursor: wait;
}

/* Tools placeholder */
.tools-placeholder {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 12px; padding: 48px 20px; text-align: center; flex: 1;
}
.tools-placeholder-icon  { opacity: 0.2; color: var(--text-muted); }
.tools-placeholder-title { font-size: 14px; font-weight: 600; color: var(--text-muted); opacity: 0.65; }
.tools-placeholder-body  { font-size: 12px; line-height: 1.6; max-width: 230px; color: var(--text-muted); opacity: 0.45; }

/* ── Right panel — context-aware display area ─────────────────────────────── */

.right-panel {
    flex: 1; min-width: 0;
    background:
        radial-gradient(circle at top right, rgba(136,192,208,0.08), transparent 20%),
        radial-gradient(circle at 20% 0%, rgba(94,129,172,0.08), transparent 22%),
        var(--bg-main);
    padding: 0; display: flex; flex-direction: column; overflow: hidden;
    position: relative;
}

/* Non-map panes keep the 24px breathing room; map panes manage their own layout */
.display-pane:not(#pane-weatherverify):not(#pane-weatheralerts):not(#pane-warmonitor):not(#pane-crimemap) {
    padding: 28px 30px;
}

/* Display panes — only one visible at a time */
.display-pane { display: none; flex-direction: column; flex: 1; min-height: 0; gap: 10px; }
.display-pane.active { display: flex; }

/* Shared header row used by all panes */
.response-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; flex-shrink: 0;
}
.response-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* Status pill (chat pane) */
.status-pill {
    border-radius: 999px; border: 1px solid var(--border-soft);
    padding: 4px 10px; font-size: 12px; color: var(--text-muted); background: transparent;
}
.status-ready { color: #cce8f0; border-color: rgba(136,192,208,0.35); background: rgba(136,192,208,0.08); }
.status-busy  { color: #b5ccdf; border-color: rgba(129,161,193,0.35); background: rgba(129,161,193,0.08); }
.status-error { color: #f4a7ab; border-color: rgba(191,97,106,0.45); background: rgba(191,97,106,0.08); }

/* Action button in pane header (Download PDF, ← Back) */
.display-action-btn {
    border-radius: 14px; border: 1px solid var(--border-soft);
    background: rgba(255,255,255,0.03); color: var(--text-muted);
    padding: 5px 12px; font-size: 12px; font-family: inherit;
    cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: background 0.15s, color 0.15s, transform 0.15s;
}
.display-action-btn:hover { background: rgba(255,255,255,0.06); color: var(--text-primary); transform: translateY(-1px); }

/* ── Chat pane ────────────────────────────────────────────────────────────── */

.response-output {
    flex: 1; min-height: 0;
    border-radius: 18px; border: 1px solid rgba(255,255,255,0.06);
    background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent 24%), var(--bg-panel);
    padding: 14px 16px;
    font-size: 15px; overflow-y: auto;
    display: flex; flex-direction: column; gap: 0;
    box-shadow: 0 18px 40px rgba(0,0,0,0.12);
}
.response-output::-webkit-scrollbar       { width: 4px; }
.response-output::-webkit-scrollbar-track { background: transparent; }
.response-output::-webkit-scrollbar-thumb { background: #4c566a; border-radius: 2px; }

.placeholder-text { color: var(--text-muted); font-size: 15px; line-height: 1.55; }

.chat-entry     { display: flex; flex-direction: column; gap: 8px; }
.chat-question  {
    color: var(--accent); font-size: 13px; font-weight: 600; letter-spacing: 0.02em;
    padding: 8px 10px; background: rgba(136,192,208,0.07);
    border-left: 2px solid var(--accent); border-radius: 4px; white-space: pre-wrap;
}
.chat-answer    { color: var(--text-primary); font-size: 15px; line-height: 1.6; white-space: pre-wrap; padding: 4px 2px 4px 12px; }
.chat-divider   { border: none; border-top: 1px solid var(--border-soft); margin: 12px 0; opacity: 0.5; }

.chat-thinking {
    color: var(--text-muted); font-size: 14px; font-style: italic; padding: 8px 2px;
    animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:0.4;} }

.response-footer { display: flex; align-items: center; flex-shrink: 0; }
.save-button {
    border-radius: 14px; border: 1px solid var(--border-soft);
    background: rgba(255,255,255,0.03); color: var(--text-muted);
    padding: 9px 14px; font-size: 14px; font-family: inherit;
    cursor: pointer; transition: background 0.15s, color 0.15s;
}
.save-button:hover { background: rgba(255,255,255,0.06); color: var(--text-primary); }

/* ── PDF viewer pane ──────────────────────────────────────────────────────── */

.pdf-viewer-wrap {
    flex: 1; min-height: 0;
    border-radius: 12px; border: 1px solid var(--border-soft);
    overflow: hidden; background: #fff;
}

.pdf-iframe {
    width: 100%; height: 100%;
    border: none; display: block;
}

/* ── News article reader pane ─────────────────────────────────────────────── */

.article-reader {
    flex: 1; min-height: 0;
    background: transparent;
    padding: 28px 32px;
    overflow-y: auto;
    display: flex; flex-direction: column; gap: 0;
}
.article-reader::-webkit-scrollbar       { width: 4px; }
.article-reader::-webkit-scrollbar-track { background: transparent; }
.article-reader::-webkit-scrollbar-thumb { background: #4c566a; border-radius: 2px; }

/* Stacking article cards */
.article-card {
    padding: 20px 12px;
    border-bottom: 1px solid var(--border-subtle);
    border-left: 3px solid transparent;
    background: transparent;
}
.article-card:last-child { border-bottom: none; }

/* Persistent accent on the selected card — stays until another is selected */
.article-card-active {
    background: var(--accent-dim);
    border-left-color: var(--accent);
}

/* Momentary slightly brighter flash — fades back to accent-dim */
.article-card-flash.article-card-active {
    background: rgba(136,192,208,0.10);
    transition: background 0.6s ease-out;
}

.article-card-inner {
    display: flex; flex-direction: column; gap: 0;
}

/* Article source badge */
.article-source-bar {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 10px; flex-wrap: wrap;
}
.article-source-link {
    color: var(--accent); font-size: 12px; font-weight: 600;
    text-decoration: none; letter-spacing: 0.03em;
}
.article-source-link:hover { text-decoration: underline; }
.article-published {
    color: #8892a0; font-size: 11px;
    border-left: 1px solid rgba(255,255,255,0.1); padding-left: 10px;
}

/* Article headline */
.article-headline {
    color: var(--text-primary); font-size: 17px; font-weight: 700;
    line-height: 1.3; margin-bottom: 12px; letter-spacing: 0.01em;
}

/* Article divider */
.article-divider {
    border: none; border-top: 1px solid rgba(255,255,255,0.07);
    margin: 0 0 20px;
}

/* Article body paragraphs */
.article-para {
    color: var(--text-primary); font-size: 15px;
    line-height: 1.75; margin-bottom: 14px;
    opacity: 0.92;
}
.article-para:last-child { margin-bottom: 0; }

/* AI summary label */
.article-ai-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent-text);
    background: var(--accent-dim);
    border: 1px solid var(--accent-border);
    border-radius: 999px;
    padding: 3px 10px;
    display: inline-block;
    margin-bottom: 14px;
}

/* Read full article footer */
.article-read-full {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.07);
}

.article-read-full-link {
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: 0.01em;
}

.article-read-full-link:hover { text-decoration: underline; }

/* Loading / error states inside article reader */
.article-loading {
    color: var(--text-muted); font-size: 14px; font-style: italic;
    padding: 20px 0; animation: pulse 1.4s ease-in-out infinite;
}
.article-error {
    color: #f4a7ab; font-size: 13px; padding: 12px 0; line-height: 1.55;
}
.article-error a { color: var(--accent); }
/* Insight cards — clickable rows */
.insight-card {
    border-bottom: 1px solid var(--border-subtle);
    padding: 10px 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    border-radius: 6px;
    margin: 0 -6px;
    transition: background 0.12s;
}
.insight-card:hover     { background: var(--hover-bg); }
.insight-card.active-row { background: var(--accent-dim); }
.insight-card:last-child { border-bottom: none; }

.insight-card-read {
    color: var(--accent);
    font-size: 11px;
    margin-top: 2px;
}

/* ── Generic placeholder pane ────────────────────────────────────────────── */

#pane-placeholder { justify-content: center; align-items: center; }

.pane-placeholder-inner {
    display: flex; flex-direction: column; align-items: center;
    gap: 14px; text-align: center; max-width: 320px;
}
.pane-placeholder-icon  { opacity: 0.15; color: var(--text-muted); }
.pane-placeholder-text  { color: var(--text-muted); font-size: 14px; line-height: 1.6; opacity: 0.55; }

/* ── Mobile top bar (hidden on desktop) ───────────────────────────────────── */

.mobile-topbar {
    display: none; /* shown via media query */
}

.mobile-panel-tabs {
    display: none;
}

.app-root.mobile-tabs-hidden .mobile-panel-tabs {
    display: none !important;
}

.sidebar-overlay {
    display: none; /* shown via media query */
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 1100px) {
    :root { --content-width: 280px; }
}

/* ── Tablet ───────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    :root { --content-width: 240px; --sidebar-width: 56px; }

    .sidebar { padding: 12px 6px; }
    .sidebar-brand-tagline { display: none; }
    .sidebar-brand-name { display: none; }
    .sidebar-favicon { width: 30px; height: 30px; }
    .sidebar-logo { gap: 0; padding-bottom: 10px; margin-bottom: 10px; justify-content: center; }
    .nav-label { display: none; }
    .nav-item { justify-content: center; padding: 10px; }
    .nav-icon svg { width: 18px; height: 18px; }
    .sidebar-logout span { display: none; }
    .sidebar-logout { justify-content: center; padding: 10px; }

    .content-panel-hud { padding: 14px 14px 12px; }
    .content-panel-hud-title { font-size: 16px; }
    .content-panel-hud-meta { font-size: 11px; }

    .panel-title { font-size: 14px; }
    .panel-header { padding: 14px 14px 10px; }
    .panel-scrollable { padding: 10px 12px; }
    .question-form { padding: 12px 14px; }
}

/* ── Mobile ───────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {

    .pane-splitter {
        display: none !important;
    }

    /* Hide desktop collapse button on mobile */
    .sidebar-collapse-toggle {
        display: none;
    }

    /* Prevent collapsed state on mobile */
    .sidebar.collapsed {
        width: 260px;
        padding: 18px 10px 14px;
    }

    /* ── Mobile top bar ── */
    .mobile-topbar {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 14px;
        background: rgba(39,44,54,0.92);
        border-bottom: 1px solid var(--border-hard);
        flex-shrink: 0;
        z-index: 100;
        backdrop-filter: blur(18px);
        box-shadow: 0 10px 30px rgba(0,0,0,0.18);
    }
    .sidebar-toggle {
        background: none; border: none; color: var(--text-primary);
        padding: 6px; cursor: pointer; border-radius: 6px;
        display: flex; align-items: center; justify-content: center;
    }
    .sidebar-toggle:hover { background: var(--border-subtle); }
    .mobile-topbar-brand {
        display: flex; align-items: center; gap: 6px; flex: 1;
    }
    .mobile-topbar-icon { width: 22px; height: 22px; border-radius: 6px; }
    .mobile-topbar-name {
        font-size: 14px; font-weight: 700; color: var(--text-primary);
        letter-spacing: 0.02em;
    }

    .mobile-panel-tabs {
        display: flex;
        gap: 8px;
        padding: 10px 12px 12px;
        background: rgba(39,44,54,0.88);
        border-bottom: 1px solid var(--border-hard);
        backdrop-filter: blur(18px);
        flex-shrink: 0;
    }

    .mobile-panel-tab {
        flex: 1;
        border: 1px solid var(--border-soft);
        background: rgba(255,255,255,0.03);
        color: var(--text-muted);
        border-radius: 999px;
        padding: 9px 12px;
        font: inherit;
        font-size: 12px;
        font-weight: 600;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        cursor: pointer;
        transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    }

    .mobile-panel-tab.active {
        background: var(--accent-dim);
        border-color: var(--accent-border);
        color: var(--accent-text);
    }

    /* ── Sidebar as slide-out overlay ── */
    .sidebar {
        position: fixed;
        top: 0; left: 0;
        width: min(84vw, 300px); height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 200;
        border-right: 1px solid var(--border-hard);
        padding: 18px 10px 14px;
        flex-direction: column;
    }
    .sidebar.sidebar-open {
        transform: translateX(0);
    }
    .sidebar-brand-name { display: block; }
    .sidebar-brand-tagline { display: block; }
    .nav-label { display: inline; }
    .nav-icon { display: flex; }
    .nav-item { justify-content: flex-start; padding: 8px 12px; }
    .sidebar-logout { justify-content: flex-start; padding: 7px 12px; }
    .sidebar-logout span { display: inline; }
    .sidebar-favicon { width: 32px; height: 32px; }
    .sidebar-logo { gap: 10px; justify-content: flex-start; }

    /* Overlay backdrop */
    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 190;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s;
    }
    .sidebar-overlay.visible {
        opacity: 1;
        pointer-events: auto;
    }

    /* ── App root becomes vertical column ── */
    .app-root {
        flex-direction: column;
        height: 100dvh;
        overflow: hidden;
    }

    .content-panel,
    .right-panel {
        width: 100%;
        min-height: 0;
        padding: 0;
    }

    .app-root.mobile-view-list .content-panel { display: flex; flex: 1; }
    .app-root.mobile-view-list .right-panel   { display: none; }
    .app-root.mobile-view-detail .content-panel { display: none; }
    .app-root.mobile-view-detail .right-panel   { display: flex; flex: 1; }

    /* ── Chat section: compact input in top pane ── */
    /* Hide the panel header on mobile to save vertical space */
    #section-chat .panel-header { display: none; }

    .content-panel-hud {
        padding: 12px 12px 10px;
    }

    .content-panel-hud-title {
        font-size: 15px;
    }

    .content-panel-hud-meta {
        font-size: 11px;
        max-width: none;
    }

    /* Shrink the textarea to 3 rows worth of height */
    .question-input {
        min-height: 0;
        height: 72px;  /* ~3 rows */
        resize: none;
        font-size: 14px;
        padding: 9px 12px;
    }

    /* Compress chat form padding */
    .question-form { padding: 10px 12px; gap: 7px; }

    .input-label-row { margin-bottom: 0; }
    .input-label { font-size: 12px; }
    .new-chat-button { font-size: 11px; padding: 4px 10px; }

    .ask-button   { padding: 8px 16px; font-size: 13px; }
    .clear-button { padding: 7px 12px; font-size: 12px; }
    .helper-text  { padding: 0 12px; font-size: 10px; }
    .panel-footer-note { padding: 6px 12px; font-size: 10px; }

    /* Hide resize handle on mobile */
    .panel-resize-handle { display: none; }

    /* ── News / Forms: list in top pane ── */
    /* Keep the section header but compact it */
    .panel-header { padding: 10px 12px 8px; }
    .panel-title  { font-size: 13px; }
    .panel-subtitle { font-size: 11px; }

    .panel-scrollable { padding: 6px 10px; }
    .tool-row { padding: 8px 6px; }
    .tool-name { font-size: 12px; }
    .tool-source { font-size: 10px; }
    .tool-section-label { font-size: 10px; padding: 10px 0 4px; }

    .news-card { padding: 8px 6px; }
    .news-card-title { font-size: 13px; }
    .news-card-meta { font-size: 10px; }
    .news-card-read { font-size: 11px; }

    .insight-card { padding: 8px 6px; }
    .insight-card-title { font-size: 12px; }
    .insight-card-meta { font-size: 10px; }
    .insight-card-blurb { font-size: 11px; }
    .insight-card-read { font-size: 11px; }

    /* ── Bottom pane (right-panel) — response / detail ── */
    .response-header { gap: 6px; padding: 8px 10px; }
    .response-title { font-size: 13px; }
    .status-pill { font-size: 11px; padding: 3px 8px; }
    .display-action-btn { font-size: 11px; padding: 5px 10px; }

    .response-output { padding: 10px 12px; font-size: 14px; border-radius: 10px; }
    .chat-question { font-size: 13px; padding: 6px 8px; }
    .chat-answer { font-size: 14px; padding: 4px 2px 4px 10px; }
    .save-button { font-size: 12px; padding: 6px 12px; }

    .pdf-viewer-wrap { border-radius: 10px; }
    .pdf-iframe { min-height: 0; }  /* fills flex container naturally */

    .article-reader { padding: 8px 10px; }
    .article-card { padding: 12px 8px; }
    .article-headline { font-size: 14px; }
    .article-source-link { font-size: 11px; }
    .article-published { font-size: 10px; }
    .article-ai-label { font-size: 9px; padding: 2px 8px; }
    .article-para { font-size: 13px; line-height: 1.6; }
    .article-read-full-link { font-size: 12px; }


    .pane-placeholder-inner { max-width: 240px; }
    .pane-placeholder-text { font-size: 12px; }

    .tools-placeholder { padding: 24px 16px; }
    .tools-placeholder-title { font-size: 13px; }
    .tools-placeholder-body { font-size: 12px; }
}/* ═══════════════════════════════════════════════════════════════════════════
   MODERN CHAT INTERFACE (ChatGPT/Claude style)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Chat Header ────────────────────────────────────────────────────────── */

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    border-bottom: none;
    background: transparent;
    flex-shrink: 0;
}

.chat-header-shell {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 24px;
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 24px;
    background:
        linear-gradient(135deg, rgba(136,192,208,0.12), rgba(94,129,172,0.06) 45%, transparent 100%),
        linear-gradient(180deg, rgba(255,255,255,0.03), transparent 36%),
        var(--bg-panel);
    box-shadow: 0 20px 44px rgba(0,0,0,0.14);
}

.chat-header-left {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.chat-kicker {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent-text);
}

.chat-brand-lockup {
    display: flex;
    align-items: center;
    gap: 14px;
}

.chat-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.chat-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    line-height: 1;
}

.chat-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    max-width: 42ch;
    line-height: 1.45;
}

.chat-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.chat-status-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.new-chat-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 13px;
    border-radius: 12px;
    border: 1px solid var(--border-soft);
    background: rgba(255,255,255,0.03);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
}

.new-chat-btn:hover {
    background: var(--accent-dim);
    border-color: var(--accent-border);
    color: var(--accent-text);
}

.new-chat-btn svg {
    flex-shrink: 0;
}

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border-soft);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}

.icon-btn:hover {
    background: var(--accent-dim);
    border-color: var(--accent-border);
    color: var(--accent-text);
}

/* ── Messages Container ────────────────────────────────────────────────── */

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 0 22px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    background: transparent;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #4c566a;
    border-radius: 3px;
}

/* ── Welcome Screen ────────────────────────────────────────────────────── */

.chat-welcome {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: min(100%, 980px);
    margin: 0 auto;
}

.chat-hero-card {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(250px, 0.9fr);
    gap: 18px;
    padding: 24px;
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,0.07);
    background:
        radial-gradient(circle at top right, rgba(136,192,208,0.16), transparent 26%),
        linear-gradient(180deg, rgba(255,255,255,0.03), transparent 42%),
        var(--bg-panel);
    box-shadow: 0 18px 40px rgba(0,0,0,0.14);
}

.chat-hero-copy {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-hero-eyebrow {
    display: inline-flex;
    align-self: flex-start;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--accent-border);
    background: var(--accent-dim);
    color: var(--accent-text);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.chat-hero-copy h2 {
    font-size: 34px;
    line-height: 1.02;
    letter-spacing: -0.04em;
    color: var(--text-primary);
    max-width: 14ch;
}

.chat-hero-copy p {
    font-size: 15px;
    line-height: 1.65;
    color: var(--text-secondary);
    max-width: 56ch;
}

.chat-hero-metrics {
    display: grid;
    gap: 10px;
}

.chat-metric {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.03);
}

.chat-metric span {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}

.chat-metric strong {
    font-size: 14px;
    line-height: 1.35;
    color: var(--text-primary);
}

.welcome-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: var(--accent-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.welcome-icon svg {
    stroke: var(--accent);
}

.welcome-examples {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    width: min(100%, 980px);
}

.example-prompt {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 126px;
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.06);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.02), transparent 56%),
        rgba(59,66,82,0.84);
    color: var(--text-primary);
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
    line-height: 1.45;
    box-shadow: 0 14px 30px rgba(0,0,0,0.12);
}

.example-prompt-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}

.example-prompt strong {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.45;
    color: var(--text-primary);
}

.example-prompt:hover {
    background:
        linear-gradient(180deg, rgba(136,192,208,0.12), transparent 56%),
        rgba(59,66,82,0.92);
    border-color: var(--accent-border);
    color: var(--accent-text);
    transform: translateY(-2px);
}

/* ── Message Bubbles ───────────────────────────────────────────────────── */

.message-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-bubble {
    display: flex;
    gap: 12px;
    max-width: 85%;
}

/* User messages - right aligned */
.message-bubble.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

/* Assistant messages - left aligned */
.message-bubble.assistant {
    align-self: flex-start;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.message-bubble.user .message-avatar {
    background: var(--user-msg-bg);
    color: var(--user-msg-text);
}

.message-bubble.assistant .message-avatar {
    background: var(--accent-dim);
    color: var(--accent);
    border: 1px solid var(--accent-border);
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message-text {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 15px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.message-bubble.user .message-text {
    background: var(--user-msg-bg);
    color: var(--user-msg-text);
    border-bottom-right-radius: 4px;
}

.message-bubble.assistant .message-text {
    background: var(--bg-panel);
    color: var(--text-primary);
    border: 1px solid var(--border-soft);
    border-bottom-left-radius: 4px;
}

/* Thinking indicator */
.message-thinking {
    display: flex;
    gap: 12px;
    max-width: 85%;
    align-self: flex-start;
}

.message-thinking .message-text {
    background: var(--bg-panel);
    border: 1px solid var(--border-soft);
    color: var(--text-muted);
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
}

.thinking-dots {
    display: flex;
    gap: 4px;
}

.thinking-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    animation: thinkingBounce 1.4s ease-in-out infinite;
}

.thinking-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.thinking-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes thinkingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* ── Input Area (Fixed Bottom) ─────────────────────────────────────────── */

.chat-input-container {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 18px 0 0;
    border-top: none;
    background: transparent;
    flex-shrink: 0;
}

.status-indicator {
    font-size: 12px;
    color: var(--text-muted);
    padding: 0 2px 8px 2px;
    min-height: 20px;
}

.status-indicator.typing {
    color: var(--accent);
}

.status-indicator.error {
    color: var(--danger-text);
}

.chat-input-form {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.status-indicator,
.chat-input-form,
.chat-footer-note {
    width: min(100%, 980px);
    margin: 0 auto;
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-radius: 24px;
    border: 1px solid var(--border-soft);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.03), transparent 46%),
        var(--bg-panel);
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    box-shadow: 0 16px 34px rgba(0,0,0,0.14);
}

.chat-input-wrapper:focus-within {
    border-color: var(--accent-border);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    resize: none;
    min-height: 24px;
    max-height: 200px;
    line-height: 1.5;
    padding: 0;
}

.chat-input::placeholder {
    color: var(--text-muted);
}

/* Auto-grow textarea */
.chat-input {
    overflow-y: hidden;
}

.send-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: var(--accent);
    color: white;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

.send-button:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.send-button svg {
    transform: translateX(1px);
}

.chat-footer-note {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    padding: 12px 0 0 0;
    opacity: 0.5;
    line-height: 1.4;
}

/* ── Mobile Adjustments ────────────────────────────────────────────────── */

@media (max-width: 768px) {
    /* Fix mobile viewport — prevent body bounce scroll without breaking layout */
    body, html {
        overflow: hidden;
        height: 100%;
        overscroll-behavior: none;
    }
    
    .app-root {
        height: 100vh;
        height: 100dvh; /* Use dynamic viewport height for mobile browsers */
        overflow: hidden;
    }
    
    /* Chat pane takes full viewport on mobile */
    #pane-chat {
        height: 100%;
        max-height: 100vh;
        max-height: 100dvh;
    }
    
    .chat-header {
        padding: 0;
        flex-shrink: 0;
    }

    .chat-header-shell {
        padding: 16px;
        border-radius: 18px;
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }

    .chat-brand-lockup {
        gap: 10px;
    }
    
    .chat-messages {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        padding: 12px 0 16px;
    }
    
    .chat-input-container {
        padding: 10px 0 0;
        flex-shrink: 0;
    }

    .chat-title {
        font-size: 22px;
    }

    .chat-subtitle {
        font-size: 12px;
    }

    .chat-status-chip {
        display: none;
    }

    .chat-header-right {
        justify-content: flex-end;
    }

    .new-chat-btn span {
        display: none; /* Hide "New Chat" text, keep icon */
    }

    .new-chat-btn {
        padding: 8px;
        width: 36px;
        justify-content: center;
    }

    .message-bubble {
        max-width: 92%;
    }

    .message-avatar {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .message-text {
        font-size: 14px;
        padding: 10px 14px;
    }

    .chat-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .chat-welcome {
        width: 100%;
    }

    .chat-hero-card {
        grid-template-columns: 1fr;
        padding: 18px;
        border-radius: 18px;
    }

    .chat-hero-copy h2 {
        font-size: 26px;
        max-width: none;
    }

    .welcome-examples {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .example-prompt {
        min-height: 0;
        padding: 14px 16px;
        font-size: 13px;
    }

    .status-indicator,
    .chat-input-form,
    .chat-footer-note {
        width: 100%;
    }
}

/* ── Hide old chat UI when using modern interface ──────────────────────── */

#section-chat.modern-chat .panel-header,
#section-chat.modern-chat .question-form,
#section-chat.modern-chat .helper-text,
#section-chat.modern-chat .panel-footer-note {
    display: none;
}

/* ══════════════════════════════════════════════════════════════════════════
   MODAL (New Chat Confirmation)
   ══════════════════════════════════════════════════════════════════════════ */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 12px 0;
}

.modal-message {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0 0 20px 0;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid var(--border-soft);
    transition: all 0.15s;
}

.modal-btn-secondary {
    background: transparent;
    color: var(--text-primary);
}

.modal-btn-secondary:hover {
    background: var(--bg-panel);
}

.modal-btn-primary {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.modal-btn-primary:hover {
    background: var(--accent-hover);
}

/* ══════════════════════════════════════════════════════════════════════════
   CHATGPT-STYLE INPUT BOX
   ══════════════════════════════════════════════════════════════════════════ */

.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-radius: 24px;
    border: 1px solid var(--border-soft);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.03), transparent 46%),
        var(--bg-panel);
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    box-shadow: 0 16px 34px rgba(0,0,0,0.14);
}

[data-theme="light"] .chat-input-wrapper {
    background: var(--bg-input);
    border-color: var(--border-soft);
    box-shadow: 0 0 0 1px transparent;
}

.chat-input-wrapper:focus-within {
    border-color: var(--accent-border);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.input-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

.input-action-btn:hover {
    background: var(--accent-dim);
    color: var(--accent);
}

.welcome-logo {
    width: 52px;
    height: 52px;
    object-fit: contain;
    border-radius: 14px;
    box-shadow: 0 12px 26px rgba(0,0,0,0.18);
}

[data-theme="light"] .chat-header-shell {
    border-color: var(--border-soft);
    background:
        linear-gradient(135deg, rgba(43,125,233,0.07), rgba(43,125,233,0.02) 45%, transparent 100%),
        linear-gradient(180deg, rgba(255,255,255,0.96), rgba(247,247,248,0.96)),
        var(--bg-card);
    box-shadow: 0 18px 34px rgba(15,23,42,0.08);
}

[data-theme="light"] .chat-status-chip,
[data-theme="light"] .new-chat-btn,
[data-theme="light"] .chat-metric {
    border-color: var(--border-soft);
    background: var(--bg-card);
    color: var(--text-secondary);
}

[data-theme="light"] .chat-hero-card {
    border-color: var(--border-soft);
    background:
        radial-gradient(circle at top right, rgba(43,125,233,0.09), transparent 24%),
        linear-gradient(180deg, rgba(255,255,255,0.98), rgba(247,247,248,0.96)),
        var(--bg-card);
    box-shadow: 0 18px 34px rgba(15,23,42,0.08);
}

[data-theme="light"] .example-prompt {
    border-color: var(--border-soft);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.98), rgba(247,247,248,0.96)),
        var(--bg-card);
    color: var(--text-primary);
    box-shadow: 0 14px 26px rgba(15,23,42,0.06);
}

[data-theme="light"] .example-prompt:hover {
    background:
        linear-gradient(180deg, rgba(43,125,233,0.06), rgba(255,255,255,0.98)),
        var(--bg-card);
    color: var(--text-primary);
}

[data-theme="light"] .chat-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
}

/* Auth page logo */
.auth-logo {
    text-align: center;
    margin-bottom: 20px;
}

.auth-logo-img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 16px;
}

/* ══════════════════════════════════════════════════════════════════════════
   WEATHER VERIFICATION MAP
   ══════════════════════════════════════════════════════════════════════════ */

/* Full-width pane — no content-panel alongside it */
#pane-dictionary {
    gap: 0;
}

#pane-weatherverify,
#pane-weatheralerts {
    padding: 0;
    overflow: hidden;
}

/* Two-column shell: narrow form on left, map+results on right */
.wm-shell {
    display: flex;
    flex-direction: row;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

/* ── Left: form column ────────────────────────────────────────────────────── */
.wm-form-col {
    width: 260px;
    flex-shrink: 0;
    background: var(--bg-panel);
    border-right: 1px solid var(--border-hard);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 16px 16px;
    gap: 0;
}

.wm-form-col::-webkit-scrollbar       { width: 4px; }
.wm-form-col::-webkit-scrollbar-track { background: transparent; }
.wm-form-col::-webkit-scrollbar-thumb { background: #4c566a; border-radius: 2px; }

.wm-form-header { margin-bottom: 18px; }

/* ── Weather Map sidebar section layout ──────────────────────────────────── */
#section-weatherverify .wm-sidebar-scroll,
#section-weatheralerts .wm-sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 16px 16px;
}
#section-weatherverify .wm-sidebar-scroll::-webkit-scrollbar,
#section-weatheralerts .wm-sidebar-scroll::-webkit-scrollbar       { width: 4px; }
#section-weatherverify .wm-sidebar-scroll::-webkit-scrollbar-track,
#section-weatheralerts .wm-sidebar-scroll::-webkit-scrollbar-track { background: transparent; }
#section-weatherverify .wm-sidebar-scroll::-webkit-scrollbar-thumb,
#section-weatheralerts .wm-sidebar-scroll::-webkit-scrollbar-thumb { background: #4c566a; border-radius: 2px; }

/* ── War Monitor sidebar fills panel section ─────────────────────────────── */
#section-warmonitor .war-sidebar-v9 { height: 100%; }

/* ── Crime Map sidebar section layout ────────────────────────────────────── */
#section-crimemap .cm-sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 16px 16px;
}
#section-crimemap .cm-sidebar-scroll::-webkit-scrollbar       { width: 4px; }
#section-crimemap .cm-sidebar-scroll::-webkit-scrollbar-track { background: transparent; }
#section-crimemap .cm-sidebar-scroll::-webkit-scrollbar-thumb { background: #4c566a; border-radius: 2px; }

/* ── Right col as direct pane child (no .wm-shell wrapper) ───────────────── */
#pane-weatherverify,
#pane-weatheralerts,
#pane-warmonitor,
#pane-crimemap { gap: 0; }

#pane-weatherverify > .wm-right-col,
#pane-weatheralerts > .wm-right-col,
#pane-warmonitor > .war-right-col,
#pane-crimemap > .cm-right-col {
    flex: 1;
    min-height: 0;
}

/* Contain map overlay stacking so tiles/markers cannot bleed over nearby UI */
.wm-right-col,
.war-right-col,
.cm-right-col,
.cm-map-area,
#pane-warmonitor .war-map-area {
    isolation: isolate;
}

.wm-form-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 3px;
}

.wm-form-sub {
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.4;
}

.wm-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 12px;
}

.wm-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.wm-input {
    width: 100%;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    padding: 9px 10px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    -webkit-appearance: none;
    appearance: none;
}

.wm-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238892a0' stroke-width='2' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
    cursor: pointer;
}

[data-theme="light"] .wm-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

.wm-input:focus { border-color: var(--accent-border); box-shadow: 0 0 0 3px var(--accent-dim); }
.wm-input::placeholder { color: #616e7e; }

.wm-suggestions {
    display: none;
    margin-top: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
}

.wm-suggestions.open {
    display: block;
}

.wm-suggest-item {
    width: 100%;
    display: block;
    padding: 10px 12px;
    border: 0;
    border-bottom: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    font: inherit;
    font-size: 12.5px;
    line-height: 1.4;
    transition: background 0.15s ease, color 0.15s ease;
}

.wm-suggest-item:last-child {
    border-bottom: none;
}

.wm-suggest-item:hover,
.wm-suggest-item.active {
    background: var(--accent-dim);
    color: var(--accent);
}

input[type="date"].wm-input::-webkit-calendar-picker-indicator {
    filter: invert(0.5); cursor: pointer;
}
[data-theme="light"] input[type="date"].wm-input::-webkit-calendar-picker-indicator {
    filter: none;
}

.wm-btn-search {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px 14px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    margin-bottom: 10px;
}
.wm-btn-search:hover:not(:disabled) { background: var(--accent-hover); }
.wm-btn-search:disabled { opacity: 0.5; cursor: default; }

.wm-status {
    font-size: 11.5px;
    color: var(--text-muted);
    min-height: 16px;
    line-height: 1.4;
    text-align: center;
}
.wm-status.error   { color: var(--danger-text); }
.wm-status.loading { animation: pulse 1.4s ease-in-out infinite; }

/* Station info after search */
.wm-station-info {
    background: var(--accent-dim);
    border: 1px solid var(--accent-border);
    border-radius: 8px;
    padding: 8px 10px;
    margin-top: 12px;
}
.wm-stn-name { font-size: 12px; font-weight: 600; color: var(--accent-text); line-height: 1.3; }
.wm-stn-meta { font-size: 10px; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }

/* Event badges in sidebar */
.wm-events-sidebar {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 10px;
}

/* Badge component */
.wm-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid transparent;
}
.wm-badge-severe    { background: rgba(191,97,106,0.18);  border-color: rgba(191,97,106,0.5);  color: #f4a7ab; }
.wm-badge-confirmed { background: rgba(163,190,140,0.18); border-color: rgba(163,190,140,0.5); color: #b5d6a0; }
.wm-badge-possible  { background: rgba(235,203,139,0.18); border-color: rgba(235,203,139,0.45);color: #f0d9a0; }
.wm-badge-unlikely  { background: var(--hover-bg);        border-color: var(--border-subtle);  color: var(--text-muted); }

[data-theme="light"] .wm-badge-severe    { background:#fff0f0; border-color:#ef4444; color:#dc2626; }
[data-theme="light"] .wm-badge-confirmed { background:#f0faf0; border-color:#22c55e; color:#166534; }
[data-theme="light"] .wm-badge-possible  { background:#fffbea; border-color:#f59e0b; color:#92400e; }
[data-theme="light"] .wm-badge-unlikely  { background:#f7f7f8; border-color:#e0e0e0; color:#666;    }

/* ── Right: map + results column ──────────────────────────────────────────── */
.wm-right-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    padding: 0;
    gap: 0;
}

.wm-right-col::-webkit-scrollbar       { width: 4px; }
.wm-right-col::-webkit-scrollbar-track { background: transparent; }
.wm-right-col::-webkit-scrollbar-thumb { background: #4c566a; border-radius: 2px; }

/* The key fix: explicit pixel height so OpenLayers can render */
.wm-map {
    flex: 1 1 auto;
    min-height: 180px;
    width: 100%;
    overflow: hidden;
    background: #dde4e8;
}

/* OpenLayers viewport must fill the container */
#wv-map,
#wa-map,
.wm-map .ol-viewport {
    height: 100% !important;
    width: 100%;
}

/* Results panel */
.wm-results {
    flex: 0 0 260px;
    min-height: 90px;
    display: flex;
    flex-direction: column;
    overflow: auto;
}

/* ── Alerts pane: expand map to fill right column ─────────────────────── */
#pane-weatheralerts .wm-map {
    flex: 1;
    height: auto;
    min-height: 400px;
}
#pane-weatheralerts #wa-map,
#pane-weatheralerts .wm-map .ol-viewport {
    height: 100% !important;
}

/* ── Map area wrapper (wraps map + floating filter) ───────────────────── */
.wm-map-area {
    position: relative;
    flex: 1 1 auto;
    min-height: 180px;
    width: 100%;
    overflow: hidden;
    background: #dde4e8;
}

.wm-map-area .wm-map,
.wm-map-area #wv-map,
.wm-map-area #wa-map,
.wm-map-area .ol-viewport {
    position: absolute !important;
    top: 0; left: 0; right: 0; bottom: 0;
    height: 100% !important;
    width: 100% !important;
}

/* OpenLayers popup shell */
.ol-popup {
    position: absolute;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
    padding: 10px 12px 10px 12px;
    min-width: 180px;
    max-width: 320px;
    pointer-events: auto;
    z-index: 1100;
}
.ol-popup:after,
.ol-popup:before {
    top: 100%;
    border: solid transparent;
    content: " ";
    height: 0;
    width: 0;
    position: absolute;
    pointer-events: none;
}
.ol-popup:after {
    border-top-color: var(--bg-card);
    border-width: 8px;
    left: 50%;
    margin-left: -8px;
}
.ol-popup:before {
    border-top-color: var(--border-soft);
    border-width: 9px;
    left: 50%;
    margin-left: -9px;
}
.ol-popup-closer {
    position: absolute;
    top: 4px;
    right: 6px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 18px;
    line-height: 1;
}
.ol-popup-content {
    padding-right: 18px;
    font-size: 12px;
    line-height: 1.45;
}
.ol-popup-content strong {
    color: var(--text-primary);
}

/* Expand map area to fill alerts pane */
#pane-weatheralerts .wm-map-area {
    flex: 1;
    height: auto;
    min-height: 400px;
}

/* ── Floating peril filter (over the map in alerts pane) ───────────────── */
.ce-filter-float {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1000;
    transition: right 0.25s ease;
    background: var(--bg-card, rgba(30, 32, 40, 0.92));
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    min-width: 180px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Shift peril filter left when fire detail panel is open */
.wm-map-area:has(.fire-detail-panel.open) .ce-filter-float {
    right: 372px;
}

/* ── Weather event timeline in sidebar ──────────────────────────────────── */
.ce-event-list {
    flex: 1;
    overflow-y: auto;
    margin: 0 -8px;        /* bleed to panel edge */
}

.ce-event-list::-webkit-scrollbar       { width: 4px; }
.ce-event-list::-webkit-scrollbar-track { background: transparent; }
.ce-event-list::-webkit-scrollbar-thumb { background: #4c566a; border-radius: 2px; }

.ce-ev-empty {
    padding: 20px 8px;
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

/* Group header */
.ce-ev-group-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 8px;
    cursor: pointer;
    background: var(--bg-panel-soft);
    border-bottom: 1px solid var(--border-hard);
    border-top: 1px solid var(--border-hard);
    position: sticky;
    top: 0;
    z-index: 1;
    user-select: none;
}

.ce-ev-group-header:first-child {
    border-top: none;
}

.ce-ev-group-icon {
    font-size: 13px;
    flex-shrink: 0;
    line-height: 1;
}

.ce-ev-group-label {
    flex: 1;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.ce-ev-group-count {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--border-soft);
    padding: 1px 6px;
    border-radius: 999px;
}

.ce-ev-group-toggle {
    font-size: 10px;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: transform 0.15s;
}

/* Group body */
.ce-ev-group-body {
    /* expanded by default */
}

.ce-ev-group-body.collapsed {
    display: none;
}

/* Event row */
.ce-ev-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    transition: background 0.12s;
}

.ce-ev-row:hover {
    background: var(--hover-bg, rgba(255, 255, 255, 0.04));
}

.ce-ev-row.active {
    background: var(--active-bg, rgba(99, 102, 241, 0.08));
    border-left: 3px solid var(--accent);
    padding-left: 7px;
}

.ce-ev-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.ce-ev-body {
    flex: 1;
    min-width: 0;
}

.ce-ev-headline {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.35;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.ce-ev-area {
    font-size: 10.5px;
    color: var(--text-muted);
    margin-top: 2px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Severity badge */
.ce-sev-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    background: var(--border-soft);
    color: var(--text-muted);
    flex-shrink: 0;
}

.ce-sev-extreme {
    background: rgba(191, 97, 106, 0.2);
    color: #bf616a;
}
.ce-sev-severe {
    background: rgba(235, 203, 139, 0.2);
    color: #ebcb8b;
}
.ce-sev-moderate {
    background: rgba(99, 179, 237, 0.15);
    color: #63b3ed;
}

[data-theme="light"] .ce-sev-extreme  { background: #fff0f0; color: #dc2626; }
[data-theme="light"] .ce-sev-severe   { background: #fffbeb; color: #b45309; }
[data-theme="light"] .ce-sev-moderate { background: #eff6ff; color: #2563eb; }

/* Empty state */
.wm-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    opacity: 0.4;
    flex: 1;
}
.wm-empty p { font-size: 13px; line-height: 1.6; max-width: 260px; }

/* Result block */
.wm-result-block { display: flex; flex-direction: column; gap: 0; }

.wm-section-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.wm-summary-box {
    background: var(--bg-panel);
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    padding: 10px 13px;
}
.wm-summary-box p { font-size: 12.5px; line-height: 1.65; color: var(--text-primary); margin: 0; }

.wm-event-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    padding: 9px 12px;
    margin-top: 6px;
}
.wm-event-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 5px;
}
.wm-event-name { font-size: 12px; font-weight: 600; color: var(--text-primary); }

.wm-notes { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.wm-notes li {
    font-size: 11.5px; color: var(--text-muted); line-height: 1.4;
    padding-left: 12px; position: relative;
}
.wm-notes li::before { content: '·'; position: absolute; left: 2px; color: var(--accent); font-weight: bold; }

/* Hourly table */
.wm-table-wrap {
    margin-top: 6px;
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border-soft);
}
.wm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    min-width: 440px;
}
.wm-table th {
    color: var(--text-muted); font-weight: 600; text-align: left;
    padding: 6px 8px; border-bottom: 1px solid var(--border-soft);
    background: var(--bg-panel); white-space: nowrap;
    position: sticky; top: 0; z-index: 1;
}
.wm-table td {
    color: var(--text-primary); padding: 5px 8px;
    border-bottom: 1px solid var(--border-subtle); white-space: nowrap;
}
.wm-table tr:last-child td { border-bottom: none; }
.wm-table tbody tr:hover td { background: var(--hover-bg); }

/* Flag dots */
.wm-dot {
    display: inline-block; width: 6px; height: 6px;
    border-radius: 50%; margin-right: 3px; vertical-align: middle;
}
.dot-wind { background: #bf616a; }
.dot-rain { background: #5e81ac; }
.dot-snow { background: #88c0d0; }
.dot-hail { background: #d08770; }

.wm-attribution {
    font-size: 10px; color: var(--text-muted); opacity: 0.45;
    text-align: right; padding-top: 8px;
}

/* Copy button — floats inside right col */
.wm-copy-btn {
    position: absolute;
    top: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    background: var(--bg-panel);
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    z-index: 5;
}
.wm-copy-btn:hover {
    background: var(--accent-dim);
    border-color: var(--accent-border);
    color: var(--accent-text);
}

/* ── Mobile ───────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .wm-shell {
        flex-direction: column;
        overflow-y: auto;
    }

    .wm-form-col {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-hard);
        overflow-y: visible;
        flex-shrink: 0;
    }

    .wm-right-col {
        padding: 12px 14px;
        flex-shrink: 0;
        min-height: 0;
    }

    .wm-map,
    #wv-map,
    #wa-map,
    .wm-map .ol-viewport {
        height: 200px !important;
    }

    .wm-copy-btn { top: 14px; right: 14px; }

    .wm-table th:nth-child(n+6),
    .wm-table td:nth-child(n+6) { display: none; }

    /* Alerts pane: override the 400px min-height so map fits on screen */
    #pane-weatheralerts .wm-map-area {
        min-height: 220px;
    }
    #pane-weatheralerts .wm-map {
        min-height: 220px;
    }
    #pane-weatheralerts #wa-map,
    #pane-weatheralerts .wm-map .ol-viewport {
        min-height: 220px !important;
    }

    /* Floating filter: smaller positioning on mobile */
    .ce-filter-float {
        top: 8px;
        right: 8px;
        min-width: 150px;
    }
}

.wm-field-tip {
    font-size: 10.5px;
    color: var(--text-muted);
    opacity: 0.65;
    line-height: 1.4;
    margin-top: 2px;
}


/* ══════════════════════════════════════════════════════════════════════════
   AI INTELLIGENCE ASSESSMENT BLOCK (collapsible)
   ══════════════════════════════════════════════════════════════════════════ */

/* Outer wrapper — sits after hourly table inside .wm-results */
.wm-intel-block {
    margin-top: 14px;
    border-radius: 10px;
    border: 1px solid var(--accent-border);
    background: var(--bg-panel);
    overflow: hidden;
    flex-shrink: 0;
}

/* ── Toggle button (the always-visible header) ────────────────────────────── */
.wm-intel-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 14px;
    background: var(--accent-dim);
    border: none;
    border-bottom: 1px solid var(--accent-border);
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: background 0.15s;
}

.wm-intel-toggle:hover {
    background: rgba(136,192,208,0.18);
}

[data-theme="light"] .wm-intel-toggle:hover {
    background: rgba(43,125,233,0.12);
}

.wm-intel-toggle-left {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-text);
    letter-spacing: 0.01em;
}

.wm-intel-toggle-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.wm-intel-badge {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    padding: 2px 8px;
    white-space: nowrap;
}

/* Chevron rotates when collapsed */
.wm-intel-chevron {
    color: var(--text-muted);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.wm-intel-toggle[aria-expanded="false"] .wm-intel-chevron {
    transform: rotate(180deg);
}

/* ── Collapsible content panel ────────────────────────────────────────────── */
.wm-intel-content {
    display: block; /* starts open */
}

/* Assessment text */
.wm-intel-body {
    padding: 12px 14px 8px;
    font-size: 12.5px;
    line-height: 1.72;
    color: var(--text-primary);
}

.wm-intel-body p {
    margin: 0 0 10px 0;
}
.wm-intel-body p:last-child { margin-bottom: 0; }

.wm-intel-body strong {
    color: var(--text-primary);
    font-weight: 700;
}

/* News sources sub-section */
.wm-intel-news {
    border-top: 1px solid var(--border-subtle);
    padding: 9px 14px 12px;
}

.wm-intel-news-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 7px;
}

.wm-intel-news-empty {
    font-size: 11.5px;
    color: var(--text-muted);
    opacity: 0.6;
    font-style: italic;
}

.wm-news-item {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 5px 5px;
    border-bottom: 1px solid var(--border-subtle);
    text-decoration: none;
    border-radius: 5px;
    margin: 0 -5px;
    transition: background 0.12s;
}
.wm-news-item:last-child { border-bottom: none; }
.wm-news-item:hover { background: var(--hover-bg); }

.wm-news-source {
    font-size: 10px;
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 72px;
    max-width: 105px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wm-news-title {
    font-size: 11.5px;
    color: var(--text-primary);
    line-height: 1.35;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.wm-news-date {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: normal;
    margin-left: 2px;
}

/* Loading state */
.wm-intel-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}

.wm-intel-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-soft);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: wmSpin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes wmSpin { to { transform: rotate(360deg); } }

/* Error state */
.wm-intel-error {
    padding: 12px 14px;
    font-size: 12px;
    color: var(--danger-text);
    line-height: 1.5;
}

/* Light theme */
[data-theme="light"] .wm-intel-block   { border-color: var(--accent-border); background: #f9fbff; }
[data-theme="light"] .wm-intel-body    { color: #1f1f1f; }
[data-theme="light"] .wm-news-title    { color: #1f1f1f; }


/* Panel content visibility */
.wm-panel-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* ══════════════════════════════════════════════════════════════════════════
   CURRENT EVENTS – Peril Checkbox List
   ══════════════════════════════════════════════════════════════════════════ */

.ce-last-updated {
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0.6;
    margin-bottom: 10px;
    text-align: center;
}

.ce-peril-actions {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
}
.ce-toggle-btn {
    flex: 1;
    padding: 5px 0;
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    background: var(--bg-input);
    color: var(--text-secondary);
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s;
}
.ce-toggle-btn:hover {
    background: var(--accent-dim);
    color: var(--accent);
    border-color: var(--accent-border);
}

.ce-peril-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    overflow-y: auto;
}

/* ── Individual peril row ───────────────────────────────────────────────── */
.ce-peril-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 8px;
    border-radius: 7px;
    cursor: pointer;
    transition: background 0.12s;
    user-select: none;
}

.ce-peril-row:hover {
    background: var(--hover-bg);
}

.ce-peril-row input[type="checkbox"] {
    display: none;
}

/* Custom checkbox */
.ce-check {
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--border-soft);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
    background: var(--bg-input);
}

.ce-peril-row input:checked ~ .ce-check {
    background: var(--accent);
    border-color: var(--accent);
}

.ce-check-icon {
    display: none;
    width: 10px;
    height: 10px;
}

.ce-peril-row input:checked ~ .ce-check .ce-check-icon {
    display: block;
}

/* Peril label */
.ce-peril-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
    line-height: 1.2;
}

/* Count badge */
.ce-count {
    font-size: 10px;
    font-weight: 700;
    min-width: 20px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 0 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    color: var(--text-muted);
    flex-shrink: 0;
}

.ce-count.has-alerts {
    background: var(--accent-dim);
    border-color: var(--accent-border);
    color: var(--accent-text);
}

/* ── Attribution ────────────────────────────────────────────────────────── */
.ce-attribution {
    font-size: 9.5px;
    color: var(--text-muted);
    opacity: 0.55;
    text-align: center;
    padding: 10px 0 2px;
    line-height: 1.4;
    flex-shrink: 0;
}

.ce-attribution a {
    color: var(--accent);
    text-decoration: none;
}

.ce-attribution a:hover {
    text-decoration: underline;
}

/* ── Alert popups ───────────────────────────────────────────────────────── */
.ce-popup-title {
    font-weight: 700;
    font-size: 12px;
    margin-bottom: 4px;
    color: #2e3440;
}

.ce-popup-detail {
    font-size: 11px;
    color: #4c566a;
    line-height: 1.45;
}

.ce-popup-severity {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1px 6px;
    border-radius: 3px;
    margin-bottom: 4px;
}

/* ── Mobile responsive ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .ce-peril-row {
        padding: 6px 6px;
    }
}

/* ══════════════════════════════════════════════════════════════════════════
   FIRE DETAIL PANEL (slide-in over map right edge)
   ══════════════════════════════════════════════════════════════════════════ */

.fire-detail-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 360px;
    height: 100%;
    background: var(--bg-card);
    border-left: 1px solid var(--border-soft);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.25);
    z-index: 800;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.25s ease;
}

.fire-detail-panel.open {
    transform: translateX(0);
}

.fire-detail-close {
    position: sticky;
    top: 0;
    float: right;
    background: var(--bg-panel);
    border: 1px solid var(--border-soft);
    color: var(--text-secondary);
    font-size: 20px;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 12px 12px 0 0;
    z-index: 1;
    transition: background 0.15s;
}
.fire-detail-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.fire-detail-content {
    padding: 16px 20px 24px;
}

.fd-header {
    margin-bottom: 16px;
}

.fd-peril-icon {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}

.fd-fire-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px;
    line-height: 1.3;
}

.fd-location {
    font-size: 12.5px;
    color: var(--text-secondary);
    margin: 0;
}

.fd-risk-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 3px 10px;
    border-radius: 4px;
    margin-top: 8px;
}
.fd-risk-low      { background: rgba(56, 161, 105, 0.15); color: #38a169; }
.fd-risk-moderate { background: rgba(236, 201, 75, 0.2);  color: #d69e2e; }
.fd-risk-high     { background: rgba(221, 107, 32, 0.2);  color: #dd6b20; }
.fd-risk-critical { background: rgba(229, 62, 62, 0.2);   color: #e53e3e; }

.fd-section {
    margin-top: 16px;
}

.fd-section-title {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin: 0 0 8px;
}

.fd-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.fd-stat {
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 10px 12px;
}

.fd-stat-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.fd-stat-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 2px;
}

.fd-community-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.fd-community {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 12.5px;
}
.fd-community:last-child { border-bottom: none; }

.fd-community-name {
    color: var(--text-primary);
    font-weight: 500;
}

.fd-community-dist {
    color: var(--text-muted);
    font-size: 11px;
    white-space: nowrap;
}

.fd-ai-summary {
    font-size: 12.5px;
    line-height: 1.65;
    color: var(--text-secondary);
}

.fd-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 13px;
    gap: 12px;
}

.fd-spinner {
    width: 24px;
    height: 24px;
    border: 2.5px solid var(--border-soft);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: fd-spin 0.7s linear infinite;
}

@keyframes fd-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    .fire-detail-panel {
        width: 100%;
    }
}

/* ══════════════════════════════════════════════════════════════════════════
   AGREEMENT GATE
   ══════════════════════════════════════════════════════════════════════════ */

/* Dim all nav items and new-chat button until user agrees */
body.pending-agreement .nav-item,
body.pending-agreement .new-chat-btn,
body.pending-agreement .chat-input-container {
    pointer-events: none;
    opacity: 0.35;
    cursor: not-allowed;
}

/* Agreement modal overlay */
.agree-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: agree-fade-in 0.3s ease;
}

@keyframes agree-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.agree-overlay-box {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    padding: 36px 52px;
    text-align: center;
    font-size: 15px;
    color: var(--text-primary);
    max-width: 420px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* Agreement modal content */
.agree-modal {
    max-width: 540px;
    text-align: left;
    padding: 32px 36px;
}

.agree-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.agree-modal-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.agree-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.agree-modal-body {
    font-size: 13.5px;
    line-height: 1.65;
    color: var(--text-secondary);
    max-height: 50vh;
    overflow-y: auto;
}

.agree-modal-body p {
    margin: 0 0 12px;
}

.agree-modal-body ul {
    margin: 0 0 16px;
    padding-left: 20px;
}

.agree-modal-body li {
    margin-bottom: 10px;
}

.agree-modal-body li strong {
    color: var(--text-primary);
}

.agree-modal-age {
    text-align: center;
    color: var(--text-primary);
    margin-top: 8px;
}

.agree-modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    justify-content: center;
}

.agree-btn {
    padding: 10px 28px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border-soft);
    transition: background 0.15s, opacity 0.15s;
}

.agree-btn-accept {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.agree-btn-accept:hover {
    opacity: 0.85;
}

.agree-btn-decline {
    background: transparent;
    color: var(--text-secondary);
}

.agree-btn-decline:hover {
    background: var(--bg-hover);
}

@media (max-width: 480px) {
    .agree-modal {
        padding: 24px 20px;
        max-width: 92vw;
        border-radius: 10px;
    }
    .agree-modal-body { font-size: 13px; }
    .agree-modal-actions { flex-direction: column; }
    .agree-btn { width: 100%; text-align: center; }
}
