/*
  Тема админки по референсу заказчика (iSpring, 12.09.2026).

  Работает в два слоя. Первый — переменные самой админки Django: перекрасив их,
  получаем правильные цвета в таблицах, формах и фильтрах, ничего там не трогая
  руками. Второй — структурная часть: левый рельс, шапка, карточки.

  Тема светлая намеренно. Django умеет тёмную по настройке системы, но референс
  светлый, и половина экранов методиста — печатные бланки аттестаций.
*/

:root,
html[data-theme="light"],
html[data-theme="dark"] {
  color-scheme: light;

  --lms-accent: #f47b20;
  --lms-accent-dark: #d96711;
  --lms-accent-soft: #fdf0e6;
  --lms-ink: #23262b;
  --lms-muted: #7b8089;
  --lms-line: #e6e8ec;
  --lms-bg: #f4f5f7;

  /* --- переменные Django --- */
  --primary: var(--lms-accent);
  --secondary: var(--lms-accent);
  --accent: var(--lms-accent);
  --primary-fg: #fff;

  --body-fg: var(--lms-ink);
  --body-bg: #fff;
  --body-quiet-color: var(--lms-muted);
  --body-loud-color: #000;

  --header-color: var(--lms-ink);
  --header-branding-color: var(--lms-ink);
  --header-bg: #fff;
  --header-link-color: var(--lms-ink);

  --breadcrumbs-fg: var(--lms-muted);
  --breadcrumbs-link-fg: var(--lms-muted);
  --breadcrumbs-bg: transparent;

  --link-fg: #1f6fb2;
  --link-hover-color: #14507f;
  --link-selected-fg: var(--lms-accent);

  --hairline-color: var(--lms-line);
  --border-color: var(--lms-line);

  --button-bg: var(--lms-accent);
  --button-fg: #fff;
  --button-hover-bg: var(--lms-accent-dark);
  --default-button-bg: var(--lms-accent);
  --default-button-hover-bg: var(--lms-accent-dark);
  --close-button-bg: #8a8f98;
  --close-button-hover-bg: #6f747c;
  --delete-button-bg: #d64545;
  --delete-button-hover-bg: #b83636;

  --object-tools-bg: var(--lms-accent);
  --object-tools-hover-bg: var(--lms-accent-dark);

  --selected-bg: #f6f7f9;
  --selected-row: var(--lms-accent-soft);

  /* Comfortaa — шрифт сети (правки 14.09.2026, п. 14). Подключение — в fonts.css.
     Системный шрифт остаётся запасным: пока файл не загрузился, текст читается им. */
  --font-family-primary: Comfortaa, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

body {
  background: var(--lms-bg);
  font-family: var(--font-family-primary);
  font-size: 14px;
  color: var(--lms-ink);
}

/* --- шапка --- */

#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 56px;
  padding: 0 20px;
  background: #fff;
  border-bottom: 1px solid var(--lms-line);
  color: var(--lms-ink);
}

#branding { padding: 0; }
#branding h1 { display: none; }

.brand__mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--lms-ink);
}

.brand__logo {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--lms-accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand__name { font-size: 16px; font-weight: 600; }

#user-tools {
  font-size: 13px;
  color: var(--lms-muted);
  text-transform: none;
  letter-spacing: 0;
  padding: 0;
}

#user-tools a {
  color: var(--lms-muted);
  border-bottom: 0;
  text-decoration: none;
}

#user-tools a:hover { color: var(--lms-accent); }

/* --- левый рельс --- */

.rail {
  flex: 0 0 84px;
  align-self: stretch;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 12px 8px;
  background: #fff;
  border-right: 1px solid var(--lms-line);
  overflow-y: auto;
}

.rail__list { list-style: none; margin: 0; padding: 0; }

.rail__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 4px;
  margin-bottom: 2px;
  border-radius: 10px;
  color: var(--lms-muted);
  text-decoration: none;
  text-align: center;
}

.rail__item:hover { background: #f4f5f7; color: var(--lms-ink); }

.rail__item--on {
  background: var(--lms-accent-soft);
  color: var(--lms-accent-dark);
}

.rail__icon svg { width: 22px; height: 22px; display: block; }

.rail__label { font-size: 11px; line-height: 1.2; }

/* --- содержимое --- */

.main > .content { padding: 0; min-width: 0; }

#content {
  padding: 20px 24px 40px;
  max-width: 1400px;
}

.breadcrumbs {
  padding: 14px 24px 0;
  background: transparent;
  border: 0;
  font-size: 12px;
  color: var(--lms-muted);
}

.breadcrumbs a { color: var(--lms-muted); }
.breadcrumbs a:hover { color: var(--lms-accent); }

