/* ==========================================================================
   Global Supply Chain Index — Global Supply Chain Health Index
   Master stylesheet. Dash auto-loads this from the assets/ directory.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Reset & Base
   -------------------------------------------------------------------------- */

:root {
    --bg: #0a0a0b;
    --surface: #111113;
    --surface-raised: #18181b;
    --border: rgba(255, 255, 255, 0.10);
    --border-strong: rgba(255, 255, 255, 0.16);
    --text: #ececef;
    --text-muted: #8b8b93;
    --text-faint: #5c5c66;
    --radius-panel: 10px;
    --radius-control: 8px;
    --radius-pill: 999px;
    --font-sans: "Satoshi", "IBM Plex Sans", system-ui, sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, monospace;
    --tier-healthy: #3d9b6e;
    --tier-stable: #c4a35a;
    --tier-stressed: #c47a3a;
    --tier-critical: #c44d5f;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* --------------------------------------------------------------------------
   Dashboard Shell
   -------------------------------------------------------------------------- */

.dashboard {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px 24px 40px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.dash-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px 32px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.header-brand {
    display: flex;
    align-items: center;
    justify-self: start;
    min-width: 0;
}

.brand-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Center column: industry profile dropdown, front-and-center */
.header-center {
    display: flex;
    align-items: center;
    justify-content: center;
    justify-self: center;
    width: min(340px, 100%);
}

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

.app-title {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.15;
    color: var(--text);
}

.app-subtitle {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: -0.01em;
}

.app-subtitle-link:hover {
    color: var(--text);
}

.header-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    justify-self: end;
    gap: 8px;
    margin-top: 0;
}

.header-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px 2px;
}

.header-nav-link {
    color: var(--text-muted) !important;
    font-weight: 600 !important;
    font-size: 13px !important;
    text-decoration: none !important;
    padding: 4px 10px !important;
    border-radius: var(--radius-control);
}

.header-nav-link:hover {
    color: var(--text) !important;
    background: var(--surface-raised);
}

.header-nav-link-accent {
    color: var(--tier-healthy) !important;
}

.live-dot {
    font-size: 0.8rem;
    color: var(--tier-healthy);
    font-weight: 600;
}

.live-dot.pulsing {
    animation: livePulse 2.5s ease-in-out infinite;
}

@keyframes livePulse {
    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

@media (prefers-reduced-motion: reduce) {
    .live-dot.pulsing {
        animation: none;
    }
}

/* --------------------------------------------------------------------------
   Hero Row (Gauge + 90-Day Trend)
   -------------------------------------------------------------------------- */

.hero-row {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
    align-items: stretch;
    overflow: visible;
}

/* --------------------------------------------------------------------------
   Chart Panels (shared card style for gauge, trend, map, health bars)
   -------------------------------------------------------------------------- */
.chart-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-panel);
    padding: 16px;
    overflow: hidden;
    position: relative;
}

.chart-panel .js-plotly-plot,
.chart-panel .plotly,
.chart-panel .plot-container {
    width: 100% !important;
}

/* --------------------------------------------------------------------------
   Category Cards Row
   -------------------------------------------------------------------------- */

.cards-row {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
    position: relative;
    z-index: 1;
}

/* --------------------------------------------------------------------------
   Sharp Financial Variant (Top Panels - Stock Market Look)
   -------------------------------------------------------------------------- */

.hero-row .chart-panel,
.charts-row .chart-panel {
    border-radius: var(--radius-panel);
    position: relative;
    background: var(--surface);
    box-shadow: none;
    /* Flat, clean look */
}

/* Middle Row Charts (Health, Map) */
.charts-row .chart-panel {
    border: 1px solid var(--border);
}

/* Top Row (Gauge & Trend) */
.hero-row .chart-panel {
    border: 1px solid var(--border);
}

/* Gauge score hover explanation */
.gauge-panel {
    overflow: visible;
    z-index: 4;
}

