/* Baseline — светлая тема админки.
   Работает поверх стандартных стилей Django: сначала переопределяем его CSS-переменные,
   затем дорабатываем крупные блоки (шапка, этапы, таблицы, фильтры, формы).
   Тёмная тема отключена намеренно: интерфейс всегда светлый. */

/* Шрифт и цвета — как на base-line.ru: IBM Plex Sans, фирменный зелёный #0CC691, тёмный #232422. */
@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&display=swap");

:root,
html[data-theme="dark"],
html[data-theme="light"] {
  /* палитра Baseline */
  --bl-ink: #232422;
  --bl-text: #3a3b38;
  --bl-muted: #6b6c69;
  --bl-faint: #8d8e8d;
  --bl-line: #dedede;
  --bl-line-soft: #ededed;
  --bl-bg: #f9f9f9;
  --bl-surface: #ffffff;
  --bl-brand: #0cc691;
  --bl-brand-strong: #07946b;
  --bl-brand-soft: #e6f9f2;
  --bl-brand-ring: rgba(12, 198, 145, .2);
  --bl-violet-soft: #f8fdd9;
  --bl-lime: #eefb9f;
  --bl-teal: #1c3335;
  --bl-coral: #ff8562;
  --bl-amber-soft: #fff6e6;
  --bl-red: #d92d20;
  --bl-red-soft: #fff1f0;
  --bl-shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --bl-shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 8px 24px -12px rgba(16, 24, 40, .12);
  --bl-radius: 10px;
  --bl-radius-sm: 8px;

  /* переменные Django admin */
  --primary: var(--bl-brand);
  --secondary: var(--bl-brand-strong);
  --accent: #b7ecd9;
  --primary-fg: #fff;
  --body-fg: var(--bl-text);
  --body-bg: var(--bl-bg);
  --body-quiet-color: var(--bl-muted);
  --body-loud-color: var(--bl-ink);
  --header-color: var(--bl-text);
  --header-branding-color: var(--bl-ink);
  --header-bg: var(--bl-surface);
  --header-link-color: var(--bl-text);
  --breadcrumbs-fg: var(--bl-muted);
  --breadcrumbs-link-fg: var(--bl-text);
  --breadcrumbs-bg: transparent;
  --link-fg: var(--bl-brand-strong);
  --link-hover-color: var(--bl-brand);
  --link-selected-fg: var(--bl-brand-strong);
  --hairline-color: var(--bl-line-soft);
  --border-color: var(--bl-line);
  --error-fg: var(--bl-red);
  --message-success-bg: #ecfdf3;
  --message-warning-bg: #fffaeb;
  --message-error-bg: var(--bl-red-soft);
  --darkened-bg: #f9fafb;
  --selected-bg: #e6f9f2;
  --selected-row: #effbf6;
  --button-fg: #fff;
  --button-bg: var(--bl-brand);
  --button-hover-bg: var(--bl-brand-strong);
  --default-button-bg: var(--bl-brand-strong);
  --default-button-hover-bg: #067a55;
  --close-button-bg: #98a2b3;
  --close-button-hover-bg: #667085;
  --delete-button-bg: var(--bl-red);
  --delete-button-hover-bg: #b42318;
  --object-tools-fg: #fff;
  --object-tools-bg: var(--bl-brand);
  --object-tools-hover-bg: var(--bl-brand-strong);
  --font-family-primary: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root { color-scheme: light; }
}

/* Переключатель темы не нужен — интерфейс всегда светлый. */
.theme-toggle,
button.theme-toggle { display: none !important; }

html, body {
  background: var(--bl-bg);
  color: var(--bl-text);
  font-family: var(--font-family-primary);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .pipeline-card strong, #site-name {
  font-family: var(--font-family-primary);
}

/* ---------- Шапка ---------- */

#header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 64px;
  padding: 0 28px;
  border-bottom: 1px solid var(--bl-line);
  background: rgba(255, 255, 255, .86);
  backdrop-filter: saturate(1.4) blur(12px);
  box-shadow: none;
  color: var(--bl-text);
}

#header a:link, #header a:visited { color: var(--bl-text); }

#branding h1, #site-name { margin: 0; }

.baseline-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--bl-ink);
  line-height: 1.1;
}

