*{
    box-sizing:border-box;
}

:root{
    --bg:#eef3f8;
    --card:#ffffff;
    --text:#172033;
    --muted:#64748b;
    --line:#dbe3ee;
    --primary:#0f766e;
    --primary-dark:#115e59;
    --danger:#dc2626;
    --danger-dark:#991b1b;
    --warning:#f59e0b;
    --shadow:0 12px 30px rgba(15,23,42,.10);
}

body.dark{
    --bg:#0f172a;
    --card:#111827;
    --text:#e5e7eb;
    --muted:#94a3b8;
    --line:#334155;
    --primary:#14b8a6;
    --primary-dark:#0f766e;
    --shadow:0 12px 30px rgba(0,0,0,.35);
}

html,body{
    margin:0;
    padding:0;
    background:var(--bg);
    color:var(--text);
    font-family:Inter,Arial,sans-serif;
}

.container{
    max-width:1220px;
    margin:auto;
    padding:24px;
}

.navbar{
    background:linear-gradient(135deg,#0f172a,#134e4a);
    color:white;
    display:flex;
    justify-content:space-between;
    align-items:center;
    padding:16px 24px;
    gap:20px;
    flex-wrap:wrap;
    box-shadow:0 10px 25px rgba(0,0,0,.18);
}

.nav-left,
.nav-right{
    display:flex;
    align-items:center;
    gap:10px;
    flex-wrap:wrap;
}

.navbar a{
    color:white;
    text-decoration:none;
    font-weight:700;
    padding:9px 12px;
    border-radius:10px;
    transition:.18s ease;
}

.navbar a:hover{
    background:rgba(255,255,255,.14);
}

.brand{
    font-size:23px;
    letter-spacing:.3px;
}

.card{
    background:var(--card);
    border:1px solid var(--line);
    border-radius:20px;
    padding:22px;
    margin-bottom:20px;
    box-shadow:var(--shadow);
}

.btn,
.nav-btn,
button{
    background:linear-gradient(135deg,var(--primary),var(--primary-dark));
    color:white;
    border:none;
    border-radius:12px;
    padding:10px 15px;
    cursor:pointer;
    text-decoration:none;
    display:inline-block;
    font-weight:800;
    transition:.16s ease;
    box-shadow:0 6px 16px rgba(15,118,110,.25);
}

.btn:hover,
.nav-btn:hover,
button:hover{
    transform:translateY(-1px);
    filter:brightness(1.05);
}

.btn:active,
.nav-btn:active,
button:active{
    transform:scale(.97);
}

.btn-danger{
    background:linear-gradient(135deg,var(--danger),var(--danger-dark));
    box-shadow:0 6px 16px rgba(220,38,38,.25);
}

input,
select,
textarea{
    width:100%;
    padding:12px;
    border-radius:12px;
    border:1px solid var(--line);
    background:var(--bg);
    color:var(--text);
    margin-top:8px;
    margin-bottom:14px;
    outline:none;
}

input:focus,
select:focus,
textarea:focus{
    border-color:var(--primary);
    box-shadow:0 0 0 3px rgba(20,184,166,.16);
}

table{
    width:100%;
    border-collapse:separate;
    border-spacing:0;
    overflow:hidden;
    border-radius:16px;
    background:var(--card);
}

th,
td{
    padding:13px;
    border-bottom:1px solid var(--line);
    text-align:left;
}

th{
    background:rgba(15,118,110,.10);
    font-size:13px;
    text-transform:uppercase;
    letter-spacing:.04em;
}

tr:hover td{
    background:rgba(15,118,110,.05);
}

.grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(240px,1fr));
    gap:18px;
}

.metric{
    font-size:34px;
    font-weight:900;
    margin-top:10px;
}

.muted{
    color:var(--muted);
}

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

    .container{
        padding:14px;
    }

    table{
        font-size:13px;
    }
}

.status{
    display:inline-block;
    padding:7px 11px;
    border-radius:999px;
    font-size:12px;
    font-weight:900;
}

.status-pending{
    background:#fef3c7;
    color:#92400e;
}

.status-approved{
    background:#dcfce7;
    color:#166534;
}

.status-rejected{
    background:#fee2e2;
    color:#991b1b;
}

.router-form{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(180px,1fr));
    gap:12px;
    align-items:end;
}

.router-list{
    display:flex;
    flex-direction:column;
    gap:14px;
}

.router-box{
    border:1px solid var(--line);
    border-radius:18px;
    background:var(--card);
    overflow:hidden;
}

