:root {
  --primary:       #1B3A6B;
  --primary-light: #2563EB;
  --primary-dark:  #0F2044;
  --accent:        #F59E0B;
  --accent-dark:   #D97706;
  --danger:        #EF4444;
  --success:       #22C55E;
  --muted:         #64748B;
  --bg:            #F1F5F9;
  --card:          #FFFFFF;
  --border:        #E2E8F0;
  --text:          #0F172A;
  --text-light:    #475569;
  --radius-sm:     8px;
  --radius:        14px;
  --radius-lg:     20px;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --shadow:        0 4px 6px rgba(0,0,0,.05), 0 10px 15px rgba(0,0,0,.07);
  --shadow-lg:     0 20px 40px rgba(0,0,0,.12);
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 16px;
}

/* ── Header ── */
.site-header {
  background: var(--primary-dark);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 16px rgba(0,0,0,.25);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.logo-icon {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

.logo-text h1 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.3px;
  line-height: 1.2;
}

.logo-text p {
  font-size: .7rem;
  color: rgba(255,255,255,.5);
  letter-spacing: .3px;
}

nav { display: flex; gap: 4px; }

nav a {
  color: rgba(255,255,255,.7);
  text-decoration: none;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  transition: background .15s, color .15s;
}

nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
nav a.active { background: rgba(255,255,255,.15); color: #fff; }

/* ── Container ── */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px;
}

@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .header-inner { padding: 0 16px; }
}

/* ── Hero ── */
.hero {
  background: linear-gradient(150deg, #0A1929 0%, #1B3A6B 55%, #1A4DA6 100%);
  padding: 64px 0;
  position: relative;
  overflow: hidden;
  color: #fff;
}

.hero::before {
  content: '';
  position: absolute;
  top: -120px; right: -120px;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(37,99,235,.35) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -80px; left: -60px;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(245,158,11,.15) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero .container { position: relative; z-index: 1; }

.hero-overline {
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: 3.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,.5);
  margin-bottom: 6px;
}

.hero-date {
  font-size: 1.15rem;
  color: rgba(255,255,255,.75);
  font-weight: 500;
  margin-bottom: 28px;
}

.hero-topic-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18);
  color: rgba(255,255,255,.85);
  padding: 5px 16px;
  border-radius: 30px;
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: 14px;
}

.hero.is-special .hero-topic-badge {
  background: rgba(245,158,11,.2);
  border-color: rgba(245,158,11,.4);
  color: #FCD34D;
}

.hero-title {
  font-size: clamp(2rem, 4.5vw, 3.25rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 36px;
  max-width: 700px;
  letter-spacing: -.5px;
}

.hero-meta {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
}

.hero-meta-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hero-meta-icon {
  width: 44px;
  height: 44px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hero-meta-icon svg { opacity: .85; }

.hero-meta-info {}
.hero-meta-label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,.45);
  margin-bottom: 2px;
}

.hero-meta-value {
  font-size: 1rem;
  font-weight: 600;
  color: rgba(255,255,255,.9);
}

/* No-lesson variant */
.hero.no-lesson { background: linear-gradient(150deg, #111827 0%, #1e293b 100%); }

.hero-no-tag {
  display: inline-flex;
  align-items: center;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.5);
  padding: 4px 12px;
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 600;
  margin-bottom: 16px;
}

/* ── Week view ── */
.schedule-section {
  padding: 48px 0 80px;
}

.round-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.round-pill {
  padding: 8px 22px;
  border-radius: 30px;
  border: 2px solid var(--border);
  background: var(--card);
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  transition: all .15s;
  box-shadow: var(--shadow-sm);
}

.round-pill:hover { border-color: var(--primary-light); color: var(--primary); }
.round-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(27,58,107,.3);
}

/* ── Week navigation ── */
.week-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.week-nav-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-align: center;
}

.week-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1.5px solid var(--border);
  background: var(--card);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}

.week-nav-btn:hover:not(:disabled) {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.week-nav-btn:disabled {
  opacity: .3;
  cursor: not-allowed;
}

@media (max-width: 480px) {
  .week-nav { padding: 10px 12px; }
  .week-nav-btn { padding: 6px 10px; font-size: .8rem; }
  .week-nav-btn span { display: none; }
}

.week-section { margin-bottom: 48px; }

.week-header {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--border);
  flex-wrap: wrap;
}

.kw-badge {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -.5px;
}

.week-date-range {
  font-size: .9rem;
  color: var(--muted);
  font-weight: 500;
}

.day-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

@media (max-width: 960px) { .day-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px)  { .day-grid { grid-template-columns: 1fr; } }

/* ── Day card ── */
.day-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 0;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s;
  position: relative;
}

