:root {
    --bg:        #060812;
    --surf:      #0b1022;
    --surf2:     #101830;
    --border:    rgba(255,255,255,0.07);
    --border-h:  rgba(0,200,255,0.18);

    --cyan:   #00e5ff;
    --blue:   #006fff;
    --purple: #7c3aed;
    --green:  #00f5a0;
    --yellow: #f5c518;
    --red:    #ff3b5c;

    --t1: #e8eaf6;
    --t2: #4a5a7a;

    --r: 14px;
}

html, body {
    width: 100vw;
    height: 100vh;
    min-width: 1280px;
    min-height: 800px;
    overflow: hidden;
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--t1);
}

#app {
    width: 100vw;
    min-width: 1280px;
    height: 100vh;
    min-height: 800px;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(ellipse 100% 55% at 50% -5%, rgba(0,90,255,0.13), transparent 60%),
        var(--bg);
}

/* ── Topbar ─────────────────────────────────────────────── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    padding: 0 24px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: rgba(10,13,28,0.97);
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--blue), var(--cyan));
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    box-shadow: 0 0 16px rgba(0,114,255,0.4);
}
.brand-name { font-size: 16px; font-weight: 800; letter-spacing: 0.5px; }

/* ── Clock + Date ───────────────────────────────────────── */
.clock-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}
.clock {
    font-size: 26px; font-weight: 700;
    letter-spacing: 3px; font-variant-numeric: tabular-nums;
    color: var(--t1);
    line-height: 1;
}
.date {
    font-size: 11px; font-weight: 500;
    color: var(--t2); letter-spacing: 0.5px;
    text-transform: capitalize;
}

.topbar-right { display: flex; gap: 8px; align-items: center; }

.pill {
    display: flex; align-items: center; gap: 7px;
    padding: 6px 14px; border-radius: 20px;
    font-size: 12px; font-weight: 600; color: var(--t2);
    background: var(--surf); border: 1px solid var(--border);
    white-space: nowrap;
}
.pill.online   { color: var(--green);  border-color: rgba(0,245,160,0.2); }
.pill.warn     { color: var(--yellow); border-color: rgba(245,197,24,0.25); }
.pill.error    { color: var(--red);    border-color: rgba(255,59,92,0.25); }

.dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--green); box-shadow: 0 0 8px var(--green);
    animation: blink 2s infinite;
    flex-shrink: 0;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ── Content Layout (3 columns) ─────────────────────────── */
.content {
    flex: 1;
    display: flex;
    gap: 14px;
    padding: 14px 22px 16px;
    min-height: 0;
}

.col-left {
    width: 230px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}

.col-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}

.col-right {
    width: 330px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}

/* ── Ping Monitor ───────────────────────────────────── */
.card-ping { flex-shrink: 0; }
.ping-rows { display: flex; flex-direction: column; gap: 10px; }
.ping-row {
    display: flex; align-items: center; gap: 8px;
    background: var(--surf2); border-radius: 10px;
    padding: 8px 10px;
}
.ping-left { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ping-host { font-size: 12px; font-weight: 600; color: var(--t1); }
.ping-addr { font-size: 10px; color: var(--t2); font-variant-numeric: tabular-nums; }
.ping-ms {
    font-size: 12px; font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap; margin-left: auto;
    padding: 2px 6px; border-radius: 5px;
    background: var(--surf);
}
.ping-ok   { color: var(--green); }
.ping-warn { color: var(--yellow); }
.ping-bad  { color: var(--red); }
.ping-spark {
    width: 72px; height: 28px; flex-shrink: 0;
    display: block;
}

/* ── Daily Traffic ──────────────────────────────────── */
.card-daily {
    flex: 1; min-height: 0;
    display: flex; flex-direction: column;
}
.daily-wrap {
    flex: 1; min-height: 0;
    position: relative;
    margin: 0 -2px;
}
.daily-wrap canvas { display: block; width: 100%; height: 100%; }
.daily-footer {
    display: flex; flex-direction: column; gap: 4px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    margin-top: 6px;
}
.daily-total-row { display: flex; justify-content: space-between; align-items: center; }
.daily-key { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--t2); }
.daily-val { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ── Cards ──────────────────────────────────────────────── */
.card {
    background: var(--surf);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 16px 18px;
    overflow: hidden;
    position: relative;
    transition: border-color 0.4s ease;
}
.card:hover { border-color: var(--border-h); }
.card-label {
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1.5px; color: var(--t2);
    display: flex; align-items: center; gap: 7px;
    margin-bottom: 12px;
}

/* ── System Resources ───────────────────────────────────── */
.sys-rows { display: flex; flex-direction: column; gap: 10px; }
.sys-row { display: flex; flex-direction: column; gap: 5px; }
.sys-row-header { display: flex; justify-content: space-between; align-items: center; }
.sys-key { font-size: 11px; font-weight: 600; color: var(--t2); text-transform: uppercase; letter-spacing: 0.8px; }
.sys-val { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--t1); }

