@import url('./fonts.css?v=20260719-local');

/* ─────────────────────────────────────────────────────────────────────
   teacher.css · design system для учительского крыла Φ Фундамент
   ─────────────────────────────────────────────────────────────────────
   Принципы:
   - Sans-serif, плотные строки, видимые границы — рабочий инструмент
   - Golos Text + JetBrains Mono (mono для дат/оценок/статусов)
   - НЕ Lora, НЕ italic, НЕ watermark Φ, НЕ pull-quote — это инструмент,
     не журнал
   - Все переменные с префиксом --t- чтобы не конфликтовали с ученическими
   - Density-switchable: --t-row 28/32/40
   ───────────────────────────────────────────────────────────────────── */

:root {
  /* ── typography ───────────────────────────────────────── */
  --t-font-body: 'Golos Text', -apple-system, system-ui, sans-serif;
  --t-font-mono: 'JetBrains Mono', 'SF Mono', ui-monospace, monospace;

  --t-fs-page:    16px;     /* H1 страницы — компактно */
  --t-fs-section: 14px;     /* H2 секций */
  --t-fs-body:    13px;     /* основной текст */
  --t-fs-table:   12px;     /* ячейки таблицы */
  --t-fs-cell-grade: 13px;  /* оценка крупнее, читается с разу */
  --t-fs-label:   10.5px;   /* uppercase labels */
  --t-fs-mono:    11px;     /* mono fragments (даты, ID) */
  --t-ls-label:   0.06em;

  /* ── colors ───────────────────────────────────────────── */
  --t-bg:        #EDEAE1;
  --t-canvas:    #FBF9F4;
  --t-canvas-2:  #F1EEE5;   /* alternate row / header */
  --t-canvas-3:  #E7E3D8;   /* deeper alt */
  --t-ink:       #1B1A17;
  --t-ink-mute:  #6B675D;
  --t-ink-faint: #8A8577;
  --t-ink-invert:#FBF9F4;

  --t-accent:        #2B4C8C;        /* navy — единый бренд Φ */
  --t-accent-2:      #16213A;
  --t-accent-wash:   #E9EEF7;
  --t-accent-bright: #3B62B0;        /* hover/active links */

  --t-hair:        #D9D4C5;
  --t-hair-strong: #C4BEAC;
  --t-hair-soft:   #E2DECF;

  --t-ok:        #137333;  --t-ok-bg:    #E2F0E5;
  --t-warn:      #B7800E;  --t-warn-bg:  #FBF1DD;
  --t-bad:       #B0301C;  --t-bad-bg:   #FBEAE7;
  --t-info:      #2B4C8C;  --t-info-bg:  #E6ECF5;

  /* type-of-column header colors */
  --t-col-lesson:  #F1EEE5;   /* серый */
  --t-col-hw:      #E6ECF5;   /* navy tint */
  --t-col-test:    #FBE6E6;   /* red tint */
  --t-col-custom-1:#F1ECDD;   /* sand */
  --t-col-custom-2:#E8F0E5;   /* moss */
  --t-col-custom-3:#EDE3EB;   /* mauve */
  --t-col-custom-4:#DEE8EE;   /* slate */
  --t-col-custom-5:#F0E5DB;   /* peach */
  --t-col-custom-6:#E5E5E5;   /* neutral */

  /* ── density ──────────────────────────────────────────── */
  --t-row:         32px;
  --t-row-compact: 28px;
  --t-row-comfy:   40px;
  --t-stickycol-w: 200px;
  --t-avg-col-w:   72px;

  /* ── shape ────────────────────────────────────────────── */
  --t-r-button: 4px;
  --t-r-input:  4px;
  --t-r-card:   6px;
  --t-r-pill:   14px;

  /* ── motion ───────────────────────────────────────────── */
  --t-ease:   cubic-bezier(0.2, 0, 0.13, 1);
  --t-fast:   120ms;
  --t-base:   200ms;

  /* ── elevation ────────────────────────────────────────── */
  --t-shadow-slide: 0 0 0 0.5px var(--t-hair-strong), -8px 0 24px rgba(0,0,0,0.06);
  --t-shadow-pop:   0 8px 24px rgba(26,26,26,0.10), 0 0 0 0.5px var(--t-hair-strong);
}

/* density modifiers — body class set by teacher.js */
body.t-density-compact { --t-row: 28px; }
body.t-density-comfy   { --t-row: 40px; }

/* ─────────────────────────────────────────────────────────
   RESET / BASE
   ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--t-font-body);
  font-size: var(--t-fs-body);
  color: var(--t-ink);
  background: var(--t-bg);
  font-feature-settings: 'tnum' 1, 'cv11' 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}
*::selection { background: var(--t-accent-wash); }
button, input, textarea, select {
  font: inherit; color: inherit;
}
button { background: none; border: none; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
input, textarea { -webkit-user-select: text; user-select: text; }

/* ─────────────────────────────────────────────────────────
   SHELL · desktop sidebar + topbar + main
   ───────────────────────────────────────────────────────── */
.t-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  grid-template-rows: 48px 1fr;
  grid-template-areas:
    "side top"
    "side main";
  height: 100vh;
  overflow: hidden;
}
.t-shell.t-sidebar-collapsed { grid-template-columns: 56px 1fr; }

