/* ============================================================
   ПрофильУм — styles.css
   Сдержанная институциональная тема: тёмно-бирюзовый и синий.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --clr-bg:        #f3f7f6;
  --clr-surface:   #ffffff;
  --clr-border:    #d7e2e0;
  --clr-text:      #12262b;
  --clr-muted:     #5c7075;
  --clr-primary:   #0f766e;
  --clr-primary-h: #115e59;
  --clr-success:   #15803d;
  --clr-danger:    #a02c22;
  --clr-warn:      #a86412;
  --clr-blue:      #0e7490;
  --clr-purple:    #0e7490;
  --clr-rose:      #9e1f38;
  --radius:        3px;
  --radius-sm:     3px;
  --shadow:        none;
  --shadow-md:     0 12px 40px rgba(9,30,32,.18);
  --transition:    .12s ease;
}

body {
  font-family: 'Segoe UI', 'Inter', 'Helvetica Neue', Arial, sans-serif;
  background: var(--clr-bg);
  color: var(--clr-text);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
}

a { color: var(--clr-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

#app { display: flex; flex-direction: column; min-height: 100vh; }

/* ── Header ───────────────────────────────────────────── */
header {
  background: #0b3b3c;
  border-bottom: 2px solid #0f766e;
  padding: 0 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-size: 19px;
  font-weight: 600;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
  letter-spacing: .01em;
  padding: 11px 0;
}
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 32px; height: 32px; border-radius: 2px;
  background: #ffffff;
  color: #0b3b3c; font-size: 13px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  letter-spacing: .02em;
}
.logo-sub { font-size: 11px; font-weight: 400; color: #9fc0be; display: block; line-height: 1.2; }
.logo span span:first-child { color: #ffffff !important; }

#tabNav {
  display: flex;
  gap: 2px;
  flex: 1;
  order: 3;
  flex-basis: 100%;
  border-top: 1px solid rgba(255,255,255,.10);
  overflow-x: auto;
  scrollbar-width: none;
}
#tabNav::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: 10px 13px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #a9c6c4;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 0;
  white-space: nowrap;
  transition: color var(--transition), border-color var(--transition);
}
.tab-btn:hover { background: rgba(255,255,255,.06); color: #ffffff; }
.tab-btn.active { background: transparent; color: #ffffff; border-bottom-color: #6fbfb5; }

#authBar { display: flex; align-items: center; gap: 10px; flex-shrink: 0; margin-left: auto; padding: 11px 0; }

.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  background: transparent;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 2px;
  font-size: 13px;
  font-weight: 500;
  color: #e6f2f0;
}
.user-pill .text-muted { color: #a9c6c4 !important; }

/* ── Main Content ─────────────────────────────────────── */
main { flex: 1; padding: 24px; max-width: 1120px; margin: 0 auto; width: 100%; }

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary   { background: var(--clr-primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--clr-primary-h); }
.btn-secondary { background: #e9f3f1; color: var(--clr-primary); border-color: #c3dbd7; }
.btn-secondary:hover:not(:disabled) { background: #dcebe8; }
.btn-ghost     { background: transparent; color: var(--clr-muted); border-color: var(--clr-border); }
.btn-ghost:hover:not(:disabled) { background: var(--clr-bg); color: var(--clr-text); }
.btn-danger    { background: var(--clr-danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #8a2419; }
.btn-success   { background: var(--clr-success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #12652f; }
.btn-sm        { padding: 5px 10px; font-size: 12.5px; }
.btn-lg        { padding: 11px 22px; font-size: 15px; }

/* Выделенные кнопки ВХОДА и ВЫХОДА */
.btn-enter-demo {
  background: #0e7490;
  color: #fff;
  padding: 9px 18px;
  font-weight: 600;
}
.btn-enter-demo:hover { background: #0b6079; }

.btn-enter-exam {
  background: #8a1b31;
  color: #fff;
  padding: 9px 18px;
  font-weight: 600;
}
.btn-enter-exam:hover { background: #731629; }

.btn-enter-highlight {
  background: #0f766e;
  color: #fff;
  padding: 8px 16px;
  font-weight: 600;
}
.btn-enter-highlight:hover { background: #115e59; }

.btn-exit-highlight {
  background: #a86412;
  color: #fff;
  padding: 8px 16px;
  font-weight: 600;
}
.btn-exit-highlight:hover { background: #8a5210; }

.btn-exit-locked {
  background: #f8e6e6;
  color: #8a1b31;
  border: 1px solid #c0392b;
  padding: 8px 14px;
  font-weight: 600;
}
.btn-exit-locked:hover { background: #f4d2d3; }

/* ── Cards ────────────────────────────────────────────── */
.card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--clr-border);
  background: #fafcfb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 600;
}
.card-header h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 18px; }
.collapsible { cursor: pointer; user-select: none; }
.collapsible:hover { background: #f4f7f6; }
.collapse-icon { color: var(--clr-muted); }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }

/* ── Badges ───────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px;
  border-radius: 2px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .01em;
}
.badge-blue      { background: #e5f1f3; color: #0e6f7a; border: 1px solid #c8dfe3; }
.badge-green     { background: #e7f4ec; color: #15803d; border: 1px solid #c3e2d5; }
.badge-rose      { background: #f8e6e6; color: #9e1f38; border: 1px solid #f4d2d3; }
.badge-red       { background: #fbe9e7; color: #991b1b; border: 1px solid #e4a9a4; }
.badge-purple    { background: #e7f2f1; color: #0e7490; border: 1px solid #c3dbd7; }
.badge-secondary { background: var(--clr-bg); color: var(--clr-muted); border: 1px solid var(--clr-border); }
.badge-gray      { background: #edf1f0; color: var(--clr-muted); border: 1px solid #d7e2e0; }
.badge-yellow    { background: #fbf3dd; color: #7a4a17; border: 1px solid #e6d3a0; }
.badge-success   { background: #e7f4ec; color: #15803d; border: 1px solid #c3e2d5; }
.badge-info      { background: #e5f1f3; color: #0e6f7a; border: 1px solid #c8dfe3; }
.badge-warn      { background: #fbf3dd; color: #7a4a17; border: 1px solid #e6d3a0; }

.user-role-badge { font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 2px; letter-spacing: .02em; }
.user-role-badge.student  { background: #e5f1f3; color: #0e6f7a; }
.user-role-badge.teacher  { background: #e7f4ec; color: #166534; }
.user-role-badge.director { background: #e7f2f1; color: #115e59; }
.user-role-badge.admin    { background: #fbe9e7; color: #991b1b; }

/* ── Forms ────────────────────────────────────────────── */
.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 9px 13px;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  color: var(--clr-text);
  background: var(--clr-surface);
  transition: border var(--transition), box-shadow var(--transition);
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 2px rgba(15,118,110,.16);
}
.form-textarea { resize: vertical; min-height: 74px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.form-row-inline { display: flex; gap: 16px; align-items: center; }
.form-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.form-select-sm, .form-input-sm { padding: 6px 10px; font-size: 13px; width: auto; }
.inline-num { width: 88px !important; }

label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: var(--clr-muted); }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; color: var(--clr-text); cursor: pointer; margin: 0; }
.switch-row { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; color: var(--clr-text); cursor: pointer; margin: 0; }
.switch-row input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track { position: relative; width: 38px; height: 20px; background: #cfdedb; border: 1px solid #b7cbc7; border-radius: 2px; flex-shrink: 0; transition: background .15s, border-color .15s; }
.switch-track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; background: #ffffff; border: 1px solid #9fb8b3; border-radius: 2px; transition: transform .15s, border-color .15s; }
.switch-row input:checked + .switch-track { background: var(--clr-primary); border-color: var(--clr-primary); }
.switch-row input:checked + .switch-track::after { transform: translateX(18px); border-color: transparent; }
.switch-row input:focus-visible + .switch-track { outline: 2px solid var(--clr-primary); outline-offset: 2px; }

/* ── Alerts ───────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px; margin-top: 8px; }
.alert-error   { background: #fbe9e7; color: #991b1b; border: 1px solid #e4a9a4; }
.alert-success { background: #e7f4ec; color: #166534; border: 1px solid #a9d8c3; }
.alert-warn    { background: #fbf3dd; color: #7a4a17; border: 1px solid #d9b45a; }
.alert-info    { background: #e5f1f3; color: #0d5560; border: 1px solid #a9c9cf; }

/* ── Toasts ───────────────────────────────────────────── */
#toastContainer {
  position: fixed;
  bottom: 92px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Modals ───────────────────────────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(9,30,32,.58);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}
.modal-backdrop.active { display: flex; }
.modal {
  background: var(--clr-surface);
  border-radius: 3px;
  border-top: 3px solid var(--clr-primary);
  padding: 26px;
  max-width: 480px;
  width: 94%;
  box-shadow: var(--shadow-md);
  position: relative;
  animation: modalIn .15s ease;
}
.modal-lg { max-width: 680px; }
.modal-close {
  position: absolute; top: 14px; right: 14px;
  background: none; border: none; font-size: 19px;
  cursor: pointer; color: var(--clr-muted);
}
.modal h2 { font-size: 19px; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.modal-divider { text-align: center; color: var(--clr-muted); margin: 16px 0; font-size: 12px; position: relative; }
.modal-divider::before, .modal-divider::after { content:''; height:1px; background: var(--clr-border); position: absolute; top:50%; width:22%; }
.modal-divider::before { left:0; } .modal-divider::after { right:0; }

@keyframes modalIn {
  from { opacity:0; transform:translateY(6px); }
  to   { opacity:1; transform:translateY(0); }
}

/* Полноэкранное окно-объявление при входе/выходе */
.modal-fullscreen {
  background: rgba(9,30,32,.80) !important;
  backdrop-filter: blur(3px) !important;
  z-index: 2500 !important;
  padding: 20px;
}
.work-confirm-box {
  background: var(--clr-surface);
  border-radius: 3px;
  border-top: 4px solid var(--clr-primary);
  padding: 32px;
  max-width: 680px;
  width: 100%;
  box-shadow: 0 18px 60px rgba(0,0,0,.35);
  max-height: 92vh;
  overflow-y: auto;
}
.confirm-banner-icon {
  width: 42px; height: 42px; border-radius: 2px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; margin-bottom: 14px;
}
.confirm-banner-icon.enter { background: #e9f3f1; color: #0f766e; }
.confirm-banner-icon.exit  { background: #fbf3dd; color: #7a4a17; }
.confirm-banner-icon.lock  { background: #f8e6e6; color: #8a1b31; }
.confirm-banner-icon.enter::after { content: "\2192"; }
.confirm-banner-icon.exit::after  { content: "\2190"; }
.confirm-banner-icon.lock::after  { content: "!"; }

/* Чёткое визуальное разделение Демо-раздела и Основной (КР) части */
.demo-main-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 16px;
}
.section-demo-card {
  background: #f7fbfa;
  border: 1px solid #c3dbd7;
  border-left: 3px solid #0e7490;
  border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 12px;
}
.section-exam-card {
  background: #fdf8f8;
  border: 1px solid #dfa9ab;
  border-left: 3px solid #9e1f38;
  border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 12px;
}
.section-divider-banner {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px;
}
.section-divider-banner.is-demo {
  background: #edf5f6; border: 1px solid #c8dfe3; color: #0d5560;
}
.section-divider-banner.is-exam {
  background: #fbf0f0; border: 1px solid #dfa9ab; color: #8a1b31;
}

/* ── Empty & Loading states ───────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--clr-muted);
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
}
.empty-state h3 { font-size: 18px; margin-bottom: 10px; color: var(--clr-text); }
.empty-state p { margin-bottom: 18px; }
.loading-placeholder { text-align:center; padding:40px; color:var(--clr-muted); }

/* ── Works ────────────────────────────────────────────── */
.access-code-bar {
  background: #eef6f4;
  border: 1px solid #c3dbd7;
  border-left: 3px solid #0f766e;
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.work-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.work-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.work-title { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.work-subject { font-size: 13px; color: var(--clr-primary); font-weight: 600; }
.work-desc { font-size: 13px; color: var(--clr-muted); margin-top: 4px; }
.work-meta { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; }
.work-codes-list { display: flex; flex-direction: column; gap: 10px; }

.work-code-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border: 1.5px solid var(--clr-border);
  border-radius: var(--radius-sm);
  background: #f6f9f8;
  flex-wrap: wrap;
}
.work-code-pill.has-demo-and-exam {
  border-left: 4px solid var(--clr-primary);
}
.work-code-pill.is-demo-only {
  background: #edf7f7;
  border-left: 4px solid var(--clr-blue);
}
.work-code-pill.is-exam-only {
  background: #fcf4f4;
  border-left: 4px solid var(--clr-rose);
}
.code-label { font-family: 'Courier New', monospace; font-size: 15px; font-weight: 700; color: var(--clr-primary); background: #e9f3f1; padding: 3px 8px; border-radius: 2px; }
.code-label.big { font-size: 16px; }
.code-desc { font-size: 13px; color: var(--clr-text); font-weight: 500; }
.code-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.timer-label { font-size: 12px; color: var(--clr-muted); font-weight: 600; }

.class-section { padding: 16px 20px; border-top: 1px solid var(--clr-border); }
.class-section:first-of-type { border-top: none; }
.class-section h4 { font-size: 15px; color: var(--clr-text); margin-bottom: 12px; font-weight: 700; display:flex; align-items:center; justify-content:space-between; }

/* ── Enrollment widget ────────────────────────────────── */
.enrollment-widget .enroll-section { margin-top: 16px; padding: 16px; background: #f4f7f6; border-radius: var(--radius-sm); border: 1px solid var(--clr-border); }
.enrollment-widget .enroll-section h4 { margin-bottom: 6px; font-size: 15px; }
.enrollment-widget code { background: #d7e2e0; padding: 2px 6px; border-radius: 2px; font-size: 13px; }

/* ── Work session ─────────────────────────────────────── */
.work-session { max-width: 860px; margin: 0 auto; }
.work-session-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  padding: 16px 20px;
  background: var(--clr-surface);
  border-radius: var(--radius);
  border: 1px solid var(--clr-border);
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.work-session-title h2 { font-size: 20px; margin-bottom: 4px; }
.work-session-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.timer-display {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 8px 16px;
  background: #edf1f0;
  border-radius: 3px;
  color: var(--clr-text);
  border: 2px solid var(--clr-border);
}
.timer-graded { background: #fbf0f0; border-color: #dfa9ab; color: var(--clr-rose); }
.timer-urgent { animation: pulse 1s infinite; color: var(--clr-danger) !important; background: #fbe9e7 !important; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.65} }

.task-block {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.task-header { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.task-num { font-weight: 700; font-size: 14px; color: var(--clr-primary); }
.task-type-badge { font-size: 11.5px; padding: 2px 7px; background: var(--clr-bg); border: 1px solid var(--clr-border); border-radius: 2px; color: var(--clr-muted); font-weight: 600; }
.task-topic { font-size: 13px; color: var(--clr-muted); }
.task-question { font-size: 15px; font-weight: 500; margin-bottom: 12px; line-height: 1.55; white-space: pre-wrap; }
.task-unit { font-size: 13px; color: var(--clr-muted); margin-bottom: 8px; }
.task-input-area { margin-bottom: 10px; }
.task-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.task-feedback {
  margin-top: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.task-feedback.correct   { background: #e7f4ec; border: 1px solid #a9d8c3; color: #166534; }
.task-feedback.incorrect { background: #fbe9e7; border: 1px solid #e4a9a4; color: #991b1b; }
.task-feedback details { margin-top: 6px; }
.task-feedback summary { cursor: pointer; font-weight: 600; }

.options-group { display: flex; flex-direction: column; gap: 8px; }
.option-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin: 0;
  color: var(--clr-text);
  font-weight: 500;
  transition: background var(--transition), border var(--transition);
}
.option-label:hover { background: #eef6f4; border-color: var(--clr-primary); }
.option-label input { accent-color: var(--clr-primary); width: 17px; height: 17px; flex-shrink: 0; }

.submit-row { display: flex; justify-content: space-between; align-items:center; gap:12px; flex-wrap:wrap; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--clr-border); }
.btn-submit { font-size: 16px; padding: 12px 28px; }

/* ── Results ──────────────────────────────────────────── */
.results-view { max-width: 840px; margin: 0 auto; }
.results-summary { text-align: center; margin-bottom: 20px; padding: 24px; background: var(--clr-surface); border-radius: var(--radius); border: 1px solid var(--clr-border); box-shadow: var(--shadow); }
.results-summary h2 { font-size: 22px; margin-bottom: 14px; }
.results-stats { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.stat-pill { padding: 6px 14px; background: var(--clr-bg); border-radius: 3px; font-size: 14px; border: 1px solid var(--clr-border); }

.results-details { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.result-task {
  padding: 16px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--clr-border);
  border-left: 4px solid var(--clr-border);
  background: var(--clr-surface);
  box-shadow: var(--shadow);
}
.result-task.correct   { border-left-color: var(--clr-success); }
.result-task.incorrect { border-left-color: var(--clr-danger); }
.result-task-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; font-weight: 600; }
.result-task-body p { font-size: 14px; margin-bottom: 4px; }
.result-task-body details summary { cursor: pointer; color: var(--clr-primary); font-size: 13px; font-weight: 600; }
.feedback-text { font-style: italic; color: var(--clr-muted); }

.grade-pill { display: inline-block; min-width: 28px; height: 28px; line-height: 28px; text-align: center; border-radius: 2px; font-weight: 700; font-size: 14px; padding: 0 6px; }
.grade-5 { background: #e7f4ec; color: #166534; }
.grade-4 { background: #e5f1f3; color: #0e6f7a; }
.grade-3 { background: #fbf3dd; color: #7a4a17; }
.grade-2 { background: #fbe9e7; color: #991b1b; }

/* Баллы за задания: 5-цветная шкала, как на ЕГЭ/ОГЭ */
.score-pill { display: inline-block; padding: 2px 9px; border-radius: 2px; font-size: 13px; font-weight: 700; border: 1px solid transparent; white-space: nowrap; }
.score-green      { background: #e7f4ec; color: #166534; border-color: #bfe0cf; }
.score-lightgreen { background: #eef7e2; color: #3f6212; border-color: #d3e6b8; }
.score-yellow     { background: #fbf3dd; color: #7a4a17; border-color: #e6d3a0; }
.score-orange     { background: #fdeadd; color: #9a3412; border-color: #f0c6a8; }
.score-red        { background: #fbe9e7; color: #991b1b; border-color: #e4a9a4; }
.result-task.score-border-green      { border-left-color: #15803d; }
.result-task.score-border-lightgreen { border-left-color: #65a30d; }
.result-task.score-border-yellow     { border-left-color: #ca8a04; }
.result-task.score-border-orange     { border-left-color: #ea580c; }
.result-task.score-border-red        { border-left-color: #b91c1c; }
.score-legend { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 10px; font-size: 12px; color: var(--clr-muted); }
.score-legend span { display: inline-flex; align-items: center; gap: 5px; }
.score-dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; border: 1px solid transparent; }
.score-dot.score-green      { background: #15803d; }
.score-dot.score-lightgreen { background: #65a30d; }
.score-dot.score-yellow     { background: #ca8a04; }
.score-dot.score-orange     { background: #ea580c; }
.score-dot.score-red        { background: #b91c1c; }

/* ── Diary ────────────────────────────────────────────── */
.diary-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.diary-header h2 { font-size: 20px; }
.diary-summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.diary-stat-box { background: var(--clr-surface); border: 1px solid var(--clr-border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.diary-stat-box .val { font-size: 24px; font-weight: 700; color: var(--clr-primary); }
.diary-stat-box .lbl { font-size: 12px; color: var(--clr-muted); margin-top: 2px; }
.subject-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.table-wrap { overflow-x: auto; background: var(--clr-surface); border-radius: var(--radius); border: 1px solid var(--clr-border); box-shadow: var(--shadow); }
.diary-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.diary-table th, .diary-table td { padding: 11px 14px; border-bottom: 1px solid var(--clr-border); text-align: left; }
.diary-table th { background: #f4f7f6; font-weight: 600; font-size: 12px; color: var(--clr-muted); text-transform: uppercase; letter-spacing: .03em; }
.diary-table tr:hover { background: #f2f8f7; }
.diary-filters select { max-width: 240px; }

/* ── Chat ─────────────────────────────────────────────── */
.chat-container {
  display: flex; flex-direction: column;
  height: calc(100vh - 150px); min-height: 520px;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.chat-header {
  display: flex; gap: 12px; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--clr-border);
  background: #f6f9f8;
}
.chat-header h3 { font-size: 16px; }

.chat-pinned { background: #eef5f4; border-bottom: 1px solid #cfe0dd; }
.chat-pinned:empty { display: none; }
.pinned-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 14px; border-left: 3px solid #0f766e;
}
.pinned-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: #0f766e; flex-shrink: 0;
}
.pinned-body {
  flex: 1; min-width: 0; text-align: left;
  background: none; border: none; padding: 0; font: inherit;
  font-size: 13px; color: #33484a; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pinned-body strong { color: #0b3d3a; }
.pinned-body:hover { color: #0f766e; }
.pinned-nav { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.pinned-arrow {
  width: 20px; height: 20px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 8px; line-height: 1;
  color: #0f766e; background: #fff; border: 1px solid #cfe0dd; border-radius: 2px;
  cursor: pointer;
}
.pinned-arrow:hover { background: #dcebea; }
.pinned-dots { display: flex; align-items: center; gap: 4px; }
.pinned-dot {
  width: 6px; height: 6px; padding: 0; border: none; border-radius: 50%;
  background: #b6cfcb; cursor: pointer;
}
.pinned-dot:hover { background: #8fbdba; }
.pinned-dot.is-active { width: 14px; border-radius: 3px; background: #0f766e; }
.pinned-count { font-size: 11px; color: #3f6360; font-variant-numeric: tabular-nums; }
.pinned-unpin {
  flex-shrink: 0; border: none; background: none; padding: 2px 4px;
  font-size: 11px; color: #6b8482; cursor: pointer;
}
.pinned-unpin:hover { color: #b91c1c; text-decoration: underline; }
.chat-msg-flash .chat-bubble { outline: 2px solid #0f766e; outline-offset: 2px; }
@media (max-width: 560px) {
  .pinned-label { display: none; }
  .pinned-unpin { display: none; }
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 20px;
  background: #f2f6f5;
  scroll-behavior: smooth;
}

.chat-row { display: flex; align-items: flex-end; gap: 10px; width: 100%; }
.chat-row-me { justify-content: flex-end; }
.chat-row-other { justify-content: flex-start; }

.chat-avatar {
  width: 34px; height: 34px; border-radius: 3px;
  background: #5c7075;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}
.chat-avatar-teacher { background: #a86412; }
.chat-avatar-me { background: #0f766e; }

.chat-bubble {
  max-width: 68%;
  padding: 9px 13px;
  border-radius: 5px;
  font-size: 14px;
  line-height: 1.5;
  position: relative;
  word-break: break-word;
}
.chat-bubble-other {
  background: var(--clr-surface);
  color: var(--clr-text);
  border: 1px solid var(--clr-border);
  border-bottom-left-radius: 2px;
}
.chat-bubble-me {
  background: var(--clr-primary);
  color: #fff;
  border-bottom-right-radius: 2px;
}
.chat-bubble-teacher.chat-bubble-other {
  border: 1px solid #d9b45a;
  border-left: 3px solid #a86412;
  background: #fbf6e9;
  color: #12262b;
}
.chat-bubble-teacher.chat-bubble-me {
  background: #115e59;
  border: 1px solid #a86412;
  color: #fff;
}

.bubble-author { font-size: 12px; font-weight: 700; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.chat-bubble-other .bubble-author { color: var(--clr-primary); }
.chat-bubble-teacher.chat-bubble-other .bubble-author { color: #b45309; }
.chat-bubble-me .bubble-author { color: rgba(255,255,255,.9); }
.bubble-content { white-space: pre-wrap; }
.bubble-meta { font-size: 11px; opacity: .72; margin-top: 5px; display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.teacher-tag { font-size: 10.5px; background: #fbf3dd; color: #7a4a17; padding: 1px 5px; border-radius: 2px; font-weight: 700; }

.announcement-badge { font-size: 10.5px; font-weight: 700; color: #7a4a17; background: #e6d3a0; padding: 2px 7px; border-radius: 2px; margin-bottom: 5px; display: inline-block; }
.work-code-badge { font-size: 12px; font-weight: 700; background: rgba(15,118,110,.10); padding: 3px 7px; border-radius: 2px; margin-bottom: 5px; display: inline-flex; align-items: center; gap: 6px; }
.chat-bubble-me .work-code-badge { background: rgba(255,255,255,.18); color: #fff; }

.pin-btn { background: none; border: none; cursor: pointer; font-size: 13px; opacity: .75; padding: 0 2px; color: inherit; }
.pin-btn:hover { opacity: 1; }

.chat-input-row { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--clr-border); background: var(--clr-surface); align-items: center; }
.chat-type-sel { width: 175px !important; flex-shrink: 0; }

/* ── Chat: replies, reactions, reads, actions menu ─────── */
.chat-container { position: relative; }

.bubble-reply {
  display: block; width: 100%; text-align: left; font: inherit; cursor: pointer;
  border: none; border-left: 3px solid #0f766e; background: rgba(15, 118, 110, .08);
  padding: 4px 8px; margin-bottom: 6px; border-radius: 2px; color: inherit; overflow: hidden;
}
.chat-bubble-me .bubble-reply { border-left-color: #9fe0d9; background: rgba(255, 255, 255, .16); }
.bubble-reply-author { display: block; font-size: 11.5px; font-weight: 700; color: #0f766e; }
.chat-bubble-me .bubble-reply-author { color: #d6f2ef; }
.bubble-reply-text { display: block; font-size: 12px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bubble-reply:hover { background: rgba(15, 118, 110, .14); }

.bubble-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.reaction-chip {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid #c3d9d6; background: #fff; color: #0b3d3a;
  font-size: 11.5px; font-weight: 600; padding: 2px 7px; border-radius: 2px; cursor: pointer;
}
.chat-bubble-me .reaction-chip { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .4); color: #fff; }
.reaction-chip:hover { border-color: #0f766e; }
.reaction-chip.is-mine { background: #0f766e; border-color: #0f766e; color: #fff; }
.reaction-count { font-variant-numeric: tabular-nums; opacity: .8; }

.bubble-reads {
  border: none; background: none; padding: 0; font: inherit; font-size: 11px;
  color: inherit; opacity: .85; cursor: pointer; text-decoration: underline dotted;
}
.bubble-reads:hover { opacity: 1; }

.msg-more {
  border: none; background: none; padding: 0 2px; font: inherit; font-size: 13px;
  line-height: 1; color: inherit; cursor: pointer; opacity: .55;
}
.msg-more:hover { opacity: 1; }

.chat-bubble-deleted { opacity: .8; }
.bubble-content-deleted { font-style: italic; opacity: .7; }

.chat-menu {
  position: absolute; z-index: 40; min-width: 190px;
  background: var(--clr-surface); border: 1px solid #c3d9d6; border-radius: 3px;
  padding: 4px; display: flex; flex-direction: column; gap: 1px; box-shadow: none;
}
.chat-menu[hidden] { display: none; }
.chat-menu-reactions {
  display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 4px 6px;
  border-bottom: 1px solid var(--clr-border); margin-bottom: 4px;
}
.chat-menu-react {
  border: 1px solid #c3d9d6; background: #fff; color: #0b3d3a;
  font-size: 11.5px; font-weight: 600; padding: 3px 7px; border-radius: 2px; cursor: pointer;
}
.chat-menu-react:hover { border-color: #0f766e; }
.chat-menu-react.is-mine { background: #0f766e; border-color: #0f766e; color: #fff; }
.chat-menu-item {
  text-align: left; border: none; background: none; font: inherit; font-size: 13px;
  color: var(--clr-text); padding: 7px 9px; border-radius: 2px; cursor: pointer;
}
.chat-menu-item:hover { background: #eef6f4; }
.chat-menu-danger { color: var(--clr-danger); }
.chat-menu-danger:hover { background: #fbe9e7; }

.chat-reply-bar {
  display: flex; align-items: center; gap: 10px; padding: 7px 14px;
  background: #eef5f4; border-top: 1px solid #cfe0dd; border-left: 3px solid #0f766e;
}
.chat-reply-bar[hidden] { display: none; }
.chat-reply-info { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; }
.chat-reply-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #0f766e; }
.chat-reply-info strong { color: #0b3d3a; }
.chat-reply-text { color: #5c7a76; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-reply-cancel {
  border: 1px solid #cfe0dd; background: #fff; color: #0f766e;
  width: 22px; height: 22px; font-size: 11px; cursor: pointer; border-radius: 2px;
}
.chat-reply-cancel:hover { background: #dcebea; }

.reads-summary { display: flex; gap: 12px; margin-bottom: 14px; }
.reads-stat { flex: 1; border: 1px solid var(--clr-border); border-radius: var(--radius-sm); padding: 10px 12px; background: #f6faf9; }
.reads-stat-val { display: block; font-size: 20px; font-weight: 700; color: var(--clr-primary); }
.reads-stat-lbl { font-size: 12px; color: var(--clr-muted); }
.reads-heading { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--clr-muted); margin: 14px 0 6px; }
.reads-list { border: 1px solid var(--clr-border); border-radius: var(--radius-sm); overflow: hidden; }
.reads-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 11px; font-size: 13px; border-bottom: 1px solid var(--clr-border); }
.reads-row:last-child { border-bottom: none; }
.reads-time { font-size: 12px; color: var(--clr-muted); font-variant-numeric: tabular-nums; }

/* ── Teacher workspace & AI Upload ────────────────────── */
.ai-upload-zone {
  background: #f6faf9;
  border: 1px dashed #9cc4bf;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 18px;
}
.ai-review-banner {
  background: #fbf3dd;
  border: 1px solid #b7791f;
  color: #7a4a17;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-weight: 600;
}
.presets-grid { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.preset-check { display: flex; align-items: center; gap: 6px; padding: 6px 11px; border: 1px solid var(--clr-border); border-radius: 2px; cursor: pointer; font-size: 12.5px; font-weight: 500; color: var(--clr-text); margin: 0; transition: border-color var(--transition), background var(--transition); }
.preset-check:hover { border-color: var(--clr-primary); background: #eef6f4; }
.preset-check input { accent-color: var(--clr-primary); }

.tasks-builder { margin-top: 18px; }
.tasks-builder h4 { font-size: 15px; margin-bottom: 10px; }
.task-builder-block { background: #f4f7f6; border: 1px solid var(--clr-border); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.task-builder-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-weight: 600; }

.teacher-work-card { padding: 16px 0; border-bottom: 1px solid var(--clr-border); }
.teacher-work-card:last-child { border-bottom: none; }
.teacher-work-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.teacher-work-header > div:first-child { display: flex; flex-direction: column; gap: 4px; }
.work-actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; }

.code-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; background: #f4f7f6; border: 1px solid var(--clr-border); border-radius: var(--radius-sm); flex-wrap: wrap; margin-bottom: 6px; }
.code-row-left { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.code-row-actions { display:flex; align-items:center; gap:6px; flex-wrap:wrap; }

/* ── Director Panel ───────────────────────────────────── */
.school-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; font-size: 14px; }
.dir-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.dir-table th, .dir-table td { padding: 9px 12px; border-bottom: 1px solid var(--clr-border); text-align: left; vertical-align: middle; }
.dir-table th { background: #f4f7f6; font-weight: 600; font-size: 12px; color: var(--clr-muted); }
.dir-table tr:hover { background: #f2f8f7; }
.create-class-form h4 { font-size: 14px; font-weight: 600; margin-bottom: 8px; color: var(--clr-muted); }
.personal-code { font-family: monospace; font-size: 13px; background: #e9f3f1; color: #115e59; padding: 3px 7px; border-radius: 2px; letter-spacing: .5px; font-weight: 700; }
.personal-code-big { font-family: monospace; font-size: 18px; background: #e9f3f1; color: #115e59; padding: 8px 14px; border-radius: 3px; letter-spacing: 1.5px; display: block; margin: 8px 0; font-weight: 700; }

/* ── Admin Panel ──────────────────────────────────────── */
.admin-stats-row { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.stat-card {
  flex: 1; min-width: 110px;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  padding: 16px; text-align: center; box-shadow: var(--shadow);
}
.stat-num { font-size: 28px; font-weight: 700; color: var(--clr-primary); }
.stat-label { font-size: 13px; color: var(--clr-muted); margin-top: 4px; }

.admin-school-card {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; border-radius: var(--radius-sm); margin-bottom: 10px; gap: 12px; font-size: 14px; flex-wrap: wrap;
}
.admin-school-card.pending { background: #fbf3dd; border: 1px solid #d9b45a; }
.admin-school-card.approved { background: #f4f7f6; border: 1px solid var(--clr-border); }
.admin-school-actions { display: flex; gap: 8px; flex-shrink: 0; }

.danger-zone .card-header h3 { color: var(--clr-danger); }

.register-school-form h4 { font-size: 16px; margin-bottom: 14px; }
.rs-class-row { display: flex; gap: 10px; margin-bottom: 8px; align-items: center; }

footer {
  text-align: center;
  padding: 16px 24px;
  font-size: 12px;
  color: var(--clr-muted);
  border-top: 1px solid var(--clr-border);
  background: var(--clr-surface);
}

.text-muted { color: var(--clr-muted); }
.text-sm    { font-size: 13px; }
.works-grid { display: flex; flex-direction: column; gap: 12px; }

@media (max-width: 720px) {
  main { padding: 12px; }
  header { padding: 0 12px; gap: 10px; }
  .form-grid, .demo-main-split, .school-info-grid { grid-template-columns: 1fr; }
  .work-session-header { flex-direction: column; align-items: stretch; }
  .chat-container { height: calc(100vh - 170px); }
  .chat-bubble { max-width: 85%; }
  .modal, .work-confirm-box { padding: 20px; }
}

/* ══════════════════════════════════════════════
   CAPTCHA MODAL
══════════════════════════════════════════════ */
#captchaEquationBox {
  user-select: none;
  letter-spacing: .04em;
}
#captchaAnswer::-webkit-inner-spin-button,
#captchaAnswer::-webkit-outer-spin-button { opacity: 1; }

/* ══════════════════════════════════════════════
   LOGIN MODAL — quick accounts list
══════════════════════════════════════════════ */
.quick-account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: 3px;
  transition: background .15s;
}
.quick-account-row:hover { background: #edf1f0; }
.quick-account-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.quick-account-info strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quick-account-info .text-muted { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ══════════════════════════════════════════════
   ENTRANCE EXAMS TAB
══════════════════════════════════════════════ */
.entrance-exams-header { margin-bottom: 20px; }
.entrance-exams-header h2 { font-size: 22px; margin-bottom: 4px; }

.entrance-work-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color .12s;
}
.entrance-work-card:hover { border-color: #9cc4bf; }
.entrance-work-card .work-card-top { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.entrance-work-card .work-title { font-size: 15px; font-weight: 700; }
.entrance-work-card .work-card-meta { font-size: 12px; }
.entrance-work-card .work-card-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 4px; border-top: 1px solid var(--clr-border); }

/* Registration choice + role-specific blocks */
.register-choice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.register-choice {
  text-align: left;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: inherit;
  color: var(--clr-text);
}
.register-choice:hover { border-color: #9cc4bf; background: #f4faf8; }
.register-choice-title { font-size: 15px; font-weight: 700; color: var(--clr-primary); }
.register-choice-desc { font-size: 12px; line-height: 1.45; color: var(--clr-muted); }
@media (max-width: 640px) { .register-choice-grid { grid-template-columns: 1fr; } }

.reg-role-block {
  margin-top: 16px;
  padding: 14px;
  background: #eef6f4;
  border: 1px solid #c3dbd7;
  border-radius: 2px;
}
.reg-block-title { font-size: 13px; font-weight: 700; color: var(--clr-primary); margin: 0 0 8px; }
.reg-hint { font-size: 12px; color: var(--clr-muted); margin-top: 4px; line-height: 1.4; }
.reg-demo-hint {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px dashed #9cc4bf;
  background: #f4faf8;
  color: #115e59;
  font-size: 12px;
}
.quick-accounts-hint { text-align: center; color: var(--clr-muted); font-size: 13px; padding: 8px; }

/* mb utility */
.mb-3 { margin-bottom: 16px; }

/* ip block banner flex */
#ipBlockBanner { display: flex; align-items: center; flex-wrap: wrap; }


/* AI model catalog */
.ai-status-line { margin-top:14px; padding:9px 12px; background:#eef6f4; border:1px solid var(--clr-border); border-radius:var(--radius); font-size:13px; color:var(--clr-text); }
.ai-status-low { background:#fdf3e4; border-color:#e5c9a1; color:#7a4a10; }
.ai-catalog { margin-top:18px; padding-top:14px; border-top:1px solid var(--clr-border); }
.ai-catalog-head { display:flex; justify-content:space-between; align-items:center; gap:10px; margin-bottom:10px; flex-wrap:wrap; }
.ai-model-table { max-height:380px; overflow:auto; }
.ai-model-table .dir-table th { position:sticky; top:0; z-index:1; }
.ai-model-id { font-family:monospace; font-size:11px; color:var(--clr-muted); word-break:break-all; margin-top:2px; }
.ai-model-price { white-space:nowrap; font-variant-numeric:tabular-nums; }
.ai-model-actions { white-space:nowrap; text-align:right; }
.ai-model-actions .btn { margin-left:4px; }
@media (max-width:720px){ .ai-model-table { max-height:none; } }

/* ── AI Markdown ─────────────────────────────────────── */
.ai-md-body { font-size:14px; color:var(--clr-text); line-height:1.55; }
.ai-md-body p { margin:4px 0; }
.ai-md-body .ai-heading { font-weight:600; color:#0b3b3c; margin:8px 0 4px; }
.ai-md-body .ai-list { margin:4px 0 4px 20px; padding:0; }
.ai-md-body .ai-list li { margin:2px 0; }
.ai-md-body code { background:#eef2f1; border:1px solid #d7e2e0; padding:1px 4px; font-size:12.5px; }
.ai-md-body pre.ai-code { background:#0b3b3c; color:#e8f4f2; padding:9px 11px; overflow-x:auto; margin:6px 0; border-radius:2px; }
.ai-md-body pre.ai-code code { background:none; border:none; color:inherit; padding:0; }

/* ── Unanswered tasks: highlight, list, FAB ──────────── */
.task-block.task-unanswered {
  border-color:#d9b45a;
  background:#fffdf5;
  box-shadow:inset 3px 0 0 #d9b45a;
}
.unanswered-fab {
  position:fixed; right:24px; bottom:24px; z-index:1500;
  background:#a86412; color:#fff; border:none; border-radius:2px;
  padding:10px 14px; font-size:13px; cursor:pointer; font-family:inherit;
}
.unanswered-fab:hover { background:#8a510e; }
.unanswered-fab strong { font-weight:700; }
.unanswered-panel {
  position:fixed; right:24px; bottom:66px; z-index:1500;
  width:250px; max-width:80vw; background:#fff; border:1px solid #d7e2e0;
  border-left:3px solid #a86412; padding:10px 12px; border-radius:2px;
}
.unanswered-panel-head { font-size:12px; font-weight:600; color:#5c7075; margin-bottom:7px; text-transform:uppercase; letter-spacing:.04em; }
.unanswered-chips { display:flex; flex-wrap:wrap; gap:5px; max-height:200px; overflow:auto; }
.unanswered-chip {
  border:1px solid #d9b45a; background:#fbf3dd; color:#7a4a17;
  padding:3px 8px; font-size:12px; cursor:pointer; border-radius:2px; font-family:inherit;
}
.unanswered-chip:hover { background:#f5e6be; }

/* ── Demo attempt history ────────────────────────────── */
.attempt-history { border:1px solid #d7e2e0; background:#f7fbfa; padding:10px 12px; margin:0 0 14px; border-radius:2px; }
.attempt-history-head { display:flex; justify-content:space-between; align-items:center; gap:10px; margin-bottom:8px; flex-wrap:wrap; }
.attempt-history-list { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:6px; }
.attempt-history-list.is-collapsed { display:none; }
.attempt-chip {
  display:flex; flex-direction:column; align-items:flex-start; gap:1px;
  border:1px solid #d7e2e0; background:#fff; padding:5px 9px; cursor:pointer;
  border-radius:2px; font-family:inherit; font-size:12px; color:var(--clr-text); text-align:left;
}
.attempt-chip:hover { border-color:#0f766e; }
.attempt-chip.is-current { border-color:#0f766e; background:#e9f5f2; }
.attempt-chip-date { color:#5c7075; font-size:11px; }
.attempt-chip-score { font-variant-numeric:tabular-nums; }
.attempt-chip-grade { font-weight:700; color:#0f766e; }
.attempt-chip-current { font-size:10px; color:#0f766e; text-transform:uppercase; letter-spacing:.05em; }

/* ── Diary demo tracking (external grade) ────────────── */
.demo-track { margin-top:18px; border:1px solid #e2e8e7; background:#fafcfb; padding:12px 14px; border-radius:2px; }
.demo-track-head { display:flex; gap:10px; align-items:baseline; flex-wrap:wrap; margin-bottom:10px; }
.demo-track-head strong { font-size:13px; color:#5c7075; text-transform:uppercase; letter-spacing:.05em; }
.demo-track-group { display:flex; justify-content:space-between; align-items:center; gap:10px; padding:6px 0; border-top:1px dashed #e2e8e7; flex-wrap:wrap; }
.demo-track-group:first-of-type { border-top:none; }
.demo-track-meta { display:flex; flex-direction:column; gap:1px; min-width:180px; }
.demo-track-student { font-size:12px; font-weight:600; color:#26383d; }
.demo-track-title { font-size:13px; color:#26383d; }
.demo-track-sub { font-size:11px; color:#869499; }
.demo-track-marks { display:flex; align-items:center; gap:5px; flex-wrap:wrap; }
.demo-mark {
  display:inline-flex; flex-direction:column; align-items:center; gap:0;
  min-width:34px; padding:2px 6px; font-size:13px; font-weight:600;
  border:1px solid #cfd8d6; background:#eef1f0; color:#5c7075;
  border-radius:2px; cursor:pointer; font-family:inherit; line-height:1.2;
  opacity:.9;
}
.demo-mark:hover { opacity:1; border-color:#869499; }
.demo-mark-date { font-size:9px; font-weight:400; color:#869499; }
.demo-mark-green  { background:#e6f3ec; border-color:#a9d8c3; color:#166534; }
.demo-mark-blue   { background:#e5f1f3; border-color:#a9c9cf; color:#0d5560; }
.demo-mark-yellow { background:#fbf3dd; border-color:#d9b45a; color:#7a4a17; }
.demo-mark-red    { background:#f8e7e5; border-color:#d9a79f; color:#8f2c22; }
.demo-mark-gray   { background:#eef1f0; border-color:#cfd8d6; color:#5c7075; }
.demo-mark.is-extra { display:none; }
.demo-track-marks.is-expanded .demo-mark.is-extra { display:inline-flex; }
.demo-more {
  border:1px dashed #b9c6c3; background:transparent; color:#5c7075;
  padding:3px 7px; font-size:11px; cursor:pointer; border-radius:2px; font-family:inherit;
}
.demo-more:hover { border-color:#869499; color:#26383d; }
.demo-track-arrow { font-size:11px; color:#869499; font-variant-numeric:tabular-nums; margin-left:2px; }