.gauge-panel:has(.gauge-score-hover-zone:hover),
.gauge-panel:has(.gauge-score-hover-zone:focus-within) {
    z-index: 500;
}

.gauge-panel .js-plotly-plot,
.gauge-panel .plotly,
.gauge-panel .plot-container {
    pointer-events: none;
}

.gauge-score-hover-zone {
    position: absolute;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    width: 160px;
    height: 88px;
    z-index: 6;
    cursor: help;
}

.gauge-score-hint {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 18px;
    height: 18px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-strong);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    background: var(--surface-raised);
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
}

.gauge-panel:hover .gauge-score-hint,
.gauge-score-hover-zone:focus-within .gauge-score-hint {
    opacity: 1;
}

.score-explanation-tooltip {
    position: absolute;
    left: 50%;
    top: calc(100% + 12px);
    transform: translateX(-50%);
    width: min(340px, 88vw);
    max-height: min(420px, 70vh);
    overflow-y: auto;
    padding: 14px 16px;
    border-radius: var(--radius-control);
    border: 1px solid var(--border-strong);
    background-color: var(--surface-raised);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, visibility 0.15s ease, transform 0.15s ease;
    z-index: 501;
    isolation: isolate;
}

.score-explanation-tooltip::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background-color: var(--surface-raised);
    z-index: -1;
}

.score-explanation-headline,
.score-explanation-summary,
.score-explanation-bullet {
    position: relative;
    z-index: 1;
}

.gauge-score-hover-zone:hover .score-explanation-tooltip,
.gauge-score-hover-zone:focus-within .score-explanation-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(2px);
}

.score-explanation-headline {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.score-explanation-summary {
    margin: 0 0 10px;
    font-size: 0.84rem;
    line-height: 1.45;
    color: var(--text-muted);
}

.score-explanation-bullet {
    font-size: 0.78rem;
    line-height: 1.4;
    color: var(--text-muted);
    margin-top: 6px;
}

/* --------------------------------------------------------------------------
   Middle Row (Health Bars + World Map)
   -------------------------------------------------------------------------- */

.charts-row {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
    align-items: stretch;
}

.chart-narrow {
    /* inherits from .chart-panel */
}

.chart-wide {
    /* inherits from .chart-panel */
}

/* --------------------------------------------------------------------------
   Bottom Row (Alerts + Disruptions)
   -------------------------------------------------------------------------- */

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

.bottom-panel {
    min-width: 0;
    overflow: hidden;
}

/* --------------------------------------------------------------------------
   Panel (shared wrapper used by alerts + disruptions)
   -------------------------------------------------------------------------- */

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-panel);
    padding: 20px;
    height: 100%;
    position: relative;
}

.panel-title {
    margin: 0 0 14px;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text);
}

/* --------------------------------------------------------------------------
   AI Daily Briefing
   -------------------------------------------------------------------------- */

.daily-briefing-card {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.daily-briefing-card--empty {
    text-align: center;
}

.briefing-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 420px;
    overflow-y: auto;
}

.briefing-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius-control);
}

.briefing-marker {
    flex-shrink: 0;
    margin-top: 2px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    line-height: 1.5;
    color: var(--text-faint);
}

.briefing-text {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 400;
    line-height: 1.55;
    color: var(--text);
}

.briefing-report-link {
    display: block;
    margin-top: 16px;
    padding: 9px 12px;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--text-muted);
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-control);
}

.briefing-report-link:hover {
    color: var(--text);
    border-color: var(--border-strong);
}

.briefing-empty {
    padding: 8px 0 4px;
}

.briefing-empty-copy {
    margin: 0 0 14px;
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--text-muted);
}

.briefing-generate-btn {
    background: var(--text);
    color: var(--bg);
    border: none;
    border-radius: var(--radius-control);
    padding: 10px 20px;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
}

.briefing-generate-btn:hover {
    opacity: 0.92;
}

.briefing-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 24px 0;
}

.briefing-spinner-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

/* --------------------------------------------------------------------------
   Alerts Feed
   -------------------------------------------------------------------------- */

