/* RoboKids CRM — единая система стилей прототипа.
   Переносится в secretary/static/crm.css. Классы не зависят от данных. */

:root {
  /* Поверхности */
  /* Палитра бренда: синий #0066B3, красный #EE2F53, чёрный #0B1F33, серо-голубой #EDF2FE, белый */
  --bg: #F4F7FE;
  --surface: #ffffff;
  --surface-2: #F6F8FE;
  --line: #DCE3F0;
  --line-strong: #AEBAD0;
  /* Текст */
  --text: #0B1F33;
  --text-2: #34465A;
  --muted: #4E5F73;
  /* Акцент — фирменный синий */
  --accent: #0066B3;
  --accent-hover: #00528F;
  --accent-soft: #EDF2FE;
  --accent-line: #A9C4E8;
  /* Фирменный красный: счётчики новых дел и ошибки */
  --brand-red: #EE2F53;
  /* Смысловые цвета */
  --ok: #17703F;      --ok-bg: #E8F5EC;    --ok-line: #A6D3B6;
  --warn: #7A4B00;    --warn-bg: #FDF2D8;  --warn-line: #E8C77A;
  --err: #C41F3F;     --err-bg: #FDECEF;   --err-line: #F4A9B8;
  --info: #0066B3;    --info-bg: #EDF2FE;  --info-line: #A9C4E8;
  --focus: #0B1F33;
  /* Размеры */
  --r-sm: 8px; --r: 10px; --r-lg: 14px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px; --s12: 48px;
  --control: 48px;
  --font: "Golos Text", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 17px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 32px; line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 22px; line-height: 1.3; font-weight: 650; }
