/* ============================================================================
   МТО · ГСП Ремонт — дизайн-система
   Палитра: глубокий графитово-синий + тёплая бумага + сдержанный терракотовый
   ========================================================================== */

:root {
  --navy-900: #0e2233;
  --navy-800: #13293d;
  --navy-700: #1b3a52;
  --navy-600: #24486a;
  --steel: #2e5266;
  --accent: #d66a2f;
  --accent-strong: #b8531d;
  --accent-soft: #f9e9dd;
  --paper: #f6f4ef;
  --surface: #ffffff;
  --surface-soft: #faf9f6;
  --line: #e3dfd6;
  --line-strong: #cfc9bc;
  --ink: #1f2933;
  --ink-soft: #46535e;
  --muted: #75818b;
  --success: #2e7d4f;
  --success-soft: #e4f2e9;
  --warning: #a86412;
  --warning-soft: #fdf1dd;
  --danger: #b03434;
  --danger-soft: #fbe9e7;
  --info: #2b6a94;
  --info-soft: #e6f0f7;
  --radius-s: 8px;
  --radius-m: 12px;
  --radius-l: 16px;
  --shadow-s: 0 1px 2px rgba(19, 41, 61, 0.06), 0 1px 6px rgba(19, 41, 61, 0.05);
  --shadow-m: 0 4px 14px rgba(19, 41, 61, 0.1);
  --shadow-l: 0 16px 44px rgba(14, 34, 51, 0.22);
  --font: "Inter", "Segoe UI", -apple-system, "PT Sans", "Roboto", sans-serif;
  --sidebar-width: 252px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; color: var(--ink); }
h1 { font-size: 21px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0; }
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
small { color: var(--muted); }
::selection { background: rgba(214, 106, 47, 0.22); }

