/* Panel Admin OSBA Baitussalam */
:root {
    --emerald-950: #022C22;
    --emerald-900: #064E3B;
    --emerald-800: #065F46;
    --emerald-700: #047857;
    --emerald-600: #059669;
    --emerald-50: #ECFDF5;
    --gold-500: #F59E0B;
    --gold-100: #FEF3C7;
    --danger-600: #DC2626;
    --danger-50: #FEF2F2;
    --info-600: #2563EB;
    --info-50: #EFF6FF;
    --slate-900: #0F172A;
    --slate-800: #1E293B;
    --slate-700: #334155;
    --slate-600: #475569;
    --slate-500: #64748B;
    --slate-300: #CBD5E1;
    --slate-200: #E2E8F0;
    --slate-100: #F1F5F9;
    --bg: #F8FAFC;
    --white: #FFFFFF;
    --radius: 14px;
    --shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
    color: var(--slate-900);
    background: var(--bg);
    line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
code, pre { font-family: Consolas, 'Courier New', monospace; }

/* Login */
.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    background: radial-gradient(circle at 20% 20%, #047857 0%, #064E3B 50%, #022C22 100%);
}
.login-card {
    width: 100%;
    max-width: 430px;
    background: var(--white);
    border-radius: 20px;
    padding: 34px 30px;
    box-shadow: 0 25px 60px rgba(2, 44, 34, 0.45);
}
.login-brand { text-align: center; margin-bottom: 24px; }
.login-badge {
    display: inline-block;
    background: linear-gradient(135deg, #059669, #064E3B);
    color: #fff;
    font-weight: 900;
    letter-spacing: 0.1em;
    padding: 8px 18px;
    border-radius: 12px;
    margin-bottom: 12px;
}
.login-brand h1 { font-size: 1.45rem; color: var(--slate-900); }
.login-brand p { font-size: 0.88rem; color: var(--slate-500); margin-top: 4px; }
.login-hint {
    margin-top: 16px;
    text-align: center;
    background: var(--slate-100);
    padding: 10px;
    border-radius: 10px;
    color: var(--slate-600);
}
.login-links {
    margin-top: 18px;
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--emerald-700);
}
.login-links a:hover { text-decoration: underline; }

/* Admin Shell */
.admin-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 262px;
    flex-shrink: 0;
    background: linear-gradient(180deg, #022C22 0%, #064E3B 100%);
    color: #ECFDF5;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 40;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(167, 243, 208, 0.14);
}
.brand-mark { width: 38px; height: 38px; flex-shrink: 0; }
.brand-title { font-weight: 800; font-size: 1.05rem; color: #fff; }
.brand-sub { font-size: 0.72rem; color: #A7F3D0; }

.sidebar-nav {
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 14px;
    border-radius: 11px;
    font-size: 0.91rem;
    font-weight: 600;
    color: #D1FAE5;
    transition: background .18s, color .18s;
}
.nav-link:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.nav-link.active {
    background: linear-gradient(90deg, rgba(251, 191, 36, 0.22), rgba(16, 185, 129, 0.24));
    color: #FFFFFF;
    border: 1px solid rgba(251, 191, 36, 0.35);
}

.sidebar-footer {
    padding: 14px 12px 18px;
    border-top: 1px solid rgba(167, 243, 208, 0.14);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sidebar-quick-link {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 12px;
    border-radius: 9px;
    font-size: 0.83rem;
    font-weight: 600;
    color: #A7F3D0;
    background: rgba(255, 255, 255, 0.06);
}
.sidebar-quick-link:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 8px 0;
}
.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #F59E0B;
    color: #1E1B08;
    font-weight: 800;
    display: grid;
    place-items: center;
}
.user-name { font-size: 0.86rem; font-weight: 700; color: #fff; line-height: 1.2; }
.logout-link { font-size: 0.78rem; color: #FCA5A5; }
.logout-link:hover { text-decoration: underline; }

/* Main & Topbar */
.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    background: var(--white);
    border-bottom: 1px solid var(--slate-200);
    padding: 14px 26px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 25;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.menu-toggle {
    display: none;
    background: var(--slate-100);
    border: 1px solid var(--slate-200);
    border-radius: 9px;
    padding: 6px 11px;
    font-size: 1.1rem;
    cursor: pointer;
}
.page-title { font-size: 1.28rem; font-weight: 800; color: var(--slate-900); line-height: 1.2; }
.page-date { font-size: 0.81rem; color: var(--slate-500); }

.active-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--emerald-50);
    border: 1px solid #A7F3D0;
    padding: 7px 14px;
    border-radius: 12px;
    line-height: 1.2;
}
.active-pill small { display: block; font-size: 0.68rem; text-transform: uppercase; font-weight: 700; color: var(--emerald-700); }
.active-pill strong { font-size: 0.88rem; color: var(--emerald-950); }
.pulse-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #10B981;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.22);
}

.admin-content { padding: 24px 26px 40px; max-width: 1360px; width: 100%; margin: 0 auto; }

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 18px;
    font-size: 0.91rem;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.alert-success { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }
.alert-danger { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.alert-warning { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; }
.alert-info { background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; }
.alert-close { background: none; border: 0; font-size: 1.2rem; cursor: pointer; color: inherit; }

/* Cards & Grids */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 22px;
}
.kpi-card {
    background: var(--white);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow);
}
.kpi-label { font-size: 0.8rem; font-weight: 700; color: var(--slate-500); text-transform: uppercase; letter-spacing: 0.04em; }
.kpi-value { font-size: 1.85rem; font-weight: 800; margin: 4px 0 2px; color: var(--slate-900); }
.kpi-sub { font-size: 0.81rem; color: var(--slate-500); }
.kpi-card.emerald .kpi-value { color: var(--emerald-700); }
.kpi-card.danger .kpi-value { color: var(--danger-600); }
.kpi-card.gold .kpi-value { color: #B45309; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 22px; }
.grid-asymmetric { display: grid; grid-template-columns: 1.25fr 0.75fr; gap: 20px; margin-bottom: 22px; }

.card {
    background: var(--white);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--slate-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.card-header h2, .card-header h3 { font-size: 1.03rem; font-weight: 800; color: var(--slate-900); }
.card-header p { font-size: 0.82rem; color: var(--slate-500); }
.card-body { padding: 20px; }

/* Security Notice Banner */
.security-banner {
    background: linear-gradient(135deg, #ECFDF5, #F0FDF4);
    border: 1px solid #A7F3D0;
    border-left: 4px solid #059669;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 18px;
    font-size: 0.87rem;
    color: #064E3B;
}
.security-banner strong { color: #022C22; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    font-size: 0.83rem;
    font-weight: 700;
    color: var(--slate-700);
    margin-bottom: 6px;
}
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="time"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group input[type="url"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--slate-300);
    border-radius: 10px;
    font-size: 0.92rem;
    font-family: inherit;
    background: var(--white);
    color: var(--slate-900);
    transition: border-color .15s, box-shadow .15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--emerald-600);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.14);
}
.form-help { display: block; font-size: 0.77rem; color: var(--slate-500); margin-top: 4px; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 15px;
    border-radius: 10px;
    font-size: 0.87rem;
    font-weight: 700;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all .16s ease;
    font-family: inherit;
    white-space: nowrap;
}
.btn-sm { padding: 6px 11px; font-size: 0.79rem; border-radius: 8px; }
.btn-block { width: 100%; padding: 11px 16px; }
.btn-primary { background: var(--emerald-700); color: #fff; }
.btn-primary:hover { background: var(--emerald-800); }
.btn-gold { background: #F59E0B; color: #1E1B08; }
.btn-gold:hover { background: #D97706; color: #fff; }
.btn-outline { background: var(--white); color: var(--slate-700); border-color: var(--slate-300); }
.btn-outline:hover { background: var(--slate-100); }
.btn-danger { background: var(--danger-50); color: var(--danger-600); border-color: #FECACA; }
.btn-danger:hover { background: var(--danger-600); color: #fff; }
.btn-info { background: var(--info-50); color: var(--info-600); border-color: #BFDBFE; }
.btn-info:hover { background: var(--info-600); color: #fff; }

/* Tables */
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--slate-100); vertical-align: middle; }
th {
    background: var(--slate-100);
    color: var(--slate-600);
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
tr:hover td { background: #FAFCFB; }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 800;
    white-space: nowrap;
}
.badge-success { background: #DCFCE7; color: #166534; }
.badge-danger { background: #FEE2E2; color: #991B1B; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-neutral { background: var(--slate-100); color: var(--slate-600); }
.badge-secure { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; font-family: Consolas, monospace; }

/* Filter Bar & Tabs */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    background: var(--white);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}
.filter-bar .form-group { margin-bottom: 0; min-width: 160px; flex: 1; }

.period-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}
.period-pill {
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 0.83rem;
    font-weight: 700;
    background: var(--white);
    border: 1px solid var(--slate-300);
    color: var(--slate-700);
}
.period-pill.active {
    background: var(--emerald-700);
    border-color: var(--emerald-700);
    color: #fff;
}

.tabs {
    display: flex;
    gap: 6px;
    border-bottom: 2px solid var(--slate-200);
    margin-bottom: 18px;
    overflow-x: auto;
}
.tab-btn {
    padding: 10px 16px;
    font-size: 0.89rem;
    font-weight: 700;
    color: var(--slate-600);
    background: none;
    border: 0;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    white-space: nowrap;
}
.tab-btn.active { color: var(--emerald-700); border-bottom-color: var(--emerald-700); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Code Box & Simulator */
.code-box {
    background: #0F172A;
    color: #E2E8F0;
    border-radius: 12px;
    padding: 16px;
    font-size: 0.82rem;
    overflow-x: auto;
    line-height: 1.55;
}
.sim-output {
    margin-top: 12px;
    background: #022C22;
    color: #A7F3D0;
    border-radius: 12px;
    padding: 14px;
    font-family: Consolas, monospace;
    font-size: 0.82rem;
    min-height: 68px;
    white-space: pre-wrap;
}
.lcd-preview {
    background: #14532D;
    border: 3px solid #334155;
    border-radius: 10px;
    padding: 10px 14px;
    font-family: Consolas, monospace;
    color: #BBF7D0;
    font-size: 0.95rem;
    letter-spacing: 0.08em;
    margin-bottom: 10px;
    line-height: 1.45;
}

/* Trend Chart */
.chart-box {
    width: 100%;
    min-height: 210px;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 14px 8px 6px;
    overflow-x: auto;
}
.chart-col {
    flex: 1;
    min-width: 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.chart-bars {
    height: 150px;
    display: flex;
    align-items: flex-end;
    gap: 4px;
    width: 100%;
    justify-content: center;
}
.bar {
    width: 14px;
    border-radius: 5px 5px 0 0;
    min-height: 3px;
    transition: height .3s;
}
.bar.ontime { background: #10B981; }
.bar.late { background: #EF4444; }
.chart-lbl { font-size: 0.72rem; color: var(--slate-500); font-weight: 600; }
.chart-legend { display: flex; gap: 16px; font-size: 0.8rem; color: var(--slate-600); }
.dot-legend { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }

.enroll-box {
    background: #F0FDF4;
    border: 1px dashed #10B981;
    border-radius: 11px;
    padding: 12px;
    margin-top: 8px;
}

.empty-state {
    text-align: center;
    padding: 36px 20px;
    color: var(--slate-500);
    font-size: 0.92rem;
}

.action-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

@media (max-width: 1080px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-2, .grid-asymmetric { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
    .sidebar {
        position: fixed;
        left: -270px;
        transition: left .22s ease;
    }
    .sidebar.open { left: 0; }
    .menu-toggle { display: inline-flex; }
    .topbar { padding: 12px 16px; }
    .admin-content { padding: 16px; }
    .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
}
