@charset "UTF-8";

/* ============================================================
   teplohot.pro · портал базы знаний
   Тепловизионная оптика: приборная панель, а не SaaS-лендинг.
   ============================================================ */

:root {
  --paper: #eceee6;
  --paper-2: #e2e5da;
  --surface: #f8f8f1;
  --surface-2: #f1f2e9;
  --ink: #18211b;
  --ink-2: #4d5a51;
  --ink-3: #748076;
  --line: #d3d6c8;
  --line-strong: #b3b9a9;
  --rail: #131b16;
  --rail-2: #1c2a22;
  --rail-ink: #ece9da;
  --amber: #d68a2c;
  --amber-2: #f0b45a;
  --amber-ink: #2a1d0b;
  --ember: #b6552f;
  --moss: #3f6b50;
  --moss-soft: #dfe9dd;
  --blue-grey: #4d6570;
  --blue-soft: #e0e8ea;
  --warn-soft: #f4e4ce;
  --danger: #a13d2a;

  --font-display: "Bahnschrift", "DIN Alternate", "Segoe UI Variable Display", "Segoe UI", sans-serif;
  --font-body: "Segoe UI", "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "Cascadia Mono", "Consolas", "SFMono-Regular", monospace;

  --radius: 4px;
  --radius-sm: 2px;
  --shadow: 0 18px 40px rgba(24, 33, 27, .12);
  --max: 1280px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  font-feature-settings: "kern" 1, "liga" 1;
}

h1, h2, h3, h4, p, dl, dd, figure { margin: 0; }

button, input, select, textarea { font: inherit; color: inherit; }

a { color: inherit; }

img, svg { display: block; }

::selection { background: var(--amber-2); color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--surface);
  border-radius: var(--radius);
}
.skip-link:focus { top: 12px; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }

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

.login-body {
  min-height: 100vh;
  background: var(--rail);
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(360px, .82fr);
  min-height: 100vh;
}

.login-visual {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px 48px 44px;
  color: var(--rail-ink);
  isolation: isolate;
  background:
    radial-gradient(120% 90% at 72% 30%, #2a2420 0%, #151b16 52%, #0d120f 100%);
}

.login-thermal {
  position: absolute;
  inset: -10% -5%;
  z-index: -2;
  background:
    radial-gradient(26% 30% at 68% 33%, rgba(247, 211, 135, .95) 0%, rgba(226, 149, 62, .85) 26%, rgba(164, 71, 41, .6) 48%, rgba(74, 48, 72, .25) 64%, transparent 72%),
    radial-gradient(18% 22% at 79% 43%, rgba(255, 236, 183, .8) 0%, rgba(219, 117, 44, .5) 45%, transparent 70%),
    radial-gradient(30% 36% at 30% 78%, rgba(50, 79, 96, .55) 0%, transparent 68%),
    radial-gradient(40% 50% at 18% 20%, rgba(47, 66, 55, .65) 0%, transparent 70%),
    #0d1310;
  filter: saturate(1.08) contrast(1.02);
}

.login-grid {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(236, 233, 218, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(236, 233, 218, .045) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(80% 80% at 60% 40%, #000 20%, transparent 78%);
}

.login-scope {
  position: absolute;
  right: -110px;
  top: 50%;
  transform: translateY(-50%);
  width: min(56vw, 700px);
  height: min(56vw, 700px);
  opacity: .5;
  z-index: -1;
}

.login-scan {
  position: absolute;
  left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(240, 180, 90, .55), transparent);
  animation: scan 9s linear infinite;
  z-index: -1;
}

@keyframes scan {
  0% { top: 12%; opacity: 0; }
  8% { opacity: .8; }
  92% { opacity: .8; }
  100% { top: 92%; opacity: 0; }
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  width: max-content;
}

.login-brand-mark {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(236, 233, 218, .45);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
}

.login-brand-text {
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: .08em;
  text-transform: lowercase;
}
.login-brand-text span { color: rgba(236, 233, 218, .55); }

.login-copy {
  max-width: 560px;
  padding-bottom: 8px;
}

.login-copy h1 {
  font-family: var(--font-display);
  font-size: clamp(34px, 4.4vw, 58px);
  line-height: 1.03;
  letter-spacing: -.015em;
  font-weight: 500;
  text-wrap: balance;
}

.login-copy p {
  margin-top: 20px;
  max-width: 42ch;
  color: rgba(236, 233, 218, .72);
  font-size: 15px;
}

.login-foot {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  color: rgba(236, 233, 218, .48);
  font-size: 12px;
  letter-spacing: .02em;
  border-top: 1px solid rgba(236, 233, 218, .14);
  padding-top: 16px;
}

.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
  background: var(--paper);
  border-left: 1px solid rgba(0, 0, 0, .25);
}

.login-form {
  width: min(360px, 100%);
}

.login-form h2 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -.01em;
}