.t-side {
  grid-area: side;
  background: var(--t-canvas-2);
  border-right: 1px solid var(--t-hair);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.t-side__brand {
  display: flex; align-items: center; gap: 8px;
  padding: 0 14px;
  border-bottom: 1px solid var(--t-hair);
  flex-shrink: 0;
  height: 48px;
}
.t-side__brand-link {
  display: inline-flex; align-items: center;
  min-height: 44px; max-width: 100%;
  color: var(--t-ink);
  border-radius: var(--t-r-button);
}
.t-side__brand-link:focus-visible { outline: 2px solid var(--t-accent); outline-offset: 2px; }
/* Логотип «Фундамент» (04.09): те же файлы, что и у ученика — маска на currentColor.
   teacher.css самодостаточен: sheet.css грузит только главная. */
.t-brand-lockup,
.t-brand-mark {
  display: block; flex: 0 0 auto;
  background-color: currentColor;
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-size: contain; mask-size: contain;
}
.t-brand-lockup {
  width: 148px; aspect-ratio: 238 / 36;
  color: var(--t-ink);
  -webkit-mask-image: url('assets/fundament-logo-lockup.svg');
  mask-image: url('assets/fundament-logo-lockup.svg');
}
.t-brand-mark {
  display: none;
  width: 24px; height: 24px;
  color: var(--t-accent);
  -webkit-mask-image: url('assets/fundament-logo-mark.svg');
  mask-image: url('assets/fundament-logo-mark.svg');
}
.t-shell.t-sidebar-collapsed .t-side__brand { padding: 0; justify-content: center; }
.t-shell.t-sidebar-collapsed .t-side__brand-link { justify-content: center; width: 100%; }
.t-shell.t-sidebar-collapsed .t-side__brand .t-brand-lockup { display: none; }
.t-shell.t-sidebar-collapsed .t-side__brand .t-brand-mark { display: block; }
/* в шапке логотип живёт только на телефоне (на десктопе он в боковой панели) */
.t-top__brand { display: none; }

.t-side__user {
  padding: 10px 14px;
  border-bottom: 1px solid var(--t-hair);
  font-size: 12px;
  display: flex; gap: 8px; align-items: center;
}
.t-side__user .ava {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--t-accent); color: white;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600;
  flex-shrink: 0;
}
.t-side__user-meta { min-width: 0; line-height: 1.2; }
.t-side__user-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-side__user-role { color: var(--t-ink-mute); font-size: 11px; }
.t-shell.t-sidebar-collapsed .t-side__user-meta { display: none; }

.t-side__nav {
  flex: 1; overflow-y: auto;
  padding: 8px 6px;
  display: flex; flex-direction: column; gap: 1px;
}
.t-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: var(--t-r-button);
  color: var(--t-ink);
  font-size: 13px;
  transition: background var(--t-fast) var(--t-ease);
  white-space: nowrap;
  position: relative;
}
.t-nav-item:hover { background: rgba(0,0,0,0.04); }
.t-nav-item.on { background: var(--t-accent); color: var(--t-ink-invert); }
.t-nav-item .ico {
  width: 16px; height: 16px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--t-ink-mute);
}
.t-nav-item .ico svg { display: block; }
.t-nav-item:hover .ico { color: var(--t-accent); }
.t-nav-item.on .ico { color: var(--t-ink-invert); }
.t-nav-item .badge {
  margin-left: auto;
  font-family: var(--t-font-mono);
  font-size: 9.5px;
  background: var(--t-accent);
  color: white;
  padding: 1px 5px;
  border-radius: 7px;
  min-width: 18px; text-align: center;
}
.t-nav-item.on .badge { background: rgba(255,255,255,0.25); }
.t-nav-item .badge.warn { background: var(--t-bad); }
.t-nav-item--soon { opacity: 0.5; cursor: not-allowed; }
.t-nav-item--soon:hover { background: transparent; opacity: 0.65; }
.t-shell.t-sidebar-collapsed .t-nav-item .lbl,
.t-shell.t-sidebar-collapsed .t-nav-item .badge { display: none; }
.t-shell.t-sidebar-collapsed .t-nav-item { justify-content: center; padding: 8px 0; }

.t-side__foot {
  padding: 8px;
  border-top: 1px solid var(--t-hair);
  flex-shrink: 0;
}
.t-side__create {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  background: var(--t-accent);
  color: var(--t-ink-invert);
  font-weight: 500; font-size: 13px;
  border-radius: var(--t-r-button);
  width: 100%;
  transition: background var(--t-fast) var(--t-ease);
}
.t-side__create:hover { background: var(--t-accent-2); }
.t-side__create .plus { font-weight: 600; }
.t-shell.t-sidebar-collapsed .t-side__create .lbl { display: none; }
.t-shell.t-sidebar-collapsed .t-side__create { justify-content: center; padding: 8px 0; }

.t-side__collapse {
  position: absolute;
  left: 196px; top: 16px;
  width: 18px; height: 36px;
  background: var(--t-canvas);
  border: 1px solid var(--t-hair-strong);
  border-radius: 4px;
  display: grid; place-items: center;
  font-size: 10px; color: var(--t-ink-mute);
  z-index: 20;
  cursor: pointer;
  transition: left var(--t-base) var(--t-ease);
}
.t-shell.t-sidebar-collapsed .t-side__collapse { left: 32px; }
.t-side__collapse:hover { color: var(--t-accent); border-color: var(--t-accent); }

