/* ==========================================================================
   Кабинет репетитора — оформление
   ========================================================================== */

:root {
  --bg: #eef1f6;
  --panel: #ffffff;
  --panel-2: #f7f9fc;
  --ink: #131a2a;
  --ink-2: #46536b;
  --ink-3: #7b879c;
  --line: #dde3ec;
  --line-2: #eaeff6;
  --accent: #1f5fbf;
  --accent-ink: #12386f;
  --accent-soft: #e8f0fd;
  --ok: #12855b;
  --ok-soft: #e4f6ee;
  --warn: #a8600a;
  --warn-soft: #fdf2e0;
  --danger: #bf2f42;
  --danger-soft: #fdeaed;
  --info: #5b46b8;
  --info-soft: #efeafd;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(19, 26, 42, .06), 0 8px 24px -12px rgba(19, 26, 42, .18);
  --shadow-sm: 0 1px 2px rgba(19, 26, 42, .07);
  --sidebar-w: 252px;
  --font: "Segoe UI", "Inter", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; font-weight: 650; }
h1 { font-size: 1.5rem; letter-spacing: -.01em; }
h2 { font-size: 1.12rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .7rem; }
p:last-child { margin-bottom: 0; }
code { font-family: Consolas, "SF Mono", Menlo, monospace; font-size: .86em;
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 5px;
  padding: .1em .35em; word-break: break-all; }
ul.tight { margin: .25rem 0 0; padding-left: 1.1rem; }
.muted { color: var(--ink-2); }
.small { font-size: .85rem; }
.tiny { font-size: .78rem; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.right { text-align: right; }
.mono { font-family: Consolas, monospace; font-size: .85rem; }

/* ------------------------------- каркас --------------------------------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: #101827; color: #cfd8e8;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  padding: 16px 12px;
  background-image: radial-gradient(120% 60% at 0% 0%, rgba(63, 116, 205, .34) 0%, rgba(16, 24, 39, 0) 62%);
}

.brand { display: flex; gap: 10px; align-items: center; padding: 6px 8px 16px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 38px; height: 38px; flex: 0 0 38px; border-radius: 11px;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(140deg, #3b7ddd, #1d4ea3);
  box-shadow: 0 6px 16px -8px rgba(59, 125, 221, .9);
}
.brand-mark.big { width: 50px; height: 50px; flex-basis: 50px; border-radius: 14px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-size: 1.02rem; letter-spacing: .01em; }
.brand-text i { font-style: normal; font-size: .72rem; color: #93a3bd; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  color: #c3cfe2; font-size: .925rem; font-weight: 500;
}
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.nav-item.is-active { background: rgba(255, 255, 255, .13); color: #fff; box-shadow: inset 2px 0 0 #6ea8fe; }
.nav-item span { flex: 1; }
.nav-count {
  background: #3b7ddd; color: #fff; font-size: .72rem; font-weight: 700;
  border-radius: 999px; padding: 1px 7px; min-width: 20px; text-align: center;
}

.sidebar-foot { border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 12px; margin-top: 8px; }
.side-stat { display: flex; justify-content: space-between; align-items: center;
  font-size: .8rem; color: #93a3bd; padding: 0 10px 10px; }
.side-stat b { color: #fff; font-size: .95rem; }
.user-box { display: flex; align-items: center; gap: 6px; }
.user-link { display: flex; align-items: center; gap: 8px; padding: 7px 10px;
  border-radius: var(--radius-sm); color: #c3cfe2; font-size: .875rem; flex: 1; min-width: 0; }
.user-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-link:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 20px 28px 14px; background: var(--panel);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.titles { flex: 1; min-width: 0; }
.titles h1 { margin: 0; }
.subtitle { margin: .25rem 0 0; color: var(--ink-2); font-size: .9rem; }
.topbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.menu-btn { display: none !important; }

.crumbs { font-size: .8rem; color: var(--ink-3); margin-bottom: 3px; }
.crumbs a { color: var(--ink-3); }
.crumbs a:hover { color: var(--accent); }
.crumbs i { font-style: normal; padding: 0 5px; opacity: .55; }

.content { padding: 22px 28px 60px; max-width: 1180px; width: 100%; }
.content.is-wide { max-width: none; }

/* ------------------------------- сетки ---------------------------------- */

.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.gap { gap: 14px; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { gap: 7px; }

/* ------------------------------- карточки ------------------------------- */

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.card > h2 { display: flex; align-items: center; gap: 8px; }
.card-head { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.tinted { background: var(--panel-2); }

.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow-sm);
}
.stat b { display: block; font-size: 1.6rem; line-height: 1.1; letter-spacing: -.02em; }
.stat span { color: var(--ink-2); font-size: .82rem; }
.stat.accent b { color: var(--accent); }
.stat.ok b { color: var(--ok); }
.stat.danger b { color: var(--danger); }
.stat.warn b { color: var(--warn); }

/* ------------------------------- кнопки --------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); font: inherit; font-size: .9rem;
  font-weight: 550; cursor: pointer; white-space: nowrap;
  transition: background .13s, border-color .13s, transform .06s;
}
.btn:hover { background: var(--panel-2); border-color: #c9d3e2; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--panel-2); color: var(--ink); }
.btn-danger { color: var(--danger); border-color: #f0c7ce; background: #fff; }
.btn-danger:hover { background: var(--danger-soft); border-color: #e2a5b0; }
.btn-ok { color: #fff; background: var(--ok); border-color: var(--ok); }
.btn-ok:hover { background: #0d6b49; border-color: #0d6b49; }
.btn-sm { padding: 5px 10px; font-size: .83rem; border-radius: 8px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }

.btn-group { display: inline-flex; border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; background: var(--panel); }
.btn-group a { padding: 6px 12px; font-size: .85rem; color: var(--ink-2); border-right: 1px solid var(--line-2); }
.btn-group a:last-child { border-right: 0; }
.btn-group a:hover { background: var(--panel-2); text-decoration: none; }
.btn-group a.is-active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }

form.inline { display: inline; }
form.inline button { vertical-align: middle; }

/* ------------------------------- формы ---------------------------------- */

.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: .84rem; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: .78rem; color: var(--ink-3); font-style: normal; }

