/* =========================================================
   CALAKAN – gaya tampilan
   Warna utama (--p) diatur dari menu Pengaturan › Tampilan
   ========================================================= */
:root {
  --p: #0f766e;
  --p-600: color-mix(in srgb, var(--p) 88%, black);
  --p-800: color-mix(in srgb, var(--p) 55%, #06120f);
  --p-50: color-mix(in srgb, var(--p) 7%, white);
  --p-100: color-mix(in srgb, var(--p) 14%, white);
  --p-200: color-mix(in srgb, var(--p) 28%, white);
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #1f2933;
  --muted: #64748b;
  --line: #e5e9ef;
  --line-2: #eef1f5;
  --danger: #dc2626;
  --warn: #d97706;
  --ok: #16a34a;
  --info: #2563eb;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, 0.18);
  --sidebar-w: 268px;
  --top-h: 64px;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--p); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }

/* ---------- Progress bar & splash ---------- */
#progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 9999; pointer-events: none; }
#progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--p), #34d399); transition: width 0.3s ease, opacity 0.4s; opacity: 0; box-shadow: 0 0 8px var(--p); }
#progress.on span { opacity: 1; width: 75%; transition: width 6s cubic-bezier(0.1, 0.8, 0.2, 1); }
#progress.done span { opacity: 0; width: 100%; transition: width 0.2s, opacity 0.4s 0.2s; }

