:root{
    --bg:#0b1220;
    --muted:#93a4c7;
    --text:#e7eeff;
    --border:rgba(255,255,255,.10);
    --hover:rgba(255,255,255,.06);
    --accent:#4f8cff;
    --accent2:#22c55e;
    --shadow: 0 10px 30px rgba(0,0,0,.35);
    --radius:18px;
}

*{ box-sizing:border-box; }

body{
    margin:0;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
    color:var(--text);
    background:
            radial-gradient(1200px 600px at 10% -10%, rgba(79,140,255,.25), transparent 60%),
            radial-gradient(900px 500px at 90% 0%, rgba(34,197,94,.18), transparent 55%),
            var(--bg);
}

/* =========================
   AUTH (login / forgot)
   Use: <div class="auth"> ... </div>
   ========================= */
.auth{
    min-height:100vh;
    display:grid;
    place-items:center;
    padding:22px;
}

.auth .card{
    width:min(420px, 100%);
    padding:24px;
    border-radius: var(--radius);
    border:1px solid var(--border);
    background: rgba(255,255,255,.03);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.auth .brand{
    display:flex;
    align-items:center;
    gap:12px;
    margin-bottom:18px;
}

.auth .badge{
    width:44px; height:44px;
    border-radius:16px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    display:grid;
    place-items:center;
    font-weight:900;
    color:white;
    letter-spacing:1px;
}

.auth .brand-title{ line-height:1.2; }
.auth .brand-title h1{ margin:0; font-size:18px; }
.auth .brand-title p{ margin:2px 0 0; font-size:12px; color:var(--muted); }

.auth .title{ margin:0 0 6px; font-size:18px; }
.auth .subtitle{ margin:0 0 14px; color:var(--muted); font-size:13px; line-height:1.4; }

.auth .error{
    border: 1px solid rgba(239,68,68,.45);
    background: rgba(239,68,68,.12);
    padding: 10px 12px;
    border-radius: 14px;
    color: #ffd1d1;
    font-size: 13px;
    margin-bottom: 10px;
}

.auth .success{
    border: 1px solid rgba(34,197,94,.45);
    background: rgba(34,197,94,.12);
    padding: 10px 12px;
    border-radius: 14px;
    color: #d7ffe6;
    font-size: 13px;
    margin-bottom: 10px;
}

.auth .field{
    display:flex;
    flex-direction:column;
    gap:8px;
    margin-bottom:14px;
}

.auth label{
    font-size:12px;
    color:var(--muted);
    letter-spacing:.06em;
    text-transform:uppercase;
}

.auth input{
    width:100%;
    padding:12px 12px;
    border-radius:14px;
    border:1px solid var(--border);
    background: rgba(255,255,255,.02);
    color:var(--text);
    outline:none;
    transition:.15s ease;
}

.auth input:focus{
    border-color: rgba(79,140,255,.55);
    box-shadow: 0 0 0 4px rgba(79,140,255,.18);
}

.auth .btn{
    width:100%;
    padding:12px;
    border-radius:14px;
    border:1px solid rgba(79,140,255,.45);
    background: rgba(79,140,255,.18);
    color:var(--text);
    cursor:pointer;
    font-weight:700;
    transition:.15s ease;
}

.auth .btn:hover{
    background: rgba(79,140,255,.25);
    transform: translateY(-1px);
}

.auth .link{
    margin-top:12px;
    text-align:center;
}

.auth .link a{
    font-size:12px;
    color:var(--muted);
    text-decoration:none;
    transition:.15s ease;
}

.auth .link a:hover{
    color:var(--text);
    text-decoration:underline;
}

.auth .footer{
    margin-top:14px;
    text-align:center;
    font-size:12px;
    color:var(--muted);
}

.auth .password-wrap{ position:relative; }
.auth .password-wrap input{ padding-right:44px; }
.auth .toggle{
    position:absolute;
    right:10px;
    top:50%;
    transform: translateY(-50%);
    background:none;
    border:none;
    color:var(--muted);
    cursor:pointer;
    font-size:16px;
}
.auth .toggle:hover{ color:var(--text); }

.auth .row .btn{
    width:auto;
    flex:1;
    min-width:180px;
}

.auth .info{
    border: 1px solid rgba(79,140,255,.35);
    background: rgba(79,140,255,.10);
    padding: 12px;
    border-radius: 14px;
    color: #dbe8ff;
    font-size: 13px;
    line-height: 1.45;
    margin-bottom: 12px;
}

/* =========================
   PANEL (layout / dashboard)
   Use: <div class="app panel">
   ========================= */
.panel.app{
    display:grid;
    grid-template-columns: 280px 1fr;
    min-height:100vh;
}

.panel .sidebar{
    padding:20px;
    border-right:1px solid rgba(255,255,255,.08);
    background: rgba(15,27,51,.45);
    backdrop-filter: blur(10px);
}

.panel .brand{
    display:flex;
    align-items:center;
    gap:10px;
    padding:14px;
    border:1px solid rgba(255,255,255,.08);
    border-radius:16px;
    background: rgba(255,255,255,.03);
    box-shadow: var(--shadow);
    margin-bottom:16px;
}

.panel .brand-badge{
    width:40px; height:40px;
    border-radius:14px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    display:grid;
    place-items:center;
    font-weight:800;
    color:white;
}

.panel .brand-title{ line-height:1.1; }
.panel .brand-title .name{
    font-weight:800;
    font-size:14px;
    letter-spacing:1px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    max-width:180px;
}
.panel .brand-title .sub{
    font-size:12px;
    color:var(--muted);
    margin-top:2px;
}

.panel .nav{
    display:flex;
    flex-direction:column;
    gap:8px;
    margin-top:14px;
}

.panel .nav a{
    display:flex;
    align-items:center;
    gap:10px;
    padding:10px 12px;
    text-decoration:none;
    color:var(--text);
    border:1px solid transparent;
    border-radius:12px;
    transition:.15s ease;
}

.panel .nav a:hover{
    background: var(--hover);
    border-color: rgba(255,255,255,.08);
    transform: translateY(-1px);
}

.panel .nav a.active{
    background: rgba(79,140,255,.15);
    border-color: rgba(79,140,255,.35);
    box-shadow: 0 8px 18px rgba(79,140,255,.12);
}

.panel .nav .dot{
    width:10px; height:10px;
    border-radius:999px;
    background: rgba(255,255,255,.25);
}

.panel .nav a.active .dot{
    background: var(--accent);
    box-shadow: 0 0 0 4px rgba(79,140,255,.18);
}

.panel .sidebar-footer{
    margin-top:18px;
    padding-top:14px;
    border-top:1px solid rgba(255,255,255,.08);
}

.panel .btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    padding:10px 12px;
    border-radius:12px;
    border:1px solid rgba(255,255,255,.08);
    background: rgba(255,255,255,.03);
    color:var(--text);
    cursor:pointer;
    transition:.15s ease;
}

