/* ============================================================
   IRAN WAR MONITOR — INTELLIGENCE DASHBOARD
   Design System & Complete Stylesheet
   ============================================================ */

/* ----------------------------------------------------------
   A) DESIGN TOKENS
   ---------------------------------------------------------- */
:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #111827;
    --bg-tertiary: #1a1f35;
    --bg-card: #111827;
    --border: #1f2937;
    --border-hover: #374151;
    --text-primary: #e5e7eb;
    --text-secondary: #9ca3af;
    --text-tertiary: #6b7280;
    --accent: #e94560;
    --accent-hover: #d63d56;
    --accent-glow: rgba(233, 69, 96, 0.15);
    --blue: #3b82f6;
    --green: #10b981;
    --yellow: #f59e0b;
    --orange: #f97316;
    --purple: #8b5cf6;
    --red: #ef4444;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
    --shadow-accent: 0 4px 20px rgba(233, 69, 96, 0.2);
    --transition: all 0.2s ease;
    --transition-slow: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);

    --header-h: 56px;
    --sidebar-w: 280px;
    --detail-w: 420px;
    --mobile-nav-h: 60px;
}


/* ----------------------------------------------------------
   B) BASE / RESET
   ---------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

input, button, textarea, select {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    outline: none;
}

button {
    cursor: pointer;
    border: none;
    background: none;
}

ul, ol {
    list-style: none;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}


/* ----------------------------------------------------------
   P) CUSTOM SCROLLBAR
   ---------------------------------------------------------- */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}


/* ----------------------------------------------------------
   C) HEADER
   ---------------------------------------------------------- */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

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

.logo svg {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.logo span {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-primary);
    white-space: nowrap;
}

.credit-link {
    font-size: 9px;
    font-weight: 400;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    text-decoration: none;
    text-transform: none;
    opacity: 0.6;
    transition: opacity 0.2s ease;
    white-space: nowrap;
}

.credit-link:hover {
    opacity: 1;
    color: var(--blue);
}

/* Header navigation */
.header-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 16px;
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius);
    transition: var(--transition);
    white-space: nowrap;
}

.nav-tab svg,
.nav-tab i {
    width: 16px;
    height: 16px;
}

.nav-tab:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.nav-tab.active {
    color: var(--accent);
    background: var(--accent-glow);
}

/* Header right side */
.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
}

.pulse-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--green);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

/* Mobile hamburger */
.hamburger-btn {
    display: none;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    color: var(--text-secondary);
}

.hamburger-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}


/* ----------------------------------------------------------
   D) LAYOUT — 3-Column Grid
   ---------------------------------------------------------- */
.main-layout {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    height: calc(100vh - var(--header-h));
    margin-top: var(--header-h);
    overflow: hidden;
    transition: grid-template-columns 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-layout.no-sidebar {
    grid-template-columns: 1fr;
}

.main-layout.no-sidebar > .sidebar {
    display: none;
}


/* ----------------------------------------------------------
   E) SIDEBAR
   ---------------------------------------------------------- */
.sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    transition: var(--transition-slow);
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-tertiary);
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

/* Search box */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box > svg,
.search-box > i {
    position: absolute;
    left: 10px;
    width: 16px;
    height: 16px;
    color: var(--text-tertiary);
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding: 8px 32px 8px 34px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 13px;
    transition: var(--transition);
}

.search-box input::placeholder {
    color: var(--text-tertiary);
}

.search-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-clear {
    position: absolute;
    right: 6px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--text-tertiary);
    border-radius: 50%;
    transition: var(--transition);
    opacity: 0;
    pointer-events: none;
}

.search-clear.visible {
    opacity: 1;
    pointer-events: all;
}

.search-clear:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

/* Source filter checkboxes */
.source-group {
    margin-bottom: 12px;
}

.source-group-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    margin-bottom: 6px;
    padding-left: 2px;
}

.source-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 13px;
    color: var(--text-secondary);
}

.source-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Custom checkbox */
.source-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-hover);
    border-radius: 4px;
    flex-shrink: 0;
    position: relative;
    transition: var(--transition);
    cursor: pointer;
}

.source-item input[type="checkbox"]:checked {
    border-color: transparent;
}

.source-item input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 5px;
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Source category colors */
.source-item.western input[type="checkbox"]:checked {
    background: var(--blue);
}
.source-item.iranian input[type="checkbox"]:checked {
    background: var(--green);
}
.source-item.arab input[type="checkbox"]:checked {
    background: var(--orange);
}
.source-item.israeli input[type="checkbox"]:checked {
    background: var(--purple);
}
.source-item.independent input[type="checkbox"]:checked {
    background: var(--text-tertiary);
}

/* Source badge (colored pill) */
.source-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--radius-xl);
    line-height: 1.6;
}

