:root {
    --c:   #00eaff; /* cyan accent */
    --p:   #a78bfa; /* purple accent */
    --o:   #f97316; /* orange accent */
    --g:   #10b981; /* green */
    --r:   #ef4444; /* red */
    --y:   #fbbf24; /* yellow */
    --bg:  #030810;
    --panel: rgba(6,16,36,0.75);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: var(--bg);
    color: #e2e8f0;
    font-family: 'Inter', system-ui, sans-serif;
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
    /* subtle grid */
    background-image:
        linear-gradient(rgba(0,234,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,234,255,0.03) 1px, transparent 1px);
    background-size: 40px 40px;
}

/* ── CRT scan-line overlay ─────────────────── */
body::after {
    content: '';
    position: fixed; inset: 0;
    pointer-events: none; z-index: 9999;
    background: repeating-linear-gradient(
        0deg,
        transparent 0px,
        transparent 2px,
        rgba(0,0,0,0.06) 2px,
        rgba(0,0,0,0.06) 4px
    );
    animation: scanFlicker 8s linear infinite;
}
@keyframes scanFlicker {
    0%,100% { opacity: 0.35; }
    50%     { opacity: 0.25; }
}

/* ── Floating light sweep across whole screen ── */
body::before {
    content: '';
    position: fixed;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    pointer-events: none; z-index: 0;
    background: conic-gradient(
        from 0deg at 50% 50%,
        transparent 0deg,
        rgba(0,234,255,0.015) 60deg,
        transparent 120deg,
        rgba(167,139,250,0.01) 200deg,
        transparent 360deg
    );
    animation: sweep 20s linear infinite;
}
@keyframes sweep { to { transform: rotate(360deg); } }

/* ── KPI breathing glow ───────────────────── */
@keyframes breathe {
    0%,100% { text-shadow: 0 0 8px currentColor; }
    50%     { text-shadow: 0 0 20px currentColor, 0 0 40px currentColor; }
}
.kpi-cell .k-value {
    animation: breathe 3s ease-in-out infinite;
}

/* ── Panel entrance animation ──────────────── */
@keyframes panelFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.panel {
    animation: panelFadeIn 0.6s ease backwards;
}
.panel:nth-child(1) { animation-delay: 0.1s; }
.panel:nth-child(2) { animation-delay: 0.2s; }
.panel:nth-child(3) { animation-delay: 0.3s; }
.panel:nth-child(4) { animation-delay: 0.4s; }

/* ── Animated border glow on panels ────────── */
@keyframes borderGlow {
    0%,100% { border-color: rgba(0,234,255,0.15); box-shadow: 0 0 0 transparent; }
    50%     { border-color: rgba(0,234,255,0.3);  box-shadow: 0 0 12px rgba(0,234,255,0.08); }
}
.panel {
    animation: panelFadeIn 0.6s ease backwards, borderGlow 5s ease-in-out infinite;
}

/* ── HEADER ───────────────────────────────────── */
.tv-header {
    height: 72px;
    flex-shrink: 0;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 28px;
    border-bottom: 1px solid rgba(0,234,255,0.18);
    background: linear-gradient(180deg, rgba(0,234,255,0.06) 0%, transparent 100%);
    position: relative;
    z-index: 20;
}
.tv-header::after {
    content: '';
    position: absolute;
    bottom: -2px; left: 5%; right: 5%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--c), var(--p), var(--c), transparent);
    animation: shimmer 3s linear infinite;
}
@keyframes shimmer { from{background-position:-200% 0} to{background-position:200% 0} }

