/* ═══════════════════════════════════════════════
   FSKTM Timetable Generator — styles.css
   Breakpoints:
     Desktop : ≥ 1025px  — two-col layout, full table
     Tablet  : 769–1024px — stacked layout, scrollable table
     Mobile  : ≤ 768px   — single-col, card view default
   ═══════════════════════════════════════════════ */

/*  ════════════════════════════════
    DESIGN TOKENS
    ════════════════════════════════ */
:root {
  --bg: #080d18;
  --s1: #0e1525;
  --s2: #141e32;
  --s3: #1a263e;
  --border: #1e2d45;
  --border2: #243450;
  --grid-line: rgba(255, 255, 255, 0.05);
  --accent: #4f8ef7;
  --accent2: #7c6dfa;
  --text: #dde5f4;
  --muted: #5a7299;
  --muted2: #8ba3c7;
  --red: #f05252;
  --green: #10b981;
  --yellow: #f59e0b;
  --wrap-pad: 24px;
  --radius: 14px;
  --max-credits: 25;
}

:root[data-theme="light"] {
  --bg: #f0f4f8;
  --s1: #ffffff;
  --s2: #f1f5f9;
  --s3: #e4eaf2;
  --border: #dde3ec;
  --border2: #c5d0df;
  --grid-line: rgba(15, 23, 42, 0.08);
  --accent: #3b82f6;
  --accent2: #6366f1;
  --text: #0f172a;
  --muted: #64748b;
  --muted2: #475569;
}

/* ════════════════════════════════
   RESET & BASE
════════════════════════════════ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  /* never let body cause horizontal scroll */
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    linear-gradient(rgba(79, 142, 247, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 142, 247, .025) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

.wrap {
  max-width: 1480px;
  margin: 0 auto;
  padding: 0 var(--wrap-pad);
  position: relative;
  z-index: 1;
  width: 100%;
  min-width: 0;
  /* never exceed viewport */
}

/* ════════════════════════════════
   HEADER
════════════════════════════════ */
/* ════ HEADER ════ */
header {
  border-bottom: 1px solid var(--border);
  padding: 16px 0 14px;
  margin-bottom: 24px;
  position: relative;
}

/* Subtle top accent line */
header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent2), transparent);
  opacity: 0.6;
}

.hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: nowrap;
}

@media (max-width: 768px) {
  .hdr {
    align-items: flex-start;
  }
}

/* ── Brand (left side) ── */
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  flex: 1;
  min-width: 0;
  /* critical: lets flex child shrink */
  overflow: hidden;
}

@media (max-width: 768px) {
  .brand {
    align-items: flex-start;
    overflow: visible;
  }

  .brand-icon {
    margin-top: 2px;
  }
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: linear-gradient(135deg, #4f8ef7, #7c6dfa);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(79, 142, 247, .35);
  position: relative;
  overflow: hidden;
}

.brand-icon::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, .18) 0%, transparent 60%);
  border-radius: inherit;
}

.brand-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.brand h1 {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: clamp(15px, 2.5vw, 21px);
  color: var(--text);
  letter-spacing: -.5px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  /* Remove gradient from h1 — handled by span below */
  background: none;
  -webkit-background-clip: unset;
  -webkit-text-fill-color: unset;
  background-clip: unset;
}

/* "Generator" gets the accent gradient */
.brand-highlight {
  background: linear-gradient(110deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-sub {
  font-size: clamp(10px, 1.5vw, 12px);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

/* ── Right controls ── */
.hdr-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.hdr-badge {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 600;
  border: 1px solid rgba(79, 142, 247, .3);
  color: #93b4ef;
  background: rgba(79, 142, 247, .08);
  letter-spacing: .4px;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

:root[data-theme="light"] .hdr-badge {
  color: var(--accent);
  background: rgba(79, 142, 247, .06);
}

.toggles {
  display: flex;
  gap: 7px;
  flex-shrink: 0;
  margin-left: 8px;
  /* breathing room from the title */
}

.btn-icon {
  background: var(--s2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 34px;
  height: 34px;
  border-radius: 9px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  transition: all .2s;
  flex-shrink: 0;
}

.btn-icon:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(79, 142, 247, .08);
}

/* ── Responsive: tablet (769–1024px) ── */
@media (max-width: 1024px) {
  .brand h1 {
    font-size: clamp(14px, 3vw, 18px);
  }

  .hdr-badge {
    display: none;
  }
}

/* ── Responsive: mobile (≤ 768px) ── */
@media (max-width: 768px) {
  header {
    padding: 11px 0 10px;
    margin-bottom: 14px;
  }

  .brand-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
  }

  .brand h1 {
    /* Allow title to wrap onto two lines so full text is readable on phones. */
    font-size: clamp(11px, 3.5vw, 13px);
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    letter-spacing: -0.5px;
    line-height: 1.2;
  }

  .brand-sub {
    display: none;
  }

  .hdr-badge {
    display: none;
  }

  .btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 11px;
  }
}

/* ── Responsive: small phones (≤ 420px) ── */
@media (max-width: 420px) {
  .brand {
    gap: 9px;
  }

  .brand-icon {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    transform: translateY(1px);
  }

  .btn-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
  }

  .toggles {
    gap: 5px;
    margin-left: 4px;
  }

  .brand h1 {
    font-size: clamp(10px, 3.2vw, 12px);
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    letter-spacing: -0.6px;
    line-height: 1.2;
  }

  .brand-highlight {
    font-size: 0.95em;
  }
}

/* ── Responsive: very small (≤ 360px) ── */
@media (max-width: 360px) {
  .brand-icon {
    width: 30px;
    height: 30px;
  }

  .brand h1 {
    font-size: 11px;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }

  .brand {
    gap: 8px;
  }
}

#btn-theme {
  position: relative;
  overflow: hidden;
}

#btn-theme svg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform-origin: center;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
}

html:not([data-theme="light"]) #btn-theme .icon-sun {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(-90deg) scale(0.5);
}

html:not([data-theme="light"]) #btn-theme .icon-moon {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(0) scale(1);
}

html[data-theme="light"] #btn-theme .icon-sun {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(0) scale(1);
}

html[data-theme="light"] #btn-theme .icon-moon {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(90deg) scale(0.5);
}

/* ════════════════════════════════
   LAYOUT  — Desktop ≥ 1025px
   Sidebar fixed-width left | fluid timetable right
════════════════════════════════ */
.layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 24px;
  align-items: start;
  min-width: 0;
  /* grid must not grow wider than viewport */
}

/* Timetable column must never overflow */
.layout>div:last-child {
  min-width: 0;
}

