/* EduFacturing TechSK Portal - CSS
   Design system: light bento, white background, Rubik/Nunito, four app accent colors.
   NO glass, NO blur, NO dark background on the main app (see DESIGN-REFS ref-01..07).
*/

:root {
  --bg: #ffffff;
  --surface: #f4f6f8;
  --surface-2: #eceff2;
  --text: #14181c;
  --text-2: #55626c;
  --text-3: #8b98a1;
  --border: #e3e7eb;
  --border-2: #d3d9df;

  --petrol: #0090b0;
  --petrol-dark: #06718c;
  --orange: #f89048;
  --orange-dark: #e0762c;
  --green: #2f9e5f;
  --green-dark: #227a48;
  --blue: #3b82c4;
  --blue-dark: #2c66a0;

  --ok: #2f9e5f;
  --bad: #e5645a;
  --wait: #94a3ac;

  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;

  --shadow-sm: 0 2px 8px rgba(20, 24, 28, 0.06);
  --shadow-md: 0 6px 20px rgba(20, 24, 28, 0.08);

  --font-display: 'Rubik', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, sans-serif;

  --sidebar-w: 264px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* The `hidden` attribute must always win. Class rules that set display
   (.grade-status, .inline-msg, .dropzone__filename, ...) have higher
   specificity than the UA [hidden] rule, so without this an element toggled
   with el.hidden = true stays visible (e.g. the grader spinner rendered
   next to the finished result on the projector). */
[hidden] {
  display: none !important;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
}

h1 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  margin-bottom: var(--spacing-sm);
  letter-spacing: -0.01em;
}

h2 {
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  margin-bottom: var(--spacing-md);
}

h3 {
  font-size: 1.1rem;
  margin-bottom: var(--spacing-sm);
}

p { margin-bottom: var(--spacing-sm); }

a {
  color: var(--petrol);
  text-decoration: none;
  transition: color 0.2s;
}
a:hover { color: var(--petrol-dark); }

code {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.9em;
  color: var(--petrol-dark);
  background: var(--surface);
  padding: 0.1em 0.4em;
  border-radius: 6px;
}

.eyebrow {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--petrol);
  margin-bottom: 0.6rem;
}

.lede {
  max-width: 72ch;
  color: var(--text-2);
  font-size: clamp(0.95rem, 1.3vw, 1.05rem);
}

.section-title {
  color: var(--text);
  margin-top: var(--spacing-xl);
}

.icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* ---------------- Auth shell (pre-login) ---------------- */
.auth-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 4rem) clamp(1rem, 3vw, 2rem) 5rem;
}

.auth-shell .brand {
  margin-bottom: var(--spacing-xl);
}

/* ---------------- App shell (logged in) ---------------- */
.app-shell { min-height: 100vh; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-md);
  padding: 0.9rem clamp(1rem, 2.5vw, 2rem);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
}

.brand__mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--petrol), var(--blue));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.brand__mark svg { width: 20px; height: 20px; color: #fff; }

.topbar__search {
  flex: 1;
  max-width: 380px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  color: var(--text-3);
}
.topbar__search svg { width: 16px; height: 16px; flex-shrink: 0; }
.topbar__search input {
  border: none;
  background: none;
  outline: none;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text);
  width: 100%;
}

.topbar__nav {
  display: flex;
  gap: 1.4rem;
}
.topbar__nav a {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-2);
}
.topbar__nav a:hover { color: var(--text); }

.topbar__user {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.topbar__profile {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--petrol-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.topbar__user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}
.topbar__user-info #user-email {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text);
}

.trial-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: rgba(248, 144, 72, 0.14);
  color: var(--orange-dark);
  width: fit-content;
}
.trial-badge.is-paid { background: rgba(47, 158, 95, 0.14); color: var(--green-dark); }
.trial-badge.is-expired { background: rgba(229, 100, 90, 0.14); color: var(--bad); }

