@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --danger: #ef4444;
  --border: #e5e7eb;
  --font-sans: "Inter", "Segoe UI", -apple-system, system-ui, "Roboto", "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font-sans); background: var(--bg); color: var(--text); line-height: 1.55; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

.app-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--panel); position: sticky; top:0; z-index: 10; border-bottom: 1px solid var(--border); }
.brand { font-weight: 700; letter-spacing: .5px; }
.header-actions { display: flex; gap: 8px; align-items: center; }
.user-dropdown { position: relative; }
.user-toggle { background: #ffffff; border: 1px solid var(--border); padding: 8px 12px; border-radius: 10px; cursor: pointer; font: inherit; color:#0f172a; }
.user-menu { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 20px rgba(15,23,42,0.08); display: none; min-width: 160px; overflow: hidden; }
.user-menu a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; color: #0f172a; text-decoration: none; border-bottom: 1px solid var(--border); }
.user-menu a:last-child { border-bottom: none; }
.user-menu a:hover { background: #f1f5f9; }
.user-dropdown.open .user-menu { display: block; }
/* Fallback buka menu saat hover untuk memastikan aksesibilitas */
.user-dropdown:hover .user-menu { display: block; }
/* Ikon untuk item dropdown pengguna */
.user-menu .icon { width: 16px; height: 16px; display: inline-block; background-repeat: no-repeat; background-position: center; background-size: 16px; }
.icon-user-circle { background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%230f172a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='7' r='4'/><path d='M20 21a8 8 0 10-16 0'/></svg>"); }
.icon-logout { background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%230f172a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M10 17l5-5-5-5'/><path d='M15 12H3'/><path d='M21 21V3'/></svg>"); }
.btn { background: #ffffff; color: #0f172a; padding: 8px 12px; border-radius: 10px; text-decoration: none; border: 1px solid var(--border); }
.btn .icon { margin-right: 8px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.small { padding: 6px 10px; font-size: 14px; }

.layout { display: block; }
.sidebar { background: #ffffff; border-right: 1px solid var(--border); padding: 14px; position: fixed; top:0; bottom:0; left:0; width:240px; overflow-y:auto; }
.right { margin-left: 240px; min-height: 100vh; display: flex; flex-direction: column; }
.menu-header { color: var(--muted); margin: 18px 8px 8px; font-size: 12px; text-transform: none; letter-spacing: .2px; }
.menu-item { display: flex; align-items: center; gap:8px; padding: 10px 12px; border-radius: 10px; color: #0f172a; text-decoration: none; }
.menu-item:hover { background: #f1f5f9; }
.menu-item.active { background: #ffffff; border: 1px solid var(--border); }
.menu-toggle { display:flex; align-items:center; gap:8px; width:100%; text-align:left; padding:10px 12px; border:none; background:transparent; border-radius:10px; color:#0f172a; cursor:pointer; font: inherit; }
.menu-toggle:hover { background:#f1f5f9; }
.menu-icon { width:20px; display:inline-flex; justify-content:center; }
.submenu { margin:6px 0 8px; padding-left:4px; display:none; }
.submenu.open { display:block; }

.content { padding: 16px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 18px; margin-bottom: 16px; box-shadow: 0 8px 20px rgba(15,23,42,0.05); }
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 12px; }
.col-6 { grid-column: span 6; }
.col-12 { grid-column: span 12; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px; border-bottom: 1px solid var(--border); }
th { text-align: left; color: #334155; font-weight: 600; }
/* Kolom Nomor kecil dan rata tengah */
.col-nomor { width: 56px; text-align: center; }
td.col-nomor { text-align: center; }

input[type=text], input[type=password], input[type=date], select, input[type=file], textarea { width: 100%; padding: 10px; border-radius: 10px; border: 1px solid var(--border); background: #ffffff; color: var(--text); }
label { display: block; margin: 8px 0; }

.app-footer { padding: 12px 16px; border-top: 1px solid var(--border); background: var(--panel); text-align: center; }
.muted { color: var(--muted); }
.alert { padding: 10px; border-radius: 8px; margin: 8px 0; transition: opacity .4s ease, transform .4s ease; }
.alert.error { background: #fee2e2; border: 1px solid #ef4444; color: #7f1d1d; }
/* Alert sukses untuk flash message yang auto-dismiss */
.alert.success { background: #dcfce7; border: 1px solid #16a34a; color: #065f46; }

.login-body { display:flex; align-items:center; justify-content:center; min-height:100vh; }
.login-wrap { width: 720px; max-width: 95vw; }
.login-hero { display:grid; grid-template-columns: 1.2fr 1fr; border-radius: 16px; overflow:hidden; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.hero-left { background: linear-gradient(135deg, #1e40af, #2563eb); color: #fff; padding: 22px; display:flex; flex-direction:column; justify-content:center; }
.hero-brand { font-size: 24px; font-weight: 800; margin-bottom: 12px; }
.hero-text { font-size: 14px; opacity: .9; max-width: 420px; }
.hero-sep { height: 1px; background: rgba(255,255,255,.2); margin: 18px 0; width: 220px; }
.hero-ta-label { font-weight: 700; }
.hero-right { background: var(--panel); padding: 22px; border: 1px solid var(--border); }
.login-form label { margin: 10px 0; }
/* Rapikan jarak konten di panel login kanan */
.hero-right h2 { margin: 0 0 8px; }
.hero-right .muted { margin: 0 0 12px; }
.login-form .btn.primary { margin-top: 6px; }

/* Ikon pada input/select di form login */
.login-form .with-icon { background-repeat: no-repeat; background-position: 10px 50%; padding-left: 38px; }
.login-form .icon-user { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%23cbd5e1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'><path d='M20 21a8 8 0 10-16 0'/><circle cx='12' cy='7' r='4'/></svg>"); }
.login-form .icon-lock { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%23cbd5e1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'><rect x='5' y='11' width='14' height='10' rx='2'/><path d='M7 11V8a5 5 0 0110 0v3'/></svg>"); }
.login-form select { appearance: none; padding-right: 38px; }
.login-form .icon-select { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%23cbd5e1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'><path d='M6 9l6 6 6-6'/></svg>"); background-repeat: no-repeat; background-position: right 10px center; }

@media (max-width: 900px) {
  .sidebar { position: static; width:auto; height:auto; }
  .right { margin-left: 0; }
  .login-hero { grid-template-columns: 1fr; }
}

/* Badge Tahun Ajaran di header */
.badge { display:inline-flex; align-items:center; gap:6px; padding: 6px 10px; border-radius: 999px; font-size: 13px; border: 1px solid var(--border); background: #f1f5f9; color: #0f172a; }
.badge.ta { background: #eef2ff; border-color: var(--border); }
/* Warna label TA berdasarkan status */
.badge.ta.ta-active { background: #dcfce7; border-color: #16a34a; color: #065f46; }
.badge.ta.ta-arsip { background: #fee2e2; border-color: #ef4444; color: #7f1d1d; }

/* Info TA di sidebar */
.ta-inline { display:block; background: #eef2ff; color: #1e293b; border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; margin: 4px 6px 12px; font-size: 13px; }
.sidebar-footer { margin-top: 16px; padding: 10px 12px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }

/* Kartu metrik dashboard */
.metric-grid { display:grid; grid-template-columns: repeat(12, 1fr); gap: 12px; }
.metric { grid-column: span 3; background: #ffffff; border: 1px solid var(--border); border-radius: 14px; padding: 16px; box-shadow: 0 6px 16px rgba(15,23,42,0.05); display:flex; gap:12px; align-items:center; }
.metric .icon { width:36px; height:36px; border-radius: 10px; background: #eff6ff; display:flex; align-items:center; justify-content:center; color: var(--primary); font-size: 18px; }
.metric .label { color: #334155; font-size: 14px; }
.metric .value { font-size: 22px; font-weight: 700; color: #0f172a; }

/* Tautan aksi bergaya teks */
.action-link { color: var(--primary); text-decoration: none; padding: 4px 6px; border-radius: 8px; }
.action-link:hover { background: #eff6ff; }
.action-link.danger { color: #b91c1c; }

/* Presensi card */
.big-card { background: #ffffff; border: 1px solid var(--border); border-radius: 14px; padding: 18px; box-shadow: 0 8px 20px rgba(15,23,42,0.05); }
.big-card h3 { margin-top: 0; }

/* Brand sidebar dan toggle collapse */
.sidebar-brand { display:flex; align-items:center; gap:8px; justify-content:space-between; padding: 8px 10px; border-bottom:1px solid var(--border); margin-bottom:8px; }
.sidebar-brand .logo-text { font-weight:700; color:#0f172a; }
.collapse-toggle { width:28px; height:28px; border:1px solid var(--border); border-radius:8px; background:#f8fafc; cursor:pointer; }
.collapse-toggle:hover { background:#f1f5f9; }

/* Mode collapse: hanya ikon di sidebar */
.sidebar-collapsed .sidebar { width:72px; }
.sidebar-collapsed .right { margin-left:72px; }
.sidebar-collapsed .menu-item span:not(.menu-icon) { display:none; }
.sidebar-collapsed .menu-toggle span:not(.menu-icon) { display:none; }
.sidebar-collapsed .submenu { display:none !important; }
.sidebar-collapsed .sidebar-brand .logo-text { display:none; }

/* Ikon profesional (SVG data URI) */
.menu-icon { width:20px; height:20px; background-repeat:no-repeat; background-position:center; background-size:20px; }
.icon-app { background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='20' height='20' fill='none' stroke='%23334155' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='3' width='7' height='7' rx='1.5'/><rect x='14' y='3' width='7' height='7' rx='1.5'/><rect x='3' y='14' width='7' height='7' rx='1.5'/><rect x='14' y='14' width='7' height='7' rx='1.5'/></svg>"); }
.icon-dashboard { background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='20' height='20' fill='none' stroke='%23334155' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M12 3a9 9 0 100 18 9 9 0 000-18z'/><path d='M12 12l5-3'/></svg>"); }
.icon-settings { background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='20' height='20' fill='none' stroke='%23334155' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='3'/><path d='M19.4 15a1.65 1.65 0 00.33 1.82l.06.06a2 2 0 11-2.83 2.83l-.06-.06a1.65 1.65 0 00-1.82-.33 1.65 1.65 0 00-1 1.51V21a2 2 0 11-4 0v-.09a1.65 1.65 0 00-1-1.51 1.65 1.65 0 00-1.82.33l-.06.06a2 2 0 11-2.83-2.83l.06-.06a1.65 1.65 0 00.33-1.82 1.65 1.65 0 00-1.51-1H3a2 2 0 110-4h.09a1.65 1.65 0 001.51-1 1.65 1.65 0 00-.33-1.82l-.06-.06A2 2 0 114.95 3.4l.06.06a1.65 1.65 0 001.82.33H7a1.65 1.65 0 001-1.51V3a2 2 0 114 0v.09a1.65 1.65 0 001 1.51H13a1.65 1.65 0 001.82-.33l.06-.06a2 2 0 112.83 2.83l-.06.06a1.65 1.65 0 00-.33 1.82V9a1.65 1.65 0 001.51 1H21a2 2 0 110 4h-.09a1.65 1.65 0 00-1.51 1z'/></svg>"); }
.icon-calendar { background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='20' height='20' fill='none' stroke='%23334155' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='4' width='18' height='18' rx='2'/><path d='M16 2v4M8 2v4M3 10h18'/></svg>"); }
.icon-database { background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='20' height='20' fill='none' stroke='%23334155' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><ellipse cx='12' cy='5' rx='9' ry='3'/><path d='M21 5v6c0 1.7-4 3-9 3s-9-1.3-9-3V5'/><path d='M3 11v6c0 1.7 4 3 9 3s9-1.3 9-3v-6'/></svg>"); }
.icon-learning { background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='20' height='20' fill='none' stroke='%23334155' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M22 12l-10 4-10-4 10-4 10 4z'/><path d='M6 14v3c0 1.1 2.7 2 6 2s6-.9 6-2v-3'/></svg>"); }
.icon-activity { background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='20' height='20' fill='none' stroke='%23334155' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M3 3v18h18'/><path d='M7 14l4-4 3 3 5-6'/></svg>"); }

/* -------- Toolbar & layout helpers -------- */
.page-actions { display:flex; gap:8px; justify-content:flex-end; align-items:flex-end; flex-wrap: nowrap; overflow-x: auto; }
/* Pastikan teks tombol tidak terbungkus dan tinggi seragam */
.page-actions .btn,
.page-actions .btn-group.segmented .btn { min-height: 40px; padding: 10px 14px; white-space: nowrap; }
/* Kecilkan font tombol Filter & Download CSV khusus di Riwayat */
.page-actions .toolbar .btn,
.page-actions .btn-group.segmented .btn { font-size: 14px; }
.toolbar { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.toolbar.nowrap { flex-wrap: nowrap; align-items: flex-end; }
/* Hapus margin label dalam toolbar nowrap agar baseline rata */
.toolbar.nowrap label { margin: 0; }
/* Samakan tinggi input/select/textarea dan tombol di toolbar nowrap (Profil Akun) */
.toolbar.nowrap input[type="text"],
.toolbar.nowrap input[type="password"],
.toolbar.nowrap input[type="date"],
.toolbar.nowrap select,
.toolbar.nowrap textarea { min-height: 40px; }
.toolbar.nowrap .btn,
.toolbar.nowrap .btn-group.segmented .btn { min-height: 40px; padding: 10px 14px; }
/* Selaraskan baseline filter & aksi di semua page-actions */
.page-actions .toolbar { align-items: flex-end; }
.page-actions .toolbar label { margin: 0; }
/* Samakan tinggi komponen di toolbar agar benar-benar segaris */
.page-actions input[type="text"],
.page-actions input[type="password"],
.page-actions input[type="date"],
.page-actions select,
.page-actions textarea { min-height: 40px; }
.page-actions .btn,
.page-actions .btn-group.segmented .btn { min-height: 40px; padding: 10px 14px; }
/* Samakan tinggi tombol di toolbar dengan input/select */
.toolbar .btn { padding: 10px 12px; }
/* Aksi form (Simpan/Update) di akhir form */
.form-actions { display:flex; justify-content:flex-end; margin-top: 12px; gap: 8px; }
.form-actions .btn { min-height: 40px; }

/* Segmented button group: Tambah / Impor / Download */
.btn-group.segmented { display:inline-flex; align-items:center; border:1px solid var(--border); border-radius:12px; overflow:hidden; background:#fff; }
.btn-group.segmented .btn { background:transparent; border:none; border-right:1px solid var(--border); border-radius:0; margin:0; padding:10px 14px; color:#334155; }
.btn-group.segmented .btn .icon { margin-right:8px; }
.btn-group.segmented .btn:last-child { border-right:none; }
.btn-group.segmented a.btn { text-decoration:none; }
.btn-group.segmented .btn:hover { background:#f8fafc; }
.btn-group.segmented .btn.primary { background: transparent; color:#334155; border-right:1px solid var(--border); }
.btn-group.segmented .btn.primary:hover { background:#f8fafc; }

/* Kolom jam ke agar proporsional */
.col-jam, .col-jam-ke { width: 80px; text-align: center; }

/* Pusatkan ikon saat collapse */
.sidebar-collapsed .menu-item { justify-content:center; }
.sidebar-collapsed .menu-toggle { justify-content:center; }

/* Ikon profesional untuk kartu dashboard */
.metric .icon { background-color:#eff6ff; }
.metric .icon::before { content:''; width:22px; height:22px; display:block; background-repeat:no-repeat; background-position:center; background-size:22px; }
.icon-stats::before { background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 3v18h18'/><path d='M7 13h3v5H7zM12 8h3v10h-3zM17 11h3v7h-3z'/></svg>"); }
.icon-users::before { background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M16 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2'/><circle cx='9' cy='7' r='4'/><path d='M22 21v-2a4 4 0 00-3-3.87'/><path d='M16 3.13A4 4 0 0120 7'/></svg>"); }
.icon-student::before { background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M22 12l-10 4-10-4 10-4 10 4z'/><path d='M6 14v3c0 1.1 2.7 2 6 2s6-.9 6-2v-3'/></svg>"); }
.icon-tag::before { background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M7 7h10v10H7z'/><path d='M7 7l10 10'/></svg>"); }
.icon-class::before { background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 7h18v12H3z'/><path d='M7 7V3h10v4'/></svg>"); }
.icon-book::before { background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M4 19.5A2.5 2.5 0 016.5 17H20'/><path d='M4 4v15.5A2.5 2.5 0 006.5 22H20V4a2 2 0 00-2-2H6a2 2 0 00-2 2z'/></svg>"); }

/* Modal generik */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: none; align-items: center; justify-content: center; z-index: 50; }
.modal-backdrop.open { display: flex; }
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 16px; width: 380px; max-width: 95vw; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.modal-close { background: transparent; border: none; font-size: 20px; cursor: pointer; color: #334155; }
/* Tata letak form dalam modal agar rapi dan ringkas */
.modal form { display: flex; flex-direction: column; gap: 10px; }
.modal form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
/* Baris aksi di modal: Upload kiri, Download kanan */
.modal .modal-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
/* Percantik input file agar tidak tampak standar */
.modal input[type="file"] { padding: 8px; border: 1px solid var(--border); border-radius: 10px; background: #fff; font-size: 14px; }
.modal input[type="file"]::file-selector-button { border: none; background: #2563eb; color: #fff; padding: 8px 12px; border-radius: 8px; margin-right: 10px; cursor: pointer; }
.modal input[type="file"]::file-selector-button:hover { background: #1d4ed8; }
/* Samakan ukuran font dan tinggi baris untuk tombol aksi di modal */
.modal .btn, .modal a.btn { font-size: 15px; line-height: 24px; min-height: 40px; }

/* Status presensi via ikon */
.status-icons { display: flex; gap: 6px; align-items: center; }
/* Tombol status presensi bergaya huruf (H/S/I/A) */
.status-btn { width: 28px; height: 28px; border: 1px solid var(--border); border-radius: 8px; background: #fff; cursor: pointer; display:flex; align-items:center; justify-content:center; font-weight:600; font-size:12px; line-height:1; }
.status-btn.active { box-shadow: 0 0 0 2px rgba(59,130,246,0.15); }
/* Warna status: Hadir(H) hijau, Izin(I) oranye, Sakit(S) ungu, Alpa(A) merah */
.status-h { color: #16a34a; border-color: #16a34a; }
.status-h.active { background: #dcfce7; }
.status-i { color: #f59e0b; border-color: #f59e0b; }
.status-i.active { background: #fffbeb; }
.status-s { color: #c026d3; border-color: #c026d3; }
.status-s.active { background: #f5eafc; }
.status-a { color: #dc2626; border-color: #dc2626; }
.status-a.active { background: #fee2e2; }
.icon-present { background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23059669' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M20 6L9 17l-5-5'/></svg>"); }
.icon-sick { background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23c026d3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='9'/><path d='M8 12h8'/></svg>"); }
.icon-leave { background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23ea580c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M5 12h14'/><path d='M12 5l7 7-7 7'/></svg>"); }
.icon-alpha { background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23dc2626' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M18 6L6 18'/><path d='M6 6l12 12'/></svg>"); }

/* Ikon inline untuk tombol toolbar (Filter/Download) */
.icon { width: 16px; height: 16px; display: inline-block; background-repeat: no-repeat; background-position: center; background-size: 16px; vertical-align: middle; }
.icon-filter { background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23334155' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 4h18l-7 8v6l-4 2v-8z'/></svg>"); }
.icon-download { background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23334155' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/><path d='M7 10l5 5 5-5'/><path d='M12 15V3'/></svg>"); }
/* Ikon pencarian */
.icon-search { background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23334155' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><path d='M21 21l-4.35-4.35'/></svg>"); }
/* Override agar kontras di tombol biru */
.btn.primary .icon-search { background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><path d='M21 21l-4.35-4.35'/></svg>"); }
/* Ikon tambah & upload yang lebih luwes */
.icon-plus { background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%230f172a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 5v14'/><path d='M5 12h14'/></svg>"); }
.icon-upload { background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%230f172a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/><path d='M7 10l5-5 5 5'/><path d='M12 5v10'/></svg>"); }
/* Ikon check untuk aksi simpan/update agar konsisten dengan tombol aksi lain */
.icon-check { background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%230f172a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M20 6L9 17l-5-5'/></svg>"); }
/* Ikon aksi tabel (Edit/Aktif/Nonaktif/Hapus) */
.icon-edit { background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%230f172a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 20h9'/><path d='M16 3l5 5L8 21l-5 1 1-5L16 3z'/></svg>"); }
.icon-enable { background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23059669' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='9'/><path d='M9 12l2 2 4-4'/></svg>"); }
.icon-disable { background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23b91c1c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='9'/><path d='M8 12h8'/></svg>"); }
.icon-trash { background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23b91c1c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 6h18'/><rect x='6' y='6' width='12' height='14' rx='2'/><path d='M9 6V4h6v2'/><path d='M10 11v6M14 11v6'/></svg>"); }
.action-icons { display:flex; gap:8px; }
.action-icons a { display:inline-flex; align-items:center; gap:6px; padding:6px 10px; border:1px solid var(--border); border-radius:10px; background:#fff; color:#0f172a; text-decoration:none; }
.action-icons a:hover { background:#f8fafc; }
/* Disabled state untuk anchor aksi */
.action-icons a.disabled { pointer-events: none; opacity: .5; }
/* Samakan tampilan tombol submit dengan tautan aksi */
.action-icons button { display:inline-flex; align-items:center; gap:6px; padding:6px 10px; border:1px solid var(--border); border-radius:10px; background:#fff; color:#0f172a; cursor:pointer; }
.action-icons button:hover { background:#f8fafc; }

/* Pagination ringkas dan rapi */
.pagination { display:flex; gap:6px; align-items:center; flex-wrap:wrap; justify-content:center; }
.pagination { margin-top: 12px; }
.pagination .ellipsis { color: var(--muted); padding: 0 4px; }
.btn.small.disabled { pointer-events: none; opacity: .5; }

/* ---- Tabs Jadwal & Kartu Hari ---- */
.tabs { display:flex; gap:24px; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.tab { padding: 10px 6px; text-decoration: none; color: #334155; border-bottom: 2px solid transparent; font-weight: 600; }
.tab:hover { color: var(--primary); background: #f8fafc; border-radius: 8px 8px 0 0; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.day-grid { display:grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
.day-card { background: #ffffff; border: 1px solid var(--border); border-radius: 14px; padding: 14px; box-shadow: 0 6px 16px rgba(15,23,42,0.04); }
.day-card.no-border { background: transparent; border: none; box-shadow: none; padding: 0; }
.day-title { color: var(--primary); text-decoration: none; font-weight: 600; display:block; }
.day-sep { height: 2px; background: #e0e7ff; margin: 8px 0 10px; width: 100%; }
.day-body { color: #0f172a; font-size: 14px; }
.schedule-item { display:flex; align-items:center; gap:8px; margin: 6px 0; }
.schedule-item .badge { background:#eff6ff; border-color:#e0e7ff; font-size: 12px; }

/* Kartu jadwal per kelas */
.schedule-card { background:#fff; border:1px solid var(--border); border-radius:12px; padding:10px; box-shadow:0 6px 14px rgba(15,23,42,0.04); margin:8px 0; }
.schedule-card .jam { color: var(--muted); font-size:12px; margin-bottom:4px; }
.schedule-card .mapel { font-weight:700; color:#0f172a; }
.schedule-card .pendidik { color: var(--muted); font-size:12px; }
.schedule-card .kelas { color: var(--muted); font-size:12px; }

@media (max-width: 1100px) { .day-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 780px) { .day-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .day-grid { grid-template-columns: 1fr; } }

/* Responsivitas tabel: scroll halus di layar kecil */
@media (max-width: 640px) {
  .card { overflow-x: auto; }
  table { min-width: 640px; }
}

/* Lebar kolom khusus untuk tabel */
.col-ta { white-space: nowrap; min-width: 220px; }
.col-tingkat-nama { width: 280px; }
/* Kolom IP agar tidak terbungkus dan sedikit lebih lebar */
.col-ip, td.col-ip { white-space: nowrap; }
.col-ip { min-width: 220px; }

/* Standarisasi ukuran kolom filter di semua menu */
.filter-field { min-width: 160px; }
.filter-field select,
.filter-field input[type="text"],
.filter-field input[type="date"],
.filter-field input[type="number"] { width: 100%; }

/* Toolbar (form pencarian) agar satu baris */
.toolbar { display:flex; gap:8px; align-items:center; }
.toolbar.nowrap { flex-wrap: nowrap; align-items: flex-end; }
/* Samakan tinggi tombol di toolbar (termasuk segmented) dengan input/select */
.toolbar .btn,
.toolbar .btn-group.segmented .btn { min-height: 40px; padding: 10px 14px; font-size: 16px; }

/* Kolom tabel yang diperkecil untuk tata letak rapi dan konsisten */
.col-date { width: 120px; }
.col-kelas { width: 120px; }
.col-mapel { width: 100px; max-width: 100px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-pendidik { width: 180px; }