/* ==========================================================================
   C-SN Command OS v2 — Executive Luxury Fintech & Cosmic Glass Design System
   Light & Dark mode compatible · Zero Vite build required
   ========================================================================== */

:root {
    --csn-canvas: #f3f5fa;
    --csn-surface: #ffffff;
    --csn-surface-2: #f8fafd;
    --csn-inset: #eef2f8;
    --csn-border: rgba(15, 23, 42, 0.08);
    --csn-border-strong: rgba(245, 158, 11, 0.38);
    --csn-text: #0b1222;
    --csn-muted: #64748b;
    --csn-primary: #d97706;
    --csn-primary-bright: #f59e0b;
    --csn-primary-fg: #ffffff;
    --csn-emerald: #10b981;
    --csn-sky: #0ea5e9;
    --csn-amber: #f59e0b;
    --csn-rose: #f43f5e;
    --csn-violet: #8b5cf6;
    --csn-cyan: #06b6d4;
    --csn-shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 28px -14px rgba(15, 23, 42, 0.12);
    --csn-shadow-hero: 0 22px 48px -20px rgba(7, 13, 30, 0.55), 0 4px 14px -4px rgba(7, 13, 30, 0.25);
}

.dark {
    --csn-canvas: #060913;
    --csn-surface: #0e1628;
    --csn-surface-2: #121d35;
    --csn-inset: #080f1e;
    --csn-border: rgba(148, 163, 184, 0.14);
    --csn-border-strong: rgba(251, 191, 36, 0.42);
    --csn-text: #f8fafc;
    --csn-muted: #94a3b8;
    --csn-primary: #f59e0b;
    --csn-primary-bright: #fbbf24;
    --csn-primary-fg: #090d16;
    --csn-emerald: #34d399;
    --csn-sky: #38bdf8;
    --csn-amber: #fbbf24;
    --csn-rose: #fb7185;
    --csn-violet: #a78bfa;
    --csn-cyan: #22d3ee;
    --csn-shadow-card: 0 1px 2px rgba(0, 0, 0, 0.35), 0 14px 32px -16px rgba(0, 0, 0, 0.65);
    --csn-shadow-hero: 0 24px 54px -20px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(251, 191, 36, 0.16);
}

/* ==========================================================================
   Subtle Luxury Polish on Filament Chrome (Topbar, Canvas, Sections)
   ========================================================================== */
body.fi-body {
    background-color: var(--csn-canvas) !important;
}

.fi-topbar {
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.fi-section,
.fi-ta-ctn {
    border-radius: 1.25rem !important;
    border-color: var(--csn-border) !important;
    box-shadow: var(--csn-shadow-card) !important;
}

.csn-os-stack {
    display: flex;
    flex-direction: column;
    gap: 0.95rem;
}

/* ==========================================================================
   1. OBSIDIAN MIDNIGHT EXECUTIVE HERO CARD (Revolut / Stripe / Mercury grade)
   ========================================================================== */
.csn-hero-obsidian {
    position: relative;
    overflow: hidden;
    border-radius: 1.4rem;
    padding: 1.25rem 1.25rem 1.1rem;
    color: #f8fafc;
    background:
        radial-gradient(ellipse 68% 60% at 88% 8%, rgba(245, 158, 11, 0.24), transparent 62%),
        radial-gradient(ellipse 58% 65% at 10% 95%, rgba(16, 185, 129, 0.20), transparent 60%),
        radial-gradient(ellipse 50% 50% at 50% 40%, rgba(56, 189, 248, 0.10), transparent 65%),
        linear-gradient(140deg, #070d1d 0%, #0f1b36 52%, #131c38 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: var(--csn-shadow-hero);
}

@media (min-width: 768px) {
    .csn-hero-obsidian {
        padding: 1.5rem 1.65rem 1.3rem;
    }
}

/* Subtle tech grid overlay inside obsidian surfaces */
.csn-hero-obsidian::before,
.csn-cosmic-map-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 32px 32px;
    mask-image: radial-gradient(circle at 50% 35%, black 35%, transparent 90%);
    -webkit-mask-image: radial-gradient(circle at 50% 35%, black 35%, transparent 90%);
    pointer-events: none;
}

.csn-hero-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 1.05rem;
}

.csn-hero-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.csn-hero-brand-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.26rem 0.68rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #e2e8f0;
    white-space: nowrap;
}

.csn-live-beacon {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 9999px;
    background: #34d399;
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.25), 0 0 10px #34d399;
    display: inline-block;
    flex-shrink: 0;
}

/* Compact glass currency switch (NEVER full-width!) */
.csn-glass-seg {
    display: inline-flex;
    align-items: center;
    gap: 0.18rem;
    padding: 0.18rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    width: fit-content;
}

.csn-glass-seg-btn {
    padding: 0.24rem 0.68rem;
    border-radius: 9999px;
    border: none;
    background: transparent;
    color: rgba(226, 232, 240, 0.72);
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 150ms ease;
    white-space: nowrap;
}