.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 420px;
    overflow-y: auto;
}

.alert-item {
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: background 0.15s ease;
}

.alert-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.alert-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    flex-wrap: wrap;
    gap: 6px;
}

.severity-badge {
    /* color/background/border are severity-specific — set inline per pill */
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.alert-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.alert-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
    line-height: 1.3;
}

.alert-body {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

/* --------------------------------------------------------------------------
   Disruptions Table
   -------------------------------------------------------------------------- */

.disruptions-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.disruptions-table thead {
    border-bottom: 2px solid var(--border);
}

.disruptions-table th {
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.disruptions-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: top;
}

.disruptions-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.td-event {
    font-weight: 500;
    max-width: 200px;
}

.td-affected {
    font-size: 0.75rem;
    color: var(--text-muted);
    max-width: 160px;
}

.td-status {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   Category Health Bars (inside chart panel)
   -------------------------------------------------------------------------- */

.health-bar-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-top: 8px;
}

.health-bar-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* The Label sits on TOP of the bar */
.health-bar-label {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 12px;
    width: 100%;

    font-family: var(--font-mono);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 700;
}

.health-bar-label span:last-child {
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    /* Score pops out */
}

.health-bar-track {
    width: 100%;
    height: 8px;
    /* Thicker */
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
    /* Sharper */
    overflow: hidden;
}

.health-bar-fill {
    height: 100%;
    border-radius: 2px;
    /* Sharper */
    transition: width 0.6s ease;
    position: relative;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.dash-footer {
    text-align: center;
    padding: 20px 0 0;
    border-top: 1px solid var(--border);
}

.footer-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}

/* --------------------------------------------------------------------------
   Active Ingestion Feed (Startup Sequence Overlay)
   -------------------------------------------------------------------------- */

.ingestion-terminal {
    position: fixed;
    bottom: 24px;
    left: 24px;
    background: var(--surface-raised);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: var(--radius-control);
    padding: 12px;
    z-index: 1040;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    pointer-events: none;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);

    /* Fade out the entire container at the very end */
    animation: terminalContainerHide 0.5s 6.0s forwards;
}

@keyframes terminalContainerHide {
    to {
        opacity: 0;
        visibility: hidden;
    }
}

.terminal-line {
    display: block;
    color: var(--text-muted);
    margin-bottom: 6px;
    opacity: 1;
}

.terminal-line.final {
    color: var(--tier-healthy);
    margin-bottom: 0;
}

/* Staggered disappearances */
.terminal-line:nth-child(1) {
    animation: seqOut 0.3s 4.0s forwards;
}

.terminal-line:nth-child(2) {
    animation: seqOut 0.3s 4.2s forwards;
}

.terminal-line:nth-child(3) {
    animation: seqOut 0.3s 4.4s forwards;
}

.terminal-line:nth-child(4) {
    animation: seqOut 0.3s 4.6s forwards;
}

.terminal-line:nth-child(5) {
    animation: seqOut 0.3s 4.8s forwards;
}

.terminal-line.final::after {
    content: '█';
    margin-left: 6px;
    animation: seqBlink 1s step-end infinite;
}

@keyframes seqOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-4px);
    }
}

@keyframes seqBlink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* --------------------------------------------------------------------------
   Scrollbar (dark theme)
   -------------------------------------------------------------------------- */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

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

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

/* --------------------------------------------------------------------------
   Plotly global overrides (prevent toolbar bloat, enforce dark bg)
   -------------------------------------------------------------------------- */

.js-plotly-plot .plotly .modebar {
    display: none !important;
}

/* ==========================================================================
   RESPONSIVE — Mobile-first breakpoints
   ========================================================================== */

/* Tablets & small laptops (≤1024px) */
@media (max-width: 1024px) {
    .dashboard {
        padding: 16px 16px 32px;
        gap: 16px;
    }

    .hero-row {
        grid-template-columns: 1fr 1.5fr;
        gap: 16px;
    }

    .cards-row {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }

    .charts-row {
        grid-template-columns: 1fr 1.5fr;
        gap: 16px;
    }

    .bottom-row {
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }
}

