/* =====================================================================
   ARS-X 2.3 — обновлённое оформление и юзабилити CRM
   • меню: компактные свёрнутые группы, режим «рельс» (только иконки);
   • шапка: кнопка «Создать», компактные кнопки на узких экранах;
   • выезжающая панель сделки, новый канбан, раздел «Счета и оплаты»;
   • логотип компании для светлой и тёмной темы;
   • общая полировка: слои окон, таблицы, фокус, прокрутка.
   Подключается последним и опирается на токены arsx2.css.
   ===================================================================== */

/* ---------------------------------------------------------- слои окон */
.modal-backdrop { z-index: 70; }
.toast { z-index: 95; }
.cmdk-backdrop { z-index: 85; }
html.drawer-open { overflow: hidden; }

/* ------------------------------------------- логотип компании по теме */
html:not([data-theme="dark"]) .company-logo-dark { display: none !important; }
html[data-theme="dark"] .company-logo-light { display: none !important; }
.company-identity .company-logo-img { height: 36px; max-width: 168px; object-fit: contain; display: block; }

.logo-slots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 8px; }
.logo-slot { display: flex; gap: 14px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.logo-slot-preview { flex: 0 0 132px; height: 72px; display: grid; place-items: center; border-radius: 10px; border: 1px dashed var(--line-strong); overflow: hidden; padding: 8px; }
.logo-slot-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-slot.light .logo-slot-preview { background: #FFFFFF; }
.logo-slot.dark .logo-slot-preview { background: #14161B; border-color: #323743; }
.logo-slot-preview span { font-size: 12px; text-align: center; color: #667085; line-height: 1.35; }
.logo-slot.dark .logo-slot-preview span { color: #8B93A1; }
.logo-slot-info { min-width: 0; display: grid; gap: 6px; }
.logo-slot-info b { font-size: 13.5px; }
.logo-slot-info small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.logo-slot-info .actions { display: flex; gap: 6px; flex-wrap: wrap; }
@media (max-width: 700px) { .logo-slots { grid-template-columns: 1fr; } }

/* --------------------------------------------------------- боковое меню */
/* Классическое правило «.nav button» делало заголовок группы широкой плашкой — сбрасываем. */
.nav button.nav-group-head {
  display: inline-flex; align-items: center; gap: 6px; width: auto; max-width: 100%; align-self: flex-start;
  margin: 8px 0 2px 4px; padding: 3px 8px; border: 0; border-radius: 7px; background: transparent;
  font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--nav-muted); line-height: 1.5;
}
.nav button.nav-group-head:hover { background: var(--surface-2); color: var(--nav-text); }
.nav-group { display: flex; flex-direction: column; gap: 1px; margin-top: 2px; }
.nav-group-head .nav-module-tag { letter-spacing: .02em; }
.nav-group-head .chev { width: 12px; height: 12px; opacity: .7; }
/* Свёрнутая группа — компактный чип по ширине текста. */
.nav-group.collapsed { flex-direction: row; flex-wrap: wrap; }
.nav-group.collapsed .nav-group-head { border: 1px solid var(--nav-line); background: var(--surface); color: var(--nav-text); padding: 3px 6px 3px 9px; margin-top: 6px; }
.nav-group.collapsed .nav-group-head:hover { border-color: var(--line-strong); }
.nav-group.collapsed .nav-module-tag { display: none; }
.nav-group.collapsed + .nav-group.collapsed { margin-top: 0; }

.sidebar-top { gap: 4px; }
.sidebar-top .arsx-logo-wrap { flex: 1 1 auto; min-width: 0; }
.rail-toggle { flex: 0 0 auto; width: 30px; height: 30px; color: var(--nav-muted); }
.rail-toggle .ico { width: 18px; height: 18px; transition: transform .18s; }
.sidebar { overflow: hidden; }
.nav { overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; align-content: start; }

/* Режим «рельс»: меню — только иконки, подсказка при наведении. */
@media (min-width: 901px) {
  .shell.nav-rail, .shell.nav-rail.compact-sidebar { grid-template-columns: 68px minmax(0, 1fr); }
  .shell.nav-rail .sidebar { padding: 12px 8px 10px; align-items: stretch; }
  .shell.nav-rail .sidebar-top { flex-direction: column; padding: 2px 0 6px; gap: 8px; }
  .shell.nav-rail .sidebar .arsx-logo-wrap { width: 34px; overflow: hidden; flex: 0 0 auto; margin: 0 auto; }
  .shell.nav-rail .sidebar .arsx-logo-wrap img { width: 150px; max-width: none; }
  .shell.nav-rail .rail-toggle { margin: 0 auto; }
  .shell.nav-rail .rail-toggle .ico { transform: scaleX(-1); }
  .shell.nav-rail .cmdk-trigger { justify-content: center; padding: 0; width: 44px; margin: 2px auto 6px; }
  .shell.nav-rail .cmdk-trigger span, .shell.nav-rail .cmdk-trigger kbd { display: none; }
  .shell.nav-rail .sidebar-context { display: none; }
  .shell.nav-rail .nav { padding: 0; align-items: center; scrollbar-gutter: auto; scrollbar-width: none; }
  .shell.nav-rail .nav-group, .shell.nav-rail .nav-group.collapsed { flex-direction: column; align-items: center; width: 100%; padding-top: 6px; margin-top: 6px; border-top: 1px solid var(--nav-line); }
  .shell.nav-rail .nav-group:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
  .shell.nav-rail .nav-group-head { display: none !important; }
  .shell.nav-rail .nav-group.collapsed .nav-group-items { display: grid; }
  .shell.nav-rail .nav-group-items { width: 100%; justify-items: center; }
  .shell.nav-rail .nav button.nav-item { width: 44px; height: 40px; min-height: 40px; padding: 0; justify-content: center; }
  .shell.nav-rail .nav button.nav-item span { display: none; }
  .shell.nav-rail .nav button.nav-item .ico { width: 20px; height: 20px; flex-basis: 20px; }
  .shell.nav-rail .nav button.nav-item.active::before { left: -8px; }
  .shell.nav-rail .sidebar-footer { padding: 8px 0 0; }
  .shell.nav-rail .user-chip { flex-direction: column; gap: 4px; padding: 4px 0; }
  .shell.nav-rail .user-meta, .shell.nav-rail .sidebar-version { display: none; }
  /* всплывающая подпись у иконки */
  .shell.nav-rail .nav button.nav-item:hover::after {
    content: attr(title); position: fixed; left: 70px; margin-top: 0; transform: translateY(0);
    padding: 5px 9px; border-radius: 8px; background: var(--text); color: var(--surface); font-size: 12.5px; font-weight: 600; white-space: nowrap;
    box-shadow: var(--shadow); pointer-events: none; z-index: 90;
  }
}

/* ----------------------------------------------------------------- шапка */
.create-trigger { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 7px 14px 7px 11px; }
.create-trigger .ico { width: 17px; height: 17px; stroke-width: 2.2; }
.create-menu {
  position: fixed; z-index: 80; width: 280px; padding: 6px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); box-shadow: var(--shadow); animation: arsxPop .12s ease-out;
}
.create-menu button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border: 0; border-radius: 10px; background: transparent; color: var(--text); text-align: left; }
.create-menu button .ico { width: 34px; height: 34px; padding: 8px; border-radius: 10px; background: var(--accent-soft); color: var(--brand); flex: 0 0 34px; }
.create-menu button span { display: grid; line-height: 1.3; }
.create-menu button b { font-size: 13.5px; font-weight: 620; }
.create-menu button small { font-size: 12px; color: var(--muted); }
.create-menu button:hover, .create-menu button:focus-visible { background: var(--surface-2); outline: none; }

@media (max-width: 1280px) {
  .topbar .theme-toggle .theme-toggle-label { display: none; }
  .topbar .theme-toggle { width: 36px; padding: 0; justify-content: center; }
  .company-identity { max-width: 34vw; }
}
@media (max-width: 1100px) {
  .topbar .organization-switcher select { max-width: 180px; }
  .company-identity-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-width: 700px) {
  .create-trigger { width: 36px; padding: 0; justify-content: center; }
  .create-trigger .create-label { display: none; }
}

/* ---------------------------------------------------- общие элементы 2.3 */
.screen-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.segmented button { display: inline-flex; align-items: center; gap: 6px; }
.segmented button .ico { width: 15px; height: 15px; }
.segmented.small button { padding: 5px 10px; font-size: 12.5px; }
.count-pill { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.list-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 4px 0 12px; }
.search-input { display: flex; align-items: center; gap: 8px; min-width: 220px; flex: 0 1 300px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--input-bg); }
.search-input .ico { width: 16px; height: 16px; color: var(--muted); }
.search-input input { border: 0 !important; box-shadow: none !important; padding: 0; min-height: 34px; background: transparent; width: 100%; }
.search-input:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent); }
.danger-text { color: var(--danger) !important; }
.btn.ghost.danger-text:hover { background: color-mix(in srgb, var(--danger) 8%, transparent); }
.chip-soft { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 7px; background: var(--surface-2); color: var(--text-2); font-size: 12px; }
.chip-soft .ico { width: 13px; height: 13px; }
.badge { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.badge .ico { width: 12px; height: 12px; }
tr.clickable { cursor: pointer; }
td.cell-main b { display: block; }
td.cell-main small { display: block; color: var(--muted); font-size: 12px; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.row-tools { width: 1%; white-space: nowrap; text-align: right; }
.table-foot { padding: 10px 12px; font-size: 12.5px; border-top: 1px solid var(--line); }
.icon-btn.tiny { width: 26px; height: 26px; border-radius: 7px; }
.icon-btn.tiny .ico { width: 15px; height: 15px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted) 35%, transparent); border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--muted) 55%, transparent); }
::-webkit-scrollbar-track { background: transparent; }

