/* ============================================================
   SHADCN-INSPIRED DESIGN SYSTEM
   Based on shadcn/ui aesthetic — zinc/slate palette, subtle shadows
   ============================================================ */

:root {
    /* Dark theme — zinc-950 base (shadcn default dark) */
    --bg: hsl(240 10% 3.9%);              /* zinc-950 */
    --bg-card: hsl(240 10% 5.9%);         /* slightly lighter card */
    --bg-hover: hsl(240 5% 11%);          /* hover state */
    --border: hsl(240 4% 16%);            /* zinc-800 */
    --border-strong: hsl(240 5% 26%);     /* zinc-700 */
    --text: hsl(0 0% 98%);                /* zinc-50 */
    --text-dim: hsl(240 5% 65%);          /* zinc-400 */
    --text-muted: hsl(240 4% 46%);        /* zinc-500 */

    --accent: hsl(160 70% 42%);             /* emerald-500 — premium, anti-AI-purple */
    --accent-hover: hsl(160 75% 48%);
    --accent-fg: hsl(0 0% 100%);

    --green: hsl(142 71% 45%);
    --red: hsl(0 72% 51%);
    --yellow: hsl(38 92% 50%);
    --blue: hsl(217 91% 60%);
    --orange: hsl(25 95% 53%);

    --font-mono: 'Geist Mono', ui-monospace, 'SF Mono', 'Cascadia Mono', monospace;

    --sidebar-w: 240px;
    --radius: 0.5rem;            /* 8px — shadcn default */
    --radius-sm: 0.375rem;       /* 6px — buttons */
    --radius-lg: 0.75rem;        /* 12px — large cards */

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.5);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.4), 0 1px 2px -1px rgb(0 0 0 / 0.4);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.4);
}

/* LIGHT THEME — white background, light gray cards */
body.theme-light {
    --bg: hsl(0 0% 100%);                 /* pure white background */
    --bg-card: hsl(240 5% 96%);           /* zinc-100 — light gray cards */
    --bg-hover: hsl(240 5% 92%);          /* zinc-200 */
    --border: hsl(240 6% 88%);            /* zinc-200 */
    --border-strong: hsl(240 5% 80%);     /* zinc-300 */
    --text: hsl(240 10% 3.9%);            /* zinc-950 */
    --text-dim: hsl(240 4% 35%);          /* darker for readability */
    --text-muted: hsl(240 4% 50%);        /* zinc-500 */

    --accent: hsl(160 70% 36%);             /* emerald-600 — stronger on light */
    --accent-hover: hsl(160 75% 32%);

    --green: hsl(142 76% 36%);
    --red: hsl(0 84% 60%);
    --yellow: hsl(35 91% 38%);
    --blue: hsl(217 91% 50%);

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.06), 0 1px 2px -1px rgb(0 0 0 / 0.04);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.05);
}

body.theme-light .card {
    background: var(--bg-card);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
    border: 1px solid var(--border);
}
/* Light theme — body background fix */
body.theme-light { background: var(--bg); color: var(--text); }
body.theme-light main, body.theme-light #content { background: var(--bg); }

body.theme-light #sidebar {
    background: #ffffff;
    border-right: 1px solid var(--border);
    box-shadow: 1px 0 0 rgba(0,0,0,0.02);
}

body.theme-light #top-bar {
    border-bottom: 1px solid var(--border);
}

body.theme-light .modal {
    background: #ffffff;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

body.theme-light .alert-panel {
    background: #ffffff;
    box-shadow: -4px 0 20px rgba(0,0,0,0.08);
}

body.theme-light input,
body.theme-light textarea,
body.theme-light select {
    background: #ffffff !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

body.theme-light pre,
body.theme-light code {
    background: hsl(210 13% 95%);
    color: hsl(210 12% 16%);
    border: 1px solid hsl(210 14% 89%);
}

body.theme-light .featured-article {
    background: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
}

body.theme-light .article-content em {
    color: var(--orange);
    background: rgba(217, 119, 87, 0.1);
    padding: 0 4px;
    border-radius: 3px;
}

body.theme-light .article-content blockquote {
    background: #f6f8fa;
    border-left-color: var(--accent);
}

body.theme-light .briefing-card,
body.theme-light .terminal-card,
body.theme-light .featured-article {
    border-top-color: var(--accent);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

::selection {
    background: hsla(160, 70%, 42%, 0.25);
    color: var(--text);
}

html {
    font-feature-settings: "rlig" 1, "calt" 1;
    scroll-behavior: smooth;
}

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

/* Focus-visible — global ring for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
:focus:not(:focus-visible) { outline: none; }

body {
    font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.01em;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
}

/* Sidebar — shadcn style */
#sidebar .logo {
    padding: 16px 20px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}
#sidebar .logo h1 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text);
}
#sidebar .logo .subtitle {
    font-size: 11px;
    color: var(--text-dim);
    font-weight: 500;
    letter-spacing: 0.02em;
}

#sidebar {
    width: 260px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 0;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    z-index: 1001;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}
#sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0,0,0,0.4);
}
.mobile-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.55); z-index: 1000;
    animation: fadeIn 0.2s ease;
}
/* fadeIn defined once in portal section below */

/* Hamburger button — always visible (sidebar collapsed by default) */
.hamburger {
    display: block;
    position: fixed; top: 10px; left: 10px; z-index: 1002;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 8px 12px; cursor: pointer;
    color: var(--text); font-size: 20px; line-height: 1;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: background 0.15s, border-color 0.15s;
}
.hamburger:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.hamburger:active { transform: scale(0.95); }

.logo {
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--border);
}

.logo h1 {
    font-size: 22px;
    color: var(--accent);
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo .subtitle {
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
}

#sidebar ul {
    list-style: none;
    flex: 1;
    padding: 4px 0;
}

.nav-group-label {
    padding: 12px 20px 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

#sidebar li a {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    margin: 1px 8px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border-left: none;
    transition: background 0.15s, color 0.15s;
}

#sidebar li a:hover {
    color: var(--text);
    background: var(--bg-hover);
}
#sidebar li a:focus-visible {
    outline-offset: -2px;
}

body.theme-light #sidebar li a:hover { background: hsl(240 5% 96%); }

#sidebar li a.nav-external {
    color: var(--text-dim);
    font-size: 12px;
    opacity: 0.7;
    padding: 6px 20px;
}

#sidebar li a.nav-external:hover {
    opacity: 1;
    color: var(--accent);
}

#sidebar li a.active {
    color: var(--text);
    background: var(--bg-hover);
    font-weight: 600;
}
body.theme-light #sidebar li a.active {
    background: hsl(240 5% 92%);
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    position: sticky;
    bottom: 0;
    background: var(--bg-card);
    color: var(--text-dim);
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--green);
    border-radius: 50%;
    margin-right: 6px;
}

/* Seldon Alert Banner */
.seldon-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: rgba(231,76,60,0.1);
    border: 1px solid var(--red);
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 13px;
    animation: pulse-border 2s infinite;
}
@keyframes pulse-border {
    0%, 100% { border-color: var(--red); }
    50% { border-color: var(--yellow); }
}
.banner-icon { font-size: 18px; }
.banner-badge {
    background: var(--red);
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}

/* Alert Panel (slide from right) */
.alert-panel {
    position: fixed;
    right: 0;
    top: 0;
    width: 400px;
    max-width: 90vw;
    height: 100vh;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    z-index: 200;
    overflow-y: auto;
    box-shadow: -4px 0 20px rgba(0,0,0,0.3);
}
.alert-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-card);
}
.alert-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    border-left: 3px solid var(--border);
    transition: background 0.15s;
}
.alert-item:hover { background: var(--bg-hover); }

.alert-critical { border-left-color: var(--red); }
.alert-warning  { border-left-color: var(--yellow); }
.alert-info     { border-left-color: var(--blue); }
.alert-emergency { border-left-color: #ff0000; background: hsl(0 72% 51% / 0.05); }

.alert-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.alert-sev-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.alert-sev-critical {
    background: hsl(0 72% 51% / 0.15);
    color: var(--red);
    border: 1px solid hsl(0 72% 51% / 0.3);
}
.alert-sev-warning {
    background: hsl(38 92% 50% / 0.15);
    color: var(--yellow);
    border: 1px solid hsl(38 92% 50% / 0.3);
}
.alert-sev-info {
    background: hsl(217 91% 60% / 0.15);
    color: var(--blue);
    border: 1px solid hsl(217 91% 60% / 0.3);
}
.alert-sev-emergency {
    background: #ff0000;
    color: #fff;
}

.alert-meta {
    font-size: 11px;
    color: var(--text-dim);
    font-weight: 500;
}
.alert-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-left: auto;
}
.alert-dismiss {
    padding: 2px 10px !important;
    height: 24px !important;
    min-width: 24px;
    font-size: 14px !important;
    line-height: 1;
    color: var(--text-dim);
}

.alert-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin: 6px 0 4px;
    line-height: 1.4;
}
.alert-message {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.5;
}

/* Crisis Tracker */
.crisis-tracker-item {
    padding: 12px;
    margin-bottom: 8px;
    background: var(--bg);
    border-radius: 8px;
}
.ct-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.ct-id { font-weight: 700; font-size: 15px; color: var(--accent); }
.ct-urgency { font-size: 11px; font-weight: 700; }
.ct-delta { font-size: 13px; }
.ct-countdown { font-size: 11px; color: var(--text-dim); margin-left: auto; }

.ct-gauges { display: flex; gap: 16px; margin-bottom: 6px; }
.ct-gauge { flex: 1; }
.ct-gauge-label { font-size: 10px; color: var(--text-dim); margin-bottom: 3px; }
.ct-gauge-bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.ct-gauge-fill { height: 100%; border-radius: 3px; transition: width 0.3s; }
.ct-gauge-value { font-size: 13px; font-weight: 700; margin-top: 2px; }