/* ════════════════════════════════
   SIDEBAR
════════════════════════════════ */
.sidebar {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.panel {
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow .2s;
}

/* Sidebar panels are now static as requested */

.panel-hdr {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.panel-hdr> :nth-child(2) {
  margin-left: auto;
}

.panel-title {
  font-family: 'Syne', sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted2);
  display: inline-flex;
  align-items: center;
  line-height: 1.1;
}

.pill {
  background: rgba(79, 142, 247, .12);
  color: var(--accent);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  min-height: 20px;
}

.pill.green {
  background: rgba(16, 185, 129, .12);
  color: #34d399;
}

.pill.red {
  background: rgba(240, 82, 82, .12);
  color: #f87171;
}


/* ════════════════════════════════
   SEARCH
════════════════════════════════ */

.srch-wrap {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.srch-wrap input {
  width: 100%;
  background: var(--s2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 12px 9px 34px;
  color: var(--text);
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  transition: border-color .15s;
}

.srch-wrap input:focus {
  border-color: var(--accent);
}

.srch-wrap input::placeholder {
  color: var(--muted);
}

.srch-icon {
  position: absolute;
  left: 30px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
}

/* ════════════════════════════════
   COURSE LIST
════════════════════════════════ */
.clist {
  max-height: 380px;
  overflow-y: auto;
}

.clist::-webkit-scrollbar {
  width: 3px;
}

.clist::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 3px;
}

.citem {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, .025);
  transition: background .12s;
}

.citem:hover {
  background: var(--s2);
}

.citem.sel {
  background: rgba(79, 142, 247, .07);
}

.citem.no-sec {
  opacity: .42;
  cursor: not-allowed;
}

.cbox {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border2);
  border-radius: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .12s;
  background: transparent;
}

.citem.sel .cbox {
  background: var(--accent);
  border-color: var(--accent);
}

.citem.sel .cbox::after {
  content: '✓';
  color: #fff;
  font-size: 9px;
  font-weight: 700;
}

.cinfo {
  flex: 1;
  min-width: 0;
}

.ccode {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  font-family: 'Syne', sans-serif;
}

.cname {
  font-size: 11px;
  color: var(--muted2);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.csec-count {
  font-size: 10px;
  color: var(--muted);
  flex-shrink: 0;
}

.clist-divider {
  padding: 5px 18px 4px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, .18);
}

/* ════════════════════════════════
   SELECTION AREA
════════════════════════════════ */
.sel-area {
  padding: 0;
}

.sel-course-block {
  border-bottom: 1px solid var(--border);
  padding: 12px 18px;
  animation: fadeIn .2s ease;
  cursor: pointer;
}

.sel-course-block:hover {
  background: rgba(255, 255, 255, 0.02);
}

.sel-course-block:focus-visible {
  outline: 3px solid rgba(99, 102, 241, 0.35);
  outline-offset: -2px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.sel-code {
  font-family: 'Syne', sans-serif;
  font-size: 12px;
  font-weight: 700;
}

.sel-remove {
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: color .1s;
}

.sel-remove:hover {
  color: var(--red);
}

.sel-name {
  font-size: 11px;
  color: var(--muted2);
  margin-bottom: 9px;
  line-height: 1.4;
}

.sec-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sec-pill {
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid var(--border2);
  color: var(--muted2);
  background: transparent;
  transition: all .12s;
  font-family: 'DM Mono', monospace;
}

.sec-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.sec-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.sec-pill.conflict {
  border-color: var(--red);
  color: var(--red) !important;
  background: rgba(240, 82, 82, .08);
}

.sec-pill.conflict.active {
  background: var(--red);
  color: #fff;
}

.credit-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted2);
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--border2);
  border-radius: 5px;
  padding: 2px 7px;
  font-family: 'DM Mono', monospace;
}

.sidebar-foot {
  padding: 14px 18px;
}

.conflict-hint {
  font-size: 11px;
  color: #f87171;
  margin-bottom: 10px;
  display: none;
  line-height: 1.5;
}

.btn-reset {
  width: 100%;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--s2);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  letter-spacing: .5px;
}

.btn-reset:hover {
  background: rgba(240, 82, 82, .08);
  color: var(--red);
  border-color: rgba(240, 82, 82, .25);
}

.btn-reset:active {
  transform: translateY(1px);
}

.btn-save {
  width: 100%;
  padding: 11px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: rgba(79, 142, 247, .1);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  letter-spacing: .5px;
}

.btn-save:hover {
  background: var(--accent);
  color: #fff;
}

.btn-save:active {
  transform: translateY(1px);
}

/* ════════════════════════════════
   SAVED TIMETABLES (HISTORY)
════════════════════════════════ */
.saved-area {
  padding: 10px 16px 12px;
  max-height: 250px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.saved-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: var(--s2);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all .15s ease;
}

.saved-card:hover {
  border-color: var(--border2);
  transform: translateY(-1px);
  background: var(--s3);
}

.saved-name {
  font-family: 'Syne', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}

.saved-meta {
  font-size: 10px;
  color: var(--muted);
  font-family: 'DM Mono', monospace;
}

.saved-actions {
  display: flex;
  gap: 6px;
}

.btn-load {
  padding: 5px 12px;
  font-size: 11px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  background: rgba(16, 185, 129, .1);
  color: #10b981;
  border-color: transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s;
}

.btn-load:hover {
  background: #10b981;
  color: #fff;
}

.btn-del {
  padding: 5px 12px;
  font-size: 11px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  background: rgba(240, 82, 82, .1);
  color: var(--red);
  border-color: transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s;
}

.btn-del:hover {
  background: var(--red);
  color: #fff;
}

/* ════════════════════════════════
   MODALS
════════════════════════════════ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.modal.show {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  width: 90%;
  max-width: 400px;
  transform: translateY(20px) scale(0.95);
  transition: all 0.2s ease;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.modal.show .modal-content {
  transform: translateY(0) scale(1);
}

/* ════════════════════════════════
   TIMETABLE PANEL
════════════════════════════════ */
.tt-wrap {
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-width: 0;
  width: 100%;
  /* never exceed grid cell */
}

.tt-hdr {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.tt-title {
  font-family: 'Syne', sans-serif;
  font-size: 15px;
  font-weight: 800;
}

.tt-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tt-btn-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 13px;
  flex-shrink: 0;
  opacity: 0.95;
}

/* Unify timetable header buttons (Table, Days Left, Print/Download, Export). */
.tt-actions .btn-view-toggle,
.tt-actions .btn-sm {
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border2);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted2);
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  line-height: 1;
  white-space: nowrap;
  transition: all 0.15s;
}

.tt-actions .btn-view-toggle:hover,
.tt-actions .btn-sm:hover {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(79, 142, 247, .08);
}