/* ---------------- App body: sidebar + main ---------------- */
.app-body {
  display: flex;
  align-items: flex-start;
  min-height: calc(100vh - 65px);
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg);
  border-right: 1px solid var(--border);
  padding: var(--spacing-lg) var(--spacing-md);
  position: sticky;
  top: 65px;
  height: calc(100vh - 65px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.side-section { margin-bottom: var(--spacing-lg); }
.side-section__heading {
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 0.7rem;
  padding: 0 0.6rem;
}

.side-section a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.6rem;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-weight: 500;
  font-size: 0.92rem;
  margin-bottom: 0.15rem;
}
.side-section a:hover { background: var(--surface); color: var(--text); }
.side-section a svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--text-3); }
.side-section a:hover svg { color: var(--petrol); }

.sidebar-illus {
  margin-top: auto;
  padding-top: var(--spacing-lg);
}
.sidebar-illus svg { width: 100%; height: auto; }

.main {
  flex: 1;
  min-width: 0;
  padding: clamp(1.25rem, 3vw, 2.25rem) clamp(1.25rem, 3vw, 2.5rem) 5rem;
}

/* ---------------- Views / router ---------------- */
.view { display: none; }
.view.is-active { display: block; }

/* ---------------- Bento / Cards ---------------- */
.bento {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: clamp(1rem, 2vw, 1.25rem);
  margin: 0 0 var(--spacing-lg);
}

.bento--tiles { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(1.1rem, 2.5vw, 1.5rem);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.card:hover { box-shadow: var(--shadow-md); }

.card--content { display: flex; flex-direction: column; gap: 0.5rem; }

/* ---- Feature tiles (4 colored app tiles) ---- */
.tile {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  border-radius: var(--radius-lg);
  padding: clamp(1.25rem, 2.5vw, 1.6rem);
  color: #fff;
  cursor: pointer;
  border: none;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-align: left;
  min-height: 168px;
}
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.tile:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

.tile--petrol { background: linear-gradient(145deg, var(--petrol), var(--petrol-dark)); }
.tile--orange { background: linear-gradient(145deg, var(--orange), var(--orange-dark)); }
.tile--green  { background: linear-gradient(145deg, var(--green), var(--green-dark)); }
.tile--blue   { background: linear-gradient(145deg, var(--blue), var(--blue-dark)); }

.tile__icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
}
.tile__icon svg { width: 26px; height: 26px; color: #fff; }

.tile__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
}
.tile__desc {
  font-size: 0.87rem;
  opacity: 0.92;
  flex-grow: 1;
}
.tile__cta {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* ---- Content count cards ---- */
.count-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.count-card__title {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text-2);
  font-size: 0.92rem;
}
.count-card__count {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.1rem;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.count-card__desc { font-size: 0.85rem; color: var(--text-3); flex-grow: 1; }
.count-card__cta { align-self: flex-start; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem clamp(1rem, 2vw, 1.3rem);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  white-space: nowrap;
}

.btn--primary {
  background: var(--petrol);
  color: #fff;
}
.btn--primary:hover { background: var(--petrol-dark); }

.btn--ghost {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-2);
}
.btn--ghost:hover { background: var(--surface); border-color: var(--border-2); color: var(--text); }

.btn--go {
  background: transparent;
  border: none;
  color: var(--petrol);
  font-size: 0.85rem;
  padding: 0.3rem 0;
}
.btn--go:hover { color: var(--petrol-dark); }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.back-btn { margin-bottom: var(--spacing-lg); }

/* ---------------- Forms ---------------- */
.form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.form-group label {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-2);
}

.form-group input,
.form-group select,
.form-group textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--petrol);
  box-shadow: 0 0 0 3px rgba(0, 144, 176, 0.14);
}

.form-note {
  font-size: 0.82rem;
  color: var(--text-3);
}