.baseline-brand__mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: var(--bl-radius);
  background: var(--bl-surface);
  border: 1px solid var(--bl-line);
}
.baseline-brand__mark svg { width: 24px; height: auto; display: block; }

.baseline-brand strong {
  display: block;
  color: var(--bl-ink);
  font-family: var(--font-family-primary);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -.01em;
}

.baseline-brand span:not(.baseline-brand__mark) {
  display: block;
  margin-top: 2px;
  color: var(--bl-muted);
  font-size: 12px;
  font-weight: 500;
}

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

#user-tools a, #logout-form button {
  border: 0;
  color: var(--bl-text) !important;
  font-weight: 600;
  text-decoration: none;
}

#user-tools a:hover, #logout-form button:hover { color: var(--bl-brand) !important; }

/* ---------- Навигация слева ---------- */

#nav-sidebar {
  border-right: 1px solid var(--bl-line);
  background: var(--bl-surface);
}

#nav-sidebar .module { border: 0; border-radius: 0; box-shadow: none; background: transparent; }

#nav-sidebar caption,
#nav-sidebar .module caption {
  padding: 18px 16px 8px;
  background: transparent;
  color: var(--bl-faint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

#nav-sidebar caption a { color: var(--bl-faint) !important; }

#nav-sidebar th, #nav-sidebar td { border: 0; padding: 0; }

#nav-sidebar th a {
  display: block;
  margin: 1px 8px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--bl-text) !important;
  font-size: 13px;
  font-weight: 500;
}

#nav-sidebar th a:hover { background: var(--bl-line-soft); }

#nav-sidebar .current-model { background: transparent; }
#nav-sidebar .current-model th a {
  background: var(--bl-brand-soft);
  color: var(--bl-brand-strong) !important;
  font-weight: 650;
}

#nav-sidebar .addlink { display: none; }

#nav-filter {
  margin: 12px 8px 4px;
  padding: 8px 10px;
  border: 1px solid var(--bl-line);
  border-radius: 9px;
  background: var(--bl-bg);
}

.toggle-nav-sidebar {
  border-right: 1px solid var(--bl-line);
  background: var(--bl-surface);
  color: var(--bl-muted);
}

/* ---------- Хлебные крошки и заголовки ---------- */

div.breadcrumbs {
  padding: 14px 32px 0;
  border: 0;
  background: transparent;
  color: var(--bl-faint);
  font-size: 12.5px;
}

div.breadcrumbs a { color: var(--bl-muted) !important; }
div.breadcrumbs a:hover { color: var(--bl-brand) !important; }

#content {
  padding: 18px 32px 40px;
}

#content > h1, #content-main > h1, .pipeline__intro h1 {
  color: var(--bl-ink);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -.025em;
}

#content > h1 { margin: 6px 0 6px; }

#content > h2 { color: var(--bl-muted); font-size: 15px; font-weight: 600; }

a:link, a:visited { color: var(--bl-brand-strong); }
a:hover { color: var(--bl-brand); }

/* ---------- Карточки (модули) ---------- */

.module,
#changelist .changelist-form-container,
#content-main > .module,
#content-related .module {
  overflow: hidden;
  border: 1px solid var(--bl-line);
  border-radius: var(--bl-radius);
  background: var(--bl-surface);
  box-shadow: var(--bl-shadow);
}

.module caption,
.module h2,
.inline-group h2,
fieldset.module h2 {
  padding: 14px 18px;
  border-bottom: 1px solid var(--bl-line-soft);
  background: var(--bl-surface);
  color: var(--bl-ink);
  font-family: var(--font-family-primary);
  font-size: 14px;
  font-weight: 750;
  letter-spacing: -.005em;
  text-transform: none;
}

.module caption a, .module h2 a { color: var(--bl-ink) !important; }

/* Главная: список разделов */
.dashboard .module table th a { font-weight: 600; color: var(--bl-text) !important; }
.dashboard .module table td a { font-size: 12px; font-weight: 600; }
.dashboard .module table th, .dashboard .module table td { padding: 11px 18px; border-color: var(--bl-line-soft); }
.dashboard .module table tr:hover { background: var(--bl-bg); }
#recent-actions-module h3 { color: var(--bl-muted); font-size: 12px; }

/* ---------- Этапы (главная) ---------- */

