@import url('https://fonts.googleapis.com/css2?family=Golos+Text:wght@400..700&family=JetBrains+Mono:wght@400;500;600&family=Unbounded:wght@500;600;700&display=swap');

/* ============================================================
   Palantir AI — интерфейс «разведывательной консоли»
   Обсидиановый рельс · тёплая бумага · янтарный акцент
   ============================================================ */

:root {
  --font-ui: "Golos Text", "Segoe UI", system-ui, sans-serif;
  --font-display: "Unbounded", "Golos Text", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;

  /* поверхности */
  --bg: #f1efea;
  --bg-tint: #e8e5dd;
  --surface: #ffffff;
  --surface-2: #f8f7f3;
  --border: #e2ded4;
  --border-strong: #cec8ba;

  /* текст */
  --text: #16181c;
  --text-2: #43474e;
  --muted: #6f7278;

  /* янтарь */
  --accent: #e0801d;
  --accent-hot: #ff7a2f;
  --accent-ink: #1c1204;
  --accent-quiet: #fbead4;
  --accent-line: rgba(224, 128, 29, .38);
  --accent-text: #a2540d;

  /* сигналы */
  --ok: #196f45;      --ok-bg: #dcf0e4;      --ok-line: #b6ddc6;
  --warn: #8f5405;    --warn-bg: #fbebcb;    --warn-line: #edd39a;
  --bad: #ab241d;     --bad-bg: #fbe3e0;     --bad-line: #f0c4bf;

  /* рельс — тёмный в обеих темах */
  --rail: #0c0d10;
  --rail-2: #14161a;
  --rail-text: #eae6dd;
  --rail-muted: #83868e;
  --rail-border: #212429;

  --radius: 5px;
  --radius-lg: 8px;
  --rail-w: 250px;
  --bar-h: 62px;

  --shadow-sm: 0 1px 2px rgba(20, 18, 14, .05);
  --shadow-md: 0 12px 32px -18px rgba(20, 18, 14, .35);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");

  color-scheme: light;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

[data-theme="dark"] {
  --bg: #0a0b0e;
  --bg-tint: #101216;
  --surface: #131519;
  --surface-2: #191c21;
  --border: #24272e;
  --border-strong: #363b45;

  --text: #ece8e1;
  --text-2: #b7bac1;
  --muted: #868a92;

  --accent: #f09a3e;
  --accent-ink: #1c1204;
  --accent-quiet: #2b1d0b;
  --accent-line: rgba(240, 154, 62, .34);
  --accent-text: #f4b874;

  --ok: #5fd39b;      --ok-bg: #10251c;      --ok-line: #1f4a37;
  --warn: #e7b264;    --warn-bg: #2a1f0d;    --warn-line: #4d3a16;
  --bad: #f18b81;     --bad-bg: #2b1512;     --bad-line: #55231e;

  --rail: #08090b;
  --rail-2: #101216;
  --rail-border: #1c1f24;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 16px 40px -24px rgba(0, 0, 0, .9);
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
}

/* зернистая плёнка поверх всего — даёт «плёночную» глубину без картинок */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  background-image: var(--grain);
  opacity: .028;
  mix-blend-mode: multiply;
}
[data-theme="dark"] body::after { opacity: .05; mix-blend-mode: screen; }

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
.content a:visited:not(.button):not(.back-link):not(.nav-item) { color: var(--accent-text); }
button, input, select, textarea { font: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* ------------------------------------------------------------
   Каркас
   ------------------------------------------------------------ */
.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: var(--rail-w);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--rail-border);
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(224, 128, 29, .13), transparent 62%),
    var(--rail);
  color: var(--rail-text);
}
.sidebar::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: var(--grain);
  opacity: .045;
}

.sidebar-brand {
  position: relative;
  z-index: 1;
  height: var(--bar-h);
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 0 20px;
  border-bottom: 1px solid var(--rail-border);
  color: var(--rail-text);
}
.sidebar-brand:hover { text-decoration: none; }

