:root{
  --emerald:#075b45;
  --emerald-2:#0d7a60;
  --gold:#d4af37;
  --ink:#17342c;
  --muted:#6c7c77;
  --bg:#eef6f3;
  --card:#ffffff;
  --danger:#b42318;
  --shadow:0 14px 36px rgba(7,91,69,.12);
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{
  margin:0;
  min-height:100vh;
  font-family:Arial,Helvetica,sans-serif;
  color:var(--ink);
  background:
    radial-gradient(circle at 10% 0%,rgba(212,175,55,.18),transparent 28%),
    linear-gradient(180deg,#eaf5f1 0%,#f7faf9 55%,#edf4f1 100%);
}
button,input,select,textarea{font:inherit}
button{cursor:pointer}
.hidden{display:none!important}
.topbar{
  position:sticky;top:0;z-index:20;
  display:flex;align-items:center;justify-content:space-between;
  padding:12px 18px;
  background:linear-gradient(135deg,var(--emerald),#064536);
  color:white;
  box-shadow:0 5px 20px rgba(0,0,0,.15);
}
.brand{display:flex;align-items:center;gap:11px}
.brand-icon{
  width:43px;height:43px;border-radius:14px;
  display:grid;place-items:center;
  font-weight:900;
  background:linear-gradient(145deg,var(--gold),#f2d675);
  color:#16352c;
  border:2px solid rgba(255,255,255,.55);
}
.brand h1{font-size:16px;margin:0;letter-spacing:.4px}
.brand p{font-size:12px;margin:3px 0 0;opacity:.88}
.ghost,.secondary{
  border:1px solid rgba(255,255,255,.4);
  background:rgba(255,255,255,.1);
  color:white;border-radius:10px;padding:9px 13px;font-weight:700;
}
.container{width:min(100%,980px);margin:auto;padding:22px 16px 55px}
.view{display:none}
.view.active{display:block;animation:fade .22s ease}
@keyframes fade{from{opacity:.4;transform:translateY(5px)}to{opacity:1;transform:none}}
.hero{
  padding:28px 22px;
  background:linear-gradient(140deg,rgba(7,91,69,.98),rgba(13,122,96,.92));
  color:white;border-radius:24px;box-shadow:var(--shadow);
  position:relative;overflow:hidden;
}
.hero:after{
  content:"";position:absolute;right:-45px;top:-65px;width:190px;height:190px;
  border:28px solid rgba(212,175,55,.26);border-radius:50%;
}
.eyebrow{display:inline-block;font-size:11px;font-weight:900;letter-spacing:1.4px;color:var(--gold);margin-bottom:8px}
.hero h2,.section-head h2{margin:0 0 8px;font-size:clamp(24px,6vw,38px)}
.hero p{margin:0;max-width:600px;line-height:1.55;opacity:.92}
.menu-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin:18px 0}
.menu-card{
  min-height:145px;border:0;border-radius:20px;padding:20px;
  text-align:left;box-shadow:var(--shadow);display:flex;flex-direction:column;
  justify-content:flex-end;transition:.18s transform;
}
.menu-card:hover{transform:translateY(-2px)}
.menu-card.emerald{background:linear-gradient(145deg,#0d7a60,#075b45);color:white}
.menu-card.gold{background:linear-gradient(145deg,#f2d675,#d4af37);color:#19362e}
.menu-card.slate{background:linear-gradient(145deg,#334b44,#1e332d);color:white}
.menu-icon{font-size:31px;line-height:1;margin-bottom:auto;font-weight:900}
.menu-card b{font-size:17px}
.menu-card small{margin-top:6px;opacity:.8}
.notice{
  background:#fff8df;border:1px solid #ead27a;color:#5e4b10;
  padding:14px 16px;border-radius:14px;line-height:1.45;
}
.section-head{margin:6px 2px 16px}
.section-head h2{font-size:28px}
.inline-head{display:flex;align-items:end;justify-content:space-between;gap:12px}
.card{
  background:var(--card);border:1px solid rgba(7,91,69,.09);
  border-radius:20px;box-shadow:var(--shadow);
}
.form-card{padding:20px}
.narrow{max-width:450px;margin:auto}
label{display:block;font-weight:800;font-size:13px;margin-bottom:15px}
input,select,textarea{
  width:100%;margin-top:7px;padding:13px 14px;
  border:1px solid #cbdad5;border-radius:12px;background:#fbfdfc;
  color:var(--ink);outline:none;
}
input:focus,select:focus,textarea:focus{border-color:var(--emerald-2);box-shadow:0 0 0 3px rgba(13,122,96,.11)}
textarea{resize:vertical}
.two-col{display:grid;grid-template-columns:1fr 1fr;gap:13px}
.primary{
  border:0;border-radius:12px;padding:14px 18px;
  background:linear-gradient(135deg,var(--emerald-2),var(--emerald));
  color:white;font-weight:900;box-shadow:0 8px 18px rgba(7,91,69,.2);
}
.full{width:100%}
.hint{display:block;font-weight:400;color:var(--muted);margin-top:6px}
.image-preview{
  min-height:170px;border-radius:15px;background-size:cover;background-position:center;
  margin:-4px 0 15px;border:2px solid #d7e5e0;
}
.result{margin-top:16px}
.success-box,.error-box,.track-card{
  border-radius:18px;padding:18px;background:white;box-shadow:var(--shadow)
}
.success-box{border-left:6px solid var(--emerald-2)}
.error-box{border-left:6px solid var(--danger);color:var(--danger)}
.ticket-big{font-size:24px;font-weight:900;color:var(--emerald);letter-spacing:.5px;margin:8px 0}
.status-badge,.priority-badge{
  display:inline-block;border-radius:999px;padding:6px 10px;
  font-size:11px;font-weight:900;letter-spacing:.4px;
}
.status-BAHARU{background:#eaf2ff;color:#1d4ed8}
.status-DALAM-SEMAKAN{background:#fff4d6;color:#8a5a00}
.status-DALAM-TINDAKAN{background:#f3e8ff;color:#7e22ce}
.status-SELESAI{background:#dcfce7;color:#166534}
.status-DITOLAK{background:#fee2e2;color:#991b1b}
.priority-KRITIKAL{background:#fee2e2;color:#991b1b}
.priority-SEGERA{background:#fff4d6;color:#92400e}
.priority-BIASA{background:#e7f5ef;color:#166534}
.track-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:15px}
.info{background:#f4f8f6;border-radius:12px;padding:12px}
.info b{display:block;font-size:11px;color:var(--muted);margin-bottom:4px}
.track-images{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:14px}
.track-images img{width:100%;height:180px;object-fit:cover;border-radius:14px;border:1px solid #d3dfdb}
.stats-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:10px;margin-bottom:14px}
.stat{padding:15px;border-radius:16px;background:white;box-shadow:var(--shadow)}
.stat b{font-size:26px;display:block;color:var(--emerald)}
.stat span{font-size:11px;color:var(--muted);font-weight:800}
.toolbar{display:grid;grid-template-columns:1fr 210px;gap:10px;padding:12px;margin-bottom:14px}
.toolbar input,.toolbar select{margin:0}
.report-list{display:grid;gap:12px}
.report-item{background:white;border-radius:17px;padding:16px;box-shadow:var(--shadow);border:1px solid rgba(7,91,69,.08)}
.report-top{display:flex;justify-content:space-between;gap:10px;align-items:flex-start}
.report-item h3{margin:4px 0 6px;font-size:17px}
.report-meta{color:var(--muted);font-size:12px;line-height:1.5}
.report-desc{margin:12px 0;line-height:1.48}
.report-actions{display:flex;gap:8px;flex-wrap:wrap}
.report-actions button,.link-btn{
  border:0;background:#edf5f2;color:var(--emerald);font-weight:800;
  padding:9px 12px;border-radius:10px;text-decoration:none;font-size:12px;
}
.modal{
  position:fixed;inset:0;z-index:100;background:rgba(13,31,26,.58);
  display:grid;place-items:center;padding:16px;
}
.modal-card{
  width:min(100%,540px);max-height:92vh;overflow:auto;
  background:white;border-radius:22px;padding:22px;position:relative;
}
.modal-card h3{margin-top:0}
.modal-close{
  position:absolute;right:14px;top:12px;border:0;background:#eef3f1;
  width:34px;height:34px;border-radius:50%;font-size:22px;
}
.ticket-chip{display:inline-block;background:#eaf5f1;color:var(--emerald);font-weight:900;padding:7px 10px;border-radius:10px;margin-bottom:14px}
.loading{
  position:fixed;inset:0;z-index:200;background:rgba(255,255,255,.82);
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;font-weight:800;
}
.spinner{width:42px;height:42px;border:5px solid #dfece7;border-top-color:var(--emerald);border-radius:50%;animation:spin .8s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
footer{text-align:center;padding:20px;color:var(--muted);font-size:11px}
footer b,footer span{display:block;margin:3px}
@media(max-width:720px){
  .menu-grid{grid-template-columns:1fr}
  .menu-card{min-height:125px}
  .stats-grid{grid-template-columns:repeat(2,1fr)}
  .toolbar{grid-template-columns:1fr}
}
@media(max-width:520px){
  .container{padding:16px 12px 45px}
  .two-col,.track-grid,.track-images{grid-template-columns:1fr}
  .topbar{padding:10px 12px}
  .brand h1{font-size:14px}
  .brand p{font-size:11px}
  .hero{padding:24px 18px}
  .form-card{padding:16px}
  .inline-head{align-items:flex-start;flex-direction:column}
}

.autocomplete-wrap{position:relative}
.suggestions{
  position:absolute;left:0;right:0;top:calc(100% + 4px);z-index:60;
  background:white;border:1px solid #cbdad5;border-radius:14px;
  box-shadow:0 15px 35px rgba(7,91,69,.18);max-height:310px;overflow:auto;
}
.suggestion-item{
  width:100%;border:0;border-bottom:1px solid #edf3f1;background:white;
  padding:12px 14px;text-align:left;display:flex;justify-content:space-between;gap:10px;
}
.suggestion-item:hover{background:#edf7f3}
.suggestion-item b{font-size:13px;color:var(--ink)}
.suggestion-item span{font-size:10px;font-weight:900;color:var(--emerald)}
.suggestion-empty{padding:14px;color:var(--muted)}
.admin-head-actions,.directory-form-actions{display:flex;gap:8px;flex-wrap:wrap}
.dark-text{color:var(--emerald);border-color:#b9cec7;background:#edf5f2}
.directory-item{display:flex;justify-content:space-between;align-items:center;gap:12px}
.directory-item h3{margin:0 0 5px}
.danger-btn{background:#fee2e2!important;color:#991b1b!important}
@media(max-width:520px){.directory-item{align-items:flex-start;flex-direction:column}}

.analysis-controls{padding:16px;margin-bottom:16px}
.analysis-filter-grid{display:grid;grid-template-columns:1fr 1fr 1fr;gap:12px}
.analysis-actions{display:flex;gap:10px;flex-wrap:wrap}
.check-row{display:flex;align-items:center;gap:9px;margin:0 0 15px}
.check-row input{width:auto;margin:0}
.empty-analysis{padding:28px;text-align:center;color:var(--muted)}
.report-paper{background:white;border-radius:20px;padding:24px;box-shadow:var(--shadow)}
.report-print-head{display:flex;align-items:center;gap:16px;border-bottom:3px solid var(--gold);padding-bottom:14px;margin-bottom:18px}
.report-logo{width:62px;height:62px;border-radius:18px;display:grid;place-items:center;font-size:22px;font-weight:900;background:var(--emerald);color:var(--gold)}
.report-print-head h1{font-size:22px;margin:3px 0;color:var(--emerald)}
.report-print-head p,.report-school{margin:0;color:var(--muted);font-size:12px}
.report-school{font-weight:900;letter-spacing:1px}
.report-summary{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin-bottom:18px}
.report-kpi{border:1px solid #dce8e4;background:#f7fbf9;border-radius:13px;padding:12px}
.report-kpi b{display:block;font-size:22px;color:var(--emerald)}
.report-kpi span{font-size:10px;font-weight:900;color:var(--muted)}
.analysis-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.analysis-block{border:1px solid #dce8e4;border-radius:15px;padding:15px;margin-bottom:14px}
.analysis-block h2,.report-table-section h2{font-size:15px;color:var(--emerald);margin:0 0 13px}
.wide-block{grid-column:1/-1}
.bar-row{display:grid;grid-template-columns:minmax(95px,1.1fr) 2fr 34px;gap:8px;align-items:center;margin:8px 0;font-size:11px}
.bar-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.bar-track{height:10px;background:#e5efeb;border-radius:999px;overflow:hidden}
.bar-track i{display:block;height:100%;background:linear-gradient(90deg,var(--emerald),var(--gold));border-radius:999px}
.table-scroll{overflow:auto}
.analysis-table{width:100%;border-collapse:collapse;font-size:10px}
.analysis-table th{background:var(--emerald);color:white;padding:8px 6px;text-align:left}
.analysis-table td{padding:7px 6px;border-bottom:1px solid #e4ece9;vertical-align:top}
.analysis-table .num{text-align:right}
.empty-table,.muted-text{color:var(--muted);padding:12px;text-align:center}
.report-print-footer{display:flex;justify-content:space-between;gap:15px;border-top:1px solid #ccd9d5;padding-top:11px;margin-top:16px;font-size:9px;color:var(--muted)}
@media(max-width:720px){
  .analysis-filter-grid,.analysis-grid{grid-template-columns:1fr}
  .report-summary{grid-template-columns:repeat(2,1fr)}
  .report-paper{padding:16px}
}
@media print{
  @page{size:A4 landscape;margin:10mm}
  body{background:white}
  .topbar,.no-print,footer,.loading{display:none!important}
  .container{width:100%;max-width:none;padding:0;margin:0}
  .view{display:none!important}
  #view-analysis{display:block!important}
  #printArea,.report-paper{display:block!important;box-shadow:none;border-radius:0;padding:0}
  .report-print-head{margin-top:0}
  .analysis-grid{grid-template-columns:1fr 1fr}
  .report-summary{grid-template-columns:repeat(6,1fr)}
  .report-kpi{padding:8px}
  .report-kpi b{font-size:16px}
  .analysis-block{break-inside:avoid;padding:10px;margin-bottom:9px}
  .analysis-table{font-size:8px}
  .analysis-table th,.analysis-table td{padding:5px 4px}
  .report-table-section{break-before:auto}
  .report-print-footer{position:relative}
}

.multi-check-list{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:-4px 0 14px}
.multi-check-item{display:flex!important;flex-direction:row!important;align-items:flex-start;gap:8px;border:1px solid #d9e4e0;border-radius:12px;padding:10px;background:#f8fbfa}
.multi-check-item input{width:auto;margin-top:2px}.multi-check-item span{display:flex;flex-direction:column;gap:2px}
.multi-check-item small{color:var(--muted);font-size:10px}.archive-btn{background:#6b7280!important;color:#fff!important}
.archived-item{opacity:.95;border-left:5px solid #6b7280}
@media(max-width:600px){.multi-check-list{grid-template-columns:1fr}}

.task-button{border-color:#d4af37!important}
.task-item{border-left:5px solid var(--gold)}
.task-note{margin:12px 0;padding:11px;border-radius:12px;background:#f5f8f7;font-size:12px;line-height:1.5}
.completed-label{font-size:12px;font-weight:900;color:#087f5b}
.empty-task{padding:24px;text-align:center;color:var(--muted)}
.text-link{display:inline-block;margin-top:8px;color:var(--emerald);font-size:12px;font-weight:800}
#taskActionModal .modal-card{max-width:560px}

.telegram-btn{border-color:#249bd7!important}
.report-print-btn{border-color:#d4af37!important;font-weight:900!important}
.notification-actions{display:flex;flex-wrap:wrap;gap:10px}
.notification-member{border-left:5px solid #249bd7}
.recent-telegram{padding:20px;margin-bottom:18px}
.recent-chat-row{display:grid;grid-template-columns:1fr auto auto;gap:10px;align-items:center;padding:12px 0;border-bottom:1px solid #e5ece9}
.recent-chat-row div{display:flex;flex-direction:column}.recent-chat-row small{color:var(--muted)}
.recent-chat-row code{background:#eef5f3;padding:8px;border-radius:8px}
.compact-head{margin-top:24px}
@media(max-width:650px){.recent-chat-row{grid-template-columns:1fr}.notification-actions>*{width:100%}}

/* LOGO RASMI SMK AGAMA KERIAN */
.school-logo-wrap{
  width:54px!important;
  height:54px!important;
  padding:3px!important;
  border-radius:14px!important;
  background:#ffffff!important;
  overflow:hidden;
}
.school-logo{
  width:100%;
  height:100%;
  object-fit:contain;
  display:block;
}
.report-logo{
  width:76px!important;
  height:76px!important;
  padding:4px!important;
  border-radius:14px!important;
  background:#ffffff!important;
  border:1px solid #d7e5e0;
  flex:0 0 76px;
}
.report-logo img{
  width:100%;
  height:100%;
  object-fit:contain;
  display:block;
}
@media(max-width:520px){
  .school-logo-wrap{width:46px!important;height:46px!important}
}
@media print{
  .report-logo{
    width:68px!important;
    height:68px!important;
    flex-basis:68px;
    border:none;
    padding:0!important;
  }
}


/* === v4.4: BUTANG DASHBOARD PENTADBIR JELAS === */
#view-admin .admin-head-actions{
  display:grid !important;
  grid-template-columns:repeat(2,minmax(210px,1fr));
  gap:10px;
  width:min(100%,660px);
  align-items:stretch;
}

#view-admin .admin-head-actions button{
  min-height:50px;
  padding:12px 16px;
  border-radius:14px;
  font-weight:900 !important;
  opacity:1 !important;
  text-shadow:none !important;
  box-shadow:0 8px 18px rgba(7,91,69,.12);
}

/* Laporan */
#view-admin .report-print-btn{
  background:linear-gradient(135deg,#f5dc7c,#d4af37) !important;
  color:#17342c !important;
  border:2px solid #c89f20 !important;
}

/* Telegram */
#view-admin .telegram-btn{
  background:linear-gradient(135deg,#2ca5e0,#168dcc) !important;
  color:#ffffff !important;
  border:2px solid #168dcc !important;
}

/* Arkib */
#view-admin button[onclick*="showArchivedReports"]{
  background:#6b7280 !important;
  color:#ffffff !important;
  border:2px solid #59606c !important;
}

/* Urus Guru & Staf */
#view-admin button[onclick*="showDirectoryAdmin"]{
  background:linear-gradient(135deg,#0d7a60,#075b45) !important;
  color:#ffffff !important;
  border:2px solid #075b45 !important;
}

/* Muat semula */
#view-admin button[onclick*="loadAdminDashboard"]{
  background:#ffffff !important;
  color:#075b45 !important;
  border:2px solid #9bbdb2 !important;
}

/* Hover */
#view-admin .admin-head-actions button:hover{
  transform:translateY(-2px);
  filter:brightness(.97);
}

/* Secondary buttons outside top admin menu */
#view-notification .secondary,
#view-analysis .secondary,
#view-archive .secondary,
#view-directory .secondary{
  background:#ffffff !important;
  color:#075b45 !important;
  border:2px solid #b9cec7 !important;
  font-weight:900 !important;
}

@media(max-width:760px){
  #view-admin .admin-head-actions{
    grid-template-columns:1fr;
    width:100%;
  }
}


/* === v4.5: LOGO PENUH DAN SENARAI PENTADBIR === */
.topbar{
  min-height:92px;
}
.school-logo-wrap{
  width:76px!important;
  height:76px!important;
  padding:2px!important;
  border-radius:12px!important;
  background:#ffffff!important;
  border:2px solid rgba(255,255,255,.85)!important;
}
.school-logo{
  width:100%!important;
  height:100%!important;
  object-fit:contain!important;
  object-position:center!important;
}
.brand{gap:14px}
.brand h1{font-size:20px}
.brand p{font-size:13px}
.notification-admin{border-left:5px solid var(--gold)}
.add-admin-btn{margin:12px 0 22px;background:#fff!important;color:var(--emerald)!important;border:2px dashed var(--gold)!important}
.remove-admin-btn{border:0;border-radius:10px;padding:8px 11px;font-weight:900}
@media(max-width:520px){
  .topbar{min-height:76px}
  .school-logo-wrap{width:62px!important;height:62px!important}
  .brand h1{font-size:16px}
  .brand p{font-size:11px}
}


/* === e-KERIS v5: MOBILE + LAPORAN PEMBAIKAN 1 MUKA SURAT === */
.repair-report-btn{
  background:linear-gradient(135deg,#d4af37,#f2d675)!important;
  color:#17342c!important;
}
.repair-paper{
  width:100%;
  max-width:794px;
  min-height:1120px;
  margin:0 auto;
  padding:24px;
  background:#fff;
  border-radius:18px;
  box-shadow:var(--shadow);
}
.repair-head{
  display:grid;
  grid-template-columns:78px 1fr auto;
  align-items:center;
  gap:14px;
  padding-bottom:12px;
  border-bottom:3px solid var(--gold);
}
.repair-school-logo{width:74px;height:74px;object-fit:contain}
.repair-title b{font-size:13px;color:var(--emerald);letter-spacing:.8px}
.repair-title h1{font-size:22px;line-height:1.1;margin:4px 0;color:var(--emerald)}
.repair-title span{font-size:10px;color:var(--muted);font-weight:800}
.repair-ticket{
  padding:8px 10px;border-radius:10px;background:var(--emerald);
  color:#fff;font-size:11px;font-weight:900;white-space:nowrap
}
.repair-meta-grid{
  display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:13px 0
}
.repair-meta{border:1px solid #dce8e4;background:#f7fbf9;border-radius:10px;padding:9px}
.repair-meta b{display:block;font-size:9px;color:var(--muted);text-transform:uppercase;margin-bottom:4px}
.repair-meta span{font-size:11px;font-weight:800}
.repair-text-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:11px}
.repair-box{border:1px solid #dce8e4;border-radius:11px;padding:11px;min-height:102px}
.repair-box h3{font-size:11px;color:var(--emerald);margin:0 0 7px}
.repair-box p{font-size:10px;line-height:1.45;margin:0;text-align:justify}
.repair-photo-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.repair-photo{border:1px solid #dce8e4;border-radius:11px;padding:8px;text-align:center}
.repair-photo>b{display:block;font-size:10px;color:var(--emerald);margin-bottom:6px}
.repair-photo img,.repair-photo-empty{
  width:100%;height:255px;border-radius:8px;object-fit:cover;background:#eef4f2
}
.repair-photo-empty{display:grid;place-items:center;color:var(--muted);font-size:11px}
.repair-officer-row{
  display:grid;grid-template-columns:2fr 1fr;gap:10px;margin-top:11px
}
.repair-officer-row>div{border:1px solid #dce8e4;border-radius:10px;padding:9px}
.repair-officer-row b{display:block;font-size:9px;color:var(--muted);margin-bottom:4px}
.repair-officer-row span{font-size:10px;font-weight:800}
.repair-signatures{display:grid;grid-template-columns:1fr 1fr;gap:34px;margin-top:14px}
.repair-sign{font-size:9px}
.sign-space{height:42px;border-bottom:1px dotted #333;margin-bottom:5px}
.repair-sign b,.repair-sign small{display:block}
.repair-sign b{font-size:10px}
.repair-sign small{font-size:9px;color:var(--muted);margin-top:2px}
.repair-footer{
  display:flex;justify-content:space-between;border-top:1px solid #dce8e4;
  margin-top:12px;padding-top:7px;font-size:8px;color:var(--muted)
}

/* Mobile: laporan masih mudah dilihat, borang tidak menyusahkan */
@media(max-width:600px){
  .repair-paper{min-height:0;padding:14px;border-radius:14px}
  .repair-head{grid-template-columns:58px 1fr}
  .repair-school-logo{width:55px;height:55px}
  .repair-ticket{grid-column:1/-1;width:max-content}
  .repair-title h1{font-size:17px}
  .repair-meta-grid{grid-template-columns:1fr 1fr}
  .repair-text-grid,.repair-photo-grid,.repair-officer-row{grid-template-columns:1fr}
  .repair-photo img,.repair-photo-empty{height:210px}
  .repair-signatures{gap:16px}
}

/* Print portrait A4, exactly one page */
@media print{
  @page{size:A4 portrait;margin:7mm}
  body.printing-repair{background:#fff}
  body.printing-repair .topbar,
  body.printing-repair footer,
  body.printing-repair .no-print,
  body.printing-repair .loading{display:none!important}
  body.printing-repair .container{width:100%;max-width:none;margin:0;padding:0}
  body.printing-repair .view{display:none!important}
  body.printing-repair #view-repair-report{display:block!important}
  body.printing-repair .repair-paper{
    display:block!important;
    width:100%;
    max-width:none;
    min-height:auto;
    height:277mm;
    margin:0;
    padding:5mm;
    border-radius:0;
    box-shadow:none;
    overflow:hidden;
  }
  body.printing-repair .repair-photo img,
  body.printing-repair .repair-photo-empty{height:78mm}
  body.printing-repair .repair-box{min-height:24mm}
  body.printing-repair .sign-space{height:13mm}
}


/* === v5.1 LOGO RASMI KEMAS === */
.topbar{min-height:82px!important;padding:9px 18px!important}
.school-logo-wrap{
  width:66px!important;
  height:66px!important;
  flex:0 0 66px!important;
  padding:3px!important;
  background:#fff!important;
  border-radius:13px!important;
  overflow:hidden!important;
}
.school-logo{
  width:100%!important;
  height:100%!important;
  object-fit:contain!important;
  object-position:center!important;
}
.brand h1{font-size:20px!important;line-height:1.15!important}
.brand p{font-size:13px!important;margin-top:4px!important}
.repair-school-logo{
  width:70px!important;
  height:70px!important;
  object-fit:contain!important;
  display:block!important;
}
.report-logo{
  width:70px!important;
  height:70px!important;
  flex:0 0 70px!important;
  padding:2px!important;
  background:#fff!important;
  border:0!important;
  overflow:hidden!important;
}
.report-logo img{
  width:100%!important;
  height:100%!important;
  object-fit:contain!important;
  display:block!important;
}
.repair-report-btn{
  background:linear-gradient(135deg,#d4af37,#f2d675)!important;
  color:#17342c!important;
  font-weight:900!important;
}
@media(max-width:520px){
  .topbar{min-height:72px!important;padding:7px 10px!important}
  .school-logo-wrap{width:56px!important;height:56px!important;flex-basis:56px!important}
  .brand h1{font-size:16px!important}
  .brand p{font-size:11px!important}
}


/* === e-KERIS v6 === */
.hero h2{
  font-size:clamp(42px,9vw,72px)!important;
  letter-spacing:.5px;
  margin-bottom:6px!important;
}
.hero-subtitle{
  font-size:clamp(16px,3vw,23px)!important;
  font-weight:700;
  max-width:760px!important;
}
.keris-meaning{
  margin-top:18px;
  display:flex;
  flex-wrap:wrap;
  gap:8px 16px;
  font-size:13px;
  font-weight:700;
  color:#fff;
}
.keris-meaning b{color:var(--gold);font-size:16px}

/* Laporan pembaikan satu muka surat */
.repair-paper{
  min-height:1120px!important;
  display:flex!important;
  flex-direction:column!important;
}
.repair-head{
  grid-template-columns:76px minmax(0,1fr) auto!important;
  align-items:center!important;
}
.repair-school-logo{
  width:72px!important;
  height:82px!important;
  object-fit:contain!important;
}
.repair-title{min-width:0}
.repair-title h1{
  font-size:20px!important;
  line-height:1.05!important;
  white-space:nowrap!important;
  margin:4px 0!important;
}
.repair-title span{
  display:block;
  font-size:9px!important;
}
.repair-reference{
  text-align:right;
  min-width:130px;
}
.repair-reference span{
  display:block;
  color:var(--muted);
  font-size:9px;
  font-weight:900;
  margin-bottom:6px;
}
.repair-reference b{
  display:inline-block;
  background:var(--emerald);
  color:#fff;
  border-radius:9px;
  padding:8px 10px;
  font-size:10px;
  white-space:nowrap;
}
.repair-footer{
  margin-top:auto!important;
  padding-top:8px!important;
  width:100%;
}
.repair-photo img{
  object-fit:contain!important;
  background:#f3f7f5!important;
}

@media(max-width:600px){
  .repair-head{
    grid-template-columns:58px minmax(0,1fr)!important;
  }
  .repair-title h1{
    font-size:13px!important;
    white-space:nowrap!important;
  }
  .repair-reference{
    grid-column:1/-1;
    display:flex;
    justify-content:space-between;
    align-items:center;
    width:100%;
    text-align:left;
  }
  .repair-reference span{margin:0}
  .repair-paper{min-height:0!important}
}

@media print{
  body.printing-repair .repair-paper{
    height:277mm!important;
    display:flex!important;
    flex-direction:column!important;
  }
  body.printing-repair .repair-footer{
    margin-top:auto!important;
  }
  body.printing-repair .repair-title h1{
    font-size:15px!important;
    white-space:nowrap!important;
  }
  body.printing-repair .repair-photo img,
  body.printing-repair .repair-photo-empty{
    height:73mm!important;
  }
}


/* === e-KERIS v6.1 PEMBETULAN PAPARAN & LAPORAN === */

/* Logo paparan utama: jangan potong lencana */
.school-logo-wrap{
  width:82px!important;
  height:82px!important;
  flex:0 0 82px!important;
  padding:0!important;
  border-radius:12px!important;
  background:#ffffff!important;
  overflow:visible!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
}
.school-logo{
  width:76px!important;
  height:76px!important;
  max-width:100%!important;
  max-height:100%!important;
  object-fit:contain!important;
  object-position:center!important;
  display:block!important;
}

/* Hero tanpa teks emas di atas e-KERIS */
.hero .eyebrow{display:none!important}

/* Kepala laporan pembaikan */
.repair-head{
  grid-template-columns:84px minmax(0,1fr) auto!important;
  gap:14px!important;
}
.repair-school-logo{
  width:80px!important;
  height:88px!important;
  object-fit:contain!important;
  object-position:center!important;
  display:block!important;
}
.repair-title h1{
  font-size:19px!important;
  line-height:1.05!important;
  white-space:nowrap!important;
  margin:0 0 5px!important;
}
.repair-title span{
  font-size:9px!important;
  white-space:nowrap!important;
}
.repair-reference{
  align-self:center!important;
}

/* Gambar memenuhi kotak */
.repair-photo{
  overflow:hidden!important;
}
.repair-photo img{
  width:100%!important;
  height:255px!important;
  object-fit:cover!important;
  object-position:center!important;
  display:block!important;
}

/* Tandatangan turun ke bawah, tepat sebelum footer */
.repair-signature-spacer{
  flex:1 1 auto!important;
  min-height:24px;
}
.repair-signatures{
  margin-top:0!important;
  margin-bottom:10px!important;
}
.repair-footer{
  margin-top:0!important;
}

/* Laporan analisis: gambar/logo penuh */
.report-logo{
  width:82px!important;
  height:82px!important;
  flex:0 0 82px!important;
  padding:0!important;
  overflow:visible!important;
  background:#fff!important;
}
.report-logo img{
  width:78px!important;
  height:78px!important;
  object-fit:contain!important;
  object-position:center!important;
}

/* Telefon */
@media(max-width:600px){
  .school-logo-wrap{
    width:64px!important;
    height:64px!important;
    flex-basis:64px!important;
  }
  .school-logo{
    width:60px!important;
    height:60px!important;
  }
  .repair-head{
    grid-template-columns:60px minmax(0,1fr)!important;
  }
  .repair-school-logo{
    width:58px!important;
    height:64px!important;
  }
  .repair-title h1{
    font-size:12px!important;
    white-space:nowrap!important;
  }
  .repair-title span{
    white-space:normal!important;
  }
  .repair-photo img{
    height:220px!important;
  }
}

/* Cetak A4 */
@media print{
  body.printing-repair .repair-paper{
    height:277mm!important;
    display:flex!important;
    flex-direction:column!important;
  }
  body.printing-repair .repair-photo img{
    height:70mm!important;
    object-fit:cover!important;
  }
  body.printing-repair .repair-signature-spacer{
    flex:1 1 auto!important;
    min-height:8mm!important;
  }
  body.printing-repair .repair-signatures{
    margin-bottom:4mm!important;
  }
  body.printing-repair .repair-footer{
    margin-top:0!important;
  }
}


/* === e-KERIS v6.2 FINAL STABLE === */
.school-logo-wrap{
  width:84px!important;
  height:84px!important;
  padding:4px!important;
  overflow:hidden!important;
}
.school-logo{
  width:100%!important;
  height:100%!important;
  object-fit:contain!important;
  display:block!important;
}
.repair-school-logo,
.report-logo img{
  object-fit:contain!important;
  display:block!important;
}
.repair-photo img{
  width:100%!important;
  height:255px!important;
  object-fit:cover!important;
  display:block!important;
}
.repair-signature-spacer{
  flex:1 1 auto!important;
  min-height:20px!important;
}
.repair-signatures{
  margin-top:auto!important;
  margin-bottom:10px!important;
}
.repair-footer{
  margin-top:0!important;
}
@media print{
  body.printing-repair .repair-paper{
    height:277mm!important;
    display:flex!important;
    flex-direction:column!important;
  }
  body.printing-repair .repair-signature-spacer{
    flex:1 1 auto!important;
  }
  body.printing-repair .repair-signatures{
    margin-top:auto!important;
  }
}



/* =========================================================
   e-KERIS v6.3 — RESPONSIF TELEFON + CETAKAN JELAS
   ========================================================= */

/* Paparan automatik iPhone / Android */
html{
  -webkit-text-size-adjust:100%;
  text-size-adjust:100%;
}
body{
  overflow-x:hidden;
}
img,svg,canvas{
  max-width:100%;
}
input,select,textarea{
  min-height:46px;
  font-size:16px!important; /* elak auto-zoom Safari iPhone */
}
button{
  min-height:44px;
  touch-action:manipulation;
}
.report-item,
.card,
.modal-card,
.repair-paper,
.report-paper{
  max-width:100%;
}
.report-desc,
.report-meta,
.info,
.task-note,
.analysis-table td{
  overflow-wrap:anywhere;
  word-break:normal;
}

@media(max-width:820px){
  .container{
    width:100%!important;
    max-width:none!important;
    padding-left:14px!important;
    padding-right:14px!important;
  }
  .topbar{
    padding-left:max(12px,env(safe-area-inset-left))!important;
    padding-right:max(12px,env(safe-area-inset-right))!important;
  }
  footer{
    padding-bottom:max(20px,env(safe-area-inset-bottom))!important;
  }
  .stats-grid{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
  .analysis-filter-grid,
  .analysis-grid,
  .two-col,
  .track-grid,
  .track-images{
    grid-template-columns:1fr!important;
  }
  .report-actions{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
  .report-actions button,
  .report-actions .link-btn{
    width:100%!important;
    min-width:0!important;
    text-align:center!important;
  }
}

@media(max-width:480px){
  .container{
    padding-left:10px!important;
    padding-right:10px!important;
  }
  .brand{
    min-width:0;
  }
  .brand h1,
  .brand p{
    white-space:normal!important;
    overflow-wrap:anywhere;
  }
  .school-logo-wrap{
    width:58px!important;
    height:58px!important;
    flex-basis:58px!important;
  }
  .topbar{
    min-height:74px!important;
  }
  .hero h2{
    font-size:clamp(34px,13vw,52px)!important;
  }
  .report-actions{
    grid-template-columns:1fr!important;
  }
  .modal{
    padding:8px!important;
    align-items:end!important;
  }
  .modal-card{
    width:100%!important;
    max-height:94dvh!important;
    border-radius:20px 20px 0 0!important;
    padding:18px 14px!important;
  }
  .stats-grid{
    gap:8px!important;
  }
  .stat{
    padding:12px!important;
  }
}

/* Halaman bernama: analisis landscape, laporan pembaikan portrait */
.report-paper{page:analysisPage}
.repair-paper{page:repairPage}

@page analysisPage{
  size:A4 landscape;
  margin:9mm;
}
@page repairPage{
  size:A4 portrait;
  margin:7mm;
}

/* CETAKAN: tulisan gelap, jelas dan tidak terlalu kecil */
@media print{
  html,body{
    background:#fff!important;
    color:#000!important;
    font-family:Arial,Helvetica,sans-serif!important;
    -webkit-print-color-adjust:exact!important;
    print-color-adjust:exact!important;
  }

  *{
    text-shadow:none!important;
    box-shadow:none!important;
  }

  p,span,div,td,th,li,b,strong,small{
    opacity:1!important;
  }

  /* Warna teks kelabu ditukarkan lebih gelap ketika cetak */
  .report-meta,
  .muted-text,
  .report-print-head p,
  .report-school,
  .report-print-footer,
  .repair-meta,
  .repair-footer,
  .info b,
  .report-kpi span{
    color:#333!important;
  }

  /* LAPORAN ANALISIS */
  body:not(.printing-repair) .report-paper{
    width:100%!important;
    max-width:none!important;
    padding:0!important;
    margin:0!important;
    color:#000!important;
  }
  body:not(.printing-repair) .report-print-head h1{
    font-size:20pt!important;
    line-height:1.15!important;
    color:#064536!important;
  }
  body:not(.printing-repair) .report-print-head p,
  body:not(.printing-repair) .report-school{
    font-size:10pt!important;
    line-height:1.3!important;
  }
  body:not(.printing-repair) .report-summary{
    gap:7px!important;
  }
  body:not(.printing-repair) .report-kpi{
    padding:7px!important;
    border:1px solid #777!important;
    background:#fff!important;
  }
  body:not(.printing-repair) .report-kpi b{
    font-size:15pt!important;
    color:#064536!important;
  }
  body:not(.printing-repair) .report-kpi span{
    font-size:8.5pt!important;
  }
  body:not(.printing-repair) .analysis-block{
    border:1px solid #777!important;
    padding:9px!important;
    margin-bottom:8px!important;
    break-inside:avoid!important;
    page-break-inside:avoid!important;
  }
  body:not(.printing-repair) .analysis-block h2,
  body:not(.printing-repair) .report-table-section h2{
    font-size:11.5pt!important;
    color:#064536!important;
    margin-bottom:8px!important;
  }
  body:not(.printing-repair) .bar-row{
    font-size:9pt!important;
  }
  body:not(.printing-repair) .analysis-table{
    width:100%!important;
    table-layout:auto!important;
    font-size:9pt!important;
    line-height:1.25!important;
    color:#000!important;
  }
  body:not(.printing-repair) .analysis-table th{
    font-size:9pt!important;
    font-weight:800!important;
    padding:6px 5px!important;
    background:#075b45!important;
    color:#fff!important;
    border:1px solid #444!important;
  }
  body:not(.printing-repair) .analysis-table td{
    font-size:9pt!important;
    padding:5px!important;
    color:#000!important;
    border:1px solid #888!important;
    vertical-align:top!important;
  }
  body:not(.printing-repair) .report-print-footer{
    font-size:8.5pt!important;
    border-top:1px solid #555!important;
  }

  /* LAPORAN PEMBAIKAN */
  body.printing-repair .repair-paper{
    width:100%!important;
    max-width:none!important;
    height:auto!important;
    min-height:277mm!important;
    padding:5mm!important;
    margin:0!important;
    overflow:visible!important;
    color:#000!important;
    background:#fff!important;
  }
  body.printing-repair .repair-title h1{
    font-size:16pt!important;
    line-height:1.15!important;
    color:#064536!important;
    white-space:normal!important;
  }
  body.printing-repair .repair-title span,
  body.printing-repair .repair-reference,
  body.printing-repair .repair-meta{
    font-size:9.5pt!important;
    line-height:1.3!important;
    color:#111!important;
  }
  body.printing-repair .repair-box,
  body.printing-repair .repair-info-box{
    color:#000!important;
    border:1px solid #555!important;
    background:#fff!important;
  }
  body.printing-repair .repair-box h2,
  body.printing-repair .repair-info-box b{
    color:#064536!important;
    font-size:10pt!important;
  }
  body.printing-repair .repair-box p,
  body.printing-repair .repair-info-box span,
  body.printing-repair .repair-description,
  body.printing-repair .repair-action-note{
    color:#000!important;
    font-size:10pt!important;
    line-height:1.35!important;
  }
  body.printing-repair .repair-photo img,
  body.printing-repair .repair-photo-empty{
    height:68mm!important;
    border:1px solid #555!important;
  }
  body.printing-repair .repair-signatures{
    color:#000!important;
    font-size:9.5pt!important;
    break-inside:avoid!important;
    page-break-inside:avoid!important;
  }
  body.printing-repair .repair-footer{
    color:#222!important;
    font-size:8.5pt!important;
  }

  /* Elak elemen penting terpotong antara muka surat */
  tr,
  .report-print-head,
  .report-summary,
  .repair-head,
  .repair-photos,
  .repair-signatures,
  .report-print-footer,
  .repair-footer{
    break-inside:avoid!important;
    page-break-inside:avoid!important;
  }

  a{
    color:#000!important;
    text-decoration:none!important;
  }
}



/* === e-KERIS v6.4: AGIH TUGASAN AJK === */
.assign-task-btn{
  background:linear-gradient(135deg,#f5dc7c,#d4af37)!important;
  color:#17342c!important;
  border:2px solid #c89f20!important;
  font-weight:900!important;
  box-shadow:0 7px 16px rgba(184,139,20,.18)!important;
}
.assign-task-btn:hover{
  transform:translateY(-1px);
  filter:brightness(.98);
}
#editModalTitle{
  padding-right:42px;
  color:var(--emerald);
}
#updateSubmitBtn{
  min-height:50px;
  font-size:15px;
}
@media(max-width:520px){
  .assign-task-btn{
    order:-1;
  }
}

/* ===== e-KERIS v7.0 / CLOUDFLARE PWA ===== */
.brand-title-row,.hero-title-row{display:flex;align-items:center;gap:10px}
.hero-title-row{justify-content:center}
.version-badge{
  display:inline-flex;align-items:center;justify-content:center;
  padding:4px 9px;border-radius:999px;background:#d4af37;color:#17342c;
  font-size:11px;font-weight:950;letter-spacing:.08em;box-shadow:0 4px 12px rgba(0,0,0,.14)
}
.hero-version{font-size:12px;padding:5px 10px}
.task-portal-card{background:linear-gradient(145deg,#0c745b,#075b45)!important}
.cloudflare-ready{
  display:flex;gap:12px;align-items:center;margin-top:16px;padding:14px 16px;
  border:1px solid rgba(7,91,69,.18);border-radius:16px;background:rgba(255,255,255,.74)
}
.cloudflare-ready>span{font-size:28px}
.cloudflare-ready b,.cloudflare-ready small{display:block}
.cloudflare-ready small{margin-top:3px;color:#587068}
.api-offline-banner{
  position:fixed;left:12px;right:12px;bottom:12px;z-index:9999;
  padding:12px 14px;border-radius:14px;background:#8b1e1e;color:#fff;
  box-shadow:0 12px 30px rgba(0,0,0,.25);font-weight:750;text-align:center
}
@media(min-width:900px){
  .menu-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
}