.panel .btn:hover{
    background: var(--hover);
    transform: translateY(-1px);
}

.panel .main{ padding:22px; }

.panel .topbar{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    padding:14px 16px;
    border:1px solid rgba(255,255,255,.08);
    border-radius:16px;
    background: rgba(255,255,255,.03);
    box-shadow: var(--shadow);
    margin-bottom:16px;
}

.panel .topbar h2{ margin:0; font-size:18px; letter-spacing:1px; }
.panel .topbar .meta{ font-size:12px; color:var(--muted); }

.panel .card{
    border:1px solid rgba(255,255,255,.08);
    border-radius:16px;
    background: rgba(255,255,255,.03);
    box-shadow: var(--shadow);
    padding:16px;
}

.panel table{
    width:100%;
    border-collapse: collapse;
    overflow:hidden;
    border-radius: 14px;
    border:1px solid rgba(255,255,255,.08);
}

.panel th, .panel td{
    padding:12px 10px;
    text-align:left;
    border-bottom:1px solid rgba(255,255,255,.08);
    font-size:13px;
}

.panel th{
    font-size:12px;
    text-transform:uppercase;
    letter-spacing:.08em;
    color: var(--muted);
    background: rgba(255,255,255,.03);
}

.panel tr:hover td{
    background: rgba(255,255,255,.02);
}
/* Pagination */
.pager{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
    margin-top:12px;
    flex-wrap:wrap;
}

.pager .left{
    font-size:12px;
    color: var(--muted);
}

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

.pager .pbtn{
    padding:8px 10px;
    border-radius:10px;
    border:1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.03);
    color: var(--text);
    cursor:pointer;
    transition:.15s ease;
}

.pager .pbtn:hover{
    background: rgba(255,255,255,.08);
    transform: translateY(-1px);
}

.pager .pbtn[disabled]{
    opacity:.45;
    cursor:not-allowed;
    transform:none;
}

.pager .pnum{
    min-width:34px;
}

.pager .pbtn.active{
    border-color: rgba(79,140,255,.45);
    background: rgba(79,140,255,.18);
}

/* Table tools (search + page size) */
.table-tools{
    display:flex;
    justify-content:space-between;
    gap:12px;
    flex-wrap:wrap;
    align-items:center;
    margin: 0 0 12px;
}

.table-tools .group{
    display:flex;
    gap:10px;
    align-items:center;
    flex-wrap:wrap;
}

.table-tools .label{
    font-size:12px;
    color: var(--muted);
    letter-spacing:.06em;
    text-transform: uppercase;
}