.tt-actions .btn-view-toggle.active {
  border-color: rgba(79, 142, 247, .55);
  color: var(--accent);
  background: rgba(79, 142, 247, .12);
}

.tt-actions .btn-print {
  border-color: rgba(79, 142, 247, .45);
  color: var(--accent);
  background: rgba(79, 142, 247, .10);
}

.tt-actions .btn-export {
  border-color: rgba(124, 109, 250, .45);
  color: #b9b2ff;
  background: rgba(124, 109, 250, .10);
}

.tt-actions .btn-print:hover {
  background: rgba(79, 142, 247, .16);
}

.tt-actions .btn-export:hover {
  background: rgba(124, 109, 250, .16);
}

.tt-actions .btn-print svg {
  flex-shrink: 0;
}

.btn-sm {
  padding: 7px 13px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  border: 1px solid;
  transition: background .12s;
}

.btn-print {
  border-color: rgba(79, 142, 247, .35);
  color: var(--accent);
  background: rgba(79, 142, 247, .08);
}

.btn-print:hover {
  background: rgba(79, 142, 247, .16);
}


/* View-toggle shared styles */
.btn-view-toggle {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'DM Mono', monospace;
  white-space: nowrap;
  border: 1px solid var(--border2);
  color: var(--muted2);
  background: transparent;
  align-items: center;
  gap: 4px;
  transition: all .15s;
}

.btn-view-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-view-toggle.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(79, 142, 247, .08);
}

/* Keep the Table/Cards toggle visible on desktop too (users may still prefer card view). */

@media (max-width: 520px) {
  .tt-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
  }

  .tt-actions .btn-view-toggle,
  .tt-actions .btn-sm {
    width: 100%;
    padding: 0 10px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

.conflict-strip {
  margin: 12px 20px;
  padding: 9px 13px;
  background: rgba(240, 82, 82, .08);
  border: 1px solid rgba(240, 82, 82, .25);
  border-radius: 9px;
  font-size: 11px;
  color: #f87171;
  display: none;
  line-height: 1.6;
}

.empty {
  padding: 70px 24px;
  text-align: center;
}

.empty-ico {
  font-size: 42px;
  margin-bottom: 14px;
  opacity: .3;
}

.empty h3 {
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  color: var(--muted2);
  margin-bottom: 6px;
}

.empty p {
  font-size: 12px;
  color: var(--muted);
}

/* ════════════════════════════════
   TABLE VIEW  (desktop + tablet scroll)
   ─────────────────────────────────
   Key: .tt-scroll is the ONLY element
   that scrolls. Everything outside it
   stays locked to the viewport width.
════════════════════════════════ */
.tt-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}

.tt-scroll::-webkit-scrollbar {
  height: 4px;
}

.tt-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.tt-scroll::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 4px;
}

.tt-table {
  border-collapse: collapse;
  width: 100%;
  table-layout: fixed;
  /* Minimum readable width — scroll kicks in inside .tt-scroll below this */
  min-width: 680px;
}

.tt-table th {
  padding: 8px 2px;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  text-align: center;
  white-space: nowrap;
}

.tt-table th.day-th {
  text-align: left;
  padding-left: 12px;
  color: var(--text);
  font-family: 'Syne', sans-serif;
  font-size: 10px;
  width: 100px;
  border-right: 1px solid var(--border);
}

.tt-table td {
  border: 1px solid var(--grid-line);
  height: 58px;
  vertical-align: top;
  position: relative;
  padding: 0;
  /* Important: removes default padding so absolute inset fills perfectly */
}

.tt-table td.day-td {
  padding: 0 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted2);
  vertical-align: middle;
  white-space: nowrap;
  border-right: 1px solid var(--border);
  background: var(--s2);
  font-family: 'Syne', sans-serif;
  width: 56px;
}

.tt-table tr:hover td:not(.day-td) {
  background: rgba(255, 255, 255, .006);
}

.lunch-cell {
  background: rgba(0, 0, 0, .22) !important;
  position: relative;
}

.lunch-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: rgba(255, 255, 255, .1);
  text-transform: uppercase;
  writing-mode: vertical-lr;
  transform: rotate(180deg);
}

.slot {
  position: absolute;
  inset: 2px;
  border-radius: 6px;
  padding: 3px 5px;
  overflow: hidden;
  cursor: default;
  transition: transform .1s;
  display: flex;
  flex-direction: column;
  min-height: calc(100% - 4px);
  /* ensure it stretches to fill the cell */
}

.slot:hover {
  transform: scale(1.04);
  z-index: 20;
  overflow: visible;
}

