:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --blue: #2563eb;
  --green: #10b981;
  --dark: #020617;
  --red: #ef4444;
  --violet: #7c3aed;
  --cyan: #06b6d4;
  --amber: #f59e0b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

button, input, select, textarea {
  font-family: inherit;
}

button {
  cursor: pointer;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 300px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  background: var(--dark);
  padding: 16px;
  color: white;
}

.brand {
  border-radius: 28px;
  padding: 22px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.35);
}

.brand small {
  display: block;
  color: rgba(255,255,255,.7);
  text-transform: uppercase;
  letter-spacing: .18em;
  font-weight: 900;
  font-size: 11px;
}

.brand h1 {
  margin: 10px 0 0;
  font-size: 24px;
  line-height: 1.05;
}

.side-card {
  margin-top: 14px;
  border-radius: 24px;
  padding: 12px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
}

.side-label {
  color: #94a3b8;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .16em;
  margin-bottom: 8px;
}

.side-btn {
  width: 100%;
  border: 0;
  border-radius: 16px;
  padding: 12px 14px;
  margin: 4px 0;
  text-align: left;
  font-weight: 900;
  color: #94a3b8;
  background: transparent;
}

.side-btn:hover {
  background: rgba(255,255,255,.08);
  color: white;
}

.side-btn.active {
  background: white;
  color: var(--text);
}

.side-select {
  width: 100%;
  border: 1px solid rgba(255,255,255,.12);
  background: #020617;
  color: white;
  border-radius: 16px;
  padding: 12px;
  font-weight: 800;
  outline: none;
}

.main {
  padding: 22px;
  min-width: 0;
}

.topbar {
  background: white;
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  box-shadow: 0 10px 30px rgba(15,23,42,.04);
}

.topbar h2 {
  margin: 0;
  font-size: 26px;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-weight: 600;
}

.toolbar {
  margin-top: 14px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.panel {
  margin-top: 14px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 18px;
  box-shadow: 0 10px 30px rgba(15,23,42,.04);
}

.btn {
  border: 0;
  border-radius: 16px;
  padding: 12px 16px;
  font-weight: 900;
  background: #e2e8f0;
  color: var(--text);
}

.btn.primary {
  background: var(--blue);
  color: white;
}

.btn.dark {
  background: var(--dark);
  color: white;
}

.btn.green {
  background: var(--green);
  color: white;
}

.btn.red {
  background: #fee2e2;
  color: #b91c1c;
}

.btn.ghost {
  background: #f8fafc;
  color: #475569;
}

.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  font-weight: 800;
  outline: none;
  background: white;
}

.textarea {
  min-height: 120px;
  resize: vertical;
}

.field label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 900;
  margin-bottom: 6px;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cards {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.card {
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 16px;
  background: #f8fafc;
}

.card h3 {
  margin: 0;
}

.card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
}

.matrix-wrap {
  margin-top: 14px;
  overflow: auto;
  max-height: calc(100vh - 250px);
  border: 1px solid var(--border);
  border-radius: 22px;
  background: white;
}

table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  min-width: 1100px;
}

th, td {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 10px;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: white;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}

.sticky-date {
  position: sticky;
  left: 0;
  z-index: 11;
  background: #f8fafc;
  width: 100px;
  min-width: 100px;
  font-weight: 900;
  color: #334155;
}

.sticky-time {
  position: sticky;
  left: 100px;
  z-index: 11;
  background: white;
  width: 120px;
  min-width: 120px;
  font-weight: 900;
  color: #334155;
}

th.sticky-date, th.sticky-time {
  z-index: 20;
  background: white;
}

.today-row td {
  background: #eff6ff;
}

.current-row td {
  background: #cffafe;
}

.lesson {
  min-height: 86px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  border-radius: 18px;
  padding: 12px;
  box-shadow: 0 8px 18px rgba(37,99,235,.06);
}

.lesson:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(37,99,235,.12);
}

.lesson-title {
  font-weight: 950;
  line-height: 1.15;
}

.lesson-meta {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  font-size: 11px;
  color: #334155;
  font-weight: 800;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 8px;
  background: rgba(255,255,255,.8);
}

.empty {
  min-height: 76px;
  border: 1px dashed #cbd5e1;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #cbd5e1;
  font-weight: 900;
}

.empty.editable {
  color: var(--blue);
  background: #eff6ff;
  border-color: #bfdbfe;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(37,99,235,.18), transparent 35%),
    radial-gradient(circle at bottom right, rgba(124,58,237,.15), transparent 35%),
    var(--bg);
}

.login-box {
  width: 100%;
  max-width: 460px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 32px;
  padding: 28px;
  box-shadow: 0 30px 80px rgba(15,23,42,.1);
}

.login-box h1 {
  margin: 0;
  font-size: 30px;
}

.error {
  margin-top: 12px;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 16px;
  padding: 12px;
  font-weight: 800;
  display: none;
}

.muted {
  color: var(--muted);
  font-weight: 700;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal {
  width: min(960px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: white;
  border-radius: 32px;
  padding: 22px;
  box-shadow: 0 30px 90px rgba(15,23,42,.25);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.modal-head h2 {
  margin: 0;
}

.badge {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 900;
}

.status-ok {
  color: #047857;
  background: #d1fae5;
}

.status-no {
  color: #b91c1c;
  background: #fee2e2;
}

@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }
}
