:root {
    --bg: #06131f;
    --bg-soft: #0a1b2b;
    --panel: rgba(12, 30, 47, 0.94);
    --panel-2: rgba(15, 39, 59, 0.96);
    --border: rgba(142, 190, 212, 0.14);
    --text: #f4fbff;
    --muted: #8faabd;
    --cyan: #28d8d2;
    --cyan-soft: #6ff3eb;
    --green: #4fd49e;
    --gold: #e5b651;
    --blue: #5ca8ff;
    --danger: #ff6b7e;
    --shadow: 0 20px 48px rgba(0, 0, 0, 0.24);
}

* {
    box-sizing: border-box;
}

html {
    background: var(--bg);
}

body {
    margin: 0;
    min-width: 320px;
    color: var(--text);
    background:
        radial-gradient(circle at 12% 8%, rgba(40, 216, 210, 0.08), transparent 24%),
        radial-gradient(circle at 92% 18%, rgba(229, 182, 81, 0.08), transparent 22%),
        linear-gradient(145deg, #050f19 0%, #071827 50%, #06131f 100%);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-variant-numeric: tabular-nums;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: linear-gradient(to bottom, black, transparent 90%);
}

.dashboard-shell {
    width: min(1920px, 100%);
    min-height: 100vh;
    margin: 0 auto;
    padding: clamp(14px, 1.4vw, 28px);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: clamp(14px, 1.3vw, 24px);
}

.brand-block {
    display: flex;
    align-items: center;
    gap: clamp(14px, 1.4vw, 24px);
}

.brand-logo {
    width: clamp(150px, 12vw, 220px);
    height: auto;
}

.eyebrow,
.panel-kicker {
    margin: 0 0 4px;
    color: var(--cyan);
    font-size: clamp(10px, 0.72vw, 13px);
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

.topbar h1 {
    margin-bottom: 0;
    font-size: clamp(24px, 2vw, 38px);
    line-height: 1.05;
    letter-spacing: -0.04em;
}

.topbar-actions {
    display: flex;
    align-items: stretch;
    gap: 10px;
}

.period-chip,
.live-chip,
.icon-button {
    border: 1px solid var(--border);
    background: rgba(10, 28, 44, 0.78);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.period-chip,
.live-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    padding: 10px 16px;
    border-radius: 15px;
}

.period-chip {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
}

.period-chip span,
.live-chip span {
    color: var(--muted);
    font-size: 11px;
}

.period-chip strong,
.live-chip strong {
    font-size: 14px;
}

.live-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 6px rgba(79, 212, 158, 0.12), 0 0 18px var(--green);
    animation: pulse 2s infinite;
}

.icon-button {
    width: 58px;
    min-height: 58px;
    border-radius: 15px;
    color: var(--text);
    cursor: pointer;
    font-size: 25px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: clamp(10px, 0.9vw, 18px);
}

.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-7 { grid-column: span 7; }
.span-12 { grid-column: span 12; }

.panel {
    position: relative;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: clamp(16px, 1.2vw, 24px);
    padding: clamp(16px, 1.2vw, 24px);
    background:
        linear-gradient(145deg, rgba(15, 39, 59, 0.96), rgba(8, 24, 39, 0.98));
    box-shadow: var(--shadow);
}

.panel::after {
    content: "";
    position: absolute;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    right: -110px;
    top: -120px;
    background: rgba(40, 216, 210, 0.05);
    filter: blur(2px);
}

.panel-heading {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.panel h2 {
    margin-bottom: 0;
    font-size: clamp(15px, 1.05vw, 21px);
    line-height: 1.2;
    letter-spacing: -0.025em;
}

.status-badge {
    flex: 0 0 auto;
    padding: 7px 10px;
    border: 1px solid rgba(40, 216, 210, 0.22);
    border-radius: 999px;
    color: var(--cyan-soft);
    background: rgba(40, 216, 210, 0.08);
    font-size: clamp(10px, 0.7vw, 12px);
    font-weight: 800;
}

.status-badge--blue {
    color: #b9d7ff;
    border-color: rgba(92, 168, 255, 0.22);
    background: rgba(92, 168, 255, 0.08);
}

.hero-panel,
.sales-panel,
.month-panel,
.territory-count-panel {
    min-height: clamp(205px, 16vw, 280px);
}

.gauge-layout {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(130px, 0.9fr) minmax(150px, 1.1fr);
    align-items: center;
    gap: clamp(14px, 1.5vw, 28px);
}

.radial-gauge {
    --progress: 0%;
    width: min(100%, 215px);
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background:
        conic-gradient(from -90deg, var(--cyan) 0 var(--progress), rgba(255,255,255,0.09) var(--progress) 100%);
    box-shadow: inset 0 0 25px rgba(40, 216, 210, 0.08), 0 0 30px rgba(40, 216, 210, 0.08);
}

.radial-gauge__inner {
    width: 72%;
    aspect-ratio: 1;
    display: grid;
    place-content: center;
    text-align: center;
    border-radius: 50%;
    background: #0a1c2b;
    box-shadow: inset 0 0 24px rgba(0,0,0,0.4);
}

.radial-gauge__inner strong {
    font-size: clamp(34px, 3.5vw, 64px);
    line-height: 0.95;
    letter-spacing: -0.06em;
}

.radial-gauge__inner span {
    margin-top: 8px;
    color: var(--muted);
    font-size: clamp(10px, 0.75vw, 13px);
}

.gauge-copy > strong {
    display: block;
    color: var(--cyan-soft);
    font-size: clamp(35px, 3.1vw, 58px);
    line-height: 1;
    letter-spacing: -0.06em;
}

.gauge-copy > span {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: clamp(11px, 0.85vw, 15px);
}

.gauge-copy small {
    display: block;
    color: var(--muted);
    font-size: clamp(10px, 0.72vw, 12px);
}

.gauge-copy small b {
    color: var(--text);
}

.progress-track,
.mini-progress {
    position: relative;
    overflow: hidden;
    height: 8px;
    margin: 16px 0 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
}

.progress-track span,
.mini-progress span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #18aaa6, var(--cyan-soft));
    box-shadow: 0 0 16px rgba(40,216,210,0.45);
    transition: width 0.5s ease;
}

.progress-track--gold span {
    background: linear-gradient(90deg, #a87525, var(--gold));
    box-shadow: 0 0 16px rgba(229,182,81,0.36);
}

.currency-icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    color: #1c1608;
    background: linear-gradient(145deg, #f3d67e, var(--gold));
    font-size: 26px;
    font-weight: 900;
}

.big-money {
    position: relative;
    z-index: 1;
    margin-top: 22px;
    font-size: clamp(42px, 4vw, 76px);
    font-weight: 850;
    line-height: 0.95;
    letter-spacing: -0.065em;
}

.sales-goal-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
    color: var(--muted);
    font-size: clamp(11px, 0.8vw, 14px);
}

.sales-goal-line strong {
    color: var(--gold);
    font-size: clamp(20px, 1.6vw, 28px);
}

.panel-note {
    position: relative;
    z-index: 1;
    margin: 12px 0 0;
    color: var(--muted);
    font-size: clamp(10px, 0.75vw, 13px);
    line-height: 1.45;
}

.month-panel,
.territory-count-panel {
    display: flex;
    flex-direction: column;
}

.metric-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    margin: 9px 0 14px;
    border-radius: 13px;
    font-weight: 900;
}