/* ─── topbar ─── */
.t-top {
  grid-area: top;
  background: var(--t-canvas);
  border-bottom: 1px solid var(--t-hair);
  display: flex; align-items: center;
  padding: 0 14px;
  gap: 12px;
  height: 48px;
  font-size: 12.5px;
}
.t-top__crumb {
  color: var(--t-ink-mute);
  display: flex; gap: 6px; align-items: baseline;
}
.t-top__crumb b { color: var(--t-ink); font-weight: 600; }
.t-top__crumb .sep { color: var(--t-ink-faint); }
.t-top__spacer { flex: 1; }
.t-top__search {
  position: relative;
  width: 280px;
}
.t-top__search input {
  width: 100%;
  height: 30px;
  padding: 0 10px 0 30px;
  border: 1px solid var(--t-hair-strong);
  border-radius: var(--t-r-input);
  background: var(--t-canvas);
  font-size: 12.5px;
}
.t-top__search input:focus {
  outline: 2px solid var(--t-accent);
  outline-offset: -1px;
  border-color: transparent;
}
.t-top__search .ico {
  position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  color: var(--t-ink-mute);
  pointer-events: none;
}
.t-top__search kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-family: var(--t-font-mono); font-size: 10px;
  color: var(--t-ink-faint);
  background: var(--t-canvas-2);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--t-hair);
}
.t-top__btn {
  position: relative;
  width: 30px; height: 30px;
  border-radius: var(--t-r-button);
  display: grid; place-items: center;
  color: var(--t-ink-mute);
}
.t-top__btn svg { display: block; }
.t-top__btn:hover { background: var(--t-canvas-2); color: var(--t-ink); }
.t-top__btn .dot {
  position: absolute; top: 6px; right: 6px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--t-bad);
}

/* ─── main ─── */
.t-main {
  grid-area: main;
  min-width: 0;
  overflow: auto;
  position: relative;
  background: var(--t-bg);
}

/* ─────────────────────────────────────────────────────────
   MOBILE shell (<720px)
   ───────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .t-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 48px 1fr 56px;
    grid-template-areas:
      "top"
      "main"
      "tabbar";
    height: 100vh;
    height: 100dvh;
  }
  .t-side {
    position: fixed; inset: 0 30% 0 0;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform var(--t-base) var(--t-ease);
    background: var(--t-canvas-2);
  }
  .t-shell.t-drawer-open .t-side { transform: translateX(0); }
  /* в выдвижном меню логотип всегда полный, даже если панель на десктопе была свёрнута */
  .t-shell.t-sidebar-collapsed .t-side__brand { padding: 0 14px; justify-content: flex-start; }
  .t-shell.t-sidebar-collapsed .t-side__brand-link { justify-content: flex-start; width: auto; }
  .t-shell.t-sidebar-collapsed .t-side__brand .t-brand-lockup { display: block; }
  .t-shell.t-sidebar-collapsed .t-side__brand .t-brand-mark { display: none; }
  /* шапка телефона: бургер слева, логотип строго по центру, «Выйти» справа (как у ученика) */
  .t-top {
    display: grid;
    grid-template-columns: minmax(44px, 1fr) auto minmax(44px, 1fr);
    align-items: center;
    gap: 4px;
    padding: 0 8px;
  }
  .t-burger { grid-column: 1; justify-self: start; }
  .t-top__brand {
    display: inline-flex; align-items: center; justify-content: center;
    grid-column: 2; justify-self: center;
    min-height: 44px; color: var(--t-ink);
  }
  .t-top__brand .t-brand-lockup { width: 132px; }
  .t-top__crumb,
  .t-top__spacer,
  .t-top__search,
  .t-top__btn[data-cheat-open] { display: none; }   /* клавиатурная шпаргалка на телефоне не нужна */
  .t-top__btn[data-teacher-logout] { grid-column: 3; justify-self: end; }
  .t-side__create { min-height: 44px; }
  .t-shell.t-sidebar-collapsed .t-side__user-meta,
  .t-shell.t-sidebar-collapsed .t-nav-item .lbl,
  .t-shell.t-sidebar-collapsed .t-nav-item .badge,
  .t-shell.t-sidebar-collapsed .t-side__create .lbl { display: initial; }
  .t-shell.t-sidebar-collapsed .t-nav-item,
  .t-shell.t-sidebar-collapsed .t-side__create {
    justify-content: flex-start;
    padding: 7px 10px;
  }
  .t-side__collapse { display: none; }
  .t-top { position: sticky; top: 0; z-index: 10; }
  .t-top__search { width: 0; visibility: hidden; }
  .t-top__crumb { font-size: 12px; }
  .t-main { padding-bottom: 0; }
  .t-nav-item { min-height: 44px; }
  .t-top__btn,
  .t-burger,
  .t-btn.t-btn--icon { width: 44px; min-width: 44px; height: 44px; }
  .t-btn,
  .t-btn.t-btn--sm,
  .t-input,
  .t-selbar__btn { min-height: 44px; }
}
.t-drawer-backdrop[hidden] { display: none !important; }
@media (max-width: 720px) {
  .t-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgba(0,0,0,0.3);
  }
}
.t-tabbar {
  display: none;
  grid-area: tabbar;
  background: var(--t-canvas);
  border-top: 1px solid var(--t-hair);
  height: 56px;
}
@media (max-width: 720px) {
  .t-tabbar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding-bottom: env(safe-area-inset-bottom, 0);
    height: calc(56px + env(safe-area-inset-bottom, 0));
  }
}
.t-tab {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px;
  color: var(--t-ink-mute);
  font-size: 10px;
  position: relative;
}
.t-tab.on { color: var(--t-accent); }
.t-tab .ico { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; }
.t-tab .ico svg { display: block; width: 18px; height: 18px; }
.t-tab .badge {
  position: absolute; top: 6px; right: 28%;
  background: var(--t-bad); color: white;
  font-family: var(--t-font-mono); font-size: 9px;
  min-width: 14px; height: 14px;
  border-radius: 7px;
  display: grid; place-items: center;
  padding: 0 3px;
}
/* 04.09: display:grid перебивал атрибут hidden — на телефоне светились пустые красные точки при нуле */
.t-tab .badge[hidden],
.t-nav-item .badge[hidden] { display: none; }

