:root{
    --bg:#050914;
    --panel:#0b1220;
    --panel2:#111a2b;
    --card:#121d2f;
    --card2:#17243a;
    --border:#263852;
    --text:#edf6ff;
    --muted:#9eb2cc;
    --cyan:#32e6ff;
    --blue:#516bff;
    --green:#35ff9a;
    --red:#ff4d6d;
    --yellow:#ffd45c;
    --shadow:0 20px 70px rgba(0,0,0,.35);
}

*{
    box-sizing:border-box;
}

body{
    margin:0;
    background:
        radial-gradient(circle at 15% 10%, rgba(50,230,255,.10), transparent 25%),
        radial-gradient(circle at 85% 20%, rgba(81,107,255,.12), transparent 30%),
        var(--bg);
    color:var(--text);
    font-family:Inter,Segoe UI,Arial,sans-serif;
}

a{
    text-decoration:none;
    color:inherit;
}

.app-shell{
    display:flex;
    min-height:100vh;
}

.sidebar{
    width:280px;
    background:linear-gradient(180deg,#08111f,#050914);
    border-right:1px solid var(--border);
    padding:24px 18px;
    position:fixed;
    left:0;
    top:0;
    bottom:0;
    z-index:50;
}

.side-brand{
    display:flex;
    align-items:center;
    gap:14px;
    margin-bottom:30px;
}

.brand-icon{
    width:48px;
    height:48px;
    border-radius:16px;
    display:grid;
    place-items:center;
    font-size:24px;
    background:linear-gradient(135deg,var(--cyan),var(--blue));
    color:#00111e;
}

.side-brand strong{
    display:block;
    font-size:21px;
    font-weight:900;
}

.side-brand span{
    color:var(--muted);
    font-weight:700;
}

.side-nav{
    display:flex;
    flex-direction:column;
    gap:8px;
}

.side-nav a{
    padding:14px 16px;
    border-radius:16px;
    color:#c9d8eb;
    font-weight:800;
    display:flex;
    align-items:center;
    gap:12px;
}

.side-nav a:hover,
.side-nav a.active{
    background:linear-gradient(135deg,rgba(50,230,255,.16),rgba(81,107,255,.16));
    color:#fff;
    border:1px solid rgba(50,230,255,.25);
}

.side-footer{
    position:absolute;
    left:18px;
    right:18px;
    bottom:22px;
    padding:14px;
    background:rgba(255,255,255,.04);
    border:1px solid var(--border);
    border-radius:16px;
    display:flex;
    align-items:center;
    gap:10px;
    color:var(--muted);
    font-weight:800;
}

.status-dot{
    width:11px;
    height:11px;
    border-radius:50%;
    background:var(--green);
    box-shadow:0 0 16px var(--green);
}

.main-content{
    margin-left:280px;
    width:calc(100% - 280px);
    min-height:100vh;
}

.topbar{
    height:78px;
    border-bottom:1px solid var(--border);
    background:rgba(8,17,31,.75);
    backdrop-filter:blur(18px);
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:0 34px;
    position:sticky;
    top:0;
    z-index:30;
}

.topbar h3{
    margin:0;
    font-size:20px;
}

.topbar p{
    margin:4px 0 0;
    color:var(--muted);
    font-size:13px;
    font-weight:700;
}

.menu-btn{
    display:none;
    background:var(--card);
    color:#fff;
    border:1px solid var(--border);
    border-radius:12px;
    padding:10px 13px;
    cursor:pointer;
}

.top-link{
    padding:11px 16px;
    background:linear-gradient(135deg,var(--cyan),var(--blue));
    color:#00111e;
    border-radius:13px;
    font-weight:900;
}

.container{
    width:92%;
    max-width:1320px;
    margin:34px auto;
}

h1{
    font-size:38px;
    margin:0 0 10px;
}

h2{
    margin-top:0;
}

.muted{
    color:var(--muted);
}

.card{
    background:linear-gradient(180deg,var(--card2),var(--card));
    border:1px solid var(--border);
    border-radius:24px;
    padding:26px;
    box-shadow:var(--shadow);
}

.grid{
    display:grid;
    grid-template-columns:repeat(4,1fr);
    gap:22px;
    width:92%;
    max-width:1320px;
    margin:26px auto;
}

.grid2,
.grid-2{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:22px;
    width:92%;
    max-width:1320px;
    margin:26px auto;
}

.stat{
    font-size:46px;
    font-weight:950;
    background:linear-gradient(135deg,#fff,var(--cyan));
    -webkit-background-clip:text;
    -webkit-text-fill-color:transparent;
}

.input,
select,
textarea{
    width:100%;
    padding:15px 17px;
    margin:10px 0;
    border-radius:15px;
    border:1px solid #2b4263;
    background:#08172a;
    color:#fff;
    outline:none;
    font-weight:700;
}

.input:focus,
select:focus,
textarea:focus{
    border-color:var(--cyan);
    box-shadow:0 0 0 3px rgba(50,230,255,.12);
}

.btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    padding:13px 20px;
    border:0;
    border-radius:14px;
    background:linear-gradient(135deg,var(--cyan),var(--blue));
    color:#00111e;
    font-weight:950;
    cursor:pointer;
    margin:4px 6px 4px 0;
}

.btn2{
    background:#0d1a2c;
    color:#eaf6ff;
    border:1px solid var(--border);
}

.table{
    width:100%;
    border-collapse:collapse;
}

.table th,
.table td{
    padding:15px 14px;
    border-bottom:1px solid var(--border);
    text-align:left;
}

.pill{
    display:inline-flex;
    padding:8px 13px;
    border-radius:999px;
    background:#0a2038;
    color:#8feeff;
    border:1px solid #275173;
    font-weight:850;
}

.online{
    color:var(--green);
}

.offline{
    color:var(--red);
}

.footer{
    width:92%;
    margin:50px auto 25px;
    color:var(--muted);
    font-weight:700;
    display:flex;
    justify-content:space-between;
    gap:20px;
    flex-wrap:wrap;
}

.footer a{
    margin-left:16px;
    color:#8feeff;
}

/* Dashboard Builder */

.dashboard-shell{
    width:94%;
    margin:30px auto;
}

.dash-head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    margin-bottom:22px;
}