.pipeline {
  position: relative;
  margin: 0 0 22px;
  padding: 26px 26px 24px;
  overflow: hidden;
  border: 1px solid var(--bl-line);
  border-radius: var(--bl-radius);
  background:
    radial-gradient(1200px 260px at 100% -40%, rgba(12, 198, 145, .10), transparent 60%),
    radial-gradient(700px 220px at -10% 120%, rgba(238, 251, 159, .35), transparent 60%),
    var(--bl-surface);
  box-shadow: var(--bl-shadow);
}

.pipeline__intro h1 { margin: 6px 0 6px; font-size: 24px; }

.pipeline__intro p:not(.eyebrow) {
  max-width: 720px;
  margin: 0;
  color: var(--bl-muted);
  font-size: 14px;
  line-height: 1.55;
}

.eyebrow,
.pipeline-card__step {
  color: var(--bl-brand);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.eyebrow::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bl-brand);
  box-shadow: 0 0 0 4px var(--bl-brand-ring);
  content: "";
}

.pipeline__steps {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: stretch;
  gap: 12px;
  margin-top: 22px;
}

.pipeline-card {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 18px 18px 16px;
  border: 1px solid var(--bl-line);
  border-radius: 16px;
  background: var(--bl-surface);
  box-shadow: var(--bl-shadow-sm);
  text-decoration: none !important;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.pipeline-card:hover {
  border-color: #c9d2dc;
  box-shadow: 0 14px 28px -16px rgba(16, 24, 40, .28);
  transform: translateY(-2px);
}

.pipeline-card::after {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--bl-line-soft);
  color: var(--bl-muted);
  content: "→";
  display: grid;
  place-items: center;
  font-size: 14px;
  transition: background .18s ease, color .18s ease;
}

