/* SIPADU — Manajemen Mutasi Siswa SMPN 3 Wates
   Tanpa CDN: semua gaya ada di sini (kompatibel dengan CSP 'self'). */

:root {
  --brand-900: #0b2545;
  --brand-700: #13315c;
  --brand-600: #1d4e89;
  --teal-500: #14b8a6;
  --teal-600: #0d9488;
  --amber-500: #f59e0b;
  --rose-500: #f43f5e;
  --violet-500: #8b5cf6;
  --sky-500: #0ea5e9;

  --bg: #f0f5fb;
  --surface: #ffffff;
  --ink: #1b2a41;
  --muted: #5b6b82;
  --line: #dfe7f1;
  --radius: 16px;
  --shadow: 0 10px 30px -12px rgba(11, 37, 69, .18);
  --shadow-sm: 0 2px 8px rgba(11, 37, 69, .07);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .4rem; line-height: 1.25; color: var(--brand-900); }
h2 { font-size: 1.5rem; font-weight: 800; }
h4 { font-size: 1rem; font-weight: 700; }
code { background: #eef3fa; padding: 1px 6px; border-radius: 6px; font-size: .9em; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Layout utama ---------- */
.app { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding: 24px 16px;
  background: linear-gradient(170deg, var(--brand-900) 0%, var(--brand-600) 55%, var(--teal-600) 120%);
  color: #e6f0ff;
  display: flex; flex-direction: column; gap: 6px;
}
.side-brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px; border-bottom: 1px solid rgba(255,255,255,.14); margin-bottom: 10px; }
.side-brand img, .logo-fallback { width: 44px; height: 44px; border-radius: 12px; object-fit: contain; background: #fff; flex: none; }
.logo-fallback { display: grid; place-items: center; font-weight: 900; color: var(--brand-600); background: linear-gradient(135deg, #fff, #d9fbf5); font-size: 13px; }
.side-brand .title { font-weight: 800; letter-spacing: .3px; color: #fff; }
.side-brand .sub { font-size: 12px; color: #bcd9ff; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 12px;
  color: #dbe9ff; font-weight: 600; text-decoration: none;
  transition: background .15s, color .15s, transform .15s;
}
.nav a:hover { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; transform: translateX(2px); }
.nav a.active { background: #fff; color: var(--brand-700); box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.nav .sep { height: 1px; background: rgba(255,255,255,.14); margin: 10px 6px; }
.nav a.logout { color: #ffd7de; }
.side-foot { margin-top: auto; font-size: 12px; color: #9fc3ee; padding: 12px 8px 0; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 18px 32px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.topbar .crumb { font-weight: 800; font-size: 1.1rem; color: var(--brand-900); }
.topbar .who { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--teal-500), var(--sky-500)); }
.content { padding: 28px 32px 48px; max-width: 1280px; width: 100%; }

/* ---------- Komponen ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p { margin: 0; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 22px; margin-bottom: 20px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; }
.section-title { margin: 18px 0 10px; color: var(--brand-600); text-transform: uppercase; letter-spacing: .6px; font-size: 12px; }

.grid-stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
  position: relative; overflow: hidden; color: #fff; border-radius: var(--radius); padding: 20px 22px;
  box-shadow: var(--shadow); min-height: 118px;
}
.stat::after { content: ""; position: absolute; right: -28px; top: -28px; width: 120px; height: 120px; border-radius: 50%; background: rgba(255,255,255,.14); }
.stat .label { font-size: 13px; font-weight: 600; opacity: .92; }
.stat .value { font-size: 2.1rem; font-weight: 900; margin-top: 4px; letter-spacing: -.5px; }
.stat .foot { font-size: 12px; opacity: .85; }
.stat.blue   { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.stat.teal   { background: linear-gradient(135deg, #14b8a6, #0d9488); }
.stat.amber  { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #3b2300; }
.stat.rose   { background: linear-gradient(135deg, #fb7185, #e11d48); }

.quick { display: flex; gap: 10px; flex-wrap: wrap; }
.quick a { display: inline-flex; align-items: center; gap: 8px; padding: 12px 16px; border-radius: 12px; font-weight: 700; text-decoration: none; background: #eef5ff; color: var(--brand-600); border: 1px solid #d6e6ff; }
.quick a:hover { background: #dfeeff; text-decoration: none; }
.quick a.primary { background: linear-gradient(135deg, var(--brand-600), var(--teal-600)); color: #fff; border: 0; }

.bars { display: grid; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 52px 1fr 40px; align-items: center; gap: 10px; font-size: 13px; }
.bar-track { height: 12px; border-radius: 99px; background: #e9f0f8; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--sky-500), var(--teal-500)); }
.bar-row b { text-align: right; }

.two-col { display: grid; grid-template-columns: 1.1fr .9fr; gap: 20px; }
.stack { display: grid; gap: 20px; }
.bars.wide { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); column-gap: 26px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 12px; border: 1px solid transparent;
  font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; line-height: 1.2;
  background: #eef5ff; color: var(--brand-600); transition: transform .12s, box-shadow .15s, background .15s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn-primary { background: linear-gradient(135deg, var(--brand-600), var(--teal-600)); color: #fff; }
.btn-primary:hover { color: #fff; }
.btn-success { background: linear-gradient(135deg, #10b981, #059669); color: #fff; }
.btn-danger { background: linear-gradient(135deg, #fb7185, #e11d48); color: #fff; }
.btn-warm { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #3b2300; }
.btn-outline { background: #fff; border-color: var(--line); color: var(--brand-700); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 9px; }
.btn-block { width: 100%; margin-top: 10px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 4px 18px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 13px; font-weight: 700; color: var(--brand-700); margin: 12px 0 6px; }
.form-control, .form-select {
  width: 100%; padding: 11px 13px; font: inherit; color: var(--ink);
  background: #fff; border: 1.5px solid #cfdcec; border-radius: 12px; transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus { outline: none; border-color: var(--teal-500); box-shadow: 0 0 0 4px rgba(20,184,166,.18); }
textarea.form-control { min-height: 90px; resize: vertical; }
input[type=file].form-control { padding: 9px; background: #f8fbff; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-weight: 600; font-size: 14px; }
.actions { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.alert { padding: 12px 16px; border-radius: 12px; margin: 0 0 16px; font-weight: 600; border: 1px solid transparent; }
.alert-success { background: #e8faf2; color: #0f6b43; border-color: #bff0d9; }
.alert-danger  { background: #fff0f3; color: #a3172f; border-color: #ffd0da; }
.alert-info    { background: #eaf4ff; color: #1d4e89; border-color: #c9e2ff; }
.alert-warn    { background: #fff8e6; color: #8a5300; border-color: #ffe3a3; }
.alert ul { margin: 6px 0 0 18px; padding: 0; font-weight: 500; }

.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--line); }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; min-width: 620px; }
.table th { background: #f3f7fc; color: var(--brand-700); font-weight: 800; text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid #eef3f9; vertical-align: middle; }
.table tbody tr:nth-child(even) td { background: #fbfdff; }
.table tbody tr:hover td { background: #f1f8ff; }
.table td.num, .table th.num { text-align: center; }

.badge { display: inline-block; padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 800; }
.badge-in  { background: #dcfce7; color: #166534; }
.badge-out { background: #ffe4e6; color: #9f1239; }
.badge-active { background: #dbeafe; color: #1e40af; }
.badge-gone { background: #f1f5f9; color: #475569; }
.badge-l { background: #e0f2fe; color: #075985; }
.badge-p { background: #fce7f3; color: #9d174d; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 14px; }
.toolbar .form-group { margin: 0; flex: 1 1 200px; }
.toolbar .btn { margin-bottom: 0; }

.dropzone {
  border: 2px dashed #9fd9d0; border-radius: 16px; padding: 22px; text-align: center;
  background: linear-gradient(180deg, #f5fffc, #ffffff);
}
.dropzone .big { font-size: 15px; font-weight: 700; color: var(--brand-700); }
.logo-preview { display: flex; align-items: center; gap: 16px; padding: 14px; border: 1px dashed #c6d6ea; border-radius: 14px; background: #fbfdff; }
.logo-preview img { max-height: 90px; max-width: 180px; object-fit: contain; border-radius: 10px; background: #fff; }

.checklist { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 6px; font-size: 14px; }
.checklist li.ok { color: #0f6b43; }
.checklist li.bad { color: #a3172f; font-weight: 700; }

.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 7px 12px; border-radius: 99px; background: #eef5ff; color: var(--brand-600); font-weight: 700; font-size: 13px; text-decoration: none; border: 1px solid #d6e6ff; }
.chip.active { background: var(--brand-600); color: #fff; border-color: var(--brand-600); }
.chip:hover { text-decoration: none; }

.empty { text-align: center; padding: 30px 10px; color: var(--muted); }
.empty svg.i { width: 40px; height: 40px; color: #b8c8dc; margin-bottom: 6px; }

/* ---------- Login ---------- */
.login-body { background: linear-gradient(160deg, #0b2545 0%, #1d4e89 50%, #0d9488 130%); min-height: 100vh; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(100%, 420px); padding: 30px; border-radius: 22px; box-shadow: 0 30px 60px -20px rgba(0,0,0,.35); }
.login-card.wide { width: min(100%, 640px); }
.brand-mark {
  display: inline-block; font-weight: 900; letter-spacing: 1px; font-size: 12px; color: #0d9488;
  background: #dcfaf5; padding: 5px 12px; border-radius: 99px; margin-bottom: 10px;
}
.login-hero { text-align: center; margin-bottom: 18px; }
.login-hero img { max-height: 84px; max-width: 200px; object-fit: contain; margin-bottom: 8px; }

/* ---------- Responsif ---------- */
@media (max-width: 1100px) {
  .grid-stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 14px; }
  .side-brand { padding-bottom: 10px; margin-bottom: 6px; }
  .nav { display: flex; flex-wrap: wrap; gap: 6px; }
  .nav a { padding: 9px 12px; font-size: 14px; }
  .nav .sep { display: none; }
  .side-foot { display: none; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .topbar { position: static; }
}
@media (max-width: 600px) {
  .grid-stats { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat { padding: 16px; min-height: 104px; }
  .stat .value { font-size: 1.6rem; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .content { padding-top: 18px; }
}

/* Anak grid tidak boleh memaksa lebarnya sendiri (mencegah scroll horizontal di ponsel). */
.app > *, .two-col > *, .grid-stats > *, .form-grid > * { min-width: 0; }
.dropzone { display: block; cursor: pointer; }
.badge, .btn-sm, .table td:last-child, .table th:last-child { white-space: nowrap; }
.table td:nth-child(3) { min-width: 170px; }
