:root {
  --graphite: #7e8085;
  --panel: #2a2f36;
  --panel-dark: #23272d;
  --panel-alt: #252a30;
  --ink: #c9d1d9;
  --muted: #8e98a3;
  --accent: #7fb4d6;
  --accent-soft: rgba(127, 180, 214, 0.18);
  --steel: #9aa4ae;
  --line: rgba(255, 255, 255, 0.07);
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  --mono: "JetBrains Mono", "Consolas", monospace;
  --sans: "Inter Tight", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body, #root { min-height: 100%; }
#root { overflow-x: clip; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(255, 255, 255, 0.18), transparent 60%),
    linear-gradient(160deg, #8b8d92 0%, var(--graphite) 45%, #6f7176 100%);
}

button, input { font-family: inherit; }

.boot {
  padding: 48px;
  color: var(--ink);
  font-size: 18px;
  letter-spacing: 0.04em;
}

.error {
  margin: 16px 0;
  padding: 12px 16px;
  border: 1px solid rgba(224, 122, 122, 0.55);
  background: rgba(90, 30, 30, 0.35);
  color: #f2c6c6;
  border-radius: 8px;
  font-size: 13px;
  word-break: break-word;
}

/* --- каркас --- */

.dust-layer {
  position: fixed;
  inset: 0;
  z-index: 15;
  pointer-events: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 18px 34px;
  background: linear-gradient(180deg, #262b32 0%, #1f242a 100%);
  border-bottom: 1px solid #111519;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 290px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.brand:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; }
.brand:hover .brand-title { color: var(--accent); }
.brand:hover .brand-theme-glyph { opacity: 1; }

.brand-theme-glyph {
  margin-left: 8px;
  font-size: 13px;
  color: var(--muted);
  opacity: 0.5;
  vertical-align: 1px;
  transition: opacity 0.15s ease;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
  border: 1px solid rgba(127, 180, 214, 0.35);
  background: linear-gradient(145deg, #2f353d, #20252b);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), inset 0 -2px 0 rgba(0, 0, 0, 0.55);
}

.brand-title {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #dde5ee;
  text-shadow: 0 1px 0 #000, 0 -1px 0 rgba(255, 255, 255, 0.06);
}

.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: 0.22em; text-transform: uppercase; }

.tabs { display: flex; gap: 6px; }

.tabs button {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 10px 20px;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 4px;
}

.tabs button:hover { color: var(--ink); background: rgba(255, 255, 255, 0.04); }

.tabs button.active {
  color: var(--accent);
  border-color: rgba(127, 180, 214, 0.35);
  background: linear-gradient(180deg, rgba(127, 180, 214, 0.12), rgba(127, 180, 214, 0.03));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.main-tabs { flex: 1; }
.main-tabs button {
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main-tabs-shell {
  position: relative;
  flex: 1;
  min-width: 0;
}

.main-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-behavior: smooth;
  padding: 2px 0;
}

.main-tabs::-webkit-scrollbar { display: none; }
.main-tabs button { flex: 0 0 auto; }

.tabs-scroll-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 38px;
  z-index: 2;
  cursor: pointer;
  border: 0;
  padding: 0;
  font: inherit;
}
.tabs-scroll-zone.left {
  left: 0;
  background: linear-gradient(90deg, rgba(38, 43, 50, 0.98), rgba(38, 43, 50, 0));
}
.tabs-scroll-zone.right {
  right: 0;
  background: linear-gradient(270deg, rgba(38, 43, 50, 0.98), rgba(38, 43, 50, 0));
}
.tabs-scroll-zone:hover { background-color: rgba(127, 180, 214, 0.06); }

/* --- получить клиента --- */

.get-client-page { display: flex; flex-direction: column; gap: 14px; }
.get-client-panel { padding: 18px; }
.get-client-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.get-client-grid > div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #1e2329;
}
.get-client-grid b { display: block; margin-bottom: 5px; color: #e8f0f6; font-weight: 500; font-size: 12px; }
.get-client-grid span { display: block; color: var(--muted); font-size: 10.5px; line-height: 1.5; }
@media (max-width: 860px) {
  .get-client-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .get-client-grid { grid-template-columns: 1fr; }
}

.topbar-note { font-size: 11px; color: #6f7882; letter-spacing: 0.08em; }

.page {
  position: relative;
  z-index: 10;
  max-width: 1680px;
  margin: 0 auto;
  padding: 22px 28px 60px;
}

.panel {
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 7px),
    linear-gradient(180deg, #2d333b 0%, var(--panel) 55%, #262b32 100%);
  border: 1px solid #171b20;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  border-radius: 6px;
}

.panel-title {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
  text-shadow: 0 1px 0 #000, 0 -1px 0 rgba(255, 255, 255, 0.06);
  margin-bottom: 12px;
}

/* --- фильтры --- */

.filter-panel { padding: 16px; margin-bottom: 18px; }

.filter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 12px;
}

.slot {
  position: relative;
  padding: 10px 12px;
  min-height: 78px;
  background: linear-gradient(180deg, #22262c, #262b31);
  border: 1px solid #14171b;
  border-top-color: rgba(255, 255, 255, 0.09);
  border-bottom-color: #0e1114;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.45), inset 0 -1px 0 rgba(255, 255, 255, 0.04);
  border-radius: 4px;
}

.slot-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #98a3ae;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.multi {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 4px 8px;
  background: #1c2025;
  border: 1px solid #111418;
  border-radius: 4px;
  cursor: text;
}

.multi.is-open { border-color: rgba(127, 180, 214, 0.5); box-shadow: 0 0 0 1px rgba(127, 180, 214, 0.15); }

.chips { display: flex; flex-wrap: wrap; gap: 5px; flex: 1; align-items: center; max-height: 74px; overflow-y: auto; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px 3px 8px;
  font-size: 12px;
  color: #dbe6ef;
  background: linear-gradient(180deg, #34404a, #2a333c);
  border: 1px solid rgba(127, 180, 214, 0.28);
  border-radius: 3px;
}

.chip button {
  border: 0;
  background: transparent;
  color: #9fb3c4;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
}

.chip button:hover { color: #fff; }

.multi input {
  flex: 1;
  min-width: 90px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  padding: 4px 0;
}

.multi input::placeholder { color: #6f7983; }

.multi-caret { color: #69737d; font-size: 11px; }

.dropdown {
  position: absolute;
  z-index: 40;
  top: calc(100% - 6px);
  left: 10px;
  right: 10px;
  background: #20252b;
  border: 1px solid #101317;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.55);
  border-radius: 4px;
  max-height: min(460px, 62vh);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.dropdown-note { padding: 10px 12px; color: var(--muted); font-size: 12px; }

.dropdown-list {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #40566a #20252b;
}

.dropdown-list::-webkit-scrollbar { width: 9px; }
.dropdown-list::-webkit-scrollbar-track { background: #1a1e23; }
.dropdown-list::-webkit-scrollbar-thumb { background: #40566a; border-radius: 5px; }
.dropdown-list::-webkit-scrollbar-thumb:hover { background: #4d677f; }

.dropdown-addall {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-bottom: 1px solid rgba(127, 180, 214, 0.18);
  background: rgba(127, 180, 214, 0.07);
  color: var(--accent);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.dropdown-addall:hover { background: rgba(127, 180, 214, 0.14); }

.dropdown-item {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.dropdown-item:hover { background: rgba(127, 180, 214, 0.1); }
.dropdown-item.selected { background: rgba(127, 180, 214, 0.08); }
.dropdown-item.selected .dropdown-main { color: var(--accent); }
.dropdown-item.excluded .dropdown-main { color: #c99b9b; text-decoration: line-through; }

.dropdown-main {
  display: flex;
  flex: 1;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.dropdown-exclude {
  flex: 0 0 34px;
  border: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.05);
  background: transparent;
  color: #6f7983;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.dropdown-exclude:hover { color: #e0a0a0; background: rgba(224, 120, 120, 0.08); }
.dropdown-exclude.is-excluded { color: #e08c8c; background: rgba(224, 120, 120, 0.12); }
.dropdown-count { color: var(--muted); font-family: var(--mono); font-size: 11px; }

.chip-excluded {
  background: linear-gradient(180deg, #3a2d2d, #2c2424);
  border-color: rgba(214, 127, 127, 0.35);
  color: #d9b9b9;
}

.chip-not { color: #d68f8f; font-family: var(--mono); }

.range-values {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}

.range-values input {
  width: 100%;
  min-width: 0;
  padding: 4px 6px;
  border: 1px solid #111418;
  background: #1c2025;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  text-align: center;
  border-radius: 3px;
}

.range-values span { color: #6f7983; }

.range-track { position: relative; height: 26px; }

.range-track::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 11px;
  height: 5px;
  background: #14181c;
  border-radius: 4px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.7), 0 1px 0 rgba(255, 255, 255, 0.05);
}

.range-fill {
  position: absolute;
  top: 11px;
  height: 5px;
  background: linear-gradient(180deg, #8fc6e8, #5d93b6);
  border-radius: 4px;
  box-shadow: 0 0 10px rgba(127, 180, 214, 0.35);
}

.range-track input[type="range"] {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 26px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  pointer-events: none;
}

.range-track input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  pointer-events: auto;
  width: 16px;
  height: 22px;
  border-radius: 4px;
  background: linear-gradient(180deg, #d7e3ec, #8c99a5 45%, #5c6873);
  border: 1px solid #111;
  box-shadow: inset 0 1px 0 #fff, 0 2px 6px rgba(0, 0, 0, 0.6);
  cursor: ew-resize;
}

.range-track input[type="range"]::-moz-range-thumb {
  pointer-events: auto;
  width: 16px;
  height: 22px;
  border-radius: 4px;
  background: linear-gradient(180deg, #d7e3ec, #8c99a5 45%, #5c6873);
  border: 1px solid #111;
  cursor: ew-resize;
}

.range-limits {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 10px;
  color: #6f7983;
}

.utility-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
}

.free-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #1c2025;
  border: 1px solid #111418;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.45);
  border-radius: 4px;
}

.free-icon { color: var(--accent); font-size: 18px; }

.free-search input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
}

.free-search input::placeholder { color: #707a84; }

.ghost-btn {
  padding: 10px 16px;
  border: 1px solid #3a424b;
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent);
  color: #b7c1cb;
  font-size: 12px;
  letter-spacing: 0.06em;
  cursor: pointer;
  white-space: nowrap;
}

.ghost-btn:hover { border-color: var(--accent); color: var(--accent); }

.filter-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  gap: 16px;
}

.find-btn {
  min-width: 260px;
  padding: 16px 40px;
  border: 1px solid #4b6a80;
  border-radius: 5px;
  color: #eaf4fb;
  background: linear-gradient(180deg, #4f7f9f 0%, #3b647f 45%, #2f5268 100%);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-shadow: 0 1px 0 #000;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), inset 0 -3px 0 rgba(0, 0, 0, 0.4), 0 8px 18px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

.find-btn:hover { background: linear-gradient(180deg, #5e93b4 0%, #477694 45%, #37607a 100%); }
.find-btn:active { transform: translateY(2px); box-shadow: inset 0 3px 10px rgba(0, 0, 0, 0.6); }

/* --- таблица --- */

.table-panel { padding: 14px 16px 16px; }

.table-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.table-title {
  font-size: 14px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #d7e0e9;
  text-shadow: 0 1px 0 #000;
}

.table-sub { margin-top: 4px; font-size: 12px; color: var(--muted); }

.gear { position: relative; }

.gear-btn {
  width: 36px;
  height: 36px;
  border: 1px solid #3a424b;
  border-radius: 4px;
  background: #242a31;
  color: var(--ink);
  font-size: 17px;
  cursor: pointer;
}

.gear-btn:hover { border-color: var(--accent); color: var(--accent); }

.gear-menu {
  position: absolute;
  right: 0;
  top: 42px;
  z-index: 50;
  width: 230px;
  padding: 12px;
  background: #20252b;
  border: 1px solid #101317;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.55);
  border-radius: 4px;
}

.gear-title { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }

.gear-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
}

.gear-item input { accent-color: var(--accent); }

.table-wrap {
  max-height: 58vh;
  overflow: auto;
  border: 1px solid #14171b;
  border-radius: 4px;
  background: #1f242a;
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #a9b4bf;
  background: #262c33;
  border-bottom: 1px solid #111418;
  white-space: nowrap;
}

thead th button {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
  padding: 0;
}

thead th.sortable button:hover { color: var(--accent); text-shadow: 0 0 8px rgba(127, 180, 214, 0.5); }
thead th button.active { color: var(--accent); }

.sort-mark { margin-left: 6px; font-size: 9px; color: #6f7983; }

tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.035);
  color: #c2ccd5;
  vertical-align: top;
}

tbody tr:nth-child(odd) { background: var(--panel-dark); }
tbody tr:nth-child(even) { background: var(--panel-alt); }
tbody tr:hover { background: rgba(127, 180, 214, 0.06); }

td.mono, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

td a { color: #9fc7e0; text-decoration: none; white-space: nowrap; }
td a:hover { text-decoration: underline; }

.empty-row { text-align: center; color: var(--muted); padding: 30px; }

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 12px 0 8px;
  font-size: 12px;
  color: var(--muted);
}

.pager button {
  padding: 7px 14px;
  border: 1px solid #3a424b;
  border-radius: 3px;
  background: #242a31;
  color: var(--ink);
  cursor: pointer;
}

.pager button:disabled { opacity: 0.35; cursor: default; }
.pager button:not(:disabled):hover { border-color: var(--accent); color: var(--accent); }

.export-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  margin-top: 10px;
  padding: 18px 24px;
  overflow: hidden;
  border: 1px solid #3f484f;
  border-radius: 5px;
  background: linear-gradient(180deg, #30373f 0%, #23282e 60%, #1c2025 100%);
  color: #d8e2eb;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.32em;
  text-shadow: 0 1px 0 #000;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), inset 0 -3px 0 rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.export-btn::after {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 40%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.18), transparent);
  transform: skewX(-20deg);
  transition: left 0.5s ease;
}

.export-btn:hover::after { left: 120%; }
.export-btn:hover { border-color: var(--accent); color: #eaf4fb; }
.export-icon { font-size: 18px; }

/* --- аналитика --- */

.analytics-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.period-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid #14171b;
  border-radius: 7px;
  background: #1c2025;
}

.period-switch button {
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  padding: 7px 16px;
  font-size: 12px;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.period-switch button:hover { color: var(--ink); }
.period-switch button.active {
  background: linear-gradient(180deg, #3d4b57, #2c363f);
  color: #eaf2f8;
}

.period-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 12px;
}

.period-date { color: var(--muted); }
.flow-in { color: #8fc7a1; }
.flow-out { color: #d99a9a; }
.flow-meta { display: inline-flex; gap: 7px; }

.analytics-top {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.stack-panel { padding: 14px; min-height: 380px; display: flex; flex-direction: column; }

.stack { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; max-height: 480px; }

.stack-item {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-bottom-color: rgba(255, 255, 255, 0.04);
  background: #242930;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  font-size: 13px;
}

.stack-item:hover { background: #2a3038; }
.stack-item.selected { border-color: rgba(127, 180, 214, 0.45); background: rgba(127, 180, 214, 0.08); color: #e4eef6; }
.stack-item.compact { grid-template-columns: 1fr auto; cursor: default; }
.stack-item.compact:not(.selected) { cursor: pointer; }

.drag-handle { color: #5f6972; cursor: grab; font-size: 12px; letter-spacing: -1px; }

.stack-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stack-meta { font-family: var(--mono); font-size: 11px; color: var(--muted); white-space: nowrap; }

.stack-reset { margin-top: 10px; align-self: flex-start; }

.brands-panel { padding: 14px 16px 18px; }

.brands-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }

.bars { display: flex; flex-direction: column; gap: 9px; }

.bar-row { display: grid; grid-template-columns: 170px 1fr 70px; align-items: center; gap: 12px; }
.bar-row.flow { grid-template-columns: 170px 1fr 110px; }

.bar-label { font-size: 13px; color: #cfd8e1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.bar-track { height: 14px; background: #171b20; box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6); border-radius: 2px; overflow: hidden; }

.bar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #4c7d9b, #7fb4d6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.bar-track.flow {
  display: flex;
  gap: 2px;
  background: #171b20;
}

.bar-track.flow .bar-fill,
.bar-track.flow .bar-fill-left {
  flex: 0 0 auto;
}

.bar-fill-left {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #8a5f5f, #c08484);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.bar-value { text-align: right; font-size: 12px; color: #c6d0d9; }

.counterparty-page { display: flex; flex-direction: column; gap: 14px; }

.counterparty-search { padding: 16px 18px; }
.counterparty-search-row {
  display: grid;
  grid-template-columns: minmax(220px, 420px) 180px;
  gap: 12px;
  align-items: end;
}
.counterparty-search .rate-field { margin: 0; }
.counterparty-search-hint {
  margin-top: 10px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.5;
}
.counterparty-error {
  margin-top: 12px;
  padding: 9px 10px;
  border: 1px solid rgba(220, 120, 120, 0.35);
  border-radius: 5px;
  background: rgba(120, 40, 40, 0.18);
  color: #f0b6b6;
  font-size: 11px;
  line-height: 1.5;
}
.counterparty-empty { padding: 26px 18px; color: var(--muted); font-size: 12px; line-height: 1.6; text-align: center; }

.counterparty-attention { padding: 16px 18px; }
.counterparty-attention-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 10px;
}
.counterparty-attention-meta { color: var(--muted); font-size: 10.5px; }
.counterparty-factor-list { display: flex; flex-direction: column; gap: 6px; }
.counterparty-factor {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 10px;
  align-items: baseline;
  padding: 7px 9px;
  border-radius: 4px;
  background: #23282e;
  border-left: 3px solid #c8a800;
  font-size: 11px;
}
.counterparty-factor.stop { border-left-color: #c25757; background: rgba(150, 50, 50, 0.12); }
.counterparty-factor span { text-transform: uppercase; letter-spacing: 0.08em; font-size: 9px; color: #d9c98e; }
.counterparty-factor.stop span { color: #e3a1a1; }
.counterparty-factor b { font-weight: 400; color: #e6eef5; }
.counterparty-factor-empty { color: #9fd0ae; font-size: 11px; }

.counterparty-leasing { padding: 16px 18px; }
.counterparty-leasing-kpi {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.counterparty-leasing-kpi > div {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #1e2329;
}
.counterparty-leasing-kpi span {
  display: block;
  color: var(--muted);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  line-height: 1.35;
}
.counterparty-leasing-kpi b { display: block; margin-top: 5px; font-size: 20px; color: #e8f0f6; font-weight: 400; }
.counterparty-leasing-table-wrap { max-height: 320px; overflow-y: auto; }
.counterparty-leasing-table th:first-child,
.counterparty-leasing-table td:first-child { text-align: left; }
.counterparty-leasing-table tbody tr { cursor: pointer; }
.counterparty-messages { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.counterparty-messages-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}
.counterparty-messages-table th.sortable { cursor: pointer; user-select: none; }
.counterparty-messages-table th.sortable:hover { color: var(--accent); }
.counterparty-messages-table td:first-child { text-align: left; white-space: nowrap; }
.counterparty-messages-table td:nth-child(2),
.counterparty-messages-table td:nth-child(3),
.counterparty-messages-table td:nth-child(4) { text-align: left; }
.counterparty-messages-table td:last-child { text-align: left; white-space: normal; min-width: 180px; }
.counterparty-messages-table a { color: var(--accent); font-size: 9.5px; text-decoration: none; }
.counterparty-messages-table a:hover { text-decoration: underline; }
.counterparty-api-note { margin-top: 8px; line-height: 1.5; }

.counterparty-verdict {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 15px 18px;
  border: 1px solid var(--line);
  border-left: 4px solid #7f8b95;
  border-radius: 7px;
  background: #20252b;
}
.counterparty-verdict.green { border-left-color: #61a879; background: rgba(60, 120, 80, 0.13); }
.counterparty-verdict.yellow { border-left-color: #c8a800; background: rgba(200, 168, 0, 0.1); }
.counterparty-verdict.red { border-left-color: #c25757; background: rgba(150, 50, 50, 0.14); }
.counterparty-verdict.null { border-left-color: #7f8b95; background: rgba(120, 130, 140, 0.08); }
.counterparty-verdict-label { font-size: 17px; font-weight: 600; color: #eaf2f8; }
.counterparty-verdict-inn { margin-top: 4px; color: var(--muted); font-size: 11px; }
.counterparty-verdict-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: flex-end;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  text-align: right;
}

.counterparty-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.counterparty-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.counterparty-card { padding: 15px 16px; }
.counterparty-card .panel-title { margin-bottom: 12px; }
.counterparty-company-name { font-size: 15px; color: #eaf2f8; font-weight: 500; }
.counterparty-company-full { margin-top: 3px; color: var(--muted); font-size: 10.5px; line-height: 1.45; }
.counterparty-facts { display: grid; gap: 7px; margin-top: 12px; }
.counterparty-facts > div {
  display: grid;
  grid-template-columns: 145px 1fr;
  gap: 10px;
  align-items: baseline;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 11px;
}
.counterparty-facts span { color: var(--muted); }
.counterparty-facts b { color: #d9e3eb; font-weight: 400; }
.counterparty-founders { margin-top: 10px; color: var(--muted); font-size: 10.5px; line-height: 1.55; }
.counterparty-founders > span { display: block; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.08em; font-size: 9px; }

.counterparty-flow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.counterparty-flow > div { padding: 10px 11px; border: 1px solid var(--line); border-radius: 5px; background: #1e2329; }
.counterparty-flow b { display: block; font-size: 19px; color: #e8f0f6; }
.counterparty-flow span { display: block; margin-top: 2px; color: var(--muted); font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.07em; }
.counterparty-lessors { max-height: 200px; overflow-y: auto; }
.counterparty-lessors-title { margin-bottom: 6px; }
.counterparty-note {
  margin-top: 10px;
  padding: 8px 10px;
  border-left: 2px solid #c8a800;
  border-radius: 4px;
  background: rgba(200, 168, 0, 0.08);
  color: #d9c98e;
  font-size: 10.5px;
  line-height: 1.5;
}

.counterparty-risk-block { font-size: 11px; line-height: 1.6; }
.counterparty-risk-block + .counterparty-risk-block { margin-top: 10px; }
.counterparty-risk-block.danger { color: #e3a1a1; }
.counterparty-risk-block.warn { color: #d9c98e; }
.counterparty-risk-title { margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.08em; font-size: 9px; opacity: 0.85; }

.counterparty-list { display: flex; flex-direction: column; gap: 6px; }
.counterparty-list-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 11px;
}
.counterparty-list-row b { font-weight: 400; color: #e6eef5; white-space: nowrap; }
.counterparty-muted { color: var(--muted); font-size: 10px; }
.counterparty-person { padding: 8px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.04); font-size: 11px; line-height: 1.5; }
.counterparty-person b { color: #e6eef5; font-weight: 500; }
.counterparty-person .mono { margin-left: 7px; color: var(--muted); font-size: 10px; }

.counterparty-table td:first-child { text-align: left; white-space: nowrap; }
.counterparty-table td:nth-child(2) { text-align: left; color: var(--muted); }

.counterparty-sources { display: flex; flex-wrap: wrap; gap: 6px; }
.counterparty-source {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 10px;
  color: var(--muted);
}
.counterparty-source.ok { border-color: rgba(97, 168, 121, 0.35); color: #9fd0ae; }
.counterparty-source.empty { border-color: rgba(127, 180, 214, 0.22); }
.counterparty-source.unchecked { border-color: rgba(200, 168, 0, 0.35); color: #d9c98e; }
.counterparty-disclaimer { margin-top: 10px; color: var(--muted); font-size: 10px; line-height: 1.5; }

@media (max-width: 980px) {
  .counterparty-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .counterparty-grid { grid-template-columns: 1fr; }
  .counterparty-leasing-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .counterparty-search-row { grid-template-columns: 1fr; }
  .counterparty-kpi-grid { grid-template-columns: 1fr; }
  .counterparty-leasing-kpi { grid-template-columns: 1fr; }
  .counterparty-verdict { align-items: flex-start; flex-direction: column; }
  .counterparty-verdict-meta { align-items: flex-start; text-align: left; }
  .counterparty-facts > div { grid-template-columns: 1fr; gap: 2px; }
  .counterparty-attention-head,
  .counterparty-messages-head { flex-direction: column; align-items: flex-start; }
}

/* --- модалка --- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 12, 15, 0.7);
  display: grid;
  place-items: center;
}

.modal {
  width: min(760px, 92vw);
  max-height: 80vh;
  overflow: auto;
  padding: 22px;
  background: #23282f;
  border: 1px solid #3a424b;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
}

.modal-title { font-size: 15px; letter-spacing: 0.16em; text-transform: uppercase; margin-bottom: 12px; }
.modal-text { margin: 0 0 14px; font-size: 12px; line-height: 1.6; color: var(--muted); }

.modal ol { margin: 0 0 16px; padding-left: 22px; }
.modal li { margin: 8px 0; font-size: 12px; word-break: break-all; }
.modal a { color: #9fc7e0; }

@media (max-width: 1200px) {
  .filter-grid { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
  .analytics-top { grid-template-columns: 1fr 1fr; }
  .brands-panel { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: 12px; padding: 14px 16px; }
  .main-tabs-shell { flex: 1 0 100%; order: 3; }
  .page { padding: 14px; }
  .filter-grid { grid-template-columns: 1fr; }
  .analytics-top { grid-template-columns: 1fr; }
  .stack-panel { min-width: 0; }
  .utility-row { flex-direction: column; align-items: stretch; }
  .utility-row .ghost-btn { width: 100%; }
  .filter-actions { flex-direction: column; align-items: stretch; }
  .find-btn { width: 100%; }
  .brands-panel { overflow: hidden; }
  .brands-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .brands-head .tabs {
    display: flex;
    flex-wrap: nowrap;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
  }
  .brands-head .tabs::-webkit-scrollbar { display: none; }
  .brands-head .tabs button { flex: 0 0 auto; white-space: nowrap; }
  .bar-row { grid-template-columns: 92px minmax(0, 1fr) 46px; gap: 8px; }
  .bar-label { font-size: 12px; }
}

/* --- Анализ клиента: карточка 51 счёта --- */

.client-page { display: flex; flex-direction: column; gap: 14px; }

.client-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding: 20px 22px;
  border: 1px solid #14171b;
  border-radius: 10px;
  background:
    radial-gradient(620px 220px at 8% 0%, rgba(127, 180, 214, 0.12), transparent 70%),
    linear-gradient(180deg, #2f353d, #242930);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), var(--shadow);
}

.client-eyebrow {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.client-title {
  margin: 6px 0 8px;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #e8eff5;
}
.client-client-name {
  margin: -2px 0 8px;
  max-width: 760px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  color: #7fb4d6;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-lead {
  margin: 0;
  max-width: 760px;
  font-size: 13px;
  line-height: 1.65;
  color: #a7b3be;
}

.offline-badge {
  flex: 0 0 auto;
  padding: 7px 12px;
  border: 1px solid rgba(127, 180, 214, 0.35);
  border-radius: 20px;
  background: rgba(127, 180, 214, 0.08);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.client-upload-panel { padding: 18px; }

.client-upload-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}

.client-upload-sub { margin-top: 5px; font-size: 11px; color: var(--muted); }

.file-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  max-width: 55%;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #20252b;
  font-size: 11px;
  color: var(--ink);
}

.file-chip span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip .mono { color: var(--muted); font-size: 10px; }

.dropzone {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px;
  border: 1px dashed rgba(127, 180, 214, 0.32);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(127, 180, 214, 0.04), transparent),
    #20252b;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone:hover,
.dropzone.is-drag {
  border-color: rgba(127, 180, 214, 0.7);
  background:
    linear-gradient(180deg, rgba(127, 180, 214, 0.1), transparent),
    #232930;
}

.dropzone.is-busy { opacity: 0.7; pointer-events: none; }

.dropzone-mark {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 1px solid rgba(127, 180, 214, 0.4);
  border-radius: 6px;
  background: linear-gradient(180deg, #34404a, #262e35);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 20px;
}

.dropzone-copy { flex: 1; min-width: 0; }
.dropzone-title { font-size: 14px; color: #e2ebf2; }
.dropzone-sub { margin-top: 4px; font-size: 11px; color: var(--muted); }

.client-sheet-row {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.client-sheet-row label { display: flex; flex-direction: column; gap: 6px; }

.client-sheet-row select,
.profile-select select {
  background: #1c2025;
  color: var(--ink);
  border: 1px solid #111418;
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: none;
}

.client-upload-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
}

.client-ready-note { font-size: 11px; color: var(--muted); }

.client-explainer {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.explain-card {
  padding: 16px;
  border: 1px solid #14171b;
  border-radius: 8px;
  background: linear-gradient(180deg, #2c323a, #252a30);
}

.explain-num {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11px;
}

.explain-card b { display: block; font-size: 13px; margin-bottom: 6px; }
.explain-card p { margin: 0; font-size: 11px; line-height: 1.55; color: var(--muted); }

.client-filebar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 13px 16px;
}

.filebar-name { font-size: 13px; color: #e6eef5; overflow: hidden; text-overflow: ellipsis; }
.filebar-sub { margin-top: 4px; font-size: 11px; color: var(--muted); }

.client-diagnostics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 9px 12px;
  border: 1px solid #14171b;
  border-radius: 6px;
  background: rgba(32, 37, 43, 0.9);
  font-size: 11.5px;
  color: #98a3ad;
}

.client-diagnostics b { color: var(--ink); font-weight: 500; }
.diag-ok { color: #9ec9a8; }
.diag-warn { color: #e0a0a0; }

.client-controls { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }

.client-controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.mode-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid #111418;
  border-radius: 6px;
  background: #1c2025;
}

.mode-switch button {
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  padding: 7px 12px;
  font-size: 12px;
  cursor: pointer;
}

.mode-switch button:hover { color: var(--ink); }

.mode-switch button.active {
  background: linear-gradient(180deg, #3d4b57, #2c363f);
  color: #eaf2f8;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09);
}

.profile-select {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.profile-select select { min-width: 300px; }

.client-reset { margin-left: auto; }
.client-reset:disabled { opacity: 0.45; cursor: default; }

.client-profile-note {
  font-size: 13px;
  line-height: 1.65;
  color: #a7b3be;
  border-left: 2px solid rgba(127, 180, 214, 0.45);
  padding-left: 12px;
}

.client-categories { display: flex; flex-wrap: wrap; gap: 8px; }

.cat-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  background: #23282e;
  color: var(--ink);
  font-size: 12px;
  cursor: pointer;
}

.cat-chip b { font-size: 11px; font-weight: 400; color: var(--muted); }
.cat-chip:hover { border-color: rgba(127, 180, 214, 0.4); }
.cat-chip.active { border-color: rgba(127, 180, 214, 0.65); background: rgba(127, 180, 214, 0.15); color: #eaf3fa; }
.cat-chip.active b { color: var(--accent); }
.cat-chip.warn.active { border-color: rgba(214, 127, 127, 0.55); background: rgba(214, 127, 127, 0.12); }
.cat-chip.warn.active b { color: #e0a0a0; }

.client-selection { display: flex; flex-wrap: wrap; gap: 8px; font-size: 11px; color: var(--muted); }
.client-selection span { padding: 4px 8px; border: 1px solid var(--line); border-radius: 3px; }

.kpi-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }

.kpi-card {
  padding: 14px 16px;
  border: 1px solid #14171b;
  border-radius: 8px;
  background: linear-gradient(180deg, #2e343c, #23282e);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.kpi-card.accent { border-color: rgba(127, 180, 214, 0.35); }

.kpi-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.kpi-value { margin: 7px 0 4px; font-size: 22px; line-height: 1.15; color: #e8f0f6; }
.kpi-sub { font-size: 11px; color: var(--muted); }

.client-note {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 12px;
}

.client-note.warn {
  border: 1px solid rgba(224, 160, 120, 0.35);
  background: rgba(120, 70, 40, 0.2);
  color: #e8c2a8;
}

.client-charts { display: grid; grid-template-columns: 1.15fr 1fr; gap: 14px; }

.chart-panel { min-width: 0; padding: 16px 16px 10px; }

.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.chart-hint { margin-top: 5px; font-size: 11px; color: var(--muted); }
.chart-total { font-size: 13px; color: var(--accent); white-space: nowrap; }

.month-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 230px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.month-col {
  flex: 1 0 36px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.month-col.dimmed { opacity: 0.55; }

.month-bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; padding: 0 2px; }

.month-bar {
  width: 100%;
  min-height: 2px;
  border: 1px solid rgba(127, 180, 214, 0.25);
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, rgba(127, 180, 214, 0.55), rgba(127, 180, 214, 0.1));
  transition: height 0.25s ease, background 0.15s ease;
}

.month-col:hover .month-bar {
  background: linear-gradient(180deg, rgba(127, 180, 214, 0.85), rgba(127, 180, 214, 0.22));
}

.month-col.selected .month-bar {
  background: linear-gradient(180deg, #b3d8ee, #5d90b2);
  box-shadow: 0 0 20px rgba(127, 180, 214, 0.28);
}

.month-label {
  margin-top: 7px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  white-space: nowrap;
}

.month-col.selected .month-label { color: var(--accent); }

.cp-chart { display: flex; flex-direction: column; gap: 2px; }

.cp-row {
  display: grid;
  grid-template-columns: minmax(90px, 42%) minmax(60px, 1fr) 84px;
  align-items: center;
  gap: 10px;
  padding: 5px 6px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.cp-row:hover { background: rgba(127, 180, 214, 0.08); }
.cp-row.selected { background: rgba(127, 180, 214, 0.15); }
.cp-row.dimmed { opacity: 0.6; }

.cp-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }

.cp-inn-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 6px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.cp-inn-toggle input { width: 13px; height: 13px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.cp-inn-toggle:hover { color: var(--ink); border-color: rgba(127, 180, 214, 0.35); }

.cp-track {
  height: 10px;
  overflow: hidden;
  border: 1px solid #141719;
  border-radius: 2px;
  background: #1b1f23;
}

.cp-fill { display: block; height: 100%; background: linear-gradient(90deg, #4f7e9b, #7fb4d6); }
.cp-row.selected .cp-fill { background: linear-gradient(90deg, #7fb4d6, #bbe0f5); }

.cp-value { font-size: 11px; text-align: right; color: var(--muted); white-space: nowrap; }

.client-table-panel { padding: 16px 16px 10px; }
.client-table-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }

.client-ops { width: 100%; border-collapse: collapse; }
.client-ops th {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(127, 180, 214, 0.2);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
}
.client-ops td { padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 12px; vertical-align: middle; }
.client-ops tr:hover td { background: rgba(127, 180, 214, 0.04); }
.client-ops td:last-child, .client-ops th:last-child { text-align: right; }

.op-purpose {
  display: inline-block;
  max-width: 540px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  vertical-align: bottom;
}

.nowrap { white-space: nowrap; }

.cat-badge {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 10px;
  white-space: nowrap;
}

.cat-badge.accent { color: var(--accent); border-color: rgba(127, 180, 214, 0.4); background: rgba(127, 180, 214, 0.1); }
.cat-badge.warn { color: #d9a3a3; border-color: rgba(214, 127, 127, 0.35); background: rgba(214, 127, 127, 0.08); }
.cat-badge.muted { color: var(--muted); }
.cat-badge.steel { color: #b8c2cc; }

.client-footnote {
  padding: 10px 12px;
  border: 1px solid #14171b;
  border-radius: 6px;
  background: rgba(32, 37, 43, 0.85);
  font-size: 11px;
  line-height: 1.6;
  color: #8e98a3;
}

.chart-tooltip {
  position: fixed;
  z-index: 120;
  width: 300px;
  max-width: calc(100vw - 24px);
  padding: 12px 14px;
  border: 1px solid rgba(127, 180, 214, 0.45);
  border-radius: 6px;
  background: #171b20;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  transform: translate(-50%, -100%);
  pointer-events: none;
  font-size: 12px;
}

.chart-tooltip.is-below { transform: translate(-50%, 0); }

.tip-title { margin-bottom: 8px; color: #e8f0f6; font-size: 12px; }

.tip-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 0;
  color: var(--muted);
}

.tip-row b { color: var(--ink); font-weight: 500; }

.tip-purposes { margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--line); }

.tip-purposes-title {
  margin-bottom: 5px;
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.tip-purpose {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 0;
  font-size: 10.5px;
  line-height: 1.35;
  color: #aab5bf;
}

.tip-purpose span { overflow: hidden; }
.tip-purpose b { flex: 0 0 auto; color: var(--accent); font-weight: 400; }

@media (max-width: 1100px) {
  .client-charts { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .client-hero { flex-direction: column; align-items: flex-start; }
  .client-title { font-size: 25px; }
  .client-upload-head { flex-direction: column; }
  .file-chip { max-width: 100%; align-items: flex-start; }
  .dropzone { flex-direction: column; align-items: flex-start; text-align: left; }
  .client-upload-actions { flex-direction: column; align-items: stretch; }
  .client-upload-actions .find-btn { width: 100%; }
  .client-explainer { grid-template-columns: 1fr; }
  .client-filebar { flex-direction: column; align-items: flex-start; }
  .client-controls-row { flex-direction: column; align-items: stretch; }
  .profile-select select { min-width: 0; width: 100%; }
  .client-reset { margin-left: 0; }
  .mode-switch { width: 100%; }
  .mode-switch button { flex: 1; font-size: 11px; padding: 8px 6px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi-value { font-size: 20px; }
  .month-chart { height: 210px; gap: 3px; }
  .month-col { flex: 0 0 24px; }
  .month-label {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    height: 42px;
    margin-top: 4px;
    font-size: 9px;
  }
  .cp-row { grid-template-columns: minmax(80px, 40%) 1fr 70px; gap: 6px; }
  .op-purpose { max-width: 190px; }
  .client-ops { table-layout: fixed; }
  .client-ops th:nth-child(1), .client-ops td:nth-child(1) { width: 64px; }
  .client-ops th:nth-child(5), .client-ops td:nth-child(5) { width: 88px; }
  .client-ops th:nth-child(2), .client-ops td:nth-child(2) { word-break: break-word; }
  .client-ops th:nth-child(3), .client-ops td:nth-child(3),
  .client-ops th:nth-child(4), .client-ops td:nth-child(4) { display: none; }
  .client-ops th, .client-ops td { padding: 7px 6px; font-size: 11px; }
}

/* --- универсальная загрузка и сопоставление колонок --- */

.statement-files {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.statement-file {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #20252b;
  font-size: 11px;
}

.statement-file-name {
  max-width: 520px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}

.statement-file-meta { color: var(--muted); font-size: 10px; }

.mapping-panel {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #14171b;
  border-radius: 8px;
  background: #20252b;
}

.mapping-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.mapping-title { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.mapping-sub { margin-top: 4px; font-size: 11px; color: var(--muted); }

.mapping-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 10px 12px;
}

.mapping-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.mapping-field input,
.mapping-field select {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid #111418;
  border-radius: 4px;
  background: #1c2025;
  color: var(--ink);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: none;
}

.mapping-preview {
  margin-top: 12px;
  max-height: 220px;
  border: 1px solid #14171b;
  border-radius: 6px;
}

.mapping-preview table { border-collapse: collapse; width: 100%; }
.mapping-preview th,
.mapping-preview td {
  max-width: 180px;
  padding: 5px 8px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  color: var(--muted);
  vertical-align: top;
}

.mapping-preview th {
  position: sticky;
  top: 0;
  background: #262b32;
  color: var(--accent);
  font-weight: 500;
}

.mapping-warn {
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(224, 160, 120, 0.35);
  border-radius: 4px;
  background: rgba(120, 70, 40, 0.18);
  color: #e8c2a8;
  font-size: 11px;
}

.upload-help {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.upload-help-title {
  margin-bottom: 10px;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.upload-help-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.upload-help-card {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #23282e;
}

.upload-help-card b { display: block; margin-bottom: 5px; font-size: 11px; color: var(--ink); }
.upload-help-card span { display: block; font-size: 10.5px; line-height: 1.55; color: var(--muted); }

.upload-help-note {
  margin-top: 10px;
  font-size: 10.5px;
  line-height: 1.55;
  color: #7f8a95;
}

@media (max-width: 1100px) {
  .mapping-grid { grid-template-columns: repeat(2, minmax(180px, 1fr)); }
  .upload-help-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .mapping-grid { grid-template-columns: 1fr; }
  .mapping-head { flex-direction: column; }
  .mapping-preview th, .mapping-preview td { max-width: 120px; }
  .statement-file-name { max-width: 230px; }
}

/* --- отчёт по алгоритму --- */

.client-report-panel { padding: 16px 16px 12px; min-width: 0; }
.client-report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.client-mini-table { width: 100%; border-collapse: collapse; }
.client-mini-table th {
  padding: 7px 9px;
  border-bottom: 1px solid rgba(127, 180, 214, 0.2);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  white-space: nowrap;
}
.client-mini-table td { padding: 7px 9px; border-bottom: 1px solid var(--line); font-size: 11.5px; vertical-align: middle; }
.client-mini-table td:last-child, .client-mini-table th:last-child { text-align: right; }
.client-mini-table tr:hover td { background: rgba(127, 180, 214, 0.04); }
.client-mini-table .total-row td { border-top: 1px solid rgba(127, 180, 214, 0.25); font-weight: 500; color: #e6eef5; }
.neg { color: #e0a0a0; }

.metric-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.metric-list > div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #23282e;
}
.metric-list span { font-size: 11px; color: var(--muted); }
.metric-list b { font-size: 13px; color: #e6eef5; text-align: right; }
.metric-list em { grid-column: 1 / -1; font-size: 10px; font-style: normal; color: #7f8a95; }

.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.metric-grid > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #23282e;
}
.metric-grid span { font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.metric-grid b { font-size: 12.5px; color: #e6eef5; }

.report-sub {
  margin: 14px 0 7px;
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.report-empty { font-size: 11px; line-height: 1.55; color: #8e98a3; }
.lifecycle-row { display: flex; gap: 16px; font-size: 11px; color: var(--muted); }
.lifecycle-row b { color: var(--ink); }

.region-alert { display: flex; flex-direction: column; gap: 7px; }
.region-alert > div {
  padding: 8px 10px;
  border: 1px solid rgba(224, 160, 120, 0.45);
  border-radius: 5px;
  background: rgba(120, 70, 40, 0.2);
}
.region-alert b { display: block; font-size: 11.5px; color: #e8c2a8; }
.region-alert span { display: block; margin-top: 3px; font-size: 10.5px; color: #c9a78f; }

.risk-list { display: flex; flex-direction: column; gap: 4px; }
.risk-row {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 12px;
  align-items: flex-start;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #23282e;
}
.risk-row.alert { border-color: rgba(224, 140, 140, 0.4); background: rgba(90, 40, 40, 0.22); }
.risk-status {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 9px;
  text-align: center;
  color: var(--muted);
  white-space: nowrap;
}
.risk-status.alert { border-color: rgba(224, 140, 140, 0.55); color: #e0a0a0; background: rgba(224, 140, 140, 0.1); }
.risk-status.check { border-color: rgba(224, 180, 120, 0.5); color: #e0c090; background: rgba(224, 180, 120, 0.08); }
.risk-status.ok { border-color: rgba(140, 200, 150, 0.35); color: #9ec9a8; }
.risk-copy { display: flex; flex-direction: column; gap: 3px; }
.risk-copy b { font-size: 11.5px; font-weight: 500; color: var(--ink); }
.risk-copy span { font-size: 10.5px; line-height: 1.45; color: var(--muted); }

.client-verdict { padding: 18px; }
.verdict-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.verdict-text { margin-top: 6px; font-size: 20px; color: #e8f0f6; }
.verdict-score { font-size: 22px; color: var(--accent); white-space: nowrap; }

.score-grid { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.score-row { display: grid; grid-template-columns: 190px 1fr 40px; gap: 12px; align-items: center; font-size: 11px; color: var(--muted); }
.score-track { height: 8px; border: 1px solid #141719; border-radius: 2px; background: #1b1f23; overflow: hidden; }
.score-fill { display: block; height: 100%; background: linear-gradient(90deg, #4f7e9b, #7fb4d6); }
.score-row b { text-align: right; color: var(--ink); font-weight: 400; }

.verdict-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.flag-list, .question-list { margin: 0; padding-left: 18px; font-size: 11px; line-height: 1.6; color: var(--muted); }
.flag-list li { color: #e0b0b0; }
.question-list li { margin-bottom: 4px; }
.verdict-note { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 10px; line-height: 1.55; color: #7f8a95; }

@media (max-width: 1100px) {
  .client-report-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .verdict-columns { grid-template-columns: 1fr; gap: 10px; }
  .score-row { grid-template-columns: 130px 1fr 34px; }
  .risk-row { grid-template-columns: 64px 1fr; gap: 8px; }
  .client-mini-table th, .client-mini-table td { padding: 6px; font-size: 10.5px; }
}

.client-filebar-actions { display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 760px) {
  .client-filebar-actions { width: 100%; }
  .client-filebar-actions .ghost-btn { flex: 1; }
}

.client-formats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.client-formats span {
  padding: 3px 8px;
  border: 1px solid rgba(127, 180, 214, 0.25);
  border-radius: 12px;
  background: rgba(127, 180, 214, 0.07);
  color: #a8c7dc;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.offline-download {
  display: inline-block;
  margin-top: 10px;
  color: var(--accent);
  font-size: 11px;
  text-decoration: none;
  border-bottom: 1px dotted rgba(127, 180, 214, 0.5);
}
.offline-download:hover { color: #b9dcf2; }

.inline-link { color: var(--accent); text-decoration: none; border-bottom: 1px dotted rgba(127, 180, 214, 0.5); }
.inline-link:hover { color: #b9dcf2; }

.find-btn:disabled { opacity: 0.45; cursor: default; filter: saturate(0.5); }

.mapping-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.chart-switch { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.chart-switch button {
  border: 1px solid #14171b;
  border-radius: 3px;
  background: #1c2025;
  color: var(--muted);
  padding: 4px 8px;
  font-size: 10px;
  cursor: pointer;
}
.chart-switch button.active { border-color: rgba(127, 180, 214, 0.55); color: var(--accent); background: rgba(127, 180, 214, 0.12); }

.month-bar-wrap { position: relative; }
.month-bar.out {
  position: absolute;
  left: 18%;
  width: 64%;
  bottom: 0;
  z-index: 2;
  background: rgba(224, 140, 140, 0.35);
  border-color: rgba(224, 140, 140, 0.5);
}
.month-col.selected .month-bar.out { background: rgba(224, 140, 140, 0.55); }

.chart-legend { display: flex; gap: 14px; margin-top: 8px; font-size: 10px; color: var(--muted); }
.chart-legend span::before { content: ""; display: inline-block; width: 10px; height: 6px; margin-right: 5px; border-radius: 1px; }
.chart-legend .legend-in::before { background: linear-gradient(180deg, #9cc7e2, #4f7e9b); }
.chart-legend .legend-out::before { background: rgba(224, 140, 140, 0.55); }

.cp-row.static { cursor: default; }
.cp-row.static:hover { background: transparent; }

.chart-tooltip { width: 360px; }
.tip-purpose span { white-space: normal; }

.client-profile-panel { padding: 16px; }
.profile-badge {
  padding: 4px 10px;
  border: 1px solid rgba(140, 200, 150, 0.35);
  border-radius: 12px;
  color: #9ec9a8;
  font-family: var(--mono);
  font-size: 9.5px;
  white-space: nowrap;
}
.profile-badge.alert { border-color: rgba(224, 140, 140, 0.5); color: #e0a0a0; background: rgba(224, 140, 140, 0.08); }
.profile-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.profile-grid > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #23282e;
}
.profile-grid span { font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.profile-grid b { font-size: 12.5px; color: #e6eef5; }
.profile-grid em { font-size: 9.5px; font-style: normal; color: #7f8a95; }
.profile-penalty.alert { border-color: rgba(224, 140, 140, 0.45); background: rgba(90, 40, 40, 0.2); }
.profile-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.party-list { display: flex; flex-direction: column; gap: 3px; }
.party-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: baseline;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #23282e;
  font-size: 10.5px;
}
.party-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.party-meta { color: var(--muted); font-size: 9px; white-space: nowrap; }
.party-row b { color: #e6eef5; font-weight: 400; white-space: nowrap; }
.profile-penalty-detail { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 10.5px; line-height: 1.55; color: #8e98a3; }

.clickable-row { cursor: pointer; }
.clickable-row:hover td { background: rgba(127, 180, 214, 0.06); }
.clickable-row.selected-row td { background: rgba(127, 180, 214, 0.12); }
.inline-reset {
  margin-top: 8px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 10.5px;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}
.month-bar.expense-bar {
  background: linear-gradient(180deg, rgba(224, 140, 140, 0.7), rgba(224, 140, 140, 0.16));
  border-color: rgba(224, 140, 140, 0.5);
}
.month-col.selected .month-bar.expense-bar { background: linear-gradient(180deg, #e6a8a8, #a65f5f); }
.table-category-filter { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.table-category-filter button {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #23282e;
  color: var(--muted);
  padding: 4px 9px;
  font-size: 10px;
  cursor: pointer;
}
.table-category-filter button.active { border-color: rgba(127, 180, 214, 0.55); color: var(--accent); background: rgba(127, 180, 214, 0.12); }

@media (max-width: 1100px) {
  .profile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-parties { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .profile-grid { grid-template-columns: 1fr; }
}

.month-bar.out.full { left: 0; width: 100%; }

.assumed { border-bottom: 1px dotted #c9a86a; color: #d8c49a; cursor: help; }

/* Компактная панель режимов при скролле */
.client-sticky-controls {
  position: sticky;
  top: 94px;
  z-index: 18;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border: 1px solid rgba(127, 180, 214, 0.28);
  border-radius: 8px;
  background: rgba(30, 34, 39, 0.94);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(8px);
}
.client-sticky-controls .mode-switch.compact { padding: 2px; }
.client-sticky-controls .mode-switch.compact button { padding: 5px 10px; font-size: 11px; }
.client-sticky-controls .ghost-btn { padding: 6px 10px; font-size: 11px; }

.chart-head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.collapse-toggle {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  padding: 5px 9px;
  font-size: 11px;
  cursor: pointer;
}
.collapse-toggle:hover { color: var(--ink); border-color: rgba(127, 180, 214, 0.35); }
.collapse-chevron { display: inline-block; margin-left: 4px; transition: transform 0.2s ease; }
.collapse-chevron.open { transform: rotate(180deg); }

.party-row.clickable { cursor: pointer; border-radius: 6px; padding-left: 4px; padding-right: 4px; }
.party-row.clickable:hover { background: rgba(127, 180, 214, 0.07); }
.party-row.selected { background: rgba(127, 180, 214, 0.14); box-shadow: inset 2px 0 0 var(--accent); }
.finance-table-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.finance-table-head .inline-reset { margin-top: 0; }

@media (max-width: 600px) {
  .client-sticky-controls { top: 118px; flex-direction: column; align-items: stretch; }
  .client-sticky-controls .mode-switch { width: 100%; }
  .client-sticky-controls .mode-switch button { flex: 1; }
}

/* --- Сформировать КП --- */
.kp-th, .kp-cell { width: 58px; text-align: center; white-space: nowrap; }
.kp-link-btn {
  border: 1px solid rgba(127, 180, 214, 0.35);
  background: rgba(127, 180, 214, 0.08);
  color: var(--accent);
  border-radius: 5px;
  padding: 4px 8px;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  cursor: pointer;
}
.kp-link-btn:hover { background: rgba(127, 180, 214, 0.16); }
.kp-link-btn:disabled { opacity: 0.4; cursor: default; }

.kp-page { display: flex; flex-direction: column; gap: 14px; }
.kp-input-panel { padding: 18px; }
.kp-link-row { display: flex; gap: 10px; margin-top: 4px; }
.kp-link-input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 7px;
  border: 1px solid #14171b;
  background: #1a1e23;
  color: var(--ink);
  font-size: 12px;
}
.kp-link-input:focus { outline: none; border-color: rgba(127, 180, 214, 0.45); }
.kp-loading { padding: 18px; }

.kp-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
  gap: 14px;
  align-items: start;
}
.kp-form-panel, .kp-preview-panel { padding: 18px; }
.kp-download { white-space: nowrap; }
.kp-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin-top: 6px; }
.kp-field { display: flex; flex-direction: column; gap: 5px; font-size: 11px; color: var(--muted); }
.kp-field-wide { grid-column: 1 / -1; }
.kp-field input, .kp-field textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #14171b;
  background: #1a1e23;
  color: var(--ink);
  font-size: 12px;
  font-family: inherit;
}
.kp-field input:focus, .kp-field textarea:focus { outline: none; border-color: rgba(127, 180, 214, 0.45); }
.kp-field .kp-description { min-height: 130px; resize: vertical; line-height: 1.5; }
.kp-photo-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px; margin-top: 16px; }
.kp-photo-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.kp-photo-url { width: 220px; padding: 7px 9px; border-radius: 6px; border: 1px solid #14171b; background: #1a1e23; color: var(--ink); font-size: 11px; }
.kp-photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.kp-photo-card { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #1a1e23; }
.kp-photo-card.selected { border-color: rgba(127, 180, 214, 0.45); }
.kp-photo-card img { width: 100%; height: 110px; object-fit: cover; display: block; background: #111; }
.kp-photo-card-bar { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 5px 7px; font-size: 10.5px; color: var(--muted); }
.kp-photo-card-bar label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.kp-photo-card-bar button { border: 0; background: transparent; color: #e07a7a; cursor: pointer; font-size: 16px; line-height: 1; }

.kp-preview { background: #fff; color: #111; padding: 18px 20px 14px; border-radius: 4px; font-family: Arial, "Segoe UI", sans-serif; }
.kp-preview-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; font-size: 9px; color: #444; }
.kp-preview-head b { color: #111; font-size: 10px; letter-spacing: 0.02em; }
.kp-preview-rule { border-top: 2px solid #111; margin: 7px 0 12px; }
.kp-preview-eyebrow { font-size: 8px; letter-spacing: 0.08em; text-transform: uppercase; color: #777; }
.kp-preview-title { font-size: 24px; line-height: 1.1; margin: 3px 0 12px; color: #111; }
.kp-preview-photo { width: 100%; height: 210px; object-fit: contain; background: #f2f3f5; border-radius: 3px; display: block; }
.kp-preview-price { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: #f2f3f5; border-radius: 4px; padding: 9px 12px; margin: 12px 0 8px; }
.kp-preview-price span { font-size: 8px; letter-spacing: 0.08em; text-transform: uppercase; color: #666; }
.kp-preview-price b { font-size: 15px; color: #111; }
.kp-preview-details { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.kp-preview-details td { padding: 5px 0; border-bottom: 1px solid #e2e4e8; font-size: 9px; vertical-align: top; color: #111; }
.kp-preview-details td:first-child { width: 38%; color: #777; }
.kp-preview-details td:last-child { font-weight: 600; }
.kp-preview-sub { font-size: 9px; font-weight: 700; margin: 6px 0 3px; }
.kp-preview-desc { font-size: 8.5px; line-height: 1.45; color: #222; white-space: pre-wrap; }
.kp-preview-footer { display: flex; justify-content: space-between; gap: 10px; border-top: 1px solid #e2e4e8; margin-top: 14px; padding-top: 7px; font-size: 7.5px; color: #777; }

@media (max-width: 1050px) {
  .kp-editor-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .kp-link-row { flex-direction: column; }
  .kp-form-grid { grid-template-columns: 1fr; }
  .kp-photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kp-photo-url { width: 100%; }
}

/* --- Узнать ставку конкурента --- */
.rate-page { display: flex; flex-direction: column; gap: 14px; }
.rate-mode { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid #14171b; border-radius: 7px; background: #1c2025; align-self: flex-start; }
.rate-mode button { border: 0; border-radius: 5px; background: transparent; color: var(--muted); padding: 8px 16px; font-size: 12px; cursor: pointer; }
.rate-mode button:hover { color: var(--ink); }
.rate-mode button.active { background: linear-gradient(180deg, #3d4b57, #2c363f); color: #eaf2f8; }
.rate-pdf-soon { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px dashed rgba(127, 180, 214, 0.35); border-radius: 7px; color: var(--muted); font-size: 12px; }
.rate-pdf-soon b { color: var(--ink); font-weight: 500; }
.rate-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 0.85fr); gap: 14px; align-items: start; }
.rate-panel { padding: 18px; }
.rate-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin-top: 6px; }
.rate-field { display: flex; flex-direction: column; gap: 5px; font-size: 11px; color: var(--muted); }
.rate-field-wide { grid-column: 1 / -1; }
.rate-field input { width: 100%; padding: 8px 10px; border-radius: 6px; border: 1px solid #14171b; background: #1a1e23; color: var(--ink); font-size: 12px; font-family: inherit; }
.rate-field input:focus { outline: none; border-color: rgba(127, 180, 214, 0.45); }
.rate-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rate-input-wrap { position: relative; }
.rate-input-wrap input { padding-right: 28px; }
.rate-input-wrap i { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--muted); font-size: 10px; }
.rate-calc-btn { margin-top: 14px; width: 100%; }
.rate-results { background: #1a1e23; border: 1px solid var(--line); border-radius: 7px; padding: 10px; margin-top: 6px; }
.rate-results-nds { background: #201f1b; border-color: rgba(200, 168, 0, 0.25); }
.rate-result-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 8px; border-bottom: 1px solid rgba(255, 255, 255, 0.04); font-size: 12px; }
.rate-result-row:last-child { border-bottom: 0; }
.rate-result-row span { color: var(--muted); }
.rate-result-row b { color: var(--ink); font-weight: 500; text-align: right; }
.rate-highlight { background: rgba(200, 168, 0, 0.12); border-left: 2px solid #c8a800; border-radius: 4px; }
.rate-highlight b { color: #ffe58a; }
.rate-subtitle { margin: 16px 0 7px; font-size: 12px; font-weight: 600; color: var(--ink); }
.rate-schedule { padding: 16px; }
.rate-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.rate-table th { background: #2c3138; color: #aeb8c2; text-align: right; padding: 8px 9px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.rate-table td { padding: 7px 9px; text-align: right; border-bottom: 1px solid rgba(255, 255, 255, 0.04); white-space: nowrap; }
.rate-table th:first-child, .rate-table td:first-child { text-align: center; }
.rate-table th:nth-child(2), .rate-table td:nth-child(2) { text-align: left; }
.rate-table tbody tr:hover { background: rgba(127, 180, 214, 0.05); }
@media (max-width: 860px) {
  .rate-layout { grid-template-columns: 1fr; }
  .rate-grid { grid-template-columns: 1fr; }
  .rate-pair { grid-template-columns: 1fr 1fr; }
  .rate-pdf-soon { flex-direction: column; align-items: flex-start; gap: 3px; }
}

.rate-subtitle { display: flex; align-items: center; gap: 7px; }
.rate-info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border: 1px solid rgba(127, 180, 214, 0.45);
  border-radius: 50%;
  color: var(--accent);
  font-size: 10px;
  line-height: 1;
  cursor: help;
}

/* --- роли и доступ --- */

.brand-tagline {
  margin-top: 2px;
  font-size: 9.5px;
  letter-spacing: 0.04em;
  color: #8fa6b8;
  white-space: nowrap;
}

.role-box { display: inline-flex; align-items: center; gap: 8px; }
.role-chip {
  padding: 3px 8px;
  border: 1px solid rgba(127, 180, 214, 0.3);
  border-radius: 3px;
  color: #9ec6dd;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.role-logout {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  cursor: pointer;
  text-decoration: underline;
}
.role-logout:hover { color: var(--ink); }

.auth-modal { width: min(440px, 92vw); text-align: left; }
.auth-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  border: 1px solid rgba(127, 180, 214, 0.35);
  border-radius: 5px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 13px;
}
.auth-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.auth-actions .find-btn { width: auto; min-width: 120px; }

/* --- получить клиента: канбан --- */

.client-pipeline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr) 34px minmax(0, 1fr) 34px minmax(0, 1fr);
  gap: 6px;
  align-items: stretch;
}

.client-stage {
  min-width: 0;
  min-height: 480px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(30, 35, 41, 0.7);
}

.client-stage-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.client-stage-title { font-size: 11px; color: #dfe8f0; line-height: 1.35; }
.client-stage-count { margin-top: 3px; color: var(--muted); font-size: 10px; }

.client-add-btn {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border: 1px solid rgba(127, 180, 214, 0.4);
  border-radius: 5px;
  background: rgba(127, 180, 214, 0.1);
  color: #b9dcef;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.client-add-btn:hover { background: rgba(127, 180, 214, 0.2); }

.client-stage-list { display: flex; flex-direction: column; gap: 8px; }
.client-stage-empty { padding: 12px; color: #66717b; font-size: 10.5px; text-align: center; }

.client-stage-arrow {
  display: grid;
  place-items: center;
  color: #5f7f95;
  min-width: 0;
  width: 100%;
  height: 100%;
}
.client-stage-arrow svg { width: 100%; height: 18px; overflow: visible; }
.client-stage-arrow path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.client-card {
  position: relative;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #22272d;
  font-size: 11px;
  overflow: hidden;
}
.client-card.locked { background: #1d2228; }
.client-card.urgent { animation: clientUrgent 2.6s ease-in-out infinite; }
.client-card.urgent .client-urgent-glow {
  position: absolute;
  inset: auto 10% -12px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(224, 116, 90, 0.4), transparent 70%);
  filter: blur(6px);
  pointer-events: none;
}
@keyframes clientUrgent {
  0%, 100% { box-shadow: 0 0 0 rgba(224, 116, 90, 0), 0 0 12px rgba(224, 116, 90, 0.08); }
  50% { box-shadow: 0 0 0 1px rgba(224, 116, 90, 0.35), 0 0 18px rgba(224, 116, 90, 0.2); }
}

.client-card.stale::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 6px;
  padding: 3px;
  background: repeating-linear-gradient(45deg, #c8752a 0 8px, #16181b 8px 16px);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.client-card-top { display: flex; align-items: center; gap: 6px; }
.client-card-inn { font-size: 12px; color: #e8f0f6; flex: 1; }
.client-card-badges { display: flex; flex-wrap: wrap; gap: 3px; }
.client-badge { padding: 2px 5px; border-radius: 3px; font-size: 8px; letter-spacing: 0.03em; }
.client-badge.wait { background: rgba(200, 168, 0, 0.15); color: #d9c98e; }
.client-badge.ok { background: rgba(97, 168, 121, 0.15); color: #9fd0ae; }
.client-badge.help { background: rgba(200, 117, 42, 0.16); color: #e2ad7d; }

.client-flame {
  width: 22px;
  height: 22px;
  padding: 3px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: #66717b;
  cursor: pointer;
}
.client-flame svg { width: 100%; height: 100%; fill: currentColor; }
.client-flame.on { color: #e0745a; border-color: rgba(224, 116, 90, 0.4); background: rgba(224, 116, 90, 0.1); }

.client-locked-lines { display: flex; flex-direction: column; gap: 5px; margin-top: 12px; }
.client-locked-lines span {
  display: block;
  height: 8px;
  border-radius: 2px;
  background: repeating-linear-gradient(135deg, #323941 0 4px, #262c33 4px 8px);
  opacity: 0.9;
}
.client-locked-lines span:nth-child(1) { width: 86%; }
.client-locked-lines span:nth-child(2) { width: 64%; }
.client-locked-lines span:nth-child(3) { width: 92%; }
.client-locked-lines span:nth-child(4) { width: 48%; }
.client-locked-lines span:nth-child(5) { width: 74%; }
.client-locked-hint { margin-top: 8px; color: #65707a; font-size: 9.5px; }

.client-card-fields { display: flex; flex-direction: column; gap: 4px; margin-top: 9px; }
.client-card-fields > div { display: flex; justify-content: space-between; gap: 8px; }
.client-card-fields span { color: var(--muted); }
.client-card-fields b { color: #dfe8f0; font-weight: 400; text-align: right; }
.client-card-comment { margin: 8px 0 0; color: #aeb9c3; font-size: 10.5px; line-height: 1.45; }
.client-card-date { margin-top: 7px; color: var(--muted); font-size: 9.5px; }

.client-card-action {
  width: 100%;
  margin-top: 9px;
  padding: 6px 8px;
  border: 1px solid rgba(127, 180, 214, 0.3);
  border-radius: 4px;
  background: rgba(127, 180, 214, 0.08);
  color: #a9cfe4;
  font-size: 10px;
  cursor: pointer;
}
.client-card-action:hover { background: rgba(127, 180, 214, 0.16); }
.client-card-action.help { border-color: rgba(200, 117, 42, 0.35); color: #e2ad7d; background: rgba(200, 117, 42, 0.08); }
.client-card-note { margin-top: 7px; padding: 6px; border-radius: 3px; background: rgba(200, 168, 0, 0.08); color: #d9c98e; font-size: 9.5px; line-height: 1.4; }

.client-checks { display: flex; flex-direction: column; gap: 5px; margin-top: 9px; }
.client-checks label { display: flex; align-items: center; gap: 6px; font-size: 10px; cursor: pointer; }
.client-checks label.checked { color: #9fd0ae; }
.client-checks label.pending { color: #e2ad7d; }
.client-checks input { accent-color: #61a879; }
.client-grant { display: flex; align-items: center; gap: 6px; margin-top: 9px; color: #d9c98e; font-size: 10px; }
.client-manager-comment { display: block; margin-top: 9px; }
.client-manager-comment span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 9px; }
.client-manager-comment textarea,
.client-create-comment textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 8px;
  border: 1px solid #14171b;
  border-radius: 5px;
  background: #1a1e23;
  color: var(--ink);
  font-family: inherit;
  font-size: 10.5px;
  resize: vertical;
}

.client-create-panel {
  padding: 16px;
  border: 1px solid rgba(127, 180, 214, 0.28);
  border-radius: 7px;
  background: #20252b;
  animation: clientUnfold 0.32s ease;
  transform-origin: top center;
}
@keyframes clientUnfold {
  from { opacity: 0; transform: scaleY(0.65) translateY(-8px); }
  to { opacity: 1; transform: scaleY(1) translateY(0); }
}
.client-create-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.client-create-grid .rate-field { margin: 0; }
.client-create-comment { grid-column: 1 / -1; }
.client-create-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }
.client-create-actions .find-btn { width: auto; min-width: 170px; }
.client-loading { color: var(--muted); font-size: 11px; text-align: center; }

@media (max-width: 1200px) {
  .client-pipeline { grid-template-columns: 1fr; gap: 8px; }
  .client-stage { min-height: 0; }
}
@media (max-width: 760px) {
  .client-create-grid { grid-template-columns: 1fr; }
  .brand-tagline { white-space: normal; }
}

/* --- роли: переключатель --- */
.role-switch {
  height: 26px;
  border: 1px solid rgba(127, 180, 214, 0.28);
  border-radius: 4px;
  background: #1a1e23;
  color: #cfdae4;
  font-family: inherit;
  font-size: 10px;
  padding: 0 6px;
}

/* --- получить клиента: сетка 2x2 и стрелки --- */
.client-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  min-height: 28px;
}
.client-archive-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(194, 87, 87, 0.4);
  border-radius: 4px;
  background: rgba(194, 87, 87, 0.08);
  color: #e29a9a;
  font-size: 10px;
  padding: 4px 8px;
  cursor: pointer;
}
.client-archive-toggle svg { width: 12px; height: 12px; fill: currentColor; }
.client-archive-toggle:hover { background: rgba(194, 87, 87, 0.18); }

.client-pipeline-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr);
  grid-template-rows: auto 44px auto;
  gap: 8px;
  align-items: stretch;
}
.pipeline-cell { min-width: 0; }
.cell-new { grid-area: 1 / 1; }
.cell-arrow-top { grid-area: 1 / 2; }
.cell-work { grid-area: 1 / 3; }
.cell-arrow-right { grid-area: 2 / 3; justify-self: center; align-self: center; width: 44px; height: 44px; }
.cell-advance { grid-area: 3 / 1; }
.cell-arrow-bottom { grid-area: 3 / 2; }
.cell-approved { grid-area: 3 / 3; }

.client-stage-arrow.arrow-down svg { transform: rotate(90deg); }
.client-stage-arrow.arrow-left svg { transform: rotate(180deg); }

.client-stage.expanded {
  position: fixed;
  inset: 0;
  z-index: 95;
  border-radius: 0;
  padding: 20px;
  background: #1b1f24;
  overflow: auto;
}
.client-stage-actions { display: flex; align-items: center; gap: 6px; }
.client-expand-btn {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(127, 180, 214, 0.25);
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
}
.client-expand-btn:hover { color: var(--ink); border-color: rgba(127, 180, 214, 0.45); }

.client-stage.stage-new { border-top: 2px solid rgba(127, 180, 214, 0.35); }
.client-stage.stage-work { border-top: 2px solid rgba(90, 140, 180, 0.35); }
.client-stage.stage-approved { border-top: 2px solid rgba(97, 168, 121, 0.45); }
.client-stage.stage-advance { border-top: 2px solid rgba(200, 168, 0, 0.45); }

.client-badge.approved { background: rgba(97, 168, 121, 0.16); color: #a6dbb5; }

/* --- карточка: сворачивание, мерцание --- */
.client-card.collapsed {
  cursor: pointer;
  animation: clientCardShimmer 4.2s ease-in-out infinite;
}
@keyframes clientCardShimmer {
  0%, 100% { box-shadow: inset 0 0 0 rgba(255, 255, 255, 0), 0 0 0 rgba(127, 180, 214, 0); }
  50% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 0 12px rgba(127, 180, 214, 0.12); }
}
.client-card.expanded { cursor: default; }
.client-collapsed-summary {
  margin-top: 8px;
  color: #c5d0d9;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.client-expand-hint { margin-top: 6px; color: #66717b; font-size: 9px; }
.client-manager-name { margin-top: 5px; color: #8fa6b8; font-size: 9.5px; }
.client-muted { color: var(--muted); font-size: 10px; }

.client-name-input { margin-top: 9px; }
.client-name-input input {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 8px;
  border: 1px solid rgba(127, 180, 214, 0.3);
  border-radius: 4px;
  background: #1a1e23;
  color: var(--ink);
  font-family: inherit;
  font-size: 11px;
}
.client-name-actions { display: flex; gap: 6px; margin-top: 6px; }
.client-name-actions .ghost-btn,
.client-name-actions .find-btn { width: auto; flex: 1; padding: 6px; font-size: 10px; }

.client-deal-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 9px;
}
.client-deal-fields label { display: block; }
.client-deal-fields span { display: block; margin-bottom: 3px; color: var(--muted); font-size: 8.5px; }
.client-deal-fields input {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 7px;
  border: 1px solid #14171b;
  border-radius: 4px;
  background: #1a1e23;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 10px;
}

.client-archive-mark {
  width: 18px;
  height: 18px;
  padding: 2px;
  border: 0;
  background: transparent;
  color: #b45252;
  cursor: pointer;
}
.client-archive-mark svg { width: 100%; height: 100%; fill: currentColor; }
.client-archive-mark:hover { color: #e0745a; }

.client-card-action.return {
  border-color: rgba(200, 168, 0, 0.3);
  color: #d9c98e;
  background: rgba(200, 168, 0, 0.06);
}

.client-archive-panel { padding: 16px; border: 1px solid var(--line); border-radius: 7px; background: #1e2329; }
.client-archive-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.client-archive-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 11px;
}
.client-archive-row .client-card-action { width: auto; margin: 0; padding: 5px 8px; }

.confirm-modal { width: min(440px, 92vw); }
.confirm-modal .modal-text { font-size: 12px; }

@media (max-width: 900px) {
  .client-pipeline-grid { grid-template-columns: 1fr; grid-template-rows: none; }
  .cell-new, .cell-work, .cell-approved, .cell-advance { grid-area: auto; }
  .cell-arrow-top, .cell-arrow-right, .cell-arrow-bottom { display: none; }
  .client-stage-arrow { transform: rotate(90deg); height: 22px; }
}

.client-comments { margin-top: 10px; }
.client-comments-title { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: 0.08em; }
.client-comments-history {
  margin-top: 5px;
  padding: 7px 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  background: #1c2127;
  color: #b9c5cf;
  font-size: 10px;
  line-height: 1.5;
  white-space: pre-wrap;
  max-height: 130px;
  overflow-y: auto;
}
.client-comments textarea {
  width: 100%;
  box-sizing: border-box;
  margin-top: 6px;
  padding: 7px 8px;
  border: 1px solid #14171b;
  border-radius: 5px;
  background: #1a1e23;
  color: var(--ink);
  font-family: inherit;
  font-size: 10.5px;
  resize: vertical;
}
.client-archive-comments {
  margin-top: 5px;
  color: #8e9aa4;
  font-size: 10px;
  line-height: 1.45;
  white-space: pre-wrap;
  max-width: 620px;
}

/* --- компактные фильтры и «Новые на стоке» --- */

.filter-left-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.fresh-btn {
  border: 1px solid #4d6d84;
  background: linear-gradient(180deg, rgba(127, 180, 214, 0.16), rgba(127, 180, 214, 0.04));
  color: #cfe4f2;
  font-weight: 600;
}

.fresh-btn:hover {
  border-color: var(--accent);
  color: #eaf4fb;
  background: linear-gradient(180deg, rgba(127, 180, 214, 0.28), rgba(127, 180, 214, 0.08));
}

.fresh-btn.is-on {
  border-color: #7fb4d6;
  color: #f2f8fc;
  background: linear-gradient(180deg, #4f7f9f 0%, #3b647f 45%, #2f5268 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 4px 12px rgba(0, 0, 0, 0.35);
}

.filter-panel.is-compact {
  padding: 10px 14px;
  margin-bottom: 12px;
}

.filter-panel.is-compact .filter-grid,
.filter-panel.is-compact .utility-row,
.filter-panel.is-compact .filter-actions {
  display: none;
}

.filter-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.filter-compact-info {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.filter-compact-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #98a3ae;
  white-space: nowrap;
}

.filter-compact-summary {
  font-size: 13px;
  color: #c3ccd5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filter-compact-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-compact-actions .ghost-btn {
  padding: 8px 14px;
  font-size: 11px;
}

.table-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.expand-btn {
  padding: 9px 14px;
  font-size: 11px;
  letter-spacing: 0.08em;
}

.search-page.expanded .table-panel {
  display: flex;
  flex-direction: column;
}

.search-page.expanded .table-wrap {
  flex: 1;
  max-height: calc(100vh - 290px);
  min-height: 55vh;
}

@media (max-width: 760px) {
  .filter-left-actions { flex-direction: column; align-items: stretch; }
  .filter-left-actions .ghost-btn { width: 100%; }
  .filter-compact { flex-direction: column; align-items: stretch; }
  .filter-compact-actions { flex-direction: column; align-items: stretch; }
  .filter-compact-actions .ghost-btn { width: 100%; }
  .table-head-actions { flex-wrap: wrap; justify-content: flex-end; }
  .search-page.expanded .table-wrap { max-height: none; min-height: 60vh; }
}

/* --- пользователи, заявки, вход --- */

.auth-check {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 6px 0 10px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
  cursor: pointer;
}
.auth-check input { margin-top: 2px; accent-color: var(--accent); }
.auth-check a { color: #9fc7e0; }
.auth-switch {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
}
.auth-switch button {
  border: 0;
  background: transparent;
  color: #9fc7e0;
  font-size: 11px;
  text-align: left;
  cursor: pointer;
  padding: 2px 0;
}
.auth-switch button:hover { color: var(--accent); text-decoration: underline; }
.auth-success {
  margin: 8px 0;
  padding: 9px 12px;
  border: 1px solid rgba(80, 160, 110, 0.45);
  border-radius: 4px;
  background: rgba(80, 160, 110, 0.12);
  color: #b7e3c6;
  font-size: 12px;
  line-height: 1.5;
}
.role-name { color: var(--muted); font-size: 11px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guest-note { display: inline-flex; gap: 10px; align-items: center; }
.auth-link {
  border: 1px solid #3a424b;
  background: transparent;
  color: #b7c1cb;
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 11px;
  letter-spacing: 0.06em;
  cursor: pointer;
}
.auth-link:hover { border-color: var(--accent); color: var(--accent); }

.lead-panel { padding: 22px; }
.lead-intro { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 18px; }
.lead-intro h1 { margin: 0 0 6px; font-size: 24px; letter-spacing: 0.04em; text-transform: uppercase; }
.lead-intro p { margin: 0; max-width: 640px; color: var(--muted); line-height: 1.6; font-size: 13px; }
.lead-badge {
  min-width: 190px;
  padding: 12px 14px;
  border: 1px solid #3a424b;
  border-radius: 6px;
  background: rgba(127, 180, 214, 0.08);
  text-align: center;
}
.lead-badge b { display: block; font-size: 20px; color: var(--accent); }
.lead-badge span { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }
.lead-form { display: grid; grid-template-columns: repeat(2, minmax(220px, 1fr)); gap: 12px; }
.lead-comment, .lead-consent, .lead-actions, .lead-form .counterparty-error { grid-column: 1 / -1; }
.lead-comment textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #111418;
  border-radius: 4px;
  background: #1c2025;
  color: var(--ink);
  font: inherit;
  resize: vertical;
}
.lead-honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.lead-actions { display: flex; align-items: center; gap: 14px; margin-top: 4px; }
.lead-note { font-size: 11px; color: var(--muted); line-height: 1.4; }
.lead-success { max-width: 680px; margin: 0 auto; text-align: center; }
.lead-success-mark {
  width: 54px; height: 54px; margin: 0 auto 12px; border-radius: 50%;
  display: grid; place-items: center; font-size: 26px; color: #b7e3c6;
  border: 1px solid rgba(80, 160, 110, 0.45); background: rgba(80, 160, 110, 0.12);
}
.lead-success h1 { margin: 0 0 8px; font-size: 22px; }
.lead-success p { color: var(--muted); line-height: 1.6; margin: 0 0 16px; }
.lead-success a { color: #9fc7e0; }

.leads-panel { padding: 18px; }
.leads-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.leads-head h1 { margin: 0 0 4px; font-size: 20px; letter-spacing: 0.08em; text-transform: uppercase; }
.leads-head p { margin: 0; color: var(--muted); font-size: 12px; }
.lead-funnel { display: grid; grid-template-columns: repeat(8, minmax(90px, 1fr)); gap: 8px; margin-bottom: 16px; }
.lead-funnel-card {
  border: 1px solid #3a424b;
  border-radius: 5px;
  background: #242a31;
  color: var(--ink);
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
}
.lead-funnel-card b { display: block; font-size: 18px; }
.lead-funnel-card span { display: block; font-size: 10px; color: var(--muted); margin-top: 2px; }
.lead-funnel-card.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px rgba(127, 180, 214, 0.25); }
.leads-table-wrap { overflow: auto; border: 1px solid #14171b; border-radius: 4px; }
.leads-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.leads-table th { position: sticky; top: 0; background: #262c33; z-index: 1; text-align: left; padding: 9px 10px; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: #a9b4bf; border-bottom: 1px solid #111418; }
.leads-table td { padding: 9px 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); vertical-align: top; }
.leads-table tr:hover { background: rgba(127, 180, 214, 0.05); }
.lead-contact { display: flex; flex-direction: column; gap: 2px; margin-top: 3px; font-size: 11px; }
.lead-contact a { color: #9fc7e0; text-decoration: none; }
.lead-contact a:hover { text-decoration: underline; }
.lead-lot { display: inline-block; margin-top: 4px; font-size: 10px; color: #9fc7e0; }
.lead-status-select, .lead-assignee-select, .lead-comment-input {
  width: 100%;
  min-width: 110px;
  padding: 5px 7px;
  border: 1px solid #3a424b;
  border-radius: 3px;
  background: #1c2025;
  color: var(--ink);
  font: inherit;
  font-size: 11px;
}
.lead-take { padding: 5px 8px; font-size: 10px; }
.users-panel { padding: 18px; }
.users-list { display: flex; flex-direction: column; gap: 8px; }
.user-card { display: grid; grid-template-columns: minmax(180px, 1.2fr) minmax(150px, 0.8fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid #3a424b; border-radius: 5px; background: #242a31; }
.user-card.status-pending { border-color: #8a6d2a; }
.user-card.status-blocked { opacity: 0.65; }
.user-main { display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.user-main span { color: var(--muted); font-size: 11px; }
.user-meta { display: flex; gap: 8px; align-items: center; font-size: 11px; color: var(--muted); }
.user-status { padding: 2px 7px; border-radius: 999px; border: 1px solid #3a424b; font-size: 10px; }
.user-status.pending { border-color: #8a6d2a; color: #e0c26a; }
.user-status.approved { border-color: rgba(80, 160, 110, 0.5); color: #b7e3c6; }
.user-status.blocked, .user-status.rejected { border-color: rgba(180, 80, 80, 0.5); color: #e0a0a0; }
.user-actions { display: flex; gap: 6px; justify-content: flex-end; }
.user-actions .ghost-btn { padding: 6px 9px; font-size: 10px; }

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 0 26px;
  color: var(--muted);
  font-size: 11px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  margin-top: 18px;
}
.site-footer nav { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.site-footer a, .site-footer button {
  border: 0; background: transparent; color: #9fc7e0; padding: 0; cursor: pointer;
  font: inherit; text-decoration: none;
}
.site-footer a:hover, .site-footer button:hover { color: var(--accent); text-decoration: underline; }

.cookie-banner {
  position: fixed;
  left: 18px;
  right: 18px;
  bottom: 14px;
  z-index: 80;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border: 1px solid #3a424b;
  border-radius: 6px;
  background: #20252b;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  font-size: 11px;
  color: var(--muted);
}
.cookie-banner b { color: var(--ink); margin-right: 8px; }
.cookie-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cookie-actions a { color: #9fc7e0; }
.cookie-actions .ghost-btn, .cookie-actions .find-btn { padding: 7px 10px; font-size: 10px; min-width: 0; letter-spacing: 0.04em; }

@media (max-width: 760px) {
  .lead-intro { flex-direction: column; }
  .lead-form { grid-template-columns: 1fr; }
  .lead-funnel { grid-template-columns: repeat(2, minmax(90px, 1fr)); }
  .user-card { grid-template-columns: 1fr; }
  .user-actions { justify-content: flex-start; }
  .cookie-banner { left: 10px; right: 10px; bottom: 10px; }
}