.slot-code {
  font-family: 'Syne', sans-serif;
  font-size: 8.5px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slot-meta {
  font-size: 7.5px;
  opacity: .8;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 3px;
}

.slot-name {
  font-size: 7px;
  opacity: .72;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.slot-venue {
  font-size: 7px;
  opacity: .55;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slot-dur {
  font-size: 7.5px;
  opacity: .75;
  margin-top: 1px;
  white-space: nowrap;
}

.slot-type-badge {
  display: inline-block;
  font-size: 6.5px;
  font-weight: 700;
  letter-spacing: .3px;
  padding: 1px 3px;
  border-radius: 2px;
  opacity: .85;
  background: rgba(255, 255, 255, .15);
  flex-shrink: 0;
}

.conflict-cell {
  background: rgba(240, 82, 82, .06);
}

.conflict-inner {
  position: absolute;
  left: 2px;
  right: 2px;
  border-radius: 6px;
  padding: 2px 4px;
  overflow: hidden;
  background: rgba(240, 82, 82, .12);
  border: 1.5px solid rgba(240, 82, 82, .4);
}

.conflict-inner .slot-code {
  color: #fca5a5;
  font-size: 7.5px;
}

/* Desktop: inline time label hidden — column header is sufficient */
@media (min-width: 769px) {
  .desktop-hide {
    display: none !important;
  }
}

/* ════════════════════════════════
   CARD VIEW  ← rendered by buildCardsHTML()
   Used on mobile by default; toggle on tablet
════════════════════════════════ */
.cards-view {
  padding: 0;
}

.day-section {
  border-bottom: 1px solid var(--border);
}

.day-section:last-child {
  border-bottom: none;
}

.day-section-hdr {
  padding: 10px 16px 8px;
  background: var(--s2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.day-pip {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.day-label {
  font-family: 'Syne', sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.day-slots {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.day-empty {
  padding: 12px 16px;
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
}

/* Individual slot card */
.slot-card {
  border-radius: 10px;
  padding: 11px 13px;
  border-left: 3px solid transparent;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto auto;
  column-gap: 12px;
  row-gap: 2px;
  background: var(--s2);
  animation: fadeIn .15s ease;
  overflow: hidden;
  position: relative;
}

/* subtle shimmer in top-right */
.slot-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 50px;
  background: linear-gradient(to left, rgba(255, 255, 255, .012), transparent);
  pointer-events: none;
}

.sc-code {
  font-family: 'Syne', sans-serif;
  font-size: 13px;
  font-weight: 800;
  grid-column: 1;
  grid-row: 1;
  line-height: 1.2;
  align-self: center;
}

.sc-time {
  font-family: 'DM Mono', monospace;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted2);
  grid-column: 2;
  grid-row: 1;
  text-align: right;
  white-space: nowrap;
  align-self: center;
}

.sc-name {
  font-size: 11px;
  color: var(--muted2);
  line-height: 1.35;
  grid-column: 1 / -1;
  grid-row: 2;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.sc-tags {
  grid-column: 1 / -1;
  grid-row: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 5px;
}

.sc-tag {
  font-size: 9.5px;
  font-weight: 700;
  font-family: 'DM Mono', monospace;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .07);
  color: var(--muted2);
}

.sc-tag.type-K,
.sc-tag.type-L {
  background: rgba(79, 142, 247, .15);
  color: #93c5fd;
}

.sc-tag.type-A,
.sc-tag.type-P {
  background: rgba(16, 185, 129, .15);
  color: #6ee7b7;
}

.sc-tag.type-T {
  background: rgba(245, 158, 11, .15);
  color: #fcd34d;
}

.sc-tag.is-conflict {
  background: rgba(240, 82, 82, .15);
  color: #f87171;
}

/* ════════════════════════════════
   STATS ROW
════════════════════════════════ */
.stat-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-top: 1px solid var(--border);
  background: var(--s2);
}

.stat {
  padding: 13px 10px;
  text-align: center;
  border-right: 1px solid var(--border);
}

.stat:last-child {
  border-right: none;
}

.stat-n {
  font-family: 'Syne', sans-serif;
  font-size: 20px;
  font-weight: 800;
}

.stat-l {
  font-size: 9.5px;
  color: var(--muted);
  margin-top: 2px;
}

/* ════════════════════════════════
   LEGEND
════════════════════════════════ */
.legend {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.legend-t {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--muted);
  margin-right: 4px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: var(--muted2);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.legend-sep {
  width: 1px;
  height: 13px;
  background: var(--border);
  margin: 0 4px;
}

/* ════════════════════════════════
   SLOT COLOUR CLASSES
════════════════════════════════ */
.c0 {
  background: rgba(79, 142, 247, .2);
  border-left: 3px solid #4f8ef7;
  color: #93c5fd;
}

.c1 {
  background: rgba(16, 185, 129, .2);
  border-left: 3px solid #10b981;
  color: #6ee7b7;
}

.c2 {
  background: rgba(245, 158, 11, .2);
  border-left: 3px solid #f59e0b;
  color: #fcd34d;
}

.c3 {
  background: rgba(240, 82, 82, .2);
  border-left: 3px solid #f05252;
  color: #fca5a5;
}

.c4 {
  background: rgba(139, 92, 246, .2);
  border-left: 3px solid #8b5cf6;
  color: #c4b5fd;
}

.c5 {
  background: rgba(236, 72, 153, .2);
  border-left: 3px solid #ec4899;
  color: #f9a8d4;
}

.c6 {
  background: rgba(20, 184, 166, .2);
  border-left: 3px solid #14b8a6;
  color: #5eead4;
}

.c7 {
  background: rgba(249, 115, 22, .2);
  border-left: 3px solid #f97316;
  color: #fdba74;
}

.c8 {
  background: rgba(99, 102, 241, .2);
  border-left: 3px solid #6366f1;
  color: #a5b4fc;
}

.c9 {
  background: rgba(34, 197, 94, .2);
  border-left: 3px solid #22c55e;
  color: #86efac;
}

.c10 {
  background: rgba(251, 191, 36, .2);
  border-left: 3px solid #fbbf24;
  color: #fde68a;
}

.c11 {
  background: rgba(167, 139, 250, .2);
  border-left: 3px solid #a78bfa;
  color: #ddd6fe;
}

.type-K .slot-type-badge {
  background: rgba(79, 142, 247, .25);
}

.type-A .slot-type-badge {
  background: rgba(16, 185, 129, .25);
}

.type-T .slot-type-badge {
  background: rgba(245, 158, 11, .25);
}

/* ════════════════════════════════
   TABLET  769px – 1024px
   Single-column layout, sidebar on top.
   Table still scrolls inside .tt-scroll.
   View-toggle button appears.
════════════════════════════════ */
@media (max-width: 1024px) {
  :root {
    --wrap-pad: 18px;
  }

  /* Stack sidebar above timetable */
  .layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .sidebar {
    position: static;
  }

  /* Side-by-side panels on tablet */
  .sidebar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }

  .clist {
    max-height: 260px;
  }

  /* Show view-toggle button */
  .btn-view-toggle {
    display: inline-flex;
  }

  /* Slightly tighter table */
  .tt-table th {
    font-size: 8px;
    padding: 6px 2px;
  }

  .tt-table td {
    height: 52px;
  }

  .tt-table td.day-td {
    font-size: 10px;
    width: 48px;
    padding: 0 8px;
  }

  .slot-code {
    font-size: 8px;
  }

  .slot-meta {
    font-size: 7px;
  }

  .stat-n {
    font-size: 17px;
  }

  .stat {
    padding: 10px 8px;
  }
}

/* ════════════════════════════════
   MOBILE  ≤ 768px
   Full single-column.
   Card view shown by default (via JS).
   Table view available via toggle.
════════════════════════════════ */
@media (max-width: 768px) {
  :root {
    --wrap-pad: 12px;
  }

  /* Single-column sidebar */
  .sidebar {
    display: flex !important;
    flex-direction: column;
    gap: 10px;
  }

  .clist {
    max-height: 220px;
  }

  /* Show view-toggle */
  .btn-view-toggle[data-view="cards"] {
    display: inline-flex !important;
  }

  /* tt-hdr tighter */
  .tt-hdr {
    padding: 12px 14px;
    gap: 6px;
  }

  .tt-title {
    font-size: 13px;
  }

  /* Stats: 3-column with bottom row */
  .stat-row {
    grid-template-columns: repeat(3, 1fr);
  }

  .stat:nth-child(n+4) {
    border-top: 1px solid var(--border);
  }

  .stat:nth-child(3) {
    border-right: none;
  }

  .stat-n {
    font-size: 16px;
  }

  .stat {
    padding: 10px 6px;
  }

  .stat-l {
    font-size: 9px;
  }

  /* Legend compact */
  .legend {
    padding: 10px 14px;
    gap: 6px;
  }

  .legend-item {
    font-size: 9px;
  }

  /* Conflict strip */
  .conflict-strip {
    margin: 8px 12px;
    padding: 8px 11px;
    font-size: 10px;
  }

  /* Empty state */
  .empty {
    padding: 50px 20px;
  }
}

/* ════════════════════════════════
   EXTRA SMALL  ≤ 480px
════════════════════════════════ */
@media (max-width: 480px) {
  .stat-row {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Reset nth-child overrides from 768 */
  .stat:nth-child(3) {
    border-right: 1px solid var(--border);
    border-top: 1px solid var(--border);
  }

  .stat:nth-child(4) {
    border-top: 1px solid var(--border);
  }

  .stat:nth-child(5) {
    grid-column: 1 / -1;
    border-top: 1px solid var(--border);
    border-right: none;
  }

  .stat:nth-child(even) {
    border-right: none;
  }
}

/* ════════════════════════════════
   ORIENTATION BUTTON
════════════════════════════════ */
/* Button styling overlaps with .btn-view-toggle */

/* ════════════════════════════════
   DAYS-LEFT TABLE LAYOUT
════════════════════════════════ */
.tt-table-dl {
  table-layout: auto;
  min-width: 520px;
}

.tt-table-dl .time-th {
  width: 80px;
  text-align: right !important;
  padding-right: 10px !important;
  font-family: 'DM Mono', monospace;
  font-size: 9px;
}

.tt-table-dl .day-col-th {
  font-family: 'Syne', sans-serif;
  font-size: 10px;
  font-weight: 700;
  color: var(--text);
  border-right: 1px solid var(--border);
  min-width: 120px;
}

.tt-table-dl .time-td {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  font-weight: 500;
  color: var(--muted2);
  text-align: right;
  padding-right: 10px;
  white-space: nowrap;
  background: var(--s2);
  border-right: 1px solid var(--border);
  vertical-align: middle;
  width: 80px;
}

/* ════════════════════════════════
   COLOR SWATCH BUTTON
════════════════════════════════ */
.color-swatch-btn {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 2px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform .12s, box-shadow .12s;
  padding: 0;
  outline: none;
}

.color-swatch-btn:hover {
  transform: scale(1.2);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .25);
}

/* ════════════════════════════════
   COLOR PICKER POPUP
════════════════════════════════ */
.color-picker-popup {
  z-index: 2000;
  background: var(--s1);
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, .5);
  min-width: 196px;
  animation: cpFadeIn .15s ease;
}

@keyframes cpFadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.cp-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--muted2);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cp-code {
  font-family: 'DM Mono', monospace;
  color: var(--accent);
  font-size: 10px;
}

.cp-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.cp-swatch {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .1s, box-shadow .1s;
  border: 2px solid transparent;
}

.cp-swatch:hover:not(.taken) {
  transform: scale(1.15);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .3);
}

.cp-swatch.active {
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .4);
}

.cp-swatch.taken {
  opacity: .3;
  cursor: not-allowed;
}

.cp-check,
.cp-x {
  font-size: 12px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
}

/* ════════════════════════════════
   RESET CONFIRM MODAL
════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal-box {
  background: var(--s1);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 28px 28px 22px;
  width: 100%;
  max-width: 340px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
  transform: translateY(10px) scale(.97);
  transition: transform .18s ease;
}

.modal-overlay.open .modal-box {
  transform: translateY(0) scale(1);
}

.modal-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(240, 82, 82, .12);
  border: 1px solid rgba(240, 82, 82, .25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 16px;
}

.modal-icon svg {
  display: block;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
}

.modal-head .modal-icon {
  margin-bottom: 0;
  flex: 0 0 auto;
}

.modal-head .modal-title {
  margin-bottom: 4px;
}

.modal-head .modal-desc {
  margin-bottom: 0;
}

.modal-icon--download {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.25);
  color: #10b981;
}

.modal-title {
  font-family: 'Syne', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.modal-desc {
  font-size: 12px;
  color: var(--muted2);
  line-height: 1.6;
  margin-bottom: 22px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.modal-btn {
  flex: 1;
  padding: 10px 16px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  border: 1px solid var(--border2);
  transition: all .15s;
}

.modal-btn.cancel {
  background: var(--s2);
  color: var(--text);
}

.modal-btn.cancel:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.modal-btn.confirm {
  background: rgba(240, 82, 82, .15);
  border-color: rgba(240, 82, 82, .35);
  color: #f87171;
}

.modal-btn.confirm:hover {
  background: rgba(240, 82, 82, .28);
  border-color: #f05252;
}

/* ════════════════════════════════
   PRINT — exact match to screen
════════════════════════════════ */
@media print {

  /* Force color backgrounds to print */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  body {
    background: #fff !important;
    color: #000 !important;
    margin: 0;
    padding: 0;
  }

  /* Hide everything except the timetable panel */
  header,
  .sidebar,
  .tt-actions,
  .modal-overlay,
  .color-picker-popup {
    display: none !important;
  }

  .layout {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .wrap {
    padding: 0 !important;
    max-width: 100% !important;
  }

  .tt-wrap {
    border: 1px solid #ccc !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    width: 100% !important;
  }

  /* Show timetable title in print */
  .tt-hdr {
    display: flex !important;
    padding: 10px 14px !important;
    border-bottom: 1px solid #ddd !important;
  }

  .tt-title {
    color: #000 !important;
  }

  /* Table fills page width */
  .tt-scroll {
    overflow: visible !important;
    width: 100% !important;
  }

  .tt-table,
  .tt-table-dl {
    min-width: unset !important;
    width: 100% !important;
    table-layout: fixed !important;
  }

  /* Preserve slot colors on print */
  .slot {
    position: absolute !important;
    inset: 2px !important;
  }

  /* Stats row */
  .stat-row {
    display: grid !important;
    -webkit-print-color-adjust: exact !important;
  }

  /* Conflict strip */
  .conflict-strip {
    display: block;
  }

  /* Legend */
  .legend {
    display: flex !important;
  }

  /* Card view */
  .cards-view {
    display: block !important;
  }

  /* Day-left layout time column */
  .tt-table-dl .time-td {
    background: #f5f5f5 !important;
  }

  .tt-table td.day-td {
    background: #f5f5f5 !important;
  }

  /* Page setup */
  @page {
    size: landscape;
    margin: 10mm;
  }
}

.loader-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 25, 0.85);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: white;
  font-family: 'Syne', sans-serif;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

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

/* ════════════════════════════════
   USER FEEDBACK FORM
   ════════════════════════════════ */
.btn-feedback:hover {
  border-color: var(--accent) !important;
  color: var(--accent) !important;
  background: var(--s2) !important;
}

#feedbackType:focus,
#feedbackInput:focus {
  border-color: #8b5cf6 !important;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.15);
}