.csn-glass-seg-btn.is-active {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #0b1120;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

/* Hero centerpiece layout */
.csn-hero-main {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 1024px) {
    .csn-hero-main {
        flex-direction: row;
        align-items: flex-end;
        justify-content: space-between;
    }
}

.csn-hero-eyebrow {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: rgba(203, 213, 225, 0.78);
}

.csn-hero-figure {
    margin: 0.2rem 0 0;
    font-size: 1.95rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.08;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(180deg, #ffffff 10%, #fde68a 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@media (min-width: 768px) {
    .csn-hero-figure {
        font-size: 2.45rem;
    }
}

.csn-hero-subrow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    margin-top: 0.45rem;
    font-size: 0.78rem;
    color: rgba(203, 213, 225, 0.85);
}

.csn-hero-equiv {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.16rem 0.55rem;
    border-radius: 9999px;
    background: rgba(52, 211, 153, 0.16);
    border: 1px solid rgba(52, 211, 153, 0.32);
    color: #6ee7b7;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* 4 Glass Action Buttons with crisp SVG icons */
.csn-hero-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

@media (min-width: 640px) {
    .csn-hero-actions {
        display: flex;
        flex-wrap: wrap;
    }
}

.csn-hero-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.58rem 0.9rem;
    border-radius: 0.85rem;
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
    color: #f1f5f9;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(8px);
    transition: all 160ms ease;
    white-space: nowrap;
}

.csn-hero-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(251, 191, 36, 0.55);
    transform: translateY(-1px);
}

.csn-hero-btn-accent {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #0b1120;
    border-color: transparent;
    box-shadow: 0 8px 20px -6px rgba(245, 158, 11, 0.55);
}

.csn-hero-btn-accent:hover {
    background: linear-gradient(135deg, #fcd34d 0%, #f59e0b 100%);
    color: #0b1120;
    border-color: transparent;
}

.csn-hero-btn svg {
    width: 0.95rem;
    height: 0.95rem;
    flex-shrink: 0;
}

/* Radar Strip inside Obsidian Hero */
.csn-hero-radar {
    padding-top: 0.85rem;
    border-top: 1px solid rgba(255, 255, 255, 0.10);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.42rem;
}

.csn-radar-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.26rem 0.62rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: transform 140ms ease, opacity 140ms ease;
}

.csn-radar-chip:hover {
    transform: translateY(-1px);
    opacity: 0.92;
}

.csn-radar-danger {
    background: rgba(244, 63, 94, 0.20);
    border: 1px solid rgba(251, 113, 133, 0.42);
    color: #fda4af;
}

.csn-radar-warning {
    background: rgba(245, 158, 11, 0.18);
    border: 1px solid rgba(251, 191, 36, 0.40);
    color: #fcd34d;
}

.csn-radar-success {
    background: rgba(16, 185, 129, 0.16);
    border: 1px solid rgba(52, 211, 153, 0.34);
    color: #6ee7b7;
}

.csn-radar-info {
    background: rgba(56, 189, 248, 0.16);
    border: 1px solid rgba(56, 189, 248, 0.34);
    color: #7dd3fc;
}

.csn-radar-primary {
    background: rgba(167, 139, 250, 0.20);
    border: 1px solid rgba(167, 139, 250, 0.40);
    color: #ddd6fe;
}

/* ==========================================================================
   2. 4 LUXURY BENTO KPI CARDS (2x2 mobile / 4-col desktop, ZERO truncation)
   ========================================================================== */
.csn-kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

@media (min-width: 1024px) {
    .csn-kpi-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 0.9rem;
    }
}

.csn-kpi-card {
    position: relative;
    overflow: hidden;
    background: var(--csn-surface);
    border: 1px solid var(--csn-border);
    border-radius: 1.2rem;
    padding: 0.95rem 1rem;
    box-shadow: var(--csn-shadow-card);
    color: var(--csn-text);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    min-width: 0;
    transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.csn-kpi-card:hover {
    border-color: var(--csn-border-strong);
    transform: translateY(-2px);
}

.csn-kpi-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
}

.csn-kpi-medallion {
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 0.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.csn-kpi-medallion svg {
    width: 1.05rem;
    height: 1.05rem;
}

.csn-kpi-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.18rem 0.52rem;
    border-radius: 9999px;
    font-size: 0.69rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

.csn-kpi-title {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--csn-muted);
    line-height: 1.25;
}

.csn-kpi-value {
    font-size: 1.12rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
    margin-top: 0.12rem;
}

@media (min-width: 768px) {
    .csn-kpi-value {
        font-size: 1.32rem;
    }
}

.csn-kpi-track {
    height: 0.34rem;
    width: 100%;
    border-radius: 9999px;
    background: var(--csn-inset);
    overflow: hidden;
}

.csn-kpi-track-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 320ms ease;
}

.csn-kpi-spark {
    height: 1.8rem;
    width: 100%;
}