.res-bar {
    height: 5px;
    background: var(--surf2);
    border-radius: 3px;
    overflow: hidden;
}
.res-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--cyan);
    transition: width 0.8s ease, background 0.5s ease;
}

.sys-uptime-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 6px;
    border-top: 1px solid var(--border);
    margin-top: 2px;
}
.sys-uptime-row .sys-val { font-size: 11px; color: var(--t2); font-weight: 500; }

/* ── Gateway Widget ─────────────────────────────────────── */
.card-gateways { flex: 1; min-height: 0; }
.gw-list { display: flex; flex-direction: column; gap: 7px; }
.gw-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px;
    background: var(--surf2);
    border-radius: 9px;
    font-size: 12px;
}
.gw-dot {
    width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.dot-online { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dot-warn   { background: var(--yellow); box-shadow: 0 0 6px var(--yellow); }
.dot-error  { background: var(--red);   box-shadow: 0 0 6px var(--red); }

.gw-name  { flex: 1; font-weight: 600; color: var(--t1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gw-addr  { font-size: 10px; color: var(--t2); margin-right: 4px; }
.gw-latency {
    font-size: 11px; font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.gw-lat-ok   { color: var(--green); }
.gw-lat-warn { color: var(--yellow); }
.gw-lat-bad  { color: var(--red); }
.gw-empty { color: var(--t2); font-size: 12px; text-align: center; padding: 12px 0; }

/* ── Hero card (Center) ─────────────────────────────────── */
.card-hero {
    flex: 1;
    background: linear-gradient(170deg, #08102b 0%, #040810 100%);
    border-color: rgba(0,100,255,0.12);
    display: flex;
    flex-direction: column;
    padding: 18px 22px 0;
}

.hero-top {
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding-bottom: 12px;
    margin-bottom: 2px;
}

.hero-clients { display: flex; align-items: center; gap: 12px; }
.hero-clients i { font-size: 18px; color: var(--t2); }
.hero-clients span { font-size: 18px; font-weight: 600; color: var(--t2); }
.hero-clients strong {
    margin-left: auto;
    font-size: 40px; font-weight: 900;
    color: var(--t1); line-height: 1;
    font-variant-numeric: tabular-nums;
}

.hero-speeds {
    display: flex; align-items: baseline; gap: 28px;
    padding: 12px 0 10px;
    position: relative;
}
.hero-speeds::after {
    content: '';
    display: block;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0,229,255,0.3), rgba(0,111,255,0.2), transparent);
    margin-top: 10px;
}

.speed-sep { width: 1px; height: 36px; background: var(--border); }
.speed-block { display: flex; align-items: baseline; gap: 7px; }

/* ── Speed Arrow Animations ─────────────────────────────── */
.speed-arrow {
    font-size: 17px;
    transition: opacity 0.4s ease;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
}
@keyframes flow-down {
    0%,100% { transform: translateY(0); }
    50%     { transform: translateY(3px); }
}
@keyframes flow-up {
    0%,100% { transform: translateY(0); }
    50%     { transform: translateY(-3px); }
}

.icon-cyan   { color: var(--cyan); }
.icon-blue   { color: var(--blue); }
.icon-purple { color: var(--purple); }

.speed-val {
    font-size: 50px; font-weight: 900; line-height: 1;
    font-variant-numeric: tabular-nums; letter-spacing: -1px;
}
.speed-val.cyan { color: var(--cyan); text-shadow: 0 0 28px rgba(0,229,255,.35), 0 0 56px rgba(0,229,255,.1); }
.speed-val.blue { color: var(--blue); text-shadow: 0 0 28px rgba(0,111,255,.35), 0 0 56px rgba(0,111,255,.1); }
.speed-unit { font-size: 16px; font-weight: 600; color: var(--t2); letter-spacing: 0.5px; }

.hero-chart {
    flex: 1;
    margin: 0 -22px;
    position: relative;
    min-height: 0;
}

/* ── Interface list card ────────────────────────────────── */
.card-ifaces { flex-shrink: 0; }
.iface-list { display: flex; flex-direction: column; gap: 6px; }
.iface-row {
    display: flex; align-items: center;
    padding: 7px 10px;
    background: var(--surf2);
    border-radius: 9px;
    font-size: 12px;
}
.iface-name { flex: 1; font-weight: 600; color: var(--t1); }
.iface-rx, .iface-tx {
    width: 95px; text-align: right;
    font-weight: 700; font-variant-numeric: tabular-nums;
    font-size: 11px;
}
.iface-rx { color: var(--cyan); }
.iface-tx { color: var(--blue); }
.iface-legend {
    display: flex; gap: 14px; margin-top: 7px;
    font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 1px;
}
.cyan { color: var(--cyan); }
.blue { color: var(--blue); }
.secondary { color: var(--t2); font-size: 12px; }

/* ── WAN card ────────────────────────────────────────────── */
.card-wan { flex-shrink: 0; }
.wan-rows { display: flex; flex-direction: column; gap: 10px; }
.wan-row { display: flex; justify-content: space-between; align-items: center; }
.wan-key { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--t2); }
.wan-val { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; word-break: break-all; }

/* ── WireGuard card ──────────────────────────────────────── */
.card-wireguard { flex-shrink: 0; }
.wg-list { display: flex; flex-direction: column; gap: 6px; }
.wg-peer {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px;
    background: var(--surf2);
    border-radius: 9px;
    font-size: 12px;
}
.wg-dot {
    width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.wg-info { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: 1px; }
.wg-name { font-weight: 600; color: var(--t1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wg-hs   { font-size: 10px; color: var(--t2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wg-ep   { font-size: 10px; color: var(--t2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.wg-empty { color: var(--t2); font-size: 12px; text-align: center; padding: 10px 0; }

/* ── IPsec ──────────────────────────────────────────────── */
.card-ipsec { flex-shrink: 0; display: flex; flex-direction: column; }
.border-bottom { border-bottom: 1px solid rgba(255,255,255,0.06); padding-bottom: 8px; margin-bottom: 10px; }
.ipsec-sum-text { font-size: 12px; color: var(--t2); display: block; text-align: center; }
.ipsec-sum-text strong { color: var(--t1); font-weight: 600; font-variant-numeric: tabular-nums; }
.ipsec-sum-text strong.green { color: var(--green); }
.ipsec-sum-text strong.red { color: var(--red); }
.ipsec-list { display: flex; flex-direction: column; gap: 8px; }
.ipsec-peer {
    display: flex; flex-direction: column; gap: 4px;
    background: var(--surf2); border-radius: 8px; padding: 10px 12px;
    border: 1px solid transparent; transition: 0.2s ease;
}
.ipsec-peer:hover { border-color: rgba(255,255,255,0.05); }
.ipsec-top { display: flex; align-items: center; gap: 8px; }
.ipsec-icon { font-size: 13px; }
.ipsec-icon.green { color: var(--green); text-shadow: 0 0 6px rgba(0,255,100,0.3); }
.ipsec-icon.red { color: var(--red); text-shadow: 0 0 6px rgba(255,50,50,0.3); }
.ipsec-name { font-size: 13px; font-weight: 600; color: var(--t1); }
.ipsec-ips { display: flex; align-items: center; gap: 6px; font-size: 11px; font-variant-numeric: tabular-nums; margin-top: 2px; }
.ipsec-local { color: var(--t2); }
.ipsec-div { color: var(--border); font-size: 10px; }
.ipsec-remote { color: var(--cyan); }
.ipsec-uptime { font-size: 11px; margin-top: 4px; }
.ipsec-lbl { color: var(--t2); }
.ipsec-val { color: var(--t1); font-weight: 500; font-variant-numeric: tabular-nums; }
.ipsec-traffic { display: flex; align-items: center; gap: 10px; margin-top: 4px; font-size: 11px; font-variant-numeric: tabular-nums; font-weight: 600; }
.ipsec-t-item { display: flex; align-items: center; gap: 4px; color: var(--t1); }
.ipsec-t-div { color: var(--border); font-size: 10px; }
.ipsec-empty { color: var(--t2); font-size: 12px; text-align: center; padding: 10px 0; }

/* ── System Health ────────────────────────────────────────── */
.card-syshealth { flex: 1.2; min-height: 0; display: flex; flex-direction: column; }
.sys-rings {
    display: flex; gap: 20px; align-items: center; justify-content: center;
    flex: 1; margin-top: 10px; margin-bottom: 20px;
}
.sys-ring-box {
    position: relative; width: 85px; height: 85px;
    display: flex; align-items: center; justify-content: center;
}
.sys-svg {
    width: 100%; height: 100%;
    transform: rotate(-90deg);
}
.sys-bg {
    fill: none; stroke: var(--surf2); stroke-width: 3.5;
}
.sys-fill {
    fill: none; stroke-width: 3.5; stroke-linecap: round;
    transition: stroke-dashoffset 0.8s ease-out, stroke 0.4s ease;
}
.sys-cpu-fill { stroke: var(--cyan); filter: drop-shadow(0 0 4px rgba(0,229,255,0.3)); }
.sys-ram-fill { stroke: var(--blue); filter: drop-shadow(0 0 4px rgba(0,111,255,0.3)); }

.sys-info {
    position: absolute; display: flex; flex-direction: column; align-items: center;
}
.sys-val { font-size: 20px; font-weight: 800; color: var(--t1); line-height: 1; font-variant-numeric: tabular-nums; }
.sys-lbl { font-size: 11px; font-weight: 600; color: var(--t2); text-transform: uppercase; margin-top: 2px; }

.sys-uptime-row {
    border-top: 1px solid rgba(255,255,255,0.06);
    padding-top: 12px; margin-top: auto;
    display: flex; justify-content: space-between; align-items: baseline;
}
.sys-uptime-lbl { font-size: 12px; color: var(--t2); }
.sys-uptime-val { font-size: 13px; font-weight: 600; color: var(--t1); font-variant-numeric: tabular-nums; }

/* ── Responsive / 1080p Support ──────────────────────────── */
@media (min-width: 1400px) {
    #app {
        max-width: 1920px;
        margin: 0 auto;
    }
    .col-left {
        width: 280px; /* 230px -> 280px */
    }
    .col-right {
        width: 380px; /* 330px -> 380px */
    }
    
    /* Slightly boost main traffic hero font sizes and heights */
    .hero-clients { font-size: 20px; }
    .hero-clients strong { font-size: 36px; }
    .speed-val { font-size: 60px; }
    .hero-chart { height: 260px; } /* 200px -> 260px */
    
    /* Boost daily traffic bars size */
    .daily-wrap { height: 260px; }
    
    /* Slightly bigger fonts everywhere else */
    .card-label { font-size: 12px; padding: 12px 14px 8px; }
    .speed-unit, .daily-key, .wan-key, .iface-name, .wg-name, .ipsec-name { font-size: 14px; }
    .wg-hs, .wg-ep, .ipsec-uptime, .device-item { font-size: 12px; }
    
    /* System Health rings */
    .sys-ring-box { width: 100px; height: 100px; }
    .sys-val { font-size: 24px; }
    .sys-lbl { font-size: 12px; }
}