#submitBtn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ════════════════════════════════
   CALENDAR EXPORT (COMPACT MOBILE MODAL)
   ════════════════════════════════ */
.export-modal-box {
  max-width: 440px;
  width: 92%;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  padding: 20px 20px 16px;
  box-sizing: border-box;
}

.export-modal-box .modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.export-modal-box .modal-icon--calendar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.25);
  color: #60a5fa;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0;
  flex-shrink: 0;
}

.export-modal-box .modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0;
  line-height: 1.2;
}

.export-close-btn {
  margin-left: auto;
  background: var(--s2);
  border: 1px solid var(--border);
  color: var(--muted);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.export-close-btn:hover {
  color: var(--text);
  background: var(--border2);
}

.export-modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
  margin-bottom: 8px;
}

.export-modal-body::-webkit-scrollbar {
  width: 4px;
}

.export-modal-body::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 4px;
}

.export-date-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 4px;
  width: 100%;
}

.export-field {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
}

.export-field label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  white-space: normal;
  word-break: break-word;
}

.export-input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
  outline: none;
  min-width: 0;
  transition: border-color 0.15s;
}

.export-input:focus {
  border-color: #3b82f6;
}

.export-subnote {
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 4px;
  margin-bottom: 12px;
  line-height: 1.35;
}