.csn-kpi-foot {
    font-size: 0.72rem;
    color: var(--csn-muted);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.2rem 0.45rem;
    line-height: 1.3;
    font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   3. COSMIC OBSIDIAN WORLD MAP CARD (Stripe / Cloudflare Radar grade)
   ========================================================================== */
.csn-cosmic-map-card {
    position: relative;
    overflow: hidden;
    border-radius: 1.35rem;
    padding: 1.15rem 1.2rem;
    color: #f8fafc;
    background:
        radial-gradient(ellipse 70% 55% at 22% 12%, rgba(56, 189, 248, 0.16), transparent 60%),
        radial-gradient(ellipse 60% 55% at 85% 90%, rgba(245, 158, 11, 0.14), transparent 62%),
        linear-gradient(150deg, #060b18 0%, #0b1429 55%, #0d1831 100%);
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: var(--csn-shadow-hero);
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.csn-cosmic-map-card > * {
    position: relative;
    z-index: 1;
}

.csn-cosmic-stage {
    position: relative;
    border-radius: 1rem;
    background: radial-gradient(circle at 50% 48%, rgba(14, 165, 233, 0.12), rgba(2, 6, 23, 0.72));
    border: 1px solid rgba(148, 163, 184, 0.16);
    padding: 0.4rem;
    overflow: hidden;
    user-select: none;
}

.csn-os-map-svg {
    width: 100%;
    height: auto;
    display: block;
    cursor: grab;
    touch-action: none;
}

.csn-os-map-svg:active {
    cursor: grabbing;
}

.csn-cosmic-zoom-btn {
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 0.6rem;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
    font-weight: 800;
    font-size: 0.88rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 140ms ease;
}

.csn-cosmic-zoom-btn:hover {
    background: rgba(251, 191, 36, 0.22);
    border-color: rgba(251, 191, 36, 0.55);
}

.csn-cosmic-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.26rem 0.62rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    color: rgba(203, 213, 225, 0.82);
    cursor: pointer;
    transition: all 140ms ease;
    white-space: nowrap;
}

.csn-cosmic-chip:hover {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.28);
}

.csn-cosmic-chip.is-active {
    background: rgba(251, 191, 36, 0.18);
    border-color: rgba(251, 191, 36, 0.65);
    color: #fef3c7;
}

.csn-cosmic-inspector {
    border-radius: 0.9rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 0.8rem 0.95rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
}

.csn-cosmic-badge {
    position: absolute;
    right: 0.65rem;
    bottom: 0.6rem;
    padding: 0.18rem 0.52rem;
    border-radius: 0.45rem;
    background: rgba(7, 13, 29, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 0.7rem;
    color: rgba(203, 213, 225, 0.78);
    pointer-events: none;
}

/* ==========================================================================
   4. CLEAN LUXURY TELEMETRY CARDS (Gauges, Heatmap, Gateways)
   ========================================================================== */
.csn-panel-card {
    background: var(--csn-surface);
    border: 1px solid var(--csn-border);
    border-radius: 1.25rem;
    padding: 1.05rem 1.15rem;
    box-shadow: var(--csn-shadow-card);
    color: var(--csn-text);
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.csn-panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}

.csn-panel-title {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 800;
    letter-spacing: -0.015em;
}

.csn-panel-sub {
    margin: 0.15rem 0 0;
    font-size: 0.75rem;
    color: var(--csn-muted);
}

.csn-pill-soft {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.22rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}

.csn-gauges-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}

.csn-gauge-tile {
    border-radius: 0.95rem;
    background: var(--csn-surface-2);
    border: 1px solid var(--csn-border);
    padding: 0.7rem 0.72rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.4rem;
}

@media (min-width: 1280px) {
    .csn-gauge-tile {
        flex-direction: row;
        text-align: left;
        gap: 0.65rem;
    }
}

.csn-heat-row {
    display: grid;
    grid-template-columns: 2.2rem repeat(6, minmax(0, 1fr));
    gap: 0.3rem;
    align-items: center;
}

.csn-heat-cell {
    height: 1.55rem;
    border-radius: 0.42rem;
    border: 1px solid var(--csn-border);
    cursor: pointer;
    transition: transform 130ms ease, box-shadow 130ms ease;
}

.csn-heat-cell:hover {
    transform: scale(1.07);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.35);
}

.csn-gw-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.62rem 0;
    border-bottom: 1px solid var(--csn-border);
}

.csn-gw-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.csn-gw-avatar {
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 0.68rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.csn-dot {
    width: 0.42rem;
    height: 0.42rem;
    border-radius: 9999px;
    background: currentColor;
    display: inline-block;
    flex-shrink: 0;
}

/* SVG Animations */
@keyframes csnPulseRing {
    0% { transform: scale(0.9); opacity: 0.9; }
    70% { transform: scale(2.35); opacity: 0; }
    100% { transform: scale(2.35); opacity: 0; }
}

.csn-pulse-ring {
    transform-box: fill-box;
    transform-origin: center;
    animation: csnPulseRing 2.3s cubic-bezier(0.2, 0.7, 0.3, 1) infinite;
}

@keyframes csnFlowDash {
    to { stroke-dashoffset: -36; }
}

.csn-flow-arc {
    animation: csnFlowDash 2.1s linear infinite;
}