.source-badge.western  { background: rgba(59,130,246,0.15); color: var(--blue); }
.source-badge.iranian  { background: rgba(16,185,129,0.15); color: var(--green); }
.source-badge.arab     { background: rgba(249,115,22,0.15); color: var(--orange); }
.source-badge.israeli  { background: rgba(139,92,246,0.15); color: var(--purple); }
.source-badge.european { background: rgba(236,72,153,0.15); color: #ec4899; }
.source-badge.asian    { background: rgba(20,184,166,0.15); color: #14b8a6; }
.source-badge.regional { background: rgba(249,115,22,0.15); color: var(--orange); }
.source-badge.independent { background: rgba(107,114,128,0.15); color: var(--text-tertiary); }

/* Region pills */
.region-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.region-pill {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: var(--transition);
}

.region-pill:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.region-pill.active {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--accent);
}

/* Sidebar stats */
.sidebar-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-secondary);
    padding: 4px 0;
}

.sidebar-stat-value {
    font-weight: 600;
    color: var(--text-primary);
}


/* ----------------------------------------------------------
   F) CONTENT AREA
   ---------------------------------------------------------- */
.content {
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    height: 100%;
}

/* View switching */
.view {
    display: none;
    padding: 24px;
    animation: fadeIn 0.3s ease;
}

.view.active {
    display: block;
}


/* ----------------------------------------------------------
   G) STAT CARDS (Dashboard top row)
   ---------------------------------------------------------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: var(--transition);
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-lg);
    padding: 1px;
    background: linear-gradient(135deg, transparent, transparent);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: var(--transition);
}

.stat-card:hover::before {
    background: linear-gradient(135deg, var(--accent), var(--purple));
    opacity: 1;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    flex-shrink: 0;
}

.stat-icon svg,
.stat-icon i {
    width: 22px;
    height: 22px;
}

.stat-icon.red    { background: rgba(233,69,96,0.12); color: var(--accent); }
.stat-icon.blue   { background: rgba(59,130,246,0.12); color: var(--blue); }
.stat-icon.green  { background: rgba(16,185,129,0.12); color: var(--green); }
.stat-icon.yellow { background: rgba(245,158,11,0.12); color: var(--yellow); }

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.stat-number {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-primary);
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* ----------------------------------------------------------
   H) DASHBOARD GRID
   ---------------------------------------------------------- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.dashboard-grid h3,
.dashboard-bottom h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.dashboard-map-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    overflow: hidden;
}

.mini-map {
    height: 300px;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-primary);
}

.dashboard-headlines {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    overflow-y: auto;
    max-height: 360px;
}

.headline-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.headline-item:last-child {
    border-bottom: none;
}

.headline-item:hover {
    padding-left: 6px;
}

.headline-time {
    font-size: 11px;
    color: var(--text-tertiary);
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 50px;
}

.headline-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
}

.headline-source {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.dashboard-bottom {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}


/* ----------------------------------------------------------
   I) ARTICLE CARDS (Feed view)
   ---------------------------------------------------------- */
.feed-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.feed-header h2 {
    font-size: 18px;
    font-weight: 700;
}

.article-count {
    font-size: 13px;
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    padding: 4px 12px;
    border-radius: var(--radius-xl);
}

.feed-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.article-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition);
    animation: slideUp 0.3s ease backwards;
}

.article-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--border-hover);
}

.article-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.article-card-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-primary);
}

.article-card-summary {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--text-tertiary);
    flex-wrap: wrap;
}

.article-card-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.article-card-meta svg,
.article-card-meta i {
    width: 13px;
    height: 13px;
}

/* Translated badge */
.translated-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 500;
    color: var(--blue);
    background: rgba(59, 130, 246, 0.1);
    border-radius: var(--radius-sm);
}

/* Unread dot indicator */
.unread-dot {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--accent);
}

/* Feed pagination */
.feed-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px 0;
}

.feed-pagination button {
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: var(--transition);
}

.feed-pagination button:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.feed-pagination button.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.feed-pagination button:disabled {
    opacity: 0.3;
    pointer-events: none;
}


/* ----------------------------------------------------------
   J) MAP VIEW
   ---------------------------------------------------------- */
#view-map {
    padding: 0;
    position: relative;
    overflow: hidden;
    height: 100%;
}

#view-map.active {
    display: flex;
    flex-direction: column;
}

.full-map {
    width: 100%;
    flex: 1;
    min-height: 0;
    background: var(--bg-primary);
}

/* Leaflet overrides */
.leaflet-container {
    background: var(--bg-primary) !important;
    font-family: var(--font) !important;
}

.leaflet-control-zoom {
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
    overflow: hidden;
}