.export-info-box {
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.4;
  margin-bottom: 8px;
  border: 1px solid transparent;
}

.export-disclaimer {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.export-guide {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

.info-title {
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.guide-list {
  padding-left: 16px;
  margin: 4px 0 0;
  font-size: 11px;
}

.guide-list li {
  margin-bottom: 3px;
}

.export-modal-actions {
  flex-shrink: 0;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

@media (max-width: 480px) {
  .export-modal-box {
    padding: 16px 14px 12px;
    width: 95%;
  }

  .export-date-grid {
    gap: 7px;
  }

  .export-input {
    padding: 7px 8px;
    font-size: 12px;
  }
}

/* ════ SAVED TIMETABLES ACTION BUTTONS ════ */
.saved-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-edit {
  background: transparent;
  color: #10b981;
  /* Green */
  border: 1.5px solid #10b981;
  border-radius: 8px;
  padding: 6px 14px;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-edit:hover {
  background: rgba(16, 185, 129, 0.1);
  transform: translateY(-1px);
}

.btn-del {
  background: transparent;
  color: #ef4444;
  /* Red */
  border: 1.5px solid #ef4444;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-del:hover {
  background: rgba(239, 68, 68, 0.1);
  transform: translateY(-1px);
}

/* ════ DOWNLOAD MODAL ════ */
.dl-orientation-btn {
  flex: 1;
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
  text-align: left;
}

.dl-orientation-btn:hover {
  background: var(--s2);
}

.dl-orientation-btn.active {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.1);
  color: #6366f1;
}

.download-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.download-actions .modal-btn {
  width: 100%;
  min-height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.download-actions .modal-btn svg {
  flex: 0 0 auto;
}

.dl-btn {
  border-width: 1.5px;
}

.download-actions .modal-btn.dl-btn--png {
  background: #6366f1;
  border-color: #6366f1;
  color: #fff;
}

.download-actions .modal-btn.dl-btn--png:hover {
  background: #4f46e5;
  border-color: #4f46e5;
  color: #fff;
}

.download-actions .modal-btn.dl-btn--xlsx {
  background: #10b981;
  border-color: #10b981;
  color: #fff;
}

.download-actions .modal-btn.dl-btn--xlsx:hover {
  background: #059669;
  border-color: #059669;
  color: #fff;
}

.download-actions .modal-btn.dl-btn--pdf {
  background: #ef4444;
  border-color: #ef4444;
  color: #fff;
}

.download-actions .modal-btn.dl-btn--pdf:hover {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}

.download-actions .modal-btn.dl-btn:focus-visible {
  outline: 3px solid rgba(99, 102, 241, 0.4);
  outline-offset: 2px;
}

.download-actions .modal-btn.dl-btn:active {
  transform: translateY(1px);
}

.dl-btn--cancel {
  background: transparent;
  border-color: var(--border2);
  color: var(--muted);
  grid-column: 1 / -1;
}

.download-actions .dl-btn--png {
  grid-column: 1 / -1;
}

.dl-label-short {
  display: none;
  font-weight: 800;
  letter-spacing: 0.4px;
}

@media (max-width: 380px) {
  .dl-label-long {
    display: none;
  }

  .dl-label-short {
    display: inline;
  }
}

@media (min-width: 720px) {
  .download-actions {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .download-actions .dl-btn--png {
    grid-column: auto;
  }

  .dl-btn--cancel {
    grid-column: auto;
  }
}

#download-preview-container {
  /* This container uses CSS transforms to shrink the giant virtual grid to exactly fit the 260px wrapper box */
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ════ SELECTED COURSE DETAILS MODAL ════ */
.course-detail-box {
  max-width: 560px;
  width: 92%;
  text-align: left;
  padding: 18px 18px 16px;
}

.cd-hdr {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.cd-code {
  font-family: 'Syne', sans-serif;
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.cd-name {
  font-size: 12px;
  color: var(--muted2);
  margin-top: 2px;
  line-height: 1.4;
}

.cd-close {
  padding: 6px 10px;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 10px;
}

.cd-sub {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.cd-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border2);
  background: rgba(255, 255, 255, 0.03);
  font-size: 12px;
  color: var(--muted);
}

.cd-body {
  max-height: 62vh;
  overflow: auto;
  padding-right: 4px;
}

.cd-group+.cd-group {
  margin-top: 14px;
}

.cd-group-title {
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
  font-size: 13px;
}

.cd-group-items {
  display: grid;
  gap: 10px;
}

.cd-item {
  border: 1px solid var(--border2);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 14px;
  padding: 12px;
}

.cd-item-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.cd-type {
  font-weight: 800;
  color: var(--text);
  font-size: 13px;
}

.cd-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  border: 1px solid rgba(99, 102, 241, 0.35);
  background: rgba(99, 102, 241, 0.12);
  color: #a5b4fc;
}

.cd-time {
  font-size: 12px;
  color: var(--muted2);
  white-space: nowrap;
}

.cd-item-kv {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 6px 10px;
  font-size: 12px;
  color: var(--muted);
}

.cd-item-kv b {
  color: var(--text);
}

.cd-intakes {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 11px;
  color: var(--muted2);
  line-height: 1.4;
}

@media (max-width: 420px) {
  .cd-item-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .cd-time {
    white-space: normal;
  }

  .cd-item-kv {
    grid-template-columns: 68px 1fr;
  }
}

/* ════ DISCLAIMER / TUTORIAL MODAL ════ */
.disclaimer-box {
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 90%;
  max-width: 700px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
  animation: slideUp .25s ease;
}

.disclaimer-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.disclaimer-carousel {
  flex: 1;
  overflow: hidden;
  position: relative;
  background: var(--bg);
  /* Allow vertical scrolling gestures, but keep horizontal swipes for the carousel. */
  touch-action: pan-y;
  cursor: grab;
  user-select: none;
}

.disclaimer-carousel.is-dragging {
  cursor: grabbing;
}

.disclaimer-slides {
  display: flex;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  height: 100%;
  will-change: transform;
}

/* While dragging/swiping, follow the finger without easing. */
.disclaimer-carousel.is-dragging .disclaimer-slides {
  transition: none;
}

.disclaimer-slide {
  min-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  box-sizing: border-box;
}

.disclaimer-slide img {
  max-width: 100%;
  max-height: 55vh;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  -webkit-user-drag: none;
}

.disclaimer-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 14px 0 8px;
  flex-shrink: 0;
}

.disc-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  transition: all 0.2s;
}

.disc-dot.active {
  background: #6366f1;
  width: 22px;
  border-radius: 4px;
}

.disclaimer-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px 18px;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
}

@media (max-width: 520px) {
  .disclaimer-box {
    width: 96%;
    max-height: 95vh;
    border-radius: 14px;
  }

  .disclaimer-slide img {
    max-height: 48vh;
  }

  .disclaimer-footer {
    padding: 10px 12px 14px;
    gap: 8px;
  }
}

/* ════ DISCLAIMER SLIDE DESCRIPTION ════ */
.disclaimer-desc-area {
  flex-shrink: 0;
  padding: 10px 20px 4px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  max-height: 130px;
  overflow-y: auto;
  border-top: 1px solid var(--border);
}

.disclaimer-desc-area:empty {
  display: none;
}

.disclaimer-step {
  display: flex;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
  align-items: flex-start;
}

.disclaimer-step:last-child {
  border-bottom: none;
}

.disc-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 50%;
  color: #6366f1;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

.disc-step-text {
  flex: 1;
  color: var(--text);
}

.disc-step-text a {
  color: #6366f1;
  text-decoration: underline;
}

/* ════ FEEDBACK FLOATING ACTION BUTTON ════ */
#fab-feedback {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 900;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(99, 102, 241, 0.45);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
  outline: none;
}

#fab-feedback:hover {
  transform: scale(1.12);
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.6);
}