.ct-path-bar { display: flex; height: 20px; border-radius: 4px; overflow: hidden; font-size: 10px; font-weight: 600; }
.ct-path-foundation { background: var(--green); color: #fff; display: flex; align-items: center; justify-content: center; }
.ct-path-empire { background: var(--red); color: #fff; display: flex; align-items: center; justify-content: center; }

.ct-triggers { font-size: 11px; display: flex; gap: 12px; }

/* Top Bar — shadcn */
#top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0 18px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}
.top-bar-left {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dim);
    margin-left: 52px; /* leave room for hamburger button */
}
.top-bar-right {
    display: flex;
    gap: 8px;
    align-items: center;
}
.scope-current {
    color: var(--text);
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* Main Menubar — horizontal section navigation */
.main-menubar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px;
    margin: 0 0 16px;
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.main-menubar::-webkit-scrollbar { display: none; }
.menubar-link {
    padding: 7px 16px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border-radius: calc(var(--radius-sm) - 2px);
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
}
.menubar-link:hover {
    color: var(--text);
    background: var(--bg-card);
}
.menubar-link.active {
    background: var(--bg-card);
    color: var(--text);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}
.menubar-sep {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 6px;
    flex-shrink: 0;
}
@media (max-width: 768px) {
    .main-menubar { margin: 0 -10px 12px; padding: 4px 10px; border-radius: 0; }
    .menubar-link { padding: 6px 12px; font-size: 12px; }
}

/* Main Content — sidebar collapsed by default, content centered */
main {
    margin: 0 auto;
    flex: 1;
    padding: 20px 30px;
    padding-top: 56px;
    max-width: 1400px;
    width: 100%;
}

h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text);
}

h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text);
}

.subtitle-text {
    color: var(--text-dim);
    font-size: 14px;
    margin: -15px 0 20px;
}

/* Pages */
.page { display: none; }
.page.active { display: block; }

/* Cards — shadcn style */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow);
}
.card h3 {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
    color: var(--text);
}
.card h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin: 16px 0 8px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: left;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.stat-card:hover {
    border-color: var(--border-strong);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent);
}

.stat-card .stat-label {
    font-size: 12px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* Two Column Layout */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

@media (max-width: 900px) {
    .two-col { grid-template-columns: 1fr; }
}

/* ============================================================
   MOBILE RESPONSIVE (< 768px)
   ============================================================ */
@media (max-width: 768px) {
    main {
        padding: 12px !important;
        padding-top: 56px !important;
    }

    /* Top bar compact */
    #top-bar { flex-wrap: wrap; gap: 8px; padding: 8px 0; }
    .top-bar-left { font-size: 13px; }
    .top-bar-right { gap: 6px; flex-wrap: wrap; }

    /* Cards */
    .card { padding: 12px; margin-bottom: 12px; }
    .card h3 { font-size: 14px; }

    /* Article */
    .featured-article { padding: 12px; }
    .article-content { font-size: 13px; line-height: 1.7; }
    .article-content h4 { font-size: 14px; }
    .article-stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .article-stat { padding: 10px 6px; }
    .article-stat strong { font-size: 18px; }
    .article-content blockquote { padding: 10px 14px; font-size: 13px; }

    /* Events */
    .event-row { gap: 6px; padding: 6px 0; }
    .event-date { font-size: 11px; min-width: 75px; }
    .event-name { font-size: 12px; }

    /* News list */
    .news-item-compact { flex-wrap: wrap; gap: 4px; }
    .news-item-compact a { font-size: 12px; }

    /* Trends */
    .trend-item { gap: 6px; padding: 4px 0; }
    .trend-topic { font-size: 12px; }

    /* Contact form */
    .form-row { flex-direction: column; }
    #contact-form input, #contact-form select, #contact-form textarea {
        font-size: 16px !important; /* Prevents iOS zoom */
    }

    /* Scores row */
    .ph-scores { grid-template-columns: repeat(2, 1fr) !important; gap: 8px; }
    .ph-score-card { padding: 10px; }
    .ph-score-value { font-size: 22px !important; }

    /* Header */
    .public-header h2 { font-size: 20px; }
    .public-subtitle { font-size: 12px; }

    /* Footer */
    .featured-badge { font-size: 9px; padding: 3px 10px; }

    /* Seldon alert banner */
    .seldon-banner { font-size: 12px; padding: 6px 10px; flex-wrap: wrap; }

    /* Alert panel full width on mobile */
    .alert-panel { width: 100%; }

    /* Two-col always stack */
    .two-col, .three-col { grid-template-columns: 1fr !important; }

    /* Modal full screen on mobile */
    .modal { width: 100% !important; max-width: 100% !important; border-radius: 0 !important; }
    .narrative-modal { max-width: 100% !important; }

    /* Ticker compact */
    .ticker-row { gap: 8px; }
    .ticker-item { min-width: 90px; padding: 8px; }
    .ticker-rate { font-size: 16px; }

    /* Crisis tracker compact */
    .ct-gauges { flex-direction: column; gap: 8px; }
    .ct-header { flex-wrap: wrap; }

    /* Toggle buttons smaller */
    .lang-btn, .scope-btn { padding: 3px 8px; font-size: 10px; }

    /* Seldon score big */
    .seldon-score-value { font-size: 36px !important; }

    /* Thread grid */
    .sf-thread-grid { grid-template-columns: repeat(2, 1fr) !important; }

    /* Narr summary */
    .narr-summary-grid { grid-template-columns: repeat(2, 1fr); }
    .narr-summary-value { font-size: 20px; }

    /* Risk grid */
    .risk-grid { grid-template-columns: 1fr !important; }

    /* Pulse grid */
    .terminal-pulse-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Small phones (<480px) */
@media (max-width: 480px) {
    main { padding: 8px !important; }
    .card { padding: 10px; border-radius: 6px; }
    .article-stats { grid-template-columns: 1fr 1fr; }
    .ph-scores { grid-template-columns: 1fr !important; }
    .sf-thread-grid { grid-template-columns: 1fr !important; }
    .narr-summary-grid { grid-template-columns: 1fr 1fr; }
    .terminal-pulse-grid { grid-template-columns: 1fr 1fr; }
}

/* Toolbar */
.toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}

/* Buttons — shadcn style */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    line-height: 1;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

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

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-fg);
}

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

.btn-sm {
    padding: 6px 12px;
    height: 32px;
    font-size: 13px;
}

.btn-danger {
    background: var(--red);
    border-color: var(--red);
    color: #fff;
}

.btn-accent {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}
.btn-accent:hover { background: #00a383; }

/* Mode Toggle Switch */
.mode-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    font-size: 12px;
    color: var(--text-dim);
}
.toggle-switch {
    display: flex;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}
.toggle-btn {
    padding: 6px 14px;
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s;
}
.toggle-btn:hover { background: var(--bg-hover); }
.toggle-btn.active {
    background: var(--accent);
    color: #fff;
}

/* Inputs */
input[type="text"], input[type="number"], select, textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
}

label {
    display: block;
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 12px;
}

label > input, label > select, label > textarea {
    margin-top: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 16px;
}

/* Badge */
.badge {
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

/* Scrollable list */
.scrollable-list {
    max-height: 400px;
    overflow-y: auto;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th, td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

th {
    color: var(--text-dim);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

tr:hover { background: var(--bg-hover); }

tr { cursor: pointer; }

/* Cycle Display */
.cycle-display {
    text-align: center;
    padding: 20px;
}

.cycle-phase {
    font-size: 36px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.cycle-phase.expansion { color: var(--green); }
.cycle-phase.peak { color: var(--blue); }
.cycle-phase.contraction { color: var(--orange); }
.cycle-phase.trough { color: var(--red); }

.cycle-confidence {
    font-size: 14px;
    color: var(--text-dim);
    margin-top: 8px;
}

/* Status badges */
.status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-completed { background: rgba(0,184,148,0.15); color: var(--green); }
.status-running { background: rgba(9,132,227,0.15); color: var(--blue); }
.status-configuring { background: rgba(253,203,110,0.15); color: var(--yellow); }
.status-failed { background: rgba(231,76,60,0.15); color: var(--red); }
.status-paused { background: rgba(139,143,163,0.15); color: var(--text-dim); }

/* Severity */
.severity-high { color: var(--red); }
.severity-medium { color: var(--yellow); }
.severity-low { color: var(--green); }

/* Pattern cards */
.pattern-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
}

.pattern-card .pattern-name {
    font-weight: 600;
    font-size: 14px;
}

.pattern-card .pattern-desc {
    font-size: 13px;
    color: var(--text-dim);
    margin-top: 4px;
}

/* Agent Cards */
.agents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}

.agent-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.agent-card:hover {
    border-color: var(--border-strong);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.agent-card .agent-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.agent-card .agent-type {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--accent);
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.agent-card .agent-desc {
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 10px;
}

.agent-card .agent-params {
    display: flex;
    gap: 12px;
    font-size: 12px;
}

.agent-card .agent-params span {
    color: var(--text-dim);
}

.agent-card .agent-params strong {
    color: var(--text);
}

/* Progress bar */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg);
    border-radius: 3px;
    overflow: hidden;
    margin: 6px 0;
}

.progress-bar .progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.3s;
}

/* Report content */
.report-content {
    font-size: 14px;
    line-height: 1.7;
    white-space: pre-wrap;
    color: var(--text);
    max-height: 600px;
    overflow-y: auto;
}

/* Entity detail */
.entity-info { font-size: 14px; }
.entity-info dt { color: var(--text-dim); font-size: 12px; margin-top: 10px; }
.entity-info dd { color: var(--text); margin-bottom: 4px; }

.rel-list {
    list-style: none;
    font-size: 13px;
}

.rel-list li {
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}

.rel-arrow { color: var(--accent); margin: 0 6px; }