/* hamburger */
.t-burger {
  display: none;
  width: 32px; height: 32px;
  border-radius: var(--t-r-button);
  flex-shrink: 0;
}
@media (max-width: 720px) { .t-burger { display: grid; place-items: center; } }
.t-burger:hover { background: var(--t-canvas-2); }
.t-burger svg { display: block; color: var(--t-ink); }

/* ─────────────────────────────────────────────────────────
   COMPONENTS · buttons, inputs, pills, eyebrow
   ───────────────────────────────────────────────────────── */
.t-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px;
  padding: 0 12px;
  background: var(--t-accent);
  color: var(--t-ink-invert);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--t-r-button);
  transition: background var(--t-fast) var(--t-ease);
  cursor: pointer;
  white-space: nowrap;
}
.t-btn:hover { background: var(--t-accent-2); }
.t-btn:active { transform: translateY(0.5px); }
.t-btn.t-btn--ghost {
  background: var(--t-canvas);
  color: var(--t-ink);
  border: 1px solid var(--t-hair-strong);
}
.t-btn.t-btn--ghost:hover { background: var(--t-canvas-2); border-color: var(--t-ink-mute); }
.t-btn.t-btn--danger { background: var(--t-bad); }
.t-btn.t-btn--danger:hover { background: #8e2516; }
.t-btn.t-btn--sm { height: 26px; padding: 0 9px; font-size: 12px; }
.t-btn.t-btn--icon { width: 32px; padding: 0; justify-content: center; }
.t-btn[disabled] { opacity: 0.4; pointer-events: none; }

.t-input {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--t-hair-strong);
  border-radius: var(--t-r-input);
  background: var(--t-canvas);
  font-size: 13px;
}
.t-input:focus {
  outline: 2px solid var(--t-accent);
  outline-offset: -1px;
  border-color: transparent;
}
.t-input[type="number"] { -moz-appearance: textfield; }
.t-input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }

.t-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--t-hair-strong);
  border-radius: var(--t-r-input);
  background: var(--t-canvas);
  font-size: 13px;
  font-family: var(--t-font-body);
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}
.t-textarea:focus {
  outline: 2px solid var(--t-accent);
  outline-offset: -1px;
  border-color: transparent;
}

.t-pill {
  display: inline-flex; align-items: center; gap: 4px;
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--t-hair-strong);
  border-radius: var(--t-r-pill);
  background: var(--t-canvas);
  color: var(--t-ink);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--t-fast) var(--t-ease);
  white-space: nowrap;
}
.t-pill:hover { border-color: var(--t-ink-mute); }
.t-pill.on { background: var(--t-accent); color: var(--t-ink-invert); border-color: var(--t-accent); }
.t-pill .count {
  font-family: var(--t-font-mono);
  font-size: 10px;
  opacity: 0.7;
  margin-left: 2px;
}

.t-eyebrow {
  font-family: var(--t-font-mono);
  font-size: var(--t-fs-label);
  letter-spacing: var(--t-ls-label);
  text-transform: none;
  color: var(--t-ink-mute);
}

.t-h1 {
  font-size: var(--t-fs-page);
  font-weight: 600;
  letter-spacing: -0.005em;
  margin: 0;
  color: var(--t-ink);
}
.t-h2 {
  font-size: var(--t-fs-section);
  font-weight: 600;
  letter-spacing: -0.005em;
  margin: 0;
}

/* kbd hint */
kbd.t-kbd {
  font-family: var(--t-font-mono);
  font-size: 10px;
  color: var(--t-ink-mute);
  background: var(--t-canvas-2);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--t-hair);
}

/* ─────────────────────────────────────────────────────────
   PAGE-INTERNAL TOOLBAR (sticky inside .t-main)
   ───────────────────────────────────────────────────────── */
.t-toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--t-canvas);
  border-bottom: 1px solid var(--t-hair);
  padding: 8px 14px;
  display: flex; gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 12px;
}
.t-toolbar__sep {
  width: 1px; height: 18px;
  background: var(--t-hair);
  margin: 0 4px;
}

/* ─────────────────────────────────────────────────────────
   JOURNAL TABLE · centerpiece
   ───────────────────────────────────────────────────────── */
