:root {
  color-scheme: dark;
  --app-bg: #133183;
  --app-bg-alt: #13223f;
  --app-surface: rgba(36, 53, 97, 0.72);
  --app-surface-strong: rgba(16, 24, 48, 0.85);
  --app-border: rgba(203, 213, 225, 0.4);
  --app-highlight: rgba(248, 250, 252, 0.2);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background-color: var(--app-bg);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background:
    radial-gradient(circle at 12% 18%, rgba(94, 234, 212, 0.35), transparent 58%),
    radial-gradient(circle at 88% 5%, rgba(96, 165, 250, 0.35), transparent 52%),
    radial-gradient(circle at 50% 90%, rgba(248, 113, 113, 0.25), transparent 60%),
    linear-gradient(180deg, #13233f 0%, #0f1b33 55%, #0a1425 100%);
  color: #f8fafc;
  -webkit-font-smoothing: antialiased;
}

.app-backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(circle at 25% 18%, rgba(56, 189, 248, 0.45), transparent 52%),
    radial-gradient(circle at 70% 0%, rgba(192, 132, 252, 0.4), transparent 50%),
    radial-gradient(circle at 40% 85%, rgba(74, 222, 128, 0.28), transparent 55%),
    linear-gradient(180deg, rgba(8, 13, 30, 0.9), rgba(8, 11, 19, 0.92));
  opacity: 0.88;
  animation: backdropFloat 18s ease-in-out infinite alternate;
  filter: blur(0px);
}

@keyframes backdropFloat {
  0% {
    transform: translateY(0px) scale(1);
  }
  50% {
    transform: translateY(-18px) scale(1.02);
  }
  100% {
    transform: translateY(6px) scale(0.99);
  }
}

#toast-root {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.app-toast {
  border-radius: 1rem;
  border: 1px solid rgba(99, 102, 241, 0.35);
  background: rgba(15, 23, 42, 0.9);
  padding: 0.85rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 500;
  box-shadow: 0 25px 45px rgba(2, 6, 23, 0.45);
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  transition: opacity 220ms ease, transform 220ms ease;
}

.app-toast.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.app-toast--success {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(4, 120, 87, 0.85);
}

.app-toast--warn {
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(120, 53, 15, 0.9);
}

.app-toast--error {
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(127, 29, 29, 0.9);
}

.app-toast--info {
  border-color: rgba(14, 165, 233, 0.45);
  background: rgba(15, 118, 110, 0.85);
}

.modal-open {
  overflow: hidden;
}

body .bg-slate-900\/80,
body .bg-slate-900\/70,
body .bg-slate-900\/60 {
  background-color: var(--app-surface) !important;
  border-color: var(--app-border) !important;
  backdrop-filter: saturate(180%) blur(16px);
  box-shadow: 0 25px 70px rgba(15, 23, 42, 0.55);
}

body .border-slate-800\/70,
body .border-slate-800\/80,
body .border-slate-800\/60 {
  border-color: var(--app-border) !important;
}

body .bg-slate-900\/40 {
  background-color: rgba(37, 56, 103, 0.55) !important;
  border-color: var(--app-border) !important;
  backdrop-filter: saturate(180%) blur(18px);
}

.bg-slate-950\/95 {
  background-color: var(--app-surface-strong) !important;
  box-shadow: 0 35px 60px rgba(8, 11, 23, 0.65);
}

body.bg-slate-950 {
  background: inherit;
}

.app-loader {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(13, 23, 49, 0.85), rgba(15, 118, 110, 0.35));
  backdrop-filter: blur(24px);
  transition: opacity 240ms ease, visibility 240ms ease;
}

.app-loader--hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.app-loader__panel {
  width: min(360px, calc(100% - 32px));
  border-radius: 24px;
  border: 1px solid var(--app-border);
  background: rgba(15, 23, 42, 0.8);
  padding: 1.75rem;
  box-shadow: 0 35px 60px rgba(2, 6, 23, 0.45);
}

.app-loader__title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #bae6fd;
}