.day-card:not(.is-empty):not(.is-inactive):hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.day-card.is-today {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12), var(--shadow);
}

.day-card.is-special { border-color: var(--accent); }
.day-card.is-inactive { opacity: .45; background: #f8fafc; }
.day-card.is-past { opacity: .5; }
.day-card.is-empty {
  background: #f8fafc;
  border-style: dashed;
  opacity: .35;
  pointer-events: none;
}

.dc-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.dc-day-name {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
  margin-bottom: 3px;
}

.dc-day-date {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.dc-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: .68rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-today   { background: var(--primary); color: #fff; }
.badge-special { background: #FEF3C7; color: #92400E; }
.badge-inactive{ background: #F1F5F9; color: #64748B; }

.dc-body { flex: 1; margin-bottom: 16px; }

.dc-topic-num {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--primary-light);
  margin-bottom: 6px;
}

.day-card.is-special .dc-topic-num { color: var(--accent-dark); }

.dc-topic-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}

.dc-footer {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dc-teacher {
  font-size: .82rem;
  color: var(--muted);
  font-weight: 500;
}

.dc-note {
  margin-top: 4px;
  font-size: .8rem;
  color: var(--muted);
  font-style: italic;
}

.dc-empty-text {
  font-size: .85rem;
  color: var(--muted);
  text-align: center;
  padding: 24px 0;
}

/* ── Admin card ── */
.card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 20px;
}

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

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 14px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover { opacity: .88; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.btn-primary { background: var(--primary);      color: #fff; }
.btn-accent  { background: var(--accent);        color: #fff; }
.btn-danger  { background: var(--danger);        color: #fff; }
.btn-success { background: var(--success);       color: #fff; }
.btn-ghost   { background: transparent; color: var(--primary); border: 1.5px solid var(--border); }
.btn-sm      { padding: 5px 12px; font-size: .8rem; border-radius: 6px; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }

label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--text);
}

input[type="text"],
input[type="date"],
input[type="time"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(37,99,168,.12);
}

textarea { resize: vertical; min-height: 72px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 520px) { .form-row { grid-template-columns: 1fr; } }

.help-text { font-size: .78rem; color: var(--muted); margin-top: 4px; }

/* ── Toggle ── */
.toggle-wrap { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }

.toggle {
  width: 42px; height: 24px;
  background: var(--border);
  border-radius: 12px;
  position: relative;
  transition: background .2s;
  flex-shrink: 0;
  border: none;
  cursor: pointer;
}

.toggle::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}

.toggle.on { background: var(--success); }
.toggle.on::after { transform: translateX(18px); }

/* ── Modal ── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}

.modal-backdrop.open { display: flex; }

.modal {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 24px 28px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 { font-size: 1.15rem; font-weight: 700; color: var(--primary); }

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
  line-height: 1;
  border-radius: 6px;
  transition: background .15s;
}

.modal-close:hover { background: var(--bg); }

.modal-body { padding: 20px 28px 28px; }

/* ── Chip ── */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
}

.chip-blue  { background: #DBEAFE; color: #1D4ED8; }
.chip-amber { background: #FEF3C7; color: #92400E; }
.chip-red   { background: #FEE2E2; color: #991B1B; }
.chip-green { background: #DCFCE7; color: #166534; }

/* ── Divider ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ── Toast ── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--text);
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: .875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn .2s ease;
  max-width: 320px;
}

.toast.success { background: #14532D; border-left: 4px solid var(--success); }
.toast.error   { background: #7F1D1D; border-left: 4px solid var(--danger); }

@keyframes toastIn {
  from { transform: translateX(60px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── Info banner ── */
.info-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #DBEAFE;
  border: 1px solid #93C5FD;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: .875rem;
  color: #1E40AF;
}

/* ── Misc ── */
.page-title   { font-size: 1.6rem; font-weight: 800; color: var(--primary); margin-bottom: 4px; }
.page-subtitle{ color: var(--text-light); font-size: .95rem; margin-bottom: 28px; }

.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--muted);
}

.empty-state svg { opacity: .25; display: block; margin: 0 auto 16px; }

.flex    { display: flex; }
.gap-2   { gap: 8px; }
.gap-3   { gap: 12px; }
.mt-2    { margin-top: 8px; }
.mt-3    { margin-top: 12px; }
.text-sm { font-size: .85rem; }
.text-muted { color: var(--muted); font-size: .85rem; }
.fw-600  { font-weight: 600; }

@media (max-width: 640px) {
  .hero { padding: 48px 0; }
  .hero-title { font-size: 1.75rem; }
  .hero-meta { gap: 20px; }
  .schedule-section { padding: 32px 0 60px; }
}