/* ---------------- Messages ---------------- */
.msg {
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  font-size: 0.88rem;
}
.msg--error {
  background: rgba(229, 100, 90, 0.08);
  border: 1px solid rgba(229, 100, 90, 0.3);
  color: #b3352c;
}
.msg--ok {
  background: rgba(47, 158, 95, 0.08);
  border: 1px solid rgba(47, 158, 95, 0.3);
  color: var(--green-dark);
}

.inline-msg {
  display: inline-block;
  margin-left: 0.6rem;
  font-size: 0.85rem;
  color: var(--bad);
  font-weight: 600;
}

/* ---------------- Content lists (models / presentations) ---------------- */
.filelist {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.file {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.1rem;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}

.file__preview {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface);
}

.file__name {
  font-weight: 600;
  flex-grow: 1;
  min-width: 160px;
}

.file__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.file.is-locked .file__name { color: var(--text-2); }

/* ---------------- Materials strip (dashboard) ---------------- */
.materials-card {
  display: block;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.materials-card:hover { box-shadow: var(--shadow-md); }
.materials-card__photo {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--surface-2);
  display: block;
}
.materials-card__body { padding: 0.9rem 1rem 1.1rem; }
.materials-card__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--text);
  margin-bottom: 0.2rem;
}
.materials-card__meta {
  display: flex;
  gap: 0.6rem;
  font-size: 0.8rem;
  color: var(--text-3);
}

/* ---------------- News / tips panel ---------------- */
.side-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md);
  box-shadow: var(--shadow-sm);
}
.side-panel h3 { margin-bottom: 0.8rem; }
.side-panel ul { list-style: none; display: flex; flex-direction: column; gap: 0.75rem; }
.side-panel li { font-size: 0.88rem; color: var(--text-2); border-bottom: 1px solid var(--border); padding-bottom: 0.7rem; }
.side-panel li:last-child { border-bottom: none; padding-bottom: 0; }
.side-panel li strong { display: block; color: var(--text); margin-bottom: 0.15rem; }

.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--spacing-lg);
  align-items: start;
}
@media (max-width: 960px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

/* ---------------- Learning path timeline ---------------- */
.path {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg) var(--spacing-md);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}
.path__track {
  display: flex;
  align-items: center;
  min-width: max-content;
  gap: 0;
}
.path__step { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; width: 140px; flex-shrink: 0; }
.path__dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid var(--petrol);
  background: var(--bg);
  flex-shrink: 0;
}
.path__step.is-done .path__dot { background: var(--petrol); }
.path__label { font-size: 0.82rem; text-align: center; color: var(--text-2); font-weight: 600; }
.path__line { height: 3px; background: var(--petrol); flex: 1; margin: 0 -70px; min-width: 40px; margin-top: -32px; }

/* ---------------- Learning path (container, crumb, step interactions, next card, rest list) ---------------- */
.learning-path {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}
.lp__crumb {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--text-2);
  margin-bottom: 0.2rem;
}
.path__step {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  border-radius: var(--radius-md);
}
.path__step:hover .path__label,
.path__step:focus-visible .path__label {
  color: var(--text);
}
.path__step:hover .path__dot,
.path__step:focus-visible .path__dot {
  border-color: var(--orange);
}
.path__step:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 4px;
}
.path__step.is-current .path__dot {
  background: var(--orange);
  border-color: var(--orange);
  box-shadow: 0 0 0 4px rgba(248, 144, 72, 0.25);
}
.path__step.is-done .path__label { color: var(--text-2); }
.path__step.is-current .path__label { color: var(--text); font-weight: 700; }

.path-next {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md);
}
.path-next__text {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
}

.lp-rest {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.4rem;
}
.lp-rest__item {
  color: var(--text-2);
  opacity: 0.75;
  font-size: 0.85rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}
.lp-rest__item:last-child { border-bottom: none; }

