/* ==========================================================================
   International Student System — theme
   ========================================================================== */
:root {
  --brand:        #6d28d9; 
  --brand-600:    #7c3aed;
  --brand-700:    #5b21b6;
  --brand-50:     #f5f3ff;
  --brand-100:    #ede9fe;
  --ink:          #1e2233;
  --ink-soft:     #374151;
  --muted:        #6b7280;
  --muted-2:      #b6bac4;
  --line:         #e6e8ee;
  --bg:           #f4f5fa;
  --card:         #ffffff;
  --surface-2:    #eef0f4;
  --surface-2-ink: #384152;
  --table-head-bg: #fafafe;
  --table-stripe-bg: #fbfaff;
  --ok:           #16a34a;
  --ok-bg:        #dcfce7;
  --ok-text:      #14532d;
  --warn:         #d97706;
  --warn-bg:      #fef3c7;
  --warn-text:    #78350f;
  --danger:       #dc2626;
  --danger-bg:    #fee2e2;
  --danger-text:  #7f1d1d;
  --info:         #2563eb;
  --info-bg:      #dbeafe;
  --info-text:    #1e3a8a;
  --radius:       14px;
  --shadow:       0 1px 2px rgba(16,24,40,.04), 0 8px 24px rgba(16,24,40,.06);
  --sidebar-w:    256px;
}

html[data-theme="dark"] {
  --brand-50:     rgba(124,58,237,.16);
  --brand-100:    rgba(124,58,237,.28);
  --ink:          #e5e7eb;
  --ink-soft:     #cbd2dc;
  --muted:        #9aa3b2;
  --muted-2:      #6b7280;
  --line:         #2a2f3d;
  --bg:           #12141c;
  --card:         #1b1e29;
  --surface-2:    #242836;
  --surface-2-ink: #aab0bd;
  --table-head-bg: #1f2330;
  --table-stripe-bg: #191c27;
  --ok:           #22c55e;
  --ok-bg:        rgba(34,197,94,.16);
  --ok-text:      #86efac;
  --warn:         #f59e0b;
  --warn-bg:      rgba(245,158,11,.16);
  --warn-text:    #fcd34d;
  --danger:       #ef4444;
  --danger-bg:    rgba(239,68,68,.16);
  --danger-text:  #fca5a5;
  --info:         #3b82f6;
  --info-bg:      rgba(59,130,246,.16);
  --info-text:    #93c5fd;
  --shadow:       0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.45);
}


