:root {
  --bg-page: #f2f6f5;
  --bg-card: #ffffff;
  --bg-muted: #f7faf8;
  --border: #d5e5d9;
  --border-strong: #b8d4ad;
  --text-main: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;

  /* الهوية البصرية لوزارة التعليم (متطابقة مع نموذج التقرير المعتمد) */
  --moe-dark: #0d3b4c;
  --moe-teal: #114b5f;
  --moe-mint: #28a77a;
  --moe-blue: #0e7bb5;
  --moe-sage: #dcefd5;
  --moe-sage-border: #b8d4ad;

  --primary: #0d4a58;
  --primary-hover: #0a3b47;
  --primary-soft: #e6f3ec;
  --accent-blue: #0e7bb5;
  --accent-blue-soft: #e0f2fe;
  --accent-amber: #b45309;
  --accent-amber-soft: #fef3c7;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --success: #15803d;
  --success-soft: #dcfce7;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(13, 59, 76, 0.06);
  --shadow-md: 0 4px 16px rgba(13, 59, 76, 0.09);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-page);
  color: var(--text-main);
  font-family: 'Cairo', 'Segoe UI', Tahoma, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* ====== Top Bar ====== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(135deg, #0b3342 0%, #0f4656 55%, #125662 100%);
  color: #fff;
  border-bottom: 4px solid var(--moe-mint);
  box-shadow: 0 3px 14px rgba(13, 59, 76, 0.22);
}

.topbar-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-badge {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16);
}

.brand-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.brand-sub {
  margin: 0;
  font-size: 0.78rem;
  color: #cbead9;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 700;
  transition: all 0.15s ease;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.nav-btn.active {
  background: var(--moe-sage);
  color: var(--moe-dark);
  border-color: var(--moe-sage);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.14);
}

/* ====== Main Layout ====== */
.main-content {
  max-width: 1440px;
  margin: 0 auto;
  padding: 18px 20px 48px;
}

/* ====== KPI Cards ====== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(195px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--moe-sage-border);
  border-top: 4px solid var(--moe-dark);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kpi-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 700;
}

.kpi-value {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.kpi-note {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.kpi-card.accent-primary { border-top-color: var(--moe-dark); }
.kpi-card.accent-primary .kpi-value { color: var(--moe-dark); }
.kpi-card.accent-success { border-top-color: var(--moe-mint); }
.kpi-card.accent-success .kpi-value { color: var(--success); }
.kpi-card.accent-amber { border-top-color: var(--accent-amber); }
.kpi-card.accent-amber .kpi-value { color: var(--accent-amber); }
.kpi-card.accent-danger { border-top-color: var(--danger); }
.kpi-card.accent-danger .kpi-value { color: var(--danger); }

/* ====== Cards & Panels ====== */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--moe-sage-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  overflow: hidden;
}

.panel-header {
  padding: 13px 18px;
  background: linear-gradient(to left, var(--moe-sage), #eef7ea);
  border-bottom: 1px solid var(--moe-sage-border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.panel-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--moe-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-body {
  padding: 16px 18px;
}

/* ====== Buttons ====== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--moe-sage-border);
  background: #fff;
  color: var(--moe-dark);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.14s ease;
  white-space: nowrap;
}

.btn:hover {
  background: #eef7ea;
  border-color: #8bb883;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--moe-dark);
  border-color: var(--moe-dark);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
}

.btn-secondary {
  background: var(--moe-blue);
  border-color: var(--moe-blue);
  color: #fff;
}

.btn-secondary:hover {
  background: #0a6394;
  color: #fff;
}

.btn-success {
  background: var(--moe-mint);
  border-color: var(--moe-mint);
  color: #fff;
}

.btn-success:hover {
  background: #218b65;
  color: #fff;
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #991b1b;
  color: #fff;
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: #eef7ea;
  color: var(--moe-dark);
}

.btn-sm {
  padding: 4px 9px;
  font-size: 0.78rem;
}

/* ====== Inputs & Form Controls ====== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--moe-dark);
}

.input, .select, .textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--moe-sage-border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text-main);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--moe-dark);
  box-shadow: 0 0 0 3px rgba(13, 59, 76, 0.14);
}

.input-sm, .select-sm {
  padding: 4px 8px;
  font-size: 0.8rem;
}

/* ====== Quick Defaults Bar ====== */
.defaults-banner {
  background: linear-gradient(to left, #eef8eb, #ffffff);
  border: 1px solid var(--moe-sage-border);
  border-right: 4px solid var(--moe-mint);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 16px;
}

.defaults-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.defaults-title {
  font-weight: 800;
  color: var(--moe-dark);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ====== Filters Toolbar ====== */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  padding: 14px 18px;
  border-bottom: 1px solid var(--moe-sage-border);
  background: var(--bg-muted);
}

.filter-search {
  flex: 1 1 260px;
}

.filter-item {
  flex: 0 1 180px;
}

.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 18px;
  background: #e6f4fa;
  border-bottom: 1px solid #9bd2ec;
  color: var(--moe-dark);
}

.bulk-bar.hidden {
  display: none;
}

/* ====== Students Table ====== */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.data-table th {
  background: var(--moe-sage);
  color: var(--moe-dark);
  font-weight: 800;
  text-align: right;
  padding: 11px 12px;
  border-bottom: 2px solid var(--moe-sage-border);
  white-space: nowrap;
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5efe7;
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: #f6fbf7;
}

.data-table tbody tr.row-selected {
  background: #eaf7ee;
}

.student-name-cell {
  font-weight: 700;
  color: var(--text-main);
  min-width: 200px;
}

.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.82rem;
}

.count-high {
  background: var(--danger-soft);
  color: var(--danger);
}

.count-mid {
  background: var(--accent-amber-soft);
  color: var(--accent-amber);
}

.count-low {
  background: var(--accent-blue-soft);
  color: var(--accent-blue);
}

/* ====== Procedure Buttons in Row ====== */
.proc-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.proc-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--moe-sage-border);
  background: #fff;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.14s ease;
}