.login-form .login-intro {
  margin-top: 8px;
  margin-bottom: 30px;
  color: var(--ink-2);
  font-size: 14px;
}

.login-form .field + .field { margin-top: 16px; }

.login-form .btn-primary {
  width: 100%;
  margin-top: 24px;
  height: 44px;
}

.login-error {
  margin-top: 16px;
  padding: 10px 12px;
  border-left: 3px solid var(--danger);
  background: rgba(161, 61, 42, .08);
  color: var(--danger);
  font-size: 13px;
}

.login-note {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.6;
}

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

.app-body { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 28px;
  height: 64px;
  padding: 0 28px;
  background: var(--rail);
  color: var(--rail-ink);
  border-bottom: 1px solid rgba(236, 233, 218, .12);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  flex: 0 0 auto;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(236, 233, 218, .38);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: .06em;
  line-height: 1.1;
}
.brand-name small {
  display: block;
  font-family: var(--font-body);
  font-size: 10px;
  letter-spacing: .04em;
  color: rgba(236, 233, 218, .5);
  margin-top: 2px;
}

.topnav {
  display: flex;
  align-items: stretch;
  gap: 2px;
  height: 100%;
  flex: 1 1 auto;
}

.topnav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  color: rgba(236, 233, 218, .62);
  text-decoration: none;
  font-size: 13.5px;
  white-space: nowrap;
  transition: color .15s ease, background .15s ease;
}
.topnav-link:hover { color: var(--rail-ink); background: rgba(236, 233, 218, .05); }
.topnav-link.is-active { color: var(--rail-ink); }
.topnav-link.is-active::after {
  content: "";
  position: absolute;
  left: 16px; right: 16px; bottom: 0;
  height: 2px;
  background: var(--amber-2);
}
.topnav-link svg { width: 16px; height: 16px; opacity: .8; }
.topnav-count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: rgba(236, 233, 218, .55);
  border: 1px solid rgba(236, 233, 218, .2);
  padding: 1px 5px;
  border-radius: 10px;
}

.topbar-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 0 0 auto;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: rgba(236, 233, 218, .82);
}
.user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--rail-2);
  border: 1px solid rgba(236, 233, 218, .22);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--amber-2);
}
.user-role { font-size: 11px; color: rgba(236, 233, 218, .45); }

.icon-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: transparent;
  color: rgba(236, 233, 218, .62);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.icon-btn:hover { color: var(--rail-ink); border-color: rgba(236, 233, 218, .2); }

.app-main {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 30px 28px 64px;
  flex: 1 0 auto;
}

/* ------------------------------------------------------------
   Заголовки, секции
   ------------------------------------------------------------ */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

.page-head h1 {
  font-family: var(--font-display);
  font-size: clamp(28px, 3vw, 38px);
  font-weight: 500;
  letter-spacing: -.015em;
  line-height: 1.1;
}

.page-sub {
  margin-top: 7px;
  color: var(--ink-2);
  font-size: 13.5px;
  max-width: 70ch;
}

.page-actions { display: flex; gap: 10px; align-items: center; flex: 0 0 auto; }

.section { margin-top: 34px; }
.section:first-child { margin-top: 0; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-strong);
  margin-bottom: 0;
}
.section-head h2 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: .005em;
}
.section-head p { color: var(--ink-2); font-size: 12.5px; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background .14s ease, border-color .14s ease, color .14s ease;
}
.btn:hover { background: var(--surface); border-color: var(--ink-3); }
.btn svg { width: 15px; height: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--amber-ink);
}
.btn-primary:hover { background: var(--amber-2); border-color: var(--amber-2); }

