/* =========================================================================
   Sistem Informasi Sekolah — Panel Admin
   ========================================================================= */
:root {
    --brand: #1e56a0;
    --brand-dark: #163172;
    --brand-light: #e8f0fb;
    --accent: #16a085;
    --ink: #1f2937;
    --muted: #6b7280;
    --line: #e5e7eb;
    --bg: #f4f6fb;
    --sidebar: #14213d;
    --sidebar-2: #1c2c4d;
    --ok: #16a34a; --okbg: #e7f7ee;
    --warn: #d97706; --warnbg: #fdf3e3;
    --bad: #dc2626; --badbg: #fdeaea;
    --radius: 14px;
    --shadow: 0 4px 18px rgba(20,33,61,.08);
    --font: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--ink); }
a { color: var(--brand); text-decoration: none; }
h1,h2,h3,h4 { margin: 0 0 .4em; color: var(--brand-dark); }

.layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar { width: 260px; background: var(--sidebar); color: #c7d2e5; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; transition: .25s; }
.sidebar__brand { padding: 20px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar__logo { width: 40px; height: 40px; border-radius: 10px; background: linear-gradient(135deg, var(--brand), var(--accent)); color: #fff; display: grid; place-items: center; font-weight: 800; }
.sidebar__brand b { color: #fff; font-size: .95rem; display: block; line-height: 1.2; }
.sidebar__brand span { font-size: .72rem; color: #8fa3c4; }
.sidebar__section { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: #6d81a6; padding: 18px 20px 6px; }
.sidebar__menu { list-style: none; margin: 0; padding: 0 10px; }
.sidebar__menu a { display: flex; align-items: center; gap: 11px; padding: 10px 14px; border-radius: 10px; color: #c7d2e5; font-size: .9rem; font-weight: 500; margin-bottom: 2px; transition: .15s; }
.sidebar__menu a:hover { background: var(--sidebar-2); color: #fff; }
.sidebar__menu a.active { background: var(--brand); color: #fff; }
.sidebar__menu .ic { width: 20px; text-align: center; }

/* Main */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: #fff; border-bottom: 1px solid var(--line); padding: 14px 26px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 20; }
.topbar__title { font-weight: 700; color: var(--brand-dark); }
.topbar__user { display: flex; align-items: center; gap: 12px; font-size: .88rem; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand-light); color: var(--brand); display: grid; place-items: center; font-weight: 700; }
.hamburger { display: none; background: none; border: 0; font-size: 1.4rem; cursor: pointer; color: var(--brand-dark); }

.content { padding: 26px; flex: 1; }
.page-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.page-head h1 { font-size: 1.4rem; margin: 0; }
.page-head p { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }

/* Stat cards */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat { background: #fff; border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 14px; }
.stat__icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; background: var(--brand-light); flex-shrink: 0; }
.stat__num { font-size: 1.6rem; font-weight: 800; color: var(--brand-dark); line-height: 1; }
.stat__label { font-size: .82rem; color: var(--muted); }

/* Panels & cards */
.panel { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-bottom: 20px; }
.panel__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.panel__head h2 { font-size: 1.05rem; margin: 0; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data th { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #fafbfe; }
table.data tbody tr:hover { background: #fafbfe; }
table.data td.wrap { white-space: normal; }

/* Badges */
.badge { display: inline-block; font-size: .74rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.badge.ok { background: var(--okbg); color: var(--ok); }
.badge.warn { background: var(--warnbg); color: var(--warn); }
.badge.bad { background: var(--badbg); color: var(--bad); }
.badge.muted { background: #eef1f6; color: var(--muted); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-weight: 600; font-size: .88rem; padding: 9px 16px; border-radius: 9px; border: 1px solid transparent; font-family: inherit; transition: .15s; }
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-dark); }
.btn--light { background: var(--brand-light); color: var(--brand); }
.btn--light:hover { background: #d6e4f7; }
.btn--outline { background: #fff; border-color: var(--line); color: var(--ink); }
.btn--outline:hover { border-color: var(--brand); color: var(--brand); }
.btn--danger { background: var(--badbg); color: var(--bad); }
.btn--danger:hover { background: #f9d5d5; }
.btn--sm { padding: 6px 12px; font-size: .8rem; }
.btn--block { width: 100%; justify-content: center; }

/* Forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: 5px; }
.field input, .field select, .field textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; font-family: inherit; font-size: .92rem; background: #fff; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(30,86,160,.12); }
.field textarea { min-height: 100px; resize: vertical; }
.field--full { grid-column: 1 / -1; }
.hint { font-size: .78rem; color: var(--muted); margin-top: 4px; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 10px; font-size: .9rem; margin-bottom: 16px; }
.alert--success { background: var(--okbg); color: #14663c; }
.alert--error { background: var(--badbg); color: #9b1c1c; }
.alert--info { background: var(--brand-light); color: var(--brand-dark); }

/* Module tiles (for skeleton modules) */
.tiles { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.tile { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; display: block; transition: .15s; border: 1px solid transparent; }
.tile:hover { border-color: var(--brand-light); transform: translateY(-3px); }
.tile__ic { font-size: 1.6rem; margin-bottom: 8px; }
.tile h3 { font-size: 1rem; margin: 0 0 4px; }
.tile p { margin: 0; font-size: .84rem; color: var(--muted); }

.empty { text-align: center; padding: 40px; color: var(--muted); }
.empty__ic { font-size: 2.4rem; opacity: .5; }
.skeleton-note { background: var(--warnbg); color: #92600a; border-radius: 10px; padding: 12px 16px; font-size: .85rem; margin-bottom: 16px; }

.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: .82rem; }
.chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }

@media (max-width: 1000px) {
    .stats { grid-template-columns: repeat(2,1fr); }
    .tiles { grid-template-columns: repeat(2,1fr); }
    .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .sidebar { position: fixed; z-index: 60; transform: translateX(-100%); box-shadow: 0 0 40px rgba(0,0,0,.3); }
    .sidebar.open { transform: translateX(0); }
    .hamburger { display: block; }
    .form-grid { grid-template-columns: 1fr; }
    .stats { grid-template-columns: 1fr 1fr; }
    .tiles { grid-template-columns: 1fr; }
    .content { padding: 16px; }
}