.pipeline-card:hover::after { background: var(--bl-ink); color: #fff; }

.pipeline-card--irrelevant { background: linear-gradient(180deg, #fffaf5 0%, #fff 70%); }
.pipeline-card--irrelevant .pipeline-card__step { color: #c4620a; }
.pipeline-card--relevant { background: linear-gradient(180deg, #e6f9f2 0%, #fff 70%); }

.pipeline-card__label {
  margin-top: 14px;
  color: var(--bl-text);
  font-size: 13.5px;
  font-weight: 650;
}

.pipeline-card strong {
  margin-top: 4px;
  color: var(--bl-ink);
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -.035em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.pipeline-card small {
  margin-top: 4px;
  color: var(--bl-muted);
  font-size: 12.5px;
}

.pipeline__arrow {
  align-self: center;
  color: #c3cad4;
  font-size: 18px;
}

/* ---------- Этапы в списках ---------- */

.vacancy-stage__description {
  max-width: 820px;
  margin: 0 0 18px;
  color: var(--bl-muted);
  font-size: 14px;
  line-height: 1.55;
}

.stage-nav {
  display: inline-flex;
  gap: 4px;
  margin: 0 0 18px;
  padding: 4px;
  border: 1px solid var(--bl-line);
  border-radius: 12px;
  background: var(--bl-surface);
  box-shadow: var(--bl-shadow-sm);
}

.stage-nav a {
  padding: 8px 14px;
  border-radius: 9px;
  color: var(--bl-muted) !important;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}

.stage-nav a:hover { background: var(--bl-bg); color: var(--bl-ink) !important; }

.stage-nav a span {
  margin-right: 6px;
  color: var(--bl-faint);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stage-nav a.is-active {
  background: var(--bl-ink);
  color: #fff !important;
  box-shadow: 0 4px 10px -4px rgba(16, 24, 40, .45);
}

.stage-nav a.is-active span { color: #8fe3c6; }

/* ---------- Список: поиск, действия, таблица ---------- */

#changelist { gap: 20px; }

#changelist .changelist-form-container { min-width: 0; }

#toolbar {
  margin: 0;
  padding: 14px 16px;
  border-bottom: 1px solid var(--bl-line-soft);
  background: var(--bl-surface);
}

#toolbar form input[type="text"], #searchbar {
  min-width: 280px;
  height: 38px;
  padding: 0 12px 0 34px;
  border: 1px solid var(--bl-line);
  border-radius: 10px;
  background: var(--bl-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2398a2b3' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m14 14-3.2-3.2'/%3E%3C/svg%3E") 11px center no-repeat;
  color: var(--bl-ink);
}

#toolbar form input[type="text"]:focus, #searchbar:focus {
  border-color: var(--bl-brand);
  background-color: #fff;
  outline: 0;
  box-shadow: 0 0 0 4px var(--bl-brand-ring);
}

#toolbar #changelist-search img { display: none; }

#changelist .actions {
  padding: 10px 16px;
  border-bottom: 1px solid var(--bl-line-soft);
  background: #fbfcfd;
  color: var(--bl-muted);
  font-size: 13px;
}

#changelist .actions select {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--bl-line);
  border-radius: 9px;
  background-color: #fff;
}

#changelist .actions .button {
  height: 34px;
  padding: 0 14px;
}

#result_list { width: 100%; border: 0; border-collapse: separate; border-spacing: 0; }

#result_list thead th {
  padding: 11px 12px;
  border-bottom: 1px solid var(--bl-line);
  background: #f9fafb;
  color: var(--bl-muted);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: .02em;
  text-transform: none;
  white-space: nowrap;
}

#result_list thead th a { color: var(--bl-muted) !important; }
#result_list thead th.sorted a { color: var(--bl-ink) !important; }

#result_list td, #result_list th {
  padding: 13px 12px;
  border-bottom: 1px solid var(--bl-line-soft);
  border-top: 0;
  color: var(--bl-text);
  font-size: 13.5px;
  line-height: 1.45;
  vertical-align: top;
}

#result_list tbody tr { background: #fff; transition: background .12s ease; }
#result_list tbody tr:nth-child(even) { background: #fff; }
#result_list tbody tr:hover { background: #f7fbf9; }
#result_list tbody tr.selected { background: var(--selected-row); }

#result_list tbody th a { color: var(--bl-ink) !important; font-weight: 600; }

#result_list th:first-child, #result_list td:first-child {
  color: var(--bl-faint);
  font-variant-numeric: tabular-nums;
}

#result_list td a.baseline-external-link,
a.baseline-external-link {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 7px;
  background: var(--bl-brand-soft);
  color: var(--bl-brand-strong) !important;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.paginator {
  margin: 0;
  padding: 14px 16px;
  border-top: 1px solid var(--bl-line-soft);
  background: var(--bl-surface);
  color: var(--bl-muted);
  font-size: 13px;
}

.paginator a:link, .paginator a:visited {
  padding: 4px 9px;
  border-radius: 7px;
  background: var(--bl-bg);
  color: var(--bl-text) !important;
}

.paginator .this-page {
  padding: 4px 9px;
  border-radius: 7px;
  background: var(--bl-ink);
  color: #fff;
}

/* ---------- Фильтры справа ---------- */

#changelist-filter {
  flex: 0 0 248px;
  align-self: flex-start;
  padding: 6px 0 10px;
  border: 1px solid var(--bl-line);
  border-radius: var(--bl-radius);
  background: var(--bl-surface);
  box-shadow: var(--bl-shadow);
}

#changelist-filter h2 {
  margin: 0;
  padding: 12px 16px 6px;
  border: 0;
  background: transparent;
  color: var(--bl-ink);
  font-size: 14px;
  font-weight: 800;
}

#changelist-filter h3,
#changelist-filter summary {
  margin: 10px 0 4px;
  padding: 0 16px;
  color: var(--bl-faint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

#changelist-filter details { border: 0; }
#changelist-filter ul { margin: 0; padding: 0 8px 6px; border: 0; }
#changelist-filter li { margin: 0; padding: 0; list-style: none; }

#changelist-filter li a {
  display: block;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--bl-text) !important;
  font-size: 13px;
  text-decoration: none;
}

#changelist-filter li a:hover { background: var(--bl-bg); }

#changelist-filter li.selected a {
  background: var(--bl-brand-soft);
  color: var(--bl-brand-strong) !important;
  font-weight: 650;
}

#changelist-filter-clear a {
  display: block;
  margin: 4px 16px 8px;
  color: var(--bl-red) !important;
  font-size: 12px;
}

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

.button, input[type=submit], input[type=button], .submit-row input, a.button, button.button {
  height: auto;
  padding: 9px 16px;
  border: 0;
  border-radius: 10px;
  background: var(--bl-brand);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .08), inset 0 1px 0 rgba(255, 255, 255, .18);
  color: #fff;
  font-family: var(--font-family-primary);
  font-size: 13px;
  font-weight: 650;
  transition: background .15s ease, transform .1s ease;
}

