* { box-sizing: border-box; }
:root {
  --navy: #14286b;
  --teal: #1d3f9c;
  --teal-dark: #152f7a;
  --teal-soft: #e9eefb;
  --red: #d0202e;
  --red-dark: #a3141f;
  --yellow: #f5c518;
  --bg: #eef3f6;
  --card: #fff;
  --text: #16324a;
  --muted: #5f7385;
  --border: #dce6ec;
  --danger: #c0392b;
  --ok: #138a52;
}
body { margin: 0; font-family: "Poppins", "Segoe UI", system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* ---------- Butang ---------- */
.btn { border: 1px solid var(--border); background: #fff; color: var(--text); padding: 9px 16px; border-radius: 10px; cursor: pointer; font: inherit; font-weight: 600; }
.btn:hover { border-color: var(--teal); }
.btn.primary { background: var(--teal); color: #fff; border-color: var(--teal); }
.btn.primary:hover { background: var(--teal-dark); }
.btn.outline { color: var(--teal-dark); border-color: #b8c6ec; }
.btn.danger { color: var(--danger); border-color: #f1c4bf; }
.btn.sm { padding: 4px 12px; font-size: 13px; }
.btn:disabled { opacity: .6; cursor: wait; }

/* ---------- Log masuk ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: linear-gradient(120deg, rgba(208,32,46,.55), rgba(29,63,156,.55)), url("img/bg-sekolah.png") center / cover no-repeat fixed; }
.login-card { background: rgba(255,255,255,.94); backdrop-filter: blur(6px); padding: 32px; border-radius: 18px; width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 16px 50px rgba(0,0,0,.3); }
.login-logos { display: flex; justify-content: center; align-items: center; gap: 28px; padding: 6px 0 14px; }
.login-unit { text-align: center; color: var(--navy); font-weight: 700; letter-spacing: .1em; font-size: 14px; }

/* Logo 3D berpusing 360° */
.logo3d { position: relative; perspective: 700px; }
.logo3d::after { /* bayang di bawah logo */
  content: ""; position: absolute; left: 15%; right: 15%; bottom: -12px; height: 10px; border-radius: 50%;
  background: radial-gradient(rgba(0,0,0,.35), transparent 70%); animation: shadow3d 6s linear infinite; }
.logo3d .spin { position: relative; transform-style: preserve-3d; animation: spin3d 6s linear infinite; }
.logo3d img { display: block; height: 150px; width: auto; border-radius: 50%; }
.logo3d img.layer { position: absolute; inset: 0; transform: translateZ(calc(var(--z) * -1px)); filter: brightness(.55); }
@keyframes spin3d { from { transform: rotateY(0deg); } to { transform: rotateY(360deg); } }
@keyframes shadow3d { 0%, 50%, 100% { transform: scaleX(1); } 25%, 75% { transform: scaleX(.25); } }
@media (prefers-reduced-motion: reduce) { .logo3d .spin, .logo3d::after { animation: none; } }
.login-card h1 { margin: 0; text-align: center; font-size: 22px; color: var(--navy); font-weight: 800; }
.login-sub { margin: -10px 0 0; text-align: center; color: var(--red); font-weight: 700; letter-spacing: .08em; font-size: 13px; }
.login-card p { margin: 0; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; }
input, select, textarea { font: inherit; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: #fff; color: var(--text); font-weight: 400; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 3px solid #c9d5f3; border-color: var(--teal); }
.msg { color: var(--danger); min-height: 1em; }

/* ---------- Header ---------- */
#app { min-height: 100vh; display: flex; flex-direction: column;
  background: linear-gradient(rgba(238,243,246,.82), rgba(238,243,246,.88)), url("img/bg-sekolah.png") center / cover no-repeat fixed; }
.hdr { display: flex; align-items: center; gap: 16px; padding: 12px 28px; background: linear-gradient(100deg, var(--red-dark) 0%, var(--red) 22%, #7a2a6e 46%, var(--teal) 70%, var(--navy) 100%); color: #fff; position: sticky; top: 0; z-index: 30; box-shadow: 0 2px 12px rgba(20,40,107,.25); }
.hdr-brand { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.logo { height: 64px; width: auto; filter: drop-shadow(0 2px 6px rgba(0,0,0,.3)); }
.logo.srbj { height: 54px; }
.logo.hem { border-radius: 50%; }
.hdr-text { margin-left: 8px; min-width: 0; }
.hdr-title { font-size: 24px; font-weight: 800; letter-spacing: .02em; line-height: 1.15; }
.hdr-sub { font-size: 14px; font-weight: 700; color: var(--yellow); letter-spacing: .12em; }
.hdr-right { display: flex; align-items: center; gap: 12px; }
.avatar { width: 46px; height: 46px; border-radius: 50%; background: #fff; color: var(--navy); display: grid; place-items: center; font-weight: 800; font-size: 13px; flex-shrink: 0; }
.user-info { display: flex; flex-direction: column; line-height: 1.25; margin-right: 6px; min-width: 0; }
/* Nama penuh guru dipaparkan sepenuhnya (dibalut ke baris kedua jika panjang) */
.user-info b { max-width: 340px; white-space: normal; overflow-wrap: anywhere; line-height: 1.2; }
.user-info small { opacity: .8; font-size: 12px; }
.btn-hdr { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.55); color: #fff; padding: 10px 18px; border-radius: 999px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn-hdr:hover { background: rgba(255,255,255,.2); }
.hdr-menu { display: none; background: none; border: 0; color: #fff; font-size: 24px; cursor: pointer; }

/* ---------- Sidebar ---------- */
.layout { display: flex; flex: 1; }
#sidebar { width: 128px; background: rgba(255,255,255,.92); backdrop-filter: blur(6px); border-right: 1px solid var(--border); flex-shrink: 0; position: sticky; top: 88px; height: calc(100vh - 88px - 44px); overflow-y: auto; }
#nav { display: flex; flex-direction: column; padding: 8px 0; }
#nav a { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px; text-decoration: none; color: var(--text); font-size: 12.5px; font-weight: 500; text-align: center; line-height: 1.25; border-left: 4px solid transparent; }
#nav a .ic { font-size: 24px; line-height: 1; filter: grayscale(.35); }
#nav a:hover { background: #f3f6fd; }
#nav a.active { background: var(--teal-soft); border-left-color: var(--red); color: var(--teal-dark); font-weight: 700; }
#nav a.active .ic { filter: none; }

/* ---------- Kandungan ---------- */
main { flex: 1; min-width: 0; padding: 26px 36px 40px; }
.crumb { font-size: 13px; font-weight: 600; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.crumb b { color: var(--teal-dark); }
.page-title { display: flex; align-items: center; gap: 12px; margin: 10px 0 4px; font-size: 30px; font-weight: 800; color: var(--navy); text-transform: uppercase; border-left: 6px solid var(--red); padding-left: 14px; line-height: 1.1; }
.page-title .dot { width: 14px; height: 14px; background: var(--teal); border-radius: 4px; display: inline-block; }
.page-desc { margin: 0 0 20px 20px; color: var(--muted); font-size: 15px; }
.panel { background: rgba(255,255,255,.95); border-radius: 18px; padding: 24px; box-shadow: 0 4px 24px rgba(20,40,107,.12); }

/* Bar alat */
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.toolbar input, .toolbar select { width: auto; min-width: 200px; flex: 1; max-width: 340px; }
.toolbar .spacer { flex: 1; }

/* Jadual */
.table-wrap { background: var(--card); border-radius: 14px; border: 1px solid var(--border); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--teal-soft); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--teal-dark); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcfd; }
td.actions { white-space: nowrap; text-align: right; }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.count { color: var(--muted); margin: 0 0 8px; }
a { color: var(--teal-dark); }

/* Papan pemuka */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat { background: var(--card); border: 1px solid var(--border); border-left: 5px solid var(--teal); border-radius: 14px; padding: 16px 18px; text-decoration: none; color: inherit; transition: transform .1s; }
.stat:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(20,40,107,.1); }
.stat .num { font-size: 30px; font-weight: 800; color: var(--navy); }
.stat .lbl { color: var(--muted); font-size: 13px; }
h3.section { margin: 8px 0 12px; color: var(--navy); }

/* Kehadiran */
.radio-group { display: flex; gap: 12px; flex-wrap: wrap; }
.radio-group label { flex-direction: row; align-items: center; gap: 4px; font-weight: 400; }
.radio-group input { width: auto; }
.summary { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.pill { padding: 5px 14px; border-radius: 999px; background: var(--teal-soft); color: var(--teal-dark); font-weight: 600; font-size: 13px; }

/* Tab */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 18px; flex-wrap: wrap; }
.tab { background: none; border: 0; padding: 10px 18px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tab:hover { color: var(--teal-dark); }
.tab.active { color: var(--teal-dark); border-bottom-color: var(--teal); }

/* Carta bar bulanan */
.chart { padding: 10px 0 0 44px; margin-bottom: 8px; }
.chart-plot { position: relative; height: 260px; border-bottom: 1px solid #9fb3c0; }
.gridline { position: absolute; left: 0; right: 0; border-top: 1px solid #e6edf1; }
.gridline span { position: absolute; left: -44px; top: -9px; width: 36px; text-align: right; font-size: 11px; color: var(--muted); }
.bars { position: absolute; inset: 0; display: flex; gap: 2px; }
.bar-col { flex: 1; display: flex; align-items: flex-end; justify-content: center; border-radius: 6px 6px 0 0; outline: none; }
.bar-col:hover, .bar-col:focus-visible { background: rgba(29,63,156,.07); }
.bar { width: 56%; max-width: 40px; background: var(--teal); border-radius: 4px 4px 0 0; }
.bar-col:hover .bar, .bar-col:focus-visible .bar { background: var(--teal-dark); }
.xaxis { display: flex; gap: 2px; padding-top: 6px; }
.xaxis span { flex: 1; text-align: center; font-size: 12px; font-weight: 600; }
.chart-tip { position: absolute; transform: translate(-50%, -100%); background: var(--navy); color: #fff; padding: 6px 10px; border-radius: 8px; font-size: 12px; white-space: nowrap; pointer-events: none; z-index: 2; box-shadow: 0 4px 12px rgba(0,0,0,.2); }

/* Jadual peratus */
.pct-table td.num, .pct-table th.num, td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pct-table td.low, td.kb-p.low { color: var(--danger); font-weight: 600; }
.pct-table .total-row td { background: var(--teal-soft); font-weight: 700; border-top: 2px solid var(--teal); }

/* Galeri */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.gallery figure { margin: 0; background: var(--card); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.gallery img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: #e5e7eb; }
.gallery figcaption { padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.gallery p { margin: 0; color: var(--muted); }

/* Footer */
.ftr { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 28px; background: linear-gradient(90deg, var(--navy) 0%, var(--teal) 55%, var(--red) 100%); color: #fff; font-size: 13px; font-weight: 500; position: sticky; bottom: 0; z-index: 20; }
.live { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #2ecc71; margin-right: 6px; box-shadow: 0 0 0 3px rgba(46,204,113,.25); }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(12,20,50,.5); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal-box { background: #fff; border-radius: 18px; padding: 26px; width: 100%; max-width: 580px; max-height: 90vh; overflow-y: auto; }
.modal-box h3 { margin-top: 0; color: var(--navy); }
.modal-box.wide { max-width: 900px; }
#modal-form { display: flex; flex-direction: column; gap: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

/* Toast */
.toast { position: fixed; bottom: 60px; right: 20px; background: var(--ok); color: #fff; padding: 12px 18px; border-radius: 12px; z-index: 100; box-shadow: 0 4px 16px rgba(0,0,0,.2); max-width: 90vw; }
.toast.err { background: var(--danger); }

.setup { max-width: 600px; margin: 60px auto; padding: 24px; background: #fff3cd; border: 1px solid #ffe08a; border-radius: 12px; font-size: 16px; line-height: 1.6; }

/* Borang tandatangan */
.sign-box { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 10px; margin: 0; }
.sign-box legend { font-weight: 700; color: var(--teal-dark); padding: 0 6px; }

/* ---------- LAPORAN PDF (cetak) ---------- */
#print-area { display: none; }

@media print {
  @page {
    size: A4 landscape;
    margin: 10mm 12mm 14mm;
    @bottom-left { content: "Dijana oleh Sistem HEM · SK Seri Kota Puteri 4"; font: 8pt "Poppins", sans-serif; color: #5f7385; }
    @bottom-right { content: "Muka surat " counter(page) " / " counter(pages); font: 8pt "Poppins", sans-serif; color: #5f7385; }
  }
  html, body { background: #fff !important; }
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

.rpt { color: #16324a; font-size: 9pt; }
.rpt-page.brk { break-before: page; }
.rpt-head { display: flex; align-items: center; gap: 14px; padding-bottom: 8px; border-bottom: 3px double #14286b; }
.rpt-logos { display: flex; align-items: center; gap: 8px; }
.rpt-logos img { height: 56px; width: auto; }
.rpt-logos img.round { border-radius: 50%; }
.rpt-org { flex: 1; text-align: center; padding-right: 150px; }
.rpt-org .o1 { font-size: 15pt; font-weight: 800; color: #14286b; letter-spacing: .02em; }
.rpt-org .o2 { font-size: 9.5pt; font-weight: 700; color: #152f7a; letter-spacing: .08em; }
.rpt-org .o3 { font-size: 8pt; color: #5f7385; letter-spacing: .1em; }
.rpt-title { text-align: center; font-size: 14pt; margin: 10px 0 0; color: #14286b; letter-spacing: .03em; }
.rpt-sub { text-align: center; margin: 2px 0 10px; color: #5f7385; font-weight: 600; }
.rpt-h2 { font-size: 10pt; margin: 0 0 6px; color: #14286b; text-transform: uppercase; letter-spacing: .03em; border-left: 4px solid #d0202e; padding-left: 8px; }
.rpt-h2.big { font-size: 11.5pt; margin: 10px 0 8px; }

.rpt-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.rc { border: 1px solid #dce6ec; border-left: 4px solid #1d3f9c; border-radius: 8px; padding: 6px 10px; }
.rc-l { font-size: 8pt; color: #5f7385; font-weight: 600; text-transform: uppercase; }
.rc-v { font-size: 17pt; font-weight: 800; color: #14286b; line-height: 1.2; }
.rc-s { font-size: 8pt; color: #5f7385; }

.rpt-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 18px; align-items: start; }

/* Carta cetak */
.pc { padding: 14px 0 0 32px; }
.pc-plot { position: relative; height: 190px; border-bottom: 1px solid #9fb3c0; }
.pc-grid { position: absolute; left: 0; right: 0; border-top: 1px solid #e6edf1; }
.pc-grid span { position: absolute; left: -32px; top: -6px; width: 26px; text-align: right; font-size: 7pt; color: #5f7385; }
.pc-bars { position: absolute; inset: 0; display: flex; gap: 2px; }
.pc-col { flex: 1; display: flex; align-items: flex-end; justify-content: center; }
.pc-bar { width: 60%; background: #1d3f9c; border-radius: 3px 3px 0 0; position: relative; }
.pc-bar span { position: absolute; top: -13px; left: 50%; transform: translateX(-50%); font-size: 6.5pt; font-weight: 700; color: #16324a; white-space: nowrap; }
.pc-x { display: flex; gap: 2px; padding-top: 3px; }
.pc-x span { flex: 1; text-align: center; font-size: 7.5pt; font-weight: 600; }

/* Jadual cetak */
.rt { width: 100%; border-collapse: collapse; font-size: 8.5pt; }
.rt th { background: #14286b; color: #fff; font-weight: 600; padding: 4px 6px; text-align: left; font-size: 8pt; text-transform: none; letter-spacing: 0; }
.rt td { padding: 3px 6px; border-bottom: 1px solid #dce6ec; }
.rt .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rt tbody tr:nth-child(even) td { background: #f5f7fc; }
.rt td.low { color: #c0392b; font-weight: 700; }
.rt td.dim { color: #9aa9b5; }
.rt td.strong { font-weight: 700; }
.rt tr.tot td { background: #e9eefb !important; font-weight: 800; border-top: 2px solid #1d3f9c; border-bottom: 2px solid #1d3f9c; }
.rt.kelas td, .rt.kelas th { padding: 4px 5px; }

.rpt-notes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 3px 24px; margin: 10px 0 0; font-size: 8.5pt; padding: 8px 12px; background: #f5f7fc; border-radius: 6px; }

.rpt-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 80px; margin-top: 22px; padding: 0 30px; break-inside: avoid; }
.sg-l { font-weight: 700; margin-bottom: 38px; }
.sg-line { border-bottom: 1px dotted #16324a; width: 75%; margin-bottom: 4px; }
.sg-n { font-weight: 700; }
.sg-j { font-size: 8.5pt; }
.sg-t { font-size: 8.5pt; margin-top: 6px; }
.rpt-gen { text-align: right; font-size: 7.5pt; color: #5f7385; margin-top: 10px; }

/* ---------- ONE PAGE REPORT (OPR) — A4 794 x 1123 px ---------- */
/* Warna lalai tema SRBJ — ditukar melalui pilihan Tema (OPR_TEMA dalam app.js) */
.opr { --o-dark: #0f1f57; --o-main: #14286b; --o-mid: #1d3f9c; --o-light: #2a56c9; --o-accd: #a3141f; --o-acc: #d0202e; --o-accl: #ff5a5f; --o-hl: #ffd23f; --o-bg: #eef3fb; --o-border: #d3ddf2; }
.opr { width: 794px; height: 1123px; position: relative; overflow: hidden; background: var(--o-bg); font-family: "Poppins", Arial, sans-serif; color: var(--o-main);
  /* Susunan menegak: tinggi setiap bahagian ikut isi; ruang badan (gambar) ambil baki ruang */
  display: flex; flex-direction: column; padding-top: 276px; --fs: 1; }
.opr * { box-sizing: border-box; }
.opr-hdr { position: absolute; left: 0; right: 0; top: 0; height: 128px; background: #fff; overflow: hidden; }
.opr-hdr-photo { position: absolute; right: 0; top: 0; width: 380px; height: 128px; background: url("img/bg-sekolah.png") center 40% / cover no-repeat; }
.opr-hdr-fade { position: absolute; right: 200px; top: 0; width: 180px; height: 128px; background: linear-gradient(90deg, #fff 0%, rgba(255,255,255,.85) 35%, rgba(255,255,255,0) 100%); }
.opr-hdr-stripe { position: absolute; right: 0; top: 0; width: 380px; height: 10px; background: linear-gradient(90deg, var(--o-acc), var(--o-mid)); }
.opr-brand { position: absolute; left: 26px; top: 22px; display: flex; align-items: center; gap: 10px; }
.opr-brand img { height: 70px; width: auto; }
.opr-brand img.srbj { height: 58px; }
.opr-brand .nm { font-weight: 800; font-size: 19px; line-height: 1.1; color: var(--o-main); }
.opr-brand .nm small { display: block; font-size: 12px; font-weight: 700; letter-spacing: .04em; margin-top: 2px; }
.opr-brand .sep { width: 2px; height: 56px; background: var(--o-main); margin: 0 6px; }

.opr-title { position: absolute; left: 0; right: 0; top: 128px; height: 132px; padding: 30px 30px 0 120px; display: flex; align-items: center;
  background: linear-gradient(100deg, var(--o-dark) 0%, var(--o-main) 35%, var(--o-mid) 75%, var(--o-light) 100%); color: #fff; }
.opr-title::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: linear-gradient(90deg, var(--o-accd), var(--o-acc) 60%, var(--o-accl)); }
.opr-title::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 7px; background: linear-gradient(90deg, var(--o-acc), var(--o-accl) 50%, var(--o-acc)); }
.opr-pill { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); background: #fff; color: var(--o-main); border: 2px solid var(--o-main); border-radius: 999px; padding: 3px 22px; font-weight: 800; font-size: 13px; white-space: nowrap; }
.opr-title .ic { position: absolute; left: 30px; top: 42px; font-size: 62px; line-height: 1; }
.opr-title h1 { margin: 0; font-style: italic; font-weight: 900; text-transform: uppercase; line-height: 1.08; letter-spacing: .01em; color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,.25); }
.opr-title .hl { color: var(--o-hl); }

.opr-body { flex: 1 1 auto; min-height: 0; margin-bottom: 8px; display: grid; grid-template-columns: var(--lw, 244px) 1fr; grid-template-rows: minmax(0, 1fr); gap: 14px; padding: 0 18px; overflow: hidden; }
.opr.kkp .opr-card { margin-bottom: 9px; }
.opr.kkp .opr-card-b { padding: 7px 12px; line-height: 1.4; }
.opr.kkp .opr-info > div { margin-bottom: 2px; }
.opr.kkp .opr-chk li { margin-bottom: 3px; }
/* Saiz huruf boleh dikecilkan oleh muatOPR() (--fs) jika isi terlalu panjang */
.opr-body .opr-card-b { font-size: calc(11.5px * var(--fs)); }
.opr-kkp { flex: none; margin: 0 18px 6px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; align-items: stretch; }
.opr-kkp .k { background: #fff; border-radius: 12px; border: 1px solid var(--o-border); box-shadow: 0 2px 8px rgba(0,0,0,.08); overflow: hidden; }
.opr-kkp .k-h { display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; color: #fff; font-weight: 800; font-size: 12.5px; letter-spacing: .02em; }
.opr-kkp .k-h .i { width: 24px; height: 24px; border-radius: 50%; background: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; }
.opr-kkp .kekuatan .k-h { background: linear-gradient(90deg, #13723a, #1e9e48); }
.opr-kkp .kelemahan .k-h { background: linear-gradient(90deg, var(--o-accd), var(--o-acc)); }
.opr-kkp .baik .k-h { background: linear-gradient(90deg, #c99a00, var(--o-hl)); color: #3a2c00; }
.opr-kkp .k-b { padding: 5px 10px 7px; font-size: calc(10.5px * var(--fs)); line-height: 1.3; color: #1c2b4a; }
.opr-kkp ul { margin: 0; padding-left: 15px; }
.opr-kkp li { margin-bottom: 2px; }
.opr-left, .opr-right { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.opr-left > .opr-card:last-child, .opr-right > .opr-card:last-child { margin-bottom: 0; }
.opr-grow { flex: 1 1 auto; min-height: 60px; display: flex; flex-direction: column; }
.opr-grow > .opr-card-b { flex: 1 1 auto; min-height: 0; }
.opr-card { background: #fff; border-radius: 12px; border: 1px solid var(--o-border); box-shadow: 0 2px 8px rgba(0,0,0,.08); overflow: hidden; margin-bottom: 12px; }
.opr-card-h { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; background: linear-gradient(90deg, var(--o-main), var(--o-mid)); color: #fff; font-weight: 800; font-size: 14px; letter-spacing: .02em; }
.opr-card-h.red { background: linear-gradient(90deg, var(--o-accd), var(--o-acc)); }
.opr-card-h .i, .opr-foot-h .i { width: 30px; height: 30px; border-radius: 50%; background: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.opr-card-b { padding: 9px 12px; font-size: 11.5px; line-height: 1.45; color: #1c2b4a; }
.opr-clamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: var(--lines, 5); overflow: hidden; }
.opr-clip { overflow: hidden; }
.opr-dim { margin: 0; color: #8a97b0; }
.opr-chk { list-style: none; margin: 0; padding: 0; }
.opr-chk li { position: relative; padding-left: 22px; margin-bottom: 5px; }
.opr-chk li::before { content: "✓"; position: absolute; left: 0; top: 1px; width: 16px; height: 16px; border-radius: 50%; background: #1e9e48; color: #fff; font-size: 10px; font-weight: 900; line-height: 16px; text-align: center; }
.opr-info > div { display: flex; gap: 6px; margin-bottom: 4px; }
.opr-photos { display: grid; gap: 10px; flex: 1 1 auto; min-height: 0; grid-auto-rows: minmax(0, 1fr); }
.opr-ph { background: #fff; border-radius: 10px; padding: 5px; border: 1px solid var(--o-border); box-shadow: 0 2px 8px rgba(0,0,0,.08); text-align: center; display: flex; flex-direction: column; min-height: 0; }
.opr-ph .img { width: 100%; flex: 1 1 auto; min-height: 0; border-radius: 6px; background: var(--o-border) center 35% / cover no-repeat; }
.opr-ph span { align-self: center; flex-shrink: 0; display: inline-block; margin-top: 5px; max-width: 100%; background: linear-gradient(90deg, var(--o-main), var(--o-mid)); color: #fff; border-radius: 999px; padding: 3px 14px; font-size: 10.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.opr-foot { position: relative; flex: none; display: grid; grid-template-columns: 1fr 1fr; gap: 22px; padding: 16px 24px 12px;
  background: linear-gradient(100deg, var(--o-dark), var(--o-main) 40%, var(--o-mid) 80%, var(--o-light)); color: #fff; font-size: calc(11.5px * var(--fs)); line-height: 1.45; }
.opr-foot::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: linear-gradient(90deg, var(--o-acc), var(--o-accl), var(--o-acc)); }
.opr-foot-h { display: inline-flex; align-items: center; gap: 8px; font-weight: 900; font-size: 17px; font-style: italic; margin-bottom: 8px; }
.opr-foot-h.yellow { background: var(--o-hl); color: var(--o-main); border-radius: 999px; padding: 2px 16px 2px 3px; font-size: 15px; }
.opr-foot .opr-chk li::before { background: var(--o-hl); color: var(--o-main); }
.opr-kes { color: #fff; }
.opr-credit { flex: none; height: 26px; background: var(--o-acc); color: #fff; font-size: 10.5px; display: flex; justify-content: space-between; align-items: center; padding: 0 18px; }

/* Pratonton OPR dalam modal */
.opr-frame { width: 100%; overflow: hidden; border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,.15); }
.opr-scale { width: 794px; transform-origin: top left; }
/* Cetak OPR: A4 menegak tanpa jidar */
@page opr { size: A4 portrait; margin: 0; @bottom-left { content: none; } @bottom-right { content: none; } }
.opr-print { page: opr; }

/* ---------- SIJIL BERHENTI SEKOLAH — A4 potret 794 x 1123 px ---------- */
.sijil { position: relative; width: 794px; height: 1123px; box-sizing: border-box; padding: 50px 64px 0 80px; background: #fff; color: #111;
  font-family: Arial, Helvetica, sans-serif; font-size: 14px; overflow: hidden; }
.sj-siri { position: absolute; top: 56px; right: 64px; font-family: "Times New Roman", Times, serif; font-weight: 700; font-size: 17px; }
.sj-siri span { color: #e00000; }
.sj-logo { display: block; height: 108px; width: auto; margin: 14px auto 0; }
.sijil h1 { margin: 20px 0 0; text-align: center; font-size: 21px; font-weight: 700; letter-spacing: .01em; }
.sijil h2 { margin: 14px 0 0; text-align: center; font-size: 14.5px; font-weight: 700; line-height: 1.4; }
.sj-body { margin-top: 28px; }
.sj-row { display: flex; gap: 18px; margin-bottom: 9px; }
.sj-f { display: flex; align-items: flex-end; flex: 1; min-width: 0; }
.sj-l { white-space: nowrap; padding-right: 4px; }
.sj-v { flex: 1; min-width: 30px; min-height: 17px; padding: 0 10px 1px; border-bottom: 1px dashed #222; text-transform: uppercase; line-height: 1.25; }
.sj-sub { display: flex; align-items: flex-end; margin: 0 0 6px 96px; }
.sj-sub .sj-v { padding-left: 6px; font-size: 13.5px; }
.sj-sn { width: 24px; }
.sj-sl { width: 128px; }
.sj-ulasan { min-height: 64px; line-height: 32px; border-bottom: 0; padding-top: 2px;
  /* dua garisan putus-putus seperti templat */
  background-image: linear-gradient(90deg, #fff 3px, transparent 3px), linear-gradient(transparent 30px, #222 30px, #222 31px, transparent 31px);
  background-size: 7px 100%, 100% 32px; }
.sj-ttd { display: flex; justify-content: space-between; margin: 62px 10px 0 70px; text-align: center; line-height: 1.6; }
.sj-ttd > div { width: 270px; }
.sj-ttd > div:first-child { width: 215px; }
.sj-garis { border-top: 1px dashed #222; margin-bottom: 8px; }
.sj-tarikh { width: 230px; margin-top: 18px; }
@page sijil { size: A4 portrait; margin: 0; @bottom-left { content: none; } @bottom-right { content: none; } }
.sijil-print { page: sijil; }

/* ---------- LAPORAN TAKWIM BULANAN — A4 landskap 1123 x 794 px ---------- */
.tkw { width: 1123px; height: 794px; position: relative; overflow: hidden; background: #eef3fb; font-family: "Poppins", Arial, sans-serif; color: #14286b; }
.tkw * { box-sizing: border-box; }
.tkw-hdr { position: absolute; left: 0; right: 0; top: 0; height: 116px; background: #fff; }
.tkw-hdr::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: linear-gradient(90deg, #d0202e, #ff5a5f 40%, #1d3f9c); }
.tkw-brand { position: absolute; left: 12px; top: 8px; width: 270px; text-align: center; }
.tkw-brand .logos { display: flex; justify-content: center; align-items: center; gap: 10px; }
.tkw-brand img { height: 56px; width: auto; }
.tkw-brand img.srbj { height: 48px; }
.tkw-brand .sep { width: 2px; height: 46px; background: #14286b; }
.tkw-brand .n1 { font-weight: 800; font-size: 17px; line-height: 1.15; margin-top: 3px; }
.tkw-brand .n2 { font-weight: 700; font-size: 10.5px; color: #d0202e; letter-spacing: .03em; }
.tkw-band { position: absolute; left: 292px; right: 0; top: 0; height: 111px; overflow: hidden;
  background: linear-gradient(100deg, #0f1f57 0%, #14286b 35%, #1d3f9c 70%, #2a56c9 100%); border-radius: 0 0 0 40px; }
.tkw-photo { position: absolute; right: 0; top: 0; width: 200px; height: 111px; background: url("img/bg-sekolah.png") center 40% / cover no-repeat; }
.tkw-photo-fade { position: absolute; right: 120px; top: 0; width: 80px; height: 111px; background: linear-gradient(90deg, #2a56c9, rgba(42,86,201,0)); }
.tkw-title { position: absolute; left: 34px; top: 16px; font-style: italic; font-weight: 900; font-size: 32px; line-height: 1.08; color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,.25); white-space: nowrap; }
.tkw-month { position: absolute; left: 480px; top: 30px; background: linear-gradient(90deg, #a3141f, #d0202e); color: #ffd23f; border: 3px solid #fff; border-radius: 999px;
  padding: 6px 22px; font-style: italic; font-weight: 900; font-size: 25px; white-space: nowrap; box-shadow: 0 4px 12px rgba(0,0,0,.3); }

/* Tajuk + label bulan sebaris (tajuk unit panjang dikecilkan automatik) */
.tkw-head { position: absolute; left: 34px; right: 110px; top: 0; height: 111px; display: flex; align-items: center; gap: 22px; }
.tkw-head .tkw-title { position: static; flex: 0 1 auto; }
.tkw-head .tkw-month { position: static; flex: none; }
.tkw-list { position: absolute; left: 12px; top: 126px; width: 300px; height: 436px; background: #fff; border-radius: 14px; border: 1px solid #d3ddf2; box-shadow: 0 2px 8px rgba(20,40,107,.12); padding: 8px; overflow: hidden; }
.tkw-list-h { display: flex; align-items: center; gap: 10px; background: linear-gradient(100deg, #14286b, #1d3f9c); color: #fff; border-radius: 10px; padding: 8px 12px; font-weight: 800; font-size: 15px; line-height: 1.15; margin-bottom: 8px; }
.tkw-list-h .ic { font-size: 40px; line-height: 1; }
.tkw-item { display: grid; grid-template-columns: 96px 1fr; gap: 10px; align-items: center; margin-bottom: 7px; }
.tkw-item .d { background: linear-gradient(90deg, #a3141f, #d0202e); color: #fff; border-radius: 8px; padding: 6px 6px; font-weight: 800; font-size: 13px; text-align: center; line-height: 1.15; }
.tkw-item .t { font-size: 12px; font-weight: 600; color: #14286b; line-height: 1.25; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.tkw-list.kecil .tkw-item { margin-bottom: 4px; }
.tkw-list.kecil .tkw-item .d { font-size: 11.5px; padding: 4px; }
.tkw-list.kecil .tkw-item .t { font-size: 11px; -webkit-line-clamp: 2; }

.tkw-photos { position: absolute; left: 322px; right: 12px; top: 126px; height: 436px; display: grid; grid-auto-rows: 1fr; gap: 10px; }
.tkw-ph { position: relative; border-radius: 12px; border: 4px solid #fff; box-shadow: 0 2px 10px rgba(20,40,107,.25); background: #dfe6f3 center / cover no-repeat; overflow: hidden; }
.tkw-ph.kosong { display: grid; place-items: center; color: #8a97b0; font-weight: 600; }
.tkw-ph .cap { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); width: 82%; background: linear-gradient(90deg, #14286b, #1d3f9c); color: #fff; border: 2px solid #fff;
  border-radius: 12px; padding: 4px 10px; font-size: 12px; font-weight: 600; text-align: center; line-height: 1.25; }
.tkw-ph .cap span { font-size: 11px; font-weight: 500; }

.tkw-bottom { position: absolute; left: 12px; right: 12px; top: 572px; height: 190px; display: grid; grid-template-columns: 1fr 1.15fr 1.15fr 150px; gap: 12px; }
.tkw-card { background: #fff; border-radius: 14px; border: 2px solid #f0c64b; padding: 0 12px 8px; position: relative; overflow: hidden; }
.tkw-card.red { border-color: #e7a3a8; }
.tkw-card-h { display: inline-flex; align-items: center; gap: 8px; margin: 8px 0 6px; padding: 2px 16px 2px 3px; border-radius: 999px; font-weight: 900; font-size: 13.5px;
  background: linear-gradient(90deg, #ffd23f, #ffe27a); color: #14286b; }
.tkw-card.red .tkw-card-h { background: linear-gradient(90deg, #a3141f, #d0202e); color: #fff; }
.tkw-card-h .i { width: 26px; height: 26px; border-radius: 50%; background: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; }
.tkw-card-b { font-size: 11px; line-height: 1.4; color: #1c2b4a; }
.tkw-chk { list-style: none; margin: 0; padding: 0; }
.tkw-chk li { position: relative; padding-left: 20px; margin-bottom: 4px; }
.tkw-chk li::before { content: "✓"; position: absolute; left: 0; top: 1px; width: 15px; height: 15px; border-radius: 50%; background: #14286b; color: #fff; font-size: 9px; font-weight: 900; line-height: 15px; text-align: center; }
.tkw-card.red .tkw-chk li::before { background: #d0202e; }
.tkw-slogan { position: relative; border-radius: 14px; overflow: hidden; display: flex; align-items: center; justify-content: center; text-align: center; padding: 12px;
  background: linear-gradient(150deg, #ffd23f 0 16%, #fff 16% 24%, #1d3f9c 24% 38%, #fff 38% 100%); border: 1px solid #d3ddf2; }
.tkw-slogan span { font-style: italic; font-weight: 900; font-size: 16px; line-height: 1.2; color: #14286b; margin-top: 40px; }

.tkw-foot { position: absolute; left: 0; right: 0; bottom: 0; height: 24px; background: linear-gradient(90deg, #14286b, #1d3f9c 60%, #d0202e); color: #fff; font-size: 10.5px;
  display: flex; justify-content: space-between; align-items: center; padding: 0 16px; }

.tkw-frame { width: 100%; overflow: hidden; border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,.15); }
.tkw-scale { width: 1123px; transform-origin: top left; }
@page takwim { size: A4 landscape; margin: 0; @bottom-left { content: none; } @bottom-right { content: none; } }
.tkw-print { page: takwim; }
.tk-prog { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
.tk-prog input { width: auto; }

/* Borang gambar */
.gb-list { display: flex; flex-direction: column; gap: 8px; }
.gb-item { display: grid; grid-template-columns: 90px 1fr auto; gap: 10px; align-items: center; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 6px; }
.gb-thumb { width: 90px; height: 64px; border-radius: 6px; background: #e5e7eb center / cover no-repeat; position: relative; }
.gb-thumb span { position: absolute; left: 4px; top: 4px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px; }
.gb-btns { display: flex; gap: 4px; }

/* Pilihan pelbagai (cth. Bantuan Diterima) */
.fld { display: flex; flex-direction: column; gap: 6px; }
.fld-l { font-weight: 600; font-size: 13px; }
.multi { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 14px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: #fafbfe; }
.multi label { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; font-size: 13px; cursor: pointer; }
.multi input { width: auto; accent-color: var(--teal); }
.badge.s-bantuan { background: #fff4d6; color: #7a5600; margin: 1px 0; }

/* ---------- DASHBOARD (Papan Pemuka) ---------- */
.dash-hello { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; padding: 14px 18px;
  border-radius: 14px; background: linear-gradient(100deg, var(--teal-soft), #fff); border: 1px solid var(--border); }
.dash-hello b { font-size: 17px; color: var(--navy); display: block; }
.dash-hello .muted { font-size: 13px; }
.stat .lbl + .num + .lbl { margin-top: 2px; }
.dash { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.dcard { grid-column: span 4; background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; min-width: 0; }
.dcard.w6 { grid-column: span 6; }
.dcard.w8 { grid-column: span 8; }
.dcard.w12 { grid-column: span 12; }
.dcard-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 12px; font-weight: 700; color: var(--navy); font-size: 15px; }
.dcard-h a { font-size: 12px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.dcard .chart { margin-bottom: 0; }
.dcard .table-wrap { border: 0; }
.dcard td, .dcard th { padding: 8px 10px; font-size: 13px; }

/* Carta bar mendatar */
.hbars { display: flex; flex-direction: column; gap: 7px; }
.hb-row { display: grid; grid-template-columns: minmax(80px, 38%) 1fr 48px; gap: 10px; align-items: center; font-size: 13px; }
.hb-l { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.hb-t { height: 14px; background: #edf1f8; border-radius: 4px; overflow: hidden; }
.hb-f { display: block; height: 100%; background: var(--teal); border-radius: 0 4px 4px 0; }
.hb-f.low { background: var(--danger); }
.hb-v { text-align: right; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }

/* Program terkini */
.dash-prog { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.dp { text-decoration: none; color: inherit; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fff; transition: transform .1s; }
.dp:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(20,40,107,.12); }
.dp .img { aspect-ratio: 16 / 10; background: #e5e7eb center / cover no-repeat; }
.dp .t { padding: 8px 10px 0; font-weight: 600; font-size: 13px; line-height: 1.3; }
.dp .s { padding: 2px 10px 10px; font-size: 12px; }

@media (max-width: 1100px) {
  .dcard, .dcard.w6 { grid-column: span 6; }
  .dcard.w8 { grid-column: span 12; }
}
@media (max-width: 760px) {
  .dcard, .dcard.w6, .dcard.w8 { grid-column: span 12; }
}

/* ---------- Kebajikan & Bantuan: butang jenis bantuan ---------- */
.bt-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin-bottom: 12px; }
.bt-head b { font-size: 16px; color: var(--navy); }
.bt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; }
.bt-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 8px 10px; border: 1px solid var(--border);
  border-bottom: 4px solid var(--teal); border-radius: 14px; background: #fff; cursor: pointer; font: inherit; color: var(--text); transition: transform .1s; }
.bt-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(20,40,107,.12); }
.bt-btn .ic { font-size: 26px; line-height: 1; }
.bt-btn .nm { font-size: 12px; font-weight: 700; text-align: center; line-height: 1.25; min-height: 2.5em; display: flex; align-items: center; }
.bt-btn .n { font-size: 20px; font-weight: 800; color: var(--navy); }
.bt-btn.active { background: var(--teal); border-color: var(--teal); border-bottom-color: var(--red); color: #fff; }
.bt-btn.active .n { color: #ffd23f; }
.bt-panel { margin-top: 16px; padding: 14px; border: 1px solid var(--border); border-left: 5px solid var(--red); border-radius: 14px; background: #fafbfe; }

/* Butang penapis kelas */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 14px; }
.chip { border: 1px solid var(--border); background: #fff; color: var(--text); border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.chip b { display: inline-block; min-width: 22px; margin-left: 4px; padding: 0 6px; border-radius: 999px; background: var(--teal-soft); color: var(--teal-dark); font-size: 12px; }
.chip:hover { border-color: var(--teal); }
.chip.active { background: var(--teal); border-color: var(--teal); color: #fff; }
.chip.active b { background: rgba(255,255,255,.25); color: #fff; }

/* Kad sandaran */
.backup-card { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; border: 1px solid var(--border); border-left: 5px solid var(--teal); border-radius: 14px; padding: 18px 20px; margin-bottom: 12px; background: #fff; }

/* Lencana status */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef2f7; white-space: nowrap; }
.badge.s-baharu { background: #fdecea; color: #a93226; }
.badge.s-dalam-siasatan { background: #fff4d6; color: #8a6100; }
.badge.s-selesai { background: #e3f5ea; color: #1e7b45; }

/* ---------- MAKLUMAN SEGERA (cetak, A4 menegak) ---------- */
@page makluman {
  size: A4 portrait; margin: 16mm 20mm 18mm;
  @bottom-left { content: none; }
  @bottom-right { content: "Muka surat " counter(page) " / " counter(pages); font: 8pt Arial, sans-serif; color: #555; }
}
.mk { page: makluman; font-family: Arial, "Helvetica", sans-serif; font-size: 11pt; line-height: 1.45; color: #000; }
/* Kepala surat sekolah */
.mk-lh { text-align: center; border-bottom: 1.5px solid #000; padding-bottom: 6px; margin-bottom: 6px; }
.mk-lh-logos { display: flex; justify-content: center; align-items: center; gap: 10px; margin-bottom: 4px; }
.mk-lh-logos img { height: 58px; width: auto; }
.mk-lh-name { font-weight: 700; font-size: 12.5pt; }
.mk-lh-addr { font-size: 7.5pt; line-height: 1.25; }
.mk-sulit { text-align: center; font-weight: 700; font-size: 11pt; margin-bottom: 14px; }
.mk-sulit.bottom { margin: 22px 0 0; }
.mk-head { text-align: center; }
.mk-jpn { font-weight: 700; font-size: 12.5pt; }
.mk-title { text-align: center; font-family: "Arial Black", Arial, sans-serif; font-weight: 900; font-size: 15pt; text-decoration: underline; margin: 14px 0 0; letter-spacing: .03em; }
.mk-subtitle { text-align: center; font-family: "Arial Black", Arial, sans-serif; font-weight: 900; font-size: 8.5pt; letter-spacing: .08em; margin-bottom: 14px; }
.mk-salam { margin: 0 0 12px; }
.mk-row { margin-bottom: 10px; }
.mk-sec { margin-bottom: 10px; }
.mk-h { font-weight: 700; margin-bottom: 3px; break-after: avoid; }
.mk-note { font-weight: 400; font-size: 8.5pt; }
.mk-li { display: grid; grid-template-columns: 30px 1fr; padding-left: 22px; break-inside: avoid; }
.mk-person { padding-left: 22px; margin: 6px 0 12px; break-inside: avoid; }
.mk-plabel { text-decoration: underline; }
.mk-plines { padding-left: 40px; }
.mk-sumber { margin-top: 16px; }
.mk-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 16px; break-inside: avoid; }
.mk-sl { border-bottom: 1px dotted #000; height: 38px; width: 85%; }
.mk-sn { font-weight: 700; margin-top: 4px; text-transform: uppercase; }
.mk-tarikh { margin-top: 18px; }

/* Borang Keselamatan */
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.ks-pane { display: flex; flex-direction: column; gap: 12px; }
.ks-group { border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px; background: #fafbfe; }
.ks-group-h { font-weight: 700; color: var(--navy); }
.person { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: #fff; display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.person-head { display: flex; justify-content: space-between; align-items: center; }
.stage-list { display: grid; gap: 10px; margin: 6px 0; }
.stage-btn { text-align: left; border: 1px solid var(--border); border-left: 5px solid var(--teal); border-radius: 12px; padding: 12px 16px; background: #fff; cursor: pointer; font: inherit; display: flex; flex-direction: column; gap: 2px; }
.stage-btn:hover:not(:disabled) { background: var(--teal-soft); }
.stage-btn span { color: var(--muted); font-size: 13px; }
.stage-btn small { color: var(--danger); }
.stage-btn:disabled { opacity: .55; cursor: not-allowed; border-left-color: var(--border); }

/* ---------- Skrin kecil ---------- */
@media (max-width: 1100px) {
  .user-info { display: none; }
}
@media (max-width: 860px) {
  .hdr { padding: 10px 14px; gap: 10px; }
  .hdr-menu { display: block; }
  .logo { height: 44px; }
  .logo.srbj { height: 36px; }
  .hdr-title { font-size: 16px; }
  .hdr-sub { font-size: 10px; letter-spacing: .06em; }
  .avatar, #pass-btn { display: none; }
  .hdr { padding-top: max(10px, env(safe-area-inset-top)); }
  .btn-hdr { padding: 8px 12px; font-size: 12px; }
  #sidebar { position: fixed; left: 0; top: 66px; height: calc(100vh - 66px); z-index: 25; transform: translateX(-100%); transition: transform .2s; }
  #sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,.2); }
  main { padding: 18px 16px 30px; }
  .page-title { font-size: 22px; }
  .page-desc { margin-left: 0; }
  .panel { padding: 16px; }
  .toolbar input, .toolbar select { max-width: none; }
}
@media (max-width: 520px) {
  .logo.srbj { display: none; }
  .ftr { padding: 10px 16px; font-size: 11px; }
}

/* Pilihan tema warna OPR */
.tema-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; max-height: 236px; overflow-y: auto; padding: 2px 4px 2px 2px; }
.tema-opt { flex-direction: row !important; align-items: center; gap: 8px !important; padding: 6px 10px; border: 2px solid var(--border); border-radius: 10px;
  background: #fff; cursor: pointer; font-weight: 500 !important; font-size: 12.5px !important; }
.tema-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.tema-opt .sw { width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; box-shadow: inset 0 0 0 2px rgba(255,255,255,.6), 0 1px 3px rgba(0,0,0,.25); }
.tema-opt:has(input:checked) { border-color: var(--teal); background: var(--teal-soft); font-weight: 700 !important; }
.tema-opt:hover { border-color: var(--teal); }

/* ---------- RMT & Program Susu: tanda kehadiran ---------- */
.am-table td, .am-table th { vertical-align: middle; }
.am-c { text-align: center; width: 110px; }
.am-chk { display: inline-flex; cursor: pointer; }
.am-chk input { position: absolute; opacity: 0; width: 0; height: 0; }
.am-chk span { width: 30px; height: 30px; border-radius: 8px; border: 2px solid #b8c6ec; background: #fff; display: grid; place-items: center; transition: background .1s; }
.am-chk input:checked + span { background: var(--ok); border-color: var(--ok); }
.am-chk input:checked + span::after { content: "✓"; color: #fff; font-weight: 900; font-size: 18px; }
.am-chk input:focus-visible + span { outline: 3px solid #c9d5f3; }
.am-table tbody tr:has(input:checked) td { background: #effaf3; }
.bar.low { background: var(--danger); }
td.low-txt { color: var(--danger); font-weight: 700; }

/* ---------- CARTA ORGANISASI (A4 menegak 794 x 1123 px) ---------- */
.carta { width: 794px; height: 1123px; position: relative; overflow: hidden; background: #fff; font-family: "Poppins", Arial, sans-serif; color: #14286b;
  --c-main: #14286b; --c-mid: #1d3f9c; --c-acc: #d0202e; --c-line: #8aa0d4; }
.carta * { box-sizing: border-box; }
.ct-hdr { display: flex; align-items: center; gap: 14px; padding: 22px 34px 14px; border-bottom: 4px solid var(--c-main); position: relative; }
.ct-hdr::after { content: ""; position: absolute; left: 0; right: 0; bottom: -9px; height: 5px; background: linear-gradient(90deg, var(--c-acc), #ff5a5f 50%, var(--c-mid)); }
.ct-logos { display: flex; align-items: center; gap: 10px; }
.ct-logos img { height: 62px; width: auto; }
.ct-logos img.round { border-radius: 50%; }
.ct-logos img.srbj { height: 50px; }
.ct-sek { font-weight: 800; font-size: 20px; line-height: 1.15; }
.ct-sek small { display: block; font-size: 11px; font-weight: 700; color: var(--c-acc); letter-spacing: .05em; }
.ct-banner { margin: 28px 40px 0; padding: 12px 20px; border-radius: 12px; background: linear-gradient(100deg, #0f1f57, var(--c-main) 40%, var(--c-mid)); color: #fff;
  font-weight: 800; font-size: 17px; text-align: center; letter-spacing: .02em; display: flex; align-items: center; justify-content: center; gap: 10px; box-shadow: 0 4px 12px rgba(20,40,107,.25); }
.ct-banner .ic { font-size: 22px; }
.ct-sub { margin: 12px auto 0; width: fit-content; max-width: 90%; padding: 7px 34px; border-radius: 999px; border: 2px solid var(--c-main); background: #eef3fb;
  font-weight: 800; font-size: 14px; text-align: center; letter-spacing: .03em; }

.ct-body { position: absolute; left: 0; right: 0; top: 268px; bottom: 40px; display: flex; flex-direction: column; align-items: center; gap: 28px; padding: 0 20px; }
.ct-row, .ct-grid { position: relative; margin: 0 auto; }
.ct-row { display: flex; gap: 22px; width: fit-content; }
.ct-grid { display: grid; grid-template-columns: repeat(3, 226px); gap: 14px 20px; }
/* Garis penyambung */
.ct-body > * + *::before { content: ""; position: absolute; left: 50%; top: -28px; height: 14px; border-left: 2px solid var(--c-line); }
.ct-body > .ct-row:not(.ct-multi) + .ct-row:not(.ct-multi)::before { height: 28px; }
.ct-row.ct-multi::after, .ct-grid::after { content: ""; position: absolute; top: -14px; left: 113px; right: 113px; border-top: 2px solid var(--c-line); }
.ct-row.ct-multi > .ct-box::before, .ct-grid > .ct-box::before { content: ""; position: absolute; left: 50%; top: -14px; height: 14px; border-left: 2px solid var(--c-line); }
.ct-grid > .ct-box:nth-child(n+4)::before { display: none; }
.ct-body > .ct-row:first-child::before { display: none; }

.ct-box { position: relative; width: 226px; border: 2px solid var(--c-main); border-radius: 10px; background: #fff; overflow: visible; box-shadow: 0 3px 8px rgba(20,40,107,.12); text-align: center; }
.ct-j { border-radius: 8px 8px 0 0; background: linear-gradient(90deg, var(--c-main), var(--c-mid)); color: #fff; font-weight: 800; font-size: 11px; padding: 6px 8px; letter-spacing: .02em; line-height: 1.25; min-height: 30px; display: flex; align-items: center; justify-content: center; }
.ct-n { padding: 9px 8px; font-size: 11.5px; font-weight: 600; color: #1c2b4a; line-height: 1.3; min-height: 44px; display: flex; align-items: center; justify-content: center; }
.ct-box.utama { width: 290px; border-color: var(--c-acc); }
.ct-box.utama .ct-j { background: linear-gradient(90deg, #a3141f, var(--c-acc)); font-size: 13px; }
.ct-box.utama .ct-n { font-size: 13px; font-weight: 700; }
.ct-box.aras2 .ct-j { background: linear-gradient(90deg, #a3141f, var(--c-acc)); }
.carta.kecil .ct-n { min-height: 34px; padding: 6px; font-size: 10.5px; }
.carta.kecil .ct-j { min-height: 24px; padding: 4px 6px; font-size: 10px; }
.carta.kecil .ct-grid { gap: 10px 20px; }
.ct-foot { position: absolute; left: 0; right: 0; bottom: 0; height: 28px; background: linear-gradient(90deg, var(--c-main), var(--c-mid) 60%, var(--c-acc)); color: #fff;
  font-size: 10.5px; display: flex; justify-content: space-between; align-items: center; padding: 0 20px; }
/* Kotak terakhir yang tinggal seorang diri dalam grid -> di tengah */
.ct-grid > .ct-box:last-child:nth-child(3n+1) { grid-column: 2; }
.ct-grid > .ct-box:last-child:nth-child(3n+1)::before { display: none; }

/* Pengurusan 3K: lencana aspek */
.badge.a-kebersihan { background: #e3f5ea; color: #1e7b45; }
.badge.a-keselamatan { background: #fdecea; color: #a93226; }
.badge.a-keceriaan { background: #fff4d6; color: #8a6100; }

/* Logo Unit dalam OPR (di sebelah logo SRBJ) */
.opr-brand img.unitlogo { height: 60px; width: auto; max-width: 96px; object-fit: contain; }
.opr.ada-lu .opr-brand { gap: 9px; }
.opr.ada-lu .opr-brand .nm { font-size: 17px; }
.opr.ada-lu .opr-hdr-photo { width: 320px; }
.opr.ada-lu .opr-hdr-fade { right: 150px; width: 170px; }

/* Pengurusan Logo Unit */
.lu-list { display: flex; flex-direction: column; gap: 8px; max-height: 52vh; overflow-y: auto; padding-right: 4px; }
.lu-row { display: grid; grid-template-columns: 64px 1fr auto auto; gap: 12px; align-items: center; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.lu-prev { width: 64px; height: 52px; display: grid; place-items: center; background: #f5f7fc; border-radius: 8px; font-size: 10px; text-align: center; }
.lu-prev img { max-width: 60px; max-height: 48px; object-fit: contain; }