#fab-feedback:active {
  transform: scale(0.95);
}

/* Subtle pulse ring on load */
#fab-feedback::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(99, 102, 241, 0.4);
  animation: fabPulse 2.5s ease-out infinite;
}

@keyframes fabPulse {
  0% {
    transform: scale(1);
    opacity: 0.7;
  }

  70% {
    transform: scale(1.35);
    opacity: 0;
  }

  100% {
    transform: scale(1.35);
    opacity: 0;
  }
}

@media (max-width: 640px) {
  #fab-feedback {
    bottom: 18px;
    right: 16px;
    width: 46px;
    height: 46px;
  }
}

/* ════ UPDATE / CHANGE HIGHLIGHTS ════ */
.pill.tag-new {
  background: rgba(16, 185, 129, .12);
  color: #34d399;
}

.pill.tag-upd {
  background: rgba(245, 158, 11, .14);
  color: #fbbf24;
}

.pill.tag-amb {
  background: rgba(99, 102, 241, .14);
  color: #818cf8;
}

.slot.update-new,
.slot-card.update-new {
  outline: 1.5px solid rgba(52, 211, 153, 0.85);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.slot.update-changed,
.slot-card.update-changed {
  outline: 1.5px solid rgba(251, 191, 36, 0.9);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.14);
}

.slot-update-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.4px;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid var(--border2);
  background: rgba(16, 185, 129, 0.14);
  color: #34d399;
  margin-left: 6px;
}

.slot-update-badge.changed {
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
}

/* ════ UPDATE MODAL (Simplified UI) ════ */
.modal.update-modal .modal-content.update-content {
  width: min(92vw, 560px);
  max-width: 560px;
  max-height: 82vh;
  overflow: auto;
  padding: 18px;
}

.update-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.update-hdr {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.update-title {
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  margin: 0;
}

.update-sub {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.update-chip {
  font-size: 11px;
  color: var(--muted2);
  background: var(--s2);
  border: 1px solid var(--border);
  padding: 4px 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.2;
}

.update-chip b {
  color: var(--text);
  font-weight: 800;
}

.update-close {
  padding: 6px 12px !important;
  border-radius: 10px !important;
  border: 1px solid var(--border) !important;
}

.update-note {
  border: 1px solid var(--border);
  background: var(--s2);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--muted2);
}

.update-section {
  border: 1px solid var(--border);
  background: var(--s1);
  border-radius: 12px;
  padding: 12px;
}

.update-section.is-added {
  border-color: rgba(16, 185, 129, 0.35);
}

.update-section.is-removed {
  border-color: rgba(240, 82, 82, 0.35);
}

.update-section.is-changed {
  border-color: rgba(245, 158, 11, 0.35);
}

.update-section-title {
  font-family: 'Syne', sans-serif;
  font-size: 12px;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 8px;
}

.update-block {
  margin-top: 10px;
}

.update-block-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.update-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted2);
  line-height: 1.4;
}

.update-item {
  background: var(--s2);
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 10px;
  overflow-wrap: anywhere;
}

.update-item-top {
  font-weight: 800;
  color: var(--text);
  font-size: 12px;
  line-height: 1.2;
}

.update-course-name {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted2);
  line-height: 1.25;
}

.update-meta {
  margin-top: 5px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.25;
}

.update-item code,
.update-inline code {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
}

.update-inline {
  font-size: 12px;
  color: var(--muted2);
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.update-code {
  display: inline-block;
  margin: 2px 6px 2px 0;
}

.update-empty {
  font-size: 12px;
  color: var(--muted);
  opacity: 0.85;
}

.update-more {
  font-size: 11px;
  color: var(--muted);
  opacity: 0.85;
  padding: 2px 2px 0 2px;
}

.update-tech {
  border: 1px dashed var(--border2);
  border-radius: 12px;
  padding: 10px 12px;
  background: transparent;
}

.update-tech summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--muted2);
  font-size: 12px;
}