/* ---------------- Project detail ---------------- */
.proekt-hero {
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-lg);
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
}
.proekt-hero__photo {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: var(--radius-md);
  background: var(--surface-2);
}
.proekt-hero__badges { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.5rem; }
.badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  border: 1px solid var(--border);
}
@media (max-width: 720px) {
  .proekt-hero { grid-template-columns: 1fr; }
}

.proekt-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--spacing-lg);
  align-items: start;
}
@media (max-width: 900px) {
  .proekt-layout { grid-template-columns: 1fr; }
}

.brief {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(1.25rem, 2.5vw, 1.75rem);
  box-shadow: var(--shadow-sm);
}
.brief h1, .brief h2, .brief h3 { color: var(--text); }
.brief p { color: var(--text-2); }
.brief ol { list-style: none; counter-reset: step; margin: 0 0 var(--spacing-sm); display: flex; flex-direction: column; gap: 0.6rem; }
.brief ol li {
  counter-increment: step;
  position: relative;
  padding-left: 2.4rem;
  color: var(--text-2);
}
.brief ol li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -0.1rem;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: var(--petrol);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.brief ul { margin: 0 0 var(--spacing-sm) 1.4rem; color: var(--text-2); }

.files-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md);
  box-shadow: var(--shadow-sm);
}
.files-panel h2 { font-size: 1.05rem; margin-bottom: var(--spacing-sm); }
.files-panel .filelist { margin-bottom: var(--spacing-md); }

.proekt-actions { margin-top: var(--spacing-lg); }

/* ---------------- Grade form / checks (Машинна проверка) ---------------- */
.proverka-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: var(--spacing-lg);
  align-items: start;
}
@media (max-width: 900px) {
  .proverka-layout { grid-template-columns: 1fr; }
}

.gradeform { display: flex; flex-direction: column; gap: var(--spacing-md); }

.dropzone {
  border: 2px dashed var(--border-2);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg) var(--spacing-md);
  text-align: center;
  color: var(--text-3);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone:hover, .dropzone.is-dragover {
  border-color: var(--petrol);
  background: rgba(0, 144, 176, 0.05);
}
.dropzone__icon { width: 36px; height: 36px; margin: 0 auto 0.6rem; color: var(--text-3); }
.dropzone__filename {
  margin-top: 0.7rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  color: var(--text);
}

.results-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md) var(--spacing-lg);
  box-shadow: var(--shadow-sm);
}
.results-panel h2 { font-size: 1.05rem; }

.grade-status {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--petrol);
  font-family: var(--font-display);
  font-weight: 600;
  margin-bottom: var(--spacing-md);
}

.spinner {
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.grade-summary {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin: var(--spacing-sm) 0 var(--spacing-md);
  font-size: 0.95rem;
  color: var(--text-2);
}
.grade-summary strong { font-family: var(--font-display); }
.grade-summary .n-pass strong { color: var(--ok); }
.grade-summary .n-fail strong { color: var(--bad); }
.grade-summary .n-wait strong { color: var(--wait); }

.checks {
  display: flex;
  flex-direction: column;
}

.check {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.75rem 0.2rem;
  border-bottom: 1px solid var(--border);
}
.check:last-child { border-bottom: none; }

.check__icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.check__icon svg { width: 14px; height: 14px; }

.check--pass .check__icon { background: rgba(47, 158, 95, 0.14); color: var(--ok); }
.check--fail .check__icon { background: rgba(229, 100, 90, 0.14); color: var(--bad); }
.check--wait .check__icon { background: rgba(148, 163, 172, 0.16); color: var(--wait); }

.check__label { flex-grow: 1; font-weight: 600; color: var(--text); font-size: 0.95rem; }
.check__detail { color: var(--text-3); font-size: 0.88rem; white-space: nowrap; }

.grade-binding {
  margin-top: var(--spacing-md);
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  color: var(--text-3);
}

/* ---------------- Classroom ---------------- */
.klas-create-form { max-width: 420px; }

.join-code-box {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  background: rgba(248, 144, 72, 0.08);
  border: 2px solid var(--orange);
  border-radius: var(--radius-lg);
  padding: 1rem 1.4rem;
  margin: var(--spacing-md) 0;
}
.join-code {
  font-family: ui-monospace, monospace;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--orange-dark);
}
.join-code-box .join-hint { color: var(--text-2); font-size: 0.85rem; flex-basis: 100%; }

