/* ═══════════════════════════════════════════════════
   GURU BERTUGAS 2026 – Dual Responsive View
   Desktop/Web (>= 769px): Jadual Spreadsheet Penuh Asal (JANGAN KACAU)
   Mobile/HP (<= 768px): Paparan Kad Mesra HP Automatik
   Logo: Vektor SVG Tajam & Moden
═══════════════════════════════════════════════════ */

:root {
  --bg:           #f1f5f9;
  --surface:      #ffffff;
  --surface-alt:  #f8fafc;
  --primary:      #1e40af;
  --primary-h:    #1d4ed8;
  --primary-light:#eff6ff;
  --accent:       #2563eb;
  --hd-bg:        #0c2340;
  --text:         #0f172a;
  --text-sm:      #334155;
  --muted:        #64748b;
  --border:       #cbd5e1;
  --border-light: #e2e8f0;
  --row-alt:      #f8fafc;
  --row-hover:    #f1f5f9;
  --row-cur:      #fef9c3;
  --cur-border:   #eab308;
  --cur-glow:     rgba(234, 179, 8, 0.25);
  --success:      #15803d;
  --success-bg:   #dcfce7;
  --error:        #b91c1c;
  --error-bg:     #fee2e2;
  --radius:       12px;
  --radius-sm:    8px;
  --shadow-sm:    0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow:       0 2px 6px rgba(15, 23, 42, 0.05), 0 6px 18px rgba(15, 23, 42, 0.04);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* ── HEADER & BRAND DENGAN LOGO MENARIK ───────────── */
header {
  background: var(--hd-bg);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.hd-inner {
  max-width: 1720px;
  margin: 0 auto;
  padding: 0.65rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand-logo-wrap {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 11px;
  background: radial-gradient(circle at 30% 30%, #1e40af, #0c2340);
  padding: 2px;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 9px;
  display: block;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  line-height: 1.2;
}

.brand-tag {
  font-size: 0.68rem;
  font-weight: 800;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  padding: 0.12rem 0.45rem;
  border-radius: 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brand-sub {
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 500;
  margin-top: 1px;
}

/* Tab Navigation */
.tabs {
  display: flex;
  gap: 0.35rem;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 1.1rem;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.tab-btn.active {
  background: #1e3a8a;
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.tab-icon {
  font-size: 1rem;
}

/* ── PAGE CONTENT ─────────────────────────────────── */
.page {
  max-width: 1720px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
}

.pane {
  display: none;
}

.pane.active {
  display: block;
}

/* ═══════════════════════════════════════════════════
   1. PAPARAN WEB DESKTOP (JADUAL PENUH ASAL - KEKAL)
═══════════════════════════════════════════════════ */
#table-wrap {
  display: block;
}

#cards-wrap {
  display: none;
}

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}

#jadual-tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
}

#jadual-tbl thead th {
  padding: 0.75rem 0.9rem;
  text-align: left;
  font-size: 0.85rem;
  font-weight: 700;
  color: #f8fafc;
  background-color: #0f172a !important;
  letter-spacing: 0.02em;
  border-bottom: 2px solid #334155;
  white-space: nowrap;
}

/* Sticky Headers Asal di Desktop */
.th-fix {
  position: sticky;
  background-color: #0f172a !important;
  color: #f8fafc !important;
  z-index: 30;
}

.th-mg {
  left: 0;
  width: 70px;
  text-align: center !important;
  border-right: 1px solid #334155 !important;
  background-color: #0f172a !important;
  color: #94a3b8 !important;
  z-index: 31;
}

.th-tarikh {
  left: 70px;
  width: 160px;
  border-right: 2px solid #475569 !important;
  background-color: #0f172a !important;
  color: #f8fafc !important;
  z-index: 30;
  box-shadow: 4px 0 10px -2px rgba(0, 0, 0, 0.45);
}

.th-sesi {
  font-size: 0.88rem !important;
}

.th-pagi {
  background-color: #0f172a !important;
  color: #93c5fd !important;
  border-right: 1px solid #334155 !important;
}

.th-penyayang {
  background-color: #0f172a !important;
  color: #fde047 !important;
  border-right: 1px solid #334155 !important;
}

.th-petang {
  background-color: #0f172a !important;
  color: #d8b4fe !important;
}

/* Table Body Rows */
#jadual-tbl tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background-color 0.12s;
}

#jadual-tbl tbody tr:nth-child(even) {
  background: var(--row-alt);
}