.update-tech-body {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  color: var(--muted2);
}

.update-tech-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px;
  align-items: start;
}

.update-tech-row b {
  color: var(--text);
}

@media (max-width: 420px) {
  .update-tech-row {
    grid-template-columns: 1fr;
  }

  .update-close {
    padding: 6px 10px !important;
  }
}

/* ════ RENAME DRAFTS ════ */
.saved-name.editing {
  display: none;
}

.rename-input {
  background: var(--s1);
  border: 1.5px solid var(--accent);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  width: 100%;
  padding: 4px 8px;
  border-radius: 8px;
  outline: none;
  margin-bottom: 4px;
  display: none;
}

.rename-input.active {
  display: block;
}

.btn-rename {
  background: transparent;
  color: var(--muted);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-rename:hover {
  background: var(--s2);
  border-color: var(--muted2);
  color: var(--text);
  transform: translateY(-1px);
}

/* ════ SUBJECT NOTES ════ */
#detail-notes:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
  background: var(--s1) !important;
}

#detail-notes::placeholder {
  color: var(--muted);
  opacity: 0.5;
}

/* ════ SIDEBAR NOTES BUTTON ════ */
.btn-notes {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--s2);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid var(--border);
}

.btn-notes:hover {
  background: var(--s3);
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
}

/* ════ COURSE DETAIL NOTES ════ */
.cd-notes-wrap {
  margin: 16px 0;
  padding: 12px;
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.cd-notes-hdr {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.cd-notes-input {
  width: 100%;
  height: 60px;
  background: var(--s2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  font-family: inherit;
  font-size: 12px;
  color: var(--text);
  resize: none;
  outline: none;
  transition: border-color 0.2s;
}

.cd-notes-input:focus {
  border-color: var(--accent);
}

.btn-notes.active {
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent);
  border-color: var(--accent);
}

/* ════ AUTO-FIX BUTTON ════ */
.btn-autofix {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 13px;
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.btn-autofix:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.4);
  filter: brightness(1.1);
}

.btn-autofix:active {
  transform: translateY(0);
}

.btn-autofix::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.btn-autofix:hover::after {
  opacity: 1;
}

.btn-autofix span:first-child {
  animation: sparkle 2s infinite ease-in-out;
}

@keyframes sparkle {

  0%,
  100% {
    transform: scale(1) rotate(0);
    filter: brightness(1);
  }

  50% {
    transform: scale(1.3) rotate(20deg);
    filter: brightness(1.5);
  }
}

/* ════ MODAL ENHANCEMENT ════ */
.btn-autofix .spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

#resolution-modal.active,
#alternative-modal.active {
  display: flex !important;
}/* === CONFLICT RESOLUTION ENHANCEMENTS === */
.res-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.res-item:hover {
  transform: translateX(4px);
  background: var(--s3) !important;
}

.res-option-chip {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.res-option-chip:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(79, 142, 247, 0.2);
}

.res-option-chip.active {
  box-shadow: 0 4px 12px rgba(79, 142, 247, 0.3);
}

.loading-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  margin-right: 8px;
  vertical-align: middle;
}

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

.btn-autofix span:first-child {
  animation: sparkle 2s infinite ease-in-out;
}

@keyframes sparkle {
  0%, 100% { transform: scale(1) rotate(0); filter: brightness(1); }
  50% { transform: scale(1.2) rotate(15deg); filter: brightness(1.3); }
}

/* ── Sync Timetable (Admin) Styles ── */
#btn-sync.spinning svg {
  animation: spin 1s linear infinite;
  color: var(--accent);
}

#sync-modal .modal-content {
  border: 1px solid var(--border);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

#sync-pin-input:focus,
#sync-token-input:focus {
  border-color: var(--accent) !important;
  outline: none;
  box-shadow: 0 0 0 3px rgba(240, 101, 67, 0.15);
}

.sync-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(240, 101, 67, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.btn-toggle-pwd {
  transition: color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
}

.btn-toggle-pwd:hover {
  color: var(--text) !important;
  background: var(--s2) !important;
}

.btn-toggle-pwd:active {
  transform: translateY(-50%) scale(0.92) !important;
}

/* ══════════════════════════════════════
   FACULTY SELECT & BADGE SYSTEM (UTHM)
══════════════════════════════════════ */
.faculty-bar {
  padding: 10px 16px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.faculty-select-wrapper {
  position: relative;
  width: 100%;
}

.faculty-select {
  width: 100%;
  height: 38px;
  padding: 0 32px 0 12px;
  background: var(--s2);
  color: var(--text);
  border: 1px solid var(--border2);
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.faculty-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(240, 101, 67, 0.15);
}

.faculty-select-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--muted);
  font-size: 11px;
}

/* Faculty Badges */
.badge-fac {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 1.5px 6px;
  border-radius: 4px;
  line-height: 1.2;
  flex-shrink: 0;
}

.badge-FSKTM { background: rgba(14, 165, 233, 0.14); color: #0284c7; border: 1px solid rgba(14, 165, 233, 0.3); }
.badge-FKEE  { background: rgba(245, 158, 11, 0.14); color: #d97706; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-FKMP  { background: rgba(239, 68, 68, 0.14);  color: #dc2626; border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-FKAAB { background: rgba(16, 185, 129, 0.14); color: #059669; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-FAST  { background: rgba(139, 92, 246, 0.14); color: #7c3aed; border: 1px solid rgba(139, 92, 246, 0.3); }
.badge-FPTP  { background: rgba(244, 63, 94, 0.14);  color: #e11d48; border: 1px solid rgba(244, 63, 94, 0.3); }
.badge-FPTV  { background: rgba(59, 130, 246, 0.14); color: #2563eb; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-FTK   { background: rgba(234, 88, 12, 0.14);  color: #c2410c; border: 1px solid rgba(234, 88, 12, 0.3); }
.badge-PPB   { background: rgba(217, 70, 239, 0.14); color: #c026d3; border: 1px solid rgba(217, 70, 239, 0.3); }
.badge-PPD   { background: rgba(6, 182, 212, 0.14);  color: #0891b2; border: 1px solid rgba(6, 182, 212, 0.3); }
.badge-PPUK  { background: rgba(132, 204, 22, 0.14); color: #65a30d; border: 1px solid rgba(132, 204, 22, 0.3); }

/* Lazy Load More Button */
.clist-more-wrap {
  padding: 12px 16px;
  text-align: center;
  border-top: 1px solid var(--border);
}

.btn-load-more {
  width: 100%;
  padding: 9px 16px;
  background: var(--s2);
  color: var(--accent);
  border: 1px solid var(--border2);
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

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