.proc-chip:hover {
  border-color: var(--moe-dark);
  color: var(--moe-dark);
  background: #eef7ea;
}

.proc-chip.done {
  background: var(--moe-sage);
  border-color: #82be86;
  color: #14532d;
}

.proc-chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
}

.proc-chip.done .dot {
  background: #16a34a;
}

.row-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 5px;
  align-items: center;
}

.count-cell-wrap {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.btn-inc {
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--moe-sage-border);
  background: #fff;
  color: var(--moe-dark);
  font-weight: 800;
  font-size: 0.78rem;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  transition: all 0.14s ease;
}

.btn-inc:hover {
  background: var(--moe-dark);
  color: #fff;
  border-color: var(--moe-dark);
}

.sub-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.sub-tab-btn {
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--moe-sage-border);
  background: #fff;
  color: var(--moe-dark);
  font-weight: 700;
  cursor: pointer;
}

.sub-tab-btn.active {
  background: var(--moe-dark);
  border-color: var(--moe-dark);
  color: #fff;
}

.archive-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 14px;
}

.archive-card {
  background: #fff;
  border: 1px solid var(--moe-sage-border);
  border-right: 4px solid var(--moe-dark);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ====== Procedure Detail Split View ====== */
.split-workspace {
  display: grid;
  grid-template-columns: minmax(340px, 420px) 1fr;
  gap: 18px;
  align-items: start;
}

@media (max-width: 1080px) {
  .split-workspace {
    grid-template-columns: 1fr;
  }
}

.editor-card {
  background: var(--bg-card);
  border: 1px solid var(--moe-sage-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 76px;
  overflow: hidden;
}

@media (max-width: 1080px) {
  .editor-card {
    position: static;
  }
}

.proc-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 12px 14px;
  background: #eef7ea;
  border-bottom: 1px solid var(--moe-sage-border);
}

.proc-tab-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--moe-sage-border);
  background: #fff;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.proc-tab-btn.active {
  background: var(--moe-dark);
  border-color: var(--moe-dark);
  color: #fff;
}

.proc-tab-btn.done:not(.active) {
  background: var(--moe-sage);
  border-color: #82be86;
  color: #14532d;
}

.preview-stage {
  background: #dce5e3;
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  justify-content: center;
  overflow-x: auto;
}