.leaflet-control-zoom a {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border) !important;
    width: 32px !important;
    height: 32px !important;
    line-height: 32px !important;
    font-size: 16px !important;
}

.leaflet-control-zoom a:hover {
    background: var(--bg-tertiary) !important;
}

.leaflet-popup-content-wrapper {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius) !important;
    border: 1px solid var(--border) !important;
    box-shadow: var(--shadow-lg) !important;
}

.leaflet-popup-content {
    margin: 12px 14px !important;
    font-size: 13px !important;
    line-height: 1.5 !important;
}

.leaflet-popup-tip {
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
}

.leaflet-popup-close-button {
    color: var(--text-tertiary) !important;
}

/* Map marker tooltip (dark theme) */
.map-marker-tooltip {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-lg) !important;
    padding: 10px 14px !important;
    font-size: 12px !important;
    line-height: 1.4 !important;
    max-width: 240px !important;
    white-space: normal !important;
    word-wrap: break-word !important;
}

.map-marker-tooltip::before {
    border-top-color: var(--bg-card) !important;
}

/* Map drawer */
.map-drawer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 800;
    max-height: 40vh;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transform: translateY(calc(100% - 44px));
    transition: var(--transition-slow);
    overflow: hidden;
}

.map-drawer.open {
    transform: translateY(0);
}

.map-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
}

.map-drawer-header::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 4px;
    background: var(--border-hover);
    border-radius: 2px;
}

.drawer-close-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

.drawer-close-btn:hover {
    background: var(--border-hover);
    color: var(--text-primary);
}

.map-drawer-list {
    overflow-y: auto;
    max-height: calc(40vh - 44px);
    padding: 8px;
}

.map-drawer-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 13px;
    color: var(--text-secondary);
}

.map-drawer-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Map legend */
.map-legend {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 800;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 14px;
    background: rgba(17, 24, 39, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 11px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}


/* ----------------------------------------------------------
   K) COMMAND CENTER
   ---------------------------------------------------------- */
.command-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.command-header h2 {
    font-size: 18px;
    font-weight: 700;
}

/* Threat Gauge */
.threat-gauge-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
}

.threat-gauge-container h3 {
    margin-bottom: 16px;
}

.threat-level-label {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.threat-level-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Timeline */
.timeline-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.timeline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.timeline-header h3 {
    display: flex;
    align-items: center;
    margin: 0;
}

.timeline-count {
    font-size: 12px;
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    padding: 3px 10px;
    border-radius: var(--radius-xl);
    font-weight: 500;
}

.timeline {
    position: relative;
    padding-left: 0;
}

.timeline-item {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.timeline-item.last .timeline-track {
    padding-bottom: 0;
}

.timeline-track {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    padding-bottom: 8px;
}

.timeline-line {
    width: 2px;
    flex: 1;
    min-height: 16px;
    background: var(--border);
    margin-top: 4px;
}

.timeline-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
    box-shadow: 0 0 6px rgba(233, 69, 96, 0.4);
}

.timeline-dot.red    { background: var(--accent); box-shadow: 0 0 6px rgba(233, 69, 96, 0.4); }
.timeline-dot.orange { background: var(--orange); box-shadow: 0 0 6px rgba(249, 115, 22, 0.4); }
.timeline-dot.yellow { background: var(--yellow); box-shadow: 0 0 6px rgba(245, 158, 11, 0.4); }
.timeline-dot.blue   { background: var(--blue);   box-shadow: 0 0 6px rgba(59, 130, 246, 0.4); }

.timeline-content {
    padding-bottom: 16px;
    min-width: 0;
}

.timeline-date {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-bottom: 2px;
    font-weight: 500;
}

.timeline-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 3px;
}

.timeline-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.timeline-sig {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 1px 6px;
    border-radius: 3px;
    margin-top: 5px;
    opacity: 0.9;
}

.timeline-sig.red    { background: rgba(233,69,96,0.15); color: var(--accent); }
.timeline-sig.orange { background: rgba(249,115,22,0.15); color: var(--orange); }
.timeline-sig.yellow { background: rgba(245,158,11,0.15); color: var(--yellow); }
.timeline-sig.blue   { background: rgba(59,130,246,0.15); color: var(--blue); }

/* Backwards compat: plain text fallback */
.timeline-text {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.5;
    padding-bottom: 14px;
}

/* Sentiment bars */
.sentiment-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.sentiment-container h3 {
    margin-bottom: 16px;
}

.sentiment-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.sentiment-row:last-child {
    margin-bottom: 0;
}

.sentiment-label {
    font-size: 12px;
    color: var(--text-secondary);
    width: 80px;
    flex-shrink: 0;
    text-align: right;
}

.sentiment-bar-track {
    flex: 1;
    height: 8px;
    background: var(--bg-primary);
    border-radius: 4px;
    overflow: hidden;
}