/* Entity detail enriched */
.entity-header {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.entity-detail-icon {
    font-size: 28px;
    color: var(--accent);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: hsla(160, 70%, 42%, 0.12);
    border-radius: 8px;
}

.entity-detail-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.entity-detail-type {
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.entity-detail-aliases {
    margin-bottom: 12px;
    font-size: 12px;
    color: var(--text-dim);
}

.entity-alias-tag {
    display: inline-block;
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 4px;
    margin: 2px 2px;
    font-size: 11px;
    color: var(--accent);
}

.entity-metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.entity-metric {
    text-align: center;
    padding: 8px;
    background: var(--bg);
    border-radius: 6px;
}

.entity-metric-value {
    font-size: 18px;
    font-weight: 700;
}

.entity-metric-label {
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
}

.entity-attrs {
    background: var(--bg);
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 8px;
}

.entity-attr {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 12px;
    border-bottom: 1px solid var(--border);
}

.entity-attr:last-child { border-bottom: none; }

.entity-attr-key {
    color: var(--text-dim);
    text-transform: capitalize;
}

.entity-attr-val {
    color: var(--text);
    font-weight: 500;
    text-align: right;
    max-width: 60%;
    word-break: break-word;
}

/* Rich relationship items */
.rel-item-rich {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}

.rel-type-badge {
    background: hsla(160, 70%, 42%, 0.15);
    color: var(--accent);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
}

.rel-arrow-icon {
    color: var(--text-dim);
    font-size: 14px;
}

.rel-target-name, .rel-source-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rel-weight-bar {
    width: 40px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    flex-shrink: 0;
}

.rel-weight-fill {
    height: 100%;
    border-radius: 2px;
}

.rel-evidence {
    font-size: 10px;
    color: var(--text-dim);
    white-space: nowrap;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    width: 90%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal h3 {
    font-size: 18px;
    margin-bottom: 16px;
}

.hidden { display: none !important; }

/* Modal close button */
.modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-dim);
    font-size: 20px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    line-height: 1;
    flex-shrink: 0;
}
.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text);
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

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

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* KG Entity row */
.entity-row {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.1s;
}

.entity-row:hover { background: var(--bg-hover); }

.entity-row .entity-name { flex: 1; font-weight: 500; }
.entity-row .entity-type-badge {
    font-size: 10px;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 8px;
    background: hsla(160, 70%, 42%, 0.15);
    color: var(--accent);
    margin-right: 10px;
}
.entity-row .entity-score {
    font-size: 12px;
    color: var(--text-dim);
    min-width: 60px;
    text-align: right;
}

/* Nav divider */
.nav-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 20px;
    list-style: none;
}

/* Nav group labels */
.nav-group-label {
    list-style: none;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-dim);
    opacity: 0.5;
    padding: 12px 20px 4px;
}

/* ============================================================
   HOME / COMMAND CENTER
   ============================================================ */
.home-signal-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 28px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.home-signal-left { min-width: 200px; }

.home-signal-date {
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
}

.home-signal-sub {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 2px;
}

.home-signal-center {
    text-align: center;
    padding: 10px 30px;
    border: 2px solid var(--border);
    border-radius: 12px;
    min-width: 140px;
}

.home-signal-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-dim);
}

.home-signal-value {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: 3px;
    line-height: 1.2;
}

.home-signal-prob {
    font-size: 14px;
    color: var(--text-dim);
}

.home-signal-right {
    font-size: 14px;
    line-height: 1.8;
    text-align: right;
    min-width: 160px;
}

/* ============================================================
   INTRO PAGE
   ============================================================ */
.intro-hero {
    text-align: center;
    padding: 40px 20px 30px;
}

.intro-title {
    font-size: 48px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -2px;
    margin-bottom: 6px;
}

.intro-tagline {
    font-size: 18px;
    color: var(--text-dim);
    margin-bottom: 16px;
    font-style: italic;
}

.intro-desc {
    font-size: 15px;
    color: var(--text);
    line-height: 1.7;
    max-width: 700px;
    margin: 0 auto;
}

.intro-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
    margin-top: 24px;
}

.intro-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.intro-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px hsla(160, 70%, 42%, 0.18);
}

.intro-card-icon {
    font-size: 28px;
    color: var(--accent);
    margin-bottom: 8px;
}

.intro-card h3 {
    font-size: 16px;
    margin-bottom: 6px;
}

.intro-card p {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.5;
}

/* Steps */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.step {
    position: relative;
    padding: 16px;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--accent);
    color: #fff;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
}

.step-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.step-desc {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.5;
}

/* ============================================================
   ARCHITECTURE PAGE
   ============================================================ */
.arch-diagram {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    font-size: 13px;
    line-height: 1.4;
    overflow-x: auto;
    color: var(--accent);
    font-family: 'Geist Mono', ui-monospace, 'SF Mono', monospace;
}

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

.info-item strong {
    display: block;
    color: var(--accent);
    font-size: 14px;
    margin-bottom: 4px;
}

.info-item p {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.5;
    margin: 0;
}

.table-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.table-group h4 {
    font-size: 13px;
    color: var(--accent);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table-group ul {
    list-style: none;
    font-size: 13px;
    color: var(--text-dim);
}

.table-group li {
    padding: 3px 0;
    font-family: 'Geist Mono', ui-monospace, 'SF Mono', monospace;
}

/* ============================================================
   SERVICES PAGE
   ============================================================ */
.svc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.svc-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.svc-dot.up { background: var(--green); }
.svc-dot.down { background: var(--red); }
.svc-dot.unknown { background: var(--text-dim); }

.svc-info { flex: 1; }
.svc-name { font-weight: 600; font-size: 14px; }
.svc-status { font-size: 12px; color: var(--text-dim); }

.cmd-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.cmd-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 14px;
    background: var(--bg);
    border-radius: 6px;
    font-size: 13px;
}

.cmd-item code {
    background: hsla(160, 70%, 42%, 0.12);
    color: var(--accent);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    font-family: 'Geist Mono', ui-monospace, 'SF Mono', monospace;
}

.cmd-item span {
    color: var(--text-dim);
}

/* ============================================================
   HELP PAGE
   ============================================================ */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.faq-item {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.faq-item summary {
    padding: 14px 16px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    transition: background 0.1s;
    list-style: none;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::before {
    content: '+ ';
    color: var(--accent);
    font-weight: 700;
    margin-right: 8px;
}

.faq-item[open] summary::before { content: '- '; }

.faq-item summary:hover { background: var(--bg-hover); }

.faq-answer {
    padding: 0 16px 16px;
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-dim);
}

.faq-answer strong { color: var(--text); }

.faq-answer ol, .faq-answer ul {
    margin: 8px 0 8px 20px;
}

.faq-answer li { margin-bottom: 4px; }

.faq-answer code {
    background: hsla(160, 70%, 42%, 0.12);
    color: var(--accent);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    font-family: 'Geist Mono', ui-monospace, 'SF Mono', monospace;
}

.code-block {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
    font-family: 'Geist Mono', ui-monospace, 'SF Mono', monospace;
    font-size: 12px;
    color: var(--accent);
    overflow-x: auto;
    margin: 8px 0;
    white-space: pre;
}

/* Links grid */
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}

.link-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.15s;
}

.link-card:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}

.link-card strong {
    font-size: 14px;
    color: var(--text);
}

.link-card span {
    font-size: 12px;
    color: var(--accent);
    font-family: 'Geist Mono', ui-monospace, 'SF Mono', monospace;
    margin-top: 4px;
}

/* Diagnostic results */
.diag-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 10px;
}

.diag-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 13px;
}

.diag-icon { font-size: 18px; flex-shrink: 0; }
.diag-label { flex: 1; }
.diag-value { color: var(--text-dim); font-family: 'Geist Mono', ui-monospace, 'SF Mono', monospace; font-size: 12px; }

/* Error row */
.row-error { background: rgba(231,76,60,0.05); }

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--accent);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s;
    z-index: 200;
}

.toast-visible {
    transform: translateY(0);
    opacity: 1;
}

/* ============================================================
   NEWS PAGE
   ============================================================ */
.news-filters {
    margin-bottom: 16px;
}

.sentiment-pills {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.pill {
    padding: 8px 20px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--bg-card);
    color: var(--text-dim);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
}

.pill:hover { border-color: var(--text-dim); }
.pill:focus-visible { outline-offset: 1px; }

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