.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi-tile { display: grid; gap: 2px; text-align: left; padding: 14px 16px; border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s, transform .15s; }
.kpi-tile:not(:disabled) { cursor: pointer; }
.kpi-tile:not(:disabled):hover { border-color: var(--accent-line); box-shadow: var(--shadow); transform: translateY(-1px); }
.kpi-tile span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.kpi-tile b { font-size: 22px; font-weight: 720; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi-tile small { font-size: 12px; color: var(--muted); }
.kpi-tile.danger b { color: var(--danger); }
.kpi-tile.success b { color: var(--success); }
.kpi-tile.warning b { color: var(--warning); }
.kpi-tile:disabled { opacity: 1; }

/* ---------------------------------------------------- модальные окна React */
.next-modal-backdrop { position: fixed; inset: 0; z-index: 72; display: grid; place-items: center; padding: 20px; background: rgba(10, 12, 16, .42); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: arsxFade .14s ease-out; }
.next-modal { width: min(560px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); animation: arsxPop .16s cubic-bezier(.2, .9, .3, 1.2); }
.next-modal.size-sm { width: min(440px, 100%); }
.next-modal.size-lg { width: min(1080px, 100%); }
.next-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 12px; border-bottom: 1px solid var(--line); }
.next-modal-head h2 { margin: 0; font-size: 18px; }
.next-modal-sub { margin-top: 6px; font-size: 13px; }
.next-modal-body { padding: 16px 20px; overflow-y: auto; min-height: 0; }
.next-modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 18px 18px; }
.next-modal-foot .foot-left { margin-right: auto; display: flex; gap: 6px; }
.next-modal .field { display: grid; gap: 5px; }
.next-modal .field-label { font-size: 12.5px; font-weight: 600; color: var(--field-label); }
.next-modal textarea { resize: vertical; width: 100%; }
.next-modal input, .next-modal select { width: 100%; }
.form-row.cols-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.form-row.cols-3 .span-2 { grid-column: span 2; }
@media (max-width: 700px) {
  .next-modal-backdrop { padding: 0; align-items: end; }
  .next-modal, .next-modal.size-lg, .next-modal.size-sm { width: 100%; max-height: 94vh; border-radius: 18px 18px 0 0; }
  .form-row.cols-3 { grid-template-columns: 1fr; }
  .form-row.cols-3 .span-2 { grid-column: auto; }
}