.sentiment-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 1s ease;
}

.sentiment-bar-fill.negative { background: var(--red); }
.sentiment-bar-fill.neutral  { background: var(--yellow); }
.sentiment-bar-fill.positive { background: var(--green); }

.sentiment-value {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    width: 60px;
    flex-shrink: 0;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Briefing card */
.briefing-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.briefing-card h3 {
    margin-bottom: 12px;
}

.briefing-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.briefing-text p {
    margin-bottom: 12px;
}

.briefing-text p:last-child {
    margin-bottom: 0;
}

.briefing-text strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Command grid */
.command-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.command-full {
    grid-column: 1 / -1;
}

/* Command empty state */
.command-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 24px;
    text-align: center;
}

.command-empty h3 {
    font-size: 16px;
    margin: 16px 0 8px;
}

.command-empty p {
    color: var(--text-tertiary);
    font-size: 13px;
}


/* ----------------------------------------------------------
   K2) ANALYTICS PAGE
   ---------------------------------------------------------- */

/* Header */
.analytics-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 8px;
}

.analytics-header h2 {
    font-size: 18px;
    font-weight: 700;
}

.analytics-subtitle {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* Sections */
.an-section {
    margin-bottom: 32px;
}

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

.an-section-header h3 {
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.an-section-header h3 i,
.an-section-header h3 svg {
    width: 18px;
    height: 18px;
    color: var(--accent);
}

.an-badge {
    font-size: 11px;
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    padding: 3px 10px;
    border-radius: var(--radius-xl);
    font-weight: 500;
}

.an-note {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-bottom: 14px;
    font-style: italic;
    line-height: 1.5;
}

/* Grid layout (2 columns) */
.an-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Generic card */
.an-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.an-card h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

/* ---- TIMELINE (horizontal scroll) ---- */
.an-tl-legend {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.an-tl-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-secondary);
}

.an-tl-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.an-tl-legend-dot.red    { background: var(--accent); }
.an-tl-legend-dot.blue   { background: var(--blue); }
.an-tl-legend-dot.purple { background: var(--purple); }
.an-tl-legend-dot.orange { background: var(--orange); }

.an-tl-scroll {
    overflow-x: auto;
    padding-bottom: 12px;
    -webkit-overflow-scrolling: touch;
}

.an-tl-scroll::-webkit-scrollbar {
    height: 6px;
}

.an-tl-scroll::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-radius: 3px;
}

.an-tl-scroll::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.an-tl-track {
    display: flex;
    gap: 0;
    min-width: max-content;
    position: relative;
    padding-top: 20px;
}

.an-tl-track::before {
    content: '';
    position: absolute;
    top: 26px;
    left: 20px;
    right: 20px;
    height: 2px;
    background: var(--border);
}

.an-tl-event {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 220px;
    max-width: 260px;
    position: relative;
}

.an-tl-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    z-index: 1;
    flex-shrink: 0;
}

.an-tl-dot.red    { background: var(--accent); box-shadow: 0 0 10px rgba(233,69,96,0.5); }
.an-tl-dot.blue   { background: var(--blue);   box-shadow: 0 0 10px rgba(59,130,246,0.5); }
.an-tl-dot.purple { background: var(--purple); box-shadow: 0 0 10px rgba(139,92,246,0.5); }
.an-tl-dot.orange { background: var(--orange); box-shadow: 0 0 10px rgba(249,115,22,0.5); }

.an-tl-connector {
    width: 2px;
    height: 16px;
    background: var(--border);
}

.an-tl-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    width: 100%;
    margin: 0 8px;
    transition: var(--transition);
}

.an-tl-card:hover {
    border-color: var(--text-tertiary);
    box-shadow: var(--shadow);
}

.an-tl-date {
    font-size: 11px;
    color: var(--text-tertiary);
    font-weight: 500;
    margin-bottom: 4px;
}

.an-tl-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 6px;
}

.an-tl-detail {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 8px;
}

.an-tl-type {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 2px 7px;
    border-radius: 3px;
}

.an-tl-type.red    { background: rgba(233,69,96,0.15);  color: var(--accent); }
.an-tl-type.blue   { background: rgba(59,130,246,0.15); color: var(--blue); }
.an-tl-type.purple { background: rgba(139,92,246,0.15); color: var(--purple); }
.an-tl-type.orange { background: rgba(249,115,22,0.15); color: var(--orange); }

/* ---- BAR CHART (Human Cost + Cost of War) ---- */
.an-bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.an-bar-row:last-child {
    margin-bottom: 0;
}

.an-bar-label {
    font-size: 12px;
    color: var(--text-secondary);
    width: 150px;
    flex-shrink: 0;
    text-align: right;
}