.t-journal {
  height: 100%;
  display: flex; flex-direction: column;
}
.t-journal__wrap {
  flex: 1;
  overflow: auto;
  position: relative;
  background: var(--t-canvas);
}
.t-jt {
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--t-fs-table);
  font-family: var(--t-font-body);
  width: max-content;
  min-width: 100%;
}
.t-jt th, .t-jt td {
  border-right: 1px solid var(--t-hair);
  border-bottom: 1px solid var(--t-hair);
  padding: 0;
  text-align: center;
  height: var(--t-row);
  min-width: 38px;
  position: relative;
  background: var(--t-canvas);
}
.t-jt thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--t-canvas-2);
  font-weight: 600;
  font-size: 9.5px;
  color: var(--t-ink-mute);
  text-transform: none;
  letter-spacing: 0.04em;
  padding: 4px 3px;
  line-height: 1.3;
  user-select: none;
}
.t-jt thead th .sub {
  display: block;
  font-weight: 400;
  margin-top: 2px;
  font-size: 9px;
  letter-spacing: 0;
  opacity: 0.85;
  text-transform: none;
}
.t-jt thead th.lh   { background: var(--t-col-lesson); }
.t-jt thead th.hw   { background: var(--t-col-hw); color: var(--t-info); }
.t-jt thead th.test { background: var(--t-col-test); color: var(--t-bad); }
.t-jt thead th.cst-1{ background: var(--t-col-custom-1); color: #6e560a; }
.t-jt thead th.cst-2{ background: var(--t-col-custom-2); color: var(--t-ok); }
.t-jt thead th.cst-3{ background: var(--t-col-custom-3); color: #6a3c70; }
.t-jt thead th.cst-4{ background: var(--t-col-custom-4); color: #3d5566; }
.t-jt thead th.cst-5{ background: var(--t-col-custom-5); color: #8a4e1c; }
.t-jt thead th.cst-6{ background: var(--t-col-custom-6); color: var(--t-ink-mute); }

/* sticky student column */
.t-jt th.stu, .t-jt td.stu {
  position: sticky;
  left: 0;
  z-index: 3;
  min-width: var(--t-stickycol-w);
  width: var(--t-stickycol-w);
  text-align: left;
  border-right: 1px solid var(--t-hair-strong);
  background: var(--t-canvas);
}
.t-jt thead th.stu {
  z-index: 6;
  background: var(--t-canvas-2);
  padding-left: 12px;
}
.t-jt td.stu {
  padding: 0 10px;
  font-weight: 500;
}
.t-jt td.stu .row { display: flex; align-items: center; gap: 8px; }
.t-jt td.stu .num {
  font-family: var(--t-font-mono);
  color: var(--t-ink-faint);
  font-size: 10px;
  width: 14px;
  flex-shrink: 0;
}
.t-jt td.stu .nm {
  flex: 1;
  font-size: 12px;
  color: var(--t-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.t-jt td.stu .nm:hover { color: var(--t-accent); text-decoration: underline; }
.t-jt td.stu .avg-pre {
  font-family: var(--t-font-mono);
  font-size: 10px;
  color: var(--t-ink-faint);
  flex-shrink: 0;
}

/* sticky average column (last) */
.t-jt th.avg-h, .t-jt td.avg-c {
  position: sticky;
  right: 0;
  z-index: 3;
  min-width: var(--t-avg-col-w);
  width: var(--t-avg-col-w);
  background: var(--t-accent);
  color: var(--t-ink-invert);
  font-weight: 600;
  border-left: 1px solid var(--t-accent-2);
}
.t-jt th.avg-h { z-index: 5; }
.t-jt td.avg-c {
  font-family: var(--t-font-mono);
  font-size: 12.5px;
  letter-spacing: -0.01em;
}

/* grade cells */
.t-jt td.cell {
  font-weight: 600;
  font-size: var(--t-fs-cell-grade);
  cursor: cell;
  transition: background var(--t-fast) var(--t-ease);
  font-feature-settings: 'tnum' 1;
}
.t-jt td.cell:focus,
.t-jt td.cell:focus-within {
  outline: 2px solid var(--t-accent);
  outline-offset: -2px;
  z-index: 2;
}
.t-jt td.cell:hover { box-shadow: inset 0 0 0 1px var(--t-hair-strong); }
.t-jt td.cell.bad  { background: var(--t-bad-bg); color: var(--t-bad); }
.t-jt td.cell.warn { background: var(--t-warn-bg); color: var(--t-warn); }
.t-jt td.cell.ok   { background: var(--t-ok-bg); color: var(--t-ok); }
.t-jt td.cell.absent {
  background: var(--t-canvas-3);
  color: var(--t-ink-faint);
  font-style: italic;
  font-weight: 500;
}
.t-jt td.cell.absent.late { color: var(--t-warn); }
.t-jt td.cell.absent.excused { color: var(--t-ink-mute); }
.t-jt td.cell.has-note::after {
  content: '';
  position: absolute;
  bottom: 3px; right: 3px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--t-accent);
}
.t-jt td.cell.is-empty { color: var(--t-ink-faint); font-weight: 400; }

/* today column highlight */
.t-jt th.today, .t-jt td.today {
  box-shadow: inset 2px 0 0 var(--t-accent);
}

/* selection */
.t-jt td.cell.selected {
  outline: 2px solid var(--t-accent);
  outline-offset: -2px;
  z-index: 2;
}
.t-jt tr.row-selected td.stu { background: var(--t-accent-wash); }

/* inline edit input */
.t-jt td.cell input.t-cell-edit {
  width: 100%; height: 100%;
  border: none;
  background: var(--t-canvas);
  font: inherit;
  text-align: center;
  font-weight: 600;
  color: var(--t-ink);
  padding: 0;
}
.t-jt td.cell input.t-cell-edit:focus { outline: 2px solid var(--t-accent); outline-offset: -2px; }

/* ─────────────────────────────────────────────────────────
   SELECTION BAR (sticky bottom of main)
   ───────────────────────────────────────────────────────── */
.t-selbar {
  position: fixed;
  left: 220px;
  right: 0;
  bottom: 0;
  z-index: 6;
  background: var(--t-ink);
  color: var(--t-ink-invert);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  height: 48px;
  font-size: 12.5px;
  border-top: 1px solid var(--t-ink);
  box-shadow: 0 -4px 12px rgba(0,0,0,0.10);
  transform: translateY(100%);
  visibility: hidden;
  pointer-events: none;
  transition: transform var(--t-base) var(--t-ease), visibility 0s linear var(--t-base);
  /* П5: бар не растягивает страницу вширь на мобиле — кнопки скроллятся внутри */
  max-width: 100%;
  overflow-x: auto;
}
.t-shell.t-sidebar-collapsed ~ .t-selbar { left: 56px; }
@media (max-width: 720px) {
  .t-selbar { left: 0; bottom: 56px; }
  .t-selbar__hint { display: none; }
}
body.t-has-selection .t-selbar {
  transform: translateY(0);
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}
.t-selbar__count {
  font-weight: 600;
  white-space: nowrap;
}
.t-selbar__spacer { flex: 1; }
.t-selbar__btn {
  height: 30px;
  padding: 0 10px;
  background: rgba(255,255,255,0.09);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: var(--t-r-button);
  color: var(--t-ink-invert);
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--t-fast) var(--t-ease);
}
.t-selbar__btn:hover { background: rgba(255,255,255,0.16); }
.t-selbar__btn.danger { background: var(--t-bad); border-color: var(--t-bad); }
.t-selbar__hint {
  font-family: var(--t-font-mono);
  font-size: 10px;
  color: rgba(255,255,255,0.55);
  white-space: nowrap;
}

/* ─────────────────────────────────────────────────────────
   SAVE INDICATOR (floating bottom right)
   ───────────────────────────────────────────────────────── */
.t-save {
  position: fixed;
  right: 14px;
  bottom: 60px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-family: var(--t-font-mono);
  font-size: 10.5px;
  border-radius: 12px;
  background: var(--t-ok-bg);
  color: var(--t-ok);
  border: 1px solid #cce6d0;
  opacity: 0;
  transition: opacity var(--t-base) var(--t-ease);
  pointer-events: none;
}
.t-save.visible { opacity: 1; }
.t-save.saving { background: var(--t-canvas-2); color: var(--t-ink-mute); border-color: var(--t-hair); }
.t-save.err { background: var(--t-bad-bg); color: var(--t-bad); border-color: #f0d4cf; }
body.t-has-selection .t-save { bottom: 108px; }

/* Wave 9 role UX primitives */
.t-hot-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--ux-action-min-height, 36px);
  padding: 0 12px;
  border-radius: var(--t-r-button);
  background: var(--t-accent);
  color: var(--t-ink-invert);
  font-weight: 600;
  white-space: nowrap;
}

.t-hot-action:hover {
  background: var(--t-accent-2);
}

.t-grade-input {
  width: 100%;
  min-width: 32px;
  height: var(--t-row);
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: center;
  font-family: var(--t-font-mono);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.t-grade-input:focus-visible {
  outline: 2px solid var(--t-accent);
  outline-offset: -2px;
}

/* ─────────────────────────────────────────────────────────
   POPOVER / MODAL · used by + тип, comment-edit, mass-ops
   ───────────────────────────────────────────────────────── */
.t-pop-backdrop {
  position: fixed; inset: 0;
  background: rgba(20, 20, 20, 0.32);
  z-index: 150;
  display: none;
}
.t-pop-backdrop.open { display: block; }

.t-pop {
  position: fixed;
  z-index: 200;
  background: var(--t-canvas);
  border: 1px solid var(--t-hair-strong);
  border-radius: var(--t-r-card);
  box-shadow: var(--t-shadow-pop);
  min-width: 320px;
  max-width: 480px;
  font-size: 13px;
  display: none;
}
.t-pop.open { display: block; }
.t-pop.center {
  left: 50%; top: 50%; transform: translate(-50%, -50%);
}
.t-pop__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--t-hair);
}
.t-pop__title { font-size: 13.5px; font-weight: 600; }
.t-pop__close {
  width: 24px; height: 24px;
  border-radius: var(--t-r-button);
  color: var(--t-ink-mute);
  display: grid; place-items: center;
  font-size: 14px;
}
.t-pop__close:hover { background: var(--t-canvas-2); color: var(--t-ink); }
.t-pop__body {
  padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
  max-height: 60vh; overflow-y: auto;
}
.t-pop__foot {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 10px 14px;
  border-top: 1px solid var(--t-hair);
  background: var(--t-canvas-2);
  border-radius: 0 0 var(--t-r-card) var(--t-r-card);
}

/* field */
.t-field {
  display: flex; flex-direction: column; gap: 4px;
}
.t-field__lbl {
  font-size: 11px;
  font-weight: 500;
  color: var(--t-ink-mute);
}
.t-field input, .t-field select, .t-field textarea {
  width: 100%;
}
.t-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* color swatches */
.t-swatch-row {
  display: flex; gap: 6px;
}
.t-swatch {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1px solid var(--t-hair-strong);
  cursor: pointer;
  transition: transform var(--t-fast) var(--t-ease);
}
.t-swatch.on { border-color: var(--t-accent); border-width: 2px; transform: scale(1.06); }

/* ─────────────────────────────────────────────────────────
   SLIDE-OVER · student card
   ───────────────────────────────────────────────────────── */
.t-slideover-backdrop {
  position: fixed; inset: 0;
  background: rgba(20, 20, 20, 0.22);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-base) var(--t-ease);
}
.t-slideover-backdrop.open {
  opacity: 1; pointer-events: auto;
}

.t-slideover {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 480px;
  max-width: 100%;
  background: var(--t-canvas);
  z-index: 60;
  display: flex;
  flex-direction: column;
  box-shadow: var(--t-shadow-slide);
  transform: translateX(100%);
  transition: transform var(--t-base) var(--t-ease);
}
.t-slideover.open { transform: translateX(0); }
@media (max-width: 720px) {
  .t-slideover { width: 100%; }
}

.t-slideover__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--t-hair);
  flex-shrink: 0;
}
.t-slideover__ava {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--t-accent);
  color: white;
  display: grid; place-items: center;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}