#jadual-tbl tbody tr:hover {
  background: var(--row-hover);
}

#jadual-tbl tbody tr.cur-week {
  background: var(--row-cur) !important;
  border-left: 3px solid var(--cur-border);
}

#jadual-tbl td {
  padding: 0.45rem 0.75rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-light);
}

/* Sticky Cells Asal di Desktop */
.td-mg {
  text-align: center;
  position: sticky;
  left: 0;
  z-index: 21;
  background-color: #ffffff !important;
  border-right: 1px solid var(--border-light);
}

.td-tarikh {
  position: sticky;
  left: 70px;
  z-index: 20;
  background-color: #ffffff !important;
  border-right: 2px solid #cbd5e1 !important;
  box-shadow: 4px 0 8px -2px rgba(15, 23, 42, 0.1);
  white-space: nowrap;
}

#jadual-tbl tbody tr:nth-child(even) .td-mg,
#jadual-tbl tbody tr:nth-child(even) .td-tarikh {
  background-color: #f8fafc !important;
}

#jadual-tbl tbody tr:hover .td-mg,
#jadual-tbl tbody tr:hover .td-tarikh {
  background-color: #f1f5f9 !important;
}

#jadual-tbl tbody tr.cur-week .td-mg,
#jadual-tbl tbody tr.cur-week .td-tarikh {
  background-color: #fef9c3 !important;
}

.mg-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 32px;
  padding: 0 0.5rem;
  border-radius: 6px;
  background: #e0e7ff;
  color: #3730a3;
  font-size: 0.95rem;
  font-weight: 800;
}

.mg-badge.active-week {
  background: #facc15;
  color: #713f12;
}