.button:hover, input[type=submit]:hover, input[type=button]:hover, .submit-row input:hover, a.button:hover {
  background: var(--bl-brand-strong);
}

.button:active, input[type=submit]:active { transform: translateY(1px); }

.button.default, input[type=submit].default, .submit-row input.default {
  background: var(--bl-ink);
}

.button.default:hover, input[type=submit].default:hover, .submit-row input.default:hover { background: #1d2939; }

.object-tools a:link, .object-tools a:visited {
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--bl-ink);
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
}

.object-tools a:hover { background: var(--bl-brand); }

/* ---------- Формы ---------- */

fieldset.module { margin-bottom: 20px; }

.form-row {
  padding: 14px 18px;
  border-bottom: 1px solid var(--bl-line-soft);
}

.aligned label, form .aligned label {
  color: var(--bl-text);
  font-size: 13px;
  font-weight: 600;
}

input[type=text], input[type=password], input[type=email], input[type=url], input[type=number],
input[type=tel], textarea, select, .vTextField {
  padding: 8px 11px;
  border: 1px solid var(--bl-line);
  border-radius: 10px;
  background: #fff;
  color: var(--bl-ink);
  font-family: var(--font-family-primary);
  font-size: 13.5px;
  transition: border-color .15s ease, box-shadow .15s ease;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--bl-brand) !important;
  outline: 0;
  box-shadow: 0 0 0 4px var(--bl-brand-ring);
}

textarea { line-height: 1.5; }

.help, div.help, p.help, .form-row div.help {
  color: var(--bl-muted);
  font-size: 12px;
  line-height: 1.5;
}

.submit-row {
  margin: 20px 0;
  padding: 14px 16px;
  border: 1px solid var(--bl-line);
  border-radius: var(--bl-radius);
  background: var(--bl-surface);
  box-shadow: var(--bl-shadow);
}

.submit-row a.deletelink {
  height: auto;
  padding: 9px 14px;
  border-radius: 10px;
  background: var(--bl-red-soft);
  color: var(--bl-red) !important;
}

.inline-group .tabular tr.has_original td { padding-top: 12px; }

/* ---------- Сообщения ---------- */

ul.messagelist li {
  margin: 0 0 10px;
  padding: 12px 16px 12px 42px;
  border: 1px solid #abefc6;
  border-radius: 12px;
  background: #ecfdf3 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23079455' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3.5 8.5 3 3 6-7'/%3E%3C/svg%3E") 16px center no-repeat;
  color: #054f31;
  font-size: 13.5px;
}

ul.messagelist li.warning {
  border-color: #fedf89;
  background-color: #fffaeb;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23dc6803' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M8 4v5M8 12h.01'/%3E%3C/svg%3E");
  color: #7a2e0e;
}

ul.messagelist li.error {
  border-color: #fecdca;
  background-color: var(--bl-red-soft);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23d92d20' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='m4.5 4.5 7 7M11.5 4.5l-7 7'/%3E%3C/svg%3E");
  color: #7a271a;
}

ul.messagelist li.info {
  border-color: #c7d7fe;
  background-color: #eef4ff;
  background-image: none;
  padding-left: 16px;
  color: #2d3282;
}

.errornote {
  border: 1px solid #fecdca;
  border-radius: 12px;
  background: var(--bl-red-soft);
  color: var(--bl-red);
}

/* ---------- Вход ---------- */

body.login {
  background:
    radial-gradient(900px 400px at 85% -10%, rgba(12, 198, 145, .14), transparent 60%),
    radial-gradient(700px 360px at 0% 110%, rgba(238, 251, 159, .35), transparent 60%),
    var(--bl-bg);
}

.login #container {
  overflow: hidden;
  border: 1px solid var(--bl-line);
  border-radius: 20px;
  background: var(--bl-surface);
  box-shadow: 0 24px 48px -24px rgba(16, 24, 40, .25);
}

.login #header { position: static; padding: 18px 24px; background: #fff; }
.login #content { padding: 22px 24px 26px; }
.login .submit-row { padding: 0; border: 0; box-shadow: none; background: transparent; }
.login .submit-row input { width: 100%; padding: 11px; }

/* ---------- Адаптивность ---------- */

@media (max-width: 1024px) {
  #header { padding: 0 18px; }
  #content { padding: 16px 18px 32px; }
  div.breadcrumbs { padding: 12px 18px 0; }
  #changelist-filter { flex-basis: auto; }
}