.btn-dark {
  background: var(--rail);
  border-color: var(--rail);
  color: var(--rail-ink);
}
.btn-dark:hover { background: var(--rail-2); border-color: var(--rail-2); }

.btn-ghost { border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface); color: var(--ink); }

.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-sm svg { width: 13px; height: 13px; }

.btn-danger { color: var(--danger); border-color: rgba(161, 61, 42, .4); }
.btn-danger:hover { background: rgba(161, 61, 42, .08); border-color: var(--danger); }

.link {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 1px;
}
.link:hover { border-color: var(--ink); }

.link-quiet {
  color: var(--ink-2);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.link-quiet:hover { color: var(--ink); border-color: var(--line-strong); }

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

.field { display: block; }
.field-label {
  display: block;
  font-size: 12.5px;
  color: var(--ink-2);
  margin-bottom: 6px;
}
.field-hint { display: block; margin-top: 5px; font-size: 11.5px; color: var(--ink-3); }

.input, .select, .textarea {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color .14s ease, box-shadow .14s ease;
}
.input::placeholder, .textarea::placeholder { color: #98a095; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--moss);
  box-shadow: 0 0 0 3px rgba(63, 107, 80, .12);
}
.textarea { height: auto; min-height: 76px; padding: 9px 11px; resize: vertical; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%); background-position: calc(100% - 16px) 16px, calc(100% - 11px) 16px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .span-2 { grid-column: span 2; }

.form-error {
  padding: 9px 12px;
  border-left: 3px solid var(--danger);
  background: rgba(161, 61, 42, .07);
  color: var(--danger);
  font-size: 13px;
}
.form-success {
  padding: 9px 12px;
  border-left: 3px solid var(--moss);
  background: var(--moss-soft);
  color: #2c4f3a;
  font-size: 13px;
}

/* ------------------------------------------------------------
   Тепловая карта покрытия
   ------------------------------------------------------------ */

.coverage {
  margin-top: 18px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
}

.coverage-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 22px 16px;
}

.coverage-number {
  font-family: var(--font-display);
  font-size: clamp(40px, 5vw, 62px);
  line-height: .95;
  letter-spacing: -.03em;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.coverage-number small { font-size: .4em; color: var(--ink-2); letter-spacing: 0; margin-left: 3px; }
.coverage-label { margin-top: 7px; color: var(--ink-2); font-size: 13px; }

.coverage-legend { display: flex; gap: 20px; flex-wrap: wrap; align-items: center; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); }
.legend-swatch { width: 22px; height: 8px; flex: 0 0 auto; border-radius: 1px; }
.legend-swatch.fill { background: linear-gradient(90deg, #8a4a2c, var(--amber), var(--amber-2)); }
.legend-swatch.is-empty { background: repeating-linear-gradient(135deg, var(--paper-2) 0 4px, var(--line) 4px 5px); border: 1px solid var(--line-strong); }

.coverage-strip {
  display: flex;
  height: 46px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  background: repeating-linear-gradient(135deg, var(--paper-2) 0 4px, var(--line) 4px 5px);
  position: relative;
}
.coverage-fill {
  height: 100%;
  background: linear-gradient(90deg, #7d432b 0%, #bd6a2f 38%, var(--amber) 70%, var(--amber-2) 100%);
  position: relative;
}
.coverage-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 39px, rgba(19, 27, 22, .18) 39px 40px);
}
.coverage-ticks {
  display: flex;
  justify-content: space-between;
  padding: 6px 22px 0;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.coverage-foot {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 22px 16px;
  font-size: 12.5px;
  color: var(--ink-2);
}

/* ------------------------------------------------------------
   KPI
   ------------------------------------------------------------ */

.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 22px;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

.kpi { padding: 18px 20px 16px; border-left: 1px solid var(--line); }
.kpi:first-child { border-left: 0; padding-left: 0; }
.kpi-value {
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.kpi-label { margin-top: 8px; color: var(--ink-2); font-size: 12.5px; }
.kpi-note { margin-top: 3px; color: var(--ink-3); font-size: 11.5px; }
.kpi-value .accent { color: var(--ember); }

/* ------------------------------------------------------------
   Сетка обзора
   ------------------------------------------------------------ */

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, .85fr);
  gap: 34px;
  margin-top: 34px;
  align-items: start;
}

.panel { min-width: 0; }

.brand-table { width: 100%; border-collapse: collapse; }
.brand-table th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-3);
  padding: 9px 10px 9px 0;
  border-bottom: 1px solid var(--line);
}
.brand-table td {
  padding: 9px 10px 9px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-size: 13px;
}
.brand-table tr:last-child td { border-bottom: 0; }
.brand-name-cell { font-weight: 500; }
.brand-bar {
  height: 6px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  width: 100%;
  min-width: 70px;
  position: relative;
}
.brand-bar > span { display: block; height: 100%; background: var(--amber); }
.brand-num { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-2); white-space: nowrap; }