/* ------------------------------------------------ выезжающая панель сделки */
.drawer-layer { position: fixed; inset: 0; z-index: 45; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(10, 12, 16, .32); animation: arsxFade .16s ease-out; }
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(1180px, calc(100vw - 120px)); display: flex; flex-direction: column;
  background: var(--bg); border-left: 1px solid var(--line); box-shadow: -24px 0 60px -20px rgba(16, 24, 40, .35);
  animation: drawerIn .22s cubic-bezier(.2, .8, .2, 1);
}
@keyframes drawerIn { from { transform: translateX(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.drawer-tab { position: absolute; left: -44px; top: 18px; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 10px 0 0 10px; background: var(--surface); color: var(--text-2); box-shadow: var(--shadow); }
.drawer-tab:hover { color: var(--text); }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.drawer-kind { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 8px; background: var(--accent-soft); color: var(--brand); font-size: 12px; font-weight: 650; }
.drawer-kind .ico { width: 14px; height: 14px; }
.drawer-head h2 { margin: 0; flex: 1; min-width: 0; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 20px 32px; }
.deal-shell.in-drawer .deal-grid { grid-template-columns: minmax(0, 1fr) 360px; grid-template-areas: "main work" "main info"; align-items: start; }
.deal-shell.in-drawer .deal-main { grid-area: main; }
.deal-shell.in-drawer .side-work { grid-area: work; }
.deal-shell.in-drawer .side-info { grid-area: info; }
@media (max-width: 1180px) {
  .drawer { width: calc(100vw - 60px); }
  .deal-shell.in-drawer .deal-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "work" "main" "info"; }
}

/* счета в карточке сделки */
.deal-invoices .inv-row { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 8px; align-items: center; width: 100%; }
.deal-invoices .inv-row > span { min-width: 0; overflow-wrap: anywhere; }
.deal-invoices .inv-row .badge { justify-self: end; width: auto; }

/* ------------------------------------------------------------ канбан 2.3 */
.board-screen { display: flex; flex-direction: column; min-height: calc(100vh - 140px); }
.board-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.pipeline-pick { display: inline-flex; align-items: center; gap: 8px; padding: 0 4px 0 11px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-sm); }
.pipeline-pick .ico { width: 16px; height: 16px; color: var(--brand); }
.pipeline-pick select { border: 0 !important; box-shadow: none !important; padding: 0 6px 0 0; min-height: 34px; font-weight: 650; background: transparent; max-width: 260px; }
.chip-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-filters button { display: inline-flex; align-items: center; gap: 5px; min-height: 32px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.chip-filters button .ico { width: 14px; height: 14px; }
.chip-filters button:hover { border-color: var(--line-strong); }
.chip-filters button.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--text); }
.chip-filters button.warn .count-pill { background: var(--danger); }
.board-tools { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.board-summary { display: flex; gap: 18px; flex-wrap: wrap; align-items: baseline; padding: 2px 2px 12px; color: var(--muted); font-size: 13px; }
.board-summary b { color: var(--text); font-size: 14px; font-variant-numeric: tabular-nums; margin-right: 3px; }
.board-summary .link-button { margin-left: auto; font-size: 12.5px; }

.board { flex: 1; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(268px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; scroll-snap-type: x proximity; }
.board-col { --stage: var(--brand); display: flex; flex-direction: column; min-height: 220px; max-height: calc(100vh - 230px); border-radius: var(--radius-lg); background: var(--surface-2); border: 1px solid transparent; transition: background-color .12s, border-color .12s; scroll-snap-align: start; }
.board-col-head { position: relative; padding: 12px 12px 10px; border-bottom: 1px solid var(--line); }
.board-col-head::before { content: ""; position: absolute; left: 12px; right: 12px; top: 0; height: 3px; border-radius: 0 0 3px 3px; background: var(--stage); }
.board-col-title { display: flex; align-items: center; gap: 6px; }
.board-col-title b { font-size: 13px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-col-title .count { margin-left: auto; padding: 0 7px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 11.5px; font-weight: 650; color: var(--text-2); line-height: 18px; }
.board-col-sum { margin-top: 3px; font-size: 15px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.board-col-sum small { margin-left: 6px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.board-col-body { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.board-col.drop { background: color-mix(in srgb, var(--stage) 9%, var(--surface-2)); border-color: color-mix(in srgb, var(--stage) 45%, transparent); }
.board-col.st-won .board-col-body, .board-col.st-lost .board-col-body { opacity: .85; }
.board-empty { padding: 18px 8px; text-align: center; color: var(--muted); font-size: 12.5px; border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.board-add { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.board-add:hover { color: var(--brand); border-color: var(--accent-line); background: var(--accent-softer); }
.board-add .ico { width: 15px; height: 15px; }
.quick-deal { display: grid; gap: 6px; padding: 8px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--accent-line); box-shadow: var(--shadow-sm); }
.quick-deal input { min-height: 32px; padding: 5px 9px; font-size: 13px; }
.quick-deal-actions { display: flex; gap: 6px; }

.deal-tile { position: relative; display: grid; gap: 5px; padding: 11px 12px 10px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); cursor: pointer; transition: border-color .12s, box-shadow .12s, transform .12s, opacity .12s; }
.deal-tile::before { content: ""; position: absolute; left: -1px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--stage); opacity: .0; transition: opacity .12s; }
.deal-tile:hover { border-color: var(--accent-line); box-shadow: var(--shadow); }
.deal-tile:hover::before, .deal-tile:focus-visible::before { opacity: 1; }
.deal-tile.dragging { opacity: .45; transform: rotate(1.5deg); }
.deal-tile.is-overdue { border-color: color-mix(in srgb, var(--danger) 30%, var(--line)); }
.deal-tile-title { font-size: 13.5px; font-weight: 620; line-height: 1.35; overflow-wrap: anywhere; }
.deal-tile-amount { font-size: 15px; font-weight: 720; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.deal-tile-client { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--text-2); min-width: 0; }
.deal-tile-client .ico { width: 13px; height: 13px; color: var(--muted); }
.deal-tile-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
.tile-flag { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.tile-flag .ico { width: 13px; height: 13px; }
.tile-flag.overdue { color: var(--danger); }
.tile-flag.today { color: var(--warning); }
.tile-flag.soon { color: var(--text-2); }
.tile-flag.none { color: color-mix(in srgb, var(--warning) 80%, var(--muted)); }
.deal-tile .mini-avatar { width: 24px; height: 24px; font-size: 10px; }

.board-dropzones { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 40; display: flex; gap: 12px; animation: arsxPop .14s ease-out; }
.dropzone { display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 220px; min-height: 64px; padding: 0 22px; border-radius: 16px; border: 2px dashed; font-weight: 700; font-size: 14px; background: var(--surface); box-shadow: var(--shadow); }
.dropzone .ico { width: 22px; height: 22px; }
.dropzone.won { color: var(--success); border-color: color-mix(in srgb, var(--success) 55%, transparent); }
.dropzone.lost { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 55%, transparent); }
.dropzone.won.drop { background: color-mix(in srgb, var(--success) 14%, var(--surface)); border-style: solid; }
.dropzone.lost.drop { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); border-style: solid; }
@media (max-width: 900px) {
  .board { grid-auto-columns: 84vw; }
  .board-tools { margin-left: 0; }
  .board-col { max-height: none; }
  .search-input { flex: 1 1 100%; }
}

/* ------------------------------------------------------- счета и оплаты */
.inv-setup { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.inv-setup .ico { color: var(--warning); flex: 0 0 auto; }
.inv-setup span { flex: 1; }
.inv-table { overflow-x: auto; }
.inv-table table { min-width: 760px; }
.inv-table td { vertical-align: middle; }
.inv-sub { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inv-editor { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.inv-editor:not(:has(.inv-side)) { grid-template-columns: minmax(0, 1fr); }
.inv-main { display: grid; gap: 14px; min-width: 0; }
.inv-payer { border: 1px solid var(--line); border-radius: var(--radius); padding: 0 12px; background: var(--surface); }
.inv-payer summary { display: flex; gap: 10px; align-items: baseline; padding: 10px 0; cursor: pointer; list-style: none; }
.inv-payer summary::-webkit-details-marker { display: none; }
.inv-payer summary > span:first-child { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.inv-payer[open] summary { border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.inv-payer .form-row { padding-bottom: 12px; }
.inv-items { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.inv-items-head, .inv-item { display: grid; grid-template-columns: minmax(0, 1fr) 76px 86px 110px 120px 30px; gap: 8px; align-items: center; padding: 6px 10px; }
.inv-items-head { background: var(--table-head); font-size: 11.5px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); }
.inv-item { border-bottom: 1px solid var(--line); }
.inv-item input, .inv-item select { min-height: 34px; padding: 5px 8px; font-size: 13px; }
.inv-item.readonly { min-height: 40px; font-size: 13px; }
.inv-item.readonly .inv-name { white-space: normal; overflow-wrap: anywhere; }
.inv-item .num, .inv-items-head .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.inv-items .add-row { margin: 6px 8px 8px; }
.inv-bottom { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; align-items: start; }
.inv-vat { display: grid; grid-template-columns: 1fr 110px; gap: 10px; }
.inv-vat .inv-comment { grid-column: 1 / -1; }
.inv-vat:not(:has(.field:nth-child(3))) { grid-template-columns: 1fr; }
.inv-totals { display: grid; gap: 6px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); }
.inv-totals div { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--text-2); }
.inv-totals b { font-variant-numeric: tabular-nums; color: var(--text); }
.inv-totals .grand { padding-top: 8px; margin-top: 2px; border-top: 1px solid var(--line-strong); font-size: 15px; }
.inv-totals .grand b { font-size: 18px; font-weight: 750; }
.inv-side { display: grid; gap: 14px; }
.inv-qr { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 12px; align-items: start; padding: 12px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.inv-qr img, .inv-qr-empty { width: 112px; height: 112px; border-radius: 10px; background: #fff; border: 1px solid var(--line); }
.inv-qr-empty { display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.inv-qr-empty .ico { width: 36px; height: 36px; }
.inv-qr b { display: block; font-size: 13.5px; margin-bottom: 4px; }
.inv-qr span { display: block; font-size: 12px; color: var(--muted); line-height: 1.45; }
.inv-pay { display: grid; gap: 8px; padding: 12px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.inv-pay-head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.inv-pay-head span { color: var(--muted); font-variant-numeric: tabular-nums; }
.inv-progress { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.inv-progress span { display: block; height: 100%; border-radius: 6px; background: var(--success); transition: width .3s; }
.inv-pay-row { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto 26px; gap: 8px; align-items: center; font-size: 13px; }
.inv-pay-row .ico { width: 16px; height: 16px; color: var(--muted); }
.inv-pay-row small { display: block; font-size: 11.5px; color: var(--muted); }
.inv-pay-form { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding-top: 6px; border-top: 1px dashed var(--line); }
.inv-pay-form input { min-height: 32px; padding: 4px 8px; font-size: 13px; }
.inv-pay-form .btn { grid-column: 1 / -1; }
@media (max-width: 960px) {
  .inv-editor, .inv-bottom { grid-template-columns: minmax(0, 1fr); }
  .inv-items-head { display: none; }
  .inv-item { grid-template-columns: 1fr 1fr 1fr; }
  .inv-item input:first-child { grid-column: 1 / -1; }
}

.bank-upload { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; margin-bottom: 14px; }
.bank-upload-text b { display: block; font-size: 14.5px; margin-bottom: 3px; }
.bank-upload-text span { font-size: 13px; color: var(--muted); line-height: 1.5; }
.bank-stats { grid-column: 1 / -1; display: flex; gap: 14px; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px; color: var(--text-2); }
.bank-stats b { font-size: 15px; margin-right: 2px; }
.bank-stats .ok b { color: var(--success); }
.bank-stats .warn b { color: var(--warning); }
.tx-list { display: grid; gap: 8px; }
.tx-row { display: grid; grid-template-columns: 170px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.tx-row.has-suggest { border-color: var(--accent-line); background: linear-gradient(90deg, var(--accent-softer), var(--surface) 40%); }
.tx-row.st-ignored { opacity: .7; }
.tx-amount b { display: block; font-size: 16px; font-weight: 720; color: var(--success); font-variant-numeric: tabular-nums; }
.tx-amount small { font-size: 12px; color: var(--muted); }
.tx-main { min-width: 0; font-size: 13px; }
.tx-main p { margin: 3px 0 0; color: var(--text-2); font-size: 12.5px; line-height: 1.45; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tx-note { display: block; margin-top: 4px; font-size: 11.5px; color: var(--muted); }
.tx-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; max-width: 420px; }
.tx-pick { display: flex; gap: 6px; }
.tx-pick select { min-height: 30px; padding: 3px 8px; font-size: 12.5px; max-width: 240px; }
@media (max-width: 900px) {
  .tx-row, .bank-upload { grid-template-columns: minmax(0, 1fr); }
  .tx-actions { justify-content: flex-start; max-width: none; }
}

.billing-settings { display: grid; gap: 14px; max-width: 820px; }
.billing-org { display: flex; gap: 22px; align-items: flex-end; flex-wrap: wrap; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.billing-org small { display: block; font-size: 12px; color: var(--muted); }
.billing-org b { font-size: 14px; }
.billing-settings .field { display: grid; gap: 5px; }
.billing-settings .field-label { font-size: 12.5px; font-weight: 600; color: var(--field-label); }
.switch-row { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; }
.switch-row input { margin-top: 3px; width: 16px; height: 16px; }
.switch-row b { display: block; font-size: 13.5px; }
.switch-row small { display: block; font-size: 12.5px; color: var(--muted); }

/* 2.4: ссылка на регистрацию на странице входа */
.signup-link { margin-top: 14px; text-align: center; font-size: 13.5px; color: var(--muted); }
.signup-link a { color: var(--brand); font-weight: 600; }