#content h1 { font-size: 22px; font-weight: 600; margin: 6px 0 18px; }

/* Каждый блок админки — белая карточка. */
.module,
.inline-group,
#changelist,
.dashboard .module {
  background: #fff;
  border: 1px solid var(--lms-line);
  border-radius: 12px;
  overflow: hidden;
}

.module + .module, .inline-group + .inline-group { margin-top: 16px; }

.module h2,
.module caption,
.inline-group h2 {
  background: #fff;
  color: var(--lms-ink);
  border-bottom: 1px solid var(--lms-line);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  padding: 13px 16px;
}

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

#changelist table { border: 0; }

#changelist thead th,
.results thead th {
  background: #fafbfc;
  border-bottom: 1px solid var(--lms-line);
  color: var(--lms-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: none;
  padding: 11px 12px;
}

#changelist thead th a { color: var(--lms-muted); }

#result_list tbody td,
#result_list tbody th,
.results tbody td,
.results tbody th {
  border-bottom: 1px solid #f1f2f5;
  padding: 12px;
  vertical-align: middle;
}

#result_list tbody tr:hover > * { background: #fafbfc; }

#changelist-search {
  padding: 14px 16px;
  border-bottom: 1px solid var(--lms-line);
}

#changelist-search input[type="text"] {
  min-width: 280px;
  padding: 8px 12px;
  border: 1px solid var(--lms-line);
  border-radius: 9px;
}

#changelist .actions {
  background: #fafbfc;
  border-bottom: 1px solid var(--lms-line);
  padding: 10px 16px;
}

#changelist-filter {
  background: #fff;
  border-left: 1px solid var(--lms-line);
}

#changelist-filter h2 {
  background: #fff;
  color: var(--lms-muted);
  font-size: 12px;
}

.paginator {
  border-top: 1px solid var(--lms-line);
  padding: 12px 16px;
  background: #fff;
  color: var(--lms-muted);
  font-size: 13px;
}

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

.object-tools a,
.button,
input[type="submit"],
input[type="button"],
.submit-row input,
.submit-row a.closelink {
  border-radius: 9px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}

.object-tools a {
  background: var(--lms-accent);
  color: #fff;
  padding: 8px 14px;
  font-size: 13px;
  text-transform: none;
}

.object-tools a:hover { background: var(--lms-accent-dark); }

.submit-row {
  background: #fff;
  border: 1px solid var(--lms-line);
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: 16px;
}

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

/*
  Одна шапка на все карточки: сотрудник, курс, что появится дальше. Слева —
  кружок с буквой или обложка, посередине имя и подпись, справа статус и кнопки.
*/
.pagehead {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  padding: 16px 18px;
  border: 1px solid var(--lms-line);
  border-radius: 14px;
  background: #fff;
}

.pagehead__face {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--lms-accent-soft);
  color: var(--lms-accent-dark);
  font-size: 20px;
  font-weight: 700;
}

#content .pagehead__who h2 { margin: 0; font-size: 19px; }

.pagehead__who p { margin: 2px 0 0; color: var(--lms-muted); font-size: 13px; }

.pagehead__status {
  margin-left: auto;
  padding: 5px 12px;
  border-radius: 999px;
  background: #eef1f4;
  color: var(--lms-muted);
  font-size: 12px;
}

/*
  Статус сотрудника цветом — в списке людей и в шапке карточки (правки 13.10.2026).
  Оранжевый занят кнопками действий, поэтому «работает» — зелёный, «ждёт» —
  янтарный (теплее и спокойнее оранжевого), «приостановлен» — серый, «уволен» — красный.
  Точка перед словом — чтобы цвет различали и те, кто плохо видит оттенки.
*/
.ustatus {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}