/* палантир — «видящий камень» */
.brand-mark {
  position: relative;
  display: block;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, #ffe0b4 0%, #ffab4a 22%, var(--accent) 42%, #9c3f06 68%, #26140a 100%);
  box-shadow:
    0 0 0 1px rgba(240, 154, 62, .40),
    0 0 22px -5px rgba(255, 138, 45, .85);
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: -5px;
  border: 1px solid rgba(240, 154, 62, .20);
  border-radius: 50%;
}
.brand-name {
  display: block;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.03em;
  line-height: 1.1;
}
.brand-subtitle {
  display: block;
  margin-top: 5px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--rail-muted);
}

.rail-label {
  position: relative;
  z-index: 1;
  margin: 20px 20px 8px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: #5d616a;
}

.sidebar-nav { position: relative; z-index: 1; display: grid; gap: 2px; padding: 0 12px; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: #a9adb6;
  font-size: 14px;
  font-weight: 500;
  transition: color .16s ease, background .16s ease;
}
.nav-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 2px;
  height: 0;
  border-radius: 2px;
  background: var(--accent);
  transform: translateY(-50%);
  transition: height .2s cubic-bezier(.2, .8, .3, 1);
}
.nav-item:hover { background: rgba(255, 255, 255, .045); color: var(--rail-text); text-decoration: none; }
.nav-item.active { background: rgba(224, 128, 29, .11); color: #ffce96; font-weight: 600; }
.nav-item.active::before { height: 18px; }
.nav-icon { width: 17px; height: 17px; flex: 0 0 auto; opacity: .7; }
.nav-item.active .nav-icon { opacity: 1; color: var(--accent); }

.sidebar-user {
  position: relative;
  z-index: 1;
  margin: auto 12px 12px;
  padding: 12px;
  border: 1px solid var(--rail-border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, .028);
}
.user-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(240, 154, 62, .28);
  border-radius: var(--radius);
  background: rgba(240, 154, 62, .10);
  color: #f2b878;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}
.user-meta { min-width: 0; }
.user-name {
  display: block;
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--rail-text);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-role {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--rail-muted);
}
.logout-form { margin: 0; }
.logout-button {
  width: 100%;
  min-height: 32px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: #9aa0a9;
  font-size: 13px;
  font-weight: 600;
}
.logout-button:hover { border-color: var(--rail-border); background: rgba(255, 255, 255, .05); color: var(--rail-text); }

/* ------------------------------------------------------------
   Рабочая область
   ------------------------------------------------------------ */
.app-main {
  position: relative;
  min-height: 100vh;
  margin-left: var(--rail-w);
  background:
    radial-gradient(90% 40% at 100% 0%, var(--accent-quiet), transparent 58%),
    var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--bar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 30px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.3);
}
.topbar-kicker {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
}
.topbar-kicker::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-quiet);
}
.topbar-title { margin-top: 3px; font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.menu-toggle, .mobile-menu-button { display: none; }

.theme-button {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-2);
  box-shadow: none;
}
.theme-button:hover { border-color: var(--border-strong); background: var(--surface-2); color: var(--text); }
.theme-button svg { width: 17px; height: 17px; }
.icon-dark { display: none; }
[data-theme="dark"] .icon-light { display: none; }
[data-theme="dark"] .icon-dark { display: block; }

.content {
  position: relative;
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 30px 30px 64px;
}

/* ------------------------------------------------------------
   Типографика
   ------------------------------------------------------------ */
h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -.035em;
  line-height: 1.18;
  color: var(--text);
}
h2 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -.01em; color: var(--text); }
p { margin-top: 8px; }
.muted { color: var(--muted); font-size: 13.5px; }
.mono {
  font-family: var(--font-mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}

.page-header { margin-bottom: 22px; }
.page-header p { max-width: 68ch; margin: 7px 0 0; color: var(--muted); font-size: 14px; }

.section-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 34px 0 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .19em;
  text-transform: uppercase;
  color: var(--muted);
}
.section-heading::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 20px;
}
.title-row p { margin-top: 7px; color: var(--muted); font-size: 14px; }

/* ------------------------------------------------------------
   Карточки
   ------------------------------------------------------------ */