input[type=text], input[type=password], input[type=number], input[type=date],
input[type=time], input[type=search], input[type=email], select, textarea {
  font: inherit; font-size: .92rem; color: var(--ink);
  padding: 8px 11px; border: 1px solid #ccd5e3; border-radius: 10px;
  background: #fff; width: 100%; max-width: 100%;
  transition: border-color .13s, box-shadow .13s;
}
textarea { min-height: 90px; resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 95, 191, .14);
}
select { cursor: pointer; }
label.inline { display: inline-flex; align-items: center; gap: 7px; font-size: .9rem; cursor: pointer; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--accent); cursor: pointer; }
input[type=file] { padding: 7px; background: var(--panel-2); }

.form-grid { display: grid; gap: 13px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 4px; flex-wrap: wrap; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; margin: 0; }
legend { font-size: .84rem; font-weight: 650; color: var(--ink-2); padding: 0 6px; }

/* ------------------------------- фильтры -------------------------------- */

.filters {
  display: flex; gap: 9px; align-items: center; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 11px 13px; margin-bottom: 16px; box-shadow: var(--shadow-sm);
}
.filters .field { flex-direction: row; align-items: center; gap: 7px; }
.filters .field > span { white-space: nowrap; }
.filters input, .filters select { width: auto; min-width: 130px; padding: 6px 10px; font-size: .87rem; }
.search-form { display: flex; gap: 6px; flex: 1; min-width: 200px; }
.search-form input { flex: 1; }

/* ------------------------------- таблицы -------------------------------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-3); font-weight: 650; background: var(--panel-2); white-space: nowrap; }
tbody tr:hover { background: #fafcff; }
tbody tr:last-child td { border-bottom: 0; }
td.tight, th.tight { width: 1%; white-space: nowrap; }
td.actions { white-space: nowrap; text-align: right; }
td.actions .btn { padding: 4px 8px; font-size: .8rem; }

/* ------------------------------- плашки --------------------------------- */

.pill { display: inline-block; font-size: .76rem; font-weight: 650;
  padding: 2px 9px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; }