.pill-pozitiv.active { background: var(--green); border-color: var(--green); }
.pill-neutru.active { background: #636e72; border-color: #636e72; }
.pill-negativ.active { background: var(--red); border-color: var(--red); }

.news-filter-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.news-filter-row select,
.news-filter-row input {
    width: auto;
    min-width: 160px;
    flex: 1;
}

.news-filter-row input { max-width: 350px; }

.news-stats-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.news-stat {
    font-size: 13px;
    color: var(--text-dim);
}

.news-stat strong {
    color: var(--text);
}

.sentiment-bar-container {
    flex: 1;
    min-width: 200px;
    max-width: 400px;
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
}

.sentiment-bar-segment {
    height: 100%;
    transition: width 0.3s;
}

/* News cards */
.news-card {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 8px;
    transition: all 0.15s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.news-card:hover {
    border-color: var(--accent);
    transform: translateX(3px);
}

.news-card-sentiment {
    width: 4px;
    border-radius: 2px;
    flex-shrink: 0;
}

.news-card-sentiment.s-pozitiv { background: var(--green); }
.news-card-sentiment.s-neutru { background: #636e72; }
.news-card-sentiment.s-negativ { background: var(--red); }
.news-card-sentiment.s-pending { background: var(--border); }

.news-card-body {
    flex: 1;
    min-width: 0;
}

.news-card-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
    line-height: 1.4;
}

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

.news-card-meta .source-badge {
    background: hsla(160, 70%, 42%, 0.12);
    color: var(--accent);
    padding: 2px 8px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 11px;
}

.news-card-meta .cat-badge {
    background: rgba(9,132,227,0.12);
    color: var(--blue);
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 11px;
}

.news-card-sentiment-badge {
    padding: 2px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
}

.news-card-sentiment-badge.sb-pozitiv { background: rgba(0,184,148,0.15); color: var(--green); }
.news-card-sentiment-badge.sb-neutru { background: rgba(99,110,114,0.15); color: #b2bec3; }
.news-card-sentiment-badge.sb-negativ { background: rgba(231,76,60,0.15); color: var(--red); }

.news-card-keywords {
    display: flex;
    gap: 4px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.news-card-keywords .kw {
    font-size: 11px;
    padding: 1px 6px;
    background: var(--bg);
    border-radius: 4px;
    color: var(--text-dim);
}

.news-card-link {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    color: var(--text-dim);
    font-size: 18px;
    padding: 0 8px;
}

.news-card:hover .news-card-link { color: var(--accent); }

/* Pagination */
.news-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
    padding: 10px 0;
}

.page-btn {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-dim);
    cursor: pointer;
    font-size: 13px;
}

.page-btn:hover { border-color: var(--accent); color: var(--text); }
.page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================================================
   CYCLES & CALENDAR PAGE
   ============================================================ */
.cycles-now {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 16px;
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    align-items: center;
}

.now-date {
    text-align: center;
    min-width: 160px;
}

.now-date .now-day {
    font-size: 48px;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
}

.now-date .now-month {
    font-size: 18px;
    color: var(--text);
    margin-top: 4px;
}

.now-date .now-weekday {
    font-size: 13px;
    color: var(--text-dim);
}

.now-info {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    flex: 1;
}

.now-block {
    background: var(--bg);
    border-radius: 8px;
    padding: 12px 16px;
    min-width: 150px;
    flex: 1;
}

.now-block-label {
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

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

.now-block-sub {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 2px;
}

.now-progress {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin-top: 6px;
    overflow: hidden;
}

.now-progress-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s;
}

/* Indicators grid */
.cycles-indicators {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.cyc-ind {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    text-align: center;
}

.cyc-ind-value {
    font-size: 24px;
    font-weight: 700;
}

.cyc-ind-label {
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.cyc-ind-sub {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 2px;
}

/* Cycle bands */
.cycle-bands {
    overflow-x: auto;
}

.band-row {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    min-width: 700px;
}

.band-label {
    width: 130px;
    font-size: 12px;
    color: var(--text-dim);
    flex-shrink: 0;
    text-align: right;
    padding-right: 12px;
}

.band-track {
    flex: 1;
    height: 24px;
    background: var(--bg);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.band-segment {
    position: absolute;
    top: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: rgba(255,255,255,0.8);
    border-radius: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.band-marker {
    position: absolute;
    top: -2px;
    width: 2px;
    height: 28px;
    background: var(--accent);
    z-index: 5;
    box-shadow: 0 0 6px hsla(160, 70%, 42%, 0.5);
}

.band-marker::after {
    content: 'ACUM';
    position: absolute;
    top: -14px;
    left: -12px;
    font-size: 8px;
    color: var(--accent);
    font-weight: 700;
}

.band-months {
    display: flex;
    margin-bottom: 8px;
    min-width: 700px;
}

.band-months-spacer {
    width: 130px;
    flex-shrink: 0;
}

.band-months-track {
    flex: 1;
    display: flex;
}

.band-month {
    flex: 1;
    text-align: center;
    font-size: 10px;
    color: var(--text-dim);
    border-left: 1px solid var(--border);
    padding: 2px 0;
}

/* Electoral dots */
.band-dot {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    top: 8px;
    z-index: 3;
    border: 1px solid rgba(255,255,255,0.5);
}

/* Market cycle tags */
.mcycle-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.mcycle-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg);
    border-radius: 8px;
    font-size: 13px;
}

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

.mcycle-dot.active { background: var(--green); }
.mcycle-dot.inactive { background: var(--border); }

.mcycle-name { flex: 1; }
.mcycle-status { font-size: 11px; color: var(--text-dim); }

/* Global indicators */
.global-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.global-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg);
    border-radius: 8px;
    font-size: 13px;
}

.global-item-label { color: var(--text-dim); }
.global-item-value { font-weight: 600; color: var(--text); }

/* Electoral timeline */
.elec-timeline {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.elec-event {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg);
    border-radius: 8px;
    border-left: 3px solid var(--accent);
}

.elec-date {
    min-width: 90px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
}

.elec-title { font-size: 13px; }
.elec-type {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-dim);
    background: var(--bg-card);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Benner chart */
.benner-timeline {
    overflow-x: auto;
    padding-bottom: 8px;
}

.benner-row {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
    min-width: 900px;
}

.benner-label {
    width: 140px;
    font-size: 12px;
    color: var(--text-dim);
    flex-shrink: 0;
    text-align: right;
    padding-right: 12px;
}

.benner-track {
    flex: 1;
    display: flex;
    gap: 2px;
    position: relative;
}

.benner-year {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 0;
    font-size: 10px;
    font-weight: 600;
    border-radius: 3px;
    min-width: 38px;
    text-align: center;
    position: relative;
    transition: all 0.15s;
    cursor: default;
}

.benner-year:hover {
    transform: scale(1.15);
    z-index: 2;
}

.benner-year.panic { background: rgba(231,76,60,0.7); color: #fff; }
.benner-year.peak { background: rgba(0,184,148,0.7); color: #fff; }
.benner-year.trough { background: rgba(9,132,227,0.7); color: #fff; }
.benner-year.current {
    outline: 2px solid #fff;
    outline-offset: 1px;
    box-shadow: 0 0 12px rgba(255,255,255,0.4);
    transform: scale(1.15);
    z-index: 3;
}

.benner-year.past { opacity: 0.5; }
.benner-year.future { opacity: 0.9; }

.benner-legend {
    display: flex;
    gap: 16px;
    margin-bottom: 10px;
    font-size: 12px;
    flex-wrap: wrap;
}

.benner-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.benner-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.benner-status {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    padding: 14px;
    background: var(--bg);
    border-radius: 8px;
    font-size: 13px;
}

.benner-status strong { color: var(--text); }

.benner-accuracy {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.6;
}

.benner-hit { color: var(--green); }
.benner-miss { color: var(--red); }
.benner-partial { color: var(--yellow); }

/* ============================================================
   PSYCHOHISTORY PAGE
   ============================================================ */
.ph-header {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.ph-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
}

.ph-subtitle {
    font-size: 13px;
    color: var(--text-dim);
}

.ph-signal {
    text-align: center;
    padding: 12px 28px;
    border-radius: 10px;
    border: 2px solid;
}

.ph-signal-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.8;
}

.ph-signal-value {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: 2px;
}

.ph-signal-conf {
    font-size: 12px;
    opacity: 0.7;
}

/* Scores strip */
.ph-scores {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

@media (max-width: 900px) {
    .ph-scores { grid-template-columns: repeat(3, 1fr); }
}

.ph-score-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.ph-score-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.ph-score-value {
    font-size: 28px;
    font-weight: 700;
}

.ph-score-label {
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.ph-score-bar {
    width: 80%;
    height: 4px;
    background: var(--bg);
    border-radius: 2px;
    margin: 6px auto 0;
    overflow: hidden;
}

.ph-score-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.5s;
}

/* Three column layout */
.three-col {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

@media (max-width: 900px) {
    .three-col { grid-template-columns: 1fr; }
}

/* Regime card */
.ph-regime-display {
    text-align: center;
    padding: 16px;
}

.ph-regime-name {
    font-size: 24px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.ph-regime-bar {
    display: flex;
    margin: 16px 0 8px;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
}

.ph-regime-seg {
    flex: 1;
    position: relative;
}

.ph-regime-marker {
    position: absolute;
    top: -4px;
    width: 4px;
    height: 16px;
    background: #fff;
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(255,255,255,0.5);
}

.ph-regime-labels {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    color: var(--text-dim);
    text-transform: uppercase;
}

/* Crowd emotion */
.ph-crowd-display {
    text-align: center;
    padding: 16px;
}

.ph-crowd-state {
    font-size: 24px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.ph-crowd-scale {
    display: flex;
    margin: 16px 0 8px;
    gap: 3px;
}

.ph-crowd-dot {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    opacity: 0.3;
}

.ph-crowd-dot.active { opacity: 1; }

/* Decision card */
.ph-decision-display {
    text-align: center;
    padding: 16px;
}

.ph-decision-probs {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.ph-decision-prob {
    flex: 1;
    padding: 8px;
    border-radius: 6px;
    text-align: center;
    font-size: 12px;
}

.ph-decision-prob-value {
    font-size: 20px;
    font-weight: 700;
}

.ph-decision-prob-label {
    font-size: 10px;
    text-transform: uppercase;
    opacity: 0.7;
}

.ph-decision-reason {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.5;
    font-style: italic;
}

/* Turning points */
.tp-list { display: flex; flex-direction: column; gap: 8px; }

.tp-item {
    display: flex;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg);
    border-radius: 8px;
    align-items: flex-start;
    border-left: 3px solid;
}

.tp-icon { font-size: 18px; flex-shrink: 0; margin-top: 2px; }

.tp-body { flex: 1; }
.tp-type { font-weight: 600; font-size: 13px; }
.tp-desc { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.tp-sev { font-size: 11px; font-weight: 600; }

/* Validation */
.ph-val-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}

.ph-val-item {
    padding: 12px;
    background: var(--bg);
    border-radius: 8px;
    text-align: center;
}

.ph-val-value {
    font-size: 22px;
    font-weight: 700;
}

.ph-val-label {
    font-size: 11px;
    color: var(--text-dim);
}

.ph-val-verdict {
    padding: 14px;
    border-radius: 8px;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
}

/* Scenario bar */
.ph-scenario-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    font-size: 13px;
}

.ph-scenario-name { width: 140px; color: var(--text-dim); text-align: right; }

.ph-scenario-bar {
    flex: 1;
    height: 20px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.ph-scenario-fill {
    height: 100%;
    border-radius: 4px;
    display: flex;
    align-items: center;
    padding-left: 6px;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
}

/* Help icon + tooltip */
.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-dim);
    font-size: 10px;
    font-weight: 700;
    cursor: help;
    position: relative;
    vertical-align: middle;
    margin-left: 4px;
    flex-shrink: 0;
    transition: all 0.15s;
    font-style: normal;
}

.help-icon:hover {
    background: var(--accent);
    color: #fff;
}

.help-icon:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    border: 1px solid var(--accent);
    color: var(--text);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.6;
    white-space: pre-line;
    width: 320px;
    max-width: 90vw;
    z-index: 50;
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
    pointer-events: none;
}

.help-icon:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--accent);
    z-index: 51;
}

/* Score card help icon positioning */
.ph-score-label .help-icon {
    width: 14px;
    height: 14px;
    font-size: 9px;
}

/* Tooltip flips to bottom when near top of viewport */
.ph-scores .help-icon:hover::after {
    bottom: auto;
    top: calc(100% + 8px);
}

.ph-scores .help-icon:hover::before {
    bottom: auto;
    top: calc(100% + 2px);
    border-top-color: transparent;
    border-bottom-color: var(--accent);
}

/* Monte Carlo form */
.mc-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
}

@media (max-width: 900px) {
    .mc-form-grid { grid-template-columns: 1fr 1fr; }
}

.slider-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.slider-row input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    outline: none;
    border: none;
    padding: 0;
}

.slider-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
}