* { box-sizing: border-box; }
html { scrollbar-gutter: stable; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Sarabun', "Segoe UI", Tahoma, system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.55;
  transition: background-color .15s, color .15s;
}
a { color: var(--brand-700); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout shell ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #2a1e4a 0%, #1f1836 100%);
  color: #cbc7db;
  position: fixed; inset: 0 auto 0 0;
  display: flex; flex-direction: column;
  z-index: 40;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 20px 18px; color: #fff;
}
.sidebar .brand .logo {
  width: 40px; height: 40px; border-radius: 11px;
  background: linear-gradient(135deg, var(--brand-600), #a78bfa);
  display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 18px;
  flex: none;
}
.sidebar .brand .brand-name { font-weight: 700; font-size: 15px; line-height: 1.2; }
.sidebar .brand .brand-sub { font-size: 11px; color: #9d97b8; }
.nav { padding: 8px 12px; overflow-y: auto; flex: 1; }
.nav .group-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: #857ea6; padding: 16px 12px 6px;
}
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; margin: 2px 0; border-radius: 10px;
  color: #cbc7db; font-weight: 500; text-decoration: none;
  transition: background .15s, color .15s;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav a.active { background: var(--brand-600); color: #fff; box-shadow: 0 6px 16px rgba(124,58,237,.35); }
.nav a .nav-ic { flex-shrink: 0; opacity: .75; transition: opacity .15s; }
.nav a:hover .nav-ic, .nav a.active .nav-ic { opacity: 1; }

/* .sidebar is position:fixed, so it takes no space in this flex row — .main is really the
   only flex item here. flex:1 alone would grow it to the FULL row width and then margin-left
   pushes it further right, overflowing the viewport by one sidebar-width on the right edge
   (visible as the topbar/content falling short of the right edge without scrolling). Size it
   explicitly instead. */
.main { width: calc(100% - var(--sidebar-w)); margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }

/* ---------- Topbar ---------- */
.topbar {
  height: 62px; background: var(--card); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; padding: 0 16px 0 22px;
  position: sticky; top: 0; z-index: 30;
}
.topbar .page-title { font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; min-width: 12px; }
.hamburger {
  display: none; align-items: center; gap: 7px; flex-shrink: 0;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  font-size: 18px; padding: 8px 12px; cursor: pointer; color: var(--ink);
}
.hamburger:hover { background: var(--brand-50); border-color: var(--brand-100); }
.hamburger .hamburger-label { font-size: 13px; font-weight: 600; }

.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; flex-shrink: 0; }
.lang-switch a { padding: 5px 11px; font-size: 13px; color: var(--muted); font-weight: 600; }
.lang-switch a:hover { text-decoration: none; background: var(--brand-50); }
.lang-switch a.active { background: var(--brand); color: #fff; }
.theme-toggle {
  display: grid; place-items: center; flex-shrink: 0;
  width: 34px; height: 34px; border-radius: 50%; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); transition: background .15s, border-color .15s;
}
.theme-toggle:hover { background: var(--brand-50); border-color: var(--brand-100); text-decoration: none; }

.tabs { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
.tabs a { padding: 9px 18px; font-size: 13.5px; color: var(--muted); font-weight: 600; }
.tabs a:hover { text-decoration: none; background: var(--brand-50); }
.tabs a.active { background: var(--brand); color: #fff; }

.user-chip { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.user-chip .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--brand-100); color: var(--brand-700);
  display: grid; place-items: center; font-weight: 700; flex-shrink: 0;
}
.user-chip .u-name { font-weight: 600; font-size: 13.5px; line-height: 1.1; white-space: nowrap; }
.user-chip .u-role { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.btn-logout {
  display: grid; place-items: center; flex-shrink: 0;
  width: 36px; height: 36px; border-radius: 50%; font-size: 17px;
  color: var(--ink); background: var(--card); border: 1px solid var(--line);
  transition: background .15s, color .15s, border-color .15s;
}
.btn-logout:hover { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-bg); text-decoration: none; }

/* ---------- Content ---------- */
.content { padding: 24px; max-width: 1200px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; margin: 0; }
.page-head .sub { color: var(--muted); font-size: 13.5px; }

/* ---------- Cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px;
}
.card-head {
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
}
.card-head h2 { font-size: 15px; margin: 0; font-weight: 700; }
.card-head .spacer { flex: 1; }
.card-body { padding: 20px; }

/* ---------- Stat cards ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat .stat-ic {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  font-size: 20px; margin-bottom: 12px;
}
.stat .stat-n { font-size: 30px; font-weight: 800; line-height: 1; }
.stat .stat-l { color: var(--muted); font-size: 13px; margin-top: 6px; }
.tint-brand { background: var(--brand-50); color: var(--brand-700); }
.tint-ok { background: var(--ok-bg); color: var(--ok); }
.tint-warn { background: var(--warn-bg); color: var(--warn); }
.tint-danger { background: var(--danger-bg); color: var(--danger); }
.tint-info { background: var(--info-bg); color: var(--info); }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 22px; }
.form-grid.cols-1 { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.col-span-2 { grid-column: 1 / -1; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.field label .req { color: var(--danger); margin-left: 3px; }
.field .hint { font-size: 12px; color: var(--muted); }
.field.field-missing label { color: var(--danger); }
.field.field-missing label .badge { font-size: 10px; padding: 1px 7px; margin-left: 6px; vertical-align: middle; }
.field.field-missing input, .field.field-missing select, .field.field-missing textarea { border-color: var(--danger); }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; font-size: 14px; font-family: inherit; background: var(--card); color: var(--ink);
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--brand-600); box-shadow: 0 0 0 3px var(--brand-100);
}
.field input:disabled, .field textarea:disabled, .field select:disabled {
  background: var(--surface-2); color: var(--surface-2-ink); border-style: dashed; cursor: not-allowed;
}
.file-field {
  display: flex; align-items: center; gap: 10px; position: relative; overflow: hidden;
  width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); box-sizing: border-box;
}
.file-field input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-field-btn {
  flex-shrink: 0; padding: 6px 14px; border-radius: 8px; background: var(--brand-50);
  color: var(--brand-700); font-size: 13px; font-weight: 600;
}
.file-field-name { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field-static {
  width: 100%; padding: 10px 12px; border: 1px dashed var(--line); box-sizing: border-box;
  border-radius: 10px; font-size: 14px; background: var(--surface-2); color: var(--surface-2-ink);
}
.field textarea { min-height: 90px; resize: vertical; }
.field label .lock-ic { font-size: 11px; opacity: .6; cursor: help; margin-left: 2px; }
.field-legend {
  display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted);
  background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: 10px;
  padding: 8px 12px; margin-bottom: 16px;
}
.form-actions { display: flex; gap: 10px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  border: 1px solid transparent; border-radius: 10px; padding: 10px 18px;
  font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: background .15s, box-shadow .15s, border-color .15s; text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-700); color: #fff; }
.btn-ghost { background: var(--card); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--brand-50); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-icon { padding: 7px 10px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); }
table.data th { background: var(--table-head-bg); color: var(--ink-soft); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
table.data tbody tr:nth-child(even) { background: var(--table-stripe-bg); }
table.data tbody tr:hover { background: var(--brand-50); }
table.data tbody tr[data-href] { cursor: pointer; }
table.data td.row-chevron { color: var(--muted); text-align: right; width: 1%; }
table.data td.actions { white-space: nowrap; }

/* ---------- Badges & pills ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: var(--surface-2); color: var(--muted); }
.badge-brand { background: var(--brand-100); color: var(--brand-700); }

/* ---------- Definition list (read only view) ---------- */
.dl { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 2px 24px; }
.dl .row { display: flex; flex-direction: column; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.dl .row.span-2 { grid-column: 1 / -1; }
.dl .k { font-size: 12px; color: var(--muted); }
.dl .v { font-size: 14.5px; font-weight: 500; }
.dl .v.empty { color: var(--muted-2); font-weight: 400; font-style: italic; }

/* ---------- Alerts / flash ---------- */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; display: flex; gap: 10px; align-items: center; }
.alert-success { background: var(--ok-bg); color: var(--ok-text); }
.alert-danger { background: var(--danger-bg); color: var(--danger-text); }
.alert-info { background: var(--info-bg); color: var(--info-text); }
.alert-warn { background: var(--warn-bg); color: var(--warn-text); }

/* ---------- Bars (dashboard) ---------- */
.bar-list { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 48px; align-items: center; gap: 12px; }
.bar-row .bar-label { font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.bar-track { background: var(--surface-2); border-radius: 999px; height: 12px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--brand-600), #a78bfa); border-radius: 999px; }
.bar-row .bar-val { text-align: right; font-size: 13px; font-weight: 700; color: var(--muted); }

/* ---------- Avatar photo ---------- */
.photo { width: 168px; height: 168px; border-radius: 20px; object-fit: cover; border: 1px solid var(--line); background: var(--surface-2); }
.photo-placeholder { display: grid; place-items: center; color: var(--muted-2); font-size: 34px; }

/* ---------- Student picker ---------- */
.picker-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.picker-bar .current { font-weight: 700; }

.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }

/* ---------- Inline edit disclosure (e.g. visa record edit) ---------- */
details.visa-edit > summary { list-style: none; display: inline-flex; }
details.visa-edit > summary::-webkit-details-marker { display: none; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; width: 100%; display: flex; align-items: center; justify-content: flex-end;
  padding: 20px 8vw 20px 20px; background-color: #0b0b12;
  background-size: cover; background-position: top center; background-repeat: no-repeat;
}
.login-card { width: 100%; max-width: 360px; background: var(--card); border-radius: 18px; box-shadow: var(--shadow); padding: 26px 24px; position: relative; }
.login-theme-toggle { position: absolute; top: 16px; right: 16px; }

/* ---------- PDPA notice gate ---------- */
.pdpa-card { max-width: 640px; }
.pdpa-notice-body {
  text-align: left; max-height: 50vh; overflow-y: auto;
  margin: 16px 0; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2);
}
.pdpa-notice-body h3 { font-size: 14.5px; margin: 16px 0 6px; color: var(--ink-soft); }
.pdpa-notice-body h3:first-child { margin-top: 0; }
.pdpa-notice-body p { font-size: 13.5px; margin: 8px 0; color: var(--ink); }
.pdpa-notice-body ul { margin: 4px 0 12px; padding-left: 20px; }
.pdpa-notice-body li { margin-bottom: 4px; font-size: 13.5px; color: var(--ink); }
.login-card .logo { width: 48px; height: 48px; border-radius: 14px; background: linear-gradient(135deg, var(--brand-600), #a78bfa); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 22px; margin-bottom: 16px; }
.login-card h1 { font-size: 19px; margin: 0 0 4px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.login-card .field { margin-bottom: 14px; }
.login-card .btn { width: 100%; }
.login-divider { display: flex; align-items: center; gap: 10px; margin: 16px 0; color: var(--muted); font-size: 12px; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.btn-cmu { display: flex; align-items: center; justify-content: center; gap: 8px; background: #5a2d82; color: #fff; }
.btn-cmu:hover { background: #4a2469; color: #fff; }
.login-hint { margin-top: 16px; font-size: 11.5px; color: var(--muted); text-align: center; }
@media (max-width: 760px) {
  .login-wrap { justify-content: center; padding: 20px; }
}

/* ---------- Printable request forms (Form B, etc.) ---------- */
.formb-sheet {
  background: #fff; color: #111; max-width: 820px; margin: 0 auto; padding: 28px 34px;
  border: 1px solid var(--line); border-radius: 10px; font-size: 13.5px; line-height: 1.6;
}
.formb-sheet strong { color: #111; }
.formb-sheet .formb-fillin { display: inline-block; min-width: 90px; border-bottom: 1px solid #111; }
.formb-sheet .formb-hint { font-size: 11px; color: #555; }
/* Passport Certificate only: an empty Study Progress note sits alone on its own line (no
   inline sentence around it like the other blank fields), so the shared dashed-underline
   placeholder above reads as a stray mark rather than a fill-in-the-blank — suppress it here. */
.cert-sheet #certStudyProgress .formb-fillin { border-bottom: none; min-width: 0; }
.formb-top { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 8px; }
.formb-formno { border: 2px solid #111; border-radius: 4px; padding: 10px 18px; font-weight: 700; font-size: 16px; white-space: nowrap; }
.formb-titlebox { flex: 1; border: 2px solid #111; border-radius: 4px; padding: 10px 16px; font-size: 14px; }
.formb-titlebox b { font-size: 20px; }
.formb-staffline { font-size: 11.5px; color: #444; text-align: right; margin-bottom: 4px; }
.formb-hr { border: none; border-top: 1px dashed #999; margin: 12px 0 16px; }
.formb-hr-solid { border: none; border-top: 1px solid #000; margin: 12px 0 16px; }
.formb-row { display: flex; flex-wrap: wrap; gap: 24px; margin-bottom: 12px; }
.formb-row > span { flex: 1; min-width: 200px; }
.formb-officer-box { border: 2px solid #111; border-radius: 6px; padding: 14px 16px; margin: 18px 0; position: relative; }
.formb-officer-badge { position: absolute; top: -12px; right: 12px; background: #111; color: #fff; font-size: 10.5px; padding: 3px 10px; border-radius: 3px; }
.formb-officer-banner { background: #111; color: #fff; font-size: 12.5px; font-weight: 600; padding: 6px 16px; margin: -14px -16px 12px; border-radius: 4px 4px 0 0; }
.formb-expiry-big { font-size: 1.3em; font-weight: 700; }
.formb-checklist { margin: 18px 0; }
.formb-checklist ul { list-style: none; margin: 8px 0 0; padding-left: 4px; }
.formb-checklist li { margin-bottom: 4px; }
.formb-reminder { border: 1px dashed #111; border-radius: 6px; padding: 12px 16px; margin: 18px 0; font-size: 12px; }
.formb-footer { display: flex; justify-content: space-between; gap: 24px; margin-top: 24px; align-items: flex-end; flex-wrap: wrap; }
.formb-sign { border: 1px solid #111; border-radius: 4px; padding: 24px 16px 10px; min-width: 220px; }

.formb-chk { display: inline-block; }
.formb-chk[data-group] { cursor: pointer; }
.formb-inline-input {
  border: none; border-bottom: 1px solid #111; background: transparent;
  font: inherit; color: inherit; padding: 0 2px; border-radius: 0;
}
.formb-inline-input[type="date"] { width: 130px; }
.formb-inline-input[type="text"] { width: 200px; }
.formb-sheet.formb-editing { outline: 2px dashed #6d28d9; outline-offset: 8px; }
.formb-sheet.formb-editing .formb-chk { cursor: pointer; }
.formb-sheet.formb-editing:focus { outline-color: #6d28d9; }

/* Editable registry fields: a real <input> swapped in while editing — not contenteditable,
   which is unreliable for capture when nested inside other inline, non-editable content. */
.formb-editable .fe-input { display: none; }
.formb-editable .fe-text { background: transparent; }
.formb-sheet.formb-editing .formb-editable .fe-text { display: none; }
.formb-sheet.formb-editing .formb-editable .fe-input {
  display: inline-block; border: none; border-bottom: 1px solid #111; background: rgba(109, 40, 217, .08);
  font: inherit; color: inherit; padding: 0 2px; border-radius: 2px; min-width: 60px;
}
.formb-sheet.formb-editing .formb-editable textarea.fe-input {
  display: block; width: 100%; min-width: 0; border: 1px solid #111; border-radius: 4px;
  padding: 6px 8px; resize: vertical; margin-top: 4px;
}
.formb-sign .fe-input[type="text"] { min-width: 180px; }

@media print {
  @page { size: A4; margin: 12mm; }
  html, body { background: #fff !important; }
  body * { visibility: hidden; }
  #printArea, #printArea * { visibility: visible; }
  #printArea {
    position: absolute; left: 0; top: 0; width: 100%; margin: 0; padding: 0; border: none; border-radius: 0;
    /* Sized to fill a full A4 page like the source templates (generous, not screen-cramped) —
       this only applies to print; on-screen editing keeps its own compact defaults. */
    font-size: 14.5px; line-height: 1.55;
  }
  #printArea.formb-editing { outline: none; }
  #printArea .formb-top { margin-bottom: 10px; }
  #printArea .formb-row { gap: 24px; margin-bottom: 12px; }
  #printArea .formb-staffline { margin-bottom: 6px; }
  #printArea .formb-hr, #printArea .formb-hr-solid { margin: 10px 0 13px; }
  #printArea .formb-officer-box { padding: 11px 16px; margin: 13px 0; }
  #printArea .formb-officer-badge { top: -12px; font-size: 10.5px; padding: 3px 10px; }
  #printArea .formb-checklist { margin: 13px 0; }
  #printArea .formb-checklist li { margin-bottom: 3px; }
  #printArea .formb-reminder { padding: 11px 16px; margin: 13px 0; }
  #printArea .formb-footer { margin-top: 10px; }
  #printArea p { margin: 6px 0; }
  .no-print { display: none !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); box-shadow: 12px 0 32px rgba(0,0,0,.25); }
  .main { margin-left: 0; width: 100%; }
  .hamburger { display: inline-flex; }
  .topbar .page-title { font-size: 15px; }
  .form-grid, .dl { grid-template-columns: 1fr; }
  .backdrop.show { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; }
}

@media (max-width: 480px) {
  .content { padding: 16px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .topbar { gap: 8px; padding: 0 10px 0 14px; }
  .user-chip .u-name, .user-chip .u-role { display: none; }
}

/* ---------- SweetAlert2 overrides ---------- */
.swal2-container { z-index: 9999; }
.swal2-popup.swal2-toast { font-family: 'Sarabun', "Segoe UI", Tahoma, system-ui, sans-serif; font-size: 14px; }

/* ---------- Evidence image lightbox ---------- */
.lightbox-overlay {
  display: none; position: fixed; inset: 0; z-index: 10000;
  background: rgba(15, 15, 20, .88);
  align-items: center; justify-content: center; padding: 40px;
}
.lightbox-overlay.show { display: flex; }
.lightbox-img { max-width: 90vw; max-height: 85vh; border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.lightbox-pdf { width: 90vw; height: 85vh; max-width: 1100px; border: none; border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.5); background: #fff; }
.lightbox-close {
  position: absolute; top: 18px; right: 22px; width: 40px; height: 40px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.1); color: #fff;
  font-size: 24px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.lightbox-close:hover { background: rgba(255,255,255,.2); }

/* ---------- Promotional popup ---------- */
.promo-popup-overlay {
  display: none; position: fixed; inset: 0; z-index: 10001;
  background: rgba(15, 15, 20, .72);
  align-items: center; justify-content: center; padding: 24px;
}
.promo-popup-overlay.show { display: flex; }
.promo-popup-card {
  position: relative; width: 100%; max-width: 720px; max-height: 94vh;
  background: #fff; border-radius: 18px; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 70px rgba(0,0,0,.55);
}
.promo-popup-body { overflow-y: auto; }
.promo-popup-body img { display: block; width: 100%; }
.promo-popup-close {
  position: absolute; top: 14px; right: 14px; width: 42px; height: 42px; border-radius: 999px;
  border: none; background: rgba(0,0,0,.45); color: #fff;
  font-size: 26px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center;
  z-index: 1;
}
.promo-popup-close:hover { background: rgba(0,0,0,.65); }
.promo-popup-actions {
  display: flex; gap: 12px; padding: 18px; border-top: 1px solid var(--line); background: #fff;
}
.promo-popup-actions .btn { flex: 1; justify-content: center; padding: 13px 18px; font-size: 15px; }

.swal2-confirm { font-weight: 600 !important; }
.swal2-cancel  { font-weight: 600 !important; }