@media (max-width: 800px) {
  .pipeline { padding: 20px; }
  .pipeline__steps { grid-template-columns: 1fr; }
  .pipeline__arrow { justify-self: center; transform: rotate(90deg); }
  .stage-nav { display: flex; max-width: 100%; overflow-x: auto; }
  #toolbar form input[type="text"], #searchbar { min-width: 0; width: 100%; }
}

/* ---------- Уточнения ---------- */

#changelist.module,
#changelist.module.filtered {
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#changelist .changelist-form-container { overflow: hidden; }
#changelist .results { overflow-x: auto; }

#result_list th, #result_list td,
.module table th, .module table td,
#nav-sidebar th, #nav-sidebar td,
.module caption, #nav-sidebar caption { text-align: left; }

.module caption { caption-side: top; }

.company-name { color: var(--bl-ink) !important; font-weight: 650; }
.company-name small { display: block; margin-top: 2px; color: var(--bl-faint); font-size: 11.5px; font-weight: 500; }

/* Выгрузка в Excel */
.pipeline__export {
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--body-quiet-color, #666);
}
.pipeline__export a { white-space: nowrap; }
.object-tools a.baseline-excel-link {
  background: #1d6f42;
  color: #fff;
}
.object-tools a.baseline-excel-link:hover { background: #155232; }

/* ---------- Полоса периода (над таблицами и на главной) ---------- */

.period-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--bl-line);
  border-radius: var(--bl-radius);
  background: var(--bl-surface);
  box-shadow: var(--bl-shadow-sm);
}
.period-bar__title { color: var(--bl-muted); font-size: 13px; white-space: nowrap; }
.period-bar__title b { color: var(--bl-ink); }
.period-bar__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.period-chip {
  padding: 6px 12px;
  border: 1px solid var(--bl-line);
  border-radius: var(--bl-radius-sm);
  color: var(--bl-text) !important;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none !important;
  white-space: nowrap;
}
.period-chip:hover { border-color: var(--bl-brand); color: var(--bl-brand-strong) !important; }
.period-chip.is-active { border-color: var(--bl-brand); background: var(--bl-brand); color: #fff !important; }
.period-bar__custom { position: relative; }
.period-bar__custom > summary { list-style: none; cursor: pointer; }
.period-bar__custom > summary::-webkit-details-marker { display: none; }
.period-bar__range {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  right: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--bl-line);
  border-radius: var(--bl-radius);
  background: var(--bl-surface);
  box-shadow: var(--bl-shadow);
  font-size: 13px;
  white-space: nowrap;
}
.period-bar__range.is-active input[type="date"] { border-color: var(--bl-brand); }
.period-bar__range label { display: flex; align-items: center; gap: 6px; color: var(--bl-muted); }
.period-bar__range input[type="date"] {
  padding: 5px 8px;
  border: 1px solid var(--bl-line);
  border-radius: var(--bl-radius-sm);
  font: inherit;
}
.period-bar__range button {
  padding: 6px 14px;
  border: 0;
  border-radius: var(--bl-radius-sm);
  background: var(--bl-brand);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* ---------- Дашборд на главной ---------- */

/* Стандартный dashboard.css Django жёстко задаёт главной ширину 600px — снимаем, страница во всю ширину. */
.dashboard #content { width: auto; max-width: none; }
.dashboard #content-main { float: none; width: 100%; }
.dashboard #content-main > .module { max-width: 960px; }
.dash { margin: 0 0 28px; }
.dash__head h1 { margin: 6px 0 4px; font-size: 26px; }
.dash__sub { margin: 0 0 16px; color: var(--bl-muted); font-size: 14px; }

.dash-funnel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr) auto) minmax(0, 1fr);
  align-items: stretch;
  gap: 10px;
  margin: 0 0 18px;
}
.dash-funnel__arrow { align-self: center; color: var(--bl-faint); font-size: 18px; }
.dash-kpi {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 16px 16px 14px;
  border: 1px solid var(--bl-line);
  border-radius: var(--bl-radius);
  background: var(--bl-surface);
  box-shadow: var(--bl-shadow-sm);
  text-decoration: none !important;
  transition: transform .18s ease, box-shadow .18s ease;
}
.dash-kpi:hover { box-shadow: 0 14px 28px -16px rgba(16, 24, 40, .28); transform: translateY(-2px); }
.dash-kpi__label { color: var(--bl-muted); font-size: 13px; font-weight: 600; }
.dash-kpi strong { margin: 6px 0 2px; color: var(--bl-ink); font-size: 32px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.dash-kpi small { color: var(--bl-muted); font-size: 12px; }
.dash-kpi:last-child { border-color: transparent; background: var(--bl-teal); }
.dash-kpi:last-child .dash-kpi__label, .dash-kpi:last-child small { color: rgba(255, 255, 255, .72); }
.dash-kpi:last-child strong { color: var(--bl-lime); }

.dash-card {
  margin: 0 0 14px;
  padding: 18px 20px;
  border: 1px solid var(--bl-line);
  border-radius: var(--bl-radius);
  background: var(--bl-surface);
  box-shadow: var(--bl-shadow-sm);
  overflow-x: auto;
}
.dash-card h2 { margin: 0 0 12px; color: var(--bl-ink); font-size: 16px; }
.dash-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.dash-table th, .dash-table td { padding: 10px 12px; border-bottom: 1px solid var(--bl-line-soft); text-align: right; white-space: nowrap; }
.dash-table thead th { color: var(--bl-muted); font-size: 12px; font-weight: 600; background: transparent; }
.dash-table th:first-child, .dash-table td:first-child { text-align: left; }
.dash-table tbody th { color: var(--bl-ink); font-weight: 700; }
.dash-table tfoot th, .dash-table tfoot td { border-bottom: 0; color: var(--bl-ink); font-weight: 700; }
.dash-table a { font-weight: 600; }
.dash-table .is-good, .dash-table .is-good a { color: var(--bl-brand-strong) !important; font-weight: 700; }
.dash-bar {
  display: inline-block;
  width: 70px;
  height: 6px;
  margin-right: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bl-line-soft);
  vertical-align: middle;
}
.dash-bar span { display: block; height: 100%; background: var(--bl-brand); border-radius: 999px; }
.dash-sections-title { margin: 8px 0 10px; color: var(--bl-muted); font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }

@media (max-width: 1100px) {
  .dash-funnel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-funnel__arrow { display: none; }
}


/* ---------- Списки: закреплено всё, кроме строк таблицы ----------
   Страница списка (вакансии, компании, письма, журнал…) занимает ровно высоту окна:
   шапка, меню слева, заголовок, период, этапы, поиск и действия стоят на месте,
   прокручиваются только строки таблицы (названия колонок закреплены) и, если не
   помещаются, фильтры справа — каждая область своей прокруткой.
   На узких экранах (до 1024 px) — обычная прокрутка страницы. */

@media (min-width: 1025px) {
  body.change-list { overflow: hidden; }
  body.change-list #container {
    display: flex;
    height: 100vh;
    flex-direction: column;
    overflow: hidden;
  }
  body.change-list #header,
  body.change-list .breadcrumbs,
  body.change-list div.breadcrumbs { flex: 0 0 auto; }
  /* #container > .main — иначе стандартное правило Django (flex: 1 0 auto) сильнее
     и область под шапкой растягивается на всю длину таблицы. */
  body.change-list #container > .main {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
  }
  body.change-list #nav-sidebar,
  body.change-list .toggle-nav-sidebar {
    max-height: 100%;
  }
  body.change-list #nav-sidebar { overflow-y: auto; }
  body.change-list main.content,
  body.change-list .main > .content {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
  }
  body.change-list #content {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
    padding-bottom: 16px;
  }
  body.change-list #content > br.clear,
  body.change-list #footer { display: none; }
  body.change-list #content-main {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
  }
  body.change-list #changelist {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    align-items: stretch;
  }
  body.change-list #changelist .changelist-form-container {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    flex-direction: column;
  }
  body.change-list #changelist-form {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
  }
  body.change-list #changelist .results {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
  }
  body.change-list #changelist-filter {
    position: static;
    max-height: 100%;
    overflow-y: auto;
  }

  /* Плотнее сверху, чтобы таблице досталось больше высоты. */
  body.change-list #content { padding-top: 10px; }
  body.change-list .breadcrumbs, body.change-list div.breadcrumbs { padding-top: 6px; padding-bottom: 0; }
  body.change-list #content > h1 { margin: 0 0 8px; font-size: 22px; }
  body.change-list .vacancy-stage__description,
  body.change-list .company-stage__description { display: none; }
  body.change-list .period-bar { margin-bottom: 8px; padding: 6px 10px; gap: 6px 12px; }
  body.change-list .period-bar__title { display: none; }  /* выбранный период и так подсвечен */
  body.change-list .period-chip { padding: 4px 10px; }
  body.change-list .stage-nav { margin-bottom: 8px; }
  /* Кнопки «Скачать в Excel» / «Добавить» — в строку этапов, справа. */
  body.change-list #content-main { position: relative; }
  body.change-list #content-main > .object-tools {
    position: absolute;
    top: -48px;
    right: 6px;
    margin: 0;
  }
  body.change-list #toolbar { padding-top: 8px; padding-bottom: 8px; }
}