.ustatus::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.ustatus--active { background: #e6f4eb; color: #1d7340; }
.ustatus--pending { background: #fdf3d4; color: #8a5d00; }
.ustatus--suspended { background: #eef0f3; color: #5b616b; }
.ustatus--dismissed { background: #fbe9e9; color: #b3261e; }

.pagehead__go {
  padding: 8px 14px;
  border-radius: 9px;
  background: var(--lms-accent);
  color: #fff;
  font-size: 13px;
  text-decoration: none;
}

.pagehead__ghost {
  padding: 8px 14px;
  border: 1px solid var(--lms-line);
  border-radius: 9px;
  color: var(--lms-ink);
  font-size: 13px;
  text-decoration: none;
}

.pagehead__tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.pagehead__cover {
  width: 74px;
  height: 52px;
  border-radius: 9px;
  object-fit: cover;
}

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

.form-row {
  border-bottom: 1px solid #f1f2f5;
  padding: 12px 16px;
}

fieldset.module { padding: 0; }

input[type="text"], input[type="password"], input[type="email"],
input[type="url"], input[type="number"], input[type="tel"],
textarea, select, .vTextField {
  border: 1px solid var(--lms-line);
  border-radius: 9px;
  padding: 7px 10px;
}

input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--lms-accent-soft);
  border-color: var(--lms-accent);
}

/* --- аватар-кружок в списках людей --- */

.who {
  display: flex;
  align-items: center;
  gap: 10px;
}

.who__face {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--lms-accent-soft);
  color: var(--lms-accent-dark);
  font-size: 12px;
  font-weight: 600;
}

.who__name { font-weight: 500; }
.who__sub { display: block; color: var(--lms-muted); font-size: 12px; }

/* --- плитки на главной --- */

.lms-dash__cards { gap: 14px; }

.lms-card {
  padding: 16px 18px;
  border: 1px solid var(--lms-line);
  border-radius: 12px;
  background: #fff;
}

.lms-card:hover { border-color: var(--lms-accent); }
.lms-card--alarm { border-left: 3px solid var(--lms-accent); }
.lms-card__value { font-size: 28px; }
.lms-card__label { color: var(--lms-muted); font-size: 13px; }

.lms-dash__title { font-size: 15px; }

/* Список приложений под плитками — тоже карточками, без синих шапок. */
.dashboard #content-main .module table th a { color: var(--lms-ink); font-weight: 500; }
.dashboard .module table td a { color: var(--lms-muted); }

@media (max-width: 1024px) {
  .rail { flex-basis: 64px; }
  .rail__label { display: none; }
  #content { padding: 16px; }
}

/* --- сводка на главной --- */

.lms-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}

.lms-stat {
  display: block;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--lms-line);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
}

.lms-stat:hover { border-color: var(--lms-accent); }

.lms-stat__value {
  display: block;
  font-size: 30px;
  font-weight: 600;
  line-height: 1.1;
  color: var(--lms-accent);
}

.lms-stat__label {
  display: block;
  margin-top: 4px;
  color: var(--lms-muted);
  font-size: 13px;
}

.lms-dash__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.lms-dash__link { font-size: 13px; white-space: nowrap; }

/* --- экран «Отчёты»: карточки разрезов --- */

.hub { max-width: 1040px; }

.hub__group + .hub__group { margin-top: 26px; }

.hub__caption {
  margin: 0 0 10px;
  color: var(--lms-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hub__list {
  background: #fff;
  border: 1px solid var(--lms-line);
  border-radius: 12px;
  overflow: hidden;
}

.hub__card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  color: var(--lms-ink);
  text-decoration: none;
}

.hub__card + .hub__card { border-top: 1px solid var(--lms-line); }
.hub__card:hover { background: #fafbfc; }
.hub__card:hover .hub__title { color: var(--lms-accent-dark); }

.hub__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #f1f2f5;
  color: var(--lms-muted);
}

.hub__icon svg { width: 21px; height: 21px; }

.hub__text { flex: 1; min-width: 0; }
.hub__title { display: block; font-size: 15px; font-weight: 500; }
.hub__hint { display: block; margin-top: 2px; color: var(--lms-muted); font-size: 13px; }

.hub__metric {
  flex: none;
  padding: 4px 10px;
  border-radius: 99px;
  background: var(--lms-accent-soft);
  color: var(--lms-accent-dark);
  font-size: 13px;
  font-weight: 600;
}

/* --- сводный отчёт --- */

.rpt { max-width: 1200px; }
.rpt__intro { margin: -8px 0 16px; color: var(--lms-muted); font-size: 13px; }

.rpt__filters { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 16px; }
.rpt__filter { display: flex; align-items: center; gap: 8px; color: var(--lms-muted); font-size: 13px; }

.rpt__summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.rpt__tile {
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--lms-line);
  border-radius: 12px;
}

