/* Ravion CRM — стили. Без сборки: один файл.
   Дизайн-система (см. «UX-аудит Ravion CRM»):
   - цвет: один цвет — одно значение; статусы окрашены по этапу (продажа / исполнение / закрытие / готово);
   - шрифт Inter, 5 размеров: 22 / 16 / 14 / 13 / 12;
   - отступы — сетка 4 px: 4, 8, 12, 16, 24, 32;
   - высота полей и кнопок 36 px, маленьких — 32 px, строки таблицы — 40 px. */

@font-face {
  font-family: "Inter";
  src: url("../fonts/InterVariable.2bf3d951bf9d.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
}

:root {
  /* поверхности */
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --hover: #f2f6fd;
  --border: #e2e7ee;
  --border-strong: #cdd5df;
  /* текст */
  --text: #172133;
  --text-2: #4f5b6d;
  --text-3: #646f81;            /* подсказки: 5,1:1 на белом */
  /* бренд и действие */
  --brand: #17365d;
  --brand-2: #1f4e78;
  --accent: #2463eb;
  --accent-hover: #1b54d1;
  --accent-soft: #eaf0fe;
  /* этапы статусов */
  --sale: #2563c9;   --sale-soft: #e9f1fd;
  --exec: #0f766e;   --exec-soft: #e2f4f1;
  --close: #6d4ad8;  --close-soft: #f0ebfd;
  --done: #5b6678;   --done-soft: #eef1f5;
  /* сигналы */
  --ok: #18794e;     --ok-soft: #e7f5ed;
  --warn: #8a5a00;   --warn-soft: #fff4d6;  --warn-line: #f0d79a;
  --danger: #c0352b; --danger-soft: #fdecea; --danger-line: #f3c9c4;
  /* размеры */
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-pop: 0 8px 24px rgba(16, 24, 40, .14), 0 2px 6px rgba(16, 24, 40, .08);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --sidebar: 244px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 400 14px/20px var(--font); color: var(--text); background: var(--bg); font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; line-height: 28px; margin: 0; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 16px; line-height: 22px; margin: 0 0 12px; font-weight: 600; }
h3 { font-size: 14px; line-height: 20px; margin: 0 0 8px; font-weight: 600; }
p { margin: 0 0 8px; }
.muted { color: var(--text-2); }
.small { font-size: 12px; line-height: 16px; }
.num, td.num { font-variant-numeric: tabular-nums; }
kbd { font: 500 11px/16px var(--font); padding: 0 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; color: var(--text-3); background: var(--surface); }

/* ---------- каркас */
.layout { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { background: var(--brand); color: #c9d6e8; padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; align-self: start; display: flex; flex-direction: column; }
.layout::before { content: ""; position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: var(--brand); z-index: -1; }
.brand { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 700; font-size: 16px; padding: 0 4px 16px; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-logo { display: block; background: #fff; border-radius: var(--radius); padding: 8px 12px; width: 100%; }
.brand-logo img { display: block; max-width: 100%; max-height: 40px; margin: 0 auto; }
.brand-mark { width: 32px; height: 32px; border-radius: var(--radius-sm); background: #fff; color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.back-link { display: block; color: #9fb3cf; font-size: 13px; padding: 0 8px 8px; }
.back-link:hover { color: #fff; text-decoration: none; }
.nav-heading { display: block; color: #fff; font-weight: 600; font-size: 14px; padding: 8px; margin-bottom: 8px; border-radius: var(--radius-sm); }
.nav-heading:hover, .nav-heading.active { background: rgba(255,255,255,.12); text-decoration: none; }
.nav-section { margin-bottom: 12px; }
.nav-title { font-size: 11px; line-height: 16px; text-transform: uppercase; letter-spacing: .06em; color: #8aa1c0; padding: 0 8px 4px; font-weight: 500; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a, .nav > span { display: flex; align-items: center; gap: 12px; height: 36px; padding: 0 8px; border-radius: var(--radius-sm); color: #d5e0ee; font-size: 14px; }
.nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; color: #fff; }
.nav a.active { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 #7fb0ff; }
.nav .ico { flex: none; width: 18px; height: 18px; opacity: .85; }
.nav a.active .ico { opacity: 1; }
.nav .lbl { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav .cnt { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; font-size: 11px; line-height: 20px; font-weight: 600; text-align: center; background: rgba(255,255,255,.16); color: #fff; }
.nav .cnt.red { background: #e5484d; }
.nav-soon { margin-top: 8px; padding: 8px; font-size: 12px; line-height: 16px; color: #7f97b8; }
.nav-bottom { margin-top: auto; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.12); }
.nav span.soon { color: #6f86a6; cursor: default; }
.nav .tag { font-size: 10px; border: 1px solid #4a6488; border-radius: 10px; padding: 0 6px; color: #8aa0bf; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.global-search { position: relative; flex: 1; max-width: 560px; }
.global-search input[type=search] { height: 36px; padding: 0 44px 0 36px; background: var(--surface-2); border-color: var(--border); }
.global-search input[type=search]:focus { background: #fff; }
.global-search .ico { position: absolute; left: 12px; top: 10px; width: 16px; height: 16px; color: var(--text-3); pointer-events: none; }
.global-search kbd { position: absolute; right: 10px; top: 9px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.bell { position: relative; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-sm); color: var(--text-2); }
.bell:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.bell .ico { width: 20px; height: 20px; }
.bell .dot { position: absolute; top: 1px; right: 0; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: #e5484d; color: #fff; font-size: 10px; font-weight: 600; line-height: 16px; text-align: center; box-shadow: 0 0 0 2px #fff; box-sizing: border-box; }
.user-chip { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; }
.content { padding: 24px 24px 48px; max-width: 1440px; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .muted { margin-top: 4px; }
.crumbs { font-size: 12px; line-height: 16px; margin-bottom: 4px; color: var(--text-3); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- выпадающие меню (details) */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 220px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-pop); }
.menu-pop.left { right: auto; left: 0; }
.menu-pop a, .menu-pop button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 12px; border: 0; background: none; border-radius: var(--radius-sm); color: var(--text); font: 400 14px/20px var(--font); text-align: left; cursor: pointer; white-space: nowrap; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--hover); text-decoration: none; }
.menu-pop .danger { color: var(--danger); }
.menu-pop .danger:hover { background: var(--danger-soft); }
.menu-pop hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.menu-pop .hint { display: block; color: var(--text-3); font-size: 12px; line-height: 16px; }
.menu-pop .menu-label { padding: 8px 12px 4px; font-size: 12px; color: var(--text-3); }

/* ---------- карточки */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush.visible { overflow: visible; }
.grid { display: grid; gap: 16px; margin-bottom: 16px; align-items: start; }
.grid > .card { margin-bottom: 0; }
.grid > .card.stat { align-self: stretch; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat { padding: 16px; display: block; color: inherit; }
.stat:hover { text-decoration: none; border-color: var(--border-strong); }
.stat .num { font-size: 28px; line-height: 32px; font-weight: 600; letter-spacing: -.02em; }
.stat .label { color: var(--text-2); font-size: 13px; margin-top: 4px; }
.stat.alert .num { color: var(--danger); }
.stat.warn .num { color: var(--warn); }

/* ---------- кнопки: одна синяя на экран */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); padding: 0 16px; border-radius: var(--radius-sm); font: 500 14px/1 var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); border-color: #b9c3d0; text-decoration: none; }
.btn:focus-visible, .icon-btn:focus-visible, .tab:focus-visible { outline: 2px solid #9dbbff; outline-offset: 1px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--danger); border-color: var(--danger-line); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.square { width: 36px; padding: 0; }
.btn.small.square { width: 32px; }
.btn.google { width: 100%; padding: 0 16px; height: 40px; }
.btn[disabled], .btn.is-busy { opacity: .6; pointer-events: none; }
.btn .ico { width: 16px; height: 16px; }
.inline-form { display: inline; }

/* ---------- таблицы */
table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: 12px; line-height: 16px; font-weight: 600; color: var(--text-2); background: var(--surface-2); text-transform: uppercase; letter-spacing: .03em; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--hover); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 32px 24px; text-align: center; color: var(--text-2); }
.empty .btn { margin-top: 12px; }

/* ---------- метки: статус — скруглённая с точкой; признак груза — прямоугольная; счётчик — круглый */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: 10px; font-size: 12px; font-weight: 500; line-height: 1; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); margin: 1px 2px 1px 0; vertical-align: middle; white-space: nowrap; }
.badge.blue { background: var(--accent-soft); border-color: #cddbff; color: #1d4fc4; }
.badge.green { background: var(--ok-soft); border-color: #c4e7d2; color: var(--ok); }
.badge.amber { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }
.badge.red { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); }
.tag-attr { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 6px; border: 1px solid var(--text); border-radius: 4px; font-size: 11px; font-weight: 600; line-height: 1; color: var(--text); background: #fff; letter-spacing: .02em; vertical-align: middle; white-space: nowrap; }
.tag-attr.soft { border-color: var(--border-strong); color: var(--text-2); font-weight: 500; }

.status { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 12px; font-weight: 500; line-height: 1; white-space: nowrap; vertical-align: middle; background: var(--done-soft); color: var(--done); }
.status::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status .t { overflow: hidden; text-overflow: ellipsis; }
.status-new, .status-sourcing, .status-quoted { background: var(--sale-soft); color: var(--sale); }
.status-new::before { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }
.status-confirmed, .status-in_progress { background: var(--exec-soft); color: var(--exec); }
.status-confirmed::before { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }
.status-closing { background: var(--close-soft); color: var(--close); }
.status-closed { background: var(--done-soft); color: var(--done); }
.status-declined, .status-cancelled { background: var(--done-soft); color: var(--done); }
.status-declined::before, .status-cancelled::before { width: 8px; height: 1.5px; border-radius: 0; }
h1 .status, h1 .badge, h1 .kind-badge, h1 .tag-attr { margin-left: 8px; }
.kind-request { color: var(--text-2); }
.kind-order { color: var(--brand-2); font-weight: 600; }
.kind-badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 4px; font-size: 12px; font-weight: 500; border: 1px solid var(--border-strong); background: #fff; color: var(--text-2); vertical-align: middle; }
.kind-badge.kind-order { background: var(--brand); color: #fff; border-color: var(--brand); }
.count-badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 12px; font-weight: 600; color: var(--text-2); background: var(--done-soft); vertical-align: middle; font-variant-numeric: tabular-nums; }

/* ---------- формы */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; }
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field label, .field > .label { font-weight: 500; font-size: 13px; line-height: 16px; color: var(--text); }
.field .help { color: var(--text-3); font-size: 12px; line-height: 16px; margin-top: -4px; }
.field .errors { color: var(--danger); font-size: 12px; line-height: 16px; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=search], input[type=url], input[type=tel], select, textarea {
  width: 100%; height: 36px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font: 400 14px var(--font); color: var(--text); background: #fff;
}
textarea { height: auto; padding: 8px 12px; line-height: 20px; resize: vertical; }
select { padding-right: 32px; appearance: none; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23646f81' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center; }
select[multiple] { height: auto; padding: 4px; background-image: none; }
input::placeholder, textarea::placeholder { color: #8a94a4; }
input:focus, select:focus, textarea:focus { outline: 3px solid #d6e2ff; border-color: var(--accent); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--text-2); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
.field .choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 16px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.field .choices label { font-weight: 400; font-size: 14px; display: flex; gap: 8px; align-items: center; cursor: pointer; }
.field .choices input { width: 16px; height: 16px; margin: 0; }
.form-actions { display: flex; gap: 8px; margin-top: 24px; align-items: center; }
.form-actions.sticky { position: sticky; bottom: 0; z-index: 5; margin: 0 -24px; padding: 12px 24px; background: rgba(243,245,248,.92); backdrop-filter: blur(4px); border-top: 1px solid var(--border); }
.form-errors { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger-line); padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; }
.form-section h2 { margin-bottom: 16px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px; border-bottom: 1px solid var(--border); background: var(--surface); }
.filters input, .filters select { width: auto; min-width: 160px; height: 32px; font-size: 13px; }
.filters input[type=search] { min-width: 260px; }
.filters label.small { display: flex; gap: 6px; align-items: center; white-space: nowrap; font-size: 13px; color: var(--text-2); }
.filters input[type=checkbox] { width: auto; min-width: 0; height: auto; }

/* ---------- сообщения: всплывают в углу, успех скрывается сам */
.messages { list-style: none; padding: 0; margin: 0; position: fixed; right: 24px; bottom: 24px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: 420px; }
.messages li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-pop); animation: toast-in .2s ease-out; }
.messages li .x { margin-left: auto; border: 0; background: none; color: inherit; opacity: .6; cursor: pointer; font-size: 16px; line-height: 20px; padding: 0; }
.messages li.success { background: #f2fbf6; border-color: #c4e7d2; color: #145c37; }
.messages li.info { background: #f4f8ff; border-color: #cddbff; color: #1d3f8f; }
.messages li.error { background: #fff5f4; border-color: var(--danger-line); color: #8e241c; }
.messages li.warning { background: #fffaf0; border-color: var(--warn-line); color: #6f4800; }
.messages li.hide { opacity: 0; transform: translateY(8px); transition: .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- дерево оргструктуры */
.tree-row { display: grid; grid-template-columns: minmax(260px, 1.2fr) 1fr 1.4fr auto; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--border); align-items: start; }
.tree-row:last-child { border-bottom: none; }
.tree-name { display: flex; gap: 8px; align-items: baseline; font-weight: 600; }
.tree-name .indent { display: inline-block; color: var(--text-3); font-weight: 400; }
.tree-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.people { display: flex; flex-direction: column; gap: 4px; }
.person { font-size: 13px; }
.person .pos { color: var(--text-3); }

/* ---------- матрица прав */
.matrix th, .matrix td { text-align: center; padding: 8px; }
.matrix th:first-child, .matrix td:first-child { text-align: left; }
.matrix select { width: auto; min-width: 92px; height: 32px; font-size: 13px; }
.matrix select.s0 { color: var(--text-3); }
.matrix select.s1 { background-color: #fffaf0; }
.matrix select.s2 { background-color: #f0f6ff; }
.matrix select.s3 { background-color: #eefaf2; }
.matrix .na { color: #d0d6df; }
.matrix input[type=checkbox] { width: 16px; height: 16px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-top: 12px; }

/* ---------- вход */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, #17365d 0%, #1f4e78 55%, #2b6aa3 100%); padding: 16px; }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 12px; padding: 32px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.auth-card .brand { color: var(--brand); padding: 0 0 24px; }
.auth-card .brand-mark { background: var(--brand); color: #fff; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 12px; margin: 16px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
details.fallback summary { cursor: pointer; color: var(--text-2); font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* ---------- журнал */
.changes { margin: 0; padding: 0; list-style: none; font-size: 12px; }
.changes li { margin-bottom: 2px; }
.changes .old { color: var(--danger); text-decoration: line-through; }
.changes .new { color: var(--ok); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 12px; border-top: 1px solid var(--border); }

/* ---------- центр настроек */
.hub { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.hub .card { margin: 0; }
.hub h2 { margin-bottom: 8px; }
.hub ul { list-style: none; margin: 0; padding: 0; }
.hub li { padding: 4px 0; border-bottom: 1px dashed var(--border); display: flex; justify-content: space-between; gap: 8px; }
.hub li:last-child { border-bottom: none; }
.logo-preview { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; display: inline-block; margin-bottom: 8px; }
.logo-preview img { max-height: 70px; max-width: 280px; display: block; }

/* ---------- карточки: «подпись | значение» с фиксированной колонкой подписей */
.dl { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 8px 16px; margin: 0; }
.dl dt { color: var(--text-2); font-size: 13px; }
.dl dd { margin: 0; overflow-wrap: anywhere; }
.dl dd.pre { white-space: pre-line; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 52px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.card-head h2 { margin: 0; }
.contact-row { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.contact-row:last-child { border-bottom: none; }
.field.check { justify-content: flex-end; }
.check-label { display: flex; gap: 8px; align-items: center; font-weight: 500; font-size: 13px; cursor: pointer; padding: 8px 0; }
.check-label input { width: 16px; height: 16px; margin: 0; }
details.empty-fields summary { cursor: pointer; color: var(--text-2); font-size: 13px; margin-top: 12px; }
details.empty-fields .dl { margin-top: 12px; }

/* ---------- компактные списки: строка 40 px, текст в одну линию */
.compact-head { margin-bottom: 12px; align-items: center; }
.table-wrap { overflow-x: visible; }
.table.compact { font-size: 13px; line-height: 18px; }
.table.compact th, .table.compact td { padding: 4px 12px; vertical-align: middle; }
.table.compact td { height: 40px; }
.table.compact .icon-btn { width: 28px; height: 28px; }
.table.compact .avatar { width: 24px; height: 24px; font-size: 10px; }
.table.compact th { font-size: 11px; line-height: 16px; padding-top: 8px; padding-bottom: 8px; white-space: nowrap; }
.table.compact .badge { font-size: 11px; height: 18px; padding: 0 6px; }
.table.compact .name-col a { font-weight: 600; }
.table.compact tr.row-archived td { color: var(--text-3); }
.table.sticky-head thead th { position: sticky; top: 56px; z-index: 2; box-shadow: 0 1px 0 var(--border); }
.actions-col { width: 1%; white-space: nowrap; text-align: right; }
.row-actions { display: inline-flex; gap: 2px; align-items: center; }
.table tbody tr .row-actions { opacity: 0; transition: opacity .1s; }
.table tbody tr:hover .row-actions, .table tbody tr:focus-within .row-actions { opacity: 1; }
.icon-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--radius-sm); border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer; padding: 0; }
.icon-btn:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.icon-btn[data-tip]:hover::after, .icon-btn[data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 20;
  background: #1c2533; color: #fff; font-size: 12px; font-weight: 500; line-height: 16px; white-space: nowrap;
  padding: 4px 8px; border-radius: 4px; pointer-events: none; box-shadow: 0 4px 12px rgba(0,0,0,.18);
}
tbody tr:first-child .icon-btn[data-tip]:hover::after { bottom: auto; top: calc(100% + 6px); }
.table.fixed { table-layout: fixed; }
.table.fixed td, .table.fixed th { overflow: hidden; text-overflow: ellipsis; }
.table.fixed td.wrap { white-space: normal; overflow-wrap: normal; word-break: normal; }
.table.fixed td.actions-col { overflow: visible; }
.nowrap-ellipsis, .ell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
tr[data-href] { cursor: pointer; }
.sort-link { color: inherit; display: inline-flex; gap: 4px; align-items: center; }
.sort-link:hover { color: var(--text); text-decoration: none; }
.sort-link .arr { font-size: 10px; color: var(--accent); }
@media (max-width: 900px) { .table-wrap { overflow-x: auto; } .table.fixed { table-layout: auto; min-width: 900px; } }

/* ---------- вкладки */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 0 0 16px; flex-wrap: wrap; }
.tab { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; background: none; border-top: 0; border-left: 0; border-right: 0; font: 500 14px var(--font); cursor: pointer; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--done-soft); font-size: 11px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.tab.active .tab-count { background: var(--accent-soft); color: var(--accent); }
.tab-count.red { background: var(--danger); color: #fff; }
.tab-count.amber { background: var(--warn-soft); color: var(--warn); }
.tab-panel[hidden] { display: none; }

/* ---------- задачи */
.quick-add { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px; }
.quick-add input[type=text], .quick-add input:not([type]) { flex: 1 1 260px; }
.quick-add input, .quick-add select { width: auto; height: 32px; padding: 0 8px; font-size: 13px; }
.quick-add select { padding-right: 28px; background-position: right 8px center; }
.quick-add.inner { border-top: 1px solid var(--border); background: var(--surface-2); }
.quick-add.stacked { flex-direction: column; align-items: stretch; }
.quick-add.stacked > input { flex: none; width: 100%; }
.quick-add.stacked .row { display: flex; gap: 8px; }
.quick-add.stacked .row > * { flex: 1; min-width: 0; }
.quick-add.stacked .btn { align-self: flex-start; }
.task-row { display: flex; gap: 12px; align-items: flex-start; padding: 8px 16px; border-bottom: 1px solid var(--border); }
.task-row:last-child { border-bottom: 0; }
.task-row:hover { background: var(--surface-2); }
.task-check { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-strong); background: #fff; cursor: pointer; padding: 0; margin-top: 1px; display: grid; place-items: center; font-size: 11px; line-height: 1; color: #fff; flex: none; }
.task-check:hover { background: var(--ok-soft); border-color: var(--ok); }
.task-check.prio-urgent { border-color: var(--danger); background: var(--danger-soft); }
.task-check.prio-high { border-color: #d98a00; background: var(--warn-soft); }
.task-check.prio-low { border-color: var(--border); }
.task-row.done .task-check { background: var(--ok); border-color: var(--ok); }
.task-body { min-width: 0; flex: 1; }
.task-title { color: var(--text); font-weight: 500; overflow-wrap: anywhere; }
.task-row.done .task-title { color: var(--text-3); text-decoration: line-through; }
.task-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 12px; line-height: 16px; color: var(--text-2); margin-top: 2px; }
.task-meta .badge { font-size: 11px; height: 18px; padding: 0 6px; margin: 0; }
.due.red { color: var(--danger); font-weight: 600; }
.due.green { color: var(--ok); font-weight: 600; }

/* ---------- настройки компании */
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.image-card .image-slot { height: 152px; border: 1px dashed var(--border-strong); border-radius: var(--radius); display: grid; place-items: center; margin-bottom: 12px; background: repeating-conic-gradient(#f3f5f8 0% 25%, #fff 0% 50%) 50% / 16px 16px; }
.image-card .image-slot img { max-width: 90%; max-height: 128px; }
.image-card input[type=file] { width: 100%; margin-bottom: 8px; }
.signature-preview { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; overflow-x: auto; }
.preview-box { padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); font-weight: 600; font-size: 16px; }
.rates-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rates-bar input, .rates-bar select { width: auto; height: 32px; font-size: 13px; }
.image-card .help { display: block; color: var(--text-3); font-size: 12px; margin-bottom: 8px; }
.text-used { color: var(--ok); }

/* ---------- запросы и заказы */
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field .choices.radio { display: flex; gap: 16px; }
.job-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.job-side { position: sticky; top: 72px; }
.note-card { border-left: 3px solid var(--warn); }
.note-card.red { border-left-color: var(--done); background: var(--surface-2); }
.history-row { display: grid; grid-template-columns: 120px 160px 1fr; gap: 12px; padding: 8px 16px; border-bottom: 1px solid var(--border); }
.history-row:last-child { border-bottom: 0; }
.history-row .old { color: var(--danger); text-decoration: line-through; }
.nowrap { white-space: nowrap; }
.text-red { color: var(--danger); }
.text-warn { color: var(--warn); }
.status-line { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
#status-form .field { margin-bottom: 8px; }

/* шапка карточки заявки */
.job-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.job-head h1 { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.job-head h1 .status, .job-head h1 .kind-badge, .job-head h1 .tag-attr { margin-left: 0; }
.job-head .actions { margin-left: auto; }

/* шкала статусов */
.stepper { display: flex; margin: 0 0 16px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
.step { position: relative; flex: 1 1 0; min-width: 96px; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0; border: 0; background: none; font: 500 12px/16px var(--font); color: var(--text-3); text-align: center; }
.step::before { content: ""; position: absolute; top: 7px; left: calc(-50% + 10px); right: calc(50% + 10px); height: 2px; background: var(--border); }
.step:first-child::before { display: none; }
.step .pt { position: relative; z-index: 1; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid var(--border-strong); display: grid; place-items: center; color: #fff; font-size: 10px; line-height: 1; }
.step.done { color: var(--text-2); }
.step.done .pt { background: var(--text-3); border-color: var(--text-3); }
.step.done::before, .step.current::before { background: var(--text-3); }
.step.current { color: var(--text); font-weight: 600; }
.step.current .pt { width: 20px; height: 20px; margin-top: -2px; margin-bottom: -2px; border: 5px solid var(--accent); background: #fff; }
.step.sale.current .pt { border-color: var(--sale); }
.step.exec.current .pt { border-color: var(--exec); }
.step.close.current .pt { border-color: var(--close); }
button.step { cursor: pointer; }
button.step:hover { color: var(--accent); }
button.step:hover .pt { border-color: var(--accent); }
.stepper.stopped .step { opacity: .55; }

/* плитки ключевых фактов */
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
@media (min-width: 1720px) { .facts { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.fact { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; min-width: 0; }
.fact .fact-label { font-size: 12px; line-height: 16px; color: var(--text-3); font-weight: 500; margin-bottom: 8px; display: flex; justify-content: space-between; gap: 8px; }
.fact .big { font-size: 16px; line-height: 22px; font-weight: 600; }
.fact .route { font-size: 20px; line-height: 24px; font-weight: 600; letter-spacing: .01em; }
.fact .route .arr { color: var(--text-3); font-weight: 400; margin: 0 4px; }
.fact .line { font-size: 13px; line-height: 18px; color: var(--text); margin-top: 4px; overflow-wrap: anywhere; }
.fact .line.muted { color: var(--text-2); }
.fact .links { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; font-size: 13px; }
.fact .tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; }
.fact .money { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13px; line-height: 18px; }
.fact .money dt { color: var(--text-2); }
.fact .money dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.fact .money dd.gp { font-weight: 600; color: var(--ok); }
.fact .empty-val { color: var(--text-3); font-size: 13px; }

/* все данные: подпись над значением, 3 колонки */
.kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 24px; margin: 0; }
.kv div { min-width: 0; }
.kv dt { font-size: 12px; line-height: 16px; color: var(--text-3); margin-bottom: 4px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv .wide { grid-column: 1 / -1; }
.kv-section + .kv-section { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }
.kv-section h3 { font-size: 12px; line-height: 16px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); margin-bottom: 12px; }

/* правая колонка */
.next-card { border-color: #bcd0ff; background: linear-gradient(0deg, #fff, #fff), var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent), var(--shadow); }
.next-card.none { border-color: var(--warn-line); box-shadow: inset 3px 0 0 #d98a00, var(--shadow); }
.side-label { font-size: 12px; line-height: 16px; color: var(--text-3); font-weight: 500; margin-bottom: 8px; }
.dates { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; margin: 0; font-size: 13px; }
.dates dt { color: var(--text-2); }
.dates dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

/* модальное окно */
dialog.modal { border: 0; border-radius: 12px; padding: 0; width: min(480px, calc(100vw - 32px)); box-shadow: var(--shadow-pop); color: var(--text); }
dialog.modal::backdrop { background: rgba(23, 33, 51, .4); }
dialog.modal form { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
dialog.modal h2 { margin: 0; }
dialog.modal .form-actions { margin-top: 8px; justify-content: flex-end; }

/* главная */
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.mini-row { display: flex; align-items: center; gap: 12px; padding: 8px 16px; border-bottom: 1px solid var(--border); color: inherit; min-height: 44px; }
.mini-row:last-child { border-bottom: 0; }
.mini-row:hover { background: var(--hover); text-decoration: none; }
.mini-row .no { font-weight: 600; color: var(--accent); flex: none; width: 104px; }
.mini-row .who { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-row .rt { flex: none; color: var(--text-2); font-size: 12px; }

@media (max-width: 1100px) {
  .job-grid { grid-template-columns: 1fr; } .job-side { position: static; }
  .form-grid.three, .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .layout::before { display: none; }
  .sidebar { position: static; height: auto; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .form-grid, .facts, .kv { grid-template-columns: 1fr; }
  .tree-row { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .card.flush { overflow-x: auto; }
  .topbar { padding: 0 16px; }
  .topbar .user-name { display: none; }
}

/* ---------- поиск в списках и подсказки */
.combo { position: relative; width: 100%; }
.combo-native { display: none !important; }
.combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 50; max-height: 300px; overflow-y: auto; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-pop); min-width: 220px; }
.combo-item { display: flex; flex-direction: column; gap: 0; padding: 6px 10px; border-radius: var(--radius-sm); cursor: pointer; }
.combo-item.active, .combo-item:hover { background: var(--hover); }
.combo-label { font-size: 14px; line-height: 20px; }
.combo-hint { font-size: 12px; line-height: 16px; color: var(--text-3); }
.combo-empty { padding: 8px 10px; font-size: 13px; color: var(--text-3); }

/* ---------- форма заявки */
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.plus-btn { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; border: 0; background: var(--accent-soft); color: var(--accent); font: 600 15px/1 var(--font); cursor: pointer; padding: 0; flex: none; }
.plus-btn:hover { background: var(--accent); color: #fff; }
.route-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; }
.route-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; align-content: start; }
.route-col h3 { grid-column: 1 / -1; margin: 0; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.route-col .wide { grid-column: 1 / -1; }
.route-col + .route-col { padding-left: 32px; border-left: 1px solid var(--border); }
.cargo-table { width: 100%; border-collapse: collapse; }
.cargo-table th { font-size: 11px; line-height: 14px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .03em; text-align: left; padding: 0 4px 6px; vertical-align: bottom; }
.cargo-table td { padding: 4px; vertical-align: top; }
.cargo-table input, .cargo-table select { height: 32px; padding: 0 8px; font-size: 13px; }
.cargo-table select { padding-right: 24px; background-position: right 6px center; }
.cargo-table td.n { width: 28px; color: var(--text-3); font-size: 12px; padding-top: 12px; text-align: center; }
.cargo-table td.calc { font-variant-numeric: tabular-nums; font-size: 13px; padding-top: 10px; white-space: nowrap; text-align: right; color: var(--text-2); }
.cargo-table .del { padding-top: 6px; }
.cargo-table tr.removed { display: none; }
.cargo-table .errors { display: block; color: var(--danger); font-size: 11px; line-height: 14px; margin-top: 2px; }
.cargo-table input.num-in { text-align: right; }
.cargo-sub td { padding-top: 0; }
.cargo-totals { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; margin-top: 12px; padding: 12px 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.cargo-totals .t { font-size: 13px; color: var(--text-2); }
.cargo-totals .t b { color: var(--text); font-size: 14px; font-variant-numeric: tabular-nums; }
.cargo-totals .cw { display: flex; align-items: center; gap: 8px; }
.cargo-totals .weights { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin-left: auto; }
.cargo-totals .cw input[type=text], .cargo-totals .cw input[type=number] { width: 120px; height: 32px; text-align: right; font-weight: 600; }
.cargo-totals .cw input[readonly] { background: var(--surface-2); }
.cargo-totals .cw.vw input { width: 100px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 16px; font-size: 13px; cursor: pointer; background: #fff; user-select: none; }
.chip:hover { border-color: var(--accent); }
.chip input { margin: 0; width: 14px; height: 14px; }
.chip:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: #1d4fc4; font-weight: 500; }
.hidden-by-mode { display: none !important; }
@media (max-width: 1100px) { .route-cols { grid-template-columns: 1fr; } .route-col + .route-col { padding: 16px 0 0; border-left: 0; border-top: 1px solid var(--border); margin-top: 16px; } }
.cargo-item { position: relative; display: grid; grid-template-columns: 24px repeat(12, minmax(0, 1fr)) 32px; gap: 8px 12px; padding: 12px 0 16px; border-bottom: 1px dashed var(--border-strong); margin-bottom: 12px; }
.cargo-item.removed { display: none; }
.cargo-item .n { grid-row: 1 / 3; font-weight: 600; color: var(--text-3); padding-top: 26px; text-align: center; }
.cargo-item .field { gap: 4px; }
.cargo-item .field label { font-size: 12px; font-weight: 500; color: var(--text-2); }
.cargo-item input, .cargo-item select { height: 32px; font-size: 13px; padding: 0 8px; }
.cargo-item select { padding-right: 24px; background-position: right 6px center; }
.cargo-item input.num-in { text-align: right; }
.cargo-item input[readonly] { background: var(--surface-2); color: var(--text-2); }
.ci-name { grid-column: 2 / span 5; } .ci-desc { grid-column: span 4; } .ci-hs { grid-column: span 3; }
.ci-del { grid-column: 14; grid-row: 1; margin-top: 22px; }
.ci-qty { grid-column: 2 / span 1; } .ci-pack { grid-column: span 2; } .ci-w { grid-column: span 2; }
.ci-dims { grid-column: span 4; } .ci-vol { grid-column: span 2; } .ci-vw { grid-column: span 1; }
.ci-err { grid-column: 2 / -1; }
.dims { display: flex; align-items: center; gap: 4px; }
.dims span { color: var(--text-3); font-size: 12px; }
.calc-out { height: 32px; line-height: 32px; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 1280px) { .ci-qty { grid-column: 2 / span 2; } .ci-pack { grid-column: span 2; } .ci-w { grid-column: span 2; } .ci-dims { grid-column: span 4; } .ci-vol { grid-column: span 2; } .ci-vw { grid-column: 2 / span 3; } }

/* ---------- расчёты и КП */
.chain { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px 0; }
.chain .ap { display: inline-grid; place-items: center; height: 26px; padding: 0 10px; border: 1.5px solid var(--text); border-radius: 13px; font-weight: 600; font-size: 13px; letter-spacing: .02em; background: #fff; }
.chain .hop { position: relative; display: inline-flex; flex-direction: column; align-items: center; min-width: 76px; padding: 0 4px; }
.chain .hop::after { content: ""; display: block; width: 100%; height: 2px; background: var(--border-strong); margin-top: 2px; }
.chain .hop::before { content: ""; position: absolute; right: 2px; bottom: -3px; border: 4px solid transparent; border-left: 6px solid var(--border-strong); }
.chain .hop.truck::after { background: repeating-linear-gradient(90deg, var(--border-strong) 0 6px, transparent 6px 10px); }
.chain .cr { font-size: 11px; line-height: 14px; color: var(--text-2); white-space: nowrap; }
.rate-card { display: grid; grid-template-columns: 28px minmax(0, 1fr) 180px 120px 36px; gap: 12px 16px; align-items: start; padding: 16px; border-bottom: 1px solid var(--border); }
.rate-card:last-of-type { border-bottom: 0; }
.rate-card.off { opacity: .55; }
.rate-card .rate-check { padding-top: 2px; }
.rate-card .rate-check input { width: 18px; height: 18px; }
.rate-title { font-weight: 600; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.rate-title a { color: var(--text); }
.rate-nums, .rate-time { text-align: right; }
.rate-nums .big, .rate-time .big { font-size: 16px; font-weight: 600; line-height: 22px; }
.text-ok { color: var(--ok); }
@media (max-width: 1100px) { .rate-card { grid-template-columns: 28px minmax(0, 1fr) 36px; } .rate-nums, .rate-time { grid-column: 2; text-align: left; } }

/* ---------- почта */
.mail-row { display: grid; grid-template-columns: 28px minmax(150px, 230px) minmax(0, 1fr) auto 96px; gap: 10px; align-items: center; padding: 8px 16px 8px 10px; border-bottom: 1px solid var(--border); color: inherit; }
.mail-row:last-child { border-bottom: 0; }
.mail-row:hover { background: var(--hover); }
.mail-row.selected { background: var(--accent-soft); }
.mail-row a { color: inherit; text-decoration: none; min-width: 0; }
.mail-row .pick { display: flex; align-items: center; justify-content: center; cursor: pointer; height: 100%; }
.mail-row .dir { color: var(--text-3); display: flex; }
.mail-row .dir .ico { width: 16px; height: 16px; }
.mail-row .who { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-row .who small { display: block; font-weight: 400; color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.mail-row .who .badge { margin: 2px 0 0; }
.mail-row .subj { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-row .subj b { font-weight: 400; color: var(--text); }
.mail-row .subj span { color: var(--text-3); }
.mail-row.unread { background: #fbfcff; box-shadow: inset 3px 0 0 var(--accent); }
.mail-row.unread .who, .mail-row.unread .subj b { font-weight: 700; color: var(--text); }
.mail-row.unread .when { color: var(--accent); font-weight: 600; }
.mail-row .tags { display: flex; gap: 6px; justify-content: flex-end; align-items: center; white-space: nowrap; }
.mail-row .when { text-align: right; color: var(--text-3); font-size: 12px; white-space: nowrap; }
.mail-row .clip { color: var(--text-3); }
.flag { color: #d93025; font-size: 14px; }
.mlabel { display: inline-block; font-size: 11px; line-height: 18px; padding: 0 6px; border-radius: 4px; margin-right: 6px; vertical-align: 1px; font-weight: 500; }
.lbl-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.mail-sticky { position: sticky; top: 56px; z-index: 20; background: var(--bg); margin: -24px -24px 12px; padding: 16px 24px 0; }
.mail-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 48px; padding: 8px 0; border-bottom: 1px solid var(--border); margin: 0; }
.mail-toolbar .check-label { padding: 0 6px 0 10px; }
.mail-toolbar .bulk-actions, .mail-toolbar .mail-filters { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mail-toolbar .bulk-actions[hidden], .mail-toolbar .mail-filters[hidden] { display: none; }
.mail-toolbar .sep { width: 1px; height: 24px; background: var(--border); margin: 0 4px; }
.mail-toolbar details.menu .menu-pop { min-width: 200px; }
.fchip { display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 15px; font-size: 13px; color: var(--text-2); background: var(--surface); text-decoration: none; }
.fchip:hover { border-color: var(--accent); text-decoration: none; }
.fchip.active { background: var(--accent-soft); border-color: var(--accent); color: #1d4fc4; }
.chip-select { height: 30px; border-radius: 15px; font-size: 13px; width: auto; padding: 0 28px 0 12px; }
.msg-sticky { padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.msg-toolbar { border-bottom: 0; padding: 0; }
.msg-grid { grid-template-columns: minmax(0, 1fr) 280px; }
.mailbox-bar { display: flex; align-items: center; gap: 12px; padding: 8px 14px; }
.mailbox-bar .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mailbox-bar .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.mailbox-bar .dot.off { background: var(--danger); }
.mailbox-bar .grow { flex: 1; min-width: 200px; }
.connect-card { display: flex; gap: 16px; align-items: center; padding: 20px; flex-wrap: wrap; }
.connect-card .ico-big { width: 44px; height: 44px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.connect-card .ico-big .ico { width: 22px; height: 22px; }
.connect-card .grow { flex: 1; min-width: 240px; }
.msg { border-bottom: 1px solid var(--border); }
.msg:last-child { border-bottom: 0; }
.msg-head { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; cursor: pointer; }
.msg-head .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; font-weight: 600; font-size: 12px; color: var(--text-2); flex: none; }
.msg-head .avatar.out { background: var(--accent-soft); border-color: #cddbff; color: #1d4fc4; }
.msg-head .meta { flex: 1; min-width: 0; }
.msg-head .meta .from { font-weight: 600; }
.msg-head .meta .from span { font-weight: 400; color: var(--text-3); }
.msg-head .meta .to { color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-head .meta .snip { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-head .when { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.msg.open .msg-head .snip { display: none; }
.msg-body { display: none; padding: 0 16px 12px 60px; }
.msg.open .msg-body { display: block; }
.msg-frame { width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm); min-height: 120px; background: #fff; display: block; }
.atts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.att { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px; font-size: 13px; background: var(--surface); max-width: 100%; }
.att .ico { width: 16px; height: 16px; color: var(--text-3); flex: none; }
.att a.name { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.att .size { color: var(--text-3); font-size: 12px; }
.att .saved { color: var(--ok); font-size: 12px; }
.att form { display: inline; }
.att button.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; font-size: 12px; }
.msg-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.thread-card .card-head h2 { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compose-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.compose-grid .field { margin-bottom: 12px; }
.compose-grid textarea { min-height: 280px; font: 14px/1.5 var(--font); }
.file-pick { display: flex; flex-direction: column; gap: 6px; max-height: 280px; overflow: auto; }
.file-pick label { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; }
.file-pick label span { overflow-wrap: anywhere; }
.rfq-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.rfq-list { max-height: 560px; overflow: auto; }
.rfq-agent { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 8px 16px; border-bottom: 1px solid var(--border); cursor: pointer; }
.rfq-agent:hover { background: var(--hover); }
.rfq-agent .n { font-weight: 600; }
.rfq-agent .h { color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rfq-agent select { height: 28px; font-size: 12px; padding: 0 22px 0 6px; width: auto; }
.rfq-agent.disabled { opacity: .55; cursor: default; }
.rfq-preview textarea { min-height: 300px; font: 13px/1.5 var(--font); }
.lang-tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.rfq-table td { vertical-align: middle; }
@media (max-width: 1100px) { .compose-grid, .rfq-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .mail-row { grid-template-columns: 24px minmax(0, 1fr) 80px; }
  .mail-row .subj { grid-column: 2 / 4; }
  .mail-row .tags { grid-column: 2 / 4; justify-content: flex-start; }
  .mail-sticky { margin: -16px -16px 12px; padding: 12px 16px 0; position: static; }
  .msg-body { padding-left: 16px; }
}
.mail-row .clip .ico { width: 15px; height: 15px; vertical-align: -3px; }
.msg-head .when .ico { width: 13px; height: 13px; vertical-align: -2px; }

/* ---------- почта: три панели как в Outlook */
.mail-app { display: grid; grid-template-columns: minmax(340px, 460px) minmax(0, 1fr); height: calc(100vh - 56px - 172px); min-height: 480px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.mfolders { border-right: 1px solid var(--border); padding: 12px 8px; overflow-y: auto; background: var(--surface-2); }
.mfolder { display: flex; justify-content: space-between; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: var(--radius-sm); color: var(--text); font-size: 14px; text-decoration: none; }
.mfolder span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mfolder b { font-size: 12px; color: var(--accent); font-weight: 600; }
.mfolder:hover { background: var(--hover); text-decoration: none; }
.mfolder.active { background: var(--accent-soft); color: #1d4fc4; font-weight: 600; }
.mfolder-title { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 14px 10px 4px; }
.mlist { display: flex; flex-direction: column; min-width: 0; border-right: 1px solid var(--border); }
.mlist-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 48px; padding: 6px 10px; border-bottom: 1px solid var(--border); margin: 0; }
.mlist-head .check-label { padding: 0 4px; }
.mlist-head .folder-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mlist-head .folder-name[hidden], .mlist-head .bulk-actions[hidden] { display: none; }
.mlist-head .bulk-actions { display: inline-flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.mlist-head .btn.small { padding: 0 8px; }
.mlist-body { flex: 1; overflow-y: auto; position: relative; }
.mrow { position: relative; display: grid; grid-template-columns: 26px minmax(0, 1fr); border-bottom: 1px solid var(--border); }
.mrow:hover { background: var(--hover); }
.mrow.active { background: #dce8fe; }
.mrow.selected { background: var(--accent-soft); }
.mrow .pick { display: flex; justify-content: center; padding-top: 12px; cursor: pointer; }
.mrow-link { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px 8px 2px; color: var(--text); min-width: 0; text-decoration: none; }
.mrow-link:hover { text-decoration: none; }
.mrow .l1, .mrow .l2 { display: flex; justify-content: space-between; gap: 8px; min-width: 0; }
.mrow .who { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mrow .when { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.mrow .subj { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mrow .icons { display: inline-flex; gap: 4px; color: var(--text-3); }
.mrow .icons .ico { width: 14px; height: 14px; }
.mrow .l3 { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mrow .l3 .badge { margin: 0 2px 0 0; height: 18px; font-size: 11px; }
.mrow.unread { box-shadow: inset 3px 0 0 var(--accent); }
.mrow.unread .who, .mrow.unread .subj { font-weight: 700; }
.mrow.unread .when { color: var(--accent); font-weight: 600; }
.mrow-x { position: absolute; right: 6px; bottom: 6px; }
.mlist .pager { display: flex; gap: 8px; align-items: center; justify-content: center; padding: 10px; }
.mpane { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.mpane-page { height: calc(100vh - 56px - 72px); }
.mpane-empty { margin: auto; text-align: center; color: var(--text-3); display: flex; flex-direction: column; gap: 6px; align-items: center; }
.mpane-empty .ico { width: 40px; height: 40px; opacity: .4; }
.pane-tools { border-bottom: 1px solid var(--border); padding: 8px 12px; }
.pane-toolbar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0; }
.pane-toolbar .sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.pane-scroll { flex: 1; overflow-y: auto; padding: 14px 18px 24px; }
.pane-subject { font-size: 19px; line-height: 1.3; margin: 0 0 12px; }
.pane-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.pane-head .avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; font-weight: 600; font-size: 12px; color: var(--text-2); flex: none; }
.pane-head .avatar.out { background: var(--accent-soft); color: #1d4fc4; }
.pane-meta { flex: 1; min-width: 0; }
.pane-from { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; font-weight: 600; }
.pane-date { font-weight: 400; color: var(--text-3); font-size: 12px; white-space: nowrap; }
.pane-rcpt { display: flex; gap: 8px; font-size: 13px; margin-top: 3px; }
.pane-rcpt .k { color: var(--text-3); width: 44px; flex: none; }
.pane-rcpt .v { display: flex; flex-wrap: wrap; gap: 2px 10px; min-width: 0; }
.pane-job { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 10px; margin: 0 0 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; }
.pane-job .pane-link { display: flex; gap: 6px; }
.pane-job .pane-link input { height: 30px; width: 210px; font-size: 13px; }
.link-btn { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; font: inherit; }
.pane-frame { border: 0; min-height: 80px; }
details.addr { display: inline-block; position: relative; }
details.addr > summary { list-style: none; cursor: pointer; border-radius: 4px; padding: 0 2px; }
details.addr > summary::-webkit-details-marker { display: none; }
details.addr > summary:hover { background: var(--hover); color: var(--accent); }
.addr-known { color: var(--ok); font-size: 9px; vertical-align: 2px; margin-right: 3px; }
.addr-pop { position: absolute; z-index: 40; top: 100%; left: 0; min-width: 280px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-pop); padding: 6px; display: flex; flex-direction: column; font-weight: 400; font-size: 13px; }
.addr-pop .addr-mail { padding: 6px 10px; color: var(--text-3); border-bottom: 1px solid var(--border); margin-bottom: 4px; user-select: all; }
.addr-pop a, .addr-pop button { display: block; text-align: left; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; text-decoration: none; }
.addr-pop a:hover, .addr-pop button:hover { background: var(--hover); }
.siblings { margin-top: 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.siblings summary { padding: 8px 12px; cursor: pointer; color: var(--text-2); font-size: 13px; }
.sib { display: grid; grid-template-columns: 180px minmax(0, 1fr) auto; gap: 10px; padding: 7px 12px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text); text-decoration: none; }
.sib:hover { background: var(--hover); text-decoration: none; }
.sib .who, .sib .snip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sib .snip, .sib .when { color: var(--text-3); }
.mail-search { flex: 1; max-width: 640px; }
@media (max-width: 1100px) {
  .mail-app { grid-template-columns: 1fr; height: auto; }
  .mfolders { display: flex; flex-wrap: wrap; gap: 4px; border-right: 0; border-bottom: 1px solid var(--border); }
  .mfolders .btn, .mfolders select, .mfolder-title { display: none; }
  .mpane { display: none; }
  .mlist-body { overflow: visible; }
}
.mail-app > * { min-height: 0; }
.mlist-body, .pane-scroll, .mfolders { min-height: 0; }

.mail-tabs { display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.mail-tabs .tabs { flex: 1; min-width: 0; }
.mail-tabs-right { display: flex; gap: 8px; align-items: center; padding-bottom: 6px; }
.labels-menu > summary { list-style: none; }
.labels-menu > summary::-webkit-details-marker { display: none; }
.labels-menu .menu-pop { min-width: 220px; max-height: 60vh; overflow-y: auto; }
.labels-menu .menu-pop a { display: flex; align-items: center; gap: 4px; }
.text-accent { color: var(--accent); margin-left: auto; }
.mrow .who { font-size: 14px; }
.mrow .subj { font-size: 13px; color: var(--text-2); }
.mrow.unread .subj { color: var(--text); }

.save-menu { display: inline-block; position: relative; }
.save-menu > summary { list-style: none; cursor: pointer; font-size: 12px; color: var(--accent); }
.save-menu > summary::-webkit-details-marker { display: none; }
.save-menu .menu-pop { min-width: 180px; }
[data-open-folder].done { color: var(--ok); }

.addr-suggest { position: absolute; left: 0; right: 0; top: 100%; z-index: 50; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-pop); max-height: 320px; overflow-y: auto; margin-top: 2px; }
.addr-suggest .opt { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; cursor: pointer; font-size: 13px; }
.addr-suggest .opt b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.addr-suggest .opt span { color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.addr-suggest .opt.on, .addr-suggest .opt:hover { background: var(--accent-soft); }
.dropzone { display: block; position: relative; border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 18px 12px; text-align: center; color: var(--text-2); font-size: 13px; cursor: pointer; background: var(--surface-2); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: #1d4fc4; }
.dropzone kbd { font-size: 11px; }
.picked { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.picked li { display: flex; gap: 8px; align-items: center; font-size: 13px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px 8px; }
.picked li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picked li small { color: var(--text-3); }
.picked li button { background: none; border: 0; cursor: pointer; font-size: 16px; color: var(--text-3); }

.contract-folder { padding: 10px 16px; border-top: 1px solid var(--border); background: var(--surface-2); }

.acc-group { margin-top: 14px; }
.acc-title { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.acc-file { display: flex; gap: 8px; align-items: center; font-size: 13px; padding: 3px 0; }
.acc-file span { flex: 1; overflow-wrap: anywhere; }
.acc-file small { color: var(--text-3); white-space: nowrap; }

.rfq-agent .rcpts { display: flex; flex-wrap: wrap; gap: 2px 14px; margin-top: 4px; }
.rfq-agent .rcpt { font-size: 12px; display: inline-flex; gap: 4px; align-items: center; cursor: pointer; }
.rfq-agent .rcpt input { width: 13px; height: 13px; margin: 0; }
.rfq-agent label.n { cursor: pointer; }

/* ---- письмо + выбор адресатов (запрос ставок, рассылки) */
.letter-card { margin-bottom: 16px; }
.letter-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.letter-grid textarea { min-height: 280px; font: 13px/1.5 var(--font); }
.letter-side { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
@media (max-width: 1100px) { .letter-grid { grid-template-columns: 1fr; } }
.rcpt-card { margin-bottom: 0; }
.rcpt-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.rcpt-filters input[type=search] { width: 220px; height: 32px; font-size: 13px; }
.rcpt-filters select { width: auto; height: 32px; font-size: 13px; }
.rcpt-filters .check-label { padding: 0; }
.rcpt-scroll { overflow: visible; }
.rcpt-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rcpt-table thead th { position: sticky; top: 56px; z-index: 2; background: var(--surface-2); text-align: left; font-size: 12px; font-weight: 600; color: var(--text-2); padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.rcpt-table td { padding: 5px 10px; vertical-align: middle; }
.rcpt-table .c-pick { width: 34px; padding-left: 16px; }
.rcpt-table .c-country { width: 120px; color: var(--text-2); }
.rcpt-table .c-chk { width: 82px; text-align: center; }
.rcpt-table th.c-chk { text-align: center; }
.rcpt-table input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; vertical-align: middle; }
.rcpt-table tbody.rco { border-top: 1px solid var(--border); }
.rcpt-table tr.co-row td { padding-top: 9px; padding-bottom: 4px; }
.rcpt-table .co-name label { cursor: pointer; margin-right: 6px; }
.rcpt-table .co-name .badge { margin-right: 4px; }
.rcpt-table .c-lang { text-align: right; padding-right: 16px; }
.rcpt-table .c-lang select { height: 28px; font-size: 12px; padding: 0 22px 0 8px; width: auto; }
.rcpt-table tr.ct-row:hover td { background: var(--hover); }
.rcpt-table tr.ct-row:last-of-type td { padding-bottom: 8px; }
.rcpt-table tr.ct-row.is-to td:nth-child(n+4) { background: var(--accent-soft); }
.rcpt-table tr.ct-row.is-cc td:nth-child(n+4) { background: var(--surface-2); }
.rcpt-table tbody.rco.on tr.co-row td { background: #f8fafe; }
.rcpt-table tbody.rco.bad tr.co-row td { background: var(--danger-soft); }
.rcpt-table tr.greet-row td { padding-top: 2px; padding-bottom: 10px; }
.greet-line { display: flex; gap: 8px; align-items: center; }
.greet-line .greet { max-width: 360px; height: 30px; font-size: 13px; }
.send-bar { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-pop); padding: 10px 16px; margin-top: 12px; }
.greet-reset[hidden], .greet-warn[hidden] { display: none !important; }
.colleagues { display: flex; flex-direction: column; gap: 4px; max-height: 160px; overflow: auto; } .colleagues .check-label { padding: 0; }

/* ---- финансы */
.fin-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-bottom: 16px; }
.fin-card { padding: 14px 16px; }
.fin-card-title { font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.fin-checks details { margin: 4px 0; }
.fin-checks summary { cursor: pointer; font-size: 13px; }
.fin-checks ul { list-style: none; margin: 6px 0 8px 0; padding: 0 0 0 4px; max-height: 220px; overflow: auto; }
.fin-checks li { padding: 2px 0; }
.fin-line { display: flex; align-items: center; gap: 8px; margin: 2px 0; }
.fin-amt { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.fin-aging td { vertical-align: top; }
.fin-aging tbody.fin-group { border-top: 1px solid var(--border); }
.fin-det summary { cursor: pointer; list-style: none; }
.fin-det summary::-webkit-details-marker { display: none; }
.fin-det summary::before { content: "▸ "; color: var(--text-3); }
.fin-det[open] summary::before { content: "▾ "; }
.fin-inv-list { margin: 6px 0 2px 14px; font-size: 12px; color: var(--text-2); display: grid; gap: 3px; }
.filters-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.filters-row input[type=search] { width: 280px; height: 32px; font-size: 13px; }
.filters-row select, .filters-row input[type=date] { width: auto; height: 32px; font-size: 13px; }
.fin-detail { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .fin-detail { grid-template-columns: 1fr; } }
.fin-kv { grid-template-columns: 150px minmax(0, 1fr); }
.fin-kv dd { margin: 0; }
.fin-pay { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 13px; }
.fin-pay-form { margin-top: 12px; }
.fin-pay-form summary { list-style: none; display: inline-flex; }
.fin-pay-form summary::-webkit-details-marker { display: none; }
.fin-margin { display: flex; flex-wrap: wrap; gap: 24px; padding: 12px 16px 6px; border-top: 1px solid var(--border); }
.fin-margin div, .fin-balances div { display: flex; flex-direction: column; }
.fin-margin strong, .fin-balances strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.fin-balances { display: flex; flex-wrap: wrap; gap: 24px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.text-green { color: var(--ok); }
.inv-lines td { vertical-align: middle; }
.inv-lines input { height: 32px; }
.inv-lines tr.removed { opacity: .4; }
.inv-lines tr.removed input[type=text], .inv-lines tr.removed input[type=number] { text-decoration: line-through; }
.line-del { cursor: pointer; color: var(--text-3); }
.line-del input { display: none; }
.form-grid .wide2 { grid-column: span 2; }
.fin-aging td:last-child { white-space: nowrap; }

/* ---- шаблоны документов */
.doc-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .doc-grid { grid-template-columns: 1fr; } }
.doc-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--border); }
.doc-row.off { opacity: .6; }
.doc-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.doc-help { position: sticky; top: 72px; max-height: calc(100vh - 90px); overflow: auto; }
.doc-help h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); margin: 14px 0 6px; }
.ph-list { display: flex; flex-direction: column; gap: 2px; }
.ph { display: flex; justify-content: space-between; gap: 8px; text-align: left; background: none; border: 0; border-radius: var(--radius-sm); padding: 4px 6px; font: 500 12.5px/1.3 var(--font); color: var(--accent); cursor: pointer; }
.ph span { color: var(--text-3); font-weight: 400; text-align: right; }
.ph:hover { background: var(--hover); }
.ph.copied { background: var(--ok-soft); color: var(--ok); }
.tpl-choices { display: grid; gap: 6px; }
.tpl-choice { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; }
.tpl-choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.cargo-now { margin: 2px 0 4px; }
.cargo-history li { padding: 3px 0; }
.rcpt-mini td, .rcpt-mini th { padding: 6px 8px; }
.rcpt-mini .c { text-align: center; width: 72px; }
.stage-card { margin-bottom: 16px; }
.stage-table td { vertical-align: middle; }
.stage-table input[type=text], .stage-table select { width: 100%; }
.stage-table .c { text-align: center; }
/* ---- аналитика */
.an-filters { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; padding: 10px 12px; margin-bottom: 16px; }
.an-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.an-presets .chip { color: var(--text-2); }
.chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 500; }
.an-custom { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.an-custom input[type=date] { width: 140px; }
.an-custom select { width: auto; max-width: 200px; }
.an-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.an-kpi { padding: 12px 16px; margin: 0; }
.an-kpi-label { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.an-kpi-val { white-space: nowrap; font-size: 22px; line-height: 32px; font-weight: 600; font-variant-numeric: tabular-nums; margin: 2px 0; }
.an-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); gap: 16px; margin-bottom: 16px; }
.an-chart { margin: 0; }
.an-chart h2 { font-size: 14px; margin: 0 0 12px; }
.vbars { display: flex; align-items: flex-end; gap: 2px; height: 160px; padding-bottom: 18px; border-bottom: 1px solid var(--border); position: relative; }
.vbar { flex: 1 1 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; outline: none; }
.vbar-fill { width: 100%; max-width: 24px; min-height: 0; background: var(--accent); border-radius: 4px 4px 0 0; }
.vbar-fill.neg { background: var(--danger); }
.vbar:hover .vbar-fill, .vbar:focus .vbar-fill { background: var(--accent-hover); }
.vbar:hover .vbar-fill.neg { background: var(--danger); opacity: .85; }
.vbar em { position: absolute; bottom: -18px; font-style: normal; font-size: 11px; color: var(--text-3); white-space: nowrap; }
.vbar:hover::after, .vbar:focus::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; font-size: 12px; line-height: 16px; padding: 4px 8px; border-radius: 6px; white-space: nowrap; z-index: 5; pointer-events: none; }
.vbar:first-child:hover::after { left: 0; transform: none; }
.vbar:last-child:hover::after { left: auto; right: 0; transform: none; }
.an-table-toggle { padding: 10px 16px; margin-bottom: 16px; }
.an-table-toggle summary { cursor: pointer; font-weight: 500; }
.an-table-toggle .table-scroll { margin-top: 8px; }
.an-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(860px, 100%), 1fr)); gap: 16px; }
.an-grid > .card { margin: 0; }
.an-table td, .an-table th { white-space: nowrap; }
.an-table td:first-child { white-space: normal; min-width: 160px; }
.an-bar-col { width: 200px; }
.hbar { position: relative; height: 20px; display: flex; align-items: center; }
.hbar-fill { position: absolute; left: 0; top: 4px; bottom: 4px; background: var(--accent-soft); border-radius: 0 4px 4px 0; }
.hbar-fill.neg { background: var(--danger-soft); }
.hbar b { position: relative; font-weight: 500; font-variant-numeric: tabular-nums; padding-left: 4px; }
@media (max-width: 700px) { .an-grid, .an-charts { grid-template-columns: 1fr; } }
.table-scroll { overflow-x: auto; }
/* ---- интеграции */
.int-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 16px; margin-bottom: 24px; }
.int-card { margin: 0; display: flex; flex-direction: column; align-items: flex-start; }
.int-card p { margin: 0 0 10px; }
.int-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; margin-bottom: 8px; }
.int-head h2 { margin: 0; font-size: 15px; }
.int-state { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--text-2); white-space: nowrap; }
.int-state i { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }
.int-state.ok { color: var(--ok); } .int-state.ok i { background: var(--ok); }
.int-state.warn { color: var(--warn); } .int-state.warn i { background: #d99a00; }
.int-state.error { color: var(--danger); } .int-state.error i { background: var(--danger); }
.int-state.planned i { background: transparent; border: 1.5px dashed var(--text-3); }
.int-details { width: 100%; margin-bottom: 10px; }
.int-path { word-break: break-all; color: var(--text-2); }
.int-section { font-size: 16px; margin: 0 0 12px; }
.text-amber { color: var(--warn); }