.metric-icon--cyan { color: var(--cyan); background: rgba(40,216,210,0.1); border: 1px solid rgba(40,216,210,0.2); }
.metric-icon--green { color: var(--green); background: rgba(79,212,158,0.1); border: 1px solid rgba(79,212,158,0.2); }
.metric-icon--gold { color: var(--gold); background: rgba(229,182,81,0.1); border: 1px solid rgba(229,182,81,0.2); }
.metric-icon--blue { color: var(--blue); background: rgba(92,168,255,0.1); border: 1px solid rgba(92,168,255,0.2); }

.solo-number {
    display: block;
    margin-top: auto;
    font-size: clamp(43px, 4.5vw, 72px);
    line-height: 0.95;
    letter-spacing: -0.06em;
}

.month-panel h2,
.territory-count-panel h2 {
    margin-top: 10px;
}

.map-panel,
.sectors-panel {
    min-height: clamp(330px, 26vw, 440px);
}

.map-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(170px, 0.32fr);
    gap: 16px;
    min-height: 280px;
}

.mass-map {
    min-height: 280px;
    border: 1px solid rgba(142,190,212,0.1);
    border-radius: 18px;
    background:
        radial-gradient(circle at 65% 45%, rgba(40,216,210,0.08), transparent 30%),
        linear-gradient(145deg, rgba(4,17,28,0.72), rgba(8,26,40,0.88));
}