.an-bar-track {
    flex: 1;
    height: 10px;
    background: var(--bg-primary);
    border-radius: 5px;
    overflow: hidden;
}

.an-bar-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.an-bar-value {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 120px;
    flex-shrink: 0;
    text-align: right;
    white-space: nowrap;
}

/* ---- COST ROWS ---- */
.an-cost-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.an-cost-row:last-child {
    margin-bottom: 0;
}

.an-cost-label {
    width: 140px;
    flex-shrink: 0;
    text-align: right;
}

.an-cost-name {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.an-cost-side {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 1px 5px;
    border-radius: 3px;
    margin-top: 2px;
}

.an-cost-side.iran   { background: rgba(233,69,96,0.15); color: var(--accent); }
.an-cost-side.israel { background: rgba(59,130,246,0.15); color: var(--blue); }

.an-cost-amount {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 120px;
    flex-shrink: 0;
    text-align: right;
    white-space: nowrap;
}

/* ---- SPENDING ROWS ---- */
.an-spend-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.an-spend-row:last-child {
    margin-bottom: 0;
}

.an-spend-label {
    font-size: 12px;
    color: var(--text-secondary);
    width: 120px;
    flex-shrink: 0;
    text-align: right;
}

.an-spend-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 80px;
    flex-shrink: 0;
    text-align: right;
    white-space: nowrap;
}

.an-spend-note {
    font-size: 10px;
    font-weight: 400;
    color: var(--text-tertiary);
}

/* ---- HIGHLIGHT CARD ---- */
.an-highlight-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.an-highlight-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    flex-shrink: 0;
    color: #fff;
}

.an-highlight-icon i,
.an-highlight-icon svg {
    width: 20px;
    height: 20px;
}

.an-highlight-body {
    flex: 1;
    min-width: 0;
}

.an-highlight-number {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
}

.an-highlight-desc {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-top: 2px;
}

/* ---- DONUT CHART ---- */
.an-donut-card {
    text-align: left;
}

.an-donut-row {
    display: flex;
    align-items: center;
    gap: 24px;
}

.an-donut-chart {
    flex-shrink: 0;
}

.an-donut-chart svg {
    display: block;
}

.an-donut-info {
    flex: 1;
    min-width: 0;
}

.an-donut-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.an-donut-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.an-donut-legend-count {
    margin-left: auto;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 11px;
}

.an-intercept {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.an-intercept-num {
    font-size: 24px;
    font-weight: 700;
    color: var(--green);
}

.an-intercept-label {
    font-size: 11px;
    color: var(--text-tertiary);
}

.an-donut-note {
    font-size: 11px;
    color: var(--text-tertiary);
    font-style: italic;
    margin-top: 8px;
}

/* ---- ACTORS GRID ---- */
.an-actors-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.an-actor-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
    transition: var(--transition);
}

.an-actor-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.an-actor-flag {
    font-size: 32px;
    margin-bottom: 8px;
}

.an-actor-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.an-actor-role {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.4;
}

.an-actor-bar {
    height: 3px;
    width: 40px;
    border-radius: 2px;
    margin: 0 auto;
    opacity: 0.7;
}

/* Sources disclaimer */
.an-sources {
    padding-top: 16px;
    border-top: 1px solid var(--border);
}


/* ----------------------------------------------------------
   L) DETAIL PANEL (Slide-in)
   ---------------------------------------------------------- */
.detail-panel {
    position: fixed;
    top: var(--header-h);
    right: 0;
    bottom: 0;
    width: var(--detail-w);
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2000;
    box-shadow: var(--shadow-lg);
}

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

.detail-overlay {
    position: fixed;
    inset: 0;
    z-index: 1999;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.detail-overlay.open {
    opacity: 1;
    visibility: visible;
}

.detail-close {
    position: sticky;
    top: 0;
    float: right;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    transition: var(--transition);
    z-index: 10;
}

.detail-close:hover {
    color: var(--text-primary);
    background: var(--border);
}

.detail-source-badge {
    margin-bottom: 12px;
}

.detail-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.detail-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.detail-meta svg,
.detail-meta i {
    width: 14px;
    height: 14px;
}

.detail-summary {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 20px;
}

.detail-mini-map {
    height: 180px;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
    background: var(--bg-primary);
}

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


/* ----------------------------------------------------------
   M) BUTTONS
   ---------------------------------------------------------- */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border-radius: var(--radius);
    transition: var(--transition);
}

.btn-primary svg,
.btn-primary i {
    width: 16px;
    height: 16px;
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: var(--shadow-accent);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: var(--transition);
}

.btn-secondary:hover {
    border-color: var(--border-hover);
    background: var(--bg-tertiary);
}

.btn-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    color: var(--text-secondary);
    transition: var(--transition);
}