/* Phones — landscape & large phones (≤768px) */
@media (max-width: 768px) {
    .dashboard {
        padding: 12px 12px 24px;
        gap: 14px;
    }

    .dash-header {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .header-brand,
    .header-center,
    .header-meta {
        justify-self: stretch;
    }

    .header-center {
        width: 100%;
    }

    .app-title {
        font-size: 1.5rem;
    }

    .header-meta {
        align-items: flex-start;
        gap: 10px;
    }

    .header-nav {
        justify-content: flex-start;
    }

    .hero-row {
        grid-template-columns: 1fr;
        gap: 14px;
    }

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

    .charts-row {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .bottom-row {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .chart-panel {
        padding: 12px;
    }

    .panel {
        padding: 14px;
    }

    .disruptions-table th,
    .disruptions-table td {
        padding: 6px 8px;
        font-size: 0.72rem;
    }

    .disruptions-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Phones — portrait (≤480px) */
@media (max-width: 480px) {
    .dashboard {
        padding: 8px 8px 20px;
        gap: 12px;
    }

    .app-title {
        font-size: 1.25rem;
    }

    .app-subtitle {
        font-size: 0.8rem;
    }

    .cards-row {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .panel {
        padding: 12px;
    }

    .panel-title {
        font-size: 0.9rem;
    }

    .alert-item {
        padding: 10px 12px;
    }

    .alert-title {
        font-size: 0.82rem;
    }

    .alert-body {
        font-size: 0.75rem;
    }

    .alerts-list {
        max-height: 350px;
    }

    .briefing-item {
        padding: 10px 12px;
    }

    .briefing-text {
        font-size: 0.82rem;
    }

    .briefing-list {
        max-height: 350px;
    }
}

/* ==========================================================================
   Dash debug toolbar — push below our content
   ========================================================================== */

._dash-debug-menu {
    z-index: 9999;
}

/* ==========================================================================
   Live Market Data Redesign (Scrolling Ticker)
   ========================================================================== */

.market-section-ticker {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-panel);
    padding: 12px 16px;
    margin-bottom: 24px;
    overflow: hidden;
    /* Hide the scrolling content */
    position: relative;
    white-space: nowrap;
    mask-image: linear-gradient(to right, transparent, black 24px, black calc(100% - 24px), transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 24px, black calc(100% - 24px), transparent);
}

/* The Scrolling Track */
.market-ticker-track {
    display: flex;
    align-items: center;
    gap: 48px;
    /* Gap between items */
    width: max-content;
    /* Allow track to be as wide as needed */
    animation: ticker-scroll 60s linear infinite;
    /* Very slow rotation */
}

.market-ticker-track:hover {
    animation-play-state: paused;
}

@keyframes ticker-scroll {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }

    /* Move half the width (the duplicate set) */
}

/* Individual Ticker Items */
.market-ticker-item {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.market-ticker-item + .market-ticker-item {
    border-left: 1px solid var(--border);
    padding-left: 12px;
}

.market-symbol {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.market-value-price {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.market-change-group {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.market-arrow {
    font-size: 0.7rem;
}

/* ==========================================================================
   Skeleton Loading Animation
   ========================================================================== */
.skeleton-pulse {
    background: var(--surface-raised);
    position: relative;
    overflow: hidden;
}

/* ==========================================================================
   Category Card Redesign (Technical HUD)
   ========================================================================== */

.tech-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-panel);
    padding: 16px;

    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    overflow: hidden;
    transition: border-color 0.2s;
    min-height: 160px;
}

.tech-card:hover {
    border-color: var(--border-strong);
    /* no transform, box-shadow, or filter */
}

/* Header */
.tech-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    /* Align top so height difference grows down */
    margin-bottom: 12px;
    /* Increased spacing */
    min-height: 2.4em;
    /* Force height for 2 lines */
}

.tech-label {
    font-family: var(--font-sans);
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    max-width: 75%;
    /* Ensure space for weight badge */
    line-height: 1.2;
}

.tech-weight {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-faint);
    border: 1px solid var(--border);
    padding: 1px 6px;
    border-radius: var(--radius-pill);
}

/* Main Score Row */
.tech-main-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.tech-score {
    font-family: var(--font-mono);
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.05em;
}

/* Daily Delta Box */
.tech-delta-box {
    text-align: right;
}

.tech-meta-label {
    display: block;
    font-size: 0.65rem;
    color: var(--text-faint);
    text-transform: uppercase;
    margin-bottom: 1px;
    font-family: var(--font-mono);
}

.tech-delta-value {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
}

/* Secondary Stats Grid (Min/Max) */
.tech-stats-grid {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.02);
    padding: 4px 8px;
    border-radius: 2px;
    margin-top: 4px;
}

.tech-grid-sep {
    width: 1px;
    height: 12px;
    background: var(--border);
}

.tech-meta-value {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Sparkline "Screen" */
.tech-sparkline-container {
    flex: 0 0 44px;
    height: 44px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.2);
    position: relative;
    margin-top: auto;
    overflow: hidden;
    /* Clip any potential fill bleed */
    /* Push to bottom */
}

/* Inline SVG sparkline (server-rendered, fixed 0-100 y domain) */
.spark-wrap {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 40px;
}

.spark-svg {
    display: block;
    width: 100%;
    height: 40px;
    border: 0;
    pointer-events: none;
    user-select: none;
}

.spark-caption {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-faint);
    letter-spacing: 0.5px;
    pointer-events: none;
    white-space: nowrap;
}

#newsletter-toast-inner:hover {
    border-color: var(--border-strong) !important;
}