.app-loader__subtitle {
  margin: 0.35rem 0 1.25rem;
  font-size: 0.95rem;
  color: #e2e8f0;
}

.app-loader__skeleton {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.app-loader__bar {
  display: block;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.2), rgba(99, 102, 241, 0.5));
  animation: loaderBar 1.4s ease-in-out infinite;
}

.app-loader__bar--short {
  width: 70%;
  animation-delay: 0.15s;
}

.app-loader__bar--tiny {
  width: 40%;
  animation-delay: 0.3s;
}

@keyframes loaderBar {
  0% {
    opacity: 0.3;
    transform: scaleX(0.9);
  }
  50% {
    opacity: 1;
    transform: scaleX(1);
  }
  100% {
    opacity: 0.3;
    transform: scaleX(0.95);
  }
}

.editor-print-day {
  border-radius: 1.25rem;
  border: 1px solid var(--app-border);
  background: rgba(15, 23, 42, 0.55);
  padding: 1rem;
  margin-bottom: 1rem;
}

.editor-print-table {
  width: 100%;
  border-collapse: collapse;
}

.editor-print-table th,
.editor-print-table td {
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.editor-print-cell {
  padding: 0.65rem;
  white-space: pre-wrap;
}
#exportEditorModal [data-editor-content] {
  background: rgba(15, 23, 42, 0.35) !important;
  border: 1px solid rgba(148, 163, 184, 0.3);
  box-shadow: inset 0 0 20px rgba(15, 23, 42, 0.45);
}

#exportEditorModal .editor-document-header {
  text-align: center;
  margin-bottom: 1rem;
}

#exportEditorModal .editor-document-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  color: #001f58;
}

#exportEditorModal .editor-document-subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: #0072ff;
}

#exportEditorModal .editor-day-card {
  background: #f8fafc;
  border-radius: 18px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  padding: 18px 20px 20px;
  margin-bottom: 18px;
  color: #0f172a;
  box-shadow: 0 25px 55px rgba(15, 23, 42, 0.35);
}

#exportEditorModal .editor-day-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

#exportEditorModal .editor-day-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(0, 74, 173, 0.4);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.25em;
  color: #004aad;
}

#exportEditorModal .editor-day-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #0f172a;
}

#exportEditorModal .editor-table-wrapper {
  border-radius: 12px;
  border: 1px solid rgba(203, 213, 225, 0.8);
  overflow: hidden;
  background: #ffffff;
}

#exportEditorModal .editor-day-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  color: #0f172a;
}

#exportEditorModal .editor-day-table th {
  background: linear-gradient(90deg, #e0ecff, #e0fff9);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: #001f58;
  padding: 10px 12px;
  border-bottom: 1px solid #c7d2fe;
}

#exportEditorModal .editor-day-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.65);
  vertical-align: top;
}

#exportEditorModal .editor-day-table tr:last-child td {
  border-bottom: none;
}

#exportEditorModal .editor-col-students {
  text-align: center;
  font-weight: 600;
  color: #0f172a;
}

#exportEditorModal .editor-field {
  white-space: pre-wrap;
  min-height: 22px;
  line-height: 1.45;
  border-radius: 10px;
  padding: 4px 8px;
  cursor: text;
  transition: box-shadow 150ms ease, background-color 150ms ease;
}

#exportEditorModal .editor-field:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.35), inset 0 0 0 1px rgba(59, 130, 246, 0.4);
  background: rgba(226, 232, 240, 0.7);
}

#exportEditorModal .editor-field--saving {
  background: rgba(191, 219, 254, 0.9) !important;
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.35);
}

#exportEditorModal .editor-badge {
  display: inline-flex;
  align-items: center;
  margin-top: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  font-weight: 600;
  color: #ffffff;
}

#exportEditorModal .editor-badge--morning {
  background: #00c0a3;
}

#exportEditorModal .editor-badge--afternoon {
  background: #9c27ff;
}

#exportEditorModal .editor-document-footer {
  margin-top: 1.25rem;
  text-align: center;
  font-size: 0.75rem;
  color: #64748b;
}