.needs-mini { border-top: 1px solid var(--line-strong); }
.needs-mini-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}
.needs-mini-item:hover .needs-mini-title { text-decoration: underline; text-underline-offset: 3px; }
.needs-mini-brand { display: block; font-size: 11px; color: var(--ink-3); }
.needs-mini-title { display: block; font-size: 13.5px; font-weight: 500; margin-top: 1px; }
.needs-mini-meta { display: block; font-size: 11.5px; color: var(--ink-2); margin-top: 3px; }
.needs-mini-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-2);
  align-self: center;
  white-space: nowrap;
}

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

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-strong);
}

.search-wrap { position: relative; flex: 1 1 240px; max-width: 380px; }
.search-wrap svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--ink-3); }
.search-wrap .input { padding-left: 32px; }

.toolbar .select { width: auto; min-width: 150px; }
.toolbar-spacer { flex: 1 1 auto; }
.toolbar-note { font-size: 12px; color: var(--ink-3); }

.table-wrap { width: 100%; overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data th {
  text-align: left;
  font-weight: 500;
  font-size: 11.5px;
  color: var(--ink-3);
  padding: 10px 12px 10px 0;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
  vertical-align: bottom;
}
table.data td {
  padding: 11px 12px 11px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: rgba(255, 255, 255, .45); }
td.num, th.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }

.cell-title { font-weight: 500; color: var(--ink); }
.cell-sub { margin-top: 2px; color: var(--ink-3); font-size: 11.5px; font-family: var(--font-mono); }
.cell-actions { display: flex; gap: 6px; justify-content: flex-end; }

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

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border-radius: 11px;
  font-size: 11.5px;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid transparent;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; flex: 0 0 auto; }
.pill-have { color: #2f5b42; background: var(--moss-soft); border-color: #c6d8c4; }
.pill-series { color: #6b5a22; background: #f2e9cf; border-color: #e0d3ab; }
.pill-missing { color: #8a3f27; background: #f3ded2; border-color: #e4c5b4; }
.pill-pending { color: #3c5b66; background: var(--blue-soft); border-color: #c4d5da; }
.pill-duplicate { color: var(--ink-2); background: var(--paper-2); border-color: var(--line); }
.pill-error { color: var(--danger); background: #f1d9d2; border-color: #e0bdb3; }
.pill-neutral { color: var(--ink-2); background: var(--surface-2); border-color: var(--line); }

.tag {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-2);
  background: var(--surface);
}

.source-note { display: block; margin-top: 3px; font-size: 11.5px; color: var(--ink-3); }
.source-note.warn { color: #8a5a2a; }
.source-note.ok { color: #3d634c; }

/* ------------------------------------------------------------
   Вкладки
   ------------------------------------------------------------ */

.tabs {
  display: flex;
  gap: 26px;
  border-bottom: 1px solid var(--line-strong);
  margin-top: 4px;
}
.tab {
  position: relative;
  padding: 12px 0 11px;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: 13.5px;
  cursor: pointer;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); }
.tab.is-active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--ink); }
.tab-count { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); margin-left: 5px; }

/* ------------------------------------------------------------
   Список потребностей
   ------------------------------------------------------------ */

.need-group { border-bottom: 1px solid var(--line); }
.need-group:first-child { border-top: 1px solid var(--line-strong); }

.need-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1.6fr) 92px 92px minmax(0, 1.15fr) auto;
  gap: 14px;
  align-items: center;
  padding: 13px 0;
  cursor: pointer;
}
.need-row:hover { background: rgba(255, 255, 255, .4); }
.need-caret {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-2);
  transition: transform .15s ease;
}
.need-group.is-open .need-caret { transform: rotate(90deg); }
.need-title { font-weight: 500; font-size: 13.5px; }
.need-brand { font-size: 11.5px; color: var(--ink-3); margin-bottom: 1px; }
.need-sub { margin-top: 2px; font-size: 11.5px; color: var(--ink-2); }
.need-stat { text-align: left; }
.need-stat-value { font-family: var(--font-mono); font-size: 13px; }
.need-stat-label { font-size: 10.5px; color: var(--ink-3); }
.need-source { font-size: 11.5px; color: var(--ink-2); }
.need-actions { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.need-devices { display: none; padding: 0 0 14px 56px; }
.need-group.is-open .need-devices { display: block; }
.need-device {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-top: 1px dashed var(--line);
  font-size: 12.5px;
}
.need-device-title { color: var(--ink); }
.need-device-meta { color: var(--ink-3); font-family: var(--font-mono); font-size: 11px; white-space: nowrap; }

.claim-note { font-size: 11.5px; color: var(--ink-2); margin-top: 3px; }
.claim-note strong { font-weight: 500; }

/* ------------------------------------------------------------
   Загрузка
   ------------------------------------------------------------ */

.upload-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(260px, .8fr); gap: 26px; align-items: start; margin-top: 18px; }

