/* Shymkent SmartStudy — visual system.
   Colours are taken from the logo: dark green for navigation, red strictly for
   critical states, blue for actions, gold as a thin ornamental accent. */

:root {
  --green-900: #073e35;
  --green-800: #0b5144;
  --green-700: #126b59;
  --green-600: #17806a;
  --green-050: #eaf5f1;

  --blue-700: #0646a5;
  --blue-600: #0757c9;
  --blue-050: #eaf2ff;

  --red-700: #a30d23;
  --red-600: #c8102e;
  --red-050: #fdecef;

  --gold-600: #b08d23;
  --gold-050: #fbf4de;

  --ink-900: #14221e;
  --ink-700: #34443e;
  --ink-500: #5b6c65;
  --ink-300: #87958f;

  --line: #dfe7e3;
  --line-strong: #becdc6;
  --surface: #ffffff;
  --surface-sunken: #f3f7f5;
  --surface-raised: #ffffff;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(12, 48, 39, 0.04), 0 8px 24px rgba(12, 48, 39, 0.05);
  --sidenav-width: 248px;
  --topbar-height: 72px;

  --font: "Segoe UI", Roboto, "Helvetica Neue", Arial, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-900);
  background: var(--surface-sunken);
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; line-height: 1.25; letter-spacing: -0.012em; }
h1 { font-size: clamp(1.55rem, 2.4vw, 2rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.02rem; }
p { margin: 0; }
a { color: var(--blue-600); }

[hidden] { display: none !important; }

/* ---------- Login ---------- */

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: var(--green-900);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 32px 28px 24px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
}

.login-brand { text-align: center; margin-bottom: 24px; }
.login-titles h1 { font-size: 1.25rem; color: var(--green-800); }
.login-titles p { color: var(--ink-500); font-size: 0.9rem; margin-top: 4px; }

.logo { display: block; height: 40px; width: auto; }
.logo-lg { height: 96px; margin: 0 auto 14px; }
/* If the logo file has not been installed yet, hide the broken image instead of
   showing a placeholder that would misrepresent the brand. */
.logo-missing { display: none; }

.login-form { display: grid; gap: 14px; }
.login-form label { display: grid; gap: 5px; font-size: 0.875rem; font-weight: 500; color: var(--ink-700); }
.login-note { margin-top: 16px; text-align: center; font-size: 0.82rem; color: var(--ink-500); }

/* ---------- Form controls ---------- */

input, select, textarea {
  font: inherit;
  color: var(--ink-900);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  width: 100%;
}

input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--blue-600);
  outline-offset: 1px;
}

input:disabled, select:disabled, textarea:disabled {
  background: var(--surface-sunken);
  color: var(--ink-500);
}

textarea { min-height: 120px; resize: vertical; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; margin: 0; }
legend { font-size: 0.85rem; font-weight: 600; color: var(--ink-700); padding: 0 6px; }

.form-error {
  background: var(--red-050);
  border-left: 3px solid var(--red-600);
  color: var(--red-700);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
}

.field-hint { font-size: 0.8rem; color: var(--ink-500); font-weight: 400; }

/* ---------- Buttons ---------- */

.btn {
  font: inherit;
  font-weight: 500;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface);
  color: var(--ink-900);
  border-color: var(--line-strong);
}

.btn:hover:not(:disabled) { background: var(--surface-sunken); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary { background: var(--blue-600); border-color: var(--blue-600); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--blue-700); border-color: var(--blue-700); }

.btn-danger { background: var(--surface); border-color: var(--red-600); color: var(--red-700); }
.btn-danger:hover:not(:disabled) { background: var(--red-050); }

.btn-quiet { background: transparent; border-color: transparent; color: inherit; }
.btn-quiet:hover:not(:disabled) { background: rgba(255, 255, 255, 0.14); }

.btn-block { width: 100%; }
.btn-sm { padding: 5px 10px; font-size: 0.85rem; }

.spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }

/* ---------- Application shell ---------- */