.slider-val {
    min-width: 55px;
    text-align: right;
    font-weight: 600;
    color: var(--accent);
    font-size: 14px;
}

/* Scenario builder */
.scenario-event-row {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 6px;
}

.scenario-event-row select,
.scenario-event-row input {
    font-size: 12px;
    padding: 6px 8px;
}

.scenario-event-row .se-field { flex: 1; }

/* Social & Trends */
.keyword-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 0;
}

.keyword-tag {
    padding: 4px 12px;
    border-radius: 14px;
    font-weight: 600;
    cursor: default;
    transition: transform 0.1s;
}

.keyword-tag:hover { transform: scale(1.1); }

.social-card {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}

.social-card:hover { background: var(--bg-hover); }

.social-card-source {
    width: 4px;
    border-radius: 2px;
    flex-shrink: 0;
}

.social-card-source.src-reddit { background: #ff4500; }
.social-card-source.src-twitter { background: #1da1f2; }
.social-card-source.src-google_trends { background: #4285f4; }
.social-card-source.src-telegram { background: #0088cc; }

.social-card-body { flex: 1; min-width: 0; }

.social-card-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
}

.social-card-meta {
    font-size: 12px;
    color: var(--text-dim);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.social-source-badge {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 1px 6px;
    border-radius: 4px;
}

.social-source-badge.src-reddit { background: rgba(255,69,0,0.15); color: #ff4500; }
.social-source-badge.src-twitter { background: rgba(29,161,242,0.15); color: #1da1f2; }
.social-source-badge.src-google_trends { background: rgba(66,133,244,0.15); color: #4285f4; }
.social-source-badge.src-telegram { background: rgba(0,136,204,0.15); color: #0088cc; }

.divergence-alert {
    padding: 14px 20px;
    border-radius: 10px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.divergence-alert .div-icon { font-size: 24px; }

.gtrend-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.gtrend-rank {
    width: 30px;
    font-weight: 700;
    color: var(--accent);
    flex-shrink: 0;
}

.gtrend-topic { flex: 1; }

.gtrend-traffic {
    font-size: 11px;
    color: var(--text-dim);
}

/* Narrative Threads */
.narrative-thread {
    padding: 12px 16px;
    margin-bottom: 10px;
    background: var(--bg-hover);
    border-radius: 6px;
}
.narrative-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.narrative-name { font-weight: 600; font-size: 14px; }
.narrative-prob { font-weight: 700; font-size: 16px; }
.narrative-desc { font-size: 12px; color: var(--text-dim); margin-bottom: 8px; }
.narrative-stats {
    display: flex;
    gap: 20px;
    font-size: 13px;
    margin-bottom: 6px;
}
.narrative-milestones {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.narrative-milestone {
    font-size: 11px;
    padding: 2px 8px;
    background: hsla(160, 70%, 42%, 0.15);
    border-radius: 4px;
    color: var(--text-dim);
}

/* Seldon Score Composite */
.seldon-score-big {
    text-align: center;
    padding: 20px 0;
}
.seldon-score-value {
    font-size: 48px;
    font-weight: 700;
    line-height: 1;
}
.seldon-score-label {
    font-size: 14px;
    color: var(--text-dim);
    margin-top: 4px;
}
.seldon-components {
    display: grid;
    gap: 8px;
    margin-top: 16px;
}
.seldon-component {
    padding: 6px 0;
}
.seldon-comp-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    text-transform: capitalize;
    margin-bottom: 4px;
}

/* Narrative Detail Modal */
.narrative-modal {
    max-width: 900px;
    width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
}
.narr-detail-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.narr-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}
.narr-summary-item {
    text-align: center;
    padding: 12px 8px;
    background: var(--bg);
    border-radius: 8px;
}
.narr-summary-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
}
.narr-summary-label {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 4px;
}
.narr-desc-full {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.5;
    padding: 8px 0;
}

/* Milestones timeline */
.narr-milestone-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
    padding-left: 20px;
}
.narr-milestone-timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--border);
}
.narr-milestone-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    position: relative;
}
.narr-milestone-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    position: absolute;
    left: -17px;
    flex-shrink: 0;
}
.narr-milestone-month {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    min-width: 60px;
}
.narr-milestone-event {
    font-size: 13px;
    color: var(--text);
}

/* Related sims */
.narr-sim-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg);
    border-radius: 6px;
    margin-bottom: 6px;
    cursor: pointer;
    font-size: 13px;
}
.narr-sim-item:hover { background: var(--bg-hover); }

/* Observation form & list */
.narr-obs-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.narr-obs-input-row select {
    padding: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 13px;
}
.narr-obs-input-row input[type="text"] {
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 13px;
}
.narr-obs-input-row input[type="number"] {
    padding: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 13px;
}
.narr-obs-item {
    padding: 10px 14px;
    background: var(--bg);
    border-radius: 6px;
    margin-bottom: 8px;
}
.narr-obs-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    margin-bottom: 4px;
}
.narr-obs-text {
    font-size: 13px;
    line-height: 1.4;
}

/* Clickable thread cards */
.narrative-thread {
    cursor: pointer;
    transition: background 0.15s;
}
.narrative-thread:hover {
    background: var(--bg-card);
}

