/* ═══════════════════════════════════════════════
   Timetable System — Thai School Timetable Scheduling
   ═══════════════════════════════════════════════ */
:root {
  --primary: #1a5276;
  --primary-light: #2980b9;
  --primary-dark: #154360;
  --primary-lightest: #d6eaf8;
  --accent: #e67e22;
  --accent-dark: #d35400;
  --success: #27ae60;
  --success-dark: #219a52;
  --danger: #c0392b;
  --danger-light: #fadbd8;
  --danger-dark: #a93226;
  --warning: #e67e22;
  --warning-light: #fef9e7;
  --info: #2980b9;
  --info-light: #d6eaf8;
  --bg: #f0f4f8;
  --card: #ffffff;
  --border: #dce1e7;
  --text: #2c3e50;
  --text-light: #7f8c8d;
  --header-h: 60px;
  --nav-h: 44px;

  /* Thai day colors */
  --day-mon: #f9a825;
  --day-tue: #c2185b;
  --day-wed: #2e7d32;
  --day-thu: #e65100;
  --day-fri: #1565c0;
  --day-sat: #6a1b9a;
  --day-sun: #bf360c;

  --day-mon-bg: #fff9c4;
  --day-tue-bg: #fce4ec;
  --day-wed-bg: #e8f5e9;
  --day-thu-bg: #fff3e0;
  --day-fri-bg: #e3f2fd;
  --day-sat-bg: #f3e5f5;
  --day-sun-bg: #fbe9e7;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Sarabun', 'Noto Sans Thai', 'TH Sarabun New', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}

/* ── Login Page ── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a5276 0%, #154360 100%);
}
.login-box {
  background: var(--card);
  border-radius: 16px;
  padding: 40px 36px;
  width: 400px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
  text-align: center;
}
.login-box h1 { font-size: 20px; margin-bottom: 4px; color: #1a5276; }
.login-box .subtitle { font-size: 14px; color: var(--text-light); margin-bottom: 24px; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; text-align: left; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: var(--text-light); }
.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color .2s;
}
.form-control:focus { outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(41,128,185,.15); }
select.form-control { appearance: auto; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: var(--success-dark); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-dark); }
.btn-warning { background: var(--accent); color: #fff; }
.btn-warning:hover { background: var(--accent-dark); }
.btn-info { background: var(--info); color: #fff; }
.btn-info:hover { background: var(--primary); }
.btn-ghost { background: transparent; color: var(--text-light); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-block { width: 100%; }

/* ── Layout: Header ── */
header {
  background: linear-gradient(135deg, var(--primary) 0%, #154360 100%);
  color: #fff;
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 12px rgba(0,0,0,.3);
}
.header-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .3px;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  white-space: nowrap;
}
.header-logout {
  color: #f9ca24;
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  transition: color .2s;
}
.header-logout:hover { color: #fff; }

/* ── Layout: Nav Bar ── */
nav {
  background: #1e3a5f;
  border-bottom: 3px solid var(--accent);
  position: sticky;
  top: var(--header-h);
  z-index: 999;
}
.nav-inner {
  display: flex;
  flex-wrap: wrap;
}
.nav-item {
  position: relative;
}
.nav-item > a {
  display: block;
  padding: 10px 14px;
  color: #cce4ff;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all .2s;
  white-space: nowrap;
}
.nav-item > a:hover,
.nav-item > a.active {
  background: var(--accent);
  color: #fff;
}
.nav-item:hover > .dropdown {
  display: block;
}
.dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #1a4a7a;
  min-width: 220px;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
  z-index: 100;
}
.dropdown a {
  display: block;
  padding: 9px 16px;
  color: #cce4ff;
  text-decoration: none;
  font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  transition: all .15s;
}
.dropdown a:hover {
  background: var(--primary-light);
  color: #fff;
}

/* ── Layout: Mobile hamburger ── */
.nav-hamburger {
  display: none;
  background: none;
  border: none;
  color: #cce4ff;
  font-size: 22px;
  cursor: pointer;
  padding: 10px 16px;
  line-height: 1;
}

/* ── Layout: Main & Content ── */
.main { min-height: 100vh; }
.topbar {
  display: none;
}
.content {
  padding: 24px;
  max-width: 900px;
  margin: 0 auto;
}

/* ── Cards ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}
.card-header h3 { font-size: 16px; font-weight: 700; }

/* ── Stats Cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
}
.stat-card .label { font-size: 12px; color: var(--text-light); font-weight: 600; }
.stat-card .value { font-size: 28px; font-weight: 800; color: var(--primary); margin: 4px 0 2px; }
.stat-card .sub { font-size: 12px; color: var(--text-light); }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: var(--bg); font-weight: 700; font-size: 12px; color: var(--text-light); white-space: nowrap; }
tr:hover td { background: #f8fafc; }
td.actions { white-space: nowrap; }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
}
.badge-success { background: #d5f5e3; color: #1e8449; }
.badge-danger { background: #fadbd8; color: #922b21; }
.badge-warning { background: #fef9e7; color: #7d6608; }
.badge-info { background: #d6eaf8; color: #1a5276; }
.badge-purple { background: #ede9fe; color: #5b21b6; }

/* ── Alerts ── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-success { background: #d5f5e3; color: #1e8449; border: 1px solid #a9dfbf; }
.alert-danger { background: #fadbd8; color: #922b21; border: 1px solid #f5b7b1; }
.alert-info { background: #d6eaf8; color: #1a5276; border: 1px solid #aed6f1; }
.alert-warning { background: #fef9e7; color: #7d6608; border: 1px solid #f9e79f; }

/* ── Toolbar ── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.toolbar .form-control { width: auto; min-width: 140px; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal {
  background: var(--card);
  border-radius: 12px;
  padding: 24px;
  width: 500px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
}
.modal h3 { margin-bottom: 16px; font-size: 16px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.modal-overlay[style*="display: none"],
.modal-overlay[style*="display:none"] { display: none !important; }

/* ── Toast ── */
#toast-container {
  position: fixed; top: 16px; right: 16px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none; max-width: 400px;
}
.tt-toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; border-radius: 10px;
  font-size: 14px; font-family: inherit;
  box-shadow: 0 4px 24px rgba(0,0,0,.15);
  animation: toast-in .3s ease; pointer-events: auto;
  background: #fff; border-left: 4px solid #888;
  color: var(--text);
}
.tt-toast.success { border-left-color: #22c55e; background: #f0fdf4; }
.tt-toast.danger  { border-left-color: #ef4444; background: #fef2f2; }
.tt-toast.warning { border-left-color: #f59e0b; background: #fffbeb; }
.tt-toast.info    { border-left-color: #3b82f6; background: #eff6ff; }
.tt-toast .toast-icon { font-size: 18px; flex-shrink: 0; }
.tt-toast .toast-msg  { flex: 1; }
.tt-toast .toast-close {
  background: none; border: none; cursor: pointer;
  font-size: 16px; color: #999; padding: 0 2px; line-height: 1;
}
.tt-toast.toast-out { animation: toast-out .25s ease forwards; }

@keyframes toast-in  { from { opacity:0; transform:translateX(60px); } to { opacity:1; transform:translateX(0); } }
@keyframes toast-out { from { opacity:1; transform:translateX(0); } to { opacity:0; transform:translateX(60px); } }

/* ── Confirm Dialog ── */
.tt-confirm-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 10000; animation: toast-in .2s ease;
}
.tt-confirm-box {
  background: var(--card); border-radius: 14px; padding: 24px 28px;
  width: 380px; max-width: 90vw; box-shadow: 0 8px 40px rgba(0,0,0,.2);
  text-align: center;
}
.tt-confirm-box .confirm-icon { font-size: 40px; margin-bottom: 12px; }
.tt-confirm-box .confirm-msg  { font-size: 15px; margin-bottom: 20px; color: var(--text); line-height: 1.5; }
.tt-confirm-box .confirm-actions { display: flex; gap: 10px; justify-content: center; }

/* ── Hamburger Button ── */
.hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  color: var(--text);
  line-height: 1;
}

/* ── Sidebar Overlay (unused, kept for compatibility) ── */
.sidebar-overlay {
  display: none;
}

/* ═══════════════════════════════════════════════
   Timetable-Specific Styles
   ═══════════════════════════════════════════════ */

/* ── Timetable Grid ── */
.tt-grid {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}
.tt-grid th {
  background: var(--primary-dark);
  color: #fff;
  padding: 8px 4px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--primary-dark);
  white-space: nowrap;
}
.tt-grid th:first-child {
  width: 60px;
}
.tt-grid td {
  border: 1px solid var(--border);
  padding: 0;
  vertical-align: top;
  height: 55px;
  position: relative;
}

/* ── Timetable Cell ── */
.tt-cell {
  padding: 4px 6px;
  height: 55px;
  vertical-align: middle;
  border-left: 4px solid transparent;
  cursor: default;
  transition: background-color .15s;
}
.tt-cell:hover {
  background: rgba(26,82,118,.04);
}

/* Activity blocks */
.tt-cell.activity {
  background: #eff6ff;
  border-left-color: #3b82f6;
}
.tt-cell.activity .tt-subject {
  color: #1d4ed8;
  font-weight: 700;
}

/* Lunch period */
.tt-cell.lunch {
  background: #fefce8;
  border-left-color: #eab308;
}
.tt-cell.lunch .tt-subject {
  color: #854d0e;
  font-weight: 700;
}

/* Empty slot */
.tt-cell.empty {
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 4px,
    rgba(0,0,0,.02) 4px,
    rgba(0,0,0,.02) 8px
  );
  border: 2px dashed var(--border);
}

/* Locked slot */
.tt-cell.locked {
  background: #f8fafc;
  opacity: .85;
}
.tt-cell.locked::after {
  content: '🔒';
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 10px;
}

/* ── Cell text ── */
.tt-subject {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}
.tt-teacher {
  font-size: 10px;
  color: var(--text-light);
  line-height: 1.2;
  margin-top: 1px;
}
.tt-room {
  font-size: 10px;
  color: var(--text-light);
  line-height: 1.2;
}

/* ── Period header cell ── */
.tt-period-header {
  text-align: center;
  font-weight: 700;
  font-size: 12px;
  background: var(--bg);
  padding: 6px 4px;
  border: 1px solid var(--border);
}

/* ── Day label cell ── */
.tt-day-label {
  text-align: center;
  font-weight: 700;
  font-size: 12px;
  background: var(--bg);
  padding: 6px 4px;
  border: 1px solid var(--border);
  white-space: nowrap;
  color: var(--primary);
}

/* ── Color bar indicator ── */
.tt-color-bar {
  width: 6px;
  height: 100%;
  min-height: 40px;
  border-radius: 3px;
  display: inline-block;
  vertical-align: middle;
}

/* ── Toggle Grid (unavailable / activity slots) ── */
.tt-toggle-grid {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.tt-toggle-grid th {
  background: var(--bg);
  text-align: center;
  padding: 6px 4px;
  font-size: 12px;
  border: 1px solid var(--border);
}
.tt-toggle-grid td {
  text-align: center;
  padding: 0;
  border: 1px solid var(--border);
}
.tt-toggle-btn {
  display: block;
  width: 100%;
  min-height: 40px;
  border: none;
  background: #d5f5e3;
  color: #1e8449;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px;
  font-family: inherit;
  transition: all .15s;
}
.tt-toggle-btn:hover { opacity: .8; }
.tt-toggle-btn.active {
  background: #fadbd8;
  color: #922b21;
}
.tt-toggle-btn.has-activity {
  background: #d6eaf8;
  color: #1a5276;
}

/* ── Checklist ── */
.tt-checklist {
  list-style: none;
  padding: 0;
}
.tt-checklist li {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.tt-checklist li:last-child { border-bottom: none; }
.tt-check .done { color: var(--success); font-size: 16px; }
.tt-check .pending { color: var(--danger); font-size: 16px; }

/* ── Setup progress ── */
.setup-progress {
  background: var(--bg);
  border-radius: 8px;
  height: 8px;
  overflow: hidden;
  margin: 8px 0;
}
.setup-progress-bar {
  background: var(--primary);
  height: 100%;
  border-radius: 8px;
  transition: width .3s;
}

/* ── Quick action cards ── */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.quick-action-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  transition: all .2s;
}
.quick-action-card:hover {
  border-color: var(--primary-light);
  box-shadow: 0 2px 8px rgba(26,82,118,.12);
}
.quick-action-card .qa-icon { font-size: 28px; margin-bottom: 8px; }
.quick-action-card .qa-label { font-size: 13px; font-weight: 600; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .nav-hamburger { display: block; }
  .nav-inner {
    display: none;
    flex-direction: column;
    width: 100%;
  }
  .nav-inner.open { display: flex; }
  .nav-item > a { padding: 11px 16px; font-size: 14px; }
  .dropdown {
    position: static;
    display: none;
    box-shadow: none;
    background: #153050;
  }
  .nav-item.dropdown-open .dropdown { display: block; }

  .header-title { font-size: 14px; }
  .header-right span:first-child { display: none; }

  .content { padding: 12px; }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
  }
  .stat-card { padding: 12px 14px; }
  .stat-card .value { font-size: 22px; }
  .stat-card .label { font-size: 11px; }

  .card { padding: 14px; border-radius: 10px; }
  .card-header { margin-bottom: 12px; }
  .card-header h3 { font-size: 14px; }

  .table-wrap { margin: 0 -12px; padding: 0; }
  table { font-size: 12px; min-width: 500px; }
  th, td { padding: 8px 10px; }

  .form-control { padding: 12px 14px; font-size: 16px; }
  .form-group label { font-size: 12px; }

  .btn { padding: 10px 16px; font-size: 14px; }
  .btn-sm { padding: 8px 12px; font-size: 13px; }

  .toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .toolbar .form-control { width: 100%; min-width: 0; }

  .modal { width: 100%; max-width: 100%; border-radius: 0; max-height: 100vh; padding: 16px; }
  .modal-overlay { align-items: flex-end; }
  .modal { border-radius: 16px 16px 0 0; max-height: 90vh; }

  #toast-container { left: 8px; right: 8px; max-width: 100%; top: 8px; }
  .tt-toast { font-size: 13px; padding: 10px 14px; }
  .tt-confirm-box { width: 100%; max-width: 100%; border-radius: 14px 14px 0 0; }

  .login-box { padding: 28px 20px; width: 100%; max-width: 100%; border-radius: 0; min-height: 100vh; display: flex; flex-direction: column; justify-content: center; }

  /* Timetable grid mobile */
  .tt-grid td { height: 48px; }
  .tt-cell { padding: 2px 4px; height: 48px; }
  .tt-subject { font-size: 10px; }
  .tt-teacher { font-size: 9px; }
}

@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card { padding: 10px 12px; }
  .stat-card .value { font-size: 20px; }
}

/* ── Print ── */
@media print {
  header, nav, .no-print, .hamburger, .nav-hamburger { display: none !important; }
  .content { padding: 0 !important; max-width: 100% !important; }
  body { background: #fff; }
  .card { border: none; box-shadow: none; page-break-inside: avoid; }

  @page {
    size: A4 landscape;
    margin: 10mm;
  }

  .tt-grid { font-size: 10px; }
  .tt-grid td { height: 45px; }
  .tt-cell { height: 45px; }
  .tt-cell.locked::after { content: ''; }
  .btn { display: none !important; }
}

/* ── Misc ── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-light); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none; }

/* ═══════════════════════════════════════════════
   Thai Day Color System
   ═══════════════════════════════════════════════ */
.tt-day-0, .day-mon   { color: var(--day-mon); }
.tt-day-1, .day-tue   { color: var(--day-tue); }
.tt-day-2, .day-wed   { color: var(--day-wed); }
.tt-day-3, .day-thu   { color: var(--day-thu); }
.tt-day-4, .day-fri   { color: var(--day-fri); }
.tt-day-5, .day-sat   { color: var(--day-sat); }
.tt-day-6, .day-sun   { color: var(--day-sun); }

.tt-day-bg-0 { background: var(--day-mon-bg); color: var(--day-mon); }
.tt-day-bg-1 { background: var(--day-tue-bg); color: var(--day-tue); }
.tt-day-bg-2 { background: var(--day-wed-bg); color: var(--day-wed); }
.tt-day-bg-3 { background: var(--day-thu-bg); color: var(--day-thu); }
.tt-day-bg-4 { background: var(--day-fri-bg); color: var(--day-fri); }
.tt-day-bg-5 { background: var(--day-sat-bg); color: var(--day-sat); }
.tt-day-bg-6 { background: var(--day-sun-bg); color: var(--day-sun); }

/* Day label cells in timetable grid */
.tt-day-cell-0 { background: var(--day-mon); color: #fff; }
.tt-day-cell-1 { background: var(--day-tue); color: #fff; }
.tt-day-cell-2 { background: var(--day-wed); color: #fff; }
.tt-day-cell-3 { background: var(--day-thu); color: #fff; }
.tt-day-cell-4 { background: var(--day-fri); color: #fff; }
.tt-day-cell-5 { background: var(--day-sat); color: #fff; }
.tt-day-cell-6 { background: var(--day-sun); color: #fff; }

/* ── Type Badges (พื้นฐาน/เพิ่มเติม/กิจกรรม) ── */
.type-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
}
.type-พื้นฐาน  { background: #d6eaf8; color: #1a5276; }
.type-เพิ่มเติม { background: #d5f5e3; color: #1e8449; }
.type-กิจกรรม  { background: #fef9e7; color: #7d6608; }

/* ── Color Legend ── */
.color-legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 12px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* ── Page Title ── */
.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  border-left: 5px solid var(--accent);
  padding-left: 14px;
  margin-bottom: 24px;
}

/* ── Separator ── */
.sep {
  width: 1px;
  height: 32px;
  background: var(--border);
  flex-shrink: 0;
}

/* ── Print Page (A4) ── */
.print-page {
  background: #fff;
  width: 29.7cm;
  min-height: 21cm;
  margin: 0 auto 24px;
  padding: 1cm;
  box-shadow: 0 2px 16px rgba(0,0,0,.1);
}
.print-header {
  text-align: center;
  margin-bottom: 12px;
}
.print-header h1 { font-size: 15pt; font-weight: 700; color: #2c3e50; }
.print-header h2 { font-size: 12pt; font-weight: 600; margin-top: 4px; color: #444; }

/* ── Progress overlay for export ── */
.export-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26,82,118,.88);
  z-index: 9999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
}
.export-overlay.show { display: flex; }
.export-spinner {
  width: 46px;
  height: 46px;
  border: 5px solid rgba(255,255,255,.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Day pill toggles ── */
.day-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.day-pill {
  padding: 6px 14px;
  border-radius: 20px;
  border: 2px solid transparent;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  opacity: .5;
}
.day-pill.open { opacity: 1; }
.day-pill.selected {
  border-color: var(--text);
  box-shadow: 0 0 0 2px var(--text);
}
.day-pill.dc-0 { background: var(--day-mon-bg); color: var(--day-mon); }
.day-pill.dc-1 { background: var(--day-tue-bg); color: var(--day-tue); }
.day-pill.dc-2 { background: var(--day-wed-bg); color: var(--day-wed); }
.day-pill.dc-3 { background: var(--day-thu-bg); color: var(--day-thu); }
.day-pill.dc-4 { background: var(--day-fri-bg); color: var(--day-fri); }
.day-pill.dc-5 { background: var(--day-sat-bg); color: var(--day-sat); }
.day-pill.dc-6 { background: var(--day-sun-bg); color: var(--day-sun); }

/* ═══════════════════════════════════════════════
   Morning Priority Options (generate page)
   ═══════════════════════════════════════════════ */
.morning-options { border: 1.5px solid var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 16px; }
.morning-options[open] { border-color: var(--primary-light); }
.morning-options-summary {
  padding: 12px 16px; cursor: pointer; font-weight: 600;
  display: flex; align-items: center; gap: 8px; background: var(--bg);
  user-select: none;
}
.morning-options-summary:hover { background: var(--primary-lightest); }
.morning-options-summary::marker { font-size: 1.1em; }
.morning-options-body { padding: 16px; border-top: 1px solid var(--border); }
.morning-group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.morning-group-checkbox {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border: 1.5px solid var(--border);
  border-radius: 8px; cursor: pointer; font-size: 14px;
  transition: all .15s;
}
.morning-group-checkbox:hover { border-color: var(--primary-light); background: var(--primary-lightest); }
.morning-group-checkbox input[type="checkbox"] {
  width: 18px; height: 18px; accent-color: var(--primary);
}