/* --------------------------------------------------------------------------
   Dark Theme Dropdown (Industry Profile Selector)
   -------------------------------------------------------------------------- */
#profile-selector {
    /* Keep form-select chevron: set color + image, not background shorthand */
    -webkit-appearance: none !important;
    appearance: none !important;
    background-color: var(--surface-raised) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%239aa3b5' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    background-size: 16px 16px !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-control) !important;
    color: var(--text) !important;
    font-family: var(--font-sans) !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 1.25 !important;
    padding: 7px 40px 7px 14px !important;
    cursor: pointer !important;
    height: auto !important;
    min-height: 36px !important;
    width: 100% !important;
    flex: 1;
    min-width: 0;
}

#profile-selector:focus {
    border-color: var(--border-strong) !important;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.06) !important;
}

#profile-selector option {
    background-color: var(--surface) !important;
    color: var(--text) !important;
    padding: 8px !important;
}

/* --------------------------------------------------------------------------
   Gauge Panel — prevent reflow when profile switches
   -------------------------------------------------------------------------- */
.gauge-panel {
    height: 340px;
    overflow: hidden;
}

.gauge-panel .dash-graph {
    height: 100% !important;
    width: 100% !important;
}

/* --------------------------------------------------------------------------
   Modal + Bootstrap Overrides
   -------------------------------------------------------------------------- */
.modal-content {
    background: var(--surface) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-panel) !important;
}

.modal-header,
.modal-footer {
    border-color: var(--border) !important;
    background: var(--surface) !important;
}

.modal-title {
    color: var(--text) !important;
}

/* --------------------------------------------------------------------------
   Vendored effects — thinking-orbs, border-beam (pulse), metal-fx
   See assets/vendor/ + frontend/ for provenance and build steps.
   Used sparingly and tastefully per design brief: loading states + a single
   restrained brand accent, not decoration.
   -------------------------------------------------------------------------- */

/* thinking-orbs: brand mark — <ThinkingOrb state="working" size={64} /> */
canvas.thinking-orb-mount.brand-orb {
    display: block;
    width: 64px;
    height: 64px;
    flex-shrink: 0;
}