.card {
  position: relative;
  margin: 16px 0;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -22px -22px 20px;
  padding: 0 22px;
  height: 46px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.card-header h2 {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}
.card-header.split { justify-content: space-between; }
.no-margin { margin: 0; }
.stack { display: grid; gap: 16px; }
.top-gap { margin-top: 16px; }

/* ------------------------------------------------------------
   Формы
   ------------------------------------------------------------ */
label {
  display: grid;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--muted);
}
input, select, textarea {
  min-width: 180px;
  padding: 8px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  outline: none;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input::placeholder, textarea::placeholder { color: var(--muted); font-weight: 400; opacity: .75; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-quiet);
}
input[type="file"] { padding: 6px 8px; font-size: 13px; }
input[type="datetime-local"], input[type="number"] { font-family: var(--font-mono); font-size: 13px; }
textarea { min-width: 420px; min-height: 86px; line-height: 1.55; resize: vertical; }

.row-form { display: flex; gap: 14px; align-items: end; flex-wrap: wrap; }
.form-grow { flex: 1 1 220px; }
.form-grow input, .form-grow select { width: 100%; }
.manager-form { display: grid; grid-template-columns: 1.1fr 1.1fr .65fr 1.1fr auto; gap: 14px; align-items: end; }
.check-field { align-content: end; justify-items: center; min-height: 54px; }
.check-field input { width: 16px; min-width: 16px; height: 16px; margin: 8px 0; accent-color: var(--accent); }
.checkbox-label {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 9px;
  min-height: 32px;
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-2);
}
.checkbox-label input { width: 16px; min-width: 16px; height: 16px; accent-color: var(--accent); }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 15px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -.005em;
  white-space: nowrap;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease, color .16s ease;
}
button:hover, .button:hover {
  background: var(--accent-hot);
  box-shadow: 0 8px 20px -12px rgba(255, 122, 47, .95);
  text-decoration: none;
}
button:active, .button:active { transform: translateY(1px); box-shadow: none; }
button:disabled, .button:disabled { opacity: .42; box-shadow: none; cursor: not-allowed; }
button:disabled:hover { background: var(--accent); }