.table-tools input[type="search"],
.table-tools select{
    padding:10px 12px;
    border-radius:12px;
    border:1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.03);
    color: var(--text);
    outline:none;
    transition:.15s ease;
}

.table-tools input[type="search"]:focus,
.table-tools select:focus{
    border-color: rgba(79,140,255,.55);
    box-shadow: 0 0 0 4px rgba(79,140,255,.18);
}

.table-tools .muted{
    font-size:12px;
    color: var(--muted);
}

.btn.btn-primary{
    border:1px solid rgba(79,140,255,.45);
    background: rgba(79,140,255,.18);
}
.btn.btn-secondary{
    border:1px solid var(--border);
    background: rgba(255,255,255,.03);
}

.icon-btn{
    width:36px; height:36px;
    border-radius:12px;
    border:1px solid var(--border);
    background: rgba(255,255,255,.03);
    color: var(--text);
    cursor:pointer;
}

.modal{ display:none; position:fixed; inset:0; z-index:50; }
.modal.show{ display:block; }
.modal-backdrop{ position:absolute; inset:0; background: rgba(0,0,0,.55); }

.modal-card{
    position:relative;
    width:min(560px, calc(100% - 28px));
    margin: 10vh auto 0;
    border-radius: 18px;
    border:1px solid var(--border);
    background: rgba(15,27,51,.70);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow);
    padding:16px;
}

.modal-head{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:10px;
    margin-bottom:12px;
}
.modal-title{ font-weight:800; font-size:16px; }
.modal-sub{ color: var(--muted); font-size:12px; margin-top:2px; }

.field{ display:flex; flex-direction:column; gap:8px; margin-bottom:12px; }
.field label{
    font-size:12px;
    color: var(--muted);
    letter-spacing: .06em;
    text-transform: uppercase;
}
.field input{
    width:100%;
    padding:12px 12px;
    border-radius:14px;
    border:1px solid var(--border);
    background: rgba(255,255,255,.02);
    color: var(--text);
    outline:none;
}
.field input:focus{
    border-color: rgba(79,140,255,.55);
    box-shadow: 0 0 0 4px rgba(79,140,255,.18);
}

.grid-2{ display:grid; grid-template-columns: 1fr 1fr; gap:12px; }
@media (max-width: 560px){ .grid-2{ grid-template-columns: 1fr; } }

.modal-actions{ display:flex; justify-content:flex-end; gap:10px; margin-top:8px; }

/* Toast container */
#toast-container{
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Toast */
.toast{
    min-width: 260px;
    max-width: 360px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(15,27,51,.85);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
    color: var(--text);
    font-size: 13px;
    animation: toast-in .25s ease-out;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

/* Types */
.toast.success{
    border-color: rgba(34,197,94,.45);
}
.toast.error{
    border-color: rgba(239,68,68,.45);
}

.toast .icon{
    font-size: 16px;
    line-height: 1;
}

.toast.success .icon{ color: #22c55e; }
.toast.error .icon{ color: #ef4444; }

.toast .msg{
    flex: 1;
}

/* Animations */
@keyframes toast-in{
    from{
        opacity: 0;
        transform: translateY(-6px);
    }
    to{
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toast-out{
    to{
        opacity: 0;
        transform: translateY(-6px);
    }
}

.icon-btn{
    width:34px;
    height:34px;
    border-radius:10px;
    border:1px solid var(--border);
    background: rgba(255,255,255,.03);
    color: var(--text);
    cursor:pointer;
    display:grid;
    place-items:center;
}
.icon-btn:hover{
    background: var(--hover);
}

.icon-btn.danger{
    border-color: rgba(239,68,68,.35);
}
.icon-btn.danger:hover{
    background: rgba(239,68,68,.12);
}

.btn.btn-danger{
    border:1px solid rgba(239,68,68,.45);
    background: rgba(239,68,68,.14);
}
.btn.btn-danger:hover{ background: rgba(239,68,68,.20); }

.field select{
    width:100%;
    padding:12px 12px;
    border-radius:14px;
    border:1px solid var(--border);
    background: rgba(255,255,255,.02);
    color: var(--text);
    outline:none;
    appearance: none;
}

.field select:focus{
    border-color: rgba(79,140,255,.55);
    box-shadow: 0 0 0 4px rgba(79,140,255,.18);
}

.field select{
    appearance:auto;
}

.field:hover::after{
    color: var(--text);
}

@media (max-width: 900px){
    .panel.app{ grid-template-columns: 1fr; }
    .panel .sidebar{ border-right:none; border-bottom:1px solid rgba(255,255,255,.08); }
    .panel .brand-title .name{ max-width: 70vw; }
}