#result_list thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--bl-surface);
  box-shadow: inset 0 -1px 0 var(--bl-line);
}
#result_list thead th.action-checkbox-column { z-index: 4; }

/* Компании: колонка «Вакансия» — откуда пришла компания (название читается целиком). */
#result_list th.column-vacancy_column,
#result_list td.field-vacancy_column {
  min-width: 240px;
  max-width: 320px;
}

/* Ширина колонок тянется мышью за правый край заголовка (column_resize.js). */
#result_list thead th { position: sticky; }
#result_list thead th .bl-col-grip {
  position: absolute; top: 0; right: -3px; width: 7px; height: 100%; cursor: col-resize; z-index: 6;
}
#result_list thead th .bl-col-grip::after {
  content: ""; position: absolute; top: 25%; bottom: 25%; left: 3px; width: 1px; background: var(--bl-line, #e3e6e4);
}
#result_list thead th:hover .bl-col-grip::after { background: var(--bl-green, #0cc691); width: 2px; }
body.bl-col-resizing, body.bl-col-resizing * { cursor: col-resize !important; user-select: none !important; }
/* Точные ширины после перетаскивания: перенос по словам, поля ввода — по ширине колонки. */
#result_list.bl-fixed { table-layout: fixed; max-width: none; }
#result_list.bl-fixed th, #result_list.bl-fixed td {
  white-space: normal !important; overflow-wrap: anywhere; word-break: normal; overflow: hidden;
  min-width: 0 !important; max-width: none !important;
}
#result_list.bl-fixed td select, #result_list.bl-fixed td textarea, #result_list.bl-fixed td input[type=text] {
  width: 100% !important; max-width: 100% !important; min-width: 0 !important; box-sizing: border-box;
}
.bl-col-reset {
  margin-left: 12px; padding: 5px 10px; border: 1px solid var(--bl-line, #e3e6e4); border-radius: 8px;
  background: #fff; color: var(--bl-muted, #6b706d); font-size: 12px; cursor: pointer;
}
.bl-col-reset:hover { color: var(--bl-ink, #232422); border-color: var(--bl-green, #0cc691); }

/* Отметки в «Коммуникациях» прямо в списке: компактные поля. */
#result_list td select {
  height: auto; min-height: 32px; padding: 4px 28px 4px 8px; font-size: 13px; line-height: 1.3; max-width: 230px;
}
#result_list td textarea.bl-inline-comment {
  width: 200px; min-height: 40px; height: 40px; font-size: 13px; line-height: 1.3; padding: 6px 8px; resize: vertical;
}
#result_list td.field-feedback_short { min-width: 160px; max-width: 260px; color: var(--bl-muted, #6b706d); font-size: 12px; }
#result_list.bl-fixed thead th { overflow-wrap: normal; word-break: normal; hyphens: auto; }
#result_list th.column-row_number, #result_list td.field-row_number { width: 44px; color: var(--bl-muted, #6b706d); text-align: right; }

/* Кнопки проверки писем в «Коммуникациях» */
.bl-review-bar { background:#F3F8F5; border:1px solid #CFE6DC; border-radius:10px; padding:12px 16px; margin:0 0 14px; }
.bl-review-steps { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.bl-review-steps form { margin:0; }
.bl-review-btn { padding:9px 14px !important; font-weight:600; }
.bl-review-btn[disabled] { opacity:.5; cursor:not-allowed; }
.bl-review-arrow { color:#5B615E; }
.bl-review-status { margin-top:8px; color:#3F4643; font-size:13px; }
