/* ============================================================
   Общие токены и база. Строгая «продуктовая» система:
   Inter, нейтральные поверхности, один синий акцент.
   ============================================================ */

:root {
  /* поверхности */
  --bg: #0b0e13;
  --surface: #12161e;
  --surface-2: #171c26;
  --surface-3: #1e2430;
  --line: #262d3a;
  --line-soft: #1d232e;

  /* текст */
  --text: #e9edf4;
  --text-2: #a7b0bf;
  --text-3: #6d7686;

  /* акцент */
  --accent: #4c8dff;
  --accent-strong: #2f6dff;
  --accent-soft: rgba(76, 141, 255, 0.14);
  --accent-line: rgba(76, 141, 255, 0.45);

  /* статусы */
  --ok: #43c17a;
  --warn: #f0b13e;

  /* светлая тема панели */
  --l-bg: #f3f5f8;
  --l-surface: #ffffff;
  --l-line: #e2e7ee;
  --l-text: #17202b;
  --l-text-2: #5c6675;
  --l-text-3: #98a1af;

  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --radius: 10px;
  --radius-lg: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-feature-settings: 'tnum' 1; /* табличные цифры — ровные часы и таймеры */
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }
a { color: inherit; }

/* кнопка */
.btn {
  font-family: var(--font);
  font-size: .92rem;
  font-weight: 600;
  line-height: 1;
  padding: .6rem .95rem;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
  user-select: none;
  white-space: nowrap;
}
.btn.primary { background: var(--accent-strong); color: #fff; }
.btn.primary:hover { background: #2861f0; }
.btn.subtle { background: var(--l-line); color: var(--l-text); }
.btn.subtle:hover { background: #d7dde6; }
.btn.ghost-danger { background: transparent; border-color: rgba(224, 84, 77, .4); color: #e0544d; }
.btn.ghost-danger:hover { background: rgba(224, 84, 77, .08); }
.btn.sm { font-size: .85rem; padding: .45rem .7rem; border-radius: 7px; }

/* поля */
.in {
  font-family: var(--font);
  font-size: .95rem;
  color: var(--l-text);
  background: var(--l-surface);
  border: 1px solid var(--l-line);
  border-radius: 8px;
  padding: .5rem .65rem;
  outline: none;
  min-width: 0;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.in:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47, 109, 255, .15); }
.in::placeholder { color: var(--l-text-3); }

select.in { cursor: pointer; }

/* выключатель */
.switch {
  position: relative;
  width: 40px; height: 22px;
  border-radius: 11px;
  background: #cfd6df;
  cursor: pointer;
  transition: background .15s ease;
  flex: none;
  border: none;
  padding: 0;
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .15s ease;
}
.switch.on { background: var(--accent-strong); }
.switch.on::after { transform: translateX(18px); }

.dim { color: var(--l-text-2); }

/* ============================================================
   Недельная таблица «классы × (дни × уроки)» — общая для экрана
   и панели управления.
   ============================================================ */
.wframe {
  flex: 1;
  min-height: 0;
  background: #ffffff;
  border: 1px solid #e3e8ef;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(23, 32, 43, 0.05), 0 10px 28px rgba(23, 32, 43, 0.05);
  display: flex;
}
.wtable {
  flex: 1;
  width: 100%;
  height: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}
.wtable th, .wtable td {
  border-right: 1px solid #a9b3c1;
  border-bottom: 1px solid #a9b3c1;
  vertical-align: middle;
  line-height: 1;
  min-width: 0;
}
.wtable th:last-child, .wtable td:last-child { border-right: 0; }

/* шапка: классы */
.wtable thead th {
  background: #f8fafc;
  padding: .15rem .4rem;
  font-size: 1.02rem;
  font-weight: 800;
  color: #17202b;
  text-align: center;
  border-bottom: 2px solid #98a3b3;
}
/* угловые шапки над днём и номером урока — ширины задаём здесь,
   т.к. при table-layout: fixed первая строка определяет колонки */
.wtable thead th.g-day-c { width: 1.8rem; border-right: 0; }
.wtable thead th.g-num-c { width: 1.3rem; border-right: 1px solid #a9b3c1; }

/* колонка дня: вертикальная подпись, прижата к номерам уроков */
td.g-day {
  width: 1.8rem;
  background: #f8fafc;
  text-align: center;
  padding: .3rem .1rem;
}
td.g-day span {
  display: inline-block;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: .64rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #000;
  white-space: nowrap;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* узкая колонка номера урока — цифра вплотную, без пустых полей */
td.g-num {
  width: 1.3rem;
  background: #f8fafc;
  text-align: center;
  font-size: .8rem;
  font-weight: 800;
  color: #303b4a;
  padding: 0;
  border-right: 1px solid #a9b3c1;
}

/* клетка с предметом */
td.subj {
  text-align: center;
  font-size: .88rem;
  font-weight: 600;
  color: #243041;
  padding: 0 .3rem;
  line-height: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* блоки дней */
.wtable tbody tr:first-child td { border-top: 2px solid #98a3b3; }
.wtable tbody:nth-of-type(even) td.subj { background: #fafbfd; }

/* прошедшие уроки сегодня */
.wtable tr.pastrow td { opacity: .42; }

/* текущий урок */
.wtable tr.currow td.subj { background: #e9f0ff; color: var(--accent-strong); font-weight: 700; }
.wtable tr.currow td.g-num {
  background: #e9f0ff;
  color: var(--accent-strong);
  box-shadow: inset 3px 0 0 var(--accent-strong);
}

/* день без уроков */
.wtable tbody.w-empty td.subj {
  background: repeating-linear-gradient(-45deg, #fafbfc, #fafbfc 10px, #f3f5f8 10px, #f3f5f8 20px);
}

/* плотный режим, когда строк много */
.wtable.dense td.subj { font-size: .74rem; }
.wtable.dense td.g-num { font-size: .7rem; }
.wtable.dense thead th { font-size: .88rem; padding: .18rem .3rem; }

/* зачёркнутые и заменённые уроки (замены):
   старый предмет зачёркнут красным сверху, новый — жирным снизу */
.wtable tbody td.subj.w-struck { color: #d64541; }
.wtable tbody td.subj.w-repl { font-size: .66rem; line-height: 1.25; }
.wtable tbody td.subj .wold,
.wtable tbody td.subj s.wold {
  display: block;
  color: #d64541;
  text-decoration: line-through;
  text-decoration-color: #d64541;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wtable tbody td.subj .rnew {
  display: block;
  color: #17202b;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wtable tbody td.subj.w-ovr { background: #fff3cd; }