.router-box summary{
    cursor:pointer;
    padding:16px;
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:14px;
    list-style:none;
    background:rgba(15,118,110,.06);
}

.router-box summary::-webkit-details-marker{
    display:none;
}

.router-detail{
    padding:18px;
    border-top:1px solid var(--line);
}

.mini-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(180px,1fr));
    gap:12px;
    margin-bottom:16px;
}

.inline-form{
    display:flex;
    gap:12px;
    flex-wrap:wrap;
    align-items:center;
    margin-bottom:16px;
}

.check-row{
    display:flex;
    align-items:center;
    gap:8px;
    background:rgba(15,118,110,.06);
    padding:10px 12px;
    border-radius:12px;
}

.check-row input{
    width:auto;
    margin:0;
}

.router-actions{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(160px,1fr));
    gap:12px;
}

.router-actions form{
    margin:0;
}

.router-actions button,
.router-actions a{
    width:100%;
    text-align:center;
}

.ping-result{
    margin-top:14px;
    padding:12px 14px;
    border-radius:12px;
    font-weight:800;
}

.ping-ok{
    background:#dcfce7;
    color:#166534;
}

.ping-bad{
    background:#fee2e2;
    color:#991b1b;
}

.nav-top{
    width:100%;
    display:flex;
    justify-content:space-between;
    align-items:center;
}

.mobile-toggle{
    display:none;
    font-size:24px;
    padding:8px 14px;
}

@media(max-width:768px){

    .navbar{
        align-items:stretch;
    }

    .mobile-toggle{
        display:block;
    }

    .nav-right{
        display:none;
        width:100%;
        flex-direction:column;
        gap:8px;
        margin-top:14px;
    }

    .nav-right.show-mobile-nav{
        display:flex;
    }

    .nav-right a,
    .nav-right button{
        width:100%;
        text-align:center;
    }

    .brand{
        font-size:20px;
    }

    .router-actions{
        grid-template-columns:1fr;
    }

    .router-form{
        grid-template-columns:1fr;
    }

    .grid{
        grid-template-columns:1fr;
    }

    table{
        display:block;
        overflow-x:auto;
        white-space:nowrap;
    }

}

.router-detections{
    margin-top:18px;
    margin-bottom:18px;
}

.router-blocks{
    margin-top:18px;
    margin-bottom:18px;
}

.brand-sub{
    font-size:13px;
    font-weight:800;
    opacity:1;
    margin-left:6px;
    color:#ffffff;
    text-shadow:0 1px 2px rgba(0,0,0,.35);
}

@media(max-width:768px){
    .brand-sub{
        display:block;
        margin-left:0;
        margin-top:2px;
        font-size:11px;
    }
}

body.theme-teal{
    --bg:#eef3f8;
    --card:#ffffff;
    --text:#172033;
    --muted:#64748b;
    --line:#dbe3ee;
    --primary:#0f766e;
    --primary-dark:#115e59;
}

body.theme-blue{
    --bg:#eff6ff;
    --card:#ffffff;
    --text:#172033;
    --muted:#64748b;
    --line:#bfdbfe;
    --primary:#2563eb;
    --primary-dark:#1e40af;
}

body.theme-purple{
    --bg:#f5f3ff;
    --card:#ffffff;
    --text:#1e1b4b;
    --muted:#6b7280;
    --line:#ddd6fe;
    --primary:#7c3aed;
    --primary-dark:#5b21b6;
}

body.theme-gold{
    --bg:#fffbeb;
    --card:#ffffff;
    --text:#1f2937;
    --muted:#78716c;
    --line:#fde68a;
    --primary:#d97706;
    --primary-dark:#92400e;
}

body.theme-dark{
    --bg:#0f172a;
    --card:#111827;
    --text:#e5e7eb;
    --muted:#94a3b8;
    --line:#334155;
    --primary:#14b8a6;
    --primary-dark:#0f766e;
}

body.theme-blue .navbar{
    background:linear-gradient(135deg,#0f172a,#1d4ed8);
}

body.theme-purple .navbar{
    background:linear-gradient(135deg,#1e1b4b,#7c3aed);
}

body.theme-gold .navbar{
    background:linear-gradient(135deg,#451a03,#d97706);
}

body.theme-dark .navbar{
    background:linear-gradient(135deg,#020617,#0f766e);
}

body.theme-teal .navbar{
    background:linear-gradient(135deg,#0f172a,#134e4a);
}

.theme-select{
    background:white;
    color:#111827;
    border:none;
    border-radius:12px;
    padding:9px 12px;
    font-weight:800;
    cursor:pointer;
}