.btn-icon svg,
.btn-icon i {
    width: 18px;
    height: 18px;
}

.btn-icon:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.btn-sm:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}


/* ----------------------------------------------------------
   N) LOADING STATES
   ---------------------------------------------------------- */

/* Skeleton shimmer */
.skeleton {
    position: relative;
    overflow: hidden;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
}

.skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.04) 50%,
        transparent 100%
    );
    animation: shimmer 1.5s ease-in-out infinite;
}

.skeleton-card {
    height: 120px;
    margin-bottom: 12px;
    border-radius: var(--radius-lg);
}

.skeleton-line {
    height: 12px;
    margin-bottom: 8px;
    border-radius: 6px;
}

.skeleton-line.short {
    width: 60%;
}

.skeleton-line.medium {
    width: 80%;
}

/* Spinner */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    color: var(--text-tertiary);
    font-size: 13px;
}

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

/* Spinning refresh button */
.btn-icon.spinning i,
.btn-icon.spinning svg {
    animation: spin 1s linear infinite;
}

.region-tag {
    display: inline-flex;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.detail-section {
    margin-bottom: 20px;
}

.detail-section h4 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    margin-bottom: 8px;
}

.detail-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.detail-date {
    font-size: 12px;
    color: var(--text-tertiary);
}

.detail-map {
    height: 180px;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-primary);
    margin-bottom: 8px;
}

.location-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

.location-label i,
.location-label svg {
    width: 14px;
    height: 14px;
}

.translation-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    margin-bottom: 16px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: var(--radius);
    font-size: 12px;
    color: var(--text-secondary);
}

.translation-banner i,
.translation-banner svg {
    width: 16px;
    height: 16px;
    color: var(--blue);
    flex-shrink: 0;
}

.drawer-article {
    padding: 8px 10px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.drawer-article:hover {
    background: var(--bg-tertiary);
}

.drawer-article-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
}

.drawer-article-meta {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.drawer-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 13px;
}


/* ----------------------------------------------------------
   O) TOAST NOTIFICATIONS
   ---------------------------------------------------------- */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    min-width: 280px;
    max-width: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    color: var(--text-primary);
    pointer-events: all;
    animation: slideInRight 0.3s ease;
}

.toast.dismissing {
    animation: slideOutRight 0.3s ease forwards;
}

.toast svg,
.toast i {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.toast.success { border-left: 3px solid var(--green); }
.toast.success svg,
.toast.success i { color: var(--green); }

.toast.error { border-left: 3px solid var(--red); }
.toast.error svg,
.toast.error i { color: var(--red); }

.toast.warning { border-left: 3px solid var(--yellow); }
.toast.warning svg,
.toast.warning i { color: var(--yellow); }

.toast.info { border-left: 3px solid var(--blue); }
.toast.info svg,
.toast.info i { color: var(--blue); }


/* ----------------------------------------------------------
   P) EMPTY STATES
   ---------------------------------------------------------- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    text-align: center;
}

.empty-icon {
    width: 48px;
    height: 48px;
    color: var(--text-tertiary);
    opacity: 0.5;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.empty-state p {
    font-size: 13px;
    color: var(--text-tertiary);
    max-width: 300px;
}


/* ----------------------------------------------------------
   Q) MODALS
   ---------------------------------------------------------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal {
    width: 90%;
    max-width: 520px;
    max-height: 80vh;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.25s ease;
}

.modal-overlay.open .modal {
    transform: scale(1) translateY(0);
}

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

.modal-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(80vh - 60px);
}

.settings-section {
    margin-bottom: 24px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
}

.settings-desc {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 12px;
    line-height: 1.5;
}

.input-group {
    display: flex;
    gap: 8px;
}

.input-group input {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 13px;
    transition: var(--transition);
}

.input-group input::placeholder {
    color: var(--text-tertiary);
}

.input-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}


/* ----------------------------------------------------------
   R) MOBILE BOTTOM NAV
   ---------------------------------------------------------- */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: var(--mobile-nav-h);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    justify-content: space-around;
    align-items: center;
    padding: 0 8px;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.mobile-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 12px;
    border-radius: var(--radius);
    color: var(--text-tertiary);
    transition: var(--transition);
    font-size: 10px;
    font-weight: 500;
}

.mobile-nav-btn svg,
.mobile-nav-btn i {
    width: 20px;
    height: 20px;
}

.mobile-nav-btn.active {
    color: var(--accent);
}

.mobile-nav-btn:hover {
    color: var(--text-primary);
}


/* ----------------------------------------------------------
   S) ANIMATIONS / KEYFRAMES
   ---------------------------------------------------------- */
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

@keyframes slideOutRight {
    from { transform: translateX(0);    opacity: 1; }
    to   { transform: translateX(100%); opacity: 0; }
}

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