.hdr-left { display: flex; align-items: center; gap: 14px; }
.hdr-logo  { height: 46px; width: auto; max-width: 100px; object-fit: contain; filter: drop-shadow(0 0 8px var(--c)); }
.hdr-logo-fallback { font-size: 22px; font-weight: 900; background: linear-gradient(135deg, var(--o), var(--p)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hdr-platform-tag {
    font-size: 11px; font-weight: 700; letter-spacing: 2px;
    color: var(--c); border: 1px solid rgba(0,234,255,0.35);
    padding: 3px 10px; border-radius: 20px;
    background: rgba(0,234,255,0.07);
    text-transform: uppercase;
}

.hdr-center { text-align: center; }
.hdr-title {
    font-size: 26px; font-weight: 900; letter-spacing: 6px;
    background: linear-gradient(135deg, #fff 10%, var(--c) 50%, var(--p) 90%);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
    text-shadow: none;
    filter: drop-shadow(0 0 20px rgba(0,234,255,0.4));
}
.hdr-sub { font-size: 11px; color: rgba(255,255,255,0.45); letter-spacing: 3px; margin-top: 2px; }

.hdr-right { display: flex; align-items: center; justify-content: flex-end; gap: 16px; }
.hdr-clock { font-size: 28px; font-weight: 900; color: var(--c); font-variant-numeric: tabular-nums; letter-spacing: 2px; text-shadow: 0 0 12px var(--c); }
.hdr-date  { font-size: 12px; color: rgba(255,255,255,0.5); text-align: right; margin-top: 1px; }

.btn-exit {
    padding: 8px 18px; font-size: 12px; font-weight: 700; letter-spacing: 1px;
    background: rgba(239,68,68,0.15); color: #ef4444;
    border: 1px solid rgba(239,68,68,0.4); border-radius: 6px;
    cursor: pointer; transition: all .2s;
}
.btn-exit:hover { background: rgba(239,68,68,0.3); }

/* ── MAIN GRID ─── */
.tv-body {
    flex: 1;
    display: grid;
    grid-template-columns: 460px 1fr 460px;
    grid-template-rows: 90px 1fr 1fr;
    gap: 16px;
    padding: 16px 20px 20px;
    min-height: 0;
    position: relative;
    z-index: 1;
}

/* KPI ticker strip — full width center top */
.kpi-strip {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
    width: 100%;
    max-width: 1000px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    background: rgba(0,234,255,0.04);
    border: 1px solid rgba(0,234,255,0.2);
    border-radius: 10px;
    padding: 0 24px;
    position: relative;
    overflow: hidden;
    z-index: 10;
    backdrop-filter: blur(8px);
}
.kpi-strip::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(0,234,255,0.04) 50%, transparent 100%);
    animation: pulse-bg 4s ease-in-out infinite;
}
@keyframes pulse-bg { 0%,100%{opacity:0} 50%{opacity:1} }
.kpi-cell { text-align: center; }
.kpi-cell .k-label { font-size: 10px; font-weight: 700; letter-spacing: 2px; color: rgba(255,255,255,0.5); text-transform: uppercase; }
.kpi-cell .k-value { font-size: 26px; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: 1px; margin-top: 2px; }
.kpi-cell .k-trend { font-size: 11px; font-weight: 600; margin-top: 2px; }
.kpi-sep { width: 1px; height: 42px; background: rgba(0,234,255,0.2); }
.cyan { color: var(--c); text-shadow: 0 0 10px var(--c); }
.green { color: var(--g); text-shadow: 0 0 10px var(--g); }
.red   { color: var(--r); text-shadow: 0 0 10px var(--r); }
.yellow{ color: var(--y); text-shadow: 0 0 10px var(--y); }
.purple{ color: var(--p); text-shadow: 0 0 10px var(--p); }

.top-left-panel {
    grid-column: 1; grid-row: 2;
    justify-self: stretch; height: 100%;
}
.bottom-left-panel {
    grid-column: 1; grid-row: 3;
    justify-self: stretch; height: 100%;
}
.top-right-panel {
    grid-column: 3; grid-row: 2;
    justify-self: stretch; height: 100%;
}
.bottom-right-panel {
    grid-column: 3; grid-row: 3;
    justify-self: stretch; height: 100%;
}

/* Center panels */
.center-map {
    position: fixed !important;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 1 !important;
    border: none !important;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: none !important;
    animation: none !important;
    padding: 0 !important;
    margin: 0 !important;
    pointer-events: auto;
}
.center-map::before, .center-map::after { display: none !important; }
.center-map .ph { display: none !important; }

.center-orders  { grid-column: 2; grid-row: 3; z-index: 10; }

/* ── PANEL ─────────────────────────────────── */
.panel {
    background: rgba(3, 8, 16, 0.45);
    border: 1px solid rgba(0,234,255,0.15);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: relative;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    overflow: hidden;
    flex: 1;
    z-index: 10;
    box-shadow: inset 0 0 20px rgba(0,234,255,0.02);
}
/* Tech corner decorations */
.panel::before, .panel::after {
    content: ''; position: absolute; width: 12px; height: 12px;
    border-color: var(--c); border-style: solid; pointer-events: none; z-index: 10;
}
.panel::before { top: 0; left:  0; border-width: 2px 0 0 2px; border-radius: 2px 0 0 0; }
.panel::after  { bottom: 0; right: 0; border-width: 0 2px 2px 0; border-radius: 0 0 2px 0; }

.ph {
    height: 44px; flex-shrink: 0;
    display: flex; align-items: center; gap: 8px;
    padding: 0 14px;
    border-bottom: 1px solid rgba(0,234,255,0.12);
    background: linear-gradient(90deg, rgba(0,234,255,0.1) 0%, transparent 70%);
    font-size: 13px; font-weight: 700; color: var(--c); letter-spacing: 1px;
}
.ph .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); animation: blink 1.5s ease-in-out infinite; flex-shrink: 0; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.3} }