.t-slideover__meta { flex: 1; min-width: 0; }
.t-slideover__name {
  font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.t-slideover__sub {
  font-size: 11.5px; color: var(--t-ink-mute);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.t-slideover__close {
  width: 28px; height: 28px;
  border-radius: var(--t-r-button);
  color: var(--t-ink-mute);
  display: grid; place-items: center;
}
.t-slideover__close:hover { background: var(--t-canvas-2); color: var(--t-ink); }

.t-slideover__tabs {
  display: flex;
  border-bottom: 1px solid var(--t-hair);
  background: var(--t-canvas-2);
  flex-shrink: 0;
  overflow-x: auto;
}
.t-slideover__tab {
  padding: 8px 14px;
  font-size: 12px;
  color: var(--t-ink-mute);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.t-slideover__tab.on { color: var(--t-ink); border-bottom-color: var(--t-accent); background: var(--t-canvas); }

.t-slideover__body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
}

.t-slideover__foot {
  display: flex; gap: 6px;
  padding: 10px 14px;
  border-top: 1px solid var(--t-hair);
  background: var(--t-canvas-2);
  flex-shrink: 0;
  overflow-x: auto;
}

/* metric row */
.t-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.t-metric {
  background: var(--t-canvas-2);
  border-radius: var(--t-r-card);
  padding: 10px;
  text-align: center;
}
.t-metric__v {
  font-family: var(--t-font-mono);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
}
.t-metric__v.ok { color: var(--t-ok); }
.t-metric__v.bad { color: var(--t-bad); }
.t-metric__v.warn { color: var(--t-warn); }
.t-metric__l {
  font-size: 10px;
  color: var(--t-ink-mute);
  margin-top: 4px;
  text-transform: none;
  letter-spacing: 0.04em;
}

/* generic list row in slideover */
.t-row-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--t-hair-soft);
  font-size: 12.5px;
}
.t-row-item:last-child { border-bottom: none; }
.t-row-item__date {
  font-family: var(--t-font-mono);
  font-size: 11px;
  color: var(--t-ink-mute);
  width: 50px;
  flex-shrink: 0;
}
.t-row-item__type {
  font-family: var(--t-font-mono);
  font-size: 9.5px;
  text-transform: none;
  letter-spacing: 0.06em;
  color: var(--t-ink-mute);
  padding: 1px 5px;
  border: 1px solid var(--t-hair);
  border-radius: 3px;
  flex-shrink: 0;
}
.t-row-item__body { flex: 1; min-width: 0; }
.t-row-item__grade {
  font-family: var(--t-font-mono);
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────
   MOBILE journal · number-pad popup
   ───────────────────────────────────────────────────────── */
.t-numpad-backdrop {
  position: fixed; inset: 0;
  background: rgba(20,20,20,0.4);
  z-index: 150;
  display: none;
}
.t-numpad-backdrop.open { display: block; }
.t-numpad {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--t-canvas);
  z-index: 200;
  padding: 14px;
  border-top: 1px solid var(--t-hair);
  border-radius: 12px 12px 0 0;
  display: none;
}
.t-numpad.open { display: block; }
.t-numpad__head {
  font-size: 12px; color: var(--t-ink-mute);
  margin-bottom: 10px;
  display: flex; justify-content: space-between;
}
.t-numpad__head .cur { font-family: var(--t-font-mono); color: var(--t-ink); font-weight: 600; }
.t-numpad__grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
.t-numpad__btn {
  height: 44px;
  border: 1px solid var(--t-hair-strong);
  border-radius: var(--t-r-button);
  background: var(--t-canvas);
  font-size: 15px;
  font-weight: 500;
}
.t-numpad__btn:active { background: var(--t-canvas-2); }
.t-numpad__btn.accent { background: var(--t-accent); color: white; border-color: var(--t-accent); }
.t-numpad__btn.full { grid-column: span 3; }