.mass-map svg {
    width: 100%;
    height: 100%;
    min-height: 280px;
}

.state-shape,
.cape-shape,
.island-shape {
    stroke: rgba(143, 198, 222, 0.28);
    stroke-width: 2;
}

.cape-shape,
.island-shape {
    fill: #0c2a40;
}

.map-marker .marker-pulse {
    fill: transparent;
    stroke: rgba(143, 198, 222, 0.16);
    stroke-width: 1.5;
}

.map-marker .marker-core {
    fill: #36556c;
    stroke: #708da1;
    stroke-width: 1.5;
    transition: 0.35s ease;
}

.map-marker text {
    fill: #7794a8;
    font-size: 8px;
    font-weight: 700;
    paint-order: stroke;
    stroke: #071827;
    stroke-width: 2.5px;
    stroke-linejoin: round;
    opacity: 0.62;
    transition: 0.35s ease;
}

.map-marker.is-active .marker-pulse {
    stroke: rgba(40,216,210,0.45);
    filter: url(#glow);
    animation: markerPulse 2.1s infinite;
}

.map-marker.is-active .marker-core {
    fill: var(--cyan);
    stroke: #c0fffb;
    filter: url(#glow);
}

.map-marker.is-active text {
    fill: #e8fffd;
    opacity: 1;
    font-size: 9px;
}

.map-legend,
.trend-legend {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--muted);
    font-size: 11px;
}

.map-legend span,
.trend-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #36556c;
}

.legend-dot--active {
    background: var(--cyan);
    box-shadow: 0 0 10px rgba(40,216,210,0.7);
}

.territory-list-card {
    padding: 16px;
    border: 1px solid rgba(142,190,212,0.1);
    border-radius: 18px;
    background: rgba(4, 17, 28, 0.46);
}

.territory-list-card h3 {
    margin-bottom: 12px;
    font-size: 14px;
}

.territory-list-card p {
    margin: 14px 0 0;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.45;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.territory-tag {
    padding: 7px 9px;
    border: 1px solid rgba(40,216,210,0.16);
    border-radius: 999px;
    color: var(--cyan-soft);
    background: rgba(40,216,210,0.07);
    font-size: 10px;
    font-weight: 700;
}

.territory-tag--empty {
    color: var(--muted);
    border-color: var(--border);
    background: rgba(255,255,255,0.03);
}

.sector-bars {
    display: grid;
    gap: 15px;
    margin-top: 22px;
}

.sector-row {
    display: grid;
    gap: 7px;
}

.sector-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: #dcecf4;
    font-size: clamp(11px, 0.8vw, 14px);
}

.sector-label b {
    color: var(--cyan-soft);
}

.sector-track {
    overflow: hidden;
    height: 14px;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
}

.sector-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(40,216,210,0.58), var(--cyan));
    box-shadow: 0 0 14px rgba(40,216,210,0.25);
    transition: width 0.5s ease;
}

.empty-state {
    display: grid;
    place-items: center;
    min-height: 210px;
    padding: 20px;
    border: 1px dashed rgba(142,190,212,0.16);
    border-radius: 16px;
    color: var(--muted);
    text-align: center;
    font-size: 12px;
}