/* Terminal (Bloomberg-style) */
.terminal-card { border-top: 2px solid var(--accent); }
.terminal-alerts { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.terminal-alert {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 14px; background: var(--bg-card); border-left: 3px solid;
    border-radius: 4px; font-size: 13px;
}
.terminal-alert-sev { font-weight: 700; font-size: 11px; min-width: 60px; }

.ticker-row { display: flex; flex-wrap: wrap; gap: 16px; }
.ticker-item { flex: 1; min-width: 120px; padding: 12px; background: var(--bg); border-radius: 6px; text-align: center; }
.ticker-pair { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }
.ticker-rate { font-size: 20px; font-weight: 700; margin: 4px 0; }
.ticker-change { font-size: 12px; font-weight: 600; }
.ticker-rates { display: flex; gap: 16px; margin-top: 10px; flex-wrap: wrap; }
.ticker-rate-item { font-size: 13px; padding: 4px 10px; background: var(--bg); border-radius: 4px; }

.terminal-pulse-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.pulse-item { text-align: center; padding: 12px 8px; background: var(--bg); border-radius: 6px; }
.pulse-label { font-size: 10px; font-weight: 700; color: var(--text-dim); letter-spacing: 1px; }
.pulse-value { font-size: 22px; font-weight: 700; margin: 4px 0; }
.pulse-sub { font-size: 11px; color: var(--text-dim); }

.risk-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.risk-item { padding: 10px 14px; background: var(--bg); border-radius: 6px; }
.risk-header { display: flex; justify-content: space-between; margin-bottom: 6px; }
.risk-category { font-size: 12px; font-weight: 600; text-transform: capitalize; }
.risk-level { font-size: 11px; font-weight: 700; }
.risk-factor { font-size: 11px; color: var(--text-dim); padding: 2px 0; }

.terminal-news-item {
    position: relative; padding: 8px 12px 8px 50px;
    margin-bottom: 4px; border-radius: 4px; overflow: hidden;
}
.terminal-news-impact {
    position: absolute; left: 0; top: 0; bottom: 0;
    border-radius: 4px 0 0 4px;
}
.terminal-news-content { position: relative; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.terminal-news-score { font-weight: 700; font-size: 14px; min-width: 30px; text-align: center; }
.terminal-news-title { font-size: 13px; color: var(--text); text-decoration: none; flex: 1; }
.terminal-news-title:hover { color: var(--accent); }
.terminal-news-meta { font-size: 11px; color: var(--text-dim); }

/* Graph (Palantir-style) */
.graph-stat { font-size: 13px; margin-bottom: 4px; }
.graph-rank-item {
    display: flex; align-items: center; gap: 8px;
    padding: 4px 0; font-size: 13px;
}

/* Public Navbar — shadcn tabs */
.public-navbar {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 16px 0 24px;
    padding: 4px;
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
    overflow-x: auto;
}
.pub-nav-link {
    padding: 6px 14px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border-radius: calc(var(--radius-sm) - 2px);
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.pub-nav-link:hover {
    color: var(--text);
}
.pub-nav-link.active {
    background: var(--bg-card);
    color: var(--text);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.pub-section {
    animation: fadeIn 0.3s;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Bullet links to source */
.bullet-link {
    color: var(--text);
    text-decoration: none;
    flex: 1;
}
.bullet-link:hover {
    color: var(--accent);
    text-decoration: underline;
}
.read-source {
    font-size: 14px;
    color: var(--accent);
    text-decoration: none;
    margin-left: 6px;
    opacity: 0.6;
    transition: opacity 0.15s;
}
.read-source:hover {
    opacity: 1;
}

/* Article cards (list view) — shadcn style */
.article-card {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 16px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
    box-shadow: var(--shadow-sm);
}
.article-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.article-card-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.25;
    margin: 12px 0 6px;
    color: var(--text);
}
.article-card-meta {
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 12px;
    font-weight: 500;
}
.article-card-intro {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-dim);
    margin-bottom: 16px;
}
.article-card-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.article-card-readmore {
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
}
.article-card-lang,
.article-card-views {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Article detail view */
#article-detail { animation: fadeIn 0.3s; }
.article-detail-header {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}
.article-detail-card {
    padding: 40px;
}
.article-detail-title {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin: 12px 0 12px;
    color: var(--text);
}
.article-detail-footer {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

@media (max-width: 768px) {
    .article-detail-card { padding: 20px; }
    .article-detail-title { font-size: 26px; }
    .article-card { padding: 16px; }
    .article-card-title { font-size: 18px; }
}

/* Article language switch */
.lang-switch {
    display: inline-block;
    margin-left: 12px;
    padding: 3px 10px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}
.lang-switch:hover { background: var(--accent-hover); }
.lang-badge {
    display: inline-block;
    margin-left: 12px;
    padding: 2px 8px;
    background: var(--bg-hover);
    color: var(--text-dim);
    border-radius: 4px;
    font-size: 11px;
}
.article-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

/* Daily Briefing — shadcn */
.briefing-card {
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.briefing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}
.briefing-tabs {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 4px;
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
    flex-wrap: wrap;
}
.briefing-tab {
    padding: 6px 14px;
    background: transparent;
    border: none;
    border-radius: calc(var(--radius-sm) - 2px);
    color: var(--text-dim);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    transition: background 0.15s, color 0.15s;
}
.briefing-tab.active {
    background: var(--bg-card);
    color: var(--text);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}
.briefing-tab:hover:not(.active) { color: var(--text); }

.briefing-meta {
    display: flex; gap: 16px; font-size: 12px; color: var(--text-dim);
    margin-bottom: 12px; flex-wrap: wrap;
}
.briefing-summary { font-size: 14px; line-height: 1.7; margin-bottom: 12px; }
.briefing-bullets { list-style: none; padding: 0; margin: 8px 0; }
.briefing-bullets li {
    padding: 6px 0; font-size: 13px; display: flex; align-items: center; gap: 8px;
    border-bottom: 1px solid var(--border);
}
.bullet-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.bullet-source { color: var(--text-dim); font-size: 11px; }

.briefing-table {
    width: 100%; font-size: 13px; margin: 8px 0 16px;
}
.briefing-table td { padding: 5px 0; border-bottom: 1px solid var(--border); }
.briefing-table td:first-child { color: var(--text-dim); }
.briefing-table td:last-child { text-align: right; color: var(--accent); }

.briefing-articles { font-size: 12px; padding-left: 20px; }
.briefing-articles li { padding: 3px 0; }
.briefing-articles a { color: var(--text); text-decoration: none; }
.briefing-articles a:hover { color: var(--accent); }

/* Events table */
.events-table { width: 100%; font-size: 13px; }
.events-table th {
    text-align: left; padding: 6px 8px; border-bottom: 2px solid var(--border);
    font-size: 11px; color: var(--text-dim); text-transform: uppercase;
}
.events-table td { padding: 8px; border-bottom: 1px solid var(--border); }
.event-cat {
    padding: 2px 8px; background: hsla(160, 70%, 42%, 0.15);
    border-radius: 4px; font-size: 11px; color: var(--accent);
}

/* Featured Article — shadcn card */
.featured-article {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.featured-article h3 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.2;
    margin: 4px 0 8px;
}
.featured-badge {
    display: inline-flex;
    align-items: center;
    background: var(--bg-hover);
    color: var(--text);
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    border-radius: 9999px;
    border: 1px solid var(--border);
    margin-bottom: 8px;
    position: static;
    width: fit-content;
}
.featured-date {
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 24px;
    font-weight: 500;
}
.article-content {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text);
}
.article-content p { margin-bottom: 16px; }
.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
    color: var(--text);
    font-weight: 700;
    letter-spacing: -0.018em;
    line-height: 1.25;
}
.article-content h1 { font-size: 28px; margin: 36px 0 14px; }
.article-content h2 { font-size: 24px; margin: 32px 0 12px; }
.article-content h3 { font-size: 20px; margin: 30px 0 12px; }
.article-content h4 { font-size: 18px; margin: 28px 0 10px; }
.article-content h5 { font-size: 16px; margin: 24px 0 8px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); }
.article-content h6 { font-size: 14px; margin: 20px 0 6px; color: var(--text-dim); }

/* Article hero header (badge + title + date) inside detail view */
.article-detail-hero {
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--border);
}
.article-detail-hero .featured-badge { margin-bottom: 14px; }
.article-detail-hero .article-detail-title { margin: 0 0 12px 0; }
.article-detail-hero .featured-date { margin: 0; color: var(--text-dim); font-size: 14px; }
@media (max-width: 768px) {
    .article-detail-hero { margin-bottom: 20px; padding-bottom: 18px; }
}
.article-content blockquote {
    border-left: 4px solid var(--accent);
    padding: 16px 24px;
    margin: 24px 0;
    font-style: italic;
    color: var(--text-dim);
    background: var(--bg-hover);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 15px;
}
.article-content em {
    color: var(--accent);
    font-style: italic;
    font-weight: 500;
    background: hsl(160 70% 42% / 0.08);
    padding: 0 4px;
    border-radius: 3px;
    border-bottom: 1px dashed hsl(160 70% 42% / 0.4);
}
body.theme-light .article-content em {
    background: hsl(160 70% 36% / 0.08);
    border-bottom-color: hsl(160 70% 36% / 0.4);
}
.article-content strong {
    font-weight: 700;
    color: var(--text);
    background: linear-gradient(180deg, transparent 60%, hsl(160 70% 42% / 0.15) 60%);
    padding: 0 1px;
}
body.theme-light .article-content strong {
    background: linear-gradient(180deg, transparent 60%, hsl(160 70% 36% / 0.18) 60%);
}
.article-content ul, .article-content ol { padding-left: 24px; margin: 12px 0 16px; }
.article-content li { margin-bottom: 6px; }
.article-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin: 20px 0;
}
.article-stat {
    text-align: left;
    padding: 16px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.article-stat strong {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.025em;
    line-height: 1.1;
    margin-bottom: 6px;
}
.article-stat span {
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.4;
}

/* Public Home Page — shadcn hero */
.public-header {
    text-align: center;
    padding: 48px 0 32px;
}
.public-header h2 {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
}
.public-subtitle {
    color: var(--text-dim);
    font-size: 16px;
    margin-top: 12px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

.event-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.event-row:last-child { border-bottom: none; }
.event-date { font-size: 12px; color: var(--accent); font-family: 'Geist Mono', ui-monospace, 'SF Mono', monospace; min-width: 90px; }
.event-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.event-name { font-size: 13px; }

.news-list-compact { display: flex; flex-direction: column; gap: 6px; }
.news-item-compact {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}
.news-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

.trend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}
.trend-item:last-child { border-bottom: none; }
.trend-rank {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    min-width: 20px;
    text-align: center;
}
.trend-topic { font-size: 13px; flex: 1; }
.trend-traffic { font-size: 11px; color: var(--text-dim); }

/* Forms — shadcn input style */
#contact-form textarea,
#contact-form input[type="text"],
#contact-form input[type="email"],
#contact-form select {
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}
#contact-form input:focus,
#contact-form textarea:focus,
#contact-form select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px hsl(160 70% 42% / 0.15);
}
#contact-form label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
}

/* Second Foundation Auth Gate */
.sf-lock-box {
    text-align: center;
    padding: 80px 40px;
    max-width: 400px;
    margin: 60px auto;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
}
.sf-lock-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.6;
}

/* Second Foundation */
.sf-thread-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}
.sf-thread-card {
    text-align: center;
    padding: 16px 8px;
    background: var(--bg);
    border-radius: 8px;
}
.sf-thread-name { font-size: 12px; color: var(--text-dim); margin-bottom: 4px; }
.sf-thread-prob { font-size: 22px; font-weight: 700; }
.sf-thread-delta { font-size: 14px; font-weight: 600; margin-top: 2px; }

.sf-suggestion {
    padding: 12px 16px;
    margin-bottom: 10px;
    background: var(--bg-hover);
    border-radius: 6px;
}
.sf-suggestion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 4px;
}
.cb { display: flex; align-items: center; gap: 4px; font-size: 13px; cursor: pointer; }
.cb input { cursor: pointer; }

/* Tactics */
.sf-tactic {
    padding: 16px;
    margin-bottom: 14px;
    background: var(--bg-hover);
    border-radius: 8px;
}
.sf-tactic-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}
.sf-tactic-name { font-size: 15px; font-weight: 600; }
.sf-tactic-goal { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.sf-success-rate { font-size: 18px; font-weight: 700; }
.sf-tactic-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.sf-message-box {
    background: var(--bg);
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 12px;
}
.sf-message-emotion {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--accent);
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.sf-message-angle {
    font-size: 14px;
    font-style: italic;
    color: var(--text);
}

/* Conversion Funnel */
.sf-funnel {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 12px;
    background: var(--bg);
    border-radius: 6px;
    padding: 12px;
}
.sf-funnel-step {
    flex: 1;
    text-align: center;
}
.sf-funnel-value {
    font-size: 16px;
    font-weight: 700;
}
.sf-funnel-label {
    font-size: 10px;
    color: var(--text-dim);
    margin: 2px 0 4px;
}
.sf-funnel-bar {
    height: 4px;
    border-radius: 2px;
    min-width: 4px;
}
.sf-funnel-arrow {
    color: var(--text-dim);
    font-size: 16px;
    flex-shrink: 0;
}

.sf-tactic-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.sf-actors {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12px;
}
.sf-actor {
    padding: 2px 8px;
    background: hsla(160, 70%, 42%, 0.15);
    border-radius: 4px;
    cursor: help;
}

/* Language & Scope Toggles */
.lang-scope-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    justify-content: center;
}
.lang-toggle, .scope-toggle {
    display: inline-flex;
    align-items: center;
    padding: 3px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    gap: 2px;
}
.lang-btn, .scope-btn {
    padding: 4px 10px;
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    border-radius: calc(var(--radius-sm) - 2px);
    font-family: inherit;
    transition: background 0.15s, color 0.15s;
}
.lang-btn.active, .scope-btn.active {
    background: var(--bg-card);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}