#splash { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 9000; transition: opacity 0.35s; }
#splash.hide { opacity: 0; pointer-events: none; }
.splash-box { text-align: center; color: var(--muted); }
.splash-logo { width: 72px; height: 72px; border-radius: 18px; display: block; margin: 0 auto 18px; object-fit: contain; }
.spinner { width: 20px; height: 20px; border: 2.5px solid var(--p-200); border-top-color: var(--p); border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; vertical-align: middle; }
.spinner.lg { width: 34px; height: 34px; border-width: 3.5px; }
.spinner.light { border-color: rgba(255,255,255,.35); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Layout ---------- */
.layout { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 60;
  background: linear-gradient(180deg, var(--p-800), color-mix(in srgb, var(--p-800) 85%, black));
  color: #e6f4f1; display: flex; flex-direction: column;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 18px 20px; min-height: var(--top-h); }
.brand img { width: 40px; height: 40px; border-radius: 11px; background: #fff; object-fit: contain; padding: 3px; flex-shrink: 0; }
.brand b { display: block; font-size: 17px; letter-spacing: 0.3px; color: #fff; }
.brand small { display: block; font-size: 11.5px; opacity: 0.72; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.nav { flex: 1; overflow-y: auto; padding: 8px 12px 16px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; opacity: 0.55; padding: 14px 12px 6px; font-weight: 700; }
.nav a, .nav button.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; margin: 2px 0;
  border-radius: 10px; color: rgba(255,255,255,.82); font-weight: 500; background: none; border: 0; cursor: pointer; text-align: left;
  transition: background 0.15s, color 0.15s;
}
.nav a i, .nav button.nav-item i { font-size: 17px; width: 20px; text-align: center; opacity: 0.9; }
.nav a:hover, .nav button.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.active { background: #fff; color: var(--p-800); font-weight: 700; box-shadow: 0 4px 14px -4px rgba(0,0,0,.35); }
.nav a.active i { color: var(--p); }
.nav .group > button.nav-item .chev { margin-left: auto; font-size: 12px; transition: transform 0.2s; }
.nav .group.open > button.nav-item .chev { transform: rotate(90deg); }
.nav .sub { overflow: hidden; max-height: 0; transition: max-height 0.25s ease; padding-left: 14px; }
.nav .group.open .sub { max-height: 400px; }
.nav .sub a { font-size: 13.5px; padding: 8px 12px; }
.nav .badge-dot { margin-left: auto; background: #f43f5e; color: #fff; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 7px; }
.side-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.1); }
.side-user { display: flex; align-items: center; gap: 10px; padding: 8px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--p-100); color: var(--p-800); flex-shrink: 0; font-size: 13px; }
.side-user .avatar { background: rgba(255,255,255,.15); color: #fff; }
.side-user b { display: block; font-size: 13px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.side-user small { font-size: 11.5px; opacity: 0.7; }
.nav-item.logout { color: #fecaca !important; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--top-h); display: flex; align-items: center; gap: 12px;
  padding: 0 24px; background: rgba(255,255,255,.88); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
  height: calc(var(--top-h) + env(safe-area-inset-top));
}
.topbar h1 { font-size: 18px; font-weight: 700; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn.hamburger { display: none; }
.icon-btn { position: relative; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; cursor: pointer; font-size: 18px; color: var(--text); transition: background 0.15s; }
.icon-btn:hover { background: var(--p-50); }
.icon-btn .count { position: absolute; top: -5px; right: -5px; background: #f43f5e; color: #fff; font-size: 10.5px; font-weight: 700; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; display: grid; place-items: center; border: 2px solid #fff; }
.content { padding: 24px; flex: 1; width: 100%; max-width: 1400px; }
.footer { padding: 14px 24px 22px; color: var(--muted); font-size: 12.5px; }
.backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); z-index: 55; opacity: 0; pointer-events: none; transition: opacity 0.25s; }

@media (max-width: 991px) {
  .sidebar { transform: translateX(-102%); box-shadow: var(--shadow-lg); }
  .layout.nav-open .sidebar { transform: none; }
  .layout.nav-open .backdrop { opacity: 1; pointer-events: auto; }
  .main { margin-left: 0; }
  .icon-btn.hamburger { display: grid; }
  .topbar { padding-left: 14px; padding-right: 14px; }
  .content { padding: 16px; }
  .footer { padding: 10px 16px 24px; }
}

/* ---------- Page transition ---------- */
.page { animation: fadeUp 0.28s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Cards & grid ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.card-h h3 { font-size: 15.5px; font-weight: 700; flex: 1; min-width: 160px; }
.card-b { padding: 20px; }
.card-b.p0 { padding: 0; }
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid.c2, .grid.c3 { grid-template-columns: 1fr; } .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }

/* ---------- Hero / greeting ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 20px; padding: 28px 30px; color: #fff;
  background: radial-gradient(1200px 300px at 100% 0%, rgba(255,255,255,.18), transparent 60%), linear-gradient(135deg, var(--p), var(--p-800));
  box-shadow: 0 18px 40px -18px var(--p);
}
.hero .arabic { font-family: "Amiri", "Traditional Arabic", "Scheherazade New", serif; font-size: 30px; line-height: 1.4; opacity: 0.95; direction: rtl; }
.hero h2 { font-size: 26px; font-weight: 800; margin-top: 4px; }
.hero p { margin: 8px 0 0; opacity: 0.88; max-width: 640px; }
.hero .pattern { position: absolute; right: -40px; bottom: -60px; width: 260px; height: 260px; opacity: 0.12; }
@media (max-width: 640px) { .hero { padding: 22px 20px; border-radius: 16px; } .hero h2 { font-size: 21px; } .hero .arabic { font-size: 24px; } }

.stat { display: flex; align-items: center; gap: 14px; padding: 18px; }
.stat .ic { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; font-size: 21px; background: var(--p-50); color: var(--p); flex-shrink: 0; }
.stat b { font-size: 24px; font-weight: 800; display: block; line-height: 1.1; }
.stat span { font-size: 12.5px; color: var(--muted); }
@media (max-width: 640px) { .stat { padding: 14px; gap: 10px; } .stat .ic { width: 38px; height: 38px; font-size: 17px; } .stat b { font-size: 19px; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: 11px; border: 1px solid transparent; background: var(--p); color: #fff; font-weight: 600; cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, transform 0.05s; white-space: nowrap; text-decoration: none; font-size: 14px;
}
.btn:hover { background: var(--p-600); box-shadow: 0 6px 16px -8px var(--p); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn i { font-size: 16px; }
.btn.ghost { background: #fff; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { background: var(--p-50); border-color: var(--p-200); box-shadow: none; }
.btn.soft { background: var(--p-50); color: var(--p-800); }
.btn.soft:hover { background: var(--p-100); box-shadow: none; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #b91c1c; box-shadow: 0 6px 16px -8px var(--danger); }
.btn.warn { background: var(--warn); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn.icon { width: 34px; padding: 0; height: 34px; }
.btn.icon.sm { width: 30px; height: 30px; }
.btn.block { width: 100%; }
.btn.lg { height: 48px; font-size: 15px; border-radius: 13px; }
.btn .spinner { width: 16px; height: 16px; border-width: 2px; border-color: rgba(255,255,255,.4); border-top-color: #fff; }
.btn.ghost .spinner, .btn.soft .spinner { border-color: var(--p-200); border-top-color: var(--p); }
.btn-group { display: inline-flex; gap: 6px; }

/* ---------- Forms ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field > span em { color: var(--danger); font-style: normal; }
.field small.hint { display: block; color: var(--muted); font-size: 12px; margin-top: 5px; }
.input, .select, textarea.input {
  width: 100%; height: 42px; padding: 0 13px; border: 1px solid var(--line); border-radius: 11px; background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s; outline: none; font-size: 14.5px;
}
textarea.input { height: auto; min-height: 64px; padding: 10px 13px; resize: vertical; line-height: 1.45; }
.input:focus, .select:focus, textarea.input:focus { border-color: var(--p); box-shadow: 0 0 0 4px var(--p-100); }
.select { appearance: none; -webkit-appearance: none; padding-right: 36px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%2364748b' d='M1.6 5.3a.8.8 0 0 1 1.1 0L8 10.6l5.3-5.3a.8.8 0 1 1 1.1 1.1l-5.8 5.9a.8.8 0 0 1-1.2 0L1.6 6.4a.8.8 0 0 1 0-1.1z'/%3E%3C/svg%3E") no-repeat right 13px center; }
.input.sm, .select.sm { height: 34px; font-size: 13.5px; border-radius: 9px; }
.search { position: relative; min-width: 220px; flex: 1; max-width: 340px; }
.search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .input { padding-left: 36px; height: 38px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--p); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-check input { display: none; }
.chip-check span { display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: 99px; border: 1px solid var(--line); cursor: pointer; font-size: 13px; font-weight: 600; background: #fff; transition: all 0.15s; }
.chip-check input:checked + span { background: var(--p); color: #fff; border-color: var(--p); }
.color-row { display: flex; gap: 10px; align-items: center; }
.color-row input[type="color"] { width: 48px; height: 42px; border: 1px solid var(--line); border-radius: 11px; padding: 3px; background: #fff; cursor: pointer; }
@media (max-width: 640px) { .search { max-width: none; min-width: 0; width: 100%; flex: 1 1 100%; } .card-h h3 { min-width: 0; } }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--line-2); color: var(--muted); white-space: nowrap; }
.badge.ok { background: #dcfce7; color: #15803d; }
.badge.warn { background: #fef3c7; color: #b45309; }
.badge.danger { background: #fee2e2; color: #b91c1c; }
.badge.info { background: #dbeafe; color: #1d4ed8; }
.badge.p { background: var(--p-100); color: var(--p-800); }
.badge.role-admin { background: #ede9fe; color: #6d28d9; }
.badge.role-wali { background: var(--p-100); color: var(--p-800); }
.badge.role-guru { background: #dbeafe; color: #1d4ed8; }
.badge.role-ortu { background: #fce7f3; color: #be185d; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); font-weight: 700; padding: 11px 16px; background: #f8fafc; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t th.sortable { cursor: pointer; user-select: none; }
table.t th.sortable:hover { color: var(--p); }
table.t th .si { opacity: 0.4; font-size: 11px; margin-left: 4px; }
table.t th.sorted .si { opacity: 1; color: var(--p); }
table.t td { padding: 12px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.t tbody tr { transition: background 0.12s; }
table.t tbody tr:hover { background: #fafcfc; }
table.t td.actions { text-align: right; white-space: nowrap; }
table.t tr.group-row td { background: var(--p-50); font-weight: 700; color: var(--p-800); font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.4px; padding: 8px 16px; }
.cell-title { font-weight: 600; }
.cell-sub { font-size: 12.5px; color: var(--muted); }

/* Tabel → kartu di layar kecil */
@media (max-width: 760px) {
  table.t.responsive thead { display: none; }
  table.t.responsive, table.t.responsive tbody, table.t.responsive tr, table.t.responsive td { display: block; width: 100%; }
  table.t.responsive tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  table.t.responsive td { border: 0; padding: 3px 0; display: flex; gap: 10px; }
  table.t.responsive td[data-label]::before { content: attr(data-label); min-width: 96px; color: var(--muted); font-size: 12px; font-weight: 600; padding-top: 1px; flex-shrink: 0; }
  table.t.responsive td.actions { justify-content: flex-end; padding-top: 8px; }
  table.t.responsive td.main-cell { font-size: 15px; }
  table.t.responsive td.main-cell::before { display: none; }
  table.t.responsive tr.group-row { padding: 0; }
  table.t.responsive tr.group-row td { padding: 8px 14px; }
}

/* ---------- Empty & skeleton ---------- */
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty i { font-size: 44px; color: var(--p-200); display: block; margin-bottom: 10px; }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.skel { background: linear-gradient(90deg, #eef1f5 25%, #f7f9fb 37%, #eef1f5 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: 8px; height: 14px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.skel-card { padding: 20px; }
.skel-card .skel + .skel { margin-top: 12px; }

/* ---------- Progress ---------- */
.bar { height: 7px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--p); border-radius: 99px; transition: width 0.4s; }
.bar.ok > span { background: var(--ok); }

/* ---------- Tabs / segmented ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
/* Mouse/trackpad: tidak ada gestur geser, jadi tab turun ke baris berikutnya agar semua kelas terjangkau */
@media (hover: hover) and (pointer: fine) {
  .tabs { flex-wrap: wrap; overflow-x: visible; }
}
.tab { border: 1px solid var(--line); background: #fff; padding: 8px 14px; border-radius: 99px; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; transition: all 0.15s; color: var(--text); }
.tab:hover { border-color: var(--p-200); }
.tab.active { background: var(--p); border-color: var(--p); color: #fff; box-shadow: 0 6px 14px -8px var(--p); }
.tab .n { display: inline-block; margin-left: 6px; font-size: 11.5px; padding: 0 7px; border-radius: 99px; background: rgba(0,0,0,.08); }
.tab.active .n { background: rgba(255,255,255,.25); }

/* ---------- Week picker ---------- */
.week { display: inline-flex; align-items: center; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.week button { width: 34px; height: 34px; border: 0; background: none; border-radius: 9px; cursor: pointer; font-size: 15px; color: var(--text); }
.week button:hover { background: var(--p-50); color: var(--p); }
.week label { position: relative; padding: 0 10px; font-weight: 700; font-size: 13.5px; cursor: pointer; white-space: nowrap; display: flex; align-items: center; gap: 7px; }
.week label i { color: var(--p); }
.week input[type="date"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.week .today { font-size: 12px; font-weight: 700; width: auto; padding: 0 10px; color: var(--p); white-space: nowrap; }
/* Layar HP: rapatkan agar tombol "Pekan ini" tidak terlipat */
@media (max-width: 480px) {
  .week { max-width: 100%; }
  .week button { width: 30px; }
  .week label { padding: 0 4px; font-size: 13px; }
  .week label i { display: none; }
  .week .today { padding: 0 8px; }
}

/* ---------- CALAKAN tampilan baca ---------- */
.cal-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.cal-title small { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--p); font-weight: 700; }
.cal-title h2 { font-size: 20px; font-weight: 800; }
.cal-title p { margin: 2px 0 0; color: var(--muted); }
table.cal { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
table.cal th { background: var(--p); color: #fff; font-weight: 700; padding: 11px 12px; text-align: left; font-size: 12.5px; }
table.cal th:first-child { border-top-left-radius: 10px; }
table.cal th:last-child { border-top-right-radius: 10px; }
table.cal td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); border-right: 1px solid var(--line-2); vertical-align: top; }
table.cal td:last-child { border-right: 0; }
table.cal td.day { font-weight: 800; background: var(--p-50); color: var(--p-800); text-align: center; vertical-align: middle; width: 90px; border-right: 1px solid var(--p-100); }
table.cal td.day small { display: block; font-weight: 600; font-size: 11px; color: var(--muted); margin-top: 2px; }
table.cal td.subj { font-weight: 700; width: 150px; }
table.cal td.subj small { display: block; font-weight: 500; color: var(--muted); font-size: 11.5px; }
table.cal tr.day-end td { border-bottom: 2px solid var(--p-100); }
table.cal .empty-cell { color: #b6c0cc; }

.day-cards { display: none; }
.day-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.day-card + .day-card { margin-top: 12px; }
.day-card > header { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--p-50); cursor: pointer; }
.day-card > header b { font-size: 15px; color: var(--p-800); }
.day-card > header span { color: var(--muted); font-size: 12.5px; }
.day-card > header .chev { margin-left: auto; transition: transform 0.2s; color: var(--p); }
.day-card.collapsed > header .chev { transform: rotate(-90deg); }
.day-card.collapsed .lessons { display: none; }
.day-card.today > header { background: var(--p); }
.day-card.today > header b, .day-card.today > header span, .day-card.today > header .chev { color: #fff; }
.lesson { padding: 12px 14px; border-top: 1px solid var(--line-2); }
.lesson h4 { font-size: 14.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.lesson h4 .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--p); flex-shrink: 0; }
.lesson dl { margin: 6px 0 0; display: grid; grid-template-columns: 76px 1fr; gap: 3px 10px; font-size: 13.5px; }
.lesson dt { color: var(--muted); font-size: 12px; font-weight: 600; padding-top: 1px; }
.lesson dd { margin: 0; }
.lesson .tugas { background: #fffbeb; border: 1px dashed #fcd34d; padding: 6px 10px; border-radius: 8px; margin-top: 8px; font-size: 13px; }
@media (max-width: 760px) {
  .cal-table-wrap { display: none; }
  .day-cards { display: block; }
}

/* ---------- Form isian rencana ---------- */
.fill-day { margin-bottom: 18px; }
.fill-day > h3 { font-size: 14px; font-weight: 800; color: var(--p-800); text-transform: uppercase; letter-spacing: 0.6px; margin: 0 0 10px; display: flex; gap: 8px; align-items: center; }
.fill-day > h3 small { text-transform: none; letter-spacing: 0; color: var(--muted); font-weight: 600; }
.fill-row { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; transition: border-color 0.15s, box-shadow 0.15s; }
.fill-row.editable { border-left: 4px solid var(--p); }
.fill-row.dirty { border-color: var(--warn); border-left-color: var(--warn); box-shadow: 0 0 0 3px #fef3c7; }
.fill-row.readonly { background: #fafbfc; }
.fill-row .fr-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.fill-row .fr-head b { font-size: 15px; }
.fill-row .fr-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.fill-row .fr-grid label span { font-size: 12px; font-weight: 700; color: var(--muted); display: block; margin-bottom: 4px; }
.fill-row .fr-grid textarea { min-height: 54px; }
.fill-row .ro-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 14px; font-size: 13px; }
.fill-row .ro-grid div span { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.fill-row.collapsed-ro .ro-grid { display: none; }
@media (max-width: 760px) {
  .fill-row .fr-grid { grid-template-columns: 1fr; }
  .fill-row .ro-grid { grid-template-columns: 1fr 1fr; }
  .fill-row { padding: 12px; }
}
.savebar {
  position: sticky; bottom: 0; z-index: 30; margin: 16px -24px -24px; padding: 12px 24px calc(12px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.94); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
@media (max-width: 991px) { .savebar { margin: 16px -16px -16px; padding-left: 16px; padding-right: 16px; } }

/* ---------- Schedule editor ---------- */
.sched-grid { display: grid; grid-template-columns: repeat(var(--days, 5), minmax(200px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.sched-col { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-width: 200px; }
.sched-col > header { padding: 12px 14px; font-weight: 800; color: var(--p-800); background: var(--p-50); border-radius: var(--radius) var(--radius) 0 0; display: flex; align-items: center; }
.sched-col > header span { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 600; }
.sched-list { padding: 8px; flex: 1; min-height: 60px; }
.sched-item { border: 1px solid var(--line); border-radius: 11px; padding: 8px; margin-bottom: 8px; background: #fff; }
.sched-item .top { display: flex; gap: 6px; align-items: center; }
.sched-item .top .no { width: 22px; height: 22px; border-radius: 7px; background: var(--p-100); color: var(--p-800); font-size: 11.5px; font-weight: 800; display: grid; place-items: center; flex-shrink: 0; }
.sched-item .top select { flex: 1; min-width: 0; }
.sched-item .bottom { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.sched-item .bottom input { width: 76px; height: 30px; padding: 0 6px; font-size: 12.5px; }
.sched-item .bottom .tt { font-size: 11.5px; color: var(--muted); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sched-item .tt.none { color: var(--warn); }
.sched-add { margin: 0 8px 8px; }
@media (max-width: 760px) {
  .sched-grid { grid-template-columns: 1fr; overflow: visible; }
}

/* ---------- Subject groups ---------- */
.subj-card { padding: 16px; }
.subj-card header { display: flex; align-items: center; gap: 10px; }
.subj-card header .ic { width: 38px; height: 38px; border-radius: 11px; background: var(--p-50); color: var(--p); display: grid; place-items: center; font-weight: 800; font-size: 12px; flex-shrink: 0; }
.subj-card header b { flex: 1; font-size: 15px; }
.subj-card ul { list-style: none; margin: 12px 0 0; padding: 0; }
.subj-card li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px dashed var(--line); font-size: 13.5px; }
.subj-card li .avatar { width: 28px; height: 28px; font-size: 11px; }
.subj-card li .cls { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; opacity: 0; transition: opacity 0.2s; }
.modal-bg.show { opacity: 1; }
.modal { background: #fff; border-radius: 18px; width: 100%; max-width: 560px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); transform: translateY(12px) scale(0.98); transition: transform 0.22s; }
.modal-bg.show .modal { transform: none; }
.modal.lg { max-width: 780px; }
.modal > header { display: flex; align-items: center; gap: 10px; padding: 18px 20px; border-bottom: 1px solid var(--line-2); }
.modal > header h3 { flex: 1; font-size: 17px; font-weight: 800; }
.modal > .body { padding: 20px; overflow-y: auto; }
.modal > footer { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line-2); }
@media (max-width: 640px) {
  .modal-bg { padding: 0; align-items: flex-end; }
  .modal { max-width: none; border-radius: 20px 20px 0 0; max-height: 92vh; transform: translateY(40px); }
  .modal > footer { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .modal > footer .btn { flex: 1; }
}

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: #fff; }
.login-art { position: relative; overflow: hidden; color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(900px 500px at 0% 0%, rgba(255,255,255,.18), transparent 60%), linear-gradient(150deg, var(--p), var(--p-800)); }
.login-art .brandline { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 18px; }
.login-art .brandline img { width: 46px; height: 46px; border-radius: 12px; background: #fff; padding: 4px; object-fit: contain; }
.login-art h2 { font-size: 38px; font-weight: 800; line-height: 1.15; max-width: 480px; }
.login-art p { opacity: 0.85; max-width: 440px; font-size: 15px; }
.login-art .feat { display: flex; gap: 22px; flex-wrap: wrap; font-size: 13.5px; opacity: 0.92; }
.login-art .feat span { display: flex; align-items: center; gap: 8px; }
.login-art svg.deco { position: absolute; right: -80px; bottom: -80px; width: 420px; opacity: 0.1; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 32px 24px; }
.login-form form { width: 100%; max-width: 380px; }
.login-form h1 { font-size: 26px; font-weight: 800; }
.login-form .sub { color: var(--muted); margin: 6px 0 26px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 44px; }
.pw-wrap button { position: absolute; right: 4px; top: 4px; width: 36px; height: 34px; border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 17px; }
.login-mobile-head { display: none; }
@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-form { align-items: flex-start; padding-top: 0; }
  .login-mobile-head { display: block; margin: 0 -24px 28px; padding: calc(40px + env(safe-area-inset-top)) 24px 36px; color: #fff; border-radius: 0 0 28px 28px;
    background: radial-gradient(600px 300px at 0% 0%, rgba(255,255,255,.18), transparent 60%), linear-gradient(150deg, var(--p), var(--p-800)); text-align: center; }
  .login-mobile-head img { width: 64px; height: 64px; border-radius: 16px; background: #fff; padding: 5px; object-fit: contain; }
  .login-mobile-head b { display: block; font-size: 22px; margin-top: 10px; }
  .login-mobile-head small { opacity: 0.85; }
  .login-form form { max-width: 440px; }
}

/* ---------- Notifications ---------- */
.notif { display: flex; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); cursor: pointer; transition: background 0.12s; }
.notif:hover { background: #fafcfc; }
.notif.unread { background: var(--p-50); }
.notif .ic { width: 38px; height: 38px; border-radius: 50%; background: var(--p-100); color: var(--p); display: grid; place-items: center; flex-shrink: 0; }
.notif b { display: block; font-size: 14px; }
.notif p { margin: 2px 0 0; font-size: 13.5px; color: var(--muted); }
.notif > .badge { align-self: flex-start; }
.notif time { font-size: 11.5px; color: var(--muted); }

.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; background: var(--p-50); border: 1px solid var(--p-100); align-items: flex-start; }
.callout i { font-size: 20px; color: var(--p); flex-shrink: 0; margin-top: 1px; }
.callout.warn { background: #fffbeb; border-color: #fde68a; }
.callout.warn i { color: var(--warn); }
.callout.danger { background: #fef2f2; border-color: #fecaca; }
.callout.danger i { color: var(--danger); }
/* Hanya judul callout yang satu baris sendiri; <b> di dalam kalimat (<p>) tetap sebaris */
.callout > div > b { display: block; }
.callout p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }

.img-drop { border: 2px dashed var(--line); border-radius: 14px; padding: 16px; display: flex; gap: 14px; align-items: center; }
.img-drop .prev { width: 64px; height: 64px; border-radius: 12px; background: #f8fafc; border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; flex-shrink: 0; }
.img-drop .prev img { width: 100%; height: 100%; object-fit: contain; }

/* ---------- SweetAlert2 menyesuaikan tema ---------- */
.swal2-popup { font-family: var(--font) !important; border-radius: 18px !important; }
.swal2-styled.swal2-confirm { background: var(--p) !important; border-radius: 11px !important; font-weight: 600 !important; }
.swal2-styled.swal2-cancel { border-radius: 11px !important; font-weight: 600 !important; background: #64748b !important; }
.swal2-styled.swal2-deny { border-radius: 11px !important; font-weight: 600 !important; }
.swal2-styled:focus { box-shadow: 0 0 0 3px var(--p-200) !important; }
.swal2-toast { box-shadow: var(--shadow-lg) !important; }
.swal2-html-container ul { text-align: left; font-size: 14px; }
.swal2-timer-progress-bar { background: var(--p) !important; }
.swal2-icon.swal2-success .swal2-success-ring { border-color: color-mix(in srgb, var(--p) 30%, transparent) !important; }
.swal2-icon.swal2-success [class^=swal2-success-line] { background-color: var(--p) !important; }

@media print {
  .sidebar, .topbar, .no-print, .savebar, .footer { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; }
}
