/*
  Fail override khas sekolah anda.
  Semua style di sini akan menimpa style.css.
  Contoh:
  :root {
    --color-primary: #9a3412;
    --color-primary-strong: #7c2d12;
    --font-sans: 'Trebuchet MS', sans-serif;
  }
*/

button:not(.landing-clipart-card):not(.sort-btn):not(.btn-ghost):not(.back-to-top),
.btn:not(.btn-ghost) {
  min-height: 52px;
  border-radius: 16px;
  padding: 12px 18px;
  font-size: 15px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.row-actions button:not(.btn-ghost),
.row-actions .btn:not(.btn-ghost),
.grid-form button:not(.btn-ghost),
.grid-form .btn:not(.btn-ghost) {
  min-width: 180px;
}

button.btn-ghost,
.btn.btn-ghost {
  min-height: 52px;
  border-radius: 16px;
  padding: 12px 18px;
  font-size: 15px;
  line-height: 1.15;
  font-weight: 800;
}

.report-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-top: 4px;
}

.report-actions button,
.report-actions .btn {
  width: 100%;
  min-height: 58px;
  border-radius: 16px;
  padding: 10px 14px;
  font-size: 15px;
  line-height: 1.2;
  font-weight: 800;
  text-align: center;
  white-space: normal;
}

.report-export-choices {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
}

.report-export-choices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.report-export-choice {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #d2dfef;
  border-radius: 12px;
  background: #f6faff;
  padding: 10px 12px;
  font-weight: 700;
}

.report-export-choice input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.report-actions .btn-report-filter {
  background: linear-gradient(135deg, #0f7a83, #1c82b4);
}

.report-actions .btn-report-excel {
  background: linear-gradient(135deg, #0f7f5f, #249a64);
}

.report-actions .btn-report-pdf {
  background: linear-gradient(135deg, #be4a34, #e16647);
}

.report-actions .btn-report-excel-all {
  background: linear-gradient(135deg, #6f5bd5, #3f7de0);
}

.report-actions .btn-report-pdf-all {
  background: linear-gradient(135deg, #9a3a8b, #d0507c);
}

main.container > h2,
main.container .card > h3,
main.container .card > h4 {
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

/* Elak kad ringkasan rapat dengan jadual bawah (contoh LMS) */
main.container .card .grid4 + .table-wrap {
  margin-top: 14px;
}

main.container .card .grid4 {
  margin-bottom: 8px;
}

.grid-form .filter-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.grid-form.spm-centered-filter {
  grid-template-columns: repeat(3, minmax(240px, 300px));
  justify-content: center;
  justify-items: stretch;
  max-width: 980px;
  margin: 0 auto;
}

form.grid-form[method="get"] {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  justify-content: stretch;
  justify-items: stretch;
}

form.grid-form[method="get"] > .filter-field {
  width: 100%;
}

form.grid-form[method="get"] > select,
form.grid-form[method="get"] > input:not([type="hidden"]),
form.grid-form[method="get"] > button,
form.grid-form[method="get"] > a.btn {
  width: 100%;
}

.grid-form .filter-field-wide {
  grid-column: 1 / -1;
}

@media (max-width: 980px) {
  .grid-form.spm-centered-filter {
    grid-template-columns: 1fr;
    max-width: 560px;
  }
}

.grid-form .filter-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #4d6158;
  padding: 0 2px;
}

.grid-form .filter-group {
  grid-column: 1 / -1;
  border: 1px solid #d5e2d7;
  border-radius: 14px;
  background: #f7fbf8;
  padding: 10px;
}

.grid-form .filter-group + .filter-group {
  margin-top: -4px;
}

.grid-form .filter-group-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #355247;
  margin-bottom: 8px;
  padding: 0 2px;
}

.grid-form .filter-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-2);
  align-items: end;
  justify-content: stretch;
}

.grid-form .filter-group-compare > summary {
  list-style: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b3d2e;
  padding: 2px 22px 2px 2px;
  position: relative;
}

.grid-form .filter-group-compare > summary::-webkit-details-marker {
  display: none;
}

.grid-form .filter-group-compare > summary::after {
  content: '▾';
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: #a04b2f;
}

.grid-form .filter-group-compare[open] > summary::after {
  content: '▴';
}

.grid-form .filter-group.filter-group-compare {
  border-color: #ecd8c8;
  background: #fff7f1;
}

.grid-form .filter-group.filter-group-compare .filter-group-grid {
  background: transparent;
}

.grid-form .filter-group-compare .filter-group-grid {
  display: block;
  margin-top: 8px;
}

.grid-form .compare-scope-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-2);
  align-items: end;
}