h3 { font-size: 18px; line-height: 1.4; font-weight: 650; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
small, .small { font-size: 15px; line-height: 1.45; }
.muted { color: var(--muted); }
.strong { font-weight: 650; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Каркас: меню + содержимое */
.app { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: 100vh; }
.main { min-width: 0; padding: 32px 40px 72px; }
.wrap { max-width: 1240px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }

/* Боковое меню */
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 24px 16px; display: flex; flex-direction: column; gap: 20px; min-height: 100%; }
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); padding: 4px 8px; }
.brand-mark { width: 44px; height: 44px; border-radius: 10px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 18px; flex: none; }
.brand-name { font-size: 19px; font-weight: 700; line-height: 1.2; display: block; }
.brand-sub { font-size: 14px; color: var(--muted); display: block; }
.side .menu-toggle { display: none; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-group { font-size: 14px; font-weight: 600; color: var(--muted); padding: 16px 12px 6px; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 10px 12px; border-radius: var(--r); color: var(--text-2); text-decoration: none; font-size: 17px; font-weight: 500; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item svg { flex: none; width: 22px; height: 22px; }
.nav-item.is-active { background: var(--accent-soft); color: var(--accent-hover); font-weight: 650; }
.nav-count { margin-left: auto; min-width: 28px; height: 26px; padding: 0 8px; border-radius: 999px; background: #D6203F; color: #fff; font-size: 15px; font-weight: 650; display: grid; place-items: center; }
.nav-count.is-warn { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-line); }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding: 16px 8px 0; display: flex; flex-direction: column; gap: 12px; }
.mailbox { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; color: var(--text-2); }

/* Заголовок страницы */
.back-link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 17px; font-weight: 600; text-decoration: none; }
.back-link:hover { text-decoration: underline; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; }
.page-head-text { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: 1 1 520px; }
.page-head .lead { color: var(--text-2); font-size: 18px; max-width: 760px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* Панели */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); min-width: 0; }
.pad { padding: 24px; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.panel-body { padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-lg { display: flex; flex-direction: column; gap: 24px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.between { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.cols-main { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
.cols-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.cols-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.divider { height: 1px; background: var(--line); border: 0; margin: 0; }

/* Кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--control); padding: 10px 20px; border-radius: var(--r); border: 1.5px solid transparent; font-family: inherit; font-size: 17px; font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent-hover); }
.btn-quiet { background: transparent; color: var(--accent); padding-left: 12px; padding-right: 12px; }
.btn-quiet:hover { background: var(--accent-soft); color: var(--accent-hover); }
.btn-danger { background: var(--surface); color: var(--err); border-color: var(--err-line); }
.btn-danger:hover { background: var(--err-bg); }
.btn-sm { min-height: 44px; padding: 8px 14px; font-size: 16px; }
.btn[disabled], .btn.is-busy { opacity: .62; cursor: not-allowed; }
.btn-primary[disabled] { background: #7A9CC4; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

/* Поля */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 16px; font-weight: 600; color: var(--text); }
.field-label .opt { font-weight: 400; color: var(--muted); }
.field-hint { font-size: 15px; color: var(--muted); }
.input, .select, .textarea { width: 100%; min-height: var(--control); padding: 10px 14px; border: 1.5px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--text); font-family: inherit; font-size: 17px; line-height: 1.45; }
.textarea { min-height: 120px; resize: vertical; }
.select { padding-right: 12px; cursor: pointer; }
.input:hover, .select:hover, .textarea:hover { border-color: #7F8EA6; }
.input:focus, .select:focus, .textarea:focus { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--focus); }
.field.has-error .input, .field.has-error .textarea, .field.has-error .select { border-color: var(--err); background: #FFF8F9; }
.field-error { display: flex; gap: 8px; align-items: flex-start; color: var(--err); font-size: 15px; font-weight: 500; }
.field-error svg { flex: none; width: 18px; height: 18px; margin-top: 2px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 24px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 17px; cursor: pointer; padding: 12px 0; }
.check input { width: 24px; height: 24px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.search-box { position: relative; }
.search-box svg { position: absolute; left: 14px; top: 50%; width: 22px; height: 22px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-box .input { padding-left: 46px; }
.multi { display: flex; flex-direction: column; gap: 10px; }
.multi-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: 10px; align-items: start; }

/* Фильтры */
.filters { display: grid; grid-template-columns: minmax(0, 2fr) repeat(4, minmax(0, 1fr)); gap: 16px; align-items: end; padding: 24px; border-bottom: 1px solid var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--text-2); font-family: inherit; font-size: 16px; font-weight: 500; cursor: pointer; }
.chip.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-hover); font-weight: 650; }
.chip .chip-n { font-weight: 650; }
.result-bar { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between; padding: 16px 24px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.result-count { font-size: 18px; }
.result-count b { font-size: 22px; }
.active-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tag { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line-strong); font-size: 15px; }

/* Таблицы */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 16px; }
.table th { text-align: left; font-size: 15px; font-weight: 650; color: var(--text-2); padding: 14px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table th:first-child, .table td:first-child { padding-left: 24px; }
.table th:last-child, .table td:last-child { padding-right: 24px; }
.table tbody tr:hover { background: #F6F9FF; }
.table tr.is-overdue td { background: #fffbf0; }
.cell-title { font-weight: 650; color: var(--text); text-decoration: none; font-size: 17px; line-height: 1.4; }
a.cell-title:hover { color: var(--accent-hover); text-decoration: underline; }
.cell-sub { display: block; color: var(--muted); font-size: 15px; margin-top: 2px; }
.cell-actions { text-align: right; white-space: nowrap; }

/* Список-таблица на сетке (в Jinja можно использовать и <table class="table table-cards">) */
.gt { display: flex; flex-direction: column; }
.gt-row { display: grid; grid-template-columns: var(--cols, 2fr 1fr 1fr); gap: 8px 20px; padding: 16px 24px; border-bottom: 1px solid var(--line); align-items: start; font-size: 16px; }
.gt-row:last-child { border-bottom: 0; }
.gt-head { background: var(--surface-2); font-size: 15px; font-weight: 650; color: var(--text-2); padding-top: 14px; padding-bottom: 14px; }
.gt-body .gt-row:hover { background: #F6F9FF; }
.gt-row.is-last { background: var(--accent-soft); }
.gt-row.is-overdue { background: #fffbf0; }
.gt-cell { min-width: 0; overflow-wrap: anywhere; }
.link-btn { display: inline; padding: 0; margin: 0; border: 0; background: none; font-family: inherit; font-size: 17px; font-weight: 650; line-height: 1.4; color: var(--text); text-align: left; cursor: pointer; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 4px; }
.link-btn:hover { color: var(--accent-hover); text-decoration-color: currentColor; }
.eyebrow { font-size: 15px; font-weight: 600; color: var(--muted); }
.split-aside { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; padding: 24px; }
.aside-col { border-left: 1px solid var(--line); padding-left: 24px; }
@media (max-width: 767px) {
  .split-aside { grid-template-columns: minmax(0, 1fr); padding: 18px 16px; gap: 16px; }
  .aside-col { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 16px; }
}

/* Статусы: всегда текст + значок + цвет */
.status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px 3px 10px; border-radius: 999px; font-size: 15px; font-weight: 600; line-height: 1.5; border: 1px solid; white-space: nowrap; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.st-new { color: var(--info); background: var(--info-bg); border-color: var(--info-line); }
.st-work { color: #0B1F33; background: #E4EAF5; border-color: #AEBAD0; }
.st-wait { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }
.st-ok { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-line); }
.st-off { color: var(--text-2); background: #E9EEF6; border-color: #C9D3E3; }
.gt-cell .status { white-space: normal; max-width: 100%; }
.st-err { color: var(--err); background: var(--err-bg); border-color: var(--err-line); }

/* Уведомления */
.notice { display: flex; gap: 14px; align-items: flex-start; padding: 16px 20px; border-radius: var(--r); border: 1px solid; font-size: 17px; }
.notice svg { flex: none; width: 24px; height: 24px; margin-top: 1px; }
.notice-body { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.notice-title { font-weight: 650; }
.n-ok { background: var(--ok-bg); border-color: var(--ok-line); color: #0E3D22; }
.n-ok svg { color: var(--ok); }
.n-warn { background: var(--warn-bg); border-color: var(--warn-line); color: #4d3000; }
.n-warn svg { color: var(--warn); }
.n-err { background: var(--err-bg); border-color: var(--err-line); color: #6d140e; }
.n-err svg { color: var(--err); }
.n-info { background: var(--info-bg); border-color: var(--info-line); color: #12305a; }
.n-info svg { color: var(--info); }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 40; display: flex; gap: 12px; align-items: center; max-width: 440px; padding: 16px 20px; border-radius: var(--r); background: #0B1F33; color: #fff; font-size: 17px; box-shadow: 0 8px 28px rgba(0,0,0,.18); }
.toast svg { color: #8FC8F5; width: 24px; height: 24px; flex: none; }

/* Диалог */
.backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(11, 31, 51, .55); display: grid; place-items: center; padding: 16px; }
.dialog { width: 100%; max-width: 580px; max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border-radius: var(--r-lg); padding: 28px; display: flex; flex-direction: column; gap: 20px; box-shadow: 0 16px 48px rgba(0,0,0,.2); }
.dialog-wide { max-width: 860px; }
.dialog-actions { display: flex; flex-wrap: wrap-reverse; gap: 12px; justify-content: flex-end; }

/* Показатели на «Обзоре» */
.metric { display: flex; flex-direction: column; gap: 6px; padding: 22px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); text-decoration: none; color: var(--text); min-height: 168px; }
.metric:hover { border-color: var(--accent); color: var(--text); }
.metric-n { font-size: 44px; font-weight: 700; line-height: 1.1; }
.metric-label { font-size: 18px; font-weight: 650; }
.metric-hint { font-size: 15px; color: var(--muted); }
.metric-go { margin-top: auto; font-size: 16px; font-weight: 600; color: var(--accent); }
.metric.is-warn .metric-n { color: var(--warn); }

/* Списки */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; gap: 16px; align-items: flex-start; padding: 16px 24px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text); }
.list-row:last-child { border-bottom: 0; }
a.list-row:hover { background: #F6F9FF; }
.list-row .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--info); flex: none; margin-top: 9px; }
.kv { display: grid; grid-template-columns: minmax(150px, 220px) minmax(0, 1fr); gap: 12px 20px; margin: 0; }
.kv dt { color: var(--muted); font-size: 16px; }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

/* Пошаговые процессы */
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.step { display: flex; align-items: center; gap: 10px; padding: 8px 16px 8px 8px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 16px; color: var(--muted); }
.step-n { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: #E9EEF6; color: var(--text-2); flex: none; }
.step.is-current { border-color: var(--accent); color: var(--text); font-weight: 650; }
.step.is-current .step-n { background: var(--accent); color: #fff; }
.step.is-done { color: var(--text-2); }
.step.is-done .step-n { background: var(--accent-soft); color: var(--accent-hover); }
.progress { height: 12px; border-radius: 999px; background: #E1E8F4; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

/* Пагинация */
.pager { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; justify-content: space-between; padding: 16px 24px; border-top: 1px solid var(--line); }
.pager-pages { display: flex; flex-wrap: wrap; gap: 6px; }
.page-btn { min-width: 44px; min-height: 44px; border-radius: var(--r-sm); border: 1.5px solid var(--line-strong); background: var(--surface); font-family: inherit; font-size: 16px; font-weight: 600; color: var(--text); cursor: pointer; }
.page-btn.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Пустые и служебные состояния */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 48px 24px; }
.empty-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted); }
.empty-icon svg { width: 26px; height: 26px; }
.empty p { color: var(--text-2); max-width: 520px; }
.skel { background: #E4EAF5; border-radius: 6px; height: 18px; }

/* Письма и документы */
.mail-body { white-space: pre-wrap; font-family: inherit; font-size: 17px; line-height: 1.6; margin: 0; overflow-wrap: anywhere; }
.attach { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.attach-icon { width: 40px; height: 48px; border-radius: 6px; background: #fff; border: 1px solid var(--line-strong); display: grid; place-items: center; font-size: 13px; font-weight: 700; color: var(--err); flex: none; }
.doc-page { background: #fff; border: 1px solid var(--line-strong); border-radius: 4px; padding: 40px 44px; font-size: 15px; line-height: 1.5; color: #222; display: flex; flex-direction: column; gap: 14px; }
.doc-page table { width: 100%; border-collapse: collapse; font-size: 15px; }
.doc-page td, .doc-page th { border: 1px solid #c8c8c8; padding: 6px 8px; text-align: left; }
.history { display: flex; flex-direction: column; }
.history-item { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.history-item:last-child { border-bottom: 0; }
.dir { flex: none; font-size: 14px; font-weight: 650; padding: 2px 10px; border-radius: 6px; height: fit-content; }
.dir-in { background: var(--info-bg); color: var(--info); }
.dir-out { background: var(--ok-bg); color: var(--ok); }

/* Панель сохранения — не перекрывает поля: отступ снизу у формы */
.save-bar { position: sticky; bottom: 0; z-index: 10; display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; justify-content: space-between; padding: 16px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: 0 -4px 16px rgba(11,31,51,.06); }
.form-end-space { height: 8px; }

/* Планшет и небольшой ноутбук */
@media (max-width: 1279px) {
  .main { padding: 28px 28px 64px; }
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filters .f-search { grid-column: 1 / -1; }
  .cols-main { grid-template-columns: minmax(0, 1fr) 320px; }
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { border-right: 0; border-bottom: 1px solid var(--line); padding: 12px 16px; gap: 0; min-height: 0; }
  .side .menu-toggle { display: inline-flex; }
  .side .nav, .side .side-foot { display: none; }
  .side.is-open .nav { display: flex; padding-top: 12px; }
  .side.is-open .side-foot { display: flex; padding-top: 12px; margin-top: 12px; }
  .cols-main, .cols-2 { grid-template-columns: minmax(0, 1fr); }
  .cols-3 { grid-template-columns: minmax(0, 1fr); }
}
/* Телефон */
@media (max-width: 767px) {
  body { font-size: 17px; }
  h1 { font-size: 28px; }
  h2 { font-size: 20px; }
  .main { padding: 20px 16px 96px; }
  .pad, .panel-body { padding: 18px 16px; }
  .panel-head, .result-bar, .pager { padding: 16px; }
  .filters { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .form-grid, .cols-4 { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .kv dd { margin-bottom: 12px; }
  .multi-row { grid-template-columns: minmax(0, 1fr); }
  .actions .btn, .dialog-actions .btn { flex: 1 1 100%; }
  .page-head .actions { width: 100%; }
  /* Таблица превращается в карточки */
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards tr { padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .table-cards td { padding: 4px 0 !important; border: 0; }
  .table-cards td[data-label]::before { content: attr(data-label); display: block; font-size: 14px; color: var(--muted); font-weight: 600; }
  .table-cards .cell-actions { text-align: left; padding-top: 10px !important; }
  .gt-head { display: none; }
  .gt-row { grid-template-columns: minmax(0, 1fr); padding: 14px 16px; gap: 6px; }
  .gt-cell[data-label]::before { content: attr(data-label); display: block; font-size: 14px; color: var(--muted); font-weight: 600; }
  .toast { left: 16px; right: 16px; bottom: 16px; }
  .save-bar { padding: 12px 16px; border-radius: var(--r); }
  .save-bar .btn { flex: 1 1 auto; }
  .list-row { flex-wrap: wrap; padding: 14px 16px; }
  .list-row > .btn { flex: 1 1 100%; }
  .panel-head > .btn, .panel-head .actions { flex: 1 1 100%; }
}

/* Production integration: self-hosted font, native forms and real data. */
@font-face { font-family: 'Golos Text'; src: url('fonts/GolosText.ttf') format('truetype'); font-weight: 400 900; font-style: normal; font-display: swap; }
[hidden] { display: none !important; }
svg { width: 22px; height: 22px; flex: none; }
button, input, select, textarea { max-width: 100%; }
label { display: flex; flex-direction: column; gap: 7px; min-width: 0; font-size: 16px; font-weight: 600; }
label.check { flex-direction: row; font-weight: 400; }
select { min-width: 0; text-overflow: ellipsis; }
textarea { resize: vertical; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
summary { cursor: pointer; font-weight: 600; min-height: 44px; }
details[open] > summary { margin-bottom: 20px; }
.btn { white-space: normal; text-align: center; overflow-wrap: anywhere; }
.status { white-space: normal; max-width: 100%; color: var(--muted); background: var(--surface-2); border-color: var(--line); }
.status.new, .status.active, .status.in_progress, .status.sending { color: var(--info); background: var(--info-bg); border-color: var(--info-line); }
.status.warning, .status.waiting, .status.pending, .status.ready, .status.queued, .status.paused, .status.draft { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }
.status.won, .status.sent, .status.completed, .status.imported { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-line); }
.status.failed, .status.unknown { color: var(--err); background: var(--err-bg); border-color: var(--err-line); }
.page-head > div { min-width: 0; }
.page-head h1 { overflow-wrap: anywhere; }
.page-head p { margin-top: 8px; max-width: 860px; }
.eyebrow { display: block; margin-bottom: 6px; }
.pad > h2, .pad > h3 { margin-bottom: 18px; }
.pad > .between, .pad > p, .pad > dl, .pad > .mail-body { margin-bottom: 20px; }
.pad > :last-child { margin-bottom: 0; }
.pad.stack > h2 { margin-bottom: 0; }
.page-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 16px; color: var(--muted); font-size: 14px; }
.skip-link { position: absolute; top: -100px; left: 16px; z-index: 100; background: white; padding: 16px; }
.skip-link:focus { top: 16px; }
.full-width { width: 100%; }
.mailbox svg { margin-top: 3px; }
.mailbox span { min-width: 0; overflow-wrap: anywhere; }
.text-link { font-weight: 600; text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.chip, .tag { text-decoration: none; }
.heading-count { display: inline-flex; font-size: 20px; padding: 3px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); vertical-align: middle; }
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; padding: 24px; align-items: end; border-bottom: 1px solid var(--line); }
.toolbar .search { flex: 1 1 280px; }
.toolbar select { flex: 0 1 240px; }
.table { table-layout: fixed; }
.table th { white-space: normal; }
.table td { overflow-wrap: anywhere; }
.table td small, .table .cell-title { display: block; }
.table td small { margin-top: 3px; color: var(--muted); }
.table-wrap { border-radius: 0 0 var(--r-lg) var(--r-lg); }
.table:not(.table-cards) { table-layout: auto; }
.table:not(.table-cards) th, .table:not(.table-cards) td { min-width: 150px; }
.table tr.is-last { background: var(--accent-soft); outline: 2px solid var(--accent-line); outline-offset: -2px; }
.pager > div { display: flex; flex-wrap: wrap; gap: 8px; }
.edu-totals { display: flex; gap: 16px; flex-wrap: wrap; font-size: 15px; color: var(--muted); }
.edu-filters { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px; padding: 24px; align-items: end; }
.edu-search { grid-column: 1 / -1; }
.edu-filter-actions { display: flex; flex-wrap: wrap; gap: 12px; grid-column: 1 / -1; }
.edu-meta { display: flex; flex-wrap: wrap; gap: 8px 24px; color: var(--muted); font-size: 15px; }
.edu-raw { white-space: pre-line; }
.edu-detail-title { font-size: 28px; }
.edu-history > div { padding: 12px 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; }
.edu-history small { color: var(--muted); }
.connection-row { display: flex; gap: 12px; }
.connection-row div { min-width: 0; }
.connection-row small { display: block; margin-top: 4px; }
.connection-row svg { color: var(--accent); margin-top: 3px; }
.list-row, .history-entry, .message-text, .mail-body { overflow-wrap: anywhere; }
.list-row .status { flex: 0 1 auto; }
.message-text { white-space: pre-line; margin: 20px 0; }
.history-entry { display: block; padding: 18px 0; text-decoration: none; color: var(--text); border-bottom: 1px solid var(--line); }
.history-entry p { margin: 8px 0; color: var(--muted); }
.source-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; align-items: center; }
.button-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; align-items: center; }
.row select { width: auto; flex: 1 1 160px; }
.lead-card > h2 { margin: 14px 0 8px; }
.lead-card > .text-link { display: inline-block; margin-top: 16px; }
.mail-footer { padding-top: 16px; margin-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 15px; }
.bounded-table { max-height: 600px; overflow: auto; }
.campaign-guide { display: flex; flex-direction: column; gap: 20px; align-self: start; }
.campaign-guide h2 { margin-bottom: 0; }
.rule { display: flex; flex-direction: column; gap: 3px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.rule strong { font-size: 26px; }
.rule span { font-size: 15px; color: var(--muted); }
.file-field { padding: 24px; border: 2px dashed var(--accent-line); background: var(--surface-2); border-radius: var(--r); align-items: center; text-align: center; font-weight: 400; }
.file-field input { background: var(--surface); padding: 8px; font-size: 15px; }
.instruction-list { padding-left: 24px; display: flex; flex-direction: column; gap: 20px; margin: 24px 0; }
.instruction-list p { color: var(--muted); font-size: 16px; margin-top: 6px; }
.notice { flex-wrap: wrap; overflow-wrap: anywhere; }
.auth-body { min-height: 100dvh; display: grid; place-items: center; padding: 32px 16px; }
.auth-card { width: min(100%,600px); padding: 36px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); display: flex; flex-direction: column; gap: 24px; }
.auth-card .brand { padding: 0; }
.login-command { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); }
.login-command code { font-size: 20px; overflow-wrap: anywhere; }
.login-status { font-size: 16px; color: var(--accent); font-weight: 600; }
.public-brand { padding: 24px; }
.unsaved-dialog { color: var(--text); font: inherit; width: min(580px,calc(100% - 32px)); max-height: calc(100dvh - 32px); padding: 28px; border: 1px solid var(--line); border-radius: var(--r-lg); }
.unsaved-dialog::backdrop { background: rgba(11,31,51,.55); }
.form-error { scroll-margin-top: 24px; }
form[aria-busy="true"] { cursor: progress; }
@media(min-width:1024px) { .side { align-self: stretch; } }
@media(max-width:1279px) { .edu-filters { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media(max-width:1023px) { html:not([data-ui-ready]) .side .nav { display: flex; } .side-foot { margin-top: 12px; } }
@media(max-width:767px) {
 .main { padding: 20px 16px 48px; }
 .side-top .brand { gap: 8px; padding: 0; }
 .brand-name { font-size: 17px; }
 .brand-sub { font-size: 12px; }
 .brand-mark { width: 36px; height: 36px; }
 .menu-toggle { padding: 8px 10px; gap: 6px; }
 .side-top { gap: 8px; }
 .table, .table-cards { table-layout: auto; }
 .edu-filters { grid-template-columns: minmax(0,1fr); padding: 16px; }
 .edu-detail-title { font-size: 26px; }
 .edu-filter-actions > *, .button-row > *, .toolbar > * { flex: 1 1 100%; }
 .button-row form .btn { width: 100%; }
 .toolbar { padding: 16px; }
 .toolbar select { flex-basis: 100%; }
 .toolbar .search { flex-basis: 100%; }
 .auth-card { padding: 24px 20px; }
 .login-command { padding: 12px; }
 .login-command .btn { width: 100%; }
 .form-grid { gap: 18px; }
 .metric { min-height: 154px; }
 .save-bar { position: static; }
 .kv { overflow-wrap: anywhere; }
 .file-field { padding: 20px 12px; }
 .file-field input { width: 100%; }
 .unsaved-dialog { padding: 24px 20px; }
}

@media(min-width:768px) { .education-table th:nth-child(1) { width: 36%; } .education-table th:nth-child(2) { width: 21%; } .education-table th:nth-child(3) { width: 27%; } .education-table th:nth-child(4) { width: 16%; } }
.edu-totals { flex-basis: 100%; }

/* Campaign composer: large controls, explicit steps, wrap at phone widths. */
.campaign-layout{display:grid;grid-template-columns:minmax(0,1fr) 310px;gap:24px;align-items:start}
.campaign-layout .campaign-guide{position:sticky;top:24px}
.compose-block{border:1px solid var(--line,#d4dfee);border-radius:14px;padding:20px;min-width:0;display:grid;gap:14px;margin:0}
.compose-block legend{padding:0 8px;font-size:20px;font-weight:650;color:#0b1f33;max-width:100%}
.step-dot{display:inline-grid;place-items:center;width:30px;height:30px;background:#edf2fe;border-radius:50%;color:#0066b3;margin-right:5px;font-size:17px}
.choice-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,220px),1fr));gap:12px;margin-top:10px}
.choice-grid .check{min-height:48px;padding:8px;border-radius:8px;background:#f7f9fe;align-items:center}
.multi-picker{border:1px solid #a4b4cc;border-radius:10px;padding:14px}
.multi-picker summary{font-weight:600;cursor:pointer;min-height:24px}
.field-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-top:8px}
.field-heading label,.field-label{font-weight:600}
.field-hint{font-size:15px;line-height:1.55;color:#52627a;margin:0}
.ai-result{padding:16px;border:1px solid #8eb5d4;background:#f2f7fc;border-radius:12px}
.signature-editor{padding:16px;background:#f5f7fc;border-radius:10px}
.signature-editor summary{font-weight:600;cursor:pointer;margin-bottom:8px}
.material-choice{padding:12px;background:#f7f9fe;border-radius:10px;align-items:start;overflow-wrap:anywhere}
.material-choice span{min-width:0}.material-choice small{display:block;color:#52627a;margin-top:4px}
.file-input{height:auto;min-height:48px;padding:10px;max-width:100%;font-size:15px}
.file-input::file-selector-button{min-height:36px;background:#edf2fe;border:1px solid #a4b4cc;border-radius:6px;margin-right:10px;color:#0b1f33;font:inherit}
.attachment-preview{border-top:1px solid #d4dfee;margin-top:20px;padding-top:16px;overflow-wrap:anywhere}
.campaign-composer{min-width:0}.campaign-composer [hidden]{display:none!important}
@media(max-width:1100px){.campaign-layout{grid-template-columns:minmax(0,1fr)}.campaign-layout .campaign-guide{position:static;order:-1}}
@media(max-width:600px){.compose-block{padding:12px}.compose-block legend{font-size:18px}.field-heading{align-items:stretch}.field-heading .btn{width:100%}.campaign-composer .choice-grid{grid-template-columns:1fr}.campaign-layout{gap:16px}}