.secondary { border-color: var(--border-strong); background: var(--surface); color: var(--text-2); }
.secondary:hover { border-color: var(--text-2); background: var(--surface-2); color: var(--text); box-shadow: none; }
.link {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.link:hover { background: none; box-shadow: none; color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.danger { background: var(--bad); color: #fff; }
.danger:hover { background: var(--bad); filter: brightness(1.08); box-shadow: none; }
.danger-text { color: var(--bad); }
.danger-text:hover { color: var(--bad); }

button:focus-visible, .button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ------------------------------------------------------------
   Таблицы
   ------------------------------------------------------------ */
.table-wrap { overflow-x: auto; padding: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 18px; text-align: left; vertical-align: middle; }
thead th {
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
thead th:first-child { border-radius: var(--radius-lg) 0 0 0; }
thead th:last-child { border-radius: 0 var(--radius-lg) 0 0; }
tbody td { border-bottom: 1px solid var(--border); font-size: 14px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .13s ease, box-shadow .13s ease; }
tbody tr:hover { background: var(--surface-2); box-shadow: inset 2px 0 0 var(--accent); }
td a { font-weight: 600; color: var(--text); }
td a:hover { color: var(--accent-text); }
.table-subtitle {
  max-width: 44ch;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: -.01em;
  color: var(--muted);
}
.cell-data {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  white-space: nowrap;
  color: var(--text-2);
}
.cell-data a { color: var(--accent-text); font-weight: 500; }
.cell-num { font-family: var(--font-mono); font-size: 13px; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------
   Метки состояний
   ------------------------------------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border: 1px solid var(--accent-line);
  border-radius: var(--radius);
  background: var(--accent-quiet);
  color: var(--accent-text);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 24px;
  padding: 3px 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .07em;
  text-transform: uppercase;
  white-space: nowrap;
}
.status-pill::before {
  content: "";
  width: 5px;
  height: 5px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
}

/* состояние сайта */
.status-not_found, .status-social_only, .status-weak, .status-no_conversion {
  border-color: var(--warn-line); background: var(--warn-bg); color: var(--warn);
}
.status-pending { border-color: var(--accent-line); background: var(--accent-quiet); color: var(--accent-text); }
.status-healthy { border-color: var(--ok-line); background: var(--ok-bg); color: var(--ok); }
.status-unavailable { border-color: var(--bad-line); background: var(--bad-bg); color: var(--bad); }

/* статус лида */
.lead-new { border-color: var(--accent-line); background: var(--accent-quiet); color: var(--accent-text); }
.lead-in_progress { border-color: var(--border-strong); background: var(--surface-2); color: var(--text-2); }
.lead-callback { border-color: var(--warn-line); background: var(--warn-bg); color: var(--warn); }
.lead-success { border-color: var(--ok-line); background: var(--ok-bg); color: var(--ok); }
.lead-rejected { border-color: var(--bad-line); background: var(--bad-bg); color: var(--bad); }

.owner-tag {
  display: block;
  margin-top: 5px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .05em;
  color: var(--muted);
}
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.tag {
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: -.01em;
}

/* ------------------------------------------------------------
   Сообщения
   ------------------------------------------------------------ */
.notice, .error-box, .demo-banner {
  position: relative;
  margin: 14px 0;
  padding: 13px 16px 13px 17px;
  border: 1px solid var(--ok-line);
  border-left: 3px solid var(--ok);
  border-radius: var(--radius);
  background: var(--ok-bg);
  color: var(--ok);
  font-size: 13.5px;
}
.error-box { border-color: var(--bad-line); border-left-color: var(--bad); background: var(--bad-bg); color: var(--bad); }
.error-box strong,
.demo-banner strong,
.notice strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.error-box p, .notice p { margin: 5px 0 0; color: inherit; opacity: .92; }
.error { color: var(--bad); }
.demo-banner {
  display: flex;
  align-items: baseline;
  gap: 12px;
  border-color: var(--warn-line);
  border-left-color: var(--warn);
  background: var(--warn-bg);
  color: var(--warn);
}
.demo-banner strong { flex: 0 0 auto; }
.demo-pill { border-color: var(--warn-line) !important; background: var(--warn-bg) !important; color: var(--warn) !important; }

.empty-state { padding: 52px 20px; color: var(--muted); text-align: center; }
.empty-state::before {
  content: "";
  display: block;
  width: 30px;
  height: 30px;
  margin: 0 auto 14px;
  border: 1px dashed var(--border-strong);
  border-radius: 50%;
}
.empty-icon { margin-bottom: 10px; color: var(--accent); font-size: 28px; }
.empty-copy { color: var(--muted); font-size: 13.5px; }
tbody td .empty-state { padding: 44px 20px; }

/* ------------------------------------------------------------
   Фильтры
   ------------------------------------------------------------ */
.filter-grid { display: grid; grid-template-columns: 1.3fr repeat(2, 1fr); gap: 14px; align-items: end; }
.filter-grid input, .filter-grid select { width: 100%; min-width: 0; }
.filter-wide { grid-column: span 1; }
.filter-actions { display: flex; gap: 8px; align-items: center; }
.mock-search-form {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px dashed var(--border);
}

/* ------------------------------------------------------------
   Карточка компании
   ------------------------------------------------------------ */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 18px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--muted);
}
.back-link:hover { color: var(--accent-text); text-decoration: none; }

.company-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 22px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}
.company-heading p { margin: 9px 0 0; }
.heading-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.heading-actions { flex: 0 0 auto; }
.company-grid { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(310px, 1fr); gap: 18px; align-items: start; }
.company-main, .company-side { min-width: 0; }

.offer-title { font-family: var(--font-display); font-size: 19px; font-weight: 500; letter-spacing: -.03em; }
.leading { line-height: 1.65; }

.work-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; }
.work-form input, .work-form select { width: 100%; min-width: 0; }