.rpt__tile-value { display: block; font-size: 24px; font-weight: 600; }
.rpt__tile-value--alarm { color: #d64545; }
.rpt__tile-label { display: block; margin-top: 2px; color: var(--lms-muted); font-size: 12px; }

.rpt__card {
  background: #fff;
  border: 1px solid var(--lms-line);
  border-radius: 12px;
  overflow-x: auto;
}

.rpt__table { width: 100%; border-collapse: collapse; }

.rpt__table th {
  padding: 11px 14px;
  background: #fafbfc;
  border-bottom: 1px solid var(--lms-line);
  color: var(--lms-muted);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.rpt__table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f2f5;
  vertical-align: middle;
}

.rpt__table tbody tr:last-child td { border-bottom: 0; }
.rpt__table tbody tr:hover td { background: #fafbfc; }

.rpt__num { text-align: right; font-variant-numeric: tabular-nums; }
.rpt__alarm { color: #d64545; font-weight: 600; }
.rpt__sub { display: block; color: var(--lms-muted); font-size: 12px; }
.rpt__empty { padding: 28px 14px; text-align: center; color: var(--lms-muted); }

.rpt__barcell { white-space: nowrap; min-width: 150px; }

.rpt__bar {
  display: inline-block;
  width: 100px;
  height: 6px;
  border-radius: 99px;
  background: #eceef2;
  overflow: hidden;
  vertical-align: middle;
}

.rpt__bar span { display: block; height: 100%; background: var(--lms-accent); }
.rpt__pct { margin-left: 8px; color: var(--lms-muted); font-size: 12px; }

.rpt__badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
}

.rpt__badge--good { background: #e6f4ec; color: #1f7a4a; }
.rpt__badge--bad { background: #fbe9e9; color: #b83636; }
.rpt__badge--wait { background: #fdf0e6; color: var(--lms-accent-dark); }

/*
  Согласованность (ответ заказчика 15.09.2026). Раньше оранжевым было всё подряд:
  «Сохранить», «Сохранить и продолжить», «История», «Изменить оценки» — и глаз не
  понимал, какое действие главное. Теперь оранжевая только главная кнопка экрана,
  остальные — белые с рамкой. Красная — только удаление.
*/
.button,
input[type="button"],
.submit-row input:not(.default),
.object-tools a.historylink,
.res__edit {
  background: #fff;
  border: 1px solid var(--lms-line);
  color: var(--lms-ink);
}

.button:hover,
input[type="button"]:hover,
.submit-row input:not(.default):hover,
.object-tools a.historylink:hover,
.res__edit:hover {
  background: #f6f7f9;
  border-color: #cfd3da;
  color: var(--lms-ink);
}

.submit-row input.default,
.button.default {
  background: var(--lms-accent);
  border-color: var(--lms-accent);
  color: #fff;
}

.submit-row a.deletelink {
  border-radius: 9px;
  background: #fff;
  border: 1px solid #f0c4c4;
  color: #b83636;
}

.submit-row a.deletelink:hover { background: #fdf2f2; color: #9e2b2b; }

/* Обратная связь на наведение и нажатие — у всех кнопок одинаковая. */
.button, input[type="submit"], input[type="button"], .object-tools a,
.asg__go, .asg__ghost, .upanel__go, .pagehead__go, .pagehead__ghost {
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}

.button:active, input[type="submit"]:active, .object-tools a:active,
.asg__go:active, .upanel__go:active, .pagehead__go:active { transform: translateY(1px); }

/* Сообщение с кнопкой «Отменить» после назначения. */
.messagelist .undo-form { display: inline; margin-left: 10px; }

.messagelist .undo-form button {
  padding: 3px 10px;
  border: 1px solid currentColor;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* --- кнопки над списком (static/admin/row-actions.js) --- */

.rowbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.rowbar[hidden] { display: none; }

.rowbar__count { color: var(--lms-muted); font-size: 13px; }

.rowbar__button {
  padding: 7px 14px;
  border: 1px solid var(--lms-line);
  border-radius: 9px;
  background: #fff;
  color: var(--lms-ink);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.rowbar__button:hover { background: #f6f7f9; }
.rowbar__button--danger { border-color: #f0c4c4; color: #b83636; }
.rowbar__button--danger:hover { background: #fdf2f2; }
.rowbar__button[hidden] { display: none; }

/* Родной выбор действия прячем: кнопки делают то же самое, а лишний выпадающий
   список — это ровно то, на что жаловался заказчик.
   Класс назван дважды не по ошибке: changelists.css подключается в шаблоне
   списка после нашей темы, и при равном весе побеждал бы он. */
#changelist .actions.actions--quiet > label,
#changelist .actions.actions--quiet select,
#changelist .actions.actions--quiet .action-counter,
#changelist .actions.actions--quiet button[name="index"],
#changelist .actions.actions--quiet input[name="index"],
#changelist .actions.actions--quiet .actions-select-icon { display: none; }

.actions--quiet .question,
.actions--quiet .all,
.actions--quiet .clear { font-size: 13px; }

/* Вход в панель всегда светлый. Тёмная тема iPhone подставляла сюда тёмно-серый
   фон из тёмной темы Django (--darkened-bg), а остальная панель у нас светлая —
   вокруг формы получался «чёрный экран» (жалоба управляющих 01.10.2026). */
body.login { background: var(--lms-bg); }
:root, html[data-theme="light"], html[data-theme="dark"] { --darkened-bg: var(--lms-bg); }