.tarikh-mula {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.tarikh-akhir {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
  margin-top: 1px;
}

.td-guru-col {
  min-width: 250px;
}

.guru-stack-compact {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
}

.guru-slot-compact {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 34px;
  padding: 0.35rem 0.75rem;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.guru-slot-compact:hover {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.15);
  transform: translateY(-1px);
}

.guru-slot-compact.is-empty {
  border-style: dashed;
  background: #f8fafc;
}

.guru-slot-compact.is-empty .slot-name-txt {
  color: #94a3b8;
  font-style: italic;
  font-weight: 400;
}

.slot-name-txt {
  flex: 1;
  font-size: 0.88rem;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.guru-slot-compact.saving, .card-slot.saving {
  border-color: #f59e0b !important;
  background-color: #fffbeb !important;
}

.guru-slot-compact.saved, .card-slot.saved {
  border-color: #16a34a !important;
  background-color: #f0fdf4 !important;
}

/* ═══════════════════════════════════════════════════
   2. PAPARAN KAD MESRA HP (DIJANA PADA TELEFON PINTAR)
═══════════════════════════════════════════════════ */
.cards-wrap {
  width: 100%;
}

.cards-grid {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.week-card {
  background: var(--surface);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

/* Card Minggu Semasa */
.week-card.is-current-card {
  border-color: #eab308;
  box-shadow: 0 6px 20px var(--cur-glow);
  background: linear-gradient(180deg, #fffbeb 0%, #ffffff 70px);
  position: relative;
}

.week-card.is-current-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #f59e0b, #eab308, #f59e0b);
}

.card-header {
  padding: 0.85rem 1rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.is-current-card .card-header {
  background: #fef9c3;
  border-bottom-color: #fef08a;
}

.card-header-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.card-mg-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 34px;
  padding: 0 0.55rem;
  border-radius: 8px;
  background: #e0e7ff;
  color: #3730a3;
  font-size: 0.95rem;
  font-weight: 800;
}

.is-current-card .card-mg-badge {
  background: #facc15;
  color: #713f12;
}

.card-dates {
  display: flex;
  flex-direction: column;
}

.card-tarikh-mula {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}

.card-tarikh-akhir {
  font-size: 0.76rem;
  color: var(--muted);
  font-weight: 500;
}

.cur-week-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: #fef08a;
  border: 1px solid #eab308;
  color: #713f12;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.25rem 0.55rem;
  border-radius: 20px;
  white-space: nowrap;
}

.card-body {
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.duty-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.duty-group-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding-bottom: 0.2rem;
  border-bottom: 1px dashed var(--border-light);
}

.duty-group-title.pagi { color: #1e40af; }
.duty-group-title.penyayang { color: #854d0e; }
.duty-group-title.petang { color: #6b21a8; }

.card-slots-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.card-slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  min-height: 44px;
  padding: 0.5rem 0.85rem;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.card-slot:hover {
  border-color: #2563eb;
  background: #eff6ff;
  transform: translateY(-1px);
}

.card-slot:active {
  transform: scale(0.99);
}

.card-slot.is-empty {
  border-style: dashed;
  background: #f8fafc;
  color: #94a3b8;
}

.card-slot.is-empty .slot-name-txt {
  color: #94a3b8;
  font-style: italic;
  font-weight: 500;
  font-size: 0.85rem;
}

.card-slot-icon {
  font-size: 0.95rem;
  color: #64748b;
  flex-shrink: 0;
}

.card-slot-action {
  font-size: 0.76rem;
  color: #2563eb;
  font-weight: 600;
  opacity: 0.85;
}

/* Floating button lompat minggu semasa di HP */
.fab-current {
  display: none;
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 90;
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  color: #ffffff;
  border: 1.5px solid #60a5fa;
  border-radius: 50px;
  padding: 0.65rem 1.15rem;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  align-items: center;
  gap: 0.45rem;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
  cursor: pointer;
}

/* ═══════════════════════════════════════════════════
   MODAL PEMILIHAN GURU (DESKTOP MODAL + HP BOTTOM SHEET)
═══════════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #ffffff;
  border-radius: 14px;
  width: 560px;
  max-width: 94vw;
  max-height: 84vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.3);
  border: 1px solid #e2e8f0;
  transform: scale(0.95);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.modal-backdrop.active .modal-card {
  transform: scale(1);
}

.modal-handle {
  display: none;
  width: 44px;
  height: 5px;
  background: #cbd5e1;
  border-radius: 4px;
  margin: 0.6rem auto 0;
}

.modal-header {
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
}

.modal-sub {
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 500;
  margin-top: 2px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #94a3b8;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  transition: all 0.15s;
}

.modal-close:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.modal-search-wrap {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: #ffffff;
}

.modal-search-icon {
  font-size: 1.1rem;
  color: #64748b;
}

.modal-search-wrap input {
  border: none;
  outline: none;
  width: 100%;
  font-size: 1rem;
  font-family: inherit;
  color: #1e293b;
  background: transparent;
}

.btn-clear-search {
  background: #f1f5f9;
  border: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: #64748b;
  font-size: 1rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
}

.btn-clear-search:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.modal-list {
  padding: 0.5rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.modal-teacher-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  min-height: 44px;
}

.modal-teacher-item:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.modal-teacher-item:active {
  background: #e2e8f0;
}

.modal-teacher-item.selected {
  background: #eff6ff;
  border-color: #93c5fd;
}

.teacher-info {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.teacher-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: #1e293b;
}

.teacher-stats {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.stat-badge {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  white-space: nowrap;
}

.stat-bertugas {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.stat-penyayang {
  background: #fefce8;
  color: #854d0e;
  border: 1px solid #fef08a;
}

.teacher-check {
  font-size: 0.8rem;
  font-weight: 700;
  color: #16a34a;
  background: #dcfce7;
  padding: 0.2rem 0.55rem;
  border-radius: 12px;
  white-space: nowrap;
}

.modal-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #475569;
  background: #f1f5f9;
  border-radius: 6px;
  margin: 0.4rem 0 0.25rem;
}

.modal-section-header.cadangan-header {
  color: #1e40af;
  background: #eff6ff;
  border-left: 3px solid #2563eb;
}

.modal-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: #94a3b8;
  font-size: 0.92rem;
}

.modal-info-note {
  text-align: center;
  padding: 0.65rem 0.85rem;
  font-size: 0.78rem;
  color: #64748b;
  background: #f8fafc;
  border-top: 1px dashed #cbd5e1;
  margin-top: 0.5rem;
  border-radius: 6px;
  line-height: 1.4;
}

.modal-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
}

.btn-modal-clear {
  background: transparent;
  border: 1px solid #fecaca;
  color: #dc2626;
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-modal-clear:hover {
  background: #fee2e2;
}

.btn-modal-close {
  background: #e2e8f0;
  border: none;
  color: #334155;
  padding: 0.45rem 1rem;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-modal-close:hover {
  background: #cbd5e1;
}

/* ── LOG TAB ──────────────────────────────────────── */
.log-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.5rem 1.1rem;
  border-radius: 8px;
}

.stat-num {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
}

.stat-lbl {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}

.stat-ok .stat-num { color: var(--success); }
.stat-err .stat-num { color: var(--error); }

#log-tbl {
  width: 100%;
  border-collapse: collapse;
}

#log-tbl th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.85rem;
  font-weight: 700;
  color: #f8fafc;
  background-color: #0f172a !important;
  border-bottom: 2px solid #334155;
}

#log-tbl td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.9rem;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
}

.badge-guru {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.badge-ib {
  background: #fdf2f8;
  color: #be185d;
  border: 1px solid #fbcfe8;
}

.badge-ok {
  background: #dcfce7;
  color: #15803d;
}

.badge-err {
  background: #fee2e2;
  color: #b91c1c;
}

.ts {
  color: var(--muted);
  font-size: 0.82rem;
}

/* ── LOADING & TOAST ──────────────────────────────── */
.td-loading, .td-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1100;
  padding: 0.75rem 1.4rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  background: #1e293b;
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.ok { background: #15803d; }
.toast.err { background: #b91c1c; }
.toast.info { background: #1e40af; }

/* ═══════════════════════════════════════════════════
   MEDIA QUERY: BILA DIBUKA DI TELEFON PINTAR / HP (<= 768px)
   - Sembunyikan Jadual Spreadsheet Penuh Desktop
   - Paparkan Kad Mingguan Mesra HP Secara Automatik
═══════════════════════════════════════════════════ */
@media (max-width: 768px) {
  html {
    font-size: 14px;
  }

  /* TUKAR PAPARAN UTAMA KEPADA KAD DI HP */
  #table-wrap {
    display: none !important;
  }

  #cards-wrap {
    display: block !important;
  }

  .fab-current {
    display: inline-flex;
  }

  .hd-inner {
    padding: 0.55rem 0.85rem;
    gap: 0.5rem;
  }

  .brand-logo-wrap {
    width: 36px;
    height: 36px;
    border-radius: 9px;
  }

  .brand-title {
    font-size: 0.95rem;
  }

  .brand-sub {
    font-size: 0.68rem;
  }

  .tab-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
  }

  .page {
    padding: 0.65rem 0.65rem;
    padding-bottom: 5rem;
  }

  /* Bottom sheet modal di HP */
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal-card {
    width: 100%;
    max-width: 100%;
    max-height: 88vh;
    border-radius: 18px 18px 0 0;
    margin: 0;
    transform: translateY(100%);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.35);
  }

  .modal-backdrop.active .modal-card {
    transform: translateY(0);
  }

  .modal-handle {
    display: block;
  }

  .modal-header {
    padding: 0.8rem 1rem;
  }

  .modal-title {
    font-size: 1rem;
  }

  .modal-search-wrap {
    padding: 0.75rem 1rem;
  }

  .modal-teacher-item {
    padding: 0.75rem 0.85rem;
    min-height: 48px;
  }

  .modal-footer {
    padding: 0.75rem 1rem;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  }

  .btn-modal-clear, .btn-modal-close {
    flex: 1;
    text-align: center;
    justify-content: center;
  }

  .log-toolbar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }

  .stat-pill {
    padding: 0.5rem 0.65rem;
    justify-content: center;
    text-align: center;
    flex-direction: column;
    gap: 0.2rem;
  }

  .toast {
    left: 1rem;
    right: 1rem;
    bottom: 4.8rem;
    text-align: center;
  }
}