.comment-form { display: grid; gap: 10px; }
.comment-form textarea { width: 100%; min-width: 0; }
.comment-form button { justify-self: start; }
.comment { padding: 15px 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border-bottom: 0; padding-bottom: 0; }
.comment p { margin: 6px 0 0; font-size: 14px; line-height: 1.6; color: var(--text-2); }
.comment-meta { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.comment-meta b { font-size: 13.5px; font-weight: 600; color: var(--text); }
.comment-meta span {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.inline-edit { display: flex; gap: 8px; margin: 9px 0; }
.inline-edit input { flex: 1; min-width: 0; }

.timeline { display: grid; gap: 16px; }
.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 12px;
  font-size: 13.5px;
  color: var(--text-2);
}
.timeline-item:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 14px;
  bottom: -18px;
  width: 1px;
  background: var(--border);
}
.timeline-item b { color: var(--text); }
.timeline-item .muted { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .04em; }
.timeline-dot {
  width: 9px;
  height: 9px;
  margin-top: 5px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--surface);
}

.contact-actions { display: grid; gap: 8px; }
.contact-actions .button {
  width: 100%;
  min-width: 0;
  justify-content: flex-start;
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: -.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rating-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}
.rating-row strong { color: var(--accent-text); font-size: 14px; }
.schedule { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.schedule summary {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
}
.schedule summary:hover { color: var(--text); }
.schedule div {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px 12px;
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-2);
}
.details-form { display: grid; gap: 12px; margin-top: 20px; padding-top: 20px; border-top: 1px dashed var(--border); }
.details-form input, .details-form textarea { width: 100%; min-width: 0; }
.details-form textarea { min-height: 88px; }
.source-searches { display: grid; gap: 8px; margin-top: 12px; font-size: 13.5px; }
.source-searches a { font-weight: 500; }

.proxy-results { display: grid; gap: 6px; margin-top: 18px; }
.proxy-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: -.01em;
}

/* ------------------------------------------------------------
   Вход — всегда обсидиан
   ------------------------------------------------------------ */
.auth-page {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
  background:
    radial-gradient(60% 55% at 78% 12%, rgba(224, 128, 29, .16), transparent 62%),
    radial-gradient(50% 50% at 8% 92%, rgba(255, 122, 47, .09), transparent 60%),
    var(--rail);
  color: var(--rail-text);
}
.auth-page::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .022) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(120% 90% at 50% 30%, #000 20%, transparent 78%);
}