.grid-form .compare-scope-row[hidden] {
  display: none !important;
}

.grid-form .compare-scope-row + .compare-scope-row {
  margin-top: var(--space-2);
}

.grid-form .compare-scope-tools {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.grid-form .compare-scope-note {
  color: #85574a;
  font-weight: 700;
  font-size: 11px;
}

.grid-form .compare-scope-add-btn {
  min-height: 40px !important;
  min-width: 120px !important;
  padding: 8px 12px !important;
  border-radius: 12px !important;
  font-size: 13px !important;
  white-space: nowrap;
  background: linear-gradient(135deg, #b45309, #c2410c) !important;
  color: #fff !important;
}

.grid-form .filter-field.is-disabled {
  opacity: 0.6;
}

@media (max-width: 768px) {
  .grid-form {
    grid-template-columns: 1fr;
    justify-content: stretch;
  }
  .grid-form > .filter-field,
  .grid-form .filter-group-grid {
    width: 100%;
    max-width: 100%;
    grid-template-columns: 1fr;
    justify-content: stretch;
  }
  .grid-form .compare-scope-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  button:not(.landing-clipart-card):not(.sort-btn),
  .btn {
    min-height: 48px;
    font-size: 14px;
    padding: 10px 14px;
  }
  .report-actions {
    grid-template-columns: 1fr;
  }
  .report-actions button,
  .report-actions .btn {
    min-height: 52px;
    font-size: 14px;
  }
}

.subject-delete-form {
  justify-content: center;
}

.btn-icon-danger {
  min-width: 40px !important;
  width: 40px;
  min-height: 40px !important;
  height: 40px;
  border-radius: 999px;
  padding: 0 !important;
  border: 0;
  background: linear-gradient(135deg, #cf3f36, #e45a4d);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon-danger:hover {
  filter: brightness(1.05);
}

.btn-icon-danger .icon-trash {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.btn.btn-sm,
button.btn-sm {
  min-height: 40px !important;
  min-width: 0 !important;
  padding: 8px 12px !important;
  font-size: 13px !important;
  border-radius: 12px !important;
}

.dash-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.dash-hello {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 700;
  color: #4d6685;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.dash-name {
  margin: 0;
  font-size: 32px;
  line-height: 1.1;
}

.dash-role {
  margin: 8px 0 0;
  color: #4b6482;
  font-weight: 700;
}

.dash-datetime {
  text-align: right;
}

.dash-day {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: #10395b;
}

.dash-date {
  margin: 4px 0 0;
  font-size: 15px;
  color: #436180;
  font-weight: 700;
}

.dash-time {
  margin: 6px 0 0;
  font-size: 30px;
  font-weight: 800;
  color: #0f7a83;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.dash-admin-stats h4 {
  margin: 12px 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.dash-inline-filter {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.dash-inline-filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 180px;
}

.dash-inline-filter-field label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #4d6482;
}

.dash-inline-filter-field select {
  min-width: 180px;
}

.dash-gps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.dash-gps-card {
  border-width: 1px;
}

.dash-gps-card h3 {
  margin-bottom: 2px;
}

.dash-gps-card p {
  margin: 0;
  font-weight: 700;
}

.dash-gps-t1 { background: #eef7ff; border-color: #bfdcff; }
.dash-gps-t2 { background: #eefcf3; border-color: #bdecc9; }
.dash-gps-t3 { background: #fff8ea; border-color: #f7dfaf; }
.dash-gps-t4 { background: #fff1f4; border-color: #ffc7d2; }
.dash-gps-t5 { background: #f3f1ff; border-color: #d4ccff; }

.dash-admin-stats .table-wrap {
  overflow-x: auto;
}

.dash-admin-stats .table-wrap > table {
  width: 100%;
  min-width: 0;
  table-layout: auto;
}

.dash-admin-stats .table-wrap > table th,
.dash-admin-stats .table-wrap > table td {
  vertical-align: middle;
}

.dash-admin-stats .table-wrap > table th:nth-child(1),
.dash-admin-stats .table-wrap > table td:nth-child(1) { min-width: 90px; }

.dash-admin-stats .table-wrap > table th:nth-child(2),
.dash-admin-stats .table-wrap > table td:nth-child(2) { min-width: 110px; }

.dash-admin-stats .table-wrap > table th:nth-child(3),
.dash-admin-stats .table-wrap > table td:nth-child(3) { min-width: 110px; }

.dash-admin-stats .table-wrap > table th:nth-child(4),
.dash-admin-stats .table-wrap > table td:nth-child(4) { min-width: 140px; }

.dash-admin-stats .table-wrap > table th:nth-child(5),
.dash-admin-stats .table-wrap > table td:nth-child(5) { min-width: 300px; }

.dash-admin-stats .table-wrap > table th:nth-child(6),
.dash-admin-stats .table-wrap > table td:nth-child(6) { min-width: 110px; }

.dash-admin-stats .table-wrap > table th:nth-child(7),
.dash-admin-stats .table-wrap > table td:nth-child(7) { min-width: 170px; }

.dash-pending-cell {
  line-height: 1.4;
}

.dash-pending-links {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dash-pending-links .chip {
  margin: 0;
}

.dash-status-cell {
  text-align: center;
}

.dash-status-cell .chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  line-height: 1.2;
  padding: 10px 16px;
  min-width: 132px;
  max-width: 170px;
  border-radius: 9999px !important;
  border-width: 2px;
}

.row-complete td {
  background: #f4fff8;
}

.row-incomplete td {
  background: #fff6f6;
}

.chip.chip-ok {
  background: linear-gradient(135deg, #e8faef, #dbf6e5);
  border-color: #8ad7a7;
  color: #196a3f;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(22, 120, 68, 0.08);
}

.chip.chip-warn {
  background: linear-gradient(135deg, #fff2ef, #ffe7e3);
  border-color: #f8a598;
  color: #a12c1b;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(180, 56, 36, 0.08);
}

.chip.chip-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  background: #eef7ff;
  border-color: #b8d8ff;
  color: #0f4f8a;
  font-weight: 700;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.chip.chip-link:hover {
  background: #dcecff;
  border-color: #93c5fd;
}

.card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.card-title-row h3 {
  margin: 0;
}

.mini-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.mini-calendar-weekday {
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  color: #557291;
}

.mini-calendar-day {
  min-height: 72px;
  border: 1px solid #d6e3f0;
  border-radius: 14px;
  background: #fbfdff;
  padding: 8px;
}

.mini-calendar-empty {
  border-color: transparent;
  background: transparent;
}

.mini-calendar-day.is-today {
  border-color: #58a9d7;
  box-shadow: 0 0 0 2px rgba(88, 169, 215, 0.2) inset;
}

.mini-calendar-date {
  font-size: 13px;
  font-weight: 800;
  color: #143859;
}

.mini-calendar-dots {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.event-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 18px;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(73, 99, 128, 0.26);
  background: #e8f1fb;
  color: #1d4f83;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
}

.event-dot.event-peperiksaan {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e40af;
}

.event-dot.event-isi_markah {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}

.event-dot.event-mesyuarat {
  background: #ede9fe;
  border-color: #c4b5fd;
  color: #5b21b6;
}

.event-dot.event-taklimat {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}

.event-dot.event-aktiviti {
  background: #fce7f3;
  border-color: #f9a8d4;
  color: #9d174d;
}

.event-dot.event-umum {
  background: #e2e8f0;
  border-color: #cbd5e1;
  color: #334155;
}

.event-tag {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 800;
}

.nav-spacer {
  flex: 1 1 auto;
  min-width: 0;
}

.nav-settings-dropdown summary {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  border-color: rgba(255, 235, 200, 0.65);
  color: #fff7ed;
}

.nav-settings-dropdown summary:hover {
  background: linear-gradient(135deg, #f97316, #dc2626);
  border-color: rgba(255, 235, 200, 0.9);
}

.nav-settings-dropdown[open] summary {
  background: linear-gradient(135deg, #f97316, #dc2626);
  border-color: rgba(255, 235, 200, 0.95);
}

.nav-settings-dropdown .nav-submenu {
  left: auto;
  right: 0;
  min-width: 250px;
  max-width: min(92vw, 300px);
}

a.nav-logout-link {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  border-color: rgba(254, 202, 202, 0.7);
  color: #fff3f3;
}

a.nav-logout-link:hover {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border-color: rgba(254, 202, 202, 0.95);
}

.app-shell {
  width: 100%;
  max-width: calc(var(--container-max) + 320px);
  margin: var(--space-5) auto 0;
  padding: 0 var(--space-3);
  flex: 1 0 auto;
  position: relative;
}

html,
body {
  overflow-x: hidden;
}

/* Kemasan: tona navigasi & sidebar lebih gelap sedikit */
.topbar {
  position: relative;
  overflow: visible;
  z-index: 220;
  background:
    radial-gradient(560px 220px at -8% -22%, rgba(125, 211, 252, 0.22), rgba(125, 211, 252, 0) 64%),
    radial-gradient(520px 210px at 112% -16%, rgba(56, 189, 248, 0.18), rgba(56, 189, 248, 0) 62%),
    linear-gradient(120deg, #0a3f67, #0d4f82) !important;
}

.topbar::before,
.topbar::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
  z-index: 0;
}

.topbar::before {
  width: 210px;
  height: 210px;
  right: 12px;
  top: 8px;
  transform: translate(36%, -34%);
  background: radial-gradient(circle, rgba(147, 197, 253, 0.2), rgba(147, 197, 253, 0));
}

.topbar::after {
  width: 128px;
  height: 128px;
  left: 14px;
  bottom: 8px;
  transform: translate(-28%, 22%);
  background: radial-gradient(circle, rgba(45, 212, 191, 0.16), rgba(45, 212, 191, 0));
}

.topbar .brand,
.topbar nav,
.topbar .topbar-mobile-toggle {
  position: relative;
  z-index: 2;
}

.topbar .topbar-nav .nav-dropdown {
  position: relative;
  z-index: 320;
}

.topbar .topbar-nav .nav-submenu {
  z-index: 9999;
}

.topbar-mobile-toggle {
  display: none;
}

@media (max-width: 991px) {
  .topbar-mobile-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 42px;
    margin-top: 12px;
    border-radius: 14px;
    border: 1px solid #c7d9ea;
    background: linear-gradient(180deg, #f8fbff, #ecf4fb);
    color: #12324f;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
  }

  .topbar.mobile-nav-open .topbar-mobile-toggle {
    background: linear-gradient(180deg, #eef6ff, #e1eefc);
    border-color: #a9c5df;
  }

  .topbar .topbar-nav {
    display: none;
  }

  .topbar.mobile-nav-open .topbar-nav {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-items: stretch;
  }

  .topbar .topbar-nav .nav-spacer {
    display: none;
  }

  .topbar .topbar-nav > a,
  .topbar .topbar-nav > .nav-dropdown {
    width: 100%;
    min-width: 0;
  }

  .topbar .topbar-nav a:not(.nav-logout-link),
  .topbar .topbar-nav .nav-dropdown:not(.nav-settings-dropdown) > summary {
    width: 100%;
    min-height: 42px;
    border-radius: 14px;
    padding: 9px 12px;
    font-size: 14px;
    justify-content: space-between;
    text-align: left;
    color: #12324f;
    background: linear-gradient(180deg, #f8fbff, #edf5fc);
    border: 1px solid #c8d9ea;
    box-shadow: inset 0 1px 0 #ffffff, 0 1px 0 rgba(9, 24, 40, 0.08);
  }

  .topbar .topbar-nav a:not(.nav-logout-link):hover,
  .topbar .topbar-nav .nav-dropdown:not(.nav-settings-dropdown) > summary:hover {
    background: linear-gradient(180deg, #f0f7ff, #e4effa);
    border-color: #9fbfdb;
  }

  .topbar .topbar-nav .nav-dropdown:not(.nav-settings-dropdown)[open] > summary {
    background: linear-gradient(180deg, #eaf3fe, #dbeafb);
    border-color: #8eb3d5;
  }

  .topbar .topbar-nav a.nav-logout-link {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    border-color: rgba(254, 202, 202, 0.7);
    color: #fff3f3;
  }

  .topbar .topbar-nav a.nav-logout-link:hover {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-color: rgba(254, 202, 202, 0.95);
  }

  .topbar .topbar-nav .nav-settings-dropdown > summary {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    border-color: rgba(255, 235, 200, 0.65);
    color: #fff7ed;
  }

  .topbar .topbar-nav .nav-settings-dropdown > summary:hover,
  .topbar .topbar-nav .nav-settings-dropdown[open] > summary {
    background: linear-gradient(135deg, #f97316, #dc2626);
    border-color: rgba(255, 235, 200, 0.92);
  }

  .topbar .topbar-nav > a.nav-logout-link {
    grid-column: 1 / -1;
    width: min(220px, 92%);
    margin: 0 auto;
    text-align: center;
    justify-content: center;
  }

  .topbar .topbar-nav .nav-dropdown {
    position: static;
  }

  .topbar .topbar-nav .nav-submenu {
    position: static;
    top: auto;
    left: auto;
    min-width: 0;
    width: 100%;
    margin-top: 6px;
    padding: 6px;
    background: rgba(7, 24, 44, 0.22);
    border: 1px solid rgba(216, 255, 251, 0.3);
    border-radius: 12px;
  }

  .topbar .topbar-nav .nav-submenu a {
    white-space: normal;
    border-radius: 10px;
    padding: 9px 10px;
    font-size: 13px;
  }

  .topbar .topbar-nav .nav-settings-dropdown .nav-submenu {
    right: auto;
    max-width: 100%;
  }
}

.sidebar-nav {
  display: none;
}

.sidebar-drawer-toggle {
  display: none;
}

/* Pastikan avatar kekal bulat pada semua saiz skrin, termasuk mobile */
.profile-avatar-preview,
.dash-profile-avatar,
.sidebar-profile-avatar {
  border-radius: 50% !important;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  overflow: hidden;
}

.profile-avatar-preview-fallback,
.dash-profile-avatar-fallback,
.sidebar-profile-avatar-fallback {
  border-radius: 50% !important;
}

@media (min-width: 992px) {
  .app-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
  }

  .sidebar-nav {
    display: block;
    position: sticky;
    top: 14px;
    align-self: start;
    margin: 0;
    max-height: calc(100vh - 24px);
    overflow: auto;
    background: linear-gradient(180deg, #e1ebf6, #d3e1ef);
    border: 1px solid #bfd1e4;
    border-radius: 18px;
    box-shadow: 0 10px 24px rgba(19, 50, 82, 0.08);
    padding: 12px;
  }

  .sidebar-drawer-toggle {
    display: inline-flex;
    position: fixed;
    top: 172px;
    left: 4px;
    z-index: 60;
    width: 26px;
    min-width: 26px;
    height: 48px;
    min-height: 48px;
    border-radius: 999px;
    padding: 0;
    font-size: 18px;
    line-height: 1;
    font-weight: 800;
    background: linear-gradient(135deg, #0f7f83, #1e82b5);
    color: #fff;
    border: 1px solid rgba(190, 220, 245, 0.9);
    box-shadow: 0 8px 18px rgba(14, 50, 84, 0.2);
  }

  .sidebar-nav-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    color: #16385d;
  }

  .sidebar-profile-card {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    padding: 12px;
    border-radius: 16px;
    text-decoration: none;
    color: #16385d;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(235, 245, 255, 0.92));
    border: 1px solid #c7d8ea;
    box-shadow: 0 10px 22px rgba(19, 50, 82, 0.08);
  }

  .sidebar-profile-card:hover {
    border-color: #aecaeb;
    transform: translateY(-1px);
  }

  .sidebar-profile-avatar,
  .sidebar-profile-avatar-fallback,
  .profile-avatar-preview,
  .profile-avatar-preview-fallback,
  .dash-profile-avatar,
  .dash-profile-avatar-fallback {
    width: 68px;
    height: 68px;
    border-radius: 999px;
    flex: 0 0 68px;
    object-fit: cover;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar-profile-avatar,
  .profile-avatar-preview,
  .dash-profile-avatar {
    border: 3px solid rgba(255, 255, 255, 0.92);
    box-shadow: 0 8px 18px rgba(19, 50, 82, 0.12);
    background: #fff;
  }

  .sidebar-profile-avatar-fallback,
  .profile-avatar-preview-fallback,
  .dash-profile-avatar-fallback {
    background: linear-gradient(135deg, #0f7f83, #1e82b5);
    color: #fff;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 0.04em;
    box-shadow: 0 8px 18px rgba(19, 50, 82, 0.14);
  }

  .sidebar-profile-copy {
    min-width: 0;
    display: grid;
    gap: 3px;
  }

  .sidebar-profile-copy strong,
  .sidebar-profile-copy span {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sidebar-profile-welcome {
    color: #5d7694;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .sidebar-profile-copy strong {
    font-size: 15px;
    line-height: 1.25;
  }

  .sidebar-profile-copy span:last-child {
    color: #58708d;
    font-size: 12px;
    font-weight: 700;
  }

  .sidebar-links {
    margin: 0;
    display: grid;
    gap: 8px;
  }

  .sidebar-links > a,
  .sidebar-dropdown > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 9px 11px;
    border: 1px solid #d5e2ef;
    border-radius: 12px;
    background: #fff;
    color: #16385d;
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    list-style: none;
    transition: background-color .15s ease, border-color .15s ease, transform .15s ease;
  }

  .sidebar-dropdown > summary::after {
    content: '▾';
    font-size: 11px;
    font-weight: 900;
    color: #2e5d8f;
    line-height: 1;
    transition: transform .15s ease;
  }

  .sidebar-dropdown[open] > summary::after {
    content: '▴';
  }

  .sidebar-dropdown > summary::-webkit-details-marker {
    display: none;
  }

  .sidebar-links > a:hover,
  .sidebar-dropdown > summary:hover {
    background: #eef6ff;
    border-color: #aecaeb;
    transform: translateX(2px);
  }

  .sidebar-dropdown[open] > summary {
    background: #e6f2ff;
    border-color: #9bbfe4;
  }

  .sidebar-submenu {
    margin-top: 6px;
    margin-left: 8px;
    display: grid;
    gap: 6px;
  }

  .sidebar-submenu a {
    display: block;
    padding: 8px 10px;
    border-radius: 10px;
    text-decoration: none;
    color: #1f4a79;
    font-size: 12px;
    font-weight: 700;
    background: #f2f7fd;
    border: 1px solid #d7e5f3;
  }

  .sidebar-submenu a:hover {
    background: #e7f1fc;
    border-color: #b9d2ea;
  }

  .sidebar-logout-link {
    background: linear-gradient(135deg, #dc2626, #b91c1c) !important;
    color: #fff4f4 !important;
    border-color: rgba(254, 202, 202, 0.8) !important;
  }

  .container-with-sidebar {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0;
    width: 100%;
  }

  body.sidebar-collapsed .app-shell {
    grid-template-columns: minmax(0, 1fr);
    max-width: var(--container-max);
  }

  body.sidebar-collapsed .sidebar-nav {
    display: none;
  }

  body.sidebar-collapsed .sidebar-drawer-toggle {
    left: 4px;
    background: linear-gradient(135deg, #1f7a3a, #2ea84f);
  }
}

.event-peperiksaan {
  background: #fff1ec;
  color: #b44c2e;
}

.event-isi_markah {
  background: #e7f6ff;
  color: #176391;
}

.event-mesyuarat {
  background: #eeeaff;
  color: #5842a5;
}

.event-taklimat {
  background: #fdf0da;
  color: #905d00;
}

.event-aktiviti {
  background: #e9f9ed;
  color: #206c34;
}

.event-umum {
  background: #ecf1f6;
  color: #465d74;
}

.upcoming-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.upcoming-list li {
  border: 1px solid #d9e5f1;
  border-radius: 14px;
  padding: 12px;
  background: #fbfdff;
}

.upcoming-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.upcoming-date {
  margin-top: 6px;
  font-size: 13px;
  color: #4f6985;
  font-weight: 700;
}

.dash-note {
  margin-top: 0;
  color: #3d5d7f;
  font-weight: 700;
}

.uat-highlight {
  margin-bottom: 16px;
  border: 1px solid #c9d2ff;
  background: linear-gradient(120deg, #eef2ff, #f2efff 52%, #eef6ff);
}

.uat-highlight-title {
  display: inline-block;
  background: linear-gradient(135deg, #4f6edc, #6f63d8);
  color: #f8faff;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.uat-highlight-body {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
}

.uat-highlight-body strong {
  font-size: 18px;
  color: #2f3f8a;
}

.uat-highlight-body span {
  color: #4d5ca7;
  font-weight: 700;
}

.inline-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline-form form {
  margin: 0;
}

@media (max-width: 900px) {
  .dash-hero {
    flex-direction: column;
    align-items: flex-start;
  }
  .dash-datetime {
    text-align: left;
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .dash-inline-filter {
    width: 100%;
  }
  .dash-inline-filter-field,
  .dash-inline-filter-field select {
    min-width: 0;
    width: 100%;
  }
}

.marksheet-wrap {
  overflow-x: auto;
}

.marksheet-table {
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
}

.marksheet-table th,
.marksheet-table td {
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}

.marksheet-table .marksheet-col-bil {
  width: 56px;
  min-width: 56px;
}

.marksheet-table .marksheet-col-name {
  min-width: 280px;
  text-align: left;
  white-space: normal;
}

.marksheet-table .marksheet-col-class {
  min-width: 90px;
}

/* Variasi warna automatik untuk kumpulan butang pada semua halaman */
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.grid-form > .row-actions {
  grid-column: 1 / -1;
  justify-content: center;
  align-items: center;
  margin-top: 4px;
}

.grid-form > .row-actions > .btn,
.grid-form > .row-actions > button,
.grid-form > .row-actions > a.btn {
  min-width: 170px;
}

.grid-form {
  row-gap: 10px;
}

.row-actions > .btn,
.row-actions > button,
.row-actions > a.btn {
  min-width: 180px;
}

.row-actions > .btn:nth-child(1),
.row-actions > button:nth-child(1),
.row-actions > a.btn:nth-child(1) {
  background: linear-gradient(135deg, #0f7f83, #1e82b5);
  color: #fff;
}

.row-actions > .btn:nth-child(2),
.row-actions > button:nth-child(2),
.row-actions > a.btn:nth-child(2) {
  background: linear-gradient(135deg, #0f7f5f, #279966);
  color: #fff;
}

.row-actions > .btn:nth-child(3),
.row-actions > button:nth-child(3),
.row-actions > a.btn:nth-child(3) {
  background: linear-gradient(135deg, #6b5ed7, #4280de);
  color: #fff;
}

.row-actions > .btn:nth-child(4),
.row-actions > button:nth-child(4),
.row-actions > a.btn:nth-child(4) {
  background: linear-gradient(135deg, #be4f37, #df6c4f);
  color: #fff;
}

.row-actions > .btn:nth-child(5),
.row-actions > button:nth-child(5),
.row-actions > a.btn:nth-child(5) {
  background: linear-gradient(135deg, #973d8d, #d05584);
  color: #fff;
}

.row-actions > .btn.btn-ghost,
.row-actions > button.btn-ghost,
.row-actions > a.btn.btn-ghost {
  background: linear-gradient(135deg, #315f90, #4378ab) !important;
  color: #ffffff !important;
  border: 1px solid #244e7b !important;
  box-shadow: 0 4px 10px rgba(20, 53, 87, 0.16) !important;
}

.row-actions > .btn.btn-ghost:hover,
.row-actions > button.btn-ghost:hover,
.row-actions > a.btn.btn-ghost:hover {
  background: linear-gradient(135deg, #2a547f, #386997) !important;
  color: #ffffff !important;
  border-color: #1e436b !important;
}

/* Pastikan semua butang ghost (di luar row-actions juga) kekal kontras */
button.btn-ghost,
.btn.btn-ghost {
  background: linear-gradient(135deg, #315f90, #4378ab) !important;
  color: #ffffff !important;
  border: 1px solid #244e7b !important;
  box-shadow: 0 4px 10px rgba(20, 53, 87, 0.16) !important;
}

button.btn-ghost:hover,
.btn.btn-ghost:hover {
  background: linear-gradient(135deg, #2a547f, #386997) !important;
  color: #ffffff !important;
  border-color: #1e436b !important;
}

/* Butang mode headcount: kekalkan identiti warna walaupun ghost */
.row-actions > .btn.hc-mode-btn.hc-mode-both {
  background: linear-gradient(135deg, #0f7f83, #1e82b5);
  color: #fff;
}

.row-actions > .btn.hc-mode-btn.hc-mode-tov {
  background: linear-gradient(135deg, #0f7f5f, #279966);
  color: #fff;
}

.row-actions > .btn.hc-mode-btn.hc-mode-etr {
  background: linear-gradient(135deg, #be4f37, #df6c4f);
  color: #fff;
}

.row-actions > .btn.hc-mode-btn.hc-mode-both.btn-ghost {
  background: linear-gradient(135deg, #2f6784, #3f7fa2) !important;
  border-color: #2f6784 !important;
  color: #fff !important;
}

.row-actions > .btn.hc-mode-btn.hc-mode-tov.btn-ghost {
  background: linear-gradient(135deg, #2e6a58, #3f896f) !important;
  border-color: #2e6a58 !important;
  color: #fff !important;
}

.row-actions > .btn.hc-mode-btn.hc-mode-etr.btn-ghost {
  background: linear-gradient(135deg, #8f4f42, #ba6a57) !important;
  border-color: #8f4f42 !important;
  color: #fff !important;
}

.data-interpretation {
  margin: 10px 2px 0;
  padding: 10px 12px;
  border-left: 4px solid #1f82ad;
  background: #f3f9ff;
  color: #34506e;
  font-size: 14px;
  line-height: 1.45;
  border-radius: 10px;
}

.scores-title-card {
  margin-bottom: 10px;
  padding: 14px 16px;
  border: 1px solid #c5d8eb;
  border-radius: 16px;
  background: linear-gradient(140deg, #f7fbff, #edf4fb);
}

.scores-title-card .scores-title-kicker {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #4f6887;
}

.scores-title-card h3 {
  margin: 0;
  font-size: 34px;
  line-height: 1.15;
}

.scores-title-blocks {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 10px;
}

.scores-title-block {
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid #c5d8eb;
  font-size: 22px;
  line-height: 1.2;
  font-weight: 800;
  color: #113457;
  text-align: center;
}

.scores-title-subject {
  background: linear-gradient(135deg, #eff8ff, #dceefe);
}

.scores-title-exam {
  background: linear-gradient(135deg, #f1fff5, #daf7e4);
}

.scores-title-class {
  background: linear-gradient(135deg, #fff6e9, #ffe8cc);
}

@media (max-width: 768px) {
  .grid-form > .row-actions {
    justify-content: center;
  }
  .grid-form > .row-actions > .btn,
  .grid-form > .row-actions > button,
  .grid-form > .row-actions > a.btn {
    flex: 1 1 100%;
    min-width: 0;
  }

  .scores-title-blocks {
    grid-template-columns: 1fr;
  }

  .scores-title-block {
    font-size: 20px;
  }
}