.pill-not_started { background: #f1f4f9; color: var(--ink-3); border-color: #e2e8f1; }
.pill-in_progress { background: var(--warn-soft); color: var(--warn); border-color: #f2dfc0; }
.pill-done { background: var(--accent-soft); color: var(--accent-ink); border-color: #cfe0fa; }
.pill-mastered { background: var(--ok-soft); color: var(--ok); border-color: #c6ebda; }
.pill-needs_review { background: var(--danger-soft); color: var(--danger); border-color: #f4ccd3; }
.pill-planned { background: var(--accent-soft); color: var(--accent-ink); }
.pill-done-event { background: var(--ok-soft); color: var(--ok); }
.pill-cancelled { background: #f1f4f9; color: var(--ink-3); }

.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 8px;
  border-radius: 6px; background: var(--panel-2); color: var(--ink-2); border: 1px solid var(--line-2); }
.badge-muted { background: #f1f4f9; color: var(--ink-3); }
.badge-info { background: var(--info-soft); color: var(--info); border-color: #ddd4fb; }
.badge-ok { background: var(--ok-soft); color: var(--ok); border-color: #c6ebda; }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: #f2dfc0; }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: #f4ccd3; }
.badge-accent { background: var(--accent-soft); color: var(--accent-ink); border-color: #cfe0fa; }

.pills { display: flex; gap: 5px; flex-wrap: wrap; }

/* ------------------------------- прогресс ------------------------------- */

.progress { height: 7px; border-radius: 999px; background: #e7ecf4; overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #3b7ddd, #1d4ea3); transition: width .25s; }
.progress.ok span { background: linear-gradient(90deg, #1aa06d, #0d6b49); }
.progress.warn span { background: linear-gradient(90deg, #e0a340, #a8600a); }
.progress-label { font-size: .78rem; color: var(--ink-3); margin-top: 4px; }

/* ------------------------------- чипы ----------------------------------- */

.chip { display: inline-flex; align-items: center; gap: 8px; font-weight: 550; color: var(--ink); }
.chip:hover { text-decoration: none; color: var(--accent); }
.avatar {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 9px; color: #fff;
  display: grid; place-items: center; font-size: .78rem; font-weight: 700; letter-spacing: .02em;
}
.avatar.lg { width: 54px; height: 54px; flex-basis: 54px; border-radius: 15px; font-size: 1.15rem; }
.avatar.sm { width: 24px; height: 24px; flex-basis: 24px; border-radius: 7px; font-size: .68rem; }

/* ------------------------------- пустые --------------------------------- */

.empty { text-align: center; padding: 34px 18px; color: var(--ink-2); }
.empty-icon { color: #b7c3d6; margin-bottom: 8px; display: flex; justify-content: center; }
.empty h2 { margin-bottom: .35rem; }
.empty p { max-width: 46ch; margin: 0 auto .6rem; }
.empty-action { margin-top: 12px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* ------------------------------- всплески ------------------------------- */

.flash {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px;
  border-radius: var(--radius-sm); margin-bottom: 16px; font-size: .9rem;
  border: 1px solid transparent;
}
.flash span, .flash ul { flex: 1; }
.flash ul { margin: 0; }
.flash-ok { background: var(--ok-soft); color: #0b5c40; border-color: #bfe8d5; }
.flash-error { background: var(--danger-soft); color: #8f2131; border-color: #f3c6ce; }
.flash-x { border: 0; background: transparent; font-size: 1.2rem; line-height: 1;
  cursor: pointer; color: inherit; opacity: .55; padding: 0 2px; }
.flash-x:hover { opacity: 1; }

/* ------------------------------- структура тем -------------------------- */

.tree { display: flex; flex-direction: column; gap: 8px; }
.tree-group { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel);
  overflow: hidden; box-shadow: var(--shadow-sm); }
.tree-group > summary, .tree-group > .tree-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  background: var(--panel-2); cursor: pointer; font-weight: 620; font-size: .93rem;
  border-bottom: 1px solid var(--line-2); list-style: none;
}
.tree-group > summary::-webkit-details-marker { display: none; }
.tree-group > summary::before {
  content: "▸"; color: var(--ink-3); font-size: .8rem; transition: transform .15s; display: inline-block;
}
.tree-group[open] > summary::before { transform: rotate(90deg); }
.tree-group > .tree-head { cursor: default; }
.tree-group .count { color: var(--ink-3); font-weight: 500; font-size: .82rem; }
.topic-list { display: flex; flex-direction: column; }
.topic-row {
  display: flex; gap: 11px; padding: 11px 14px; border-bottom: 1px solid var(--line-2);
  align-items: flex-start;
}
.topic-row:last-child { border-bottom: 0; }
.topic-row:hover { background: #fafcff; }
.topic-row.is-done { background: #f7fdfa; }
.topic-row.is-progress { background: #fffcf6; }
.topic-row.is-review { background: #fffafb; }
.topic-check { padding-top: 2px; }
.topic-body { flex: 1; min-width: 0; }
.topic-title { font-weight: 570; font-size: .93rem; }
.topic-title a { color: inherit; }
.topic-title a:hover { color: var(--accent); }
.topic-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  margin-top: 5px; font-size: .78rem; color: var(--ink-3); }
.topic-desc { font-size: .83rem; color: var(--ink-2); margin-top: 4px; }
.topic-side { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.subtopics { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.subtopic { font-size: .76rem; background: var(--panel-2); border: 1px solid var(--line-2);
  color: var(--ink-2); border-radius: 6px; padding: 1px 7px; }

/* ------------------------------- вкладки --------------------------------- */

.tabs { display: flex; gap: 3px; border-bottom: 2px solid var(--line); margin-bottom: 18px;
  overflow-x: auto; }
.tabs a { padding: 9px 14px; font-size: .9rem; font-weight: 550; color: var(--ink-2);
  border-bottom: 2px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.is-active { color: var(--accent); border-bottom-color: var(--accent); }

/* ------------------------------- заметки -------------------------------- */

.note { border: 1px solid var(--line); border-left: 3px solid var(--ink-3);
  border-radius: var(--radius-sm); padding: 11px 13px; background: var(--panel); margin-bottom: 10px; }
.note-problem { border-left-color: var(--danger); background: #fffbfc; }
.note-progress { border-left-color: var(--ok); background: #fbfefc; }
.note-plan { border-left-color: var(--accent); background: #fbfdff; }
.note-parent { border-left-color: var(--info); background: #fcfbff; }
.note-head { display: flex; gap: 9px; align-items: center; margin-bottom: 5px; flex-wrap: wrap;
  font-size: .8rem; color: var(--ink-3); }
.note-body { font-size: .91rem; }
.note.pinned { box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow-sm); }

/* ------------------------------- материалы ------------------------------ */

.material-list { display: flex; flex-direction: column; gap: 9px; }
.material {
  display: flex; gap: 12px; align-items: flex-start; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel);
}
.material:hover { border-color: #c9d3e2; }
.mat-icon { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 10px;
  display: grid; place-items: center; background: var(--panel-2); color: var(--ink-2);
  border: 1px solid var(--line-2); }
.mat-icon.k-presentation { background: var(--warn-soft); color: var(--warn); border-color: #f2dfc0; }
.mat-icon.k-link { background: var(--accent-soft); color: var(--accent); border-color: #cfe0fa; }
.mat-icon.k-video { background: var(--info-soft); color: var(--info); border-color: #ddd4fb; }
.mat-icon.k-file { background: #eef2f8; color: var(--ink-2); }
.mat-icon.k-task { background: var(--ok-soft); color: var(--ok); border-color: #c6ebda; }
.mat-icon.k-solution { background: #f1f4f9; color: var(--ink-2); }
.mat-body { flex: 1; min-width: 0; }
.mat-title { font-weight: 570; font-size: .93rem; word-break: break-word; }
.mat-meta { font-size: .78rem; color: var(--ink-3); display: flex; gap: 9px; flex-wrap: wrap; margin-top: 3px; }
.mat-desc { font-size: .85rem; color: var(--ink-2); margin-top: 5px; }

/* ------------------------------- таймлайн ------------------------------- */

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px;
  width: 2px; background: var(--line); }
.tl-item { position: relative; margin-bottom: 14px; }
.tl-item::before { content: ""; position: absolute; left: -20px; top: 7px;
  width: 9px; height: 9px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 3px var(--panel); }
.tl-item.hw::before { background: var(--warn); }
.tl-item.note::before { background: var(--info); }
.tl-date { font-size: .78rem; color: var(--ink-3); }

/* ------------------------------- прочее --------------------------------- */

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .89rem; }
.kv dt { color: var(--ink-3); font-size: .82rem; }
.kv dd { margin: 0; }

.hr { height: 1px; background: var(--line); margin: 16px 0; border: 0; }

.callout { border-radius: var(--radius-sm); padding: 12px 14px; font-size: .88rem;
  background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--accent); }
.callout.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.callout.danger { border-left-color: var(--danger); background: var(--danger-soft); }
.callout.ok { border-left-color: var(--ok); background: var(--ok-soft); }

.details-block > summary { cursor: pointer; font-weight: 600; font-size: .9rem;
  color: var(--ink-2); padding: 4px 0; }
.details-block[open] > summary { margin-bottom: 10px; }

/* ------------------------------- авторизация ---------------------------- */

.auth-body { background: #101827;
  background-image: radial-gradient(90% 55% at 15% 0%, rgba(63, 116, 205, .38), transparent 65%),
    radial-gradient(70% 50% at 100% 100%, rgba(91, 70, 184, .3), transparent 60%);
  min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.auth-wrap { width: 100%; max-width: 430px; }
.auth-brand { display: flex; gap: 13px; align-items: center; color: #fff; margin-bottom: 20px; }
.auth-brand b { display: block; font-size: 1.12rem; }
.auth-brand i { font-style: normal; font-size: .82rem; color: #93a3bd; }
.auth-card { margin: 0; }
.auth-card h1 { font-size: 1.28rem; }

/* ------------------------------- адаптив -------------------------------- */

.sidebar-backdrop { display: none; }

@media (max-width: 1000px) {
  .sidebar {
    position: fixed; z-index: 60; left: 0; top: 0; height: 100vh;
    transform: translateX(-102%); transition: transform .22s ease;
    box-shadow: 0 0 40px rgba(0, 0, 0, .4);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .sidebar-backdrop {
    display: block; position: fixed; inset: 0; background: rgba(9, 14, 24, .5); z-index: 50;
  }
  .menu-btn { display: inline-flex !important; }
  .content { padding: 18px 16px 50px; }
  .topbar { padding: 14px 16px 12px; flex-wrap: wrap; }
  .topbar-actions { width: 100%; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dt { margin-top: 6px; }
}

/* ------------------------------- печать --------------------------------- */

@media print {
  .sidebar, .topbar-actions, .menu-btn, .no-print { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .topbar { position: static; border: 0; padding: 0 0 10px; }
}

/* ==========================================================================
   Переключение темы (кнопка в правом верхнем углу)
   Светлая тема выше не изменена. Тёмная включается атрибутом
   data-theme="dark" на <html> и переопределяет только цвета.
   ========================================================================== */

.theme-btn { padding: 7px; border-radius: 10px; color: var(--ink-2); }
.theme-btn .ic { display: block; }
.theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark { display: block; }

/* кнопка на странице входа: там нет верхней панели */
.theme-btn-floating {
  position: fixed; top: 14px; right: 16px; z-index: 60;
  color: #cfd8e8; border-color: rgba(255, 255, 255, .18);
}
.theme-btn-floating:hover {
  background: rgba(255, 255, 255, .1); color: #fff;
  border-color: rgba(255, 255, 255, .32);
}

/* ---- палитра тёмной темы ---- */
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1319;
  --panel: #161c25;
  --panel-2: #1b222c;
  --ink: #e7edf6;
  --ink-2: #aab6c8;
  --ink-3: #7f8a9c;
  --line: #2a323e;
  --line-2: #232b36;
  --accent: #4d8ef7;
  --accent-ink: #bcd6ff;
  --accent-soft: #1b2a42;
  --ok: #4fd39a;
  --ok-soft: #14291f;
  --warn: #e5a94e;
  --warn-soft: #2d2418;
  --danger: #ff8593;
  --danger-soft: #2f1b20;
  --info: #b0a0ff;
  --info-soft: #241f36;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 10px 26px -14px rgba(0, 0, 0, .8);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
}

/* ---- плавная смена ---- */
body, .card, .stat, .topbar, .filters, .sidebar, .pill, .badge {
  transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}

/* ---- поля ввода ---- */
[data-theme="dark"] input[type=text], [data-theme="dark"] input[type=password],
[data-theme="dark"] input[type=number], [data-theme="dark"] input[type=date],
[data-theme="dark"] input[type=time], [data-theme="dark"] input[type=search],
[data-theme="dark"] input[type=email], [data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: var(--panel-2); border-color: var(--line);
}
[data-theme="dark"] input:focus, [data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
  box-shadow: 0 0 0 3px rgba(77, 142, 247, .22);
}

/* ---- кнопки ---- */
[data-theme="dark"] .btn:hover { border-color: #3a4553; }
[data-theme="dark"] .btn-primary { color: #08131f; }
[data-theme="dark"] .btn-primary:hover { background: #6ba0f9; border-color: #6ba0f9; }
[data-theme="dark"] .btn-ok { color: #06180f; }
[data-theme="dark"] .btn-ok:hover { background: #63dfa8; border-color: #63dfa8; }
[data-theme="dark"] .btn-danger { background: var(--panel); border-color: #5b2f38; }
[data-theme="dark"] .btn-danger:hover { background: var(--danger-soft); border-color: #7a3d48; }

/* ---- таблицы ---- */
[data-theme="dark"] tbody tr:hover { background: #1a2130; }

/* ---- плашки и бейджи ---- */
[data-theme="dark"] .pill-not_started, [data-theme="dark"] .pill-cancelled,
[data-theme="dark"] .badge-muted {
  background: #232b36; color: var(--ink-2); border-color: #303a47;
}
[data-theme="dark"] .pill-in_progress, [data-theme="dark"] .badge-warn { border-color: #4a3a1d; }
[data-theme="dark"] .pill-done, [data-theme="dark"] .pill-planned,
[data-theme="dark"] .badge-accent { border-color: #2c466e; }
[data-theme="dark"] .pill-mastered, [data-theme="dark"] .pill-done-event,
[data-theme="dark"] .badge-ok { border-color: #245040; }
[data-theme="dark"] .pill-needs_review, [data-theme="dark"] .badge-danger { border-color: #573039; }
[data-theme="dark"] .badge-info { border-color: #3d3462; }

/* ---- прогресс ---- */
[data-theme="dark"] .progress { background: #262f3b; }

/* ---- строки тем ---- */
[data-theme="dark"] .topic-row:hover { background: #1a2130; }
[data-theme="dark"] .topic-row.is-done { background: #16241d; }
[data-theme="dark"] .topic-row.is-progress { background: #241f16; }
[data-theme="dark"] .topic-row.is-review { background: #241a1d; }

/* ---- заметки ---- */
[data-theme="dark"] .note-problem { background: #201619; }
[data-theme="dark"] .note-progress { background: #14201a; }
[data-theme="dark"] .note-plan { background: #161d28; }
[data-theme="dark"] .note-parent { background: #1b1826; }

/* ---- материалы и пустые состояния ---- */
[data-theme="dark"] .mat-icon.k-file,
[data-theme="dark"] .mat-icon.k-solution { background: #232b36; }
[data-theme="dark"] .material:hover { border-color: #3a4553; }
[data-theme="dark"] .empty-icon { color: #4d5766; }

/* ---- сообщения ---- */
[data-theme="dark"] .flash-ok { color: var(--ok); border-color: #245040; }
[data-theme="dark"] .flash-error { color: var(--danger); border-color: #573039; }

/* ---- разделы и темы в программе ученика ---- */
.tree-section {
  font-size: .78rem; font-weight: 650; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: .04em;
  padding: 11px 14px 5px; border-top: 1px solid var(--line-2);
}
.tree-section:first-child { border-top: 0; padding-top: 6px; }
.topic-line {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 7px 14px; border-bottom: 1px solid var(--line-2);
}
.topic-line:last-child { border-bottom: 0; }
.topic-line .topic-name { flex: 1; }
.next-lesson .next-title { font-size: 1.1rem; font-weight: 650; margin: 4px 0 2px; }
.hw-row { display: flex; gap: 14px; justify-content: space-between; align-items: flex-start;
  padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.hw-row:last-child { border-bottom: 0; }
.hw-main { flex: 1; }
.hw-main p { margin: 2px 0; }
.hw-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