@keyframes shimmer {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%);  }
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.5; transform: scale(0.85); }
}

@keyframes gaugeReveal {
    /* kept for backwards compat — SVG gauge replaces CSS gauge */
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Staggered animation for lists */
.article-card:nth-child(1)  { animation-delay: 0.00s; }
.article-card:nth-child(2)  { animation-delay: 0.04s; }
.article-card:nth-child(3)  { animation-delay: 0.08s; }
.article-card:nth-child(4)  { animation-delay: 0.12s; }
.article-card:nth-child(5)  { animation-delay: 0.16s; }
.article-card:nth-child(6)  { animation-delay: 0.20s; }
.article-card:nth-child(7)  { animation-delay: 0.24s; }
.article-card:nth-child(8)  { animation-delay: 0.28s; }
.article-card:nth-child(9)  { animation-delay: 0.32s; }
.article-card:nth-child(10) { animation-delay: 0.36s; }


/* ----------------------------------------------------------
   T) RESPONSIVE BREAKPOINTS
   ---------------------------------------------------------- */

/* Note: detail-panel and detail-overlay base styles are in section L above */

/* Medium screens: Sidebar becomes drawer */
@media (max-width: 1024px) {
    .header-nav {
        display: none;
    }

    .hamburger-btn {
        display: flex;
    }

    .main-layout {
        grid-template-columns: 1fr !important;
    }

    .sidebar {
        position: fixed;
        top: var(--header-h);
        left: 0;
        bottom: 0;
        width: var(--sidebar-w);
        z-index: 2000;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: var(--shadow-lg);
    }

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

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        z-index: 1999;
        background: rgba(0, 0, 0, 0.4);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.25s ease, visibility 0.25s ease;
    }

    .sidebar-overlay.open {
        opacity: 1;
        visibility: visible;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-bottom {
        grid-template-columns: 1fr;
    }

    .command-grid {
        grid-template-columns: 1fr;
    }

    /* Analytics responsive */
    .an-grid-2 {
        grid-template-columns: 1fr;
    }
}

/* Small screens: Single column, bottom tab bar */
@media (max-width: 768px) {
    .header-right .live-indicator {
        display: none;
    }

    .logo span {
        font-size: 11px;
        letter-spacing: 0.12em;
    }

    .credit-link {
        display: none;
    }

    .mobile-nav {
        display: flex;
    }

    body {
        padding-bottom: var(--mobile-nav-h);
    }

    .main-layout {
        height: calc(100vh - var(--header-h) - var(--mobile-nav-h));
    }

    .view {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 12px;
        gap: 10px;
    }

    .stat-number {
        font-size: 20px;
    }

    .stat-icon {
        width: 36px;
        height: 36px;
    }

    .stat-icon svg,
    .stat-icon i {
        width: 18px;
        height: 18px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-bottom {
        grid-template-columns: 1fr;
    }

    .mini-map {
        height: 220px;
    }

    .detail-panel {
        position: fixed;
        top: var(--header-h);
        left: 0;
        right: 0;
        bottom: var(--mobile-nav-h);
        width: 100%;
        z-index: 3000;
        border-left: none;
        border-top: 1px solid var(--border);
    }

    .command-grid {
        grid-template-columns: 1fr;
    }

    .command-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .feed-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    #toast-container {
        bottom: calc(var(--mobile-nav-h) + 12px);
        left: 12px;
        right: 12px;
    }

    .toast {
        min-width: auto;
        max-width: none;
    }

    .map-legend {
        top: auto;
        bottom: 50px;
        right: 8px;
        font-size: 10px;
        padding: 8px 10px;
    }

    /* Analytics responsive - 768px */
    .an-bar-label,
    .an-cost-label,
    .an-spend-label {
        width: 100px;
        font-size: 11px;
    }

    .an-bar-value,
    .an-cost-amount,
    .an-spend-value {
        min-width: 80px;
        font-size: 10px;
    }

    .an-donut-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .an-actors-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .an-tl-event {
        min-width: 180px;
    }

    .analytics-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .header {
        padding: 0 12px;
    }

    .view {
        padding: 12px;
    }

    .detail-actions {
        flex-direction: column;
    }

    .detail-actions .btn-primary,
    .detail-actions .btn-secondary {
        width: 100%;
        justify-content: center;
    }

    /* Analytics responsive - 480px */
    .an-bar-row,
    .an-cost-row,
    .an-spend-row {
        flex-wrap: wrap;
    }

    .an-bar-label,
    .an-cost-label,
    .an-spend-label {
        width: 100%;
        text-align: left;
    }

    .an-actors-grid {
        grid-template-columns: 1fr 1fr;
    }

    .an-tl-event {
        min-width: 160px;
    }
}


/* ----------------------------------------------------------
   U-BIAS) SOURCE DIVERSITY TRACKER
   ---------------------------------------------------------- */
.bias-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.bias-subtitle {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 20px;
}

.bias-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 13px;
}