.lang-btn:hover:not(.active),
.scope-btn:hover:not(.active) { color: var(--text); }

@media (max-width: 900px) {
    .sf-thread-grid { grid-template-columns: repeat(3, 1fr); }
    .sf-funnel { flex-wrap: wrap; }
    .sf-funnel-arrow { display: none; }
}

/* ============================================================
   NEWS PORTAL — full portal layout (stream + cat sections + sidebar)
   ============================================================ */
.news-portal-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 16px;
    margin-top: 16px;
    align-items: start;
}
@media (max-width: 1024px) {
    .news-portal-grid { grid-template-columns: 1fr; }
}

.news-portal-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.news-portal-sidebar { display: flex; flex-direction: column; gap: 12px; }

.portal-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.portal-section-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.portal-cat-filter { display: flex; gap: 6px; flex-wrap: wrap; }
.cat-chip {
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 500;
    background: var(--bg-hover);
    color: var(--text-dim);
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}
.cat-chip:hover { color: var(--text); border-color: var(--border-strong); }
.cat-chip:focus-visible { outline-offset: 1px; }
.cat-chip.active {
    background: var(--accent);
    color: var(--accent-fg);
    border-color: var(--accent);
}

.portal-news-item {
    position: relative;
    display: flex;
    gap: 14px;
    padding: 14px 16px 14px 0;
    border-bottom: 1px solid var(--border);
}
.portal-news-item:last-child { border-bottom: none; padding-bottom: 4px; }
.portal-news-item.compact { padding: 10px 16px 10px 0; gap: 10px; }
.portal-news-body { flex: 1; min-width: 0; }

.portal-news-thumb {
    flex-shrink: 0;
    display: block;
    width: 120px;
    height: 80px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-hover);
    border: 1px solid var(--border);
}
.portal-news-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}
.portal-news-thumb:hover img { transform: scale(1.04); }
.portal-news-item.compact .portal-news-thumb {
    width: 84px;
    height: 60px;
}

.portal-news-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
    flex-wrap: wrap;
}
.portal-news-source { font-weight: 500; color: var(--text-dim); }
.portal-news-time { margin-left: auto; color: var(--text-muted); }

.portal-news-title {
    font-size: 14px;
    line-height: 1.45;
    font-weight: 600;
    margin: 4px 0 0 0;
}
.portal-news-title a {
    color: var(--text);
    text-decoration: none;
    transition: color 0.15s;
}
.portal-news-title a:hover { color: var(--accent); }
.portal-news-item.compact .portal-news-title { font-size: 13px; }

.portal-news-keywords {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 6px;
}
.kw-pill {
    font-size: 10px;
    padding: 2px 7px;
    background: var(--bg-hover);
    color: var(--text-dim);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.cat-badge {
    display: inline-block;
    padding: 2px 7px;
    font-size: 9px;
    font-weight: 700;
    border-radius: var(--radius-sm);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.cat-politica       { background: hsla(217, 91%, 60%, 0.15); color: hsl(217 91% 70%); }
.cat-economie       { background: hsla(142, 71%, 45%, 0.15); color: hsl(142 71% 55%); }
.cat-international  { background: hsla(160, 70%, 42%, 0.18); color: hsl(160 70% 50%); }
.cat-ai             { background: hsla(160, 70%, 42%, 0.25); color: hsl(160 70% 55%); }
.cat-tehnologie     { background: hsla(38, 92%, 50%, 0.15); color: hsl(38 92% 60%); }
.cat-sanatate       { background: hsla(0, 72%, 51%, 0.12); color: hsl(0 72% 65%); }
.cat-justitie       { background: hsla(25, 95%, 53%, 0.15); color: hsl(25 95% 63%); }
.cat-social         { background: hsla(180, 60%, 50%, 0.15); color: hsl(180 60% 60%); }
.cat-energie        { background: hsla(60, 80%, 50%, 0.15); color: hsl(60 80% 60%); }
.cat-mediu          { background: hsla(120, 60%, 45%, 0.15); color: hsl(120 60% 55%); }
.cat-altele         { background: var(--bg-hover); color: var(--text-dim); }
.cat-cyber_security { background: hsla(280, 70%, 55%, 0.15); color: hsl(280 70% 65%); }

/* ============================================================
   SENTINEL — Cybersecurity Threat Intelligence
   ============================================================ */
.sentinel-threat-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.sentinel-normal   { background: hsla(160, 70%, 42%, 0.15); color: hsl(160 70% 50%); }
.sentinel-elevated { background: hsla(38, 92%, 50%, 0.18); color: hsl(38 92% 55%); }
.sentinel-high     { background: hsla(25, 95%, 53%, 0.18); color: hsl(25 95% 60%); }
.sentinel-critical {
    background: hsla(0, 72%, 51%, 0.18);
    color: hsl(0 72% 60%);
    animation: sentinel-pulse 2s ease-in-out infinite;
}
@keyframes sentinel-pulse {
    0%, 100% { box-shadow: 0 0 0 0 hsla(0, 72%, 51%, 0.4); }
    50% { box-shadow: 0 0 0 6px hsla(0, 72%, 51%, 0); }
}

.sentinel-sev-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 500;
    color: var(--text-dim);
    background: var(--bg-card);
    border: 1px solid var(--border);
}
.sentinel-sev-chip strong { font-weight: 700; }
.sev-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}
.sev-critical .sev-dot { background: hsl(0 72% 51%); }
.sev-critical strong   { color: hsl(0 72% 60%); }
.sev-high .sev-dot     { background: hsl(25 95% 53%); }
.sev-high strong       { color: hsl(25 95% 60%); }
.sev-medium .sev-dot   { background: hsl(38 92% 50%); }
.sev-medium strong     { color: hsl(38 92% 55%); }
.sev-low .sev-dot      { background: var(--text-muted); }
.sev-low strong        { color: var(--text-dim); }

/* Sentinel card severity border */
.sentinel-card { border-left: 3px solid var(--border); }
.sentinel-card.sev-critical { border-left-color: hsl(0 72% 51%); }
.sentinel-card.sev-high     { border-left-color: hsl(25 95% 53%); }
.sentinel-card.sev-medium   { border-left-color: hsl(38 92% 50%); }
.sentinel-card.sev-low      { border-left-color: var(--text-muted); }

.sentinel-sev-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: var(--radius-sm);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.sentinel-sev-badge.sev-critical { background: hsla(0, 72%, 51%, 0.15); color: hsl(0 72% 60%); }
.sentinel-sev-badge.sev-high     { background: hsla(25, 95%, 53%, 0.15); color: hsl(25 95% 60%); }
.sentinel-sev-badge.sev-medium   { background: hsla(38, 92%, 50%, 0.15); color: hsl(38 92% 55%); }
.sentinel-sev-badge.sev-low      { background: var(--bg-hover); color: var(--text-dim); }

.sentinel-threat-badge-inline {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.03em;
    background: hsla(280, 70%, 55%, 0.12);
    color: hsl(280 70% 65%);
}

.sentinel-cve {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    font-family: var(--font-mono, monospace);
    background: hsla(0, 72%, 51%, 0.1);
    color: hsl(0 72% 60%);
    letter-spacing: 0.02em;
}

.sentiment-dot {
    position: absolute;
    right: 0;
    top: 18px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
}
.sent-pozitiv { background: var(--green); }
.sent-negativ { background: var(--red); }
.sent-neutru  { background: var(--text-muted); }

/* Sidebar widgets */
.sidebar-card { padding: 14px 16px; }
.sidebar-card h4 {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    margin: 0 0 10px 0;
    letter-spacing: 0.06em;
}

.portal-see-more {
    font-size: 12px;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
}
.portal-see-more:hover { text-decoration: underline; }

.sidebar-analysis-item {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    transition: opacity 0.15s;
}
.sidebar-analysis-item:last-child { border-bottom: none; padding-bottom: 0; }
.sidebar-analysis-item:hover { opacity: 0.75; }
.sidebar-analysis-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
    margin-bottom: 3px;
}
.sidebar-analysis-meta {
    font-size: 10px;
    color: var(--text-muted);
}

.sidebar-event-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
}
.sidebar-event-item:last-child { border-bottom: none; padding-bottom: 0; }
.sidebar-event-date {
    font-size: 10px;
    color: var(--accent);
    font-family: var(--font-mono, monospace);
    font-weight: 600;
}
.sidebar-event-name {
    font-size: 12px;
    color: var(--text);
    line-height: 1.4;
}

/* Sidebar trending — slightly tighter than the main trend-item */
.sidebar-card .trend-item {
    gap: 8px;
    padding: 7px 0;
}
.sidebar-card .trend-rank {
    font-size: 11px;
    min-width: 20px;
}
.sidebar-card .trend-topic { font-size: 12px; }
.sidebar-card .trend-traffic { font-size: 10px; }

/* Mobile tweaks for portal */
@media (max-width: 768px) {
    .portal-section-header { flex-direction: column; align-items: flex-start; gap: 8px; }
    .portal-cat-filter { width: 100%; }
    .news-portal-grid { gap: 12px; margin-top: 12px; }
    .sidebar-card { padding: 12px; }
    .portal-news-item { padding-right: 14px; gap: 10px; }
    .portal-news-thumb { width: 90px; height: 64px; }
    .portal-news-item.compact .portal-news-thumb { width: 70px; height: 50px; }
}

/* ============================================================
   2026 PORTAL — Bento Hero / Live Ticker / Cmd+K / Skeletons
   ============================================================ */
:root {
    --font-display: "Geist", "Satoshi", "Cabinet Grotesk", -apple-system, sans-serif;
    --bg-glass: hsla(240, 10%, 5.9%, 0.65);
    --shadow-bento: 0 1px 0 hsla(0,0%,100%,0.04) inset, 0 12px 40px -16px rgba(0,0,0,0.5);
    --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
    --reveal-y: 12px;

}