.pb { flex: 1; padding: 10px 14px; overflow: hidden; position: relative; min-height: 0; }

/* ── RANK LIST ─────────────────────────────── */
.rank-list { display: flex; flex-direction: column; gap: 6px; height: 100%; overflow-y: auto; }
.rank-list::-webkit-scrollbar { width: 3px; }
.rank-list::-webkit-scrollbar-thumb { background: rgba(0,234,255,0.3); border-radius: 2px; }

.rank-item {
    display: grid; grid-template-columns: 28px 1fr auto;
    align-items: center; gap: 8px;
    background: rgba(0,234,255,0.04);
    border: 1px solid rgba(0,234,255,0.08);
    border-radius: 6px; padding: 8px 10px;
    transition: all .2s;
}
.rank-item:hover { background: rgba(0,234,255,0.1); border-color: rgba(0,234,255,0.25); }

.rank-no {
    width: 26px; height: 26px; border-radius: 5px;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 900;
    background: rgba(0,234,255,0.15); color: var(--c);
}
.rank-item:nth-child(1) .rank-no { background: transparent; border: 2px solid var(--r); color: var(--r); box-shadow: 0 0 8px var(--r); }
.rank-item:nth-child(2) .rank-no { background: transparent; border: 2px solid var(--y); color: var(--y); box-shadow: 0 0 8px var(--y); }
.rank-item:nth-child(3) .rank-no { background: transparent; border: 2px solid var(--g); color: var(--g); box-shadow: 0 0 8px var(--g); }

