/* dashboard\energy\assets\css\style.css */
:root{
    --bg: #0b1220;
    --panel: rgba(17, 24, 39, 0.78);
    --panel-2: rgba(30, 41, 59, 0.9);
    --card: rgba(255,255,255,0.06);
    --line: rgba(148, 163, 184, 0.22);
    --text: #e5eefc;
    --muted: #9fb0c9;
    --green: #6ee7b7;
    --green-2: #22c55e;
    --amber: #fbbf24;
    --red: #fb7185;
    --cyan: #38bdf8;
    --shadow: 0 20px 50px rgba(0,0,0,0.35);
    --radius: 24px;
}

*{
    box-sizing: border-box;
}

body{
    margin: 0;
    font-family: "Segoe UI", Tahoma, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(56,189,248,0.08), transparent 25%),
        radial-gradient(circle at top right, rgba(34,197,94,0.08), transparent 25%),
        linear-gradient(135deg, #0b1220 0%, #101827 100%);
    min-height: 100vh;
}

.page-shell{
    max-width: 1700px;
    margin: 0 auto;
    padding: 24px;
}

.topbar{
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.topbar h1{
    margin: 0;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: .2px;
}

.subtitle{
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 0.98rem;
}

.topbar-right{
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-chip{
    padding: 10px 16px;
    border-radius: 999px;
    font-size: .9rem;
    font-weight: 700;
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: var(--shadow);
}

.status-chip.online{
    background: rgba(34,197,94,0.16);
    color: #b9ffd6;
}

.last-update-box{
    background: var(--panel);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 18px;
    padding: 10px 14px;
    min-width: 170px;
    box-shadow: var(--shadow);
}

.last-update-box span{
    display: block;
    color: var(--muted);
    font-size: .8rem;
    margin-bottom: 4px;
}

.last-update-box strong{
    font-size: .95rem;
}

.summary-grid{
    display: grid;
    grid-template-columns: repeat(3, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.summary-card{
    background: var(--panel);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.summary-card::before{
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, rgba(56,189,248,0.08), transparent 35%, rgba(34,197,94,0.08));
    pointer-events: none;
}

.summary-title{
    color: var(--muted);
    font-size: .95rem;
    margin-bottom: 10px;
}

.summary-value{
    font-size: 2rem;
    font-weight: 900;
    line-height: 1;
    margin-bottom: 8px;
}

.summary-value span{
    font-size: 1rem;
    font-weight: 700;
    color: var(--cyan);
}

.summary-sub{
    color: var(--muted);
    font-size: .9rem;
}

.dashboard-layout{
    display: grid;
    grid-template-columns: minmax(900px, 1.5fr) minmax(320px, 420px);
    gap: 20px;
}

.stations-column{
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.station-card{
    background: var(--panel);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 28px;
    padding: 20px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.station-card::before{
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 10% 10%, rgba(56,189,248,0.08), transparent 22%),
        radial-gradient(circle at 95% 15%, rgba(34,197,94,0.08), transparent 18%);
    pointer-events: none;
}

.station-card-header{
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 18px;
}

.station-card-header h2{
    margin: 0 0 8px;
    font-size: 1.5rem;
}

.station-meta{
    margin: 0;
    color: var(--muted);
    font-size: .92rem;
}

.station-total-box{
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    padding: 14px 18px;
    border-radius: 18px;
    min-width: 170px;
    text-align: right;
}

.station-total-box span{
    display: block;
    color: var(--muted);
    font-size: .82rem;
    margin-bottom: 4px;
}

.station-total-box strong{
    font-size: 1.2rem;
    color: #d7fff0;
}

.station-flow-layout{
    display: grid;
    grid-template-columns: minmax(290px, 360px) 220px minmax(280px, 360px);
    gap: 18px;
    align-items: center;
}

.vent-column{
    display: grid;
    gap: 14px;
}

.vent-card{
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 14px;
    align-items: center;
    background: var(--card);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 14px;
    backdrop-filter: blur(12px);
    transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}

.vent-card:hover{
    transform: translateY(-2px);
    border-color: rgba(110,231,183,0.35);
    box-shadow: 0 12px 30px rgba(0,0,0,0.22);
}

.vent-image-wrap{
    width: 100%;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.06);
    border-radius: 18px;
    overflow: hidden;
}

.vent-image-wrap img{
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    filter: drop-shadow(0 8px 10px rgba(0,0,0,0.25));
}

.vent-info{
    display: grid;
    gap: 10px;
}

.vent-name{
    font-size: 1rem;
    font-weight: 700;
}

.gauge-mini{
    display: grid;
    gap: 8px;
}

.gauge-track{
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(90deg, #22c55e 0%, #84cc16 35%, #f59e0b 70%, #ef4444 100%);
    opacity: .25;
    overflow: hidden;
    position: relative;
}

.gauge-fill{
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(90deg, #22c55e 0%, #84cc16 35%, #f59e0b 70%, #ef4444 100%);
    box-shadow: 0 0 16px rgba(110,231,183,.4);
    transition: width .5s ease;
}

.gauge-value{
    font-size: .95rem;
    color: #dffdf3;
    font-weight: 700;
}

.connector-stage{
    min-height: 320px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bus-lines{
    width: 100%;
    height: 100%;
    min-height: 320px;
    position: relative;
}

.flow-line{
    position: absolute;
    border-radius: 999px;
    background:
        linear-gradient(90deg, rgba(255,255,255,0.12), rgba(255,255,255,0.12)),
        repeating-linear-gradient(
            90deg,
            rgba(110,231,183,0) 0px,
            rgba(110,231,183,0) 24px,
            rgba(110,231,183,0.95) 24px,
            rgba(110,231,183,0.95) 42px,
            rgba(56,189,248,0.95) 42px,
            rgba(56,189,248,0.95) 56px
        );
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 0 10px rgba(56,189,248,0.12);
    opacity: .45;
}

.flow-line.active{
    animation: flowMove 1.2s linear infinite;
    opacity: 1;
}

.flow-line.horizontal{
    width: 180px;
    height: 12px;
    left: 10px;
    background-size: 100% 100%, 180px 100%;
}

.flow-line.vertical{
    width: 12px;
    height: 242px;
    left: 178px;
    top: 38px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0.12)),
        repeating-linear-gradient(
            180deg,
            rgba(110,231,183,0) 0px,
            rgba(110,231,183,0) 24px,
            rgba(110,231,183,0.95) 24px,
            rgba(110,231,183,0.95) 42px,
            rgba(56,189,248,0.95) 42px,
            rgba(56,189,248,0.95) 56px
        );
    background-size: 100% 100%, 100% 180px;
}

.flow-line.vertical.mid{
    position: relative;
    width: 12px;
    height: 56px;
    left: auto;
    top: auto;
    margin: 14px auto;
}

#s1Line1, #s2Line1{ top: 35px; }
#s1Line2, #s2Line2{ top: 128px; }
#s1Line3, #s2Line3{ top: 220px; }

.device-column{
    display: grid;
    justify-items: center;
    gap: 8px;
}

.controller-card{
    width: 100%;
    max-width: 300px;
    min-height: 145px;
    background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04));
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 22px;
    padding: 16px;
    box-shadow: var(--shadow);
}

.controller-top{
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.controller-screen{
    flex: 1;
    background: rgba(2,6,23,0.55);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 12px;
    min-height: 88px;
}

.controller-label{
    display: block;
    color: var(--muted);
    font-size: .8rem;
    margin-bottom: 10px;
}

.controller-screen strong{
    display: block;
    font-size: 1.5rem;
    color: #d8fff0;
}

.controller-leds{
    display: grid;
    gap: 8px;
    align-content: start;
}

.led{
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 12px currentColor;
}

.led.green{ background: var(--green-2); color: var(--green-2); }
.led.amber{ background: var(--amber); color: var(--amber); }
.led.red{ background: var(--red); color: var(--red); }

.controller-footer{
    margin-top: 10px;
    color: var(--muted);
    font-size: .85rem;
}

.battery-card{
    width: 100%;
    max-width: 260px;
    display: grid;
    justify-items: center;
    gap: 12px;
    background: var(--card);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 22px;
    padding: 18px;
}

.battery-icon{
    display: flex;
    align-items: center;
    justify-content: center;
}

.battery-icon.large{
    transform: scale(1.05);
}

.battery-icon.giant{
    transform: scale(1.25);
}

.battery-body{
    width: 96px;
    height: 54px;
    border: 4px solid rgba(255,255,255,0.9);
    border-radius: 10px;
    padding: 6px;
    background: rgba(255,255,255,0.05);
    box-shadow: inset 0 0 20px rgba(0,0,0,0.18);
}

.battery-cap{
    width: 10px;
    height: 24px;
    border-radius: 0 5px 5px 0;
    background: rgba(255,255,255,0.88);
    margin-left: 4px;
}

.battery-cells{
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    height: 100%;
}

.battery-cells span{
    display: block;
    background: rgba(255,255,255,0.12);
    border-radius: 4px;
    transition: background .35s ease, box-shadow .35s ease, opacity .35s ease;
    opacity: .35;
}

.battery-cells span.on{
    background: linear-gradient(180deg, #86efac, #22c55e);
    box-shadow: 0 0 10px rgba(34,197,94,0.45);
    opacity: 1;
}

.battery-text{
    display: grid;
    justify-items: center;
    gap: 4px;
}

.battery-text strong{
    font-size: 1.35rem;
    color: #d7fff0;
}

.battery-text span{
    color: var(--muted);
}

.right-panel{
    display: grid;
    align-content: start;
}

.overall-card{
    background: var(--panel);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 28px;
    padding: 24px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 20px;
}

.overall-card h3{
    margin: 0 0 22px;
    font-size: 1.3rem;
}

.battery-stack{
    display: grid;
    gap: 18px;
    justify-items: center;
}

.battery-panel{
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 22px;
    padding: 18px;
    display: grid;
    justify-items: center;
    gap: 14px;
}

.battery-panel.main{
    min-height: 170px;
}

.battery-panel.small{
    min-width: 140px;
    flex: 1;
}

.battery-panel-text{
    text-align: center;
}

.battery-panel-text strong{
    display: block;
    font-size: 1.5rem;
    color: #dbfff2;
}

.battery-panel-text span{
    color: var(--muted);
}

.distribution-lines{
    width: 100%;
    height: 90px;
    position: relative;
}

.distribution-lines .flow-line.vertical{
    position: absolute;
    width: 12px;
    height: 56px;
    left: calc(50% - 6px);
    top: 0;
}

.distribution-lines .flow-line.horizontal{
    position: absolute;
    width: 78%;
    height: 12px;
    left: 11%;
    top: 54px;
}

.station-battery-row{
    width: 100%;
    display: flex;
    gap: 16px;
}

.legend-box{
    margin-top: 20px;
    display: grid;
    gap: 10px;
}

.legend-item{
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: .92rem;
}

.legend-dot{
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-dot.active{
    background: var(--green-2);
    box-shadow: 0 0 10px rgba(34,197,94,0.45);
}

.legend-dot.idle{
    background: rgba(148,163,184,0.55);
}

.card-idle{
    opacity: .72;
    filter: grayscale(.08);
}

.line-idle{
    animation: none !important;
    opacity: .22 !important;
}

@keyframes flowMove{
    from{
        background-position: 0 0, 0 0;
    }
    to{
        background-position: 0 0, 180px 0;
    }
}

@media (max-width: 1400px){
    .dashboard-layout{
        grid-template-columns: 1fr;
    }

    .right-panel{
        order: -1;
    }

    .overall-card{
        position: relative;
        top: 0;
    }
}

@media (max-width: 980px){
    .summary-grid{
        grid-template-columns: 1fr;
    }

    .station-flow-layout{
        grid-template-columns: 1fr;
    }

    .connector-stage{
        min-height: 180px;
    }

    .bus-lines{
        min-height: 180px;
    }

    .flow-line.horizontal{
        width: 78%;
        left: 10%;
    }

    .flow-line.vertical{
        left: calc(50% - 6px);
        height: 138px;
        top: 20px;
    }

    #s1Line1, #s2Line1{ top: 10px; }
    #s1Line2, #s2Line2{ top: 70px; }
    #s1Line3, #s2Line3{ top: 130px; }

    .station-battery-row{
        flex-direction: column;
    }

    .topbar{
        flex-direction: column;
        align-items: flex-start;
    }

    .topbar-right{
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 640px){
    .page-shell{
        padding: 14px;
    }

    .topbar h1{
        font-size: 1.45rem;
    }

    .vent-card{
        grid-template-columns: 88px 1fr;
    }

    .vent-image-wrap{
        height: 74px;
    }
}