.bias-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.bias-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.bias-card-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    margin-bottom: 16px;
}

/* Score card */
.bias-score-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.bias-score-ring {
    position: relative;
    width: 140px;
    height: 140px;
    margin-bottom: 12px;
}

.bias-score-ring svg {
    display: block;
}

.bias-score-value {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
}

.bias-score-excellent { stroke: var(--green); }
.bias-score-good { stroke: var(--blue); }
.bias-score-fair { stroke: var(--yellow); }
.bias-score-poor { stroke: var(--red); }

.bias-score-excellent-text { color: var(--green); }
.bias-score-good-text { color: var(--blue); }
.bias-score-fair-text { color: var(--yellow); }
.bias-score-poor-text { color: var(--red); }

.bias-score-label {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.bias-score-desc {
    font-size: 11px;
    color: var(--text-tertiary);
}

/* Donut chart */
.bias-donut-card {
    overflow: hidden;
}

.bias-donut-row {
    display: flex;
    align-items: center;
    gap: 20px;
}

.bias-donut-chart {
    flex-shrink: 0;
}

.bias-donut-chart svg {
    display: block;
}

.bias-donut-legend {
    flex: 1;
    min-width: 0;
}

.bias-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.bias-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.bias-legend-label {
    flex: 1;
    min-width: 0;
}

.bias-legend-pct {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 11px;
    min-width: 36px;
    text-align: right;
}

.bias-legend-count {
    font-size: 10px;
    color: var(--text-tertiary);
    min-width: 24px;
    text-align: right;
}

/* Source bars */
.bias-bars-card {
    margin-bottom: 16px;
}

.bias-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.bias-bar-row:last-child {
    margin-bottom: 0;
}

.bias-bar-label {
    width: 140px;
    flex-shrink: 0;
    font-size: 12px;
    color: var(--text-secondary);
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bias-bar-track {
    flex: 1;
    height: 8px;
    background: var(--bg-primary);
    border-radius: 4px;
    overflow: hidden;
}

.bias-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}

.bias-bar-count {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 30px;
    text-align: right;
}

/* Skew warnings */
.bias-warnings {
    margin-top: 16px;
    margin-bottom: 24px;
}

.bias-warning {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    margin-bottom: 8px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text-secondary);
}

.bias-warning i,
.bias-warning svg {
    width: 18px;
    height: 18px;
    color: var(--red);
    flex-shrink: 0;
}

/* Topic language tags */
.topic-lang-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.topic-lang-tag {
    display: inline-block;
    padding: 3px 8px;
    font-size: 10px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.topic-lang-tag.active {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--green);
    color: var(--green);
}

.topic-lang-tag.inactive {
    background: rgba(107, 114, 128, 0.1);
    color: var(--text-tertiary);
}

/* Responsive: bias grid stacks at 768px */
@media (max-width: 768px) {
    .bias-grid {
        grid-template-columns: 1fr;
    }

    .bias-donut-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .bias-bar-label {
        width: 100px;
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .bias-bar-row {
        flex-wrap: wrap;
    }

    .bias-bar-label {
        width: 100%;
        text-align: left;
    }
}


/* ----------------------------------------------------------
   U) UTILITY CLASSES
   ---------------------------------------------------------- */
.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.text-accent  { color: var(--accent); }
.text-blue    { color: var(--blue); }
.text-green   { color: var(--green); }
.text-yellow  { color: var(--yellow); }
.text-orange  { color: var(--orange); }
.text-purple  { color: var(--purple); }
.text-red     { color: var(--red); }
.text-muted   { color: var(--text-tertiary); }

.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gap-sm  { gap: 6px;  }
.gap-md  { gap: 12px; }
.gap-lg  { gap: 20px; }

.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.mb-lg { margin-bottom: 24px; }


/* ----------------------------------------------------------
   V) PRINT STYLES
   ---------------------------------------------------------- */
@media print {
    .header,
    .sidebar,
    .mobile-nav,
    .detail-panel,
    .map-legend,
    .map-drawer,
    #toast-container {
        display: none !important;
    }

    body {
        background: #fff;
        color: #111;
        overflow: visible;
        height: auto;
    }

    .main-layout {
        display: block;
        height: auto;
        margin: 0;
        overflow: visible;
    }

    .content {
        overflow: visible;
    }

    .view {
        display: block !important;
        padding: 20px;
    }

    .article-card {
        break-inside: avoid;
        border: 1px solid #ddd;
        box-shadow: none;
    }
}