/* Universal: images never overflow their container (Tailwind preflight is OFF) */
img { max-width: 100%; height: auto; }
body.theme-light {
    --bg-glass: hsla(0, 0%, 100%, 0.75);
    --shadow-bento: 0 1px 0 hsla(0,0%,0%,0.03) inset, 0 8px 24px -12px rgba(0,0,0,0.1);
}

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0s !important; transition-duration: 0s !important; }
    .reveal { opacity: 1 !important; transform: none !important; }
}

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(var(--reveal-y)); transition: opacity 0.5s var(--ease-out-quart), transform 0.5s var(--ease-out-quart); }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ----- Skeletons ----- */
.skel {
    background: linear-gradient(90deg, var(--bg-hover) 0%, hsla(240, 5%, 18%, 0.5) 50%, var(--bg-hover) 100%);
    background-size: 200% 100%;
    animation: skel-shimmer 1.4s linear infinite;
    border-radius: var(--radius-sm);
}
body.theme-light .skel { background: linear-gradient(90deg, hsl(240 5% 94%) 0%, hsl(240 5% 88%) 50%, hsl(240 5% 94%) 100%); background-size: 200% 100%; }
@keyframes skel-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.skel-line { height: 12px; margin-bottom: 8px; }
.skel-w50 { width: 50%; }
.skel-w60 { width: 60%; }
.skel-w70 { width: 70%; }
.skel-w80 { width: 80%; }
.skel-w90 { width: 90%; }
.skel-thumb { height: 200px; }
.skel-thumb-sm { height: 80px; }
.skel-card { height: 280px; border-radius: var(--radius); }
.skel-lane-card { display: inline-block; width: 260px; height: 220px; margin-right: 12px; flex-shrink: 0; }
.skel-mag-card { height: 240px; }

/* ----- Live Ticker ----- */
.live-ticker {
    margin: 8px 0 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    overflow: hidden;
    position: relative;
    height: 36px;
    display: flex;
    align-items: center;
}
.live-ticker::before {
    content: "LIVE";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    padding: 0 14px;
    background: var(--accent);
    color: var(--accent-fg);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    z-index: 2;
    box-shadow: 6px 0 12px var(--bg-card);
}
.ticker-track {
    display: flex;
    gap: 28px;
    padding-left: 70px;
    white-space: nowrap;
    animation: ticker-scroll 90s linear infinite;
    will-change: transform;
}
.live-ticker:hover .ticker-track { animation-play-state: paused; }
@keyframes ticker-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}
.ticker-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-dim);
}
.ticker-item strong { color: var(--text); font-weight: 700; }
.ticker-item .delta-up { color: var(--green); font-size: 11px; }
.ticker-item .delta-down { color: var(--red); font-size: 11px; }
.ticker-item .delta-flat { color: var(--text-muted); font-size: 11px; }
.ticker-loading { padding-left: 80px; color: var(--text-dim); font-size: 12px; }

/* AI digest, jump chips → migrated to Tailwind in index.html */

/* Hero bento cells, big-read, crisis-row, mood, sparklines, secondary
   → All migrated to Tailwind utility classes in index.html / app.js
   Pulse animation for status dots is kept globally below. */
@keyframes dot-pulse {
    0%, 100% { box-shadow: 0 0 0 0 hsla(142, 71%, 45%, 0.6); }
    50% { box-shadow: 0 0 0 6px hsla(142, 71%, 45%, 0); }
}
.bento-status-dot.pulse { animation: dot-pulse 2s ease-in-out infinite; }

/* Sparkline rows (rendered by JS) — small custom layout */
.spark-row { display: flex; align-items: center; gap: 10px; font-size: 11px; }
.spark-row .spark-label { color: var(--text-dim); flex: 0 0 50px; font-weight: 500; }
.spark-row .spark-svg { flex: 1; height: 20px; }
.spark-row .spark-value { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); flex: 0 0 auto; min-width: 38px; text-align: right; }

/* Portal block, stream grid/cards → migrated to Tailwind in index.html / app.js
   Only bookmark button glyph + active state remain here as a pseudo-element shim. */
.sc-bookmark::before { content: "☆"; }
.sc-bookmark.active::before { content: "★"; }
.sc-bookmark.active { background: var(--yellow) !important; color: hsl(240, 10%, 5%) !important; }

.cat-chip-bookmark { display: inline-flex; align-items: center; gap: 4px; }
.cat-chip-count {
    background: var(--bg-card);
    color: var(--text-dim);
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    margin-left: 2px;
}
.cat-chip.active .cat-chip-count { background: var(--accent-fg); color: var(--accent); }

/* Category lanes, magazine cards, timeline grid → migrated to Tailwind */

.events-timeline {
    position: relative;
    padding-left: 24px;
}
.events-timeline::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--border);
}
.tl-event {
    position: relative;
    padding: 10px 0 14px;
    border-bottom: 1px solid var(--border);
}
.tl-event:last-child { border-bottom: none; }
.tl-event::before {
    content: "";
    position: absolute;
    left: -22px;
    top: 16px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg);
    z-index: 1;
}
.tl-event.impact-critical::before { background: var(--red); box-shadow: 0 0 0 4px hsla(0, 72%, 51%, 0.15); }
.tl-event.impact-high::before    { background: var(--orange); }
.tl-event.impact-med::before     { background: var(--yellow); }
.tl-event.impact-low::before     { background: var(--text-muted); }
.tl-event-date {
    font-size: 11px;
    color: var(--accent);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    margin-bottom: 4px;
    letter-spacing: 0.02em;
}
.tl-event-name { font-size: 15px; line-height: 1.4; color: var(--text); font-weight: 500; }
.tl-event-impact {
    display: inline-block;
    margin-top: 6px;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.tl-event.impact-critical .tl-event-impact { background: hsla(0, 72%, 51%, 0.18); color: hsl(0 80% 70%); }
.tl-event.impact-high    .tl-event-impact { background: hsla(25, 95%, 53%, 0.18); color: hsl(25 95% 65%); }
.tl-event.impact-med     .tl-event-impact { background: hsla(38, 92%, 50%, 0.18); color: hsl(38 92% 60%); }
.tl-event.impact-low     .tl-event-impact { background: var(--bg-hover); color: var(--text-dim); }

.trending-panel { display: flex; flex-direction: column; gap: 4px; }
.trending-panel .trend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.trending-panel .trend-item:last-child { border-bottom: none; }
.trending-panel .trend-rank {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
    min-width: 24px;
    text-align: center;
}
.trending-panel .trend-topic { font-size: 14px; flex: 1; color: var(--text); line-height: 1.4; }
.trending-panel .trend-traffic { font-size: 10px; color: var(--text-muted); }

/* ----- Cmd+K trigger (in topbar) ----- */
.cmdk-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
    min-width: 140px;
}
.cmdk-trigger:hover { color: var(--text); border-color: var(--border-strong); background: var(--bg-hover); }
.cmdk-trigger-icon { font-size: 14px; }
.cmdk-trigger-text { flex: 1; text-align: left; }
.cmdk-trigger kbd {
    font-size: 10px;
    padding: 1px 6px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text-dim);
    font-family: ui-monospace, "SF Mono", monospace;
}

/* ----- Cmd+K modal ----- */
.cmdk-modal {
    position: fixed;
    inset: 0;
    background: hsla(240, 10%, 3%, 0.65);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 12vh;
    animation: cmdk-fade 0.18s var(--ease-out-quart);
}
@keyframes cmdk-fade { from { opacity: 0; } to { opacity: 1; } }
.cmdk-box {
    width: 100%;
    max-width: 640px;
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 60px -20px rgba(0,0,0,0.6);
    overflow: hidden;
    margin: 0 16px;
    animation: cmdk-pop 0.22s var(--ease-out-quart);
}
@keyframes cmdk-pop { from { transform: scale(0.96) translateY(-8px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }
.cmdk-input-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
}
.cmdk-icon { font-size: 18px; color: var(--text-dim); }
#cmdk-input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text);
    font-size: 16px;
    font-family: inherit;
    outline: none;
}
.cmdk-esc { font-size: 10px; padding: 2px 6px; background: var(--bg-hover); border: 1px solid var(--border); border-radius: 3px; color: var(--text-dim); }
.cmdk-results {
    max-height: 60vh;
    overflow-y: auto;
    padding: 8px 0;
}
.cmdk-hint { padding: 24px 22px; color: var(--text-dim); font-size: 13px; }
.cmdk-shortcuts { display: flex; gap: 16px; margin-top: 12px; flex-wrap: wrap; font-size: 11px; }
.cmdk-shortcuts kbd { font-size: 10px; padding: 1px 5px; background: var(--bg-hover); border: 1px solid var(--border); border-radius: 3px; margin-right: 4px; }

.cmdk-section { padding: 4px 0; }
.cmdk-section-label { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; padding: 8px 22px 4px; }
.cmdk-result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 22px;
    cursor: pointer;
    transition: background 0.1s;
    color: var(--text);
}
.cmdk-result:hover, .cmdk-result.active { background: var(--bg-hover); }
.cmdk-result-icon { font-size: 14px; color: var(--text-dim); flex-shrink: 0; }
.cmdk-result-body { flex: 1; min-width: 0; }
.cmdk-result-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-result-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.cmdk-result-arrow { color: var(--text-muted); font-size: 12px; }
.cmdk-ai-answer {
    padding: 16px 22px;
    background: hsla(160, 70%, 42%, 0.06);
    border-top: 1px solid var(--border);
    font-size: 13px;
    line-height: 1.6;
    color: var(--text);
    white-space: pre-wrap;
}

.cmdk-box-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; border-bottom: 1px solid var(--border); }
.cmdk-box-header h3 { font-size: 14px; font-weight: 600; }
.kbd-list { padding: 16px 22px; display: flex; flex-direction: column; gap: 12px; font-size: 13px; }
.kbd-list > div { display: flex; align-items: center; gap: 8px; }
.kbd-list kbd { font-size: 11px; padding: 2px 8px; background: var(--bg-hover); border: 1px solid var(--border); border-radius: 4px; min-width: 22px; text-align: center; }
.kbd-list span { color: var(--text-dim); margin-left: auto; }

/* Mobile-only: hide Cmd+K trigger button on phones */
@media (max-width: 600px) { .cmdk-trigger { display: none; } }