.dropzone {
  position: relative;
  border: 1.5px dashed var(--line-strong);
  background:
    repeating-linear-gradient(135deg, rgba(211, 214, 200, .18) 0 6px, transparent 6px 12px),
    var(--surface);
  border-radius: var(--radius);
  padding: 28px 22px;
  text-align: center;
  transition: border-color .15s ease, background .15s ease;
  cursor: pointer;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--amber); background-color: #fbf7ec; }
.dropzone-icon {
  width: 38px; height: 38px;
  margin: 0 auto 10px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--ink-2);
  background: var(--paper);
}
.dropzone-title { font-size: 14px; font-weight: 500; }
.dropzone-hint { margin-top: 4px; font-size: 12px; color: var(--ink-2); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.file-list { margin-top: 12px; border-top: 1px solid var(--line); }
.file-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.file-item-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item-size { color: var(--ink-3); font-family: var(--font-mono); font-size: 11px; }
.file-item-remove { border: 0; background: transparent; color: var(--ink-3); cursor: pointer; padding: 3px; }
.file-item-remove:hover { color: var(--danger); }

.progress { height: 4px; background: var(--paper-2); border: 1px solid var(--line); margin-top: 14px; overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; background: var(--amber); transition: width .2s ease; }

.upload-side { border-left: 1px solid var(--line); padding-left: 22px; }
.upload-side h3 { font-family: var(--font-display); font-weight: 500; font-size: 14px; margin-bottom: 8px; }
.upload-side p { font-size: 12.5px; color: var(--ink-2); line-height: 1.55; }
.upload-side ol { margin: 10px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--ink-2); }
.upload-side li { margin-bottom: 6px; }
.upload-side code { font-family: var(--font-mono); font-size: 11.5px; background: var(--paper-2); padding: 1px 4px; border-radius: 2px; }