.klas-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--spacing-lg);
  align-items: start;
  margin-top: var(--spacing-lg);
}
@media (max-width: 900px) {
  .klas-layout { grid-template-columns: 1fr; }
}

.roster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--spacing-sm);
}

.student-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.student-card__head { display: flex; align-items: center; gap: 0.7rem; }
.student-card__name { font-family: var(--font-display); font-weight: 600; font-size: 0.92rem; }
.student-card__sub { font-size: 0.75rem; color: var(--text-3); }
.student-card__bar {
  height: 7px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.student-card__bar > span { display: block; height: 100%; background: var(--petrol); }
.student-card .btn--ghost { align-self: flex-start; font-size: 0.78rem; padding: 0.35rem 0.7rem; }

.seat-empty {
  border: 2px dashed var(--border-2);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  font-size: 0.85rem;
  min-height: 108px;
}

.klas-counts {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}
.klas-counts__item { display: flex; align-items: center; gap: 0.8rem; }
.klas-counts__num { font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; color: var(--text); }
.klas-counts__label { font-size: 0.82rem; color: var(--text-3); }

/* ---------------- Account card ---------------- */
.account-card { max-width: 720px; }
.account-status { color: var(--text-2); }
.account-actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
  flex-wrap: wrap;
  margin: var(--spacing-sm) 0;
}
.account-actions__item {
  display: flex;
  align-items: center;
}
.invoice-form { margin-top: var(--spacing-md); }
.invoice-actions {
  display: flex;
  gap: var(--spacing-sm);
}
.invoice-actions button { flex: 1; }

/* ---------------- Toasts ---------------- */
.toast-root {
  position: fixed;
  bottom: 1.2rem;
  right: 1.2rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: 360px;
}
.toast-root .msg { box-shadow: var(--shadow-md); }

/* ---------------- Presentation / projector view (the only dark screen) ---------------- */
.presenter {
  background: #14181c;
  color: #eef3f6;
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  display: none;
}
.presenter.is-active { display: block; }
.presenter h1 { color: #4ab8cc; }
.presenter__notes { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.14); border-radius: var(--radius-md); padding: var(--spacing-md); }

/* ---------------- Responsive ---------------- */
@media (max-width: 900px) {
  .app-body { flex-direction: column; }
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: var(--spacing-md);
    padding: 0.6rem var(--spacing-md);
  }
  .side-section { margin-bottom: 0; display: flex; align-items: center; gap: 0.3rem; flex: 0 0 auto; }
  .side-section__heading { display: none; }
  .side-section a { white-space: nowrap; margin-bottom: 0; padding: 0.5rem 0.6rem; }
  .sidebar-illus { display: none; }
}

@media (max-width: 640px) {
  .path { overflow-x: visible; }
  .path__track { flex-direction: column; align-items: flex-start; min-width: 0; }
  .path__step { flex-direction: row; width: 100%; justify-content: flex-start; align-items: center; gap: 0.8rem; }
  .path__label { text-align: left; }
  .path__line { width: 3px; height: 18px; min-width: 0; flex: 0 0 auto; margin: 0 0 0 9px; }
}

@media (max-width: 768px) {
  .topbar { gap: 0.75rem; }
  .topbar__search { order: 3; max-width: none; flex-basis: 100%; }
  .bento { grid-template-columns: 1fr; }
  .file { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  :root { font-size: 14px; }
  .toast-root { left: 1rem; right: 1rem; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