.rank-name { font-size: 12px; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; }
.rank-val  { font-size: 13px; font-weight: 800; color: var(--c); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rank-bar-wrap { grid-column: 1/-1; height: 2px; background: rgba(0,234,255,0.1); border-radius: 1px; margin-top: 2px; }
.rank-bar { height: 100%; background: linear-gradient(90deg, var(--c), var(--p)); border-radius: 1px; transition: width 1s ease; }

/* ── PROGRESS RING ─────────────────────────── */
.ring-wrap { display: flex; align-items: center; justify-content: center; gap: 24px; height: 100%; }
.ring-chart { width: 100px; height: 100px; }
.ring-stats { display: flex; flex-direction: column; gap: 8px; }
.ring-stat-item .rs-label { font-size: 10px; color: rgba(255,255,255,0.5); letter-spacing: 1px; text-transform: uppercase; }
.ring-stat-item .rs-val   { font-size: 18px; font-weight: 800; margin-top: 1px; }

/* ── LIVE ORDERS ───────────────────────────── */
.live-stream {
    display: flex; flex-direction: column; gap: 5px;
    height: 100%; overflow: hidden;
    position: relative;
}
/* Auto-scroll animation for live orders */
.live-stream-inner {
    display: flex; flex-direction: column; gap: 5px;
    animation: scrollUp 60s linear infinite;
}
.live-stream:hover .live-stream-inner { animation-play-state: paused; }
@keyframes scrollUp {
    0%   { transform: translateY(0); }
    100% { transform: translateY(-50%); }
}
.order-row {
    display: grid;
    grid-template-columns: 55px 1fr auto auto;
    align-items: center; gap: 8px;
    background: rgba(0,234,255,0.04);
    border: 1px solid rgba(0,234,255,0.08);
    border-left: 3px solid var(--c);
    border-radius: 0 6px 6px 0; padding: 6px 10px;
    font-size: 12px; flex-shrink: 0;
}
@keyframes slideIn { from{opacity:0;transform:translateX(-20px)} to{opacity:1;transform:translateX(0)} }
.order-row.wb    { border-left-color: #a855f7; }
.order-row.ozon  { border-left-color: #3b82f6; }
.order-row.yandex{ border-left-color: var(--y); }
.order-time  { font-size: 11px; color: rgba(255,255,255,0.45); font-variant-numeric: tabular-nums; }
.order-sku   { font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.order-shop  { font-size: 11px; color: rgba(255,255,255,0.5); white-space: nowrap; }
.order-amount{ font-weight: 800; color: var(--g); white-space: nowrap; }

/* Target input styling */
.target-input-wrap { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.target-input-wrap label { font-size: 10px; color: rgba(255,255,255,0.5); white-space: nowrap; }
.target-input {
    background: rgba(0,0,0,0.5); border: 1px solid rgba(0,234,255,0.3);
    border-radius: 4px; color: var(--c); padding: 3px 8px;
    font-size: 13px; font-weight: 700; width: 110px; text-align: right;
    outline: none; font-family: inherit;
}
.target-input:focus { border-color: var(--c); box-shadow: 0 0 8px rgba(0,234,255,0.2); }
.target-unit { font-size: 11px; color: rgba(255,255,255,0.4); }

/* ── Date range buttons ───────────────── */
.tv-range-btn {
    background: rgba(0,234,255,0.08); border: 1px solid rgba(0,234,255,0.2);
    border-radius: 6px; color: rgba(255,255,255,0.6); padding: 4px 14px;
    font-size: 12px; font-weight: 700; cursor: pointer; transition: all .2s;
    font-family: inherit;
}
.tv-range-btn:hover { background: rgba(0,234,255,0.15); color: #fff; }
.tv-range-btn.active {
    background: rgba(0,234,255,0.2); border-color: var(--c);
    color: var(--c); box-shadow: 0 0 8px rgba(0,234,255,0.2);
}

/* ── CHART SIZE ────────────────────────────── */
.chart-full { width: 100%; height: 100%; }

/* ── FILTERS ROW ───────────────────────────── */
.filter-row {
    display: flex; gap: 8px; align-items: center;
    padding: 8px 14px;
    border-bottom: 1px solid rgba(0,234,255,0.08);
    flex-shrink: 0;
}
select {
    background: rgba(0,0,0,0.6); color: var(--c);
    border: 1px solid rgba(0,234,255,0.3); border-radius: 6px;
    padding: 5px 10px; font-size: 12px; font-weight: 600;
    cursor: pointer; outline: none;
}
select:focus { border-color: var(--c); }

/* ── Language Switcher (Sci-Fi style) ─────── */
.tv-lang-switch {
    display: flex;
    background: rgba(0,234,255,0.04);
    border: 1px solid rgba(0,234,255,0.15);
    border-radius: 8px;
    padding: 2px;
    gap: 2px;
    backdrop-filter: blur(6px);
}
.tv-lang-btn {
    position: relative;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: rgba(255,255,255,0.4);
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Inter', system-ui, sans-serif;
    overflow: hidden;
}
.tv-lang-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(0,234,255,0.15), rgba(167,139,250,0.1));
    border-radius: 6px;
    opacity: 0;
    transition: opacity 0.35s ease;
}
.tv-lang-btn:hover {
    color: rgba(255,255,255,0.75);
    border-color: rgba(0,234,255,0.2);
}
.tv-lang-btn:hover::before {
    opacity: 1;
}
.tv-lang-btn.active {
    color: var(--c);
    border-color: rgba(0,234,255,0.4);
    background: rgba(0,234,255,0.12);
    box-shadow: 0 0 12px rgba(0,234,255,0.15), inset 0 0 8px rgba(0,234,255,0.05);
    text-shadow: 0 0 8px var(--c);
}
.tv-lang-btn.active::before {
    opacity: 0;
}