/* ====== Fill All 4 Procedures View ====== */
.fill-all-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.proc-fill-card {
  background: #fff;
  border: 1px solid var(--moe-sage-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.proc-fill-card.included {
  border-color: var(--moe-dark);
  box-shadow: 0 0 0 2px rgba(13, 59, 76, 0.12);
}

.proc-fill-head {
  padding: 12px 14px;
  background: var(--moe-sage);
  border-bottom: 1px solid var(--moe-sage-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.proc-fill-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

/* ================================================================
   الهوية البصرية الرسمية للتقرير والوثائق (مطابقة لملف التقرير المرفق)
   ================================================================ */
.a4-doc {
  width: 210mm;
  min-height: 297mm;
  background: #ffffff;
  color: #111827;
  box-shadow: 0 8px 30px rgba(13, 59, 76, 0.18);
  font-family: 'Cairo', 'Segoe UI', Tahoma, Arial, sans-serif;
  font-size: 14.5px;
  line-height: 1.8;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* الترويسة العليا المنحنية الداكنة */
.moe-banner-wrap {
  position: relative;
  margin-bottom: 22px;
}

.moe-banner {
  background: linear-gradient(125deg, #0b3342 0%, #114b5f 65%, #165e6b 100%);
  color: #ffffff;
  padding: 16px 24px 26px;
  border-bottom-left-radius: 56px;
  border-bottom: 5px solid #48b087;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.moe-banner-text {
  text-align: right;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.7;
  color: #f1f5f9;
}

.moe-banner-divider {
  width: 1.5px;
  height: 52px;
  background: rgba(255, 255, 255, 0.45);
}

.moe-banner-logo {
  height: 62px;
  width: auto;
  object-fit: contain;
  display: block;
}

.moe-school-pill {
  position: relative;
  margin: -17px auto 0;
  width: fit-content;
  min-width: 270px;
  max-width: 82%;
  padding: 5px 28px;
  background: linear-gradient(180deg, #164f5e 0%, #0e3a48 100%);
  color: #ffffff;
  border: 1.5px solid #63c198;
  border-radius: 10px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(13, 59, 76, 0.22);
}

/* محتوى صفحة A4 الداخلي */
.moe-doc-inner {
  padding: 4px 16mm 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.doc-secret-pill {
  align-self: center;
  display: inline-block;
  padding: 2px 18px;
  border-radius: 999px;
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  font-weight: 800;
  font-size: 13.5px;
  margin-bottom: 4px;
}

.moe-doc-title {
  text-align: center;
  font-size: 21px;
  font-weight: 800;
  color: #0f172a;
  margin: 4px 0 14px;
}

.moe-doc-title.title-red {
  color: #991b1b;
}

/* الجداول ذات الرأس الأخضر الفاتح كما في التقرير المرفق */
.moe-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 14px;
  font-size: 14px;
}

.moe-table th,
.moe-table td {
  border: 1px solid #b8d4ad;
  padding: 7px 11px;
  vertical-align: middle;
}

.moe-section-head {
  background: #dcefd5;
  color: #0f172a;
  font-weight: 800;
  font-size: 15px;
  text-align: center;
}

.moe-label-cell {
  background: #dcefd5;
  color: #0f172a;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
}

.moe-value-cell {
  background: #ffffff;
  color: #0f172a;
  font-weight: 600;
  text-align: center;
}

.moe-content-box {
  border: 1px solid #b8d4ad;
  margin-bottom: 14px;
  background: #ffffff;
}

.moe-content-box-head {
  background: #dcefd5;
  color: #0f172a;
  font-weight: 800;
  font-size: 15px;
  text-align: center;
  padding: 6px 12px;
  border-bottom: 1px solid #b8d4ad;
}

.moe-content-box-body {
  padding: 12px 16px;
  font-size: 14.5px;
  line-height: 1.95;
  text-align: justify;
}

.moe-content-box-body p {
  margin: 0 0 8px;
}

.doc-fill-val {
  display: inline-block;
  min-width: 110px;
  padding: 0 8px;
  border-bottom: 1.5px dotted #0d3b4c;
  color: #0d3b4c;
  font-weight: 800;
  text-align: center;
}

.doc-fill-val.wide {
  min-width: 230px;
}

.doc-fill-val.short {
  min-width: 80px;
}

.doc-red-heading {
  color: #b91c1c;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 4px;
  margin: 8px 0 4px;
}

.doc-list {
  margin: 6px 0 8px;
  padding-right: 22px;
  list-style: disc;
}

.doc-list li {
  margin-bottom: 5px;
}

.doc-checkbox {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border: 1.5px solid #0d3b4c;
  margin: 0 5px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  vertical-align: middle;
}

/* التوقيعات في أسفل الوثيقة */
.moe-signatures {
  margin-top: auto;
  padding-top: 18px;
  padding-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  font-size: 14.5px;
  font-weight: 800;
  color: #0f172a;
}

.moe-sig-col {
  min-width: 210px;
  text-align: center;
  line-height: 1.9;
}

/* شريط التذييل المنحني المتدرج أسفل الصفحة */
.moe-footer-wave {
  height: 36px;
  background: linear-gradient(to left, #2aa876 0%, #199499 45%, #0e78b4 100%);
  border-top-right-radius: 42px;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  font-size: 12px;
  font-weight: 700;
  position: relative;
}

/* ====== Unified Report Print & Preview Styling ====== */
.report-a4 {
  width: 100%;
  background: #ffffff;
  page: reportPage;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.report-inner {
  padding: 6px 10mm 14px;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
  line-height: 1.4;
}

.report-table th,
.report-table td {
  border: 1px solid #b8d4ad;
  padding: 4.5px 7px;
  text-align: right;
  vertical-align: middle;
}

.report-table th {
  background: #dcefd5;
  color: #0f172a;
  font-weight: 800;
}

.report-table tbody tr:nth-child(even) {
  background: #f9fcf8;
}

.report-closing {
  margin-top: 14px;
  break-inside: avoid;
  page-break-inside: avoid;
}

.report-end-wave {
  height: 26px;
  background: linear-gradient(to left, #2aa876 0%, #199499 45%, #0e78b4 100%);
  border-radius: 0 28px 8px 8px;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  font-size: 11.5px;
  font-weight: 700;
}

/* ====== Dialog & Toasts ====== */
.app-dialog {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  max-width: 640px;
  width: calc(100% - 32px);
  box-shadow: 0 20px 50px rgba(13, 59, 76, 0.25);
  background: #fff;
  color: var(--text-main);
}

.app-dialog::backdrop {
  background: rgba(13, 59, 76, 0.55);
  backdrop-filter: blur(2px);
}

.toast-container {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #0d3b4c;
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.86rem;
  box-shadow: 0 8px 20px rgba(0,0,0,0.22);
  border-right: 4px solid #28a77a;
  animation: toastIn 0.2s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
}

.badge-done { background: var(--moe-sage); color: #14532d; }
.badge-pending { background: #f1f5f9; color: #64748b; }

.helper-muted {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.hidden {
  display: none !important;
}

/* ====== Cloud Sync & Login Gate ====== */
.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(40, 167, 122, 0.22);
  border: 1px solid rgba(124, 224, 184, 0.5);
  color: #ecfdf5;
  font-size: 0.78rem;
  font-weight: 700;
}

.sync-pill.syncing {
  background: rgba(245, 158, 11, 0.25);
  border-color: rgba(252, 211, 77, 0.6);
}

.sync-pill.error {
  background: rgba(220, 38, 38, 0.3);
  border-color: rgba(252, 165, 165, 0.65);
}

.nav-logout {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(185, 28, 28, 0.28);
}

.nav-logout:hover {
  background: rgba(185, 28, 28, 0.55);
}

.login-gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: radial-gradient(circle at top right, #165e6b 0%, #0b3342 60%, #07222d 100%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  border: 1px solid var(--moe-sage-border);
}

.login-header {
  background: linear-gradient(135deg, #0b3342 0%, #114b5f 100%);
  color: #ffffff;
  padding: 24px 20px 20px;
  text-align: center;
  border-bottom: 4px solid var(--moe-mint);
}

.login-logo {
  height: 66px;
  width: auto;
  object-fit: contain;
  margin-bottom: 10px;
}

.login-school {
  font-size: 1.15rem;
  font-weight: 800;
}

.login-sub {
  font-size: 0.82rem;
  color: #cbead9;
  margin-top: 2px;
}

.login-body {
  padding: 22px 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-error {
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.84rem;
  font-weight: 700;
  border: 1px solid #fca5a5;
}

/* ====== Print Rules ====== */
.print-only {
  display: none;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }

  @page reportPage {
    size: A4 portrait;
    margin: 9mm 8mm 10mm 8mm;
  }

  html, body {
    background: #ffffff !important;
    margin: 0 !important;
    padding: 0 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .no-print {
    display: none !important;
  }

  .print-only {
    display: block !important;
  }

  .a4-doc {
    width: 210mm !important;
    height: 296.5mm !important;
    min-height: 296.5mm !important;
    max-height: 296.5mm !important;
    box-shadow: none !important;
    margin: 0 !important;
    page-break-after: always;
    break-after: page;
  }

  .a4-doc:last-child {
    page-break-after: auto;
    break-after: auto;
  }

  .report-a4 {
    padding: 0 !important;
    page: reportPage;
  }

  .report-a4 .moe-banner-wrap {
    margin-bottom: 12px !important;
  }

  .report-a4 .moe-banner {
    border-radius: 10px 10px 10px 44px !important;
  }

  .report-inner {
    padding: 0 2mm 4mm !important;
  }

  .report-table thead {
    display: table-header-group;
  }

  .report-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}