/* ─────────────────────────────────────────────────────────
   EMPTY / ERROR STATES
   ───────────────────────────────────────────────────────── */
.t-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--t-ink-mute);
}
.t-empty__title { font-size: 14px; font-weight: 500; color: var(--t-ink); margin-bottom: 6px; }
.t-empty__sub { font-size: 12.5px; }

.t-offline-bar {
  background: var(--t-bad);
  color: var(--t-ink-invert);
  padding: 6px 14px;
  font-size: 12px;
  text-align: center;
  font-weight: 500;
  display: none;
}
body.t-offline .t-offline-bar { display: block; }

/* ─────────────────────────────────────────────────────────
   SHORTCUTS CHEAT SHEET (overlay modal)
   ───────────────────────────────────────────────────────── */
.t-cheat {
  position: fixed; inset: 0;
  background: rgba(20,20,20,0.45);
  z-index: 300;
  display: none;
  align-items: center; justify-content: center;
}
.t-cheat.open { display: flex; }
.t-cheat__panel {
  background: var(--t-canvas);
  border-radius: var(--t-r-card);
  padding: 24px 28px;
  width: 480px; max-width: 90vw;
  box-shadow: var(--t-shadow-pop);
}
.t-cheat__title {
  font-size: 14px; font-weight: 600;
  margin: 0 0 12px;
  display: flex; align-items: center; gap: 8px;
}
.t-cheat__grid {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 16px;
  row-gap: 6px;
  font-size: 12.5px;
  align-items: center;
}
.t-cheat__grid kbd {
  font-family: var(--t-font-mono);
  font-size: 11px;
  background: var(--t-canvas-2);
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid var(--t-hair);
}
.t-cheat__close {
  margin-top: 14px;
}