.auth-split {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 920px;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  border: 1px solid var(--rail-border);
  border-radius: 12px;
  background: rgba(20, 22, 26, .72);
  box-shadow: 0 40px 90px -50px #000;
  backdrop-filter: blur(6px);
  overflow: hidden;
}
.auth-aside {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  padding: 38px 34px;
  border-right: 1px solid var(--rail-border);
  background: linear-gradient(160deg, rgba(255, 255, 255, .035), transparent 60%);
}
.auth-orb {
  position: relative;
  display: block;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, #ffe6c2 0%, #ffb055 20%, var(--accent) 40%, #9c3f06 66%, #200f05 100%);
  box-shadow: 0 0 0 1px rgba(240, 154, 62, .35), 0 0 60px -8px rgba(255, 122, 47, .7);
  animation: orb-pulse 5.5s ease-in-out infinite;
}
.auth-orb::after {
  content: "";
  position: absolute;
  inset: -14px;
  border: 1px solid rgba(240, 154, 62, .18);
  border-radius: 50%;
}
.auth-aside h1 {
  margin-top: 26px;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -.04em;
  line-height: 1.1;
  color: #fff;
}
.auth-tagline { margin: 12px 0 0; max-width: 26ch; color: #9ba0a9; font-size: 14px; line-height: 1.55; }
.auth-facts { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.auth-facts li {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: #74787f;
}
.auth-facts li::before {
  content: "";
  width: 12px;
  height: 1px;
  background: var(--accent);
  opacity: .8;
}

.auth-panel { padding: 38px 34px; }
.auth-panel .form-label,
.auth-panel label { color: #7f838b; }
.auth-panel input {
  width: 100%;
  border-color: #262a30;
  background: rgba(255, 255, 255, .035);
  color: var(--rail-text);
}
.auth-panel input:hover { border-color: #3a3f47; }
.auth-panel input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(224, 128, 29, .16); }
.auth-page .error-box { border-color: #5a2723; border-left-color: #f18b81; background: #2a1512; color: #f2a49b; }
.auth-page .error-box strong { color: #f4b0a8; }
.auth-page .secondary { border-color: #2a2e35; background: rgba(255, 255, 255, .04); color: #c3c7cd; }
.auth-page .secondary:hover { border-color: #454b54; background: rgba(255, 255, 255, .07); color: #fff; }
.auth-panel button { width: 100%; margin-top: 6px; min-height: 42px; }
.auth-kicker {
  display: block;
  margin-bottom: 22px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: #5f636b;
}
.auth-footnote {
  margin: 22px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--rail-border);
  color: #6c7079;
  font-size: 12px;
  line-height: 1.55;
}

/* автономная карточка (ошибка вне сессии) */
.auth.card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  border-color: var(--rail-border);
  background: rgba(20, 22, 26, .82);
  color: var(--rail-text);
}
.auth.card h1 { color: #fff; }

/* ------------------------------------------------------------
   Движение
   ------------------------------------------------------------ */
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes orb-pulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(240, 154, 62, .35), 0 0 60px -8px rgba(255, 122, 47, .65); }
  50% { box-shadow: 0 0 0 1px rgba(240, 154, 62, .55), 0 0 88px -6px rgba(255, 122, 47, .95); }
}

.content > * { animation: rise .42s cubic-bezier(.22, .8, .3, 1) backwards; }
.content > *:nth-child(1) { animation-delay: .02s; }
.content > *:nth-child(2) { animation-delay: .07s; }
.content > *:nth-child(3) { animation-delay: .12s; }
.content > *:nth-child(4) { animation-delay: .17s; }
.content > *:nth-child(n+5) { animation-delay: .2s; }
.auth-split { animation: rise .5s cubic-bezier(.22, .8, .3, 1) backwards; }

/* ------------------------------------------------------------
   Адаптив
   ------------------------------------------------------------ */
@media (max-width: 900px) {
  .auth-split { grid-template-columns: 1fr; max-width: 460px; }
  .auth-aside { gap: 28px; padding: 30px 26px; border-right: 0; border-bottom: 1px solid var(--rail-border); }
  .auth-aside h1 { margin-top: 20px; font-size: 25px; }
  .auth-facts { grid-auto-flow: column; grid-auto-columns: max-content; gap: 16px; }
  .auth-panel { padding: 26px; }
}

@media (max-width: 820px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s cubic-bezier(.22, .8, .3, 1); }
  .menu-toggle:checked ~ .sidebar { transform: translateX(0); }
  .menu-toggle:checked ~ .menu-overlay { display: block; }
  .menu-overlay { position: fixed; inset: 0; z-index: 20; display: none; background: rgba(10, 11, 14, .55); backdrop-filter: blur(2px); }
  .app-main { margin-left: 0; }
  .topbar { padding: 0 16px; }
  .mobile-menu-button {
    display: grid;
    width: 34px;
    height: 34px;
    margin-right: 10px;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-2);
    cursor: pointer;
  }
  .content { padding: 22px 16px 48px; }
  .row-form > * { width: 100%; }
  input, select, textarea { width: 100%; min-width: 0; }
  .title-row { display: block; }
  .title-row .button { margin-top: 14px; }
  .manager-form { display: flex; }
  .mock-search-form, .demo-banner { align-items: flex-start; flex-direction: column; gap: 8px; }
  .filter-grid, .work-form, .company-grid { grid-template-columns: 1fr; }
  .company-heading { flex-direction: column; }
  .heading-actions, .heading-actions form, .heading-actions button { width: 100%; }
  .filter-actions { grid-column: 1; }
  th, td { padding: 12px 14px; }
}

@media (min-width: 821px) and (max-width: 1180px) {
  .filter-grid { grid-template-columns: repeat(2, 1fr); }
  .company-grid { grid-template-columns: 1fr; }
}

/* мгновенное переключение темы — без «серой» промежуточной анимации */
.theme-swap, .theme-swap *, .theme-swap *::before, .theme-swap *::after {
  transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