.upload-results { margin-top: 14px; }
.upload-result { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.upload-result-name { font-weight: 500; }
.upload-result-msg { color: var(--ink-2); font-size: 11.5px; margin-top: 1px; }

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

dialog.dialog {
  width: min(560px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
}
dialog.dialog::backdrop { background: rgba(19, 27, 22, .55); backdrop-filter: blur(2px); }
.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}
.dialog-head h2 { font-family: var(--font-display); font-size: 19px; font-weight: 500; }
.dialog-head p { color: var(--ink-2); font-size: 12.5px; margin-top: 4px; }
.dialog-body { padding: 18px 20px; max-height: min(64vh, 620px); overflow-y: auto; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px 18px; border-top: 1px solid var(--line); }
.dialog-close { border: 0; background: transparent; color: var(--ink-2); cursor: pointer; padding: 4px; }
.dialog-close:hover { color: var(--ink); }

/* ------------------------------------------------------------
   Тосты, пустые состояния, скелетоны
   ------------------------------------------------------------ */

.toast-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(380px, calc(100vw - 36px));
}
.toast {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 13px;
  background: var(--rail);
  color: var(--rail-ink);
  border-left: 3px solid var(--amber);
  box-shadow: var(--shadow);
  font-size: 13px;
  animation: toast-in .18s ease-out;
}
.toast.is-error { border-left-color: var(--ember); }
.toast.is-success { border-left-color: var(--moss); }
.toast button { margin-left: auto; background: transparent; border: 0; color: rgba(236, 233, 218, .55); cursor: pointer; }
@keyframes toast-in { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }

.empty {
  padding: 42px 20px;
  text-align: center;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line);
}
.empty h3 { font-family: var(--font-display); font-size: 18px; font-weight: 500; color: var(--ink); margin-bottom: 6px; }
.empty p { font-size: 13px; max-width: 46ch; margin: 0 auto 16px; }

.loading { padding: 40px 0; color: var(--ink-3); font-size: 13px; }
.skeleton { background: linear-gradient(90deg, var(--paper-2) 25%, #f3f3ea 37%, var(--paper-2) 63%); background-size: 400% 100%; animation: shimmer 1.2s ease infinite; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.skeleton-row { height: 38px; margin-bottom: 6px; }

/* ------------------------------------------------------------
   Адаптив
   ------------------------------------------------------------ */

@media (max-width: 1080px) {
  .overview-grid { grid-template-columns: 1fr; gap: 30px; }
  .upload-layout { grid-template-columns: 1fr; }
  .upload-side { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; padding-top: 18px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi:nth-child(3) { border-left: 0; padding-left: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--line); }
}

@media (max-width: 900px) {
  .login-shell { grid-template-columns: minmax(0, 1fr); }
  .login-visual { min-height: 46vh; padding: 28px 24px 24px; }
  .login-scope { width: 100vw; height: 100vw; right: -40vw; top: 10%; opacity: .35; }
  .login-panel { display: block; border-left: 0; padding: 32px 20px 44px; width: 100%; }
  .login-form { width: 100%; max-width: 360px; margin: 0 auto; }
  .login-copy h1 { font-size: clamp(30px, 8vw, 44px); }
  .login-foot { display: none; }
  .topbar { gap: 14px; padding: 0 16px; overflow-x: auto; }
  .brand-name small { display: none; }
  .topnav { gap: 0; }
  .topnav-link { padding: 0 10px; font-size: 12.5px; }
  .topnav-link svg { display: none; }
  .topnav-count { display: none; }
  .topbar-user .user-meta { display: none; }
  .app-main { padding: 22px 16px 52px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 14px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .need-row { grid-template-columns: 24px minmax(0, 1fr) auto; row-gap: 6px; }
  .need-stat, .need-source { display: none; }
  .need-actions { grid-column: 2 / -1; justify-content: flex-start; }
  .need-devices { padding-left: 38px; }
  .coverage-top { flex-direction: column; align-items: flex-start; gap: 12px; }
  .coverage-foot { flex-direction: column; gap: 4px; }
}

@media (max-width: 700px) {
  .topbar { gap: 6px; padding: 0 12px; overflow-x: hidden; }
  .brand-name { display: none; }
  .topnav { flex: 0 0 auto; }
  .topnav-link { padding: 0 9px; }
  .topnav-link svg { display: block; }
  .topnav-link > span:not(.topnav-count) { display: none; }
  .topnav-link.is-active::after { left: 6px; right: 6px; }
  .topbar-user { gap: 8px; }
}

@media (max-width: 560px) {
  .kpis { grid-template-columns: 1fr; }
  .kpi { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); }
  .kpi:first-child { border-top: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .brand-table .hide-sm { display: none; }
  .toolbar .select { flex: 1 1 140px; min-width: 0; }
  .search-wrap { max-width: none; }
  .page-actions { width: 100%; flex-direction: column; align-items: stretch; }
  .page-actions .btn { width: 100%; }
}

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