:root{
    --bg:#0b1722;
    --sidebar:rgba(12,28,40,.72);
    --ink:#f4f8fb;
    --ink-dark:#1e2b34;
    --muted:rgba(237,243,247,.74);
    --muted-dark:#6c7a84;
    --line:rgba(255,255,255,.16);
    --white:#fff;
    --blue:#ddecf8;
    --blue-dark:#194258;
    --green:#2c755a;
    --red:#a44949;
    --shadow:0 18px 50px rgba(4,16,25,.24);
    --panel-bg:rgba(255,255,255,.18);
    --panel-border:rgba(255,255,255,.15);
}
*{box-sizing:border-box}
body{
    margin:0;
    font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif;
    background:var(--bg);
    color:var(--ink);
    position:relative;
    min-height:100vh;
}
a{color:inherit}
body::before{
    content:"";
    position:fixed;
    inset:0;
    background:
        linear-gradient(180deg,rgba(6,16,25,.54) 0%,rgba(8,19,29,.64) 100%),
        url('../images/portal-background.png') center center / cover no-repeat;
    z-index:-3;
    transform:scale(1.02);
}
body::after{
    content:"";
    position:fixed;
    inset:0;
    background:
        radial-gradient(circle at 15% 12%, rgba(255,255,255,.18), transparent 24%),
        radial-gradient(circle at 85% 18%, rgba(145,184,211,.14), transparent 22%);
    z-index:-2;
    pointer-events:none;
}

.admin-shell{min-height:100vh;display:grid;grid-template-columns:255px 1fr}
.sidebar{
    position:sticky;
    top:0;
    height:100vh;
    background:linear-gradient(180deg,rgba(10,24,35,.82),rgba(14,31,44,.78));
    color:#fff;
    padding:25px 18px;
    display:flex;
    flex-direction:column;
    backdrop-filter:blur(16px);
    border-right:1px solid rgba(255,255,255,.08);
}
.brand,.auth-brand{display:flex;align-items:center;gap:12px}
.brand{padding:0 8px 26px}
.brand-mark{
    width:42px;
    height:42px;
    background:rgba(255,255,255,.16);
    color:#fff;
    border-radius:12px;
    display:grid;
    place-items:center;
    font-weight:900;
    font-size:13px;
    border:1px solid rgba(255,255,255,.12);
    backdrop-filter:blur(10px);
}
.brand div,.auth-brand div{display:flex;flex-direction:column}
.brand strong{font-size:14px}
.brand small{font-size:10px;color:rgba(209,220,228,.72);text-transform:uppercase;letter-spacing:.13em;margin-top:3px}
.sidebar nav{display:flex;flex-direction:column;gap:5px}
.sidebar nav a,.sidebar-footer a{
    color:#dce5ea;
    text-decoration:none;
    font-size:13px;
    padding:11px 13px;
    border-radius:9px;
}
.sidebar nav a:hover,.sidebar nav a.active{background:rgba(255,255,255,.09);color:#fff}
.sidebar-footer{margin-top:auto;display:flex;flex-direction:column;border-top:1px solid rgba(255,255,255,.1);padding-top:13px}
.admin-main{min-width:0}
.topbar{
    height:90px;
    background:rgba(255,255,255,.12);
    backdrop-filter:blur(14px);
    border-bottom:1px solid rgba(255,255,255,.12);
    display:flex;
    align-items:center;
    padding:0 34px;
    position:sticky;
    top:0;
    z-index:20;
}
.topbar h1{font-size:20px;margin:0 0 5px}
.topbar p{font-size:12px;color:rgba(239,243,247,.72);margin:0}
.admin-user{margin-left:auto;text-align:right;display:flex;flex-direction:column}
.admin-user span{font-size:12px;font-weight:700}
.admin-user small{font-size:10px;color:rgba(239,243,247,.7);margin-top:3px}
.menu-toggle{display:none;border:0;background:transparent;font-size:22px;margin-right:12px;color:#fff}
.admin-content{padding:30px 34px 60px;max-width:1500px}
.stat-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:18px;margin-bottom:18px}
.stat-card,.panel{
    background:var(--panel-bg);
    border:1px solid var(--panel-border);
    border-radius:16px;
    box-shadow:var(--shadow);
    backdrop-filter:blur(16px);
}
.stat-card{padding:23px}
.stat-card span{display:block;font-size:11px;color:rgba(236,242,246,.7);text-transform:uppercase;letter-spacing:.08em;font-weight:700}
.stat-card strong{display:block;font-size:40px;letter-spacing:-.04em;margin:10px 0 2px}
.stat-card small{font-size:11px;color:rgba(236,242,246,.72)}
.dashboard-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px}
.panel{padding:22px}
.panel-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:18px}
.panel-head h2{font-size:15px;margin:0 0 5px}
.panel-head p{font-size:11px;color:rgba(236,242,246,.72);margin:0}
.quick-actions{display:grid;gap:9px}
.quick-actions a{
    display:flex;
    align-items:center;
    gap:13px;
    padding:12px;
    border:1px solid rgba(255,255,255,.12);
    border-radius:11px;
    text-decoration:none;
    background:rgba(255,255,255,.06);
}
.quick-actions a:hover{border-color:rgba(255,255,255,.26);background:rgba(255,255,255,.09)}
.quick-actions b{width:37px;height:37px;border-radius:9px;background:rgba(255,255,255,.14);display:grid;place-items:center;color:#fff}
.quick-actions span{display:flex;flex-direction:column}
.quick-actions strong{font-size:12px}
.quick-actions small{font-size:10px;color:rgba(236,242,246,.72);margin-top:3px}
.compact-list{display:flex;flex-direction:column}
.compact-list a{display:grid;grid-template-columns:36px 1fr auto;align-items:center;gap:11px;padding:11px 0;text-decoration:none;border-bottom:1px solid rgba(255,255,255,.08)}
.compact-list a:last-child{border:0}
.mini-icon{width:34px;height:34px;border-radius:8px;background:rgba(255,255,255,.12);display:grid;place-items:center}
.compact-list a>span:nth-child(2){display:flex;flex-direction:column}
.compact-list strong{font-size:11px}
.compact-list small{font-size:9px;color:rgba(236,242,246,.72);margin-top:3px}
.compact-list em{font-style:normal;font-size:9px;color:rgba(236,242,246,.68)}
.toolbar{display:flex;justify-content:space-between;align-items:center;margin-bottom:15px}
.toolbar>div{display:flex;flex-direction:column}
.toolbar strong{font-size:13px}
.toolbar span{font-size:10px;color:rgba(236,242,246,.74);margin-top:4px}
.btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-height:40px;
    padding:0 15px;
    border-radius:9px;
    border:1px solid transparent;
    text-decoration:none;
    font-size:11px;
    font-weight:750;
    cursor:pointer;
}
.btn.primary{background:rgba(255,255,255,.18);color:#fff;border-color:rgba(255,255,255,.16)}
.btn.primary:hover{background:rgba(255,255,255,.24)}
.btn.secondary{background:rgba(255,255,255,.08);border-color:rgba(255,255,255,.14);color:#fff}
.btn.full{width:100%;margin-bottom:9px}
.tile-manager{padding:9px}
.sortable-list{display:flex;flex-direction:column;gap:7px}
.admin-tile{
    display:grid;
    grid-template-columns:28px 46px minmax(0,1fr) auto auto;
    align-items:center;
    gap:14px;
    padding:13px 12px;
    background:rgba(255,255,255,.08);
    border:1px solid rgba(255,255,255,.12);
    border-radius:11px;
    transition:.18s;
}
.admin-tile:hover{border-color:rgba(255,255,255,.24)}
.admin-tile.dragging{opacity:.42;transform:scale(.995)}
.drag-handle{cursor:grab;border:0;background:transparent;color:#dce6ec;font-size:18px}
.admin-tile-icon{width:44px;height:44px;background:rgba(255,255,255,.12);border-radius:10px;display:grid;place-items:center}
.admin-tile-main{min-width:0}
.tile-title-row{display:flex;align-items:center;gap:8px}
.tile-title-row h3{font-size:12px;margin:0}
.admin-tile-main p{font-size:10px;color:rgba(236,242,246,.76);margin:4px 0 5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.admin-tile-main small{font-size:9px;color:rgba(236,242,246,.58);display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.small-badge{font-size:8px;border-radius:99px;background:rgba(255,255,255,.14);padding:4px 6px;text-transform:uppercase;font-weight:800;letter-spacing:.05em}
.state-pill{font-size:9px;font-weight:700;padding:6px 8px;border-radius:99px;background:rgba(255,255,255,.12);color:#edf3f6;display:flex;gap:6px;align-items:center}
.state-pill span{width:6px;height:6px;border-radius:50%;background:#d8e4ec}
.state-pill.on{color:#dff0e8;background:rgba(44,117,90,.22)}
.state-pill.on span{background:var(--green)}
.row-actions{display:flex;gap:4px}
.row-actions form{margin:0}
.icon-btn{
    width:31px;
    height:31px;
    border:1px solid rgba(255,255,255,.14);
    background:rgba(255,255,255,.08);
    border-radius:8px;
    display:grid;
    place-items:center;
    text-decoration:none;
    color:#fff;
    cursor:pointer;
}
.icon-btn:hover{background:rgba(255,255,255,.14)}
.icon-btn.danger{color:#ffd1d1}
.save-toast{position:fixed;right:25px;bottom:25px;background:#17344d;color:#fff;padding:10px 15px;border-radius:9px;font-size:10px;opacity:0;transform:translateY(10px);pointer-events:none;transition:.2s}
.save-toast.show{opacity:1;transform:none}
.empty-admin{text-align:center;padding:40px}
.empty-admin strong{font-size:13px}
.empty-admin p{font-size:11px;color:rgba(236,242,246,.72)}
.editor-layout{display:grid;grid-template-columns:minmax(0,1fr) 265px;gap:18px;align-items:start}
.editor-main{display:flex;flex-direction:column;gap:18px}
.form-panel{padding:24px}
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}
.form-grid.single{grid-template-columns:1fr}
.form-grid label{font-size:10px;font-weight:750;color:#f4f8fb;display:flex;flex-direction:column;gap:7px}
.form-grid label small{font-weight:400;color:rgba(236,242,246,.64)}
.form-grid .span-2{grid-column:span 2}
.form-grid input,.form-grid textarea,.form-grid select{
    width:100%;
    border:1px solid rgba(255,255,255,.16);
    background:rgba(255,255,255,.1);
    border-radius:9px;
    padding:11px 12px;
    font:inherit;
    font-size:11px;
    color:#fff;
    outline:none;
}
.form-grid textarea{resize:vertical;line-height:1.6}
.form-grid input::placeholder,.form-grid textarea::placeholder{color:rgba(236,242,246,.52)}
.form-grid input:focus,.form-grid textarea:focus,.form-grid select:focus{border-color:rgba(220,236,248,.52);box-shadow:0 0 0 3px rgba(220,236,248,.11)}
.switch-row{flex-direction:row!important;align-items:center!important;gap:10px!important;background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.12);padding:11px;border-radius:10px}
.switch-row>input{display:none}.switch{width:37px;height:21px;background:#bcc6cc;border-radius:99px;position:relative;flex:0 0 auto}.switch:after{content:"";position:absolute;width:15px;height:15px;border-radius:50%;background:#fff;left:3px;top:3px;transition:.18s}.switch-row>input:checked+.switch{background:var(--green)}.switch-row>input:checked+.switch:after{transform:translateX(16px)}.switch-row>span:last-child{display:flex;flex-direction:column}.switch-row strong{font-size:10px}.switch-row small{font-size:9px!important;margin-top:2px}
.sticky-card{position:sticky;top:112px}.sticky-card h3{font-size:13px;margin:0 0 15px}.sticky-card hr{border:0;border-top:1px solid rgba(255,255,255,.12);margin:10px 0 14px}.hint{font-size:10px!important;color:rgba(236,242,246,.72);line-height:1.55}.flash{padding:12px 14px;border-radius:9px;margin-bottom:15px;font-size:11px;border:1px solid}.flash.success{background:rgba(44,117,90,.18);border-color:rgba(126,197,170,.28);color:#e9fff5}.flash.error{background:rgba(164,73,73,.18);border-color:rgba(227,170,170,.25);color:#ffeaea}
.auth-page{
    min-height:100vh;
    display:grid;
    place-items:center;
    padding:25px;
}
.auth-card{
    width:min(420px,100%);
    background:rgba(255,255,255,.18);
    border:1px solid rgba(255,255,255,.14);
    box-shadow:0 24px 75px rgba(26,43,54,.16);
    border-radius:19px;
    padding:31px;
    backdrop-filter:blur(20px);
}
.install-card{width:min(520px,100%)}
.auth-brand{margin-bottom:32px}
.auth-brand .brand-mark{background:rgba(255,255,255,.15);color:#fff}
.auth-brand strong{font-size:13px}
.auth-brand small{font-size:9px;color:rgba(236,242,246,.7);text-transform:uppercase;letter-spacing:.12em;margin-top:3px}
.auth-card h1{font-size:26px;letter-spacing:-.03em;margin:0 0 8px}
.auth-card>p{font-size:11px;line-height:1.6;color:rgba(236,242,246,.74);margin:0 0 22px}
.auth-card .btn{margin-top:3px}
.back-link{display:block;text-align:center;margin-top:20px;color:rgba(236,242,246,.82);font-size:10px;text-decoration:none}
code{background:rgba(255,255,255,.15);border-radius:5px;padding:2px 5px}
.menu-toggle{cursor:pointer}

@media(max-width:950px){
    .admin-shell{grid-template-columns:1fr}
    .sidebar{position:fixed;z-index:50;width:255px;left:-270px;transition:.22s;box-shadow:12px 0 40px rgba(0,0,0,.15)}
    body.sidebar-open .sidebar{left:0}
    .menu-toggle{display:block}
    .topbar{padding:0 20px}
    .admin-content{padding:22px 20px 50px}
    .dashboard-grid,.editor-layout{grid-template-columns:1fr}
    .sticky-card{position:static}
    .admin-user{display:none}
}
@media(max-width:700px){
    .stat-grid{grid-template-columns:1fr}
    .form-grid{grid-template-columns:1fr}
    .form-grid .span-2{grid-column:auto}
    .admin-tile{grid-template-columns:25px 40px 1fr}
    .state-pill{grid-column:3}
    .row-actions{grid-column:3}
    .toolbar{align-items:flex-start;gap:15px;flex-direction:column}
    .dashboard-grid{grid-template-columns:1fr}
}