/* --------------------------------------------------------------------------
   Каркас приложения
   -------------------------------------------------------------------------- */

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--navy-900) 0%, var(--navy-800) 100%);
  color: #cfdbe5;
  padding: 20px 14px 16px;
  z-index: 60;
  overflow-y: auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 10px 18px;
  color: #fff;
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand img { width: 38px; height: 38px; border-radius: 9px; }
.brand strong { display: block; font-size: 15px; letter-spacing: 0.04em; }
.brand small { display: block; font-size: 10px; letter-spacing: 0.14em; color: #7f97a8; }

.nav-caption {
  display: block;
  margin: 18px 12px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #64809a;
}
.main-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.main-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 9px;
  color: #b9c9d6;
  font-weight: 500;
  font-size: 13.5px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.main-nav a:hover { background: rgba(255, 255, 255, 0.07); color: #fff; text-decoration: none; }
.main-nav a.active {
  background: linear-gradient(90deg, rgba(214, 106, 47, 0.24), rgba(214, 106, 47, 0.1));
  color: #fff;
  box-shadow: inset 2px 0 0 var(--accent);
}
.nav-icon { width: 19px; height: 19px; stroke: currentColor; stroke-width: 1.7; fill: none; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav-count {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 99px;
  padding: 1px 8px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: #d9e3ea;
  text-decoration: none;
}
.sidebar-user:hover { background: rgba(255, 255, 255, 0.1); text-decoration: none; }
.sidebar-user strong { display: block; font-size: 13px; color: #fff; }
.sidebar-user small { display: block; font-size: 11px; color: #8ba1b1; }
.sidebar-user-arrow { margin-left: auto; color: #6d8496; }

.page-shell { flex: 1; margin-left: var(--sidebar-width); display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 30px 14px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-title .eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}
.topbar-title p:not(.eyebrow) { color: var(--muted); font-size: 13px; }
.topbar-tools { display: flex; align-items: center; gap: 14px; }

.testmode-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 30px;
  background: repeating-linear-gradient(
    -45deg, #8a4b12, #8a4b12 14px, #96581f 14px, #96581f 28px
  );
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}
.testmode-banner b { text-transform: uppercase; letter-spacing: 0.06em; font-size: 12px; }
.testmode-banner span { opacity: 0.92; font-weight: 500; }

.page-content { padding: 24px 30px 56px; display: flex; flex-direction: column; gap: 20px; max-width: 1560px; width: 100%; }

.menu-toggle { display: none; }
.sidebar-backdrop { display: none; }

/* Меню пользователя */
.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 6px 10px; border-radius: 10px; border: 1px solid transparent; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { background: var(--surface); border-color: var(--line); }
.user-menu summary strong { display: block; font-size: 13px; }
.user-menu summary small { display: block; font-size: 11px; color: var(--muted); }
.user-menu-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 260px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-l);
  padding: 14px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.user-menu-popover > div { display: flex; flex-direction: column; align-items: center; gap: 2px; padding-bottom: 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.user-menu-popover a { padding: 8px 10px; border-radius: 8px; color: var(--ink-soft); display: flex; justify-content: space-between; }
.user-menu-popover a:hover { background: var(--surface-soft); text-decoration: none; }
.user-menu-popover form button {
  width: 100%;
  margin-top: 4px;
  padding: 9px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--danger);
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.user-menu-popover form button:hover { background: var(--danger-soft); border-color: #e2b8b2; }

.avatar {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--steel), var(--navy-700));
  color: #fff; font-weight: 700; font-size: 14px;
  flex: none;
}
.avatar.large { width: 48px; height: 48px; font-size: 18px; }

/* --------------------------------------------------------------------------
   Панели и карточки
   -------------------------------------------------------------------------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-s);
  padding: 22px 24px;
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}
.panel-head .head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.section-kicker {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-strong);
  margin-bottom: 3px;
}
.counter {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  border-radius: 99px;
  padding: 3px 12px;
  font-size: 12.5px;
  font-weight: 650;
}

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

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 9px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.14s, box-shadow 0.14s, border-color 0.14s, transform 0.05s;
  white-space: nowrap;
}
.button:hover { text-decoration: none; }
.button:active { transform: translateY(1px); }
.button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.button.primary { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(214, 106, 47, 0.3); }
.button.primary:hover { background: var(--accent-strong); }
.button.secondary { background: var(--navy-800); color: #fff; }
.button.secondary:hover { background: var(--navy-700); }
.button.outline { background: var(--surface); color: var(--ink-soft); border-color: var(--line-strong); }
.button.outline:hover { border-color: var(--steel); color: var(--navy-800); background: var(--surface-soft); }
.button.ghost { background: transparent; color: var(--ink-soft); }
.button.ghost:hover { background: rgba(19, 41, 61, 0.06); }
.button.danger { background: transparent; color: var(--danger); border-color: #e0b6b0; }
.button.danger:hover { background: var(--danger-soft); }
.button.danger-fill { background: var(--danger); color: #fff; }
.button.danger-fill:hover { background: #9c2b2b; }
.button.small { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.button.wide { width: 100%; }
.button[disabled] { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

.icon-button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  font: inherit;
  font-size: 15px;
  text-decoration: none;
}
.icon-button:hover { border-color: var(--steel); color: var(--navy-800); text-decoration: none; }
.icon-button.danger:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }

.text-link { font-weight: 600; font-size: 13px; }

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

/* Подпись поля: текст, звёздочка и уточнение — в одной строке; поле — на новой */
label {
  display: flex;
  flex-flow: row wrap;
  align-items: baseline;
  gap: 5px 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
}
label small { font-weight: 400; }
label > input,
label > select,
label > textarea,
label > .password-field { flex: 1 1 100%; }
label > small,
label > .field-hint,
label > datalist { flex-basis: 100%; }
label > .required { margin-left: -2px; }
input, select, textarea {
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  transition: border-color 0.14s, box-shadow 0.14s;
  width: 100%;
}
input:hover, select:hover, textarea:hover { border-color: #b4ad9d; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(214, 106, 47, 0.15);
}
input::placeholder, textarea::placeholder { color: #a7b0b8; }
input[disabled] { background: var(--surface-soft); color: var(--muted); }
textarea { resize: vertical; min-height: 64px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2375818b' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

.form-grid { display: grid; gap: 14px 16px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.required { color: var(--danger); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.check-label { flex-direction: row; align-items: center; gap: 9px; font-weight: 500; font-size: 13.5px; color: var(--ink); }
.check-label input { width: 17px; height: 17px; accent-color: var(--accent); padding: 0; }

.field-hint { font-size: 12px; color: var(--muted); font-weight: 400; }

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

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-m); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; background: var(--surface); }
thead th {
  position: sticky; top: 0;
  background: var(--surface-soft);
  color: var(--muted);
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  z-index: 2;
}
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fbfaf7; }
td small { display: block; margin-top: 2px; font-size: 12px; }
td.numeric, th.numeric { text-align: right; font-variant-numeric: tabular-nums; }
.table-link { font-weight: 650; color: var(--navy-800); }
.table-link:hover { color: var(--accent-strong); }

/* --------------------------------------------------------------------------
   Статусы и бейджи
   -------------------------------------------------------------------------- */

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 11px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--ink-soft);
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.draft, .status.preparation, .status.suppliers { color: var(--muted); }
.status.ready, .status.awaiting_confirmation, .status.info { color: var(--info); background: var(--info-soft); border-color: #c4dcec; }
.status.sending, .status.queued { color: var(--warning); background: var(--warning-soft); border-color: #ecd4ab; }
.status.sent, .status.sent_to_server, .status.completed, .status.success, .status.ok { color: var(--success); background: var(--success-soft); border-color: #bfdfca; }
.status.waiting_responses, .status.partial_responses, .status.partially_sent { color: var(--warning); background: var(--warning-soft); border-color: #ecd4ab; }
.status.error, .status.temporary_error, .status.has_errors, .status.cancelled, .status.undelivered, .status.overdue { color: var(--danger); background: var(--danger-soft); border-color: #ecc5bf; }
.status.archived { color: var(--muted); }
.status.redirected { color: #8a4b12; background: var(--accent-soft); border-color: #ecd0b8; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 650;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  white-space: nowrap;
}
.badge.high { background: var(--danger-soft); border-color: #ecc5bf; color: var(--danger); }
.badge.medium { background: var(--warning-soft); border-color: #ecd4ab; color: var(--warning); }
.badge.low { color: var(--muted); }
.badge.accent { background: var(--accent-soft); border-color: #ecd0b8; color: var(--accent-strong); }
.badge.success { background: var(--success-soft); border-color: #bfdfca; color: var(--success); }
.badge.info { background: var(--info-soft); border-color: #c4dcec; color: var(--info); }

.category-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.category-chips span {
  background: var(--info-soft);
  color: var(--info);
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
}
.category-chips .more { background: var(--surface-soft); color: var(--muted); border: 1px dashed var(--line-strong); }

/* --------------------------------------------------------------------------
   Уведомления
   -------------------------------------------------------------------------- */

.flash {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-m);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-s);
  font-size: 13.5px;
  font-weight: 500;
}
.flash.success { border-color: #bfdfca; background: var(--success-soft); color: #1f5c39; }
.flash.error { border-color: #ecc5bf; background: var(--danger-soft); color: #8c2626; }
.flash.warning { border-color: #ecd4ab; background: var(--warning-soft); color: #7c4a0c; }
.flash.info { border-color: #c4dcec; background: var(--info-soft); color: #205577; }
.flash button { background: none; border: none; font-size: 18px; cursor: pointer; color: inherit; opacity: 0.6; padding: 0 2px; }
.flash button:hover { opacity: 1; }

.notice {
  border: 1px solid var(--line);
  border-left: 3px solid var(--steel);
  background: var(--surface-soft);
  border-radius: var(--radius-s);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--ink-soft);
}
.notice strong { color: var(--ink); display: block; margin-bottom: 2px; }
.notice.warning { border-left-color: var(--warning); background: var(--warning-soft); }
.notice.danger { border-left-color: var(--danger); background: var(--danger-soft); }
.notice.success { border-left-color: var(--success); background: var(--success-soft); }

.empty-state {
  text-align: center;
  padding: 44px 24px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.empty-state strong { color: var(--ink-soft); font-size: 15px; }
.empty-state .button { margin-top: 10px; }
.empty-state.compact { padding: 26px 18px; }

/* --------------------------------------------------------------------------
   Диалоги
   -------------------------------------------------------------------------- */

dialog {
  border: none;
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-l);
  padding: 26px 28px;
  width: min(720px, calc(100vw - 40px));
  max-height: calc(100vh - 60px);
  overflow-y: auto;
}
dialog::backdrop { background: rgba(14, 34, 51, 0.55); backdrop-filter: blur(2px); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
dialog.narrow { width: min(480px, calc(100vw - 40px)); }

/* --------------------------------------------------------------------------
   Фильтры и панели действий
   -------------------------------------------------------------------------- */

.action-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.filter-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-bar input, .filter-bar select { width: auto; min-width: 150px; }
.filter-bar input[name="q"] { min-width: 260px; }

.filter-panel { display: flex; flex-direction: column; gap: 12px; }
.filter-panel .filter-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filter-panel .filter-row label { min-width: 150px; flex: 1; max-width: 230px; }
.filter-toggles { display: flex; gap: 10px; flex-wrap: wrap; }

.chip-toggle { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); border-radius: 99px; padding: 5px 13px; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); cursor: pointer; background: var(--surface); flex-direction: row; }
.chip-toggle:hover { border-color: var(--steel); }
.chip-toggle input { display: none; }
.chip-toggle:has(input:checked) { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.pagination .pages { display: flex; gap: 4px; flex-wrap: wrap; }
.pagination a, .pagination span.current {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px; padding: 0 8px;
  border-radius: 8px; border: 1px solid var(--line);
  font-size: 13px; font-weight: 600; color: var(--ink-soft);
  background: var(--surface);
}
.pagination a:hover { border-color: var(--steel); text-decoration: none; }
.pagination span.current { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }
.pagination .range { font-size: 12.5px; color: var(--muted); }

/* --------------------------------------------------------------------------
   Метрики рабочего стола
   -------------------------------------------------------------------------- */

.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.metric-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  padding: 18px 20px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow-s);
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s;
}
.metric-card:hover { box-shadow: var(--shadow-m); border-color: var(--line-strong); transform: translateY(-1px); text-decoration: none; }
.metric-icon {
  width: 44px; height: 44px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: var(--info-soft); color: var(--info);
}
.metric-card.warning .metric-icon { background: var(--warning-soft); color: var(--warning); }
.metric-card.success .metric-icon { background: var(--success-soft); color: var(--success); }
.metric-card.accent .metric-icon { background: var(--accent-soft); color: var(--accent-strong); }
.metric-icon svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.metric-copy { flex: 1; min-width: 0; }
.metric-label { display: block; font-size: 13px; font-weight: 650; }
.metric-copy small { font-size: 12px; }
.metric-card > strong { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }

.workspace-hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
  background: linear-gradient(120deg, var(--navy-900), var(--navy-700) 75%);
  border-radius: var(--radius-l);
  padding: 30px 32px;
  color: #dbe6ee;
  box-shadow: var(--shadow-m);
}
.workspace-hero h2 { color: #fff; font-size: 24px; margin: 6px 0 8px; }
.workspace-hero .section-kicker { color: #e8a06c; }
.workspace-meta { display: flex; gap: 18px; margin-top: 16px; font-size: 13px; color: #9fb4c2; flex-wrap: wrap; }
.quick-actions { display: flex; flex-direction: column; gap: 8px; }
.quick-actions .section-kicker { color: #e8a06c; }
.quick-action {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 11px 16px;
  color: #eaf1f5;
  text-decoration: none;
  transition: background 0.15s;
}
.quick-action:hover { background: rgba(255, 255, 255, 0.13); text-decoration: none; }
.quick-action span:first-child { font-size: 17px; }
.quick-action strong { display: block; font-size: 13.5px; }
.quick-action small { color: #9fb4c2; font-size: 12px; }
.quick-action b { margin-left: auto; color: #7f97a8; }
.quick-action.primary { background: var(--accent); border-color: var(--accent); }
.quick-action.primary small { color: #f7d8c2; }
.quick-action.primary:hover { background: var(--accent-strong); }

.dashboard-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; align-items: start; }

/* --------------------------------------------------------------------------
   Адресная книга
   -------------------------------------------------------------------------- */

.supplier-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.supplier-card {
  display: flex;
  flex-direction: column;
  gap: 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  padding: 18px;
  box-shadow: var(--shadow-s);
  transition: box-shadow 0.15s, border-color 0.15s;
  position: relative;
}
.supplier-card:hover { box-shadow: var(--shadow-m); border-color: var(--line-strong); }
.supplier-card.archived { opacity: 0.65; background: var(--surface-soft); }
.supplier-card header { display: flex; gap: 12px; align-items: flex-start; }
.supplier-card header > div { min-width: 0; flex: 1; }
.supplier-card h3 a { color: var(--ink); }
.supplier-card h3 a:hover { color: var(--accent-strong); text-decoration: none; }
.supplier-card header p { font-size: 12px; color: var(--muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.supplier-logo {
  width: 46px; height: 46px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--steel);
  font-weight: 700;
  font-size: 15px;
  overflow: hidden;
}
.supplier-logo img { width: 100%; height: 100%; object-fit: contain; padding: 4px; background: #fff; }
.supplier-logo.large { width: 72px; height: 72px; border-radius: 16px; font-size: 22px; }

.supplier-meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; }
.supplier-meta span { display: flex; flex-direction: column; }
.supplier-meta small { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; }

.supplier-contact-line { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.supplier-contact-line a { color: var(--ink-soft); display: inline-flex; align-items: center; gap: 6px; overflow-wrap: anywhere; }
.supplier-contact-line a:hover { color: var(--navy-800); }
.supplier-card footer { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.supplier-card footer form { margin-left: auto; }

.copy-value { display: inline-flex; align-items: center; gap: 6px; }
.copy-value button {
  background: none; border: none; cursor: pointer; color: var(--muted);
  font-size: 13px; padding: 2px; border-radius: 4px;
}
.copy-value button:hover { color: var(--accent-strong); background: var(--accent-soft); }

/* Карточка поставщика */
.supplier-hero { display: flex; gap: 20px; align-items: flex-start; }
.supplier-hero .info { flex: 1; min-width: 0; }
.supplier-hero h2 { font-size: 20px; margin-bottom: 4px; }
.supplier-hero .sub { color: var(--muted); font-size: 13px; }
.supplier-hero .head-badges { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 24px; }
.detail-grid dl { margin: 0; }
.detail-grid dt { font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
.detail-grid dd { margin: 0; font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.detail-grid dl.wide { grid-column: 1 / -1; }

.contact-list { display: flex; flex-direction: column; gap: 8px; }
.contact-row {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 13px;
  font-size: 13.5px;
  background: var(--surface-soft);
  flex-wrap: wrap;
}
.contact-row .primary-mark { color: var(--accent-strong); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.contact-row .spacer { flex: 1; }

/* --------------------------------------------------------------------------
   Импорт
   -------------------------------------------------------------------------- */

.import-dropzone {
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius-l);
  padding: 36px;
  text-align: center;
  background: var(--surface-soft);
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}
.import-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.import-stat {
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--surface);
  padding: 12px 14px;
  text-align: center;
}
.import-stat strong { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.import-stat small { font-size: 11.5px; }
.import-stat.create strong { color: var(--success); }
.import-stat.update strong { color: var(--info); }
.import-stat.manual strong { color: var(--warning); }
.import-stat.error strong { color: var(--danger); }

.import-tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.import-tabs a {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.import-tabs a:hover { color: var(--ink); text-decoration: none; }
.import-tabs a.active { color: var(--accent-strong); border-bottom-color: var(--accent); }

.progress-track { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.progress-track i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-strong)); transition: width 0.4s; }

/* --------------------------------------------------------------------------
   Запросы
   -------------------------------------------------------------------------- */

.stepper { display: flex; gap: 4px; flex-wrap: wrap; }
.stepper span {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  border-radius: 99px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}
.stepper span b {
  width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--line);
  color: var(--ink-soft);
  font-size: 11px;
}
.stepper span.active { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); }
.stepper span.active b { background: var(--accent); color: #fff; }
.stepper span.done { color: var(--success); border-color: #bfdfca; }
.stepper span.done b { background: var(--success); color: #fff; }

.request-summary {
  display: flex; justify-content: space-between; gap: 18px;
  background: linear-gradient(120deg, var(--navy-900), var(--navy-700));
  border-radius: var(--radius-l);
  padding: 24px 28px;
  color: #d7e2ea;
  flex-wrap: wrap;
}
.request-summary h2 { color: #fff; margin: 8px 0 4px; font-size: 20px; }
.request-summary p { color: #9fb4c2; font-size: 13px; }
.request-summary .summary-dates { display: flex; gap: 26px; align-items: flex-start; flex-wrap: wrap; }
.request-summary .summary-dates span { display: flex; flex-direction: column; gap: 2px; max-width: 320px; }
.request-summary .summary-dates small { font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: #8ba1b1; }
.request-summary .summary-dates strong { color: #fff; font-size: 14px; }

.section-tabs { display: flex; gap: 2px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 5px; position: sticky; top: 10px; z-index: 30; box-shadow: var(--shadow-s); }
.section-tabs a {
  padding: 7px 13px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}
.section-tabs a:hover { background: var(--surface-soft); text-decoration: none; }
.section-tabs a b { font-weight: 700; color: var(--muted); margin-left: 3px; }

.workflow-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.workflow-step {
  display: flex; gap: 10px; align-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-m);
  padding: 12px 14px;
  color: var(--ink-soft);
  text-decoration: none;
}
.workflow-step:hover { border-color: var(--line-strong); text-decoration: none; }
.workflow-step b {
  width: 26px; height: 26px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--line);
  font-size: 12px;
  color: var(--ink-soft);
}
.workflow-step small { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.workflow-step strong { display: block; font-size: 12.5px; color: var(--ink); }
.workflow-step.done { border-color: #bfdfca; background: #f4faf6; }
.workflow-step.done b { background: var(--success); color: #fff; }
.workflow-step.current { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(214, 106, 47, 0.12); }
.workflow-step.current b { background: var(--accent); color: #fff; }

.items-table td input, .items-table td select { padding: 6px 9px; font-size: 13px; }

.mail-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--surface);
  overflow: hidden;
}
.mail-cards { display: flex; flex-direction: column; gap: 10px; }
.mail-card summary {
  list-style: none;
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px;
  cursor: pointer;
}
.mail-card summary::-webkit-details-marker { display: none; }
.mail-card summary:hover { background: var(--surface-soft); }
.mail-card summary .who { flex: 1; min-width: 0; }
.mail-card summary strong { display: block; font-size: 13.5px; }
.mail-card summary small { font-size: 12px; overflow-wrap: anywhere; }
.mail-card .mail-body { border-top: 1px solid var(--line); padding: 16px; display: flex; flex-direction: column; gap: 12px; background: var(--surface-soft); }
.mail-card pre {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 13.5px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  margin: 0;
  max-height: 420px;
  overflow-y: auto;
}
.attachment-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.attachment-chips span, .attachment-chips a {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
}
.inline-error { background: var(--danger-soft); border: 1px solid #ecc5bf; color: #8c2626; border-radius: 8px; padding: 8px 12px; font-size: 12.5px; }

.recommendation-list { display: flex; flex-direction: column; gap: 10px; }
.recommendation-row { display: flex; gap: 14px; align-items: flex-start; border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px 16px; background: var(--surface); }
.recommendation-row:hover { border-color: var(--line-strong); }
.recommendation-row .score {
  width: 46px; height: 46px; flex: none;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
  background: var(--success-soft); color: var(--success);
}
.recommendation-row .score.mid { background: var(--warning-soft); color: var(--warning); }
.recommendation-row .score.low { background: var(--surface-soft); color: var(--muted); }
.recommendation-row .r-body { flex: 1; min-width: 0; }
.recommendation-row .r-reason { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.recommendation-row .r-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }

.document-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.document-card {
  display: flex; gap: 11px; align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 11px 13px;
  background: var(--surface);
}
.document-card.blocked { background: var(--danger-soft); border-color: #ecc5bf; }
.document-card > span:nth-child(2) { flex: 1; min-width: 0; }
.document-card strong { display: block; font-size: 12.5px; overflow-wrap: anywhere; }
.document-card em { display: block; font-size: 11.5px; color: var(--danger); font-style: normal; }
.file-icon {
  width: 40px; height: 40px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: 9px;
  background: var(--navy-800);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.upload-strip { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border: 1px dashed var(--line-strong); border-radius: var(--radius-m); padding: 13px 16px; margin-top: 12px; background: var(--surface-soft); }
.upload-strip input[type="file"] { width: auto; border: none; background: transparent; padding: 4px 0; }
.upload-strip > div { flex: 1; min-width: 200px; }
.upload-strip strong { display: block; }
.upload-strip small { display: block; margin-top: 2px; }

/* Пример формата для массовой вставки */
.paste-example {
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--surface);
  padding: 14px 16px;
  margin: 14px 0;
}
.paste-example table {
  width: auto; min-width: 60%;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  margin: 8px 0 10px;
  font-size: 12.5px;
}
.paste-example th { padding: 7px 14px; font-size: 10.5px; }
.paste-example td { padding: 7px 14px; border-bottom: 1px solid var(--line); font-family: Consolas, "Cascadia Mono", monospace; font-size: 12px; color: var(--ink-soft); }
.paste-example tr:last-child td { border-bottom: none; }
.paste-example small { display: block; color: var(--muted); }
.paste-example small a { font-weight: 650; }

.split-actions { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; margin-top: 16px; flex-wrap: wrap; }
.confirm-send { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.confirm-send label { min-width: 240px; }

.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline > div { position: relative; padding: 0 0 18px 24px; }
.timeline > div::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: -2px; width: 2px; background: var(--line); }
.timeline > div:last-child::before { display: none; }
.timeline-dot { position: absolute; left: 0; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 3px solid var(--steel); }
.timeline time { font-size: 11.5px; color: var(--muted); display: block; }
.timeline strong { font-size: 13px; }
.timeline p { font-size: 12.5px; color: var(--muted); }

/* --------------------------------------------------------------------------
   Входящие
   -------------------------------------------------------------------------- */

.inbox-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.inbox-tabs a { padding: 8px 13px; font-size: 13px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.inbox-tabs a:hover { color: var(--ink); text-decoration: none; }
.inbox-tabs a.active { color: var(--accent-strong); border-bottom-color: var(--accent); }

.inbox-list, .mail-list { display: flex; flex-direction: column; }
.inbox-row, .mail-row {
  display: flex; align-items: center; gap: 13px;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}
.inbox-row:hover, .mail-row:hover { background: var(--surface-soft); text-decoration: none; }
.inbox-row:last-child, .mail-row:last-child { border-bottom: none; }
.inbox-row.unread strong, .mail-row.unread strong { font-weight: 700; }
.inbox-row.unread { box-shadow: inset 3px 0 0 var(--accent); }
.sender-avatar {
  width: 36px; height: 36px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--info-soft);
  color: var(--info);
  font-weight: 700;
}
.sender-avatar.large { width: 48px; height: 48px; font-size: 18px; }
.inbox-sender { width: 190px; flex: none; min-width: 0; }
.inbox-sender strong, .inbox-subject strong { display: block; font-size: 13.5px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-sender small, .inbox-subject small { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-subject { flex: 1; min-width: 0; }
.inbox-class { width: 200px; flex: none; font-size: 12px; }
.inbox-class b { display: block; font-weight: 650; }
.inbox-row time, .mail-row time { flex: none; text-align: right; font-size: 12px; color: var(--muted); }
.mail-summary { flex: 1; min-width: 0; }
.mail-summary strong, .mail-summary b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.mail-summary b { font-weight: 550; }
.attachment-count { flex: none; font-size: 12px; color: var(--muted); }

.connection-bar {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--surface);
  padding: 10px 16px;
  font-size: 13px;
  flex-wrap: wrap;
}
.connection-bar > span:first-child { width: 9px; height: 9px; border-radius: 50%; background: var(--success); }
.connection-bar.error > span:first-child { background: var(--danger); }
.connection-bar em { color: var(--danger); font-style: normal; font-size: 12px; }

.message-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 16px; }
.message-head h2 { font-size: 17px; }
.message-body pre { white-space: pre-wrap; font-family: inherit; font-size: 14px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin: 0; }
.inbox-detail-grid { display: grid; grid-template-columns: 1.7fr 1fr; gap: 20px; align-items: start; }
.review-sidebar { display: flex; flex-direction: column; gap: 14px; }
.confidence { display: flex; gap: 12px; align-items: center; margin: 8px 0; }
.confidence > strong { font-size: 26px; color: var(--navy-800); }
.back-row { display: flex; justify-content: space-between; align-items: center; }
.compact-form { display: flex; flex-direction: column; gap: 10px; }

/* --------------------------------------------------------------------------
   Профиль и вход
   -------------------------------------------------------------------------- */

.profile-layout { display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: start; }
.profile-hero { display: flex; justify-content: space-between; gap: 18px; align-items: center; background: linear-gradient(120deg, var(--navy-900), var(--navy-700)); border-radius: var(--radius-l); padding: 24px 28px; color: #d7e2ea; flex-wrap: wrap; }
.profile-hero h2 { color: #fff; }
.profile-hero p { color: #9fb4c2; }
.profile-identity { display: flex; gap: 16px; align-items: center; }
.profile-avatar { width: 62px; height: 62px; border-radius: 50%; background: rgba(255,255,255,0.14); display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; color: #fff; }
.profile-meta { display: flex; gap: 24px; flex-wrap: wrap; }
.profile-meta span { display: flex; flex-direction: column; gap: 2px; }
.profile-meta small { font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: #8ba1b1; }
.profile-meta strong { color: #fff; }
.profile-main { display: flex; flex-direction: column; gap: 20px; }
.profile-summary { display: flex; flex-direction: column; gap: 12px; }
.profile-progress { display: flex; align-items: center; gap: 12px; }
.profile-progress strong { font-size: 22px; }
.profile-progress span { flex: 1; height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; display: block; }
.profile-progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-strong)); border-radius: 99px; }
.profile-contacts { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.profile-contacts div { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.profile-contacts dt { color: var(--muted); }
.profile-contacts dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.profile-nav { display: flex; flex-direction: column; gap: 4px; }
.profile-nav a { display: flex; justify-content: space-between; padding: 9px 12px; border-radius: 8px; color: var(--ink-soft); font-weight: 600; font-size: 13px; }
.profile-nav a:hover { background: var(--surface-soft); text-decoration: none; }
.password-hint { display: flex; gap: 8px; align-items: center; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.password-hint span { color: var(--success); }

.auth-body { background: var(--navy-900); min-height: 100vh; }
.auth-layout { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.auth-brand {
  position: relative;
  overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between; gap: 30px;
  padding: 44px 56px 40px;
  color: #cfdbe5;
  background: linear-gradient(150deg, #0b1c2b 25%, #16344b 100%);
}
.auth-brand > :not(.auth-aurora):not(.auth-grid-lines) { position: relative; z-index: 2; }

/* Живой фон: мягкие световые пятна + инженерная сетка */
.auth-aurora { position: absolute; inset: 0; z-index: 0; filter: blur(70px); opacity: 0.55; }
.auth-aurora i { position: absolute; border-radius: 50%; display: block; }
.auth-aurora i:nth-child(1) {
  width: 460px; height: 460px; left: -120px; top: -140px;
  background: radial-gradient(circle, rgba(214,106,47,0.55), transparent 65%);
  animation: aurora-a 16s ease-in-out infinite alternate;
}
.auth-aurora i:nth-child(2) {
  width: 520px; height: 520px; right: -160px; top: 30%;
  background: radial-gradient(circle, rgba(43,106,148,0.6), transparent 65%);
  animation: aurora-b 20s ease-in-out infinite alternate;
}
.auth-aurora i:nth-child(3) {
  width: 380px; height: 380px; left: 22%; bottom: -160px;
  background: radial-gradient(circle, rgba(232,160,108,0.35), transparent 65%);
  animation: aurora-a 24s ease-in-out infinite alternate-reverse;
}
@keyframes aurora-a { from { transform: translate(0, 0) scale(1); } to { transform: translate(60px, 40px) scale(1.15); } }
@keyframes aurora-b { from { transform: translate(0, 0) scale(1.1); } to { transform: translate(-70px, -30px) scale(0.95); } }
@media (prefers-reduced-motion: reduce) {
  .auth-aurora i, .pv-spin { animation: none !important; }
}
.auth-grid-lines {
  position: absolute; inset: 0; z-index: 1;
  background-image:
    linear-gradient(rgba(255,255,255,0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 90% 80% at 40% 40%, #000 30%, transparent 75%);
}

.auth-brand-top { display: flex; align-items: center; gap: 14px; color: #fff; }
.auth-brand-top img { width: 44px; height: 44px; border-radius: 10px; box-shadow: 0 4px 18px rgba(0,0,0,0.35); }
.auth-brand-top strong { display: block; letter-spacing: 0.06em; }
.auth-brand-top small { display: block; font-size: 10.5px; letter-spacing: 0.14em; color: #7f97a8; }

.auth-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(214,106,47,0.16);
  border: 1px solid rgba(214,106,47,0.35);
  color: #eba876; border-radius: 99px; padding: 6px 15px;
  font-size: 12px; font-weight: 650; margin-bottom: 18px;
}
.auth-pill i { width: 7px; height: 7px; border-radius: 50%; background: #e8a06c; animation: pulse 2.4s infinite; }
.auth-copy h1 { color: #fff; font-size: 31px; line-height: 1.22; margin-bottom: 12px; letter-spacing: -0.015em; }
.auth-copy > p { color: #9fb4c2; font-size: 15px; max-width: 460px; }

/* Цифры продукта */
.auth-stats { display: flex; gap: 14px; margin-top: 26px; flex-wrap: wrap; }
.auth-stats > div {
  flex: 1; min-width: 130px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 13px; padding: 13px 16px;
  backdrop-filter: blur(6px);
}
.auth-stats strong { display: block; color: #fff; font-size: 19px; font-weight: 700; letter-spacing: 0.01em; }
.auth-stats small { color: #8ba1b1; font-size: 11.5px; line-height: 1.35; display: block; margin-top: 2px; }

/* Мини-превью карточки запроса */
.auth-preview {
  margin-top: 26px; max-width: 470px;
  background: rgba(13, 30, 44, 0.72);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 15px;
  box-shadow: 0 22px 50px rgba(0,0,0,0.4);
  backdrop-filter: blur(10px);
  overflow: hidden;
  transform: perspective(900px) rotateX(1.5deg);
}
.auth-preview-head {
  display: flex; align-items: center; gap: 7px;
  padding: 11px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
}
.auth-preview-head .dot { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,0.16); }
.auth-preview-head b { margin-left: 8px; color: #c8d6e0; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.auth-preview-body { padding: 13px 16px 16px; display: flex; flex-direction: column; gap: 9px; }
.auth-preview-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: #a9bcc9; }
.auth-preview-row em { margin-left: auto; font-style: normal; font-size: 11px; font-weight: 700; color: #6f8ba0; text-transform: uppercase; letter-spacing: 0.06em; }
.auth-preview-row.active { color: #e6eef4; }
.auth-preview-row.active em { color: #e8a06c; }
.pv-check {
  width: 18px; height: 18px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: rgba(64,145,98,0.25); color: #7fd3a4; font-size: 11px;
}
.pv-spin {
  width: 14px; height: 14px; flex: none; margin: 2px;
  border-radius: 50%;
  border: 2px solid rgba(232,160,108,0.25);
  border-top-color: #e8a06c;
  animation: pv-rotate 1.1s linear infinite;
}
@keyframes pv-rotate { to { transform: rotate(360deg); } }
.auth-preview-track { height: 5px; border-radius: 99px; background: rgba(255,255,255,0.08); overflow: hidden; margin-top: 2px; }
.auth-preview-track i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #d66a2f, #e8a06c); }

.auth-features { display: flex; gap: 12px; }
.auth-features > div {
  flex: 1; display: flex; gap: 11px; align-items: flex-start;
  background: rgba(255,255,255,0.045);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 13px; padding: 13px 15px;
}
.auth-features b {
  width: 30px; height: 30px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px;
  background: rgba(214,106,47,0.18); color: #e8a06c;
  font-size: 14px; font-weight: 500;
}
.auth-features strong { display: block; color: #fff; font-size: 13px; }
.auth-features small { color: #8ba1b1; font-size: 11.5px; line-height: 1.35; }

/* Правая колонка */
.auth-form-wrap {
  position: relative;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 40px;
  background:
    radial-gradient(ellipse 60% 45% at 85% 8%, rgba(214,106,47,0.07), transparent 70%),
    radial-gradient(ellipse 55% 45% at 10% 95%, rgba(43,106,148,0.06), transparent 70%),
    var(--paper);
}
.auth-form-glow { display: none; }
.auth-dots {
  position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(19,41,61,0.10) 1.1px, transparent 1.1px);
  background-size: 26px 26px;
  mask-image: radial-gradient(ellipse 75% 70% at 50% 45%, transparent 42%, #000 85%);
}
.auth-date {
  position: relative;
  margin-bottom: 18px;
  font-size: 13px; font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
  display: inline-flex; align-items: center; gap: 9px;
}
.auth-date::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--success); animation: pulse 2.4s infinite;
}
.auth-card {
  position: relative;
  width: min(460px, 100%);
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(8px);
  border-radius: 18px;
  border: 1px solid rgba(207,201,188,0.7);
  box-shadow: 0 1px 2px rgba(19,41,61,0.05), 0 18px 50px rgba(19,41,61,0.13);
  padding: 40px 40px 34px;
  display: flex; flex-direction: column; gap: 15px;
}
.auth-card-emblem {
  position: absolute; top: -26px; left: 50%; transform: translateX(-50%);
  width: 52px; height: 52px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 8px 22px rgba(19,41,61,0.18);
  display: flex; align-items: center; justify-content: center;
}
.auth-card-emblem img { width: 36px; height: 36px; border-radius: 8px; }
.login-layout .auth-card { margin-top: 22px; }
.login-layout .form-heading { text-align: center; margin-top: 2px; }

/* Команда и метки доверия под формой */
.auth-team {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  margin-top: 22px;
  font-size: 12.5px; font-weight: 550; color: var(--ink-soft);
  background: rgba(255,255,255,0.6);
  border: 1px solid rgba(207,201,188,0.6);
  border-radius: 99px;
  padding: 8px 18px 8px 10px;
  backdrop-filter: blur(6px);
}
.team-avatars { display: inline-flex; }
.team-avatars i {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 2px solid #fff;
  margin-right: -9px;
  color: #fff;
}
.team-avatars i:last-child { margin-right: 0; }
.team-avatars i svg { width: 16px; height: 16px; }
.team-avatars i:nth-child(1) { background: var(--steel); }
.team-avatars i:nth-child(2) { background: var(--accent); }
.team-avatars i:nth-child(3) { background: var(--navy-600); }
.team-avatars i:nth-child(4) { background: #8a6d3b; }
.auth-trust {
  position: relative;
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
  margin-top: 16px;
  max-width: 460px;
}
.auth-trust span {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600; color: var(--muted);
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(207,201,188,0.55);
  border-radius: 99px;
  padding: 6px 13px;
}
.auth-trust svg { width: 14px; height: 14px; color: var(--steel); }
.auth-card::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 3px;
  border-radius: 18px 18px 0 0;
  background: linear-gradient(90deg, var(--accent), #e8a06c 55%, transparent);
}
.auth-card.wide-form { width: min(560px, 100%); }
.form-heading h2 { font-size: 21px; margin: 3px 0 5px; }
.form-heading p { color: var(--muted); font-size: 13.5px; }
.auth-card input { padding: 11px 13px; }
.auth-submit { margin-top: 6px; justify-content: space-between; padding: 13px 18px; font-size: 14.5px; box-shadow: 0 6px 18px rgba(214,106,47,0.35); }
.auth-help { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; color: var(--muted); }
.auth-lock { color: var(--success); flex: none; margin-top: 1px; }
.auth-lock svg { width: 16px; height: 16px; }
.auth-footer { margin-top: 22px; color: #8d9aa5; font-size: 12.5px; text-align: center; }
.auth-footer span { margin: 0 6px; }
.auth-flash { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 100; min-width: 320px; }

/* Поле пароля с глазком и подсказкой Caps Lock */
.password-field { position: relative; display: block; }
.password-field input { padding-right: 44px; }
.password-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: none; cursor: pointer;
  color: var(--muted); border-radius: 8px;
}
.password-eye:hover { color: var(--navy-800); background: var(--surface-soft); }
.password-eye svg { width: 18px; height: 18px; }
.password-eye.active { color: var(--accent-strong); }
.capslock-hint { color: var(--warning); font-weight: 600; font-size: 12px; }

/* --------------------------------------------------------------------------
   Прочее
   -------------------------------------------------------------------------- */

.system-state { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); font-weight: 550; }
.system-state i { width: 8px; height: 8px; border-radius: 50%; background: var(--success); animation: pulse 2.4s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.editor { border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface-soft); margin-top: 12px; }
.editor summary { padding: 12px 16px; cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--ink-soft); list-style: none; }
.editor summary::-webkit-details-marker { display: none; }
.editor summary:hover { color: var(--ink); }
.editor[open] summary { border-bottom: 1px solid var(--line); }
.editor > form, .editor > div { padding: 16px; }

.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-form label { min-width: 180px; }
.top-gap { margin-top: 14px; }

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }

/* Печать */
@media print {
  .sidebar, .topbar, .testmode-banner, .button, .form-actions { display: none !important; }
  .page-shell { margin-left: 0; }
  .panel { box-shadow: none; }
}

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

@media (max-width: 1180px) {
  .dashboard-grid, .inbox-detail-grid { grid-template-columns: 1fr; }
  .profile-layout { grid-template-columns: 1fr; }
  .workspace-hero { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.22s ease; box-shadow: var(--shadow-l); }
  .sidebar.open { transform: translateX(0); }
  .page-shell { margin-left: 0; }
  .menu-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 10px;
    font-size: 17px;
    cursor: pointer;
  }
  body.sidebar-open .sidebar-backdrop {
    display: block;
    position: fixed; inset: 0;
    background: rgba(14, 34, 51, 0.5);
    border: none;
    z-index: 50;
  }
  .auth-layout { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .page-content { padding: 18px 16px 48px; }
  .topbar { padding: 14px 16px 12px; }
  .testmode-banner { padding: 9px 16px; }
  .form-grid.two, .form-grid.three, .form-grid.four { grid-template-columns: 1fr; }
  .span-2, .span-3, .span-4 { grid-column: span 1; }
  .inbox-sender { width: auto; }
  .inbox-class { display: none; }
  .filter-bar input[name="q"] { min-width: 0; width: 100%; }
  .request-summary, .profile-hero { padding: 20px; }
}