.topbar {
  height: var(--topbar-height);
  background: var(--green-800);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 3px solid var(--gold-600);
}

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand .logo { height: 34px; background: #fff; border-radius: 4px; padding: 2px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 0.95rem; }
.brand-text small { font-size: 0.78rem; color: rgba(255, 255, 255, 0.78); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.account { display: flex; flex-direction: column; text-align: right; line-height: 1.2; margin-right: 6px; }
.account-name { font-size: 0.88rem; font-weight: 500; }
.account-role { font-size: 0.76rem; color: rgba(255, 255, 255, 0.78); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.nav-toggle span { width: 20px; height: 2px; background: #fff; border-radius: 2px; }

.layout { display: flex; align-items: flex-start; min-height: calc(100vh - var(--topbar-height)); }

.sidenav {
  width: var(--sidenav-width);
  flex: 0 0 var(--sidenav-width);
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 14px 10px;
  position: sticky;
  top: var(--topbar-height);
  max-height: calc(100vh - var(--topbar-height));
  overflow-y: auto;
}

.sidenav a {
  display: block;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-700);
  text-decoration: none;
  font-size: 0.92rem;
  margin-bottom: 2px;
}
.sidenav a:hover { background: var(--surface-sunken); }
.sidenav a.active {
  background: var(--green-050);
  color: var(--green-800);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--green-700);
}

.content { flex: 1; min-width: 0; padding: 22px 24px 48px; }

/* ---------- Page structure ---------- */

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.page-head p { color: var(--ink-500); font-size: 0.9rem; margin-top: 3px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card {
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin-bottom: 16px;
}
.card > h3 { margin-bottom: 10px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.form-grid label { display: grid; gap: 5px; font-size: 0.86rem; font-weight: 500; color: var(--ink-700); align-content: start; }
.form-grid .full { grid-column: 1 / -1; }

/* ---------- Status pills: colour is never the only signal ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface-sunken);
  color: var(--ink-700);
  white-space: nowrap;
}
.pill-icon { font-size: 0.78em; line-height: 1; }

.pill.ok     { background: var(--green-050); border-color: #b9d7c6; color: var(--green-800); }
.pill.active { background: var(--blue-050); border-color: #b6ccf3; color: var(--blue-700); }
.pill.info   { background: var(--blue-050); border-color: #cddcf7; color: var(--blue-700); }
.pill.warn   { background: var(--gold-050); border-color: #e4d091; color: #7a6114; }
.pill.error  { background: var(--red-050); border-color: #f0bcc5; color: var(--red-700); }
.pill.muted  { background: var(--surface-sunken); border-color: var(--line-strong); color: var(--ink-500); }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-500); font-weight: 600; }
tbody tr:hover { background: var(--surface-sunken); }
td.actions { white-space: nowrap; text-align: right; }
.row-link { cursor: pointer; }

/* ---------- Stat tiles ---------- */

.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 16px; }
.stat {
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat-value { font-size: 1.7rem; font-weight: 600; line-height: 1.1; color: var(--green-800); }
.stat-label { font-size: 0.82rem; color: var(--ink-500); margin-top: 3px; }
.stat.attention .stat-value { color: var(--red-700); }

/* ---------- Empty / loading / error states ---------- */

.state {
  text-align: center;
  padding: 36px 20px;
  color: var(--ink-500);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}
.state h3 { color: var(--ink-700); margin-bottom: 6px; }
.state.error { border-color: #f0bcc5; background: var(--red-050); color: var(--red-700); }
.state.error h3 { color: var(--red-700); }

.skeleton { height: 14px; border-radius: 4px; background: var(--surface-sunken); margin-bottom: 8px; }

/* ---------- Timeline ---------- */

.timeline { display: flex; gap: 0; overflow-x: auto; padding: 4px 0 2px; }
.timeline-step { flex: 1 1 0; min-width: 122px; position: relative; padding: 0 6px; }
.timeline-step::before {
  content: "";
  position: absolute;
  top: 9px; left: 0; right: 50%;
  height: 2px; background: var(--line-strong);
}
.timeline-step::after {
  content: "";
  position: absolute;
  top: 9px; left: 50%; right: 0;
  height: 2px; background: var(--line-strong);
}
.timeline-step:first-child::before, .timeline-step:last-child::after { display: none; }

.timeline-dot {
  position: relative;
  z-index: 1;
  width: 20px; height: 20px;
  margin: 0 auto 8px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  background: var(--surface);
  display: grid;
  place-items: center;
  font-size: 0.68rem;
  color: var(--ink-500);
}
.timeline-label { font-size: 0.82rem; text-align: center; font-weight: 500; color: var(--ink-700); }
.timeline-time { font-size: 0.74rem; text-align: center; color: var(--ink-500); margin-top: 2px; }
.timeline-hint { font-size: 0.78rem; text-align: center; color: var(--ink-500); margin-top: 4px; }

.timeline-step.done .timeline-dot { background: var(--green-700); border-color: var(--green-700); color: #fff; }
.timeline-step.done .timeline-label { color: var(--green-800); }
.timeline-step.active .timeline-dot { background: var(--blue-600); border-color: var(--blue-600); color: #fff; }
.timeline-step.active .timeline-label { color: var(--blue-700); font-weight: 600; }
.timeline-step.failed .timeline-dot { background: var(--red-600); border-color: var(--red-600); color: #fff; }
.timeline-step.failed .timeline-label { color: var(--red-700); font-weight: 600; }
.timeline-step.failed .timeline-hint { color: var(--red-700); }
.timeline-step.skipped { opacity: 0.5; }

/* ---------- Report ---------- */

.why-list { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 5px; font-size: 0.92rem; }
.callout {
  border-left: 3px solid var(--blue-600);
  background: var(--blue-050);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-top: 12px;
}
.callout.warn { border-color: var(--gold-600); background: var(--gold-050); }
.callout.error { border-color: var(--red-600); background: var(--red-050); color: var(--red-700); }

.finding {
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 10px;
  background: var(--surface-raised);
}
.finding.error { border-left-color: var(--red-600); }
.finding.warn { border-left-color: var(--gold-600); }
.finding.muted { border-left-color: var(--line-strong); }
.finding.ok { border-left-color: var(--green-700); }

.finding-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.finding-quote { font-style: italic; color: var(--ink-900); margin-bottom: 8px; }
.finding-note { font-size: 0.87rem; color: var(--ink-500); margin-bottom: 8px; }

.evidence {
  background: var(--surface-sunken);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-size: 0.86rem;
  margin-top: 8px;
}
.evidence-source { font-weight: 600; color: var(--green-800); margin-bottom: 3px; font-size: 0.83rem; }
.evidence-text { color: var(--ink-700); }

/* ---------- Communication and safety ---------- */

/* An unconfirmed speaker is rendered as a plain caveat, never styled to read as
   an identified person; only a confirmed role gets the emphasised treatment. */
.safety-speaker { font-weight: 550; color: var(--ink-700); margin-bottom: 2px; }
.safety-speaker.confirmed { color: var(--ink-900); }
.safety-finding .finding-note { color: var(--ink-700); font-weight: 500; }

.topic-row { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--line); }
.topic-row:last-child { border-bottom: none; }
.topic-main { flex: 1; min-width: 0; }
.topic-source { font-size: 0.78rem; color: var(--ink-500); margin-top: 2px; }

/* ---------- Audio player ---------- */

.player { background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.waveform-wrap { position: relative; margin-bottom: 10px; }
.waveform { display: block; width: 100%; height: 88px; background: var(--surface-sunken); border-radius: var(--radius-sm); cursor: pointer; }
.player-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.player-time { font-variant-numeric: tabular-nums; font-size: 0.88rem; color: var(--ink-700); }
.player-rates { display: flex; gap: 4px; }
.player-rates button { padding: 3px 9px; font-size: 0.82rem; }
.player-rates button[aria-pressed="true"] { background: var(--green-700); border-color: var(--green-700); color: #fff; }
.follow-toggle { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--ink-700); }
.follow-toggle input { width: auto; }

.transcript {
  max-height: 460px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 6px;
  background: var(--surface);
}
.segment { padding: 7px 9px; border-radius: var(--radius-sm); cursor: pointer; display: grid; gap: 2px; }
.segment:hover { background: var(--surface-sunken); }
.segment.active { background: var(--blue-050); box-shadow: inset 3px 0 0 var(--blue-600); }
.segment.flagged { background: var(--red-050); }
.segment-time { font-size: 0.76rem; color: var(--ink-500); font-variant-numeric: tabular-nums; }
.segment-speaker { font-size: 0.78rem; color: var(--ink-500); }
.segment-speaker.confirmed { color: var(--ink-700); font-weight: 550; }
.segment mark { background: var(--gold-050); padding: 0 2px; }

/* ---------- Devices ---------- */

.device-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: var(--surface-raised); }
.device-card h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.device-facts { margin-top: 10px; display: grid; gap: 4px; font-size: 0.86rem; color: var(--ink-700); }
.device-facts dt { color: var(--ink-500); font-size: 0.8rem; }
.device-facts .row { display: flex; justify-content: space-between; gap: 10px; }

/* ---------- Toast & modal ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  background: var(--ink-900);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.26);
  z-index: 60;
  font-size: 0.9rem;
  max-width: min(92vw, 520px);
}
.toast.error { background: var(--red-700); }
.toast.success { background: var(--green-800); }

.modal { border: none; border-radius: var(--radius); padding: 0; max-width: min(94vw, 480px); box-shadow: 0 12px 36px rgba(0,0,0,0.3); }
.modal::backdrop { background: rgba(16, 33, 28, 0.5); }
.modal-inner { padding: 20px 22px; display: grid; gap: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* ---------- Misc ---------- */

.muted { color: var(--ink-500); }
.small { font-size: 0.84rem; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.85em; }
.stack { display: grid; gap: 10px; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.checklist { display: grid; gap: 6px; max-height: 260px; overflow-y: auto; }
.checklist label { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; font-size: 0.88rem; }
.checklist input { width: auto; margin-top: 3px; }

.summary-line { display: grid; gap: 4px; font-size: 0.9rem; }
.summary-line b { color: var(--green-800); }

/* ---------- SmartStudy product refresh ---------- */

.skip-link {
  position: fixed;
  left: 16px;
  top: 10px;
  z-index: 100;
  transform: translateY(-150%);
  background: var(--surface);
  color: var(--green-900);
  border: 2px solid var(--green-700);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-weight: 650;
}
.skip-link:focus { transform: translateY(0); }

.eyebrow,
.stat-kicker {
  display: block;
  color: var(--green-700);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.25;
  text-transform: uppercase;
}

.login-view {
  padding: 32px;
  background:
    radial-gradient(circle at 15% 18%, rgba(255,255,255,0.09), transparent 26rem),
    var(--green-900);
}
.login-card {
  max-width: 880px;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(300px, 0.92fr) minmax(340px, 1.08fr);
  overflow: hidden;
  border-radius: 22px;
  box-shadow: 0 24px 70px rgba(0, 24, 19, 0.32);
}
.login-brand {
  min-height: 510px;
  margin: 0;
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #fff;
  background: var(--green-800);
  border-right: 4px solid var(--red-600);
}
.login-brand::after {
  content: "Урок становится понятным";
  display: block;
  max-width: 20ch;
  margin: 26px auto 0;
  color: rgba(255,255,255,0.82);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}
.login-brand .logo-lg {
  width: min(230px, 100%);
  height: auto;
  margin: 0 auto 20px;
  padding: 14px;
  border-radius: 18px;
  background: #fff;
}
.login-titles h1 { color: #fff; font-size: 1.45rem; }
.login-titles p { color: rgba(255,255,255,0.76); }
.login-panel {
  padding: 52px 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--surface);
}
.login-heading { margin-bottom: 28px; }
.login-heading h2 { margin-top: 8px; font-size: 1.55rem; }
.login-heading p { margin-top: 9px; color: var(--ink-500); }
.login-form { gap: 18px; }
.login-form input { min-height: 46px; }
.login-form .btn { min-height: 46px; margin-top: 2px; }

.topbar {
  background: rgba(255,255,255,0.96);
  color: var(--ink-900);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 12px rgba(14, 62, 50, 0.05);
  backdrop-filter: blur(12px);
  padding-inline: 20px;
}
.brand { min-width: 0; }
.brand .logo {
  width: 48px;
  height: 48px;
  padding: 3px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.brand-text strong { color: var(--green-900); font-size: 1rem; }
.brand-text small { color: var(--ink-500); }
.account-name { color: var(--ink-900); }
.account-role { color: var(--ink-500); }
.topbar .btn-quiet { color: var(--ink-700); }
.topbar .btn-quiet:hover:not(:disabled) { background: var(--green-050); color: var(--green-900); }
.nav-toggle span { background: var(--green-900); }

.sidenav {
  padding: 22px 14px;
  background: var(--green-900);
  border-right: 0;
}
.sidenav::before {
  content: "РАЗДЕЛЫ";
  display: block;
  margin: 0 12px 12px;
  color: rgba(255,255,255,0.7);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}
.sidenav a {
  min-height: 42px;
  margin-bottom: 4px;
  padding: 10px 13px;
  display: flex;
  align-items: center;
  color: rgba(255,255,255,0.78);
  border-radius: 10px;
  transition: background-color 120ms ease, color 120ms ease;
}
.sidenav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidenav a.active {
  color: #fff;
  background: rgba(255,255,255,0.13);
  box-shadow: inset 3px 0 0 #ef4655;
}

.content {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 34px 34px 64px;
}
.page-head { margin-bottom: 24px; align-items: center; }
.page-head p { margin-top: 6px; font-size: 0.93rem; }
.page-actions .btn { min-height: 40px; }

.btn { min-height: 38px; padding-inline: 16px; transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-primary { box-shadow: 0 6px 15px rgba(7, 87, 201, 0.16); }

.card,
.device-card,
.player {
  border-color: rgba(190, 205, 198, 0.72);
  box-shadow: var(--shadow);
}
.card { padding: 20px 22px; margin-bottom: 18px; }
.card-head { margin-bottom: 16px; }

.stats { gap: 14px; margin-bottom: 20px; }
.stat {
  min-height: 130px;
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border-color: var(--line);
  box-shadow: var(--shadow);
}
.stat::after {
  content: "";
  position: absolute;
  width: 54px;
  height: 4px;
  top: 0;
  left: 18px;
  border-radius: 0 0 4px 4px;
  background: var(--green-600);
}
.stat.analysis::after { background: var(--blue-600); }
.stat.attention::after { background: var(--red-600); }
.stat-kicker { margin-bottom: auto; color: var(--ink-500); }
.stat-value { margin-top: 14px; font-size: 2rem; font-variant-numeric: tabular-nums; }
.stat-label { max-width: 24ch; font-size: 0.86rem; }

.table-wrap { border: 1px solid var(--line); border-radius: 11px; }
table { background: var(--surface); }
th { padding-top: 11px; padding-bottom: 11px; background: var(--surface-sunken); }
th:first-child, td:first-child { padding-left: 14px; }
th:last-child, td:last-child { padding-right: 14px; }
tbody tr:last-child td { border-bottom: 0; }

.lesson-identity {
  display: grid;
  gap: 10px;
  padding: 24px 26px;
  margin-bottom: 18px;
  background: var(--green-900);
  color: #fff;
  border-radius: var(--radius);
  box-shadow: 0 12px 34px rgba(7, 62, 53, 0.16);
}

.finding { padding: 16px 18px; border-left-width: 4px; border-radius: 10px; }
.finding-quote { margin: 12px 0; padding-left: 14px; border-left: 2px solid var(--line-strong); font-style: normal; font-weight: 550; }
.evidence { padding: 12px 14px; border: 1px solid var(--line); }
.evidence-source { color: var(--green-700); }

.device-card { padding: 20px; border-radius: var(--radius); position: relative; }
.device-card::before {
  content: "";
  position: absolute;
  top: 22px;
  left: 0;
  width: 4px;
  height: 34px;
  border-radius: 0 4px 4px 0;
  background: var(--line-strong);
}
.device-card.is-online::before { background: var(--green-600); }
.device-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.device-head h3 { margin-top: 4px; }
.device-summary { margin-top: 9px; color: var(--ink-500); font-size: 0.9rem; }
.device-lesson { margin-top: 14px; padding: 13px 14px; display: grid; gap: 4px; border-radius: 10px; background: var(--surface-sunken); }
.device-lesson.current { background: var(--blue-050); border-left: 3px solid var(--blue-600); }
.technical-details { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.technical-details summary { cursor: pointer; color: var(--ink-500); font-size: 0.83rem; font-weight: 600; }
.technical-details[open] summary { color: var(--green-700); }
.device-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

.player { padding: 18px; }
.waveform { height: 108px; }
.transcript { max-height: 520px; padding: 8px; }
.segment { padding: 10px 11px; }

details > summary { min-height: 32px; display: flex; align-items: center; }

@media (prefers-contrast: more) {
  :root { --line: #9caca5; --line-strong: #6e8078; }
  .pill, .btn, input, select, textarea { border-width: 2px; }
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .login-view { padding: 0; background: var(--surface); }
  .login-card { min-height: 100vh; max-width: none; grid-template-columns: 1fr; border-radius: 0; box-shadow: none; }
  .login-brand { min-height: auto; padding: 24px; border-right: 0; border-bottom: 4px solid var(--red-600); }
  .login-brand .logo-lg { width: 150px; margin-bottom: 10px; }
  .login-brand::after { display: none; }
  .login-panel { padding: 34px 24px; justify-content: flex-start; }
  .nav-toggle { display: flex; }
  .layout { display: block; }
  .sidenav {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    bottom: 0;
    width: 74vw;
    max-width: 280px;
    z-index: 25;
    transform: translateX(-102%);
    transition: transform 0.18s ease-out;
    box-shadow: 4px 0 18px rgba(0,0,0,0.16);
    max-height: none;
  }
  .sidenav.open { transform: translateX(0); }
  .content { padding: 22px 16px 44px; }
  .account { display: none; }
  .brand-text small { display: none; }
  #changePasswordButton { display: none; }
}

@media (max-width: 560px) {
  .topbar { padding-inline: 10px; gap: 8px; }
  .brand .logo { width: 42px; height: 42px; }
  .brand-text strong { font-size: 0.9rem; }
  #logoutButton { padding-inline: 9px; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-actions .btn { width: 100%; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { min-height: 122px; padding: 15px; }
  .stat-value { font-size: 1.65rem; }
  .card { padding: 16px; }
  .device-head { flex-direction: column; }
  th, td { padding: 8px 7px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; }
}

@media print {
  .topbar, .sidenav, .page-actions, .player, .nav-toggle { display: none !important; }
  .content { padding: 0; }
  .card { break-inside: avoid; box-shadow: none; }
  body { background: #fff; }
}

/* =====================================================================
   Lesson board, «Назначить урок» drawer and the lesson page
   ===================================================================== */

/* Anchored scrolling and focus land below the sticky top bar, not under it. */
html { scroll-padding-top: calc(var(--topbar-height) + 16px); }

.icon { flex: none; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.btn-ghost { background: transparent; border-color: transparent; color: var(--blue-700); }
.btn-ghost:hover:not(:disabled) { background: var(--blue-050); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-700);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-sunken); color: var(--ink-900); }

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 600;
  color: var(--blue-600);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.spinner.dark { border-color: rgba(7, 87, 201, 0.22); border-top-color: var(--blue-600); flex: none; }

.state-hint { margin-top: 6px; font-size: 0.86rem; }
.state-action { margin-top: 14px; }
.slow-note { margin-top: 12px; text-align: center; font-size: 0.86rem; color: var(--ink-500); }

.skeleton {
  background: linear-gradient(90deg, #eef3f0 0, #e1e9e5 40%, #eef3f0 80%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.count {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 22px;
  padding: 0 7px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-700);
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}
.count.alert { background: var(--red-050); border-color: #f0bcc5; color: var(--red-700); }

/* ---------- Status badge: icon + word, colour is never the only cue ---------- */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-sunken);
  color: var(--ink-700);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}
.status-badge.info   { background: var(--blue-050); border-color: #cddcf7; color: var(--blue-700); }
.status-badge.active { background: var(--blue-600); border-color: var(--blue-600); color: #fff; }
.status-badge.ok     { background: var(--green-050); border-color: #b9d7c6; color: var(--green-800); }
.status-badge.warn   { background: var(--gold-050); border-color: #e4d091; color: #6b5410; }
.status-badge.error  { background: var(--red-050); border-color: #f0bcc5; color: var(--red-700); }
.status-badge.muted  { background: var(--surface-sunken); border-color: var(--line-strong); color: var(--ink-500); }
.status-badge .icon-record { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

.tag-offline {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border: 1px solid #e4d091;
  border-radius: 5px;
  background: var(--gold-050);
  color: #6b5410;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- Problem note: reason + what to do ---------- */

.problem {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  font-size: 0.87rem;
}
.problem > .icon { margin-top: 2px; }
.problem > div { flex: 1; min-width: 0; }
.problem > .btn { align-self: center; }
.problem.warn { background: var(--gold-050); border-color: #e4d091; color: #5c470c; }
.problem.error { background: var(--red-050); border-color: #f0bcc5; color: var(--red-700); }
.problem-reason { font-weight: 600; overflow-wrap: anywhere; }
.problem-action { margin-top: 2px; color: var(--ink-700); overflow-wrap: anywhere; }
.problem-label { font-weight: 600; }
.problem.compact { padding: 8px 10px; font-size: 0.82rem; }
.device-note { margin-bottom: 10px; }
.card > .problem, .card .timeline + .problem, .card .progress + .problem { margin-top: 14px; }

.safety-chip {
  display: inline-flex;
  align-items: flex-start;
  gap: 7px;
  padding: 5px 10px;
  border: 1px solid #e4d091;
  border-radius: var(--radius-sm);
  background: var(--gold-050);
  color: #5c470c;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.35;
}
.safety-chip > .icon { margin-top: 2px; }
.safety-chip-note { display: block; font-weight: 500; color: var(--ink-700); }

/* ---------- Five-step lesson progress ---------- */

.progress { display: grid; gap: 6px; }
.progress-bar { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 3px; }
.progress-bar span { height: 6px; border-radius: 99px; background: #e1e9e5; }
.progress-bar .done { background: var(--green-600); }
.progress-bar .current { background: var(--blue-600); }
.progress-bar .failed { background: var(--red-600); }
.progress-steps {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--ink-500);
  font-size: 0.8rem;
}
.progress-steps li { display: flex; align-items: center; gap: 4px; min-width: 0; line-height: 1.25; }
.progress-steps li.done { color: var(--green-800); }
.progress-steps li.current { color: var(--blue-700); font-weight: 650; }
.progress-steps li.failed { color: var(--red-700); font-weight: 650; }

/* ---------- Scores: donut for the result, bars for the two components ---------- */

.score-viz { display: flex; align-items: center; gap: 16px; min-width: 0; }
.score-viz-overall { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: none; }
.donut { position: relative; width: 72px; height: 72px; }
.donut-lg { width: 132px; height: 132px; }
.donut svg { display: block; width: 100%; height: 100%; transform: rotate(-90deg); }
.donut-track { fill: none; stroke: #e1e9e5; stroke-width: 5; }
.donut-track.unknown { stroke: var(--line-strong); stroke-width: 3; stroke-dasharray: 2 2.2; }
.donut-value { fill: none; stroke: var(--green-600); stroke-width: 5; stroke-linecap: round; }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
/* Sized to stay inside the ring even for "100%" and "74,2%". */
.donut-center strong { font-size: 0.86rem; font-weight: 700; color: var(--green-800); letter-spacing: -0.02em; }
.donut-lg .donut-center strong { font-size: 1.45rem; }
.donut-center strong.unknown { color: var(--ink-500); }
.score-viz-caption {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--ink-700);
  font-size: 0.78rem;
  font-weight: 650;
  text-align: center;
  line-height: 1.2;
}
.score-viz-caption .unknown { max-width: 11ch; margin-top: 2px; color: var(--ink-500); font-weight: 500; }
.score-bars { flex: 1; min-width: 0; display: grid; gap: 9px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 8px; font-size: 0.82rem; }
.bar-label { color: var(--ink-700); font-weight: 500; }
.bar-value { color: var(--ink-900); font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.bar-value.unknown { color: var(--ink-500); font-weight: 500; font-size: 0.78rem; }
.bar-track { grid-column: 1 / -1; height: 7px; overflow: hidden; border-radius: 99px; background: #e1e9e5; }
.bar-track > span { display: block; height: 100%; border-radius: inherit; background: var(--green-600); }
.bar-row.accuracy .bar-track > span { background: var(--blue-600); }
/* A missing score is hatched and dashed: visibly "unknown", never an empty 0%. */
.bar-track.unknown {
  background: repeating-linear-gradient(135deg, #dfe7e3 0 4px, transparent 4px 8px);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.score-viz-lg { gap: 26px; }
.score-viz-lg .score-bars { gap: 14px; }
.score-viz-lg .bar-row { font-size: 0.92rem; }
.score-viz-lg .bar-track { height: 10px; }

/* ---------- Lesson card ---------- */

.card-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
}

.lesson-card {
  --tone: var(--line-strong);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 16px 18px;
  border: 1px solid rgba(190, 205, 198, 0.72);
  border-top: 4px solid var(--tone);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.lesson-card.tone-info { --tone: #8fb0e8; }
.lesson-card.tone-active { --tone: var(--blue-600); }
.lesson-card.tone-ok { --tone: var(--green-600); }
.lesson-card.tone-warn { --tone: var(--gold-600); }
.lesson-card.tone-error { --tone: var(--red-600); }
.lesson-card:focus { outline: 3px solid var(--blue-600); outline-offset: 2px; }
.lesson-card.is-new { animation: new-card 2.6s ease-out 2; box-shadow: 0 0 0 3px rgba(7, 87, 201, 0.28), var(--shadow); }
@keyframes new-card { 0%, 40% { box-shadow: 0 0 0 7px rgba(7, 87, 201, 0.35), var(--shadow); } }
.skeleton-card { min-height: 280px; box-shadow: none; }

.lc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.lc-when {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  color: var(--ink-700);
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  line-height: 1.3;
}
.lc-day { color: var(--ink-900); font-weight: 650; }
.lc-subject { color: var(--ink-500); font-size: 0.82rem; font-weight: 600; overflow-wrap: anywhere; }
.lc-title {
  display: -webkit-box;
  overflow: hidden;
  font-size: 1.05rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.lc-title.muted { font-weight: 500; font-style: italic; }
.lc-meta { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; color: var(--ink-700); font-size: 0.86rem; }
.lc-meta li { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.lc-meta li > .icon { margin-top: 2px; color: var(--ink-500); }
.lc-meta li > span { min-width: 0; overflow-wrap: anywhere; }
.lc-materials > span {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.lc-visual { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
/* On a card only the step in progress is spelled out; the full list stays for screen readers. */
.lesson-card .progress-steps { display: block; }
.lesson-card .progress-steps li:not(.current):not(.failed) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
.stack-sm { display: grid; gap: 8px; }
.lc-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.lc-open { margin-left: auto; }

/* ---------- Dashboard ---------- */

.kpis { display: grid; gap: 12px; grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 26px; }
.kpi {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 112px;
  padding: 16px 16px 14px;
  overflow: hidden;
  border: 1px solid rgba(190, 205, 198, 0.72);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--ink-900);
  text-decoration: none;
  transition: border-color 120ms ease;
}
.kpi::before {
  content: "";
  position: absolute;
  top: 0;
  left: 16px;
  width: 40px;
  height: 4px;
  border-radius: 0 0 4px 4px;
  background: var(--green-600);
}
.kpi:hover { border-color: var(--green-600); }
/* The number sits on one line across all tiles; a two-line label only grows downwards. */
.kpi-value { margin-top: 10px; color: var(--green-800); font-size: 1.85rem; font-weight: 650; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-label { color: var(--ink-700); font-size: 0.84rem; font-weight: 500; line-height: 1.25; }
.kpi-hint { color: var(--ink-500); font-size: 0.76rem; }
.kpi.live::before { background: var(--blue-600); }
.kpi.live .kpi-value { color: var(--blue-700); }
.kpi.alert::before { background: var(--red-600); }
.kpi.alert .kpi-value { color: var(--red-700); }
.kpi.warn::before { background: var(--gold-600); }
.kpi.warn .kpi-value { color: #6b5410; }

.board-section { margin-bottom: 30px; }
.board-section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.board-section-head h2 { display: flex; align-items: center; gap: 8px; font-size: 1.15rem; }
.section-link { font-size: 0.88rem; font-weight: 600; white-space: nowrap; }
.section-empty {
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink-500);
  font-size: 0.9rem;
}

/* ---------- Lesson list filters ---------- */

.filters {
  display: grid;
  gap: 12px;
  margin-bottom: 24px;
  padding: 16px 18px;
  border: 1px solid rgba(190, 205, 198, 0.72);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.filter-search { display: flex; gap: 10px; }
.search-box {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.search-box:focus-within { outline: 2px solid var(--blue-600); outline-offset: 1px; }
.search-box .icon { color: var(--ink-500); }
.search-box input { min-width: 0; padding: 8px 0; border: 0; background: transparent; }
.search-box input:focus { outline: none; }
.filter-toggle { display: none; }
.filter-fields { display: grid; gap: 10px 12px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); align-items: end; }
.filter-field { display: grid; gap: 4px; min-width: 0; color: var(--ink-700); font-size: 0.8rem; font-weight: 600; }
.filter-field select, .filter-field input { font-size: 0.9rem; font-weight: 400; }
.filter-dates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; grid-column: span 2; }
.filter-check { display: flex; align-items: center; gap: 8px; min-height: 38px; font-size: 0.86rem; }
.filter-check input { width: auto; accent-color: var(--blue-600); }
.filter-reset { justify-self: start; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 34px;
  padding: 6px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-700);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}
.chip:hover { border-color: var(--blue-600); color: var(--blue-700); }
.chip[aria-pressed="true"] { border-color: var(--blue-600); background: var(--blue-600); color: #fff; }
.results-count { color: var(--ink-500); font-size: 0.84rem; }

.sheet {
  position: fixed;
  inset: auto 0 0 0;
  width: 100%;
  max-width: 100%;
  max-height: 88dvh;
  margin: 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  overflow-y: auto;
  border: 0;
  border-radius: 18px 18px 0 0;
  background: var(--surface);
  box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.2);
}
.sheet::backdrop { background: rgba(16, 33, 28, 0.45); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.sheet .filter-fields { grid-template-columns: minmax(0, 1fr); margin-bottom: 16px; }
.sheet .filter-dates { grid-column: auto; }

/* ---------- «Назначить урок» drawer ---------- */

.drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(640px, 100vw);
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--surface);
  color: var(--ink-900);
  box-shadow: -16px 0 44px rgba(7, 40, 32, 0.24);
}
.drawer::backdrop { background: rgba(16, 33, 28, 0.45); }
.drawer[open] { animation: drawer-in 180ms ease-out; }
@keyframes drawer-in { from { transform: translateX(28px); opacity: 0.6; } }
.drawer-panel { display: flex; flex-direction: column; height: 100%; }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 22px 14px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 1.3rem; }
.drawer-sub { margin-top: 2px; color: var(--ink-500); font-size: 0.83rem; }
.wizard-nav { padding: 10px 22px; border-bottom: 1px solid var(--line); background: var(--surface-sunken); }
.wizard-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; }
.wizard-steps button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  padding: 6px 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--ink-500);
  font: inherit;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
}
.wizard-steps button:disabled { cursor: default; }
.wizard-steps button:hover:not(:disabled) { background: var(--surface); color: var(--ink-900); }
.wizard-step-num {
  display: grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-500);
  font-size: 0.8rem;
  font-weight: 700;
}
.wizard-step-label { min-width: 0; line-height: 1.2; overflow-wrap: anywhere; }
.wizard-steps .current button { color: var(--ink-900); font-weight: 650; }
.wizard-steps .current .wizard-step-num { border-color: var(--blue-600); background: var(--blue-600); color: #fff; }
.wizard-steps .done button, .wizard-steps .visited button { color: var(--ink-700); }
.wizard-steps .done .wizard-step-num { border-color: var(--green-600); background: var(--green-600); color: #fff; }
.wizard-steps .visited .wizard-step-num { border-color: var(--blue-600); color: var(--blue-700); }

.drawer-body {
  flex: 1;
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 18px 22px 28px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.wizard-step-title { display: flex; flex-direction: column; gap: 2px; font-size: 1.15rem; }
.wizard-step-title:focus:not(:focus-visible) { outline: none; }
.wizard-step-count { color: var(--green-700); font-size: 0.74rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.drawer-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 22px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.drawer-foot:empty { display: none; }
.drawer-foot-end { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.wz-grid { display: grid; gap: 14px 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.wz-grid .span-2 { grid-column: 1 / -1; }
.wz-times { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.wz-field { display: grid; align-content: start; gap: 5px; min-width: 0; }
.wz-field > label, .wz-label {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  color: var(--ink-700);
  font-size: 0.87rem;
  font-weight: 600;
}
.optional { color: var(--ink-500); font-size: 0.78rem; font-weight: 400; }
.wz-field input, .wz-field select, .wz-field textarea { min-height: 42px; }
.field-error { color: var(--red-700); font-size: 0.83rem; font-weight: 600; }
.wz-field.invalid input, .wz-field.invalid select, .wz-field.invalid textarea {
  border-color: var(--red-600);
  box-shadow: 0 0 0 1px var(--red-600);
}
.wz-alert:focus { outline: 2px solid var(--red-600); outline-offset: 2px; }
.wz-notices { display: grid; gap: 10px; }
.wz-notices:empty { display: none; }
.wz-lead { color: var(--ink-700); font-weight: 600; }
.wz-section { display: grid; gap: 12px; padding-top: 16px; border-top: 1px solid var(--line); }
.wz-section h4 { font-size: 0.98rem; }
.wz-stack { display: grid; gap: 12px; }
.wz-empty {
  padding: 9px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  color: var(--ink-700);
  font-size: 0.86rem;
}
.wz-link-row { display: flex; }

.wz-choices { display: grid; gap: 8px; min-width: 0; padding: 12px 14px 14px; }
.wz-choices.invalid { border-color: var(--red-600); }
.wz-choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}
.wz-choice:has(input:checked) { border-color: var(--blue-600); background: var(--blue-050); box-shadow: inset 0 0 0 1px var(--blue-600); }
.wz-choice.disabled { cursor: not-allowed; opacity: 0.62; }
.wz-choice input, .wz-check input { flex: none; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--blue-600); }
.wz-choice-text { display: grid; gap: 2px; min-width: 0; }
.wz-choice-hint { color: var(--ink-500); font-size: 0.82rem; }
.wz-check { display: flex; align-items: flex-start; gap: 10px; padding: 6px 2px; font-size: 0.9rem; cursor: pointer; }

.wz-note {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px 10px;
  padding: 10px 12px;
  border: 1px solid #cddcf7;
  border-radius: var(--radius-sm);
  background: var(--blue-050);
  font-size: 0.87rem;
}
.wz-note > .icon { margin-top: 2px; color: var(--blue-700); }
.wz-note > span { flex: 1; min-width: 12rem; }

.wz-materials { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: 0.88rem; }
.wz-materials li { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.wz-materials li > span { min-width: 0; overflow-wrap: anywhere; }
.wz-materials .icon { margin-top: 3px; color: var(--green-700); }
.wz-summary { display: grid; gap: 8px; padding: 12px 14px; border: 1px solid #b9d7c6; border-radius: var(--radius-sm); background: var(--green-050); }
.wz-summary h4 { color: var(--green-800); font-size: 0.9rem; }

.device-panel {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green-600);
  border-radius: var(--radius-sm);
}
.device-panel.is-offline { border-left-color: var(--gold-600); }
.device-panel-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.device-panel-head strong { margin-right: auto; }
.device-panel dl { display: grid; gap: 6px; margin: 0; font-size: 0.87rem; }
.device-panel dl > div { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 8px; }
.device-panel dt { color: var(--ink-500); }
.device-panel dd { margin: 0; overflow-wrap: anywhere; }

.file-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.file-pick input:focus-visible + label { outline: 2px solid var(--blue-600); outline-offset: 2px; }
.file-pick-name { min-width: 0; font-size: 0.88rem; overflow-wrap: anywhere; }
.wz-count { justify-self: end; color: var(--ink-500); font-size: 0.78rem; }

.wz-review { display: grid; gap: 8px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.wz-review-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.wz-review-head h4 { font-size: 0.98rem; }
.wz-review dl { display: grid; gap: 8px; margin: 0; }
.wz-review dl > div { display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: 10px; font-size: 0.9rem; }
.wz-review dt { color: var(--ink-500); }
.wz-review dd { margin: 0; overflow-wrap: anywhere; }

.wz-progress-slot:empty { display: none; }
.wz-progress {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 12px 14px;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  font-size: 0.88rem;
}
.wz-progress li { display: flex; align-items: center; gap: 10px; color: var(--ink-500); }
.wz-progress li.done { color: var(--green-800); }
.wz-progress li.current { color: var(--blue-700); font-weight: 600; }
.wz-progress li.failed { color: var(--red-700); font-weight: 600; }
.wz-dot { flex: none; width: 14px; height: 14px; border: 2px solid var(--line-strong); border-radius: 50%; }
.wz-submit-error { display: grid; justify-items: start; gap: 10px; }
.wz-submit-error:focus { outline: none; }

/* ---------- Lesson page ---------- */

.back-row { margin-bottom: 12px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; font-weight: 600; text-decoration: none; }
.back-link:hover { text-decoration: underline; }

.identity-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.identity-label { padding: 2px 9px; border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 999px; color: rgba(255, 255, 255, 0.88); font-size: 0.82rem; }
.identity-print { margin-left: auto; border-color: rgba(255, 255, 255, 0.35); background: rgba(255, 255, 255, 0.08); color: #fff; }
.identity-print:hover:not(:disabled) { background: rgba(255, 255, 255, 0.16); }
.lesson-identity h1 { color: #fff; font-size: clamp(1.35rem, 2.4vw, 1.9rem); overflow-wrap: anywhere; }
.lesson-identity h1.untitled { color: rgba(255, 255, 255, 0.82); font-style: italic; font-weight: 500; }
.identity-subject { color: #cfe8df; font-weight: 600; }
.identity-meta { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0; padding: 0; list-style: none; color: rgba(255, 255, 255, 0.92); font-size: 0.9rem; }
.identity-meta li { display: flex; align-items: center; gap: 8px; min-width: 0; }
.identity-meta li > span { min-width: 0; overflow-wrap: anywhere; }
.identity-meta .icon { color: #a8d7c9; }
.identity-materials { display: grid; gap: 6px; margin-top: 4px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.16); }
.identity-caption { color: #a8d7c9; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.identity-materials ul { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 0; padding: 0; list-style: none; color: rgba(255, 255, 255, 0.92); font-size: 0.88rem; }
.identity-materials li { display: flex; align-items: flex-start; gap: 6px; min-width: 0; }
.identity-materials li > .icon { margin-top: 3px; color: #a8d7c9; }
.identity-materials p { color: rgba(255, 255, 255, 0.82); font-size: 0.88rem; }
.identity-safety { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.lesson-identity .link-btn { color: #fff; }

.status-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.report-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 20px; align-items: start; }
.report-main, .report-aside { min-width: 0; }
.report-main > .state { margin-bottom: 18px; }
.report-aside .transcript { max-height: 48vh; }
@media (min-width: 1200px) {
  .report-layout.has-aside { grid-template-columns: minmax(0, 1fr) minmax(340px, 420px); }
  /* The player stays in view; the transcript takes the remaining height and is
     the only thing that scrolls inside the column. */
  .report-aside {
    position: sticky;
    top: calc(var(--topbar-height) + 16px);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - var(--topbar-height) - 32px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .report-aside > .card { flex: none; }
  .report-aside > .card:has(.transcript) { flex: 1 1 auto; min-height: 260px; display: flex; flex-direction: column; margin-bottom: 0; }
  .report-aside > .card:has(.transcript) > .stack { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .report-aside .transcript { flex: 1; min-height: 120px; max-height: none; }
}

.score-block { display: flex; flex-wrap: wrap; align-items: center; gap: 24px; }
.score-block .score-viz { flex: 1 1 340px; }
.score-why { flex: 1 1 300px; min-width: 0; }
.score-why h2 { font-size: 1.15rem; }
.report-summary { margin-top: 6px; color: var(--ink-700); }
.why-driver { margin-top: 10px; font-weight: 600; }
.metric-help { margin-top: 14px; font-size: 0.88rem; }
.metric-help summary { color: var(--blue-700); font-weight: 600; cursor: pointer; }
.metric-help ul { display: grid; gap: 6px; margin: 8px 0 0; padding-left: 20px; color: var(--ink-700); }

.all-clear { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--green-050); color: var(--green-800); font-weight: 600; }
.finding-group { margin-top: 16px; }
.finding-group > h3, .finding-group-title { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 1rem; }
details.finding-group { padding: 2px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
details.finding-group[open] { padding-bottom: 12px; }
details.finding-group > summary { min-height: 44px; font-weight: 650; cursor: pointer; }
details.finding-group .finding-group-title { margin: 0; }
.finding-note.not-error { display: flex; align-items: flex-start; gap: 6px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-sunken); color: var(--ink-700); }
.finding-note.not-error .icon { margin-top: 3px; }
.finding-sources { display: grid; gap: 6px; margin-top: 10px; }
.sources-caption { color: var(--green-700); font-size: 0.74rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.evidence { margin-top: 0; }
.evidence-source { display: flex; align-items: center; gap: 6px; }

.topic-groups { display: grid; gap: 16px; margin-top: 12px; }
.topic-group h4 { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }

.report-technical { margin-top: 0; padding: 12px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.report-technical .device-facts dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.technical-link { display: inline-block; margin-top: 10px; font-size: 0.86rem; }

/* ---------- Floating «Назначить урок» on phones ---------- */

.fab-assign { display: none; }

@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .fab-assign:not([hidden]) {
    position: fixed;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    z-index: 40;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 50px;
    padding: 12px 20px;
    border: 0;
    border-radius: 999px;
    background: var(--blue-600);
    color: #fff;
    font: inherit;
    font-weight: 600;
    box-shadow: 0 10px 24px rgba(7, 87, 201, 0.35);
    cursor: pointer;
  }
  .has-fab .content { padding-bottom: 104px; }
  .has-fab .page-actions .btn-primary { display: none; }
  .has-fab .toast { bottom: 84px; }
  .filter-panel { display: none; }
  .filter-toggle { display: inline-flex; }
  .drawer { width: 100vw; }
}

@media (max-width: 560px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { min-height: 96px; padding: 14px 12px 12px; }
  .kpi-value { font-size: 1.55rem; }
  .filters { padding: 12px; }
  .lesson-card { padding: 14px; }
  .drawer-head, .drawer-body, .wizard-nav { padding-left: 16px; padding-right: 16px; }
  .drawer-foot { padding-left: 16px; padding-right: 16px; }
  .wizard-steps { display: flex; }
  .wizard-steps li { flex: none; }
  .wizard-steps li.current { flex: 1; }
  .wizard-steps li:not(.current) .wizard-step-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .wz-grid { grid-template-columns: minmax(0, 1fr); }
  .device-panel dl > div, .wz-review dl > div { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .lesson-identity { padding: 18px 16px; }
  .score-block { gap: 16px; }
  .score-viz-lg { flex-wrap: wrap; justify-content: center; }
  .score-viz-lg .score-bars { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton, .status-badge .icon-record, .lesson-card.is-new, .drawer[open] { animation: none; }
}

@media print {
  .fab-assign, .drawer, .back-row, .status-actions, .identity-print, .report-aside, .report-technical,
  .finding .btn { display: none !important; }
  .lesson-identity { background: #fff; color: var(--ink-900); border: 1px solid var(--line-strong); box-shadow: none; }
  .lesson-identity h1, .identity-meta, .identity-materials ul, .identity-subject { color: var(--ink-900); }
  .report-layout.has-aside { grid-template-columns: minmax(0, 1fr); }
  details.finding-group { border: 0; padding: 0; }
}
