/* ============================================================
   KAAI Agency Dashboard — Dark Command Center
   Styles for DashboardPanel.js
   ============================================================ */

/* ─── Scope: override light-theme panel-container defaults ── */
#panel-dashboard {
    background: var(--bg-primary, #0d0d0d);
    color: var(--text-primary, #eeeeee);
    padding: 0;
    min-height: 100%;
}

#panel-dashboard .panel-header {
    background: var(--bg-secondary, #141414);
    border-bottom: 1px solid var(--border-color, #2a2a2a);
    padding: 12px 24px;
    margin-bottom: 0;
}

#panel-dashboard .panel-header h2 {
    color: var(--text-primary, #eeeeee);
    font-size: 1.1rem;
}

#panel-dashboard .mode-label,
#panel-dashboard .mode-description {
    color: var(--text-primary, #eeeeee);
}

#panel-dashboard .mode-toggle {
    background: var(--bg-card, #1a1a1a);
    border-color: var(--border-color, #2a2a2a);
}

#panel-dashboard .mode-btn {
    color: var(--text-muted, #555);
}

#panel-dashboard .mode-btn:hover {
    background: var(--bg-hover, #222);
    color: var(--text-primary, #eee);
}

/* ─── Panel padding wrapper ──────────────────────────────── */
.dash-panel-body {
    padding: 20px 24px;
}

/* ─── Wrapper ─────────────────────────────────────────────── */
.dash-wrapper {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 0 0 24px 0;
    background: var(--bg-primary);
    min-height: 100%;
}

/* ─── Section headings ─────────────────────────────────────── */
.dash-section { display: flex; flex-direction: column; }

.dash-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.dash-section-title {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.dash-section-header .dash-section-title { margin-bottom: 0; }

.dash-section-ts {
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0.6;
}

/* ─── Process Monitor Grid ─────────────────────────────────── */
.dash-proc-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}
@media (max-width: 1100px) { .dash-proc-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 700px)  { .dash-proc-grid { grid-template-columns: repeat(3, 1fr); } }

/* ─── Bridges Grid (DEV-2026-0503-076) ────────────────────────── */
.dash-bridges-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
@media (max-width: 700px) { .dash-bridges-grid { grid-template-columns: 1fr; } }

.dash-bridge-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 4px solid #666;
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.bridge-card-top {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.92em;
    font-weight: 600;
}
.bridge-icon { font-size: 0.95em; }
.bridge-name { color: var(--text-primary, #ddd); }
.bridge-detail {
    font-size: 0.8em;
    color: var(--text-muted, #888);
}
.bridge-foot {
    font-size: 0.72em;
    color: var(--text-muted, #666);
    align-self: flex-end;
}

.dash-proc-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    cursor: default;
    transition: border-color 0.2s, box-shadow 0.2s;
    user-select: none;
    min-width: 0;
}
.dash-proc-card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent-muted, #4a9eff22);
}
.status-bg-ok      { border-left: 3px solid #10b98155; }
.status-bg-working { border-left: 3px solid #60a5fa55; }
.status-bg-idle    { border-left: 3px solid #f59e0b55; }
.status-bg-down    { border-left: 3px solid #ef444455; }
/* backward compat */
.status-bg-degraded { border-left: 3px solid #f59e0b55; }

.dash-proc-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}
.dash-proc-icon { font-size: 18px; line-height: 1; }

.dash-proc-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dash-proc-role {
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dash-proc-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
}
.dash-proc-port {
    font-size: 10px;
    color: var(--accent, #4a9eff);
    font-family: monospace;
    opacity: 0.8;
}
.dash-proc-lat {
    font-size: 10px;
    color: var(--text-muted);
}
.dash-proc-status-label {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    margin-top: 2px;
}
.proc-status-ok      { color: #10b981; }
.proc-status-working { color: #60a5fa; }
.proc-status-idle    { color: #f59e0b; }
.proc-status-down    { color: #ef4444; }
/* backward compat */
.proc-status-degraded { color: #f59e0b; }
.proc-status-unknown  { color: #ef4444; }

/* ─── Quick Actions Row ────────────────────────────────────── */
.dash-shortcuts-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.dash-shortcut-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    padding: 8px 16px;
    transition: all 0.15s;
    white-space: nowrap;
}
.dash-shortcut-btn:hover {
    background: var(--bg-hover, #222);
    border-color: var(--accent, #4a9eff);
    color: var(--accent, #4a9eff);
    box-shadow: 0 0 8px var(--accent-muted, #4a9eff22);
}
.dash-shortcut-btn.primary {
    background: var(--accent-muted, #4a9eff18);
    border-color: var(--accent, #4a9eff);
    color: var(--accent, #4a9eff);
}
.dash-shortcut-btn.primary:hover {
    background: var(--accent, #4a9eff);
    color: #fff;
}

/* ─── Today's Schedule Timeline ────────────────────────────── */
.dash-schedule-date {
    font-size: 11px;
    color: var(--text-muted);
}

.dash-schedule-timeline {
    display: flex;
    align-items: stretch;
    gap: 0;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
}

.sched-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px 8px;
    min-width: 104px;
    text-align: center;
    flex-shrink: 0;
    transition: border-color 0.2s;
    position: relative;
}

.sched-done     { opacity: 0.45; }
.sched-active   { border-color: #10b981; box-shadow: 0 0 10px #10b98133; }
.sched-next     { border-color: var(--accent, #4a9eff); }
.sched-upcoming { }

.sched-time {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    font-family: monospace;
    letter-spacing: 0.04em;
}
.sched-item.sched-active .sched-time { color: #10b981; }
.sched-item.sched-next   .sched-time { color: var(--accent, #4a9eff); }

.sched-icon  { font-size: 18px; line-height: 1; }
.sched-label { font-size: 11px; color: var(--text-primary); font-weight: 500; white-space: nowrap; }

.sched-markers {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 3px;
    min-height: 20px;
}

.sched-check {
    font-size: 13px;
    color: #10b981;
    font-weight: 700;
}
.sched-next-tag {
    font-size: 9px;
    font-weight: 700;
    color: var(--accent, #4a9eff);
    letter-spacing: 0.08em;
    border: 1px solid var(--accent, #4a9eff);
    border-radius: 3px;
    padding: 1px 4px;
}

.sched-pulse {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 6px #10b981;
    animation: sched-blink 1.4s ease-in-out infinite;
}
@keyframes sched-blink {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.5; transform: scale(0.75); }
}

.sched-trigger-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 10px;
    padding: 1px 5px;
    transition: all 0.15s;
}
.sched-trigger-btn:hover {
    border-color: var(--accent, #4a9eff);
    color: var(--accent, #4a9eff);
}
.sched-trigger-btn:disabled { opacity: 0.4; cursor: default; }

.sched-arrow {
    display: flex;
    align-items: center;
    padding: 0 4px;
    color: var(--border-color, #2a2a2a);
    font-size: 18px;
    flex-shrink: 0;
    align-self: center;
}

/* ─── Agent Health Row ─────────────────────────────────────── */
.dash-agents-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.dash-agent-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    cursor: default;
    transition: border-color 0.2s, box-shadow 0.2s;
    user-select: none;
}
.dash-agent-pill:hover {
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent-muted);
}

.dash-agent-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: background 0.3s;
}
.dash-agent-dot.ok      { background: #10b981; box-shadow: 0 0 5px #10b98188; animation: dot-pulse-ok 2.5s infinite; }
.dash-agent-dot.working { background: #60a5fa; box-shadow: 0 0 6px #60a5facc; animation: dot-pulse-work 1s infinite; }
.dash-agent-dot.idle    { background: #f59e0b; box-shadow: 0 0 5px #f59e0b88; animation: dot-pulse-idle 1.5s infinite; }
.dash-agent-dot.down    { background: #ef4444; box-shadow: 0 0 5px #ef444488; }
/* backward compat */
.dash-agent-dot.degraded { background: #f59e0b; box-shadow: 0 0 5px #f59e0b88; }
.dash-agent-dot.unknown  { background: #ef4444; }

@keyframes dot-pulse-ok   { 0%,100%{opacity:1} 50%{opacity:.55} }
@keyframes dot-pulse-work { 0%,100%{box-shadow:0 0 5px #60a5facc} 50%{box-shadow:0 0 10px #60a5faff} }
@keyframes dot-pulse-idle { 0%,100%{opacity:1} 50%{opacity:.35} }

/* ── Agent Alert Strip ─────────────────────────────────────────────── */
.dash-alert-strip {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px 14px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid;
}
.dash-alert-strip.all-ok {
    background: rgba(16,185,129,.06);
    border-color: rgba(16,185,129,.2);
    color: #10b981;
}
.dash-alert-strip.has-issues {
    background: rgba(239,68,68,.06);
    border-color: rgba(239,68,68,.25);
    color: var(--text-primary, #eee);
}
.dash-alert-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .04em;
}
.dash-alert-badge.down { background: rgba(239,68,68,.18); color: #ef4444; border: 1px solid #ef444433; }
.dash-alert-badge.idle { background: rgba(245,158,11,.15); color: #f59e0b; border: 1px solid #f59e0b33; }

.dash-agent-name    { font-size: 12px; font-weight: 500; color: var(--text-primary); }
.dash-agent-latency { font-size: 10px; color: var(--text-muted); margin-left: 2px; }

/* ─── KPI Row ──────────────────────────────────────────────── */
.dash-kpi-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}
@media (max-width: 960px) { .dash-kpi-row { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .dash-kpi-row { grid-template-columns: repeat(2, 1fr); } }

.dash-kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px 12px 12px;
    text-align: center;
    cursor: default;
    transition: border-color 0.2s;
}
.dash-kpi-card:hover { border-color: var(--accent); }

.kpi-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 5px;
    transition: color 0.3s;
}
.kpi-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.kpi-value.kpi-alert { color: #f87171; }
.kpi-value.kpi-warn  { color: #f59e0b; }
.kpi-value.kpi-ok    { color: #4ade80; }

/* ─── Two-Column Main Grid ─────────────────────────────────── */
.dash-main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
@media (max-width: 820px) { .dash-main-grid { grid-template-columns: 1fr; } }

/* ─── Cards ────────────────────────────────────────────────── */
.dash-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.dash-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
}
.card-icon  { font-size: 16px; }
.card-title { font-size: 13px; font-weight: 600; color: var(--text-primary); flex: 1; }

.card-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--accent-muted);
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}
.card-badge.auto   { background: #14532d55; color: #4ade80; border: 1px solid #14532d; }
.card-badge.manual { background: #1c191555; color: #a78bfa; border: 1px solid #2e2840; }
.card-badge.ok     { background: #14532d55; color: #4ade80; border: 1px solid #14532d; }
.card-badge.down   { background: #450a0a55; color: #f87171; border: 1px solid #450a0a; }
.card-badge.unknown{ background: #1a1a1a;   color: #555;    border: 1px solid #2a2a2a; }

.card-link-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.card-link-btn:hover { border-color: var(--accent); color: var(--accent); }

.dash-card-body { padding: 14px; flex: 1; overflow: hidden; }

/* ─── Trader Widget ────────────────────────────────────────── */
.trader-stat-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}
.trader-stat {
    background: var(--bg-secondary);
    border-radius: 6px;
    padding: 10px;
}
.trader-stat-label {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 3px;
}
.trader-stat-value {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.trader-stat-value.positive { color: #4ade80; }
.trader-stat-value.negative { color: #f87171; }

/* Signal list */
.trader-signal-list {
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}
.trader-signal-row {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    gap: 6px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 12px;
}
.trader-signal-row:last-child { border-bottom: none; }
.signal-asset  { font-weight: 600; color: var(--text-primary); width: 52px; flex-shrink: 0; }
.signal-dir    { font-size: 11px; width: 60px; font-weight: 600; flex-shrink: 0; }
.signal-dir.bearish { color: #f87171; }
.signal-dir.bullish { color: #4ade80; }
.signal-dir.neutral { color: var(--text-muted); }
.signal-conviction-bar {
    flex: 1;
    height: 4px;
    background: var(--bg-secondary);
    border-radius: 2px;
    overflow: hidden;
}
.signal-conviction-fill { height: 100%; border-radius: 2px; background: var(--accent); }
.signal-conviction-fill.bearish { background: #f87171; }
.signal-conviction-fill.bullish { background: #4ade80; }
.signal-pct { color: var(--text-muted); font-size: 11px; width: 38px; text-align: right; flex-shrink: 0; }

/* Proposals widget */
.proposals-widget {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 10px;
    transition: border-color 0.3s, background 0.3s;
}
.proposals-widget.has-proposals {
    border-color: #f59e0b88;
    background: #1c140a;
}
.proposals-count         { font-size: 22px; font-weight: 700; color: var(--text-primary); min-width: 30px; }
.proposals-count.nonzero { color: #f59e0b; }
.proposals-label         { flex: 1; font-size: 12px; color: var(--text-muted); }
.proposals-action-btn {
    font-size: 11px;
    padding: 5px 12px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    background: var(--accent);
    color: white;
    transition: opacity 0.2s;
    white-space: nowrap;
}
.proposals-action-btn:hover { opacity: 0.82; }

/* ─── Analyst Widget ───────────────────────────────────────── */
.analyst-market-row {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}
.market-chip {
    flex: 1;
    background: var(--bg-secondary);
    border-radius: 6px;
    padding: 8px 8px 6px;
    text-align: center;
    min-width: 0;
}
.market-chip-symbol { font-size: 10px; color: var(--text-muted); margin-bottom: 2px; letter-spacing: 0.04em; }
.market-chip-price  { font-size: 13px; font-weight: 700; color: var(--text-primary); white-space: nowrap; }
.market-chip-change { font-size: 10px; margin-top: 1px; }
.market-chip-change.up   { color: #4ade80; }
.market-chip-change.down { color: #f87171; }

.analyst-cycle-row {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 8px;
    padding: 6px 8px;
    background: var(--bg-secondary);
    border-radius: 6px;
}
.analyst-cycle-row b { color: var(--text-primary); }

.analyst-news-list { list-style: none; margin: 0; padding: 0; }
.analyst-news-item {
    padding: 7px 0;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 12px;
    color: var(--text-primary);
    line-height: 1.4;
}
.analyst-news-item:last-child { border-bottom: none; }
.news-cat {
    font-size: 9px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-right: 5px;
}
.news-meta { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

/* ─── Activity Feed ────────────────────────────────────────── */
.dash-activity-feed {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    max-height: 220px;
    overflow-y: auto;
}
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 7px 14px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 12px;
}
.activity-item:last-child { border-bottom: none; }
.activity-time { color: var(--text-muted); font-size: 10px; width: 55px; flex-shrink: 0; padding-top: 1px; }
.activity-icon { font-size: 13px; flex-shrink: 0; }
.activity-type-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
    margin-top: 1px;
    white-space: nowrap;
}
.activity-msg { color: var(--text-primary); line-height: 1.4; word-break: break-word; }

.atype-trader   { background: #0f2e1a; color: #4ade80; }
.atype-analyst  { background: #0f1a2e; color: #818cf8; }
.atype-system   { background: #1a1a1a; color: #94a3b8; }
.atype-approval { background: #2e1a0a; color: #fb923c; }
.atype-task     { background: #0a1f2e; color: #38bdf8; }
.atype-error    { background: #2e0a0a; color: #f87171; }
.atype-memory   { background: #1a0f2e; color: #c084fc; }

/* ─── Empty / Loading states ───────────────────────────────── */
.dash-loading { color: var(--text-muted); font-size: 12px; padding: 20px; text-align: center; }
.dash-empty   { color: var(--text-muted); font-size: 12px; padding: 14px; text-align: center; }

/* ═══════════════════════════════════════════════════════════════
   Maps Row — Weather Monitor + Global Flights
   ═══════════════════════════════════════════════════════════════ */

.dash-maps-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 960px) {
    .dash-maps-grid { grid-template-columns: 1fr; }
}

/* ─── Map card container ──────────────────────────────────────── */
.dash-map-card {
    background: var(--bg-card, #1a1a1a);
    border: 1px solid var(--border-color, #2a2a2a);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    /* Square cards: height tracks column width */
    aspect-ratio: 1 / 1;
    min-height: 360px;
    max-height: 700px;
}

.dash-map-card .dash-card-header {
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color, #2a2a2a);
    background: var(--bg-secondary, #141414);
}

/* ─── Map viewport — fills remaining card height after header ─── */
.dash-map-container {
    flex: 1;
    min-height: 0;      /* allow flex child to shrink below content size */
    position: relative;
    background: #060b10;
    overflow: hidden;
}

.dash-map-container iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: none;
}

/* Leaflet container fills its parent (.dash-map-container) */
#dash-flight-map,
#dash-flight-map .leaflet-container {
    width: 100%;
    height: 100%;
    background: #060b10;
}

/* ─── Overlay / Region switcher buttons ────────────────────────── */
.map-overlay-btns {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    align-items: center;
}

.map-overlay-btn {
    background: var(--bg-tertiary, #222);
    border: 1px solid var(--border-color, #333);
    border-radius: 4px;
    color: var(--text-muted, #777);
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 9px;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.map-overlay-btn:hover {
    background: var(--bg-hover, #2a2a2a);
    color: var(--text-primary, #fff);
    border-color: var(--accent, #4a9eff);
}
.map-overlay-btn.active {
    background: var(--accent, #4a9eff);
    border-color: var(--accent, #4a9eff);
    color: #fff;
}

/* ─── Flight map timestamp ─────────────────────────────────────── */
.dash-map-ts {
    margin-left: auto;
    font-size: 10px;
    color: var(--text-muted, #555);
    white-space: nowrap;
    align-self: center;
}

/* ─── Plane marker (div icon with CSS rotation) ─────────────────── */
.flight-plane-icon {
    font-size: 13px;
    line-height: 1;
    display: block;
    width: 18px;
    height: 18px;
    text-align: center;
    /* rotation is applied inline via style="transform:rotate(Xdeg)" */
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.9), 0 0 8px rgba(0, 0, 0, 0.6);
    pointer-events: none;
    transform-origin: center center;
}

/* ─── Leaflet tooltip override for dark theme ───────────────────── */
.flight-tooltip {
    background: rgba(15, 20, 30, 0.92) !important;
    border: 1px solid var(--border-color, #333) !important;
    border-radius: 5px !important;
    color: #e8e8e8 !important;
    font-size: 11px !important;
    line-height: 1.6;
    padding: 5px 9px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5) !important;
}
.flight-tooltip::before { display: none !important; }

/* Make Leaflet zoom controls blend with dark theme */
.leaflet-control-zoom a {
    background: var(--bg-card, #1a1a1a) !important;
    border-color: var(--border-color, #333) !important;
    color: var(--text-primary, #eee) !important;
}
.leaflet-control-zoom a:hover {
    background: var(--bg-hover, #2a2a2a) !important;
}

/* ─── NOTAM Overlay ──────────────────────────────────────────────── */

/* Pulsing circle marker for each NOTAM location */
.notam-marker-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    animation: notam-pulse 2s ease-in-out infinite;
}
@keyframes notam-pulse {
    0%, 100% { opacity: 1;   transform: scale(1);    }
    50%       { opacity: 0.7; transform: scale(1.25); }
}
.notam-count {
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
    text-shadow: 0 0 3px #000;
}

/* Leaflet popup wrapper override */
.notam-popup-container .leaflet-popup-content-wrapper {
    background: rgba(15, 18, 28, 0.97) !important;
    border: 1px solid #334 !important;
    border-radius: 8px !important;
    color: #e8e8e8 !important;
    font-size: 12px !important;
    padding: 0 !important;
}
.notam-popup-container .leaflet-popup-tip {
    background: rgba(15, 18, 28, 0.97) !important;
}
.notam-popup-container .leaflet-popup-content { margin: 0 !important; }

/* Inner popup layout */
.notam-popup { max-width: 310px; }
.notam-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px 6px;
    border-bottom: 1px solid #334;
    font-size: 13px;
}
.notam-popup-count {
    font-size: 10px;
    color: #aaa;
}
.notam-popup-list {
    max-height: 200px;
    overflow-y: auto;
    padding: 4px 0;
}
.notam-popup-item {
    padding: 6px 12px;
    border-bottom: 1px solid #222;
}
.notam-popup-item:last-child { border-bottom: none; }
.notam-type-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    border-radius: 3px;
    padding: 1px 5px;
    margin-bottom: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.notam-type-tfr      { background: #ef4444; color: #fff; }
.notam-type-obstacle { background: #f97316; color: #fff; }
.notam-type-nav      { background: #06b6d4; color: #000; }
.notam-type-runway   { background: #eab308; color: #000; }
.notam-type-other    { background: #6b7280; color: #fff; }
.notam-popup-text {
    font-size: 11px;
    color: #ccc;
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-wrap;
    margin-bottom: 3px;
}
.notam-popup-dates {
    font-size: 10px;
    color: #888;
}
.notam-popup-source {
    font-size: 10px;
    color: #555;
    padding: 4px 12px;
    border-top: 1px solid #222;
}

/* NOTAM toggle button active state */
.notam-toggle-btn.active {
    background: rgba(239, 68, 68, 0.25) !important;
    border-color: #ef4444 !important;
    color: #ef4444 !important;
}

/* ─── Flight map status overlay (rate-limit / error) ────────────── */
/* Positioned absolute over the Leaflet container so it's always visible */
.flight-map-overlay {
    position: absolute;
    inset: 0;
    z-index: 800;          /* above Leaflet tiles (z-index ~400) but below Leaflet controls (z-index ~1000) */
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(6, 11, 16, 0.72);
    pointer-events: none;
}
.flight-map-overlay-box {
    pointer-events: all;
    background: rgba(15, 18, 28, 0.95);
    border: 1px solid #fbbf2455;
    border-radius: 10px;
    padding: 18px 28px;
    text-align: center;
    color: #fbbf24;
    font-size: 14px;
    line-height: 1.7;
    max-width: 280px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.6);
}
.flight-map-overlay-box small {
    display: block;
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
}
.flight-map-retry-btn {
    margin-top: 12px;
    display: inline-block;
    background: #f59e0b;
    color: #000;
    border: none;
    border-radius: 6px;
    padding: 6px 18px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
}
.flight-map-retry-btn:hover { opacity: 0.85; }

/* ─── Broker cards (Dashboard Trader widget) ─────────────────────── */
.dash-broker-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 8px 0 6px;
}
.dash-broker-card {
    background: #111827;
    border: 1px solid #1f2937;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 11px;
}
.dash-broker-card.connected  { border-color: #065f46; }
.dash-broker-card.disconnected { border-color: #3b1515; opacity: .7; }

.broker-header {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 5px;
}
.broker-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.broker-dot.live  { background: #10b981; box-shadow: 0 0 4px #10b981; }
.broker-dot.dead  { background: #ef4444; }
.broker-name { font-weight: 600; font-size: 11px; color: #e2e8f0; flex: 1; }
.broker-status-tag {
    font-size: 9px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    background: #064e3b;
    color: #34d399;
    letter-spacing: .05em;
}
.dash-broker-card.disconnected .broker-status-tag {
    background: #450a0a;
    color: #f87171;
}
.broker-stats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 5px;
}
.broker-stat { font-size: 11px; color: #94a3b8; }
.broker-stat b { color: #e2e8f0; }
.broker-stat-label { font-size: 9px; color: #64748b; }
.broker-stat.positive b { color: #34d399; }
.broker-stat.negative b { color: #f87171; }

.broker-budget-bar-wrap { margin-top: 4px; }
.broker-budget-label {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    color: #64748b;
    margin-bottom: 3px;
}
.broker-budget-bar {
    height: 4px;
    background: #1f2937;
    border-radius: 2px;
    overflow: hidden;
}
.broker-budget-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #3b82f6);
    border-radius: 2px;
    transition: width .4s ease;
}
.broker-offline-msg {
    font-size: 10px;
    color: #6b7280;
    padding: 4px 0;
}

/* ─── Position mini-list (Dashboard Trader widget) ───────────────── */
.dash-positions-mini {
    margin: 6px 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.pos-mini-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    background: #0f172a;
    border-radius: 5px;
    padding: 3px 7px;
}
.pos-mini-asset { font-weight: 700; color: #e2e8f0; min-width: 36px; }
.pos-mini-dir   { font-size: 10px; font-weight: 600; min-width: 28px; }
.pos-mini-dir.bullish { color: #34d399; }
.pos-mini-dir.bearish { color: #f87171; }
.pos-mini-size  { color: #94a3b8; min-width: 32px; }
.pos-mini-pnl   { flex: 1; text-align: right; font-size: 10px; }
.pos-mini-pnl.positive { color: #34d399; }
.pos-mini-pnl.negative { color: #f87171; }
.pos-mini-broker { font-size: 10px; min-width: 72px; text-align: right; }
.pos-mini-broker.brokered { color: #10b981; }
.pos-mini-broker.internal { color: #f59e0b; }
.pos-mini-more  { font-size: 10px; color: #64748b; padding: 2px 4px; }