.kpi-panel {
    min-height: 215px;
}

.kpi-topline {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.kpi-topline .metric-icon {
    margin-top: 0;
}

.kpi-percent {
    color: var(--cyan-soft);
    font-size: 13px;
    font-weight: 800;
}

.kpi-panel > strong {
    display: block;
    margin-top: 8px;
    font-size: clamp(42px, 4vw, 68px);
    line-height: 0.95;
    letter-spacing: -0.06em;
}

.kpi-panel h2 {
    margin-top: 10px;
}

.goal-copy {
    margin-top: 12px;
    color: var(--muted);
    font-size: 12px;
}

.goal-copy b {
    color: var(--text);
}

.mini-progress {
    height: 6px;
    margin-top: 13px;
}

.trend-panel {
    min-height: 270px;
}

.trend-chart-wrap {
    overflow: hidden;
    height: 215px;
}

.trend-chart {
    width: 100%;
    height: 100%;
}

.chart-grid-line {
    stroke: rgba(143, 170, 189, 0.12);
    stroke-width: 1;
}

.chart-axis-label,
.chart-date-label {
    fill: #718ca0;
    font-size: 10px;
    font-weight: 600;
}

.chart-line {
    fill: none;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chart-line--subscriptions {
    stroke: var(--cyan);
    filter: drop-shadow(0 0 5px rgba(40,216,210,0.35));
}

.chart-line--sales {
    stroke: var(--gold);
    filter: drop-shadow(0 0 5px rgba(229,182,81,0.3));
}

.chart-dot {
    stroke: #071827;
    stroke-width: 2;
}

.chart-dot--subscriptions { fill: var(--cyan); }
.chart-dot--sales { fill: var(--gold); }

.trend-line {
    width: 18px;
    height: 3px;
    border-radius: 99px;
}

.trend-line--subscriptions { background: var(--cyan); }
.trend-line--sales { background: var(--gold); }

.dashboard-footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 4px 0;
    color: #668398;
    font-size: 11px;
}

.is-offline .live-dot {
    background: var(--danger);
    box-shadow: 0 0 0 6px rgba(255,107,126,0.12);
}

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

@keyframes markerPulse {
    0%, 100% { r: 9px; opacity: 0.7; }
    50% { r: 14px; opacity: 0.18; }
}

@media (min-width: 1500px) and (min-height: 850px) {
    .dashboard-shell {
        display: flex;
        flex-direction: column;
    }

    .dashboard-grid {
        flex: 1;
    }
}

@media (max-width: 1180px) {
    .span-2 { grid-column: span 3; }
    .hero-panel,
    .sales-panel { grid-column: span 6; }
    .month-panel,
    .territory-count-panel { grid-column: span 3; }
    .map-panel,
    .sectors-panel { grid-column: span 12; }
    .kpi-panel { grid-column: span 6; }
}

@media (max-width: 820px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .period-chip,
    .live-chip {
        flex: 1 1 180px;
    }

    .hero-panel,
    .sales-panel,
    .month-panel,
    .territory-count-panel,
    .kpi-panel,
    .trend-panel {
        grid-column: span 12;
    }

    .gauge-layout,
    .map-layout {
        grid-template-columns: 1fr;
    }

    .radial-gauge {
        width: min(70vw, 220px);
        margin-inline: auto;
    }

    .map-panel,
    .sectors-panel {
        min-height: auto;
    }

    .dashboard-footer {
        flex-direction: column;
    }
}

@media (max-width: 520px) {
    .dashboard-shell {
        padding: 12px;
    }

    .brand-block {
        align-items: flex-start;
        flex-direction: column;
    }

    .brand-logo {
        width: 165px;
    }

    .panel {
        padding: 16px;
    }

    .panel-heading {
        flex-direction: column;
    }

    .map-legend,
    .trend-legend {
        flex-wrap: wrap;
    }

    .mass-map svg {
        min-height: 230px;
    }
}

@media print {
    .icon-button,
    .live-chip {
        display: none;
    }

    body {
        background: #071827;
    }
}