.canvas{
    min-height:650px;
    background:linear-gradient(180deg,#02070d,#050914);
    border:1px solid #19273b;
    border-radius:26px;
    padding:22px;
    display:grid;
    grid-template-columns:repeat(auto-fill,minmax(280px,1fr));
    gap:20px;
    box-shadow:var(--shadow);
}

.widget{
    background:#000;
    border:1px solid #2d3340;
    border-radius:12px;
    min-height:165px;
    position:relative;
    padding:16px;
    overflow:hidden;
}

.widget-title{
    color:#fff;
    font-weight:900;
    margin-bottom:14px;
}

.toggle-large{
    height:112px;
    border-radius:70px;
    background:#ba171b;
    position:relative;
    display:flex;
    align-items:center;
    justify-content:flex-end;
    padding-right:32px;
    font-size:34px;
    font-weight:950;
    color:#000;
    cursor:pointer;
}

.toggle-large.on{
    background:#21d65c;
    justify-content:flex-start;
    padding-left:32px;
    padding-right:0;
}

.toggle-knob{
    position:absolute;
    left:12px;
    width:90px;
    height:90px;
    background:#000;
    border-radius:50%;
    border:6px solid #ff2931;
}

.toggle-large.on .toggle-knob{
    left:auto;
    right:12px;
    border-color:#08a644;
}

.gauge-wrap{
    display:flex;
    align-items:center;
    justify-content:center;
    height:130px;
}

.gauge{
    width:132px;
    height:132px;
    border-radius:50%;
    background:conic-gradient(var(--cyan) 0deg,var(--cyan) 220deg,#252525 220deg);
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:28px;
    font-weight:950;
    color:#fff;
}

.slider{
    width:100%;
}

.modal{
    position:fixed;
    inset:0;
    background:rgba(0,0,0,.72);
    display:none;
    align-items:center;
    justify-content:center;
    z-index:100;
}

.modal.show{
    display:flex;
}

.modal-box{
    width:min(950px,94vw);
    max-height:86vh;
    overflow:auto;
    background:#fff;
    color:#111;
    border-radius:18px;
    padding:26px;
}

.block-grid{
    display:grid;
    grid-template-columns:repeat(4,1fr);
    gap:18px;
}

.block-choice{
    height:155px;
    background:#000;
    color:#fff;
    display:flex;
    align-items:center;
    justify-content:center;
    border:8px solid #fff;
    cursor:pointer;
    font-weight:950;
    text-align:center;
}

.block-choice:hover{
    outline:4px solid var(--cyan);
}

.close{
    float:right;
    font-size:30px;
    cursor:pointer;
}

@media(max-width:980px){
    .sidebar{
        transform:translateX(-100%);
        transition:.25s;
    }

    .sidebar.open{
        transform:translateX(0);
    }

    .main-content{
        margin-left:0;
        width:100%;
    }

    .menu-btn{
        display:block;
    }

    .grid,
    .grid2,
    .grid-2{
        grid-template-columns:1fr;
    }

    .topbar{
        padding:0 16px;
    }

    .block-grid{
        grid-template-columns:1fr 1fr;
    }
}
.page-title{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:20px;
    margin-bottom:26px;
}

.api-card{
    margin-top:22px;
    padding:20px 22px;
    border-radius:22px;
    background:linear-gradient(135deg,rgba(50,230,255,.12),rgba(81,107,255,.10));
    border:1px solid rgba(50,230,255,.25);
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:20px;
}

.api-card strong{
    display:block;
    margin-top:6px;
    font-size:15px;
    word-break:break-all;
    color:#8feeff;
}

.alert-box{
    margin-top:18px;
    padding:15px 18px;
    border-radius:16px;
    background:rgba(53,255,154,.10);
    border:1px solid rgba(53,255,154,.35);
    color:var(--green);
    font-weight:850;
}

.stat-card{
    display:flex;
    align-items:center;
    gap:18px;
}

.stat-icon{
    width:58px;
    height:58px;
    border-radius:18px;
    display:grid;
    place-items:center;
    font-size:26px;
    background:rgba(255,255,255,.06);
    border:1px solid var(--border);
}

.section-head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:16px;
    margin-bottom:16px;
}

.mini-row{
    padding:15px 0;
    border-bottom:1px solid var(--border);
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:18px;
}

.mini-row:last-child{
    border-bottom:0;
}

.mini-row strong{
    display:block;
    font-size:16px;
}

.mini-row span{
    display:block;
    margin-top:4px;
    color:var(--muted);
    font-size:13px;
}

.feed-list{
    display:flex;
    flex-wrap:wrap;
    gap:12px;
    margin:15px 0;
}

.feed-chip{
    min-width:130px;
    padding:14px 16px;
    border-radius:16px;
    background:#08172a;
    border:1px solid #263f61;
}

.feed-chip span{
    display:block;
    color:var(--muted);
    font-size:13px;
    margin-bottom:7px;
}

.feed-chip strong{
    font-size:20px;
}

.code-box{
    padding:15px;
    border-radius:16px;
    background:#02070d;
    border:1px solid #263f61;
    color:#8feeff;
    font-family:Consolas,monospace;
    font-size:14px;
    word-break:break-all;
    margin:12px 0;
}

.device-grid,
.feeds-grid{
    width:92%;
    max-width:1320px;
    margin:26px auto;
    display:grid;
    grid-template-columns:repeat(auto-fill,minmax(310px,1fr));
    gap:22px;
}

.device-card,
.feed-card{
    background:linear-gradient(180deg,var(--card2),var(--card));
    border:1px solid var(--border);
    border-radius:24px;
    padding:24px;
    box-shadow:var(--shadow);
}

.device-top,
.feed-card-top{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:16px;
}

.device-top{
    justify-content:flex-start;
}

.device-icon{
    width:58px;
    height:58px;
    border-radius:18px;
    display:grid;
    place-items:center;
    background:linear-gradient(135deg,rgba(50,230,255,.18),rgba(81,107,255,.18));
    border:1px solid rgba(50,230,255,.25);
    font-size:26px;
}

.device-card h3,
.feed-card h3{
    margin:0;
    font-size:21px;
}

.device-card p,
.feed-card p{
    margin:6px 0 0;
    color:var(--muted);
}

.device-status{
    margin:22px 0;
    display:flex;
    justify-content:space-between;
    align-items:center;
}

.device-meta,
.feed-info{
    margin-top:14px;
    padding:14px;
    border-radius:16px;
    background:rgba(255,255,255,.035);
    border:1px solid rgba(255,255,255,.06);
}

.device-meta{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:12px;
}

.device-meta span,
.feed-info span{
    display:block;
    color:var(--muted);
    font-size:12px;
    margin-bottom:5px;
}

.device-meta strong,
.feed-info strong{
    font-size:14px;
    word-break:break-word;
}

.device-actions{
    margin-top:20px;
    display:flex;
    flex-wrap:wrap;
    gap:10px;
}

.feed-value{
    margin:24px 0;
    font-size:48px;
    font-weight:950;
    background:linear-gradient(135deg,#fff,var(--cyan));
    -webkit-background-clip:text;
    -webkit-text-fill-color:transparent;
}

.empty-card{
    grid-column:1 / -1;
}

.widget-delete{
    position:absolute;
    right:10px;
    top:10px;
    width:30px;
    height:30px;
    border-radius:50%;
    background:#111;
    color:#fff;
    border:1px solid #333;
    cursor:pointer;
    z-index:2;
}

.widget-feed{
    display:inline-flex;
    padding:5px 9px;
    border-radius:999px;
    background:#101820;
    border:1px solid #303b4c;
    color:#8feeff;
    font-size:12px;
    margin-bottom:14px;
}

.big-action-btn{
    width:100%;
    height:100px;
    border:0;
    border-radius:18px;
    background:linear-gradient(135deg,var(--cyan),var(--blue));
    color:#00111e;
    font-size:32px;
    font-weight:950;
    cursor:pointer;
}

.slider-value{
    margin-top:18px;
    text-align:center;
    font-size:36px;
    font-weight:950;
    color:#fff;
}

.text-widget-value{
    min-height:90px;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:32px;
    font-weight:950;
    color:#8feeff;
    text-align:center;
}

@media(max-width:700px){
    .page-title,
    .api-card,
    .dash-head,
    .mini-row{
        flex-direction:column;
        align-items:flex-start;
    }

    .device-meta{
        grid-template-columns:1fr;
    }

    .feed-value{
        font-size:38px;
    }
}
.page-title{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:20px;
    margin-bottom:26px;
}

.api-card{
    margin-top:22px;
    padding:20px 22px;
    border-radius:22px;
    background:linear-gradient(135deg,rgba(50,230,255,.12),rgba(81,107,255,.10));
    border:1px solid rgba(50,230,255,.25);
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:20px;
}

.api-card strong{
    display:block;
    margin-top:6px;
    font-size:15px;
    word-break:break-all;
    color:#8feeff;
}

.alert-box{
    margin-top:18px;
    padding:15px 18px;
    border-radius:16px;
    background:rgba(53,255,154,.10);
    border:1px solid rgba(53,255,154,.35);
    color:var(--green);
    font-weight:850;
}

.stat-card{
    display:flex;
    align-items:center;
    gap:18px;
}

.stat-icon{
    width:58px;
    height:58px;
    border-radius:18px;
    display:grid;
    place-items:center;
    font-size:26px;
    background:rgba(255,255,255,.06);
    border:1px solid var(--border);
}

.section-head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:16px;
    margin-bottom:16px;
}

.mini-row{
    padding:15px 0;
    border-bottom:1px solid var(--border);
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:18px;
}

.mini-row:last-child{
    border-bottom:0;
}

.mini-row strong{
    display:block;
    font-size:16px;
}

.mini-row span{
    display:block;
    margin-top:4px;
    color:var(--muted);
    font-size:13px;
}

.feed-list{
    display:flex;
    flex-wrap:wrap;
    gap:12px;
    margin:15px 0;
}

.feed-chip{
    min-width:130px;
    padding:14px 16px;
    border-radius:16px;
    background:#08172a;
    border:1px solid #263f61;
}

.feed-chip span{
    display:block;
    color:var(--muted);
    font-size:13px;
    margin-bottom:7px;
}

.feed-chip strong{
    font-size:20px;
}

.code-box{
    padding:15px;
    border-radius:16px;
    background:#02070d;
    border:1px solid #263f61;
    color:#8feeff;
    font-family:Consolas,monospace;
    font-size:14px;
    word-break:break-all;
    margin:12px 0;
}

.device-grid,
.feeds-grid{
    width:92%;
    max-width:1320px;
    margin:26px auto;
    display:grid;
    grid-template-columns:repeat(auto-fill,minmax(310px,1fr));
    gap:22px;
}

.device-card,
.feed-card{
    background:linear-gradient(180deg,var(--card2),var(--card));
    border:1px solid var(--border);
    border-radius:24px;
    padding:24px;
    box-shadow:var(--shadow);
}

.device-top,
.feed-card-top{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:16px;
}

.device-top{
    justify-content:flex-start;
}

.device-icon{
    width:58px;
    height:58px;
    border-radius:18px;
    display:grid;
    place-items:center;
    background:linear-gradient(135deg,rgba(50,230,255,.18),rgba(81,107,255,.18));
    border:1px solid rgba(50,230,255,.25);
    font-size:26px;
}

.device-card h3,
.feed-card h3{
    margin:0;
    font-size:21px;
}

.device-card p,
.feed-card p{
    margin:6px 0 0;
    color:var(--muted);
}

.device-status{
    margin:22px 0;
    display:flex;
    justify-content:space-between;
    align-items:center;
}

.device-meta,
.feed-info{
    margin-top:14px;
    padding:14px;
    border-radius:16px;
    background:rgba(255,255,255,.035);
    border:1px solid rgba(255,255,255,.06);
}

.device-meta{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:12px;
}

.device-meta span,
.feed-info span{
    display:block;
    color:var(--muted);
    font-size:12px;
    margin-bottom:5px;
}

.device-meta strong,
.feed-info strong{
    font-size:14px;
    word-break:break-word;
}

.device-actions{
    margin-top:20px;
    display:flex;
    flex-wrap:wrap;
    gap:10px;
}

.feed-value{
    margin:24px 0;
    font-size:48px;
    font-weight:950;
    background:linear-gradient(135deg,#fff,var(--cyan));
    -webkit-background-clip:text;
    -webkit-text-fill-color:transparent;
}

.empty-card{
    grid-column:1 / -1;
}

.widget-delete{
    position:absolute;
    right:10px;
    top:10px;
    width:30px;
    height:30px;
    border-radius:50%;
    background:#111;
    color:#fff;
    border:1px solid #333;
    cursor:pointer;
    z-index:2;
}

.widget-feed{
    display:inline-flex;
    padding:5px 9px;
    border-radius:999px;
    background:#101820;
    border:1px solid #303b4c;
    color:#8feeff;
    font-size:12px;
    margin-bottom:14px;
}

.big-action-btn{
    width:100%;
    height:100px;
    border:0;
    border-radius:18px;
    background:linear-gradient(135deg,var(--cyan),var(--blue));
    color:#00111e;
    font-size:32px;
    font-weight:950;
    cursor:pointer;
}

.slider-value{
    margin-top:18px;
    text-align:center;
    font-size:36px;
    font-weight:950;
    color:#fff;
}

.text-widget-value{
    min-height:90px;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:32px;
    font-weight:950;
    color:#8feeff;
    text-align:center;
}

@media(max-width:700px){
    .page-title,
    .api-card,
    .dash-head,
    .mini-row{
        flex-direction:column;
        align-items:flex-start;
    }

    .device-meta{
        grid-template-columns:1fr;
    }

    .feed-value{
        font-size:38px;
    }
}