/* utility */
.t-hide { display: none !important; }
@media (max-width: 720px) { .t-hide-mobile { display: none !important; } }
@media (min-width: 721px) { .t-hide-desktop { display: none !important; } }

/* scrollbar finesse */
.t-main::-webkit-scrollbar,
.t-journal__wrap::-webkit-scrollbar,
.t-slideover__body::-webkit-scrollbar { width: 8px; height: 8px; }
.t-main::-webkit-scrollbar-thumb,
.t-journal__wrap::-webkit-scrollbar-thumb,
.t-slideover__body::-webkit-scrollbar-thumb {
  background: var(--t-hair-strong);
  border-radius: 4px;
}

/* Mobile interaction targets live at the end so they win over component defaults. */
@media (max-width: 720px) {
  .t-top__btn,
  .t-burger,
  .t-btn.t-btn--icon {
    width: 44px;
    min-width: 44px;
    height: 44px;
  }
  .t-btn,
  .t-btn.t-btn--sm,
  .t-input,
  .t-selbar__btn {
    min-height: 44px;
  }
}

/* Teacher-controlled accessibility and density preferences. */
html[data-teacher-density="compact"] {
  --t-row: 28px;
}
html[data-teacher-density="compact"] .t-card,
html[data-teacher-density="compact"] .t-section,
html[data-teacher-density="compact"] .pf-panel {
  --teacher-card-space: 12px;
}
html[data-teacher-density="compact"] .t-card,
html[data-teacher-density="compact"] .pf-panel {
  padding-top: 12px;
  padding-bottom: 12px;
}

html[data-teacher-font-scale="large"] {
  --t-fs-page: 19px;
  --t-fs-section: 16px;
  --t-fs-body: 15px;
  --t-fs-table: 14px;
  --t-fs-cell-grade: 15px;
  --t-fs-label: 12px;
  --t-fs-mono: 13px;
}
html[data-teacher-font-scale="large"] .pf-shell {
  font-size: 15px;
}
html[data-teacher-font-scale="large"] .pf-shell :is(p, label, input, select, textarea, button, td, th) {
  font-size: max(13px, 1em);
}

html[data-teacher-contrast="high"] {
  --t-bg: #f3f0e8;
  --t-canvas: #ffffff;
  --t-canvas-2: #f7f5ef;
  --t-canvas-3: #ece8dc;
  --t-ink: #080b12;
  --t-ink-mute: #313744;
  --t-ink-faint: #4c5564;
  --t-accent: #173f94;
  --t-accent-2: #071c49;
  --t-accent-wash: #dce7ff;
  --t-hair: #6e7682;
  --t-hair-strong: #3f4650;
  --t-hair-soft: #a4abb3;
}
html[data-teacher-contrast="high"] :is(button, input, select, textarea, a):focus-visible {
  outline: 3px solid #0d47a1 !important;
  outline-offset: 2px !important;
}

html[data-teacher-motion="reduced"] *,
html[data-teacher-motion="reduced"] *::before,
html[data-teacher-motion="reduced"] *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  scroll-behavior: auto !important;
  transition-duration: 0.001ms !important;
}

/* 04.09 · лаунчер «Фундамент AI» в шапке преподавателя (остальное — fai-panel.css) */
.t-top .t-top__fai { margin-left: 0; height: 36px; padding: 0 12px 0 10px; font-size: 12.5px; }
@media (max-width: 719px) { .t-top .t-top__fai { width: 40px; height: 40px; } }
/* 04.09 · телефон: в шапке 4 элемента — бургер, логотип, «Фундамент AI», «Выйти» (было 3 колонки → «Выйти» переносилась) */
@media (max-width: 720px) {
  .t-top { grid-template-columns: minmax(44px, 1fr) auto auto minmax(44px, 1fr); }
  .t-top .t-top__fai { grid-column: 3; justify-self: end; margin-right: 2px; }
  .t-top__btn[data-teacher-logout] { grid-column: 4; }
}
