/* ─────────────────────────────────────────────
   Cortexia — «Студия» (светлая тема)
   off-white бумага + чернильный текст + индиго-акцент
   Сигнатура: тонкая индиго-«нить» на активных элементах,
   крупные табличные цифры (леджер), линейные SVG-иконки.
   ───────────────────────────────────────────── */

:root {
  --paper:     #f6f5f2;   /* фон приложения */
  --surface:   #ffffff;   /* карточки, панели */
  --surface-2: #f0eee9;   /* лёгкая заливка, hover */
  --ink:       #1a1a1a;   /* основной текст */
  --ink-2:     #5a5852;   /* вторичный */
  --ink-3:     #908d85;   /* приглушённый, подписи */
  --line:      #e6e3dc;   /* волосяные линии */
  --line-2:    #d9d5cb;
  --indigo:    #3b3fb5;   /* акцент (краситель индиго) */
  --indigo-600:#33368f;
  --indigo-tint:#ecedf9;  /* фон-подложка акцента */
  --profit:    #2f7d52;   /* прибыль */
  --loss:      #c2553f;   /* убыток (марена) */
  --radius:    14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(20,18,14,.05), 0 1px 3px rgba(20,18,14,.05);
  --shadow-md: 0 6px 22px rgba(20,18,14,.10);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--paper); color: var(--ink);
  height: 100vh; display: flex; overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.icon { width: 18px; height: 18px; flex-shrink: 0; }

/* ─── SIDEBAR (главная навигация) ─── */
.sidebar {
  width: 232px; background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; flex-shrink: 0;
}
.sidebar-header { padding: 22px 22px 18px; }
.sidebar-header .logo {
  font-size: 22px; font-weight: 800; letter-spacing: -.03em; color: var(--ink);
}
.sidebar-header .logo span { color: var(--indigo); }
.sidebar-header .sub {
  font-size: 10px; font-weight: 600; letter-spacing: .18em;
  text-transform: uppercase; color: var(--ink-3); margin-top: 4px;
}
/* min-height:0 + overflow-y:auto — длинный список владельца скроллится, а не срезает нижние
   пункты (Корзина уезжала за край после добавления «Откат»). */
.sidebar-nav { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: var(--radius-sm); cursor: pointer;
  color: var(--ink-2); font-size: 13.5px; font-weight: 500;
  text-decoration: none; position: relative; transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--indigo-tint); color: var(--indigo-600); font-weight: 600; }
/* сигнатура: индиго-нить слева у активного пункта */
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 3px; border-radius: 3px; background: var(--indigo);
}
.sidebar-footer {
  padding: 14px 22px; border-top: 1px solid var(--line);
  font-size: 11px; color: var(--ink-3); display: flex; align-items: center; gap: 7px;
}
.status-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--profit);
  display: inline-block; box-shadow: 0 0 0 3px rgba(47,125,82,.15);
}

/* ─── MAIN ─── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 18px 32px; background: transparent;
}
.topbar h2 { font-size: 19px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); }
.topbar .date { font-size: 12.5px; color: var(--ink-3); text-transform: capitalize; }
.content { flex: 1; overflow-y: auto; padding: 8px 32px 32px; }

/* ─── KPI WIDGETS ─── */
.widgets {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px; margin-bottom: 32px;
}
.widget {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px 20px;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
  transition: box-shadow .15s, transform .15s;
}
.widget:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
/* первый виджет (выручка) — акцентная нить сверху */
.widget:first-child::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 3px; background: var(--indigo);
}
.widget .label {
  font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 12px;
}
.widget .value {
  font-size: 30px; font-weight: 700; letter-spacing: -.03em; color: var(--ink);
  font-variant-numeric: tabular-nums; line-height: 1;
}
.widget .value.profit { color: var(--profit); }
.widget .value.loss { color: var(--loss); }

/* ─── SECTION ─── */
.section { margin-bottom: 28px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-header h3 {
  font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-3);
}
.card-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow-sm); position: relative;
  transition: box-shadow .15s, transform .15s, border-color .15s;
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); border-color: var(--line-2); }
/* сигнатура: левая «нить» появляется на наведении */
.card::before {
  content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px;
  border-radius: 3px; background: var(--indigo); opacity: 0; transition: opacity .15s;
}
.card:hover::before { opacity: 1; }
.card .title { font-size: 15px; font-weight: 650; color: var(--ink); margin-bottom: 5px; letter-spacing: -.01em; }
.card .sub { font-size: 12.5px; color: var(--ink-3); }
.card .dash-store-rev { font-size: 20px; font-weight: 700; color: var(--ink); letter-spacing: -.02em; margin-bottom: 3px; }

/* ─── CHAT LAYOUT (сайдбар чатов + чат) ─── */
.content:has(.chat-layout) { padding: 0; overflow: hidden; }
.chat-layout { display: flex; height: 100%; width: 100%; }

.chat-sidebar {
  width: 264px; background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; flex-shrink: 0;
  transition: width .2s, opacity .2s; overflow: hidden;
}
.chat-sidebar.hidden { width: 0; border: none; opacity: 0; }
.chat-sidebar .sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--line);
}
.sidebar-logo {
  font-size: 14px; font-weight: 700; color: var(--ink);
  display: flex; align-items: center; gap: 8px;
}
.sidebar-logo .icon { color: var(--indigo); }
.sidebar-new-btn {
  width: 32px; height: 32px; border-radius: var(--radius-sm); border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink-2); cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: .15s;
}
.sidebar-new-btn:hover { border-color: var(--indigo); color: var(--indigo); background: var(--indigo-tint); }
.sidebar-search { padding: 10px 14px; }
.sidebar-search input {
  width: 100%; background: var(--surface-2); border: 1px solid transparent;
  border-radius: var(--radius-sm); padding: 9px 12px; color: var(--ink);
  font-size: 12.5px; font-family: inherit; outline: none; transition: .15s;
}
.sidebar-search input::placeholder { color: var(--ink-3); }
.sidebar-search input:focus { border-color: var(--indigo); background: var(--surface); }
.sidebar-list { flex: 1; overflow-y: auto; padding: 4px 10px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-empty { padding: 24px; text-align: center; color: var(--ink-3); font-size: 12.5px; }
.chat-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 11px; border-radius: var(--radius-sm); cursor: pointer; transition: .12s;
  font-size: 13px; color: var(--ink-2); position: relative;
}
.chat-item:hover { background: var(--surface-2); color: var(--ink); }
.chat-item.active { background: var(--indigo-tint); color: var(--indigo-600); font-weight: 550; }
.chat-item-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; padding-right: 4px; }
.chat-item .delete-btn {
  width: 22px; height: 22px; border-radius: 6px; border: none;
  background: transparent; color: transparent; cursor: pointer;
  font-size: 13px; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: .12s;
}
.chat-item:hover .delete-btn { color: var(--ink-3); }
.chat-item .delete-btn:hover { color: var(--loss); background: rgba(194,85,63,.1); }

/* ─── CHAT MAIN ─── */
.chat-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; background: var(--paper); }
.chat-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--surface);
  flex-shrink: 0;
}
.sidebar-toggle {
  background: none; border: none; color: var(--ink-3); cursor: pointer;
  padding: 4px; display: flex; align-items: center; border-radius: 6px; transition: .12s;
}
.sidebar-toggle:hover { color: var(--ink); background: var(--surface-2); }
.chat-title { font-size: 14.5px; font-weight: 650; color: var(--ink); letter-spacing: -.01em; }
.chat-rename-btn {
  background: transparent; border: none; color: var(--ink-3); cursor: pointer;
  padding: 4px; display: flex; align-items: center; border-radius: 6px; transition: .12s;
}
.chat-rename-btn:hover { color: var(--ink); background: var(--surface-2); }
.chat-model-select {
  margin-left: auto; font-size: 12.5px; color: var(--ink-2); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 5px 8px;
  cursor: pointer; max-width: 220px;
}
.chat-model-select:focus { border-color: var(--indigo); outline: none; }
.chat-item .rename-btn {
  width: 22px; height: 22px; border-radius: 6px; border: none;
  background: transparent; color: transparent; cursor: pointer;
  font-size: 12px; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: .12s;
}
.chat-item:hover .rename-btn { color: var(--ink-3); }
.chat-item .rename-btn:hover { color: var(--indigo-600); background: var(--indigo-tint); }

/* ─── MESSAGES ─── */
.chat-messages { flex: 1; overflow-y: auto; padding: 24px 24px 8px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 72%; padding: 11px 15px; border-radius: 16px; font-size: 14px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.msg.user { align-self: flex-end; background: var(--indigo); color: #fff; border-bottom-right-radius: 5px; }
.msg.assistant { align-self: flex-start; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-bottom-left-radius: 5px; box-shadow: var(--shadow-sm); }
.msg.error { align-self: center; background: rgba(194,85,63,.1); color: var(--loss); font-size: 12.5px; }
.msg .timestamp { font-size: 10px; opacity: .55; margin-top: 5px; }
.msg-link { color: var(--indigo); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.msg.assistant .msg-link:hover { color: var(--indigo-600); }
.msg.user .msg-link { color: #fff; }

/* Таблицы от агента (минусы и т.п.) */
.msg.assistant:has(.msg-table-wrap) { max-width: 92%; }
.msg-table-wrap { margin: 8px 0 4px; overflow-x: auto; }
.msg-table { border-collapse: collapse; font-size: 13px; background: #fff; }
.msg-table th, .msg-table td { border: 1px solid var(--line, #d0d7de); padding: 5px 10px; text-align: left; white-space: nowrap; }
.msg-table th { background: var(--surface-2, #f3f5f8); font-weight: 600; }
.msg-table tbody tr:last-child td { font-weight: 600; background: var(--surface-2, #fafbfc); }
.msg-table-tools { display: flex; gap: 8px; margin-top: 6px; }
.msg-table-tools button { font-size: 12px; padding: 4px 11px; border: 1px solid var(--line, #d0d7de); border-radius: 7px; background: #fff; cursor: pointer; color: var(--ink, #222); }
.msg-table-tools button:hover { background: var(--surface-2, #f3f5f8); }

.msg-welcome { align-self: center; text-align: center; margin: auto; padding: 40px 20px; color: var(--ink-3); }
.welcome-icon { color: var(--line-2); margin-bottom: 14px; display: flex; justify-content: center; }
.welcome-icon .icon { width: 44px; height: 44px; }
.welcome-brief { font-size: 15px; font-weight: 600; color: var(--ink); line-height: 1.45; max-width: 460px; margin: 0 auto 10px; letter-spacing: -.01em; }
.welcome-text { font-size: 14px; color: var(--ink-2); }

/* ─── CHAT INPUT ─── */
.chat-input-area {
  display: flex; align-items: flex-end; gap: 10px;
  padding: 14px 20px 18px; border-top: 1px solid var(--line); background: var(--surface);
}
.chat-input-area textarea {
  flex: 1; background: var(--surface-2); border: 1px solid transparent; border-radius: var(--radius);
  color: var(--ink); padding: 12px 15px; font-size: 14px; font-family: inherit;
  resize: none; outline: none; max-height: 120px; line-height: 1.5; transition: .15s;
}
.chat-input-area textarea::placeholder { color: var(--ink-3); }
.chat-input-area textarea:focus { border-color: var(--indigo); background: var(--surface); }
.chat-input-area button {
  width: 42px; height: 42px; border-radius: var(--radius); border: none;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: .15s; flex-shrink: 0;
}
.btn-send { background: var(--indigo); color: #fff; }
.btn-send:hover { background: var(--indigo-600); }
.btn-mic { background: var(--surface-2); border: 1px solid var(--line-2) !important; color: var(--ink-2); }
.btn-mic:hover { border-color: var(--indigo) !important; color: var(--indigo); }
.btn-mic.recording { background: var(--loss); color: #fff; border-color: var(--loss) !important; animation: pulse 1.1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .55; } }

.mic-wrap { display: flex; align-items: center; position: relative; }
.mic-timer {
  display: none; position: absolute; bottom: -16px; left: 50%; transform: translateX(-50%);
  font-size: 10px; color: var(--loss); font-variant-numeric: tabular-nums;
  white-space: nowrap; font-weight: 600;
}

/* ─── THINKING INDICATOR ─── */
.thinking-indicator {
  display: none; align-items: center; gap: 9px;
  padding: 10px 24px; color: var(--ink-3); font-size: 13.5px;
}
.thinking-dots { display: inline-flex; align-items: center; }
.thinking-dots::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: var(--indigo); display: inline-block; animation: thinkBlink 1.2s infinite;
}
.thinking-text { color: var(--ink-3); }
@keyframes thinkBlink { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 5px; border: 2px solid var(--paper); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }

/* ─── WAREHOUSE (склад) ─── */
.wh-form {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 16px; box-shadow: var(--shadow-sm);
}
.wh-form .form-label { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.wh-form input, .wh-form select {
  flex: 1; min-width: 130px; background: var(--surface-2); border: 1px solid transparent;
  border-radius: var(--radius-sm); padding: 9px 12px; color: var(--ink);
  font-size: 13.5px; font-family: inherit; outline: none; transition: .15s;
}
.wh-form input::placeholder { color: var(--ink-3); }
.wh-form input:focus, .wh-form select:focus { border-color: var(--indigo); background: var(--surface); }
.btn-primary {
  background: var(--indigo); color: #fff; border: none; cursor: pointer;
  padding: 9px 16px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 600;
  font-family: inherit; transition: .15s; white-space: nowrap;
}
.btn-primary:hover { background: var(--indigo-600); }
.btn-ghost {
  background: transparent; color: var(--ink-2); border: 1px solid var(--line-2);
  cursor: pointer; padding: 5px 12px; border-radius: 8px; font-size: 12.5px;
  font-family: inherit; transition: .15s;
}
.btn-ghost:hover { border-color: var(--loss); color: var(--loss); background: rgba(194,85,63,.07); }
.btn-edit { margin-left: 10px; padding: 3px 10px; font-size: 12px; font-weight: 500; vertical-align: middle; }
.btn-edit:hover { border-color: var(--indigo); color: var(--indigo); background: var(--indigo-tint); }
/* B12: dev-кнопка очистки (временно) */
.btn-danger {
  background: var(--loss, #c2553f); color: #fff; border: none; cursor: pointer;
  padding: 9px 16px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 600;
  font-family: inherit; transition: .15s;
}
.btn-danger:hover { filter: brightness(.92); }
.btn-danger:disabled { opacity: .6; cursor: default; }
.dev-tools { border: 1px dashed var(--loss, #c2553f); border-radius: 10px; margin-top: 18px; }

.wh-table {
  width: 100%; border-collapse: collapse; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.wh-table th {
  text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-3); padding: 11px 16px;
  border-bottom: 1px solid var(--line); background: var(--surface-2);
}
/* Липкая шапка для ЛЮБОЙ таблицы внутри скролл-контейнера (единообразно во всех разделах).
   overflow:hidden у .wh-table ломает sticky (шапка липнет к самой таблице и уезжает с ней),
   поэтому таблице внутри скролл-бокса задаём overflow:visible. Фон непрозрачный + тень снизу —
   чтобы строки не просвечивали и граница держалась (border теряется при border-collapse). */
div[style*="overflow:auto"] > table.wh-table {
  overflow: visible;
  border-collapse: separate; border-spacing: 0;   /* collapse + sticky даёт просвет строк над шапкой */
}
div[style*="overflow:auto"] > table.wh-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-2);
  box-shadow: inset 0 -1px 0 var(--line);
}
.wh-table td { padding: 12px 16px; font-size: 14px; border-bottom: 1px solid var(--line); }
.wh-table tr:last-child td { border-bottom: none; }
.wh-table tr:hover td { background: var(--surface-2); }
.wh-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.wh-table .muted { color: var(--ink-3); }
.wh-table .actions { text-align: right; width: 1%; white-space: nowrap; }
.wh-btn-sm {
  font-size: 12.5px; padding: 5px 12px; border: 1px solid var(--line);
  border-radius: 7px; background: var(--surface); color: var(--ink);
  cursor: pointer; transition: .15s;
}
.wh-btn-sm:hover { background: var(--loss, #c2553f); border-color: var(--loss, #c2553f); color: #fff; }
.wh-btn-sm.danger { color: var(--loss, #c2553f); border-color: var(--loss, #c2553f); }
.wh-btn-sm.danger:hover { background: var(--loss, #c2553f); color: #fff; }

/* Единая кнопка «Печать» → всплывающий список форм (общий printMenu, docprint.js).
   Меню живёт на <body>, чтобы не обрезалось таблицами с overflow:auto. */
.pm-menu {
  position: absolute; z-index: 3000; min-width: 280px;
  background: var(--surface, #fff); border: 1px solid var(--line, #d9d9d9);
  border-radius: 10px; box-shadow: 0 8px 26px rgba(0,0,0,.16); padding: 5px;
}
.pm-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  border-radius: 7px; white-space: nowrap;
}
.pm-row:hover { background: rgba(0,0,0,.05); }
.pm-name { flex: 1; font-size: 13px; color: var(--ink); }
.pm-fmt {
  font-size: 12px; padding: 3px 10px; border: 1px solid var(--line, #d9d9d9);
  border-radius: 6px; color: var(--ink); text-decoration: none; background: var(--surface, #fff);
}
.pm-fmt:hover { background: var(--loss, #c2553f); border-color: var(--loss, #c2553f); color: #fff; }
.wh-addprod { flex-wrap: wrap; gap: 8px; align-items: center; }
.wh-addprod select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink); font-size: 14px; }

.wh-store { margin-bottom: 18px; }
.wh-store-name { font-size: 14.5px; font-weight: 650; color: var(--ink); margin-bottom: 8px; }
.wh-store-name .muted { font-weight: 400; color: var(--ink-3); font-size: 13px; }
.wh-empty {
  padding: 20px; text-align: center; color: var(--ink-3); font-size: 13.5px;
  background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--radius);
}
.wh-empty.sm { padding: 12px; font-size: 12.5px; }

.wh-tag {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1.6;
}
.wh-tag.in  { background: rgba(34,139,94,0.12);  color: #1d7a4f; }
.wh-tag.out { background: rgba(193,58,58,0.12);  color: #b23a3a; }

/* ── STAGE J «Пульс»: светофор контроля (строка-ссылка на свой раздел) ── */
.pulse-checks { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.pulse-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 11px 14px; text-decoration: none; color: var(--ink);
  border: 1px solid var(--line); border-left-width: 4px;
  border-radius: var(--radius-sm); background: var(--surface);
  transition: background .12s, box-shadow .12s;
}
.pulse-row:hover { background: var(--surface-2); box-shadow: var(--shadow-sm); }
.pulse-ok   { border-left-color: #2f7d52; }
.pulse-warn { border-left-color: #c98a00; }
.pulse-bad  { border-left-color: #c2553f; }
.pulse-badge {
  font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; white-space: nowrap;
}
.pulse-badge.ok   { background: rgba(47,125,82,0.12);  color: #1d7a4f; }
.pulse-badge.warn { background: rgba(201,138,0,0.14);  color: #9a6a00; }
.pulse-badge.bad  { background: rgba(194,85,63,0.14);  color: #b23a3a; }
.pulse-title  { font-weight: 600; min-width: 200px; }
.pulse-detail { color: var(--ink-3); font-size: 13px; flex: 1; }

/* ── STAGE J «Долги»: две колонки (дебиторка / кредиторка), строка → карточка контрагента ── */
.debt-cols { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 6px; }
.debt-cols .wh-col { flex: 1; min-width: 320px; }
.debt-row { cursor: pointer; transition: background .12s; }
.debt-row:hover { background: var(--surface-2); }

.wh-import-summary {
  padding: 10px 14px; background: var(--surface-2, #f4f4f7); border-radius: 8px;
  font-size: 13.5px;
}
.wh-import-summary .wh-tag { margin: 0 2px; }
.wh-import-warn {
  margin-top: 8px; padding: 9px 14px; border-radius: 8px; font-size: 13px;
  background: rgba(193,58,58,0.08); color: #9c2f2f; border: 1px solid rgba(193,58,58,0.18);
}

/* ─── Финансы: карточки предпросмотра смен + строки смен ─── */
.fin-cards { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.fin-card {
  flex: 1 1 280px; min-width: 260px; padding: 12px 14px;
  border: 1px solid var(--border, #e6e6ec); border-radius: 10px; background: #fff;
}
.fin-card-skip { opacity: 0.6; background: rgba(193,58,58,0.04); }
.fin-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.fin-card-body { display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.fin-shift-row { cursor: pointer; }
.fin-shift-row:hover { background: var(--surface-2, #f4f4f7); }
.fin-toggle { color: var(--muted, #8a8a96); }
.fin-receipts { padding: 8px 0; }
/* Строка «Итого» в сводном нале — отделяем верхней линией и фоном, как в P&L. */
.fin-recon-total td { border-top: 2px solid var(--border, #e3e3ea); background: var(--surface-2, #f7f7fb); }
/* Кликабельные суммы расхода/изъятия + разворот «на что / кому». */
.recon-clk { cursor: pointer; user-select: none; }
.recon-clk:hover { background: var(--surface-2, #f7f7fb); }
.recon-caret { font-size: 11px; color: var(--muted, #8a8a96); }
.recon-detail > td { background: var(--surface-2, #f7f7fb); padding: 8px 12px; }
.recon-ops-sect { margin: 4px 0; }
.recon-ops-h { font-size: 12px; font-weight: 600; color: var(--muted, #8a8a96); margin-bottom: 2px; }
.recon-op { display: flex; gap: 10px; align-items: baseline; font-size: 13px; padding: 2px 0; flex-wrap: wrap; }
.recon-op-amt { font-weight: 600; white-space: nowrap; min-width: 90px; }
.recon-op-when { white-space: nowrap; }
.recon-op-cmt { font-weight: 500; }

/* Переключатель мест в «Остатках» + журнальный фильтр */
.wh-subtabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.wh-subtab {
  padding: 6px 12px; border: 1px solid var(--border, #e3e3ea); border-radius: 999px;
  background: #fff; cursor: pointer; font-size: 13px; color: var(--text, #2a2a33);
}
.wh-subtab:hover { border-color: var(--accent, #4f46e5); }
.wh-subtab.active { background: var(--accent, #4f46e5); color: #fff; border-color: var(--accent, #4f46e5); }
.wh-count { font-size: 12px; opacity: 0.8; margin-left: 4px; }
.wh-place { display: none; }
.wh-place.active { display: block; }
.wh-invplace { display: none; }          /* B9: переключатель точек на инвентаризации */
.wh-invplace.active { display: block; }

/* B5: итоги кассы */
.cash-totals { display: flex; gap: 14px; flex-wrap: wrap; }
.cash-t { padding: 8px 14px; border-radius: 9px; background: var(--line, #eef0f4); font-size: 13px; }
.cash-t.in b { color: var(--profit, #1d7a4f); }
.cash-t.out b { color: var(--loss, #b23a3a); }
.cash-t.saldo { background: rgba(99, 102, 241, .1); }

/* Заголовок блока минусов */
.wh-neg-head {
  margin: 18px 0 8px; font-size: 13px; font-weight: 600; color: #b23a3a;
}

/* Аккордеон магазинов. ВАЖНО: дочерний комбинатор `>` — иначе вложенный аккордеон
   (B8: единица → категория) ломается: внешний .open раскрывал бы и все внутренние тела. */
.wh-acc > .wh-acc-body { display: none; }
.wh-acc.open > .wh-acc-body { display: block; }
.wh-acc-head {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 10px 0; user-select: none;
}
.wh-acc-toggle { display: inline-block; transition: transform 0.15s; color: var(--muted, #8a8a96); }
.wh-acc.open > .wh-acc-head .wh-acc-toggle { transform: rotate(90deg); }
.wh-acc-head .wh-store-name { flex: 1; }
.wh-acc-head .btn-edit { margin-left: auto; }

/* Журнал смен: разворот строки смены с денежным блоком (инкассация, Этап 3) */
.shift-row { cursor: pointer; }
.shift-row:hover { background: var(--surface-2); }
.shift-caret { width: 22px; text-align: center; }
.shift-row.open .wh-acc-toggle { transform: rotate(90deg); }
.shift-detail > td { background: var(--surface-2); padding: 12px 18px; }
.shift-cash { display: flex; flex-wrap: wrap; gap: 32px; }
.shift-cash-box, .shift-cash-ops { min-width: 280px; }
.scb-head { font-weight: 600; font-size: 12px; text-transform: uppercase;
  letter-spacing: .03em; margin-bottom: 6px; color: var(--muted, #8a8a96); }
.scb-row { display: flex; justify-content: space-between; gap: 28px; padding: 3px 0; font-size: 14px; }
.scb-row.total { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 6px; font-weight: 600; }
.scb-op { display: flex; gap: 10px; align-items: baseline; font-size: 13px; padding: 2px 0; }
.scb-op-k { font-size: 11px; padding: 1px 7px; border-radius: 4px;
  background: rgba(193,58,58,0.12); color: #b23a3a; white-space: nowrap; }
.scb-op-k.collection { background: rgba(34,139,94,0.12); color: #1d7a4f; }
.scb-op-amt { font-weight: 600; white-space: nowrap; }

/* B8: вложенный аккордеон категории внутри группы единицы */
.wh-acc-cat { margin-left: 14px; border-left: 2px solid var(--border, #e3e3ea); padding-left: 12px; }
.wh-acc-cat > .wh-acc-head { padding: 7px 0; }
.wh-cat-name { flex: 1; font-weight: 600; font-size: 13px; }

/* B11: вложенный аккордеон СЕМЕЙСТВА (внутри категории) — сворачивает варианты в строку */
.wh-acc-fam { margin-left: 14px; border-left: 2px dashed var(--border, #e3e3ea); padding-left: 12px; }
.wh-acc-fam > .wh-acc-head { padding: 6px 0; }
.wh-fam-name { flex: 1; font-weight: 500; font-size: 12.5px; }
.wh-acc-fam .wh-count { font-size: 11.5px; }

/* G3/G4: пикер товара (папки по единице + поиск) для перемещения и инвентаризации */
.wh-form-move { flex-direction: column; align-items: stretch; }
.wh-picker {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); overflow: hidden;
}
.wh-picker-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
}
.wh-picker-search, .inv-search {
  flex: 1; min-width: 200px; max-width: 420px; padding: 8px 12px; font-size: 13.5px;
  border: 1px solid var(--border, #e3e3ea); border-radius: 9px; background: #fff;
  font-family: inherit; outline: none;
}
.inv-search { margin: 4px 0 12px; }
.wh-picker-search:focus, .inv-search:focus { border-color: var(--indigo); }
.wh-picker-chosen { font-size: 13px; }
.wh-picker-chosen:not(.muted) { color: var(--indigo); font-weight: 600; }
.wh-picker-list { max-height: 340px; overflow-y: auto; padding: 6px 12px; }
.wh-picker-item {
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  padding: 7px 10px; border-radius: 7px; cursor: pointer; font-size: 13.5px;
}
.wh-picker-item:hover { background: var(--surface); }
.wh-picker-item.sel { background: var(--indigo); color: #fff; }
.wh-picker-item.sel .muted { color: rgba(255,255,255,.8); }
.wh-picker-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; }
.wh-picker-actions select, .wh-picker-actions input {
  background: var(--surface-2); border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 9px 12px; color: var(--ink); font-size: 13.5px; font-family: inherit; outline: none;
}
.wh-picker-actions select { flex: 1; min-width: 130px; }
.wh-picker-actions select:focus, .wh-picker-actions input:focus { border-color: var(--indigo); background: var(--surface); }

/* B8: поле поиска по остаткам */
.stock-search { margin: 4px 0 12px; display: flex; align-items: center; gap: 10px; }
.stock-filter {
  flex: 1; max-width: 360px; padding: 8px 12px; font-size: 13px;
  border: 1px solid var(--border, #e3e3ea); border-radius: 9px; background: #fff;
}
.stock-filter:focus { outline: none; border-color: var(--accent, #4f46e5); }
.stock-search-empty { font-size: 12.5px; }

/* C7: фильтры журнала действий */
.audit-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 14px; }
.audit-fld {
  padding: 7px 10px; font-size: 13px; border: 1px solid var(--border, #e3e3ea);
  border-radius: 8px; background: #fff;
}
.audit-fld:focus { outline: none; border-color: var(--accent, #4f46e5); }
.audit-date { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted, #8a8a96); }

/* C8: конструктор документов / реквизиты */
.doc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 8px 0 14px; }
.doc-grid.doc-set { grid-template-columns: repeat(3, 1fr); }
.doc-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted, #8a8a96); }
.doc-grid label.doc-wide { grid-column: span 2; }
.doc-grid input, .doc-grid select {
  padding: 8px 10px; font-size: 13px; color: var(--text, #1c1c22);
  border: 1px solid var(--border, #e3e3ea); border-radius: 8px; background: #fff;
}
.doc-grid input:focus, .doc-grid select:focus { outline: none; border-color: var(--accent, #4f46e5); }
.doc-qr { flex-direction: row !important; align-items: center; gap: 7px !important; align-self: end; padding-bottom: 8px; }
.doc-lines input { width: 100%; padding: 6px 8px; font-size: 13px; border: 1px solid var(--border, #e3e3ea); border-radius: 7px; }
.doc-lines input:focus { outline: none; border-color: var(--accent, #4f46e5); }
.doc-lines td.num, .doc-lines th.num { text-align: right; }
.doc-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.doc-warn { background: #fff5e6; border: 1px solid #f0c987; color: #8a5a00; padding: 10px 12px;
  border-radius: 9px; font-size: 13px; margin-bottom: 12px; }

/* Журнал по дням */
.wh-day { margin-bottom: 18px; }
.wh-day-head {
  font-size: 12.5px; font-weight: 600; color: var(--muted, #8a8a96);
  padding: 4px 0; border-bottom: 1px solid var(--border, #e3e3ea); margin-bottom: 6px;
}
/* STAGE I: единый журнал одной таблицей — день = строка-разделитель. Отступ сверху
   отделяет группы дней; первый день без большого отступа; сама строка без hover-подсветки. */
.wh-journal .wh-day-row td.wh-day-head { padding: 14px 0 4px; }
.wh-journal tbody tr.wh-day-row:first-child td.wh-day-head { padding-top: 2px; }
.wh-journal .wh-day-row:hover { background: transparent; }
.wh-jfilter {
  padding: 6px 11px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font-family: inherit; font-size: 13px;
  outline: none; transition: .15s;
}
.wh-jfilter:focus { border-color: var(--indigo); }

/* ─── Единый период-контрол (День/Неделя/Месяц + дата) — везде одинаково ─── */
.period { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.period-seg {
  display: inline-flex; border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); overflow: hidden;
}
.period-btn {
  padding: 6px 13px; background: var(--surface); border: none; cursor: pointer;
  font-family: inherit; font-size: 13px; color: var(--ink-2);
  border-right: 1px solid var(--line); transition: .12s;
}
.period-btn:last-child { border-right: none; }
.period-btn:hover { background: var(--surface-2); }
.period-btn.active { background: var(--indigo); color: #fff; }
.period-date, .period-date-to {
  padding: 6px 11px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font-family: inherit; font-size: 13px;
  outline: none; transition: .15s;
}
.period-date:focus, .period-date-to:focus { border-color: var(--indigo); }
.period-dash { color: var(--ink-3); margin: 0 -2px; }

/* Экономический вид остатков: inline-правка цен закупки/продажи */
.wh-econ input.price-edit {
  width: 86px; padding: 4px 8px; text-align: right;
  border: 1px solid var(--line-2); border-radius: 7px;
  background: var(--surface); color: var(--ink);
  font-family: inherit; font-size: 12.5px; outline: none; transition: .15s;
}
.wh-econ input.price-edit:focus { border-color: var(--indigo); }
.wh-econ input.price-edit.saved { border-color: var(--profit); background: #eef7f0; }

/* Правка категории и единицы прямо в остатках (выписка из чужой системы приходит
   без категории и с ошибочной единицей — чиним на месте, без похода в карточку) */
.wh-econ select.cat-edit, .wh-econ select.unit-edit {
  padding: 3px 6px; border: 1px solid var(--line-2); border-radius: 7px;
  background: var(--surface); color: var(--ink);
  font-family: inherit; font-size: 12.5px; outline: none; transition: .15s;
}
.wh-econ select.cat-edit { max-width: 150px; }
.wh-econ select.unit-edit { margin-left: 4px; }
.wh-econ select.cat-edit:focus, .wh-econ select.unit-edit:focus { border-color: var(--indigo); }

/* Галочки выбора позиций + панель действий (цена/закупка/группа/единица — только отмеченным) */
.wh-table th.cbx, .wh-table td.cbx { width: 28px; text-align: center; padding-left: 6px; padding-right: 0; }
/* галочка в шапке аккордеона — отметить всю группу/семью, не раскрывая её */
.wh-acc-head input.pick-acc { margin: 0 2px 0 0; cursor: pointer; }
/* перемещение: сколько двигать (по умолчанию весь остаток) */
.wh-movepick input.mv-qty { width: 110px; padding: 4px 8px; border: 1px solid var(--line-2);
  border-radius: 7px; background: var(--surface); color: var(--ink); font-family: inherit;
  font-size: 12.5px; text-align: right; }
.wh-pickbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 0 0 12px; padding: 10px 14px;
  border: 1px solid var(--indigo); border-radius: 12px;
  background: var(--surface); box-shadow: 0 8px 18px rgba(0, 0, 0, .12);
}
.wh-pickbar input[type="number"] { width: 130px; }
.wh-pickbar input[type="number"], .wh-pickbar input[list],
.wh-pickbar select { padding: 5px 8px; border: 1px solid var(--line-2); border-radius: 7px;
  background: var(--surface); color: var(--ink); font-family: inherit; font-size: 12.5px; }
.wh-pick-count { margin-right: 4px; font-size: 13px; }
/* Строка, которой поменяли категорию/единицу прямо в таблице: она переедет в другую группу,
   но раскладку не перестраиваем на лету — иначе строка исчезает из-под курсора. */
.wh-econ tr.row-pending > td { background: rgba(99, 102, 241, .10); }
.wh-econ tr.row-pending > td:first-child { box-shadow: inset 3px 0 0 var(--indigo); }
.wh-acc-uncat > .wh-acc-head { background: #fdf6e6; }

/* Плашка «проверьте единицу»: ошибка приёмщика в исходной системе */
.wh-warn {
  margin: 12px 0 16px; padding: 12px 14px;
  border: 1px solid #f0c36d; border-radius: 10px; background: #fdf6e6;
}
.wh-warn-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.wh-warn .wh-table { margin-bottom: 8px; }
.wh-warn .wh-btn-sm { margin-right: 6px; }

/* Две колонки внутри группы: в наличии | в минусе */
.wh-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.wh-col { min-width: 0; }
.wh-col-head { font-size: 12.5px; font-weight: 600; margin-bottom: 6px; color: var(--muted, #8a8a96); }
.wh-col-head.pnl-minus { color: #b23a3a; }
@media (max-width: 900px) { .wh-cols { grid-template-columns: 1fr; } }

/* Журнал: панель фильтров */
.wh-journal-bar { flex-wrap: wrap; gap: 10px; }
.dash-bar { flex-wrap: wrap; gap: 10px; }
.wh-journal-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-left: auto; }

.pnl-plus  { color: #1d7a4f; }
.pnl-minus { color: #b23a3a; }

/* ─── C3: Графики дашборда (чистый CSS, без библиотек) ─── */
/* Столбчатый график динамики выручки по дням */
.chart-bars {
  display: flex; align-items: flex-end; gap: 8px;
  height: 200px; padding: 8px 4px 0; overflow-x: auto;
}
.chart-col {
  flex: 1 1 0; min-width: 34px; max-width: 90px;
  display: flex; flex-direction: column; align-items: center;
  height: 100%; justify-content: flex-end; cursor: default;
}
.chart-val { font-size: 11px; font-weight: 600; color: var(--ink-3, #8a8a96); margin-bottom: 3px; white-space: nowrap; }
.chart-bar {
  width: 100%; min-height: 2px;
  background: linear-gradient(180deg, #6366f1, #4f46e5);
  border-radius: 5px 5px 0 0; transition: filter .15s;
}
.chart-col:hover .chart-bar { filter: brightness(1.12); }
.chart-x { font-size: 11px; color: var(--ink-3, #8a8a96); margin-top: 5px; white-space: nowrap; }

/* Полоса-сплит наличные/безнал */
.split-bar {
  display: flex; height: 30px; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--border, #e6e6ec);
}
.split-seg {
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12.5px; font-weight: 600; min-width: 0;
}
.split-cash     { background: #1d7a4f; }
.split-cashless { background: #4f46e5; }
.split-legend { display: flex; gap: 18px; margin-top: 8px; flex-wrap: wrap; font-size: 13px; color: var(--ink-3, #8a8a96); }
.split-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }
.dot-cash     { background: #1d7a4f; }
.dot-cashless { background: #4f46e5; }

/* Горизонтальные полосы сравнения магазинов */
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar-row {
  display: grid; grid-template-columns: minmax(120px, 1fr) 2fr auto;
  align-items: center; gap: 12px; cursor: pointer; padding: 4px 6px;
  border-radius: 8px; transition: background .12s;
}
.hbar-row:hover { background: var(--surface-2, #f6f6fa); }
.hbar-name { font-weight: 600; font-size: 13.5px; }
.hbar-track { height: 18px; background: var(--surface-2, #ececf3); border-radius: 6px; overflow: hidden; }
.hbar-fill {
  height: 100%; min-width: 2px; border-radius: 6px;
  background: linear-gradient(90deg, #6366f1, #4f46e5);
}
.hbar-val { font-size: 13px; font-weight: 600; white-space: nowrap; }
.hbar-val .muted { font-weight: 400; }
@media (max-width: 640px) {
  .hbar-row { grid-template-columns: 1fr; gap: 3px; }
  .hbar-track { grid-row: 2; }
}

/* ─── Отчёты (C4): мини-полоса доли выручки в таблице «по дням» ─── */
.rep-bar { height: 12px; min-width: 80px; background: var(--surface-2, #ececf3); border-radius: 5px; overflow: hidden; }
.rep-bar span { display: block; height: 100%; min-width: 2px; border-radius: 5px;
  background: linear-gradient(90deg, #6366f1, #4f46e5); }

/* ─── Отчёты (C4): сворачиваемые под-группы по типу единицы (метраж/вес/штуки) ─── */
.rep-group { margin-bottom: 14px; }
.rep-group-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px;
  margin: 0; padding: 10px 12px; cursor: pointer; user-select: none;
  background: var(--surface-2, #f6f6fa); border-radius: 10px; transition: background .12s; }
.rep-group-head:hover { background: var(--surface-3, #ececf3); }
.rep-group.open .rep-group-head { border-radius: 10px 10px 0 0; }
.rep-toggle { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px;
  flex: 0 0 20px; font-size: 18px; font-weight: 700; line-height: 1; color: #4f46e5;
  background: rgba(99,102,241,.12); border-radius: 6px; }
.rep-toggle::before { content: '+'; }
.rep-group.open .rep-toggle::before { content: '\2212'; } /* − */
.rep-count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px;
  padding: 0 7px; font-size: 12px; font-weight: 700; color: #4f46e5;
  background: rgba(99,102,241,.12); border-radius: 10px; }
.rep-group .wh-table { display: none; }
.rep-group.open .wh-table { display: table; }

/* Р7: сортируемые заголовки + итоговая строка денежной таблицы (нули/минусы) */
.wh-table th.sortable { cursor: pointer; user-select: none; }
.wh-table th.sortable:hover { text-decoration: underline; }
.wh-table th.sortable[data-dir="asc"]::after { content: " ▲"; font-size: 10px; }
.wh-table th.sortable[data-dir="desc"]::after { content: " ▼"; font-size: 10px; }
.wh-money tfoot .wh-money-total td { border-top: 2px solid var(--border, #e3e3ea); background: var(--surface-2, #f7f7fb); }

/* ─── Вкладки склада ─── */
.wh-tabs {
  display: flex; gap: 4px; margin-bottom: 18px;
  border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.wh-tab {
  padding: 9px 16px; border: none; background: none; cursor: pointer;
  font-size: 13.5px; font-weight: 600; color: var(--ink-3);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  font-family: inherit;
}
.wh-tab:hover { color: var(--ink); }
.wh-tab.active { color: var(--indigo-600); border-bottom-color: var(--indigo); }
.wh-panel { display: none; }
.wh-panel.active { display: block; }
/* способы прихода внутри вкладки «Приходы» */
.wh-method { display: none; }
.wh-method.active { display: block; }

/* ─── Подпункты левого меню ─── */
.nav-sub { display: flex; flex-direction: column; margin: 0 0 4px 30px; }
.nav-subitem {
  padding: 6px 12px; border-radius: var(--radius-sm);
  color: var(--ink-3); font-size: 12.5px; font-weight: 500; text-decoration: none;
}
.nav-subitem:hover { background: var(--surface-2); color: var(--ink); }

/* ─── Уведомления (C5): колокольчик в шапке + дропдаун ─── */
.topbar-right { display: flex; align-items: center; gap: 16px; }

/* ─── C10: глобальный поиск ─── */
.gsearch { position: relative; display: flex; align-items: center; }
.gsearch-ic { width: 16px; height: 16px; position: absolute; left: 11px; color: var(--ink-3); pointer-events: none; }
.gsearch-input {
  width: 220px; padding: 8px 12px 8px 34px; border: 1px solid var(--line); border-radius: 20px;
  background: var(--surface); color: var(--ink); font-size: 13px; font-family: inherit; transition: width .15s, border-color .15s;
}
.gsearch-input::placeholder { color: var(--ink-3); }
.gsearch-input:focus { outline: none; width: 300px; border-color: var(--indigo); box-shadow: var(--shadow-sm); }
.gsearch-panel {
  position: absolute; top: 42px; right: 0; width: 380px; max-height: 70vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-md); z-index: 60; padding: 6px;
}
.gs-empty { padding: 18px 12px; text-align: center; color: var(--ink-3); font-size: 13px; }
.gs-group { margin-bottom: 4px; }
.gs-group-head {
  padding: 8px 10px 4px; font-size: 11.5px; font-weight: 700; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: .03em; display: flex; align-items: center; gap: 6px;
}
.gs-group-n { color: var(--ink-3); font-weight: 600; }
.gs-item { display: flex; flex-direction: column; gap: 1px; padding: 7px 10px; border-radius: var(--radius-sm); text-decoration: none; color: var(--ink); }
.gs-item:hover, .gs-item.active { background: var(--indigo-tint, #f0f1ff); }
.gs-item-label { font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.gs-item-sub { font-size: 11.5px; color: var(--ink-3); }
@media (max-width: 760px) {
  .gsearch-input { width: 140px; }
  .gsearch-input:focus { width: 180px; }
  .gsearch-panel { width: 300px; }
}

.notif { position: relative; display: flex; }
.notif-bell {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%;
  background: var(--surface); color: var(--ink-2); cursor: pointer; box-shadow: var(--shadow-sm);
}
.notif-bell:hover { color: var(--ink); border-color: var(--line-2); }
.notif-badge {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
  background: var(--loss); color: #fff; font-size: 11px; font-weight: 700; border-radius: 9px;
  border: 2px solid var(--paper);
}
.notif-panel {
  position: absolute; top: 44px; right: 0; width: 340px; max-height: 460px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-md); z-index: 50; padding: 6px;
}
.notif-head { padding: 8px 10px 6px; font-size: 12px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.notif-empty { padding: 18px 10px; text-align: center; color: var(--ink-3); font-size: 13px; }
.notif-cat { display: block; padding: 8px 10px; border-radius: var(--radius-sm); text-decoration: none; color: var(--ink); }
.notif-cat:hover { background: var(--surface-2); }
.notif-cat-top { display: flex; align-items: center; gap: 8px; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--ink-3); }
.notif-danger .notif-dot { background: var(--loss); }
.notif-warn .notif-dot { background: #d98a2b; }
.notif-cat-title { flex: 1; font-size: 13px; font-weight: 600; }
.notif-cat-count { font-size: 12px; font-weight: 700; color: #fff; background: var(--ink-3); border-radius: 9px; padding: 1px 7px; }
.notif-danger .notif-cat-count { background: var(--loss); }
.notif-warn .notif-cat-count { background: #d98a2b; }
.notif-rows { margin: 4px 0 0 16px; }
.notif-row { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--ink-2); padding: 1px 0; }
.notif-row-qty { font-weight: 600; color: var(--loss); white-space: nowrap; }
.notif-warn .notif-row-qty { color: #b5701d; }
.notif-more { font-size: 11.5px; color: var(--ink-3); padding-top: 2px; }

/* ─── Секция «Требует внимания» на дашборде ─── */
.alert-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.alert-card {
  display: block; padding: 14px 16px; border-radius: var(--radius); text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--ink-3); box-shadow: var(--shadow-sm);
}
.alert-card:hover { box-shadow: var(--shadow-md); }
.alert-danger { border-left-color: var(--loss); }
.alert-warn { border-left-color: #d98a2b; }
.alert-card-top { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.alert-card-count { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.alert-danger .alert-card-count { color: var(--loss); }
.alert-warn .alert-card-count { color: #c07d1f; }
.alert-card-title { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.alert-card-row { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--ink-2); padding: 1px 0; }
.acr-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acr-qty { font-weight: 600; white-space: nowrap; }
.alert-danger .acr-qty { color: var(--loss); }
.alert-card-more { font-size: 11.5px; color: var(--ink-3); padding-top: 4px; }

/* ═══ ДАШБОРД 2.0 — 2 колонки, премиум ═══ */
.dash-grid { display: grid; grid-template-columns: minmax(0,1fr) 320px; gap: 22px; align-items: start; }
.dash-main { min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.dash-rail { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 14px; }

/* панель — единая карточка */
.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm);
}
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.panel-head h4 { font-size: 15px; font-weight: 650; color: var(--ink); letter-spacing: -.01em; margin: 0; }
.panel-head .muted { font-weight: 400; }
.panel-big { font-size: 18px; font-weight: 700; color: var(--ink); letter-spacing: -.02em; white-space: nowrap; }

/* KPI со спарклайнами */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kpi-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 16px 0; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
  transition: box-shadow .15s, transform .15s; min-height: 110px; display: flex; flex-direction: column;
}
.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kpi-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.kpi-value { font-size: 25px; font-weight: 700; letter-spacing: -.03em; color: var(--ink); margin-top: 8px; }
.kpi-sub { font-size: 11.5px; margin: 6px 0 16px; }
.spark { display: block; width: 100%; height: 32px; margin-top: auto; }
.spark-line { fill: none; stroke: var(--indigo); stroke-width: 1.8; vector-effect: non-scaling-stroke; }
.spark-fill { fill: var(--indigo); opacity: .10; stroke: none; }

/* area-график */
.area-chart { width: 100%; }
.area-svg { width: 100%; height: 240px; display: block; }
.area-grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.area-ylbl { font-size: 9px; fill: var(--ink-3); font-family: inherit; }
.area-line { fill: none; stroke: var(--indigo); stroke-width: 2; vector-effect: non-scaling-stroke; }
.area-dot { fill: #fff; stroke: var(--indigo); stroke-width: 1.6; }
.area-dot:hover { r: 5; fill: var(--indigo); }
.area-cross { stroke: var(--indigo); stroke-width: 1; stroke-dasharray: 3 3; opacity: .5; vector-effect: non-scaling-stroke; }
.area-focus { fill: var(--indigo); stroke: #fff; stroke-width: 2; }
.area-hit { cursor: crosshair; }
.area-tip {
  position: absolute; pointer-events: none; z-index: 5;
  background: var(--ink); color: #fff; border-radius: 8px; padding: 6px 10px;
  font-size: 12px; font-weight: 600; line-height: 1.35; white-space: nowrap;
  box-shadow: 0 4px 14px rgba(20,18,14,.22);
}
.area-tip-sub { font-weight: 400; opacity: .75; }
.area-xrow { display: flex; justify-content: space-between; margin-top: 4px; }
.area-xrow span { font-size: 11px; color: var(--ink-3); flex: 1; text-align: center; }

/* Чистая прибыль строкой */
.pnl-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.pnl-item { flex: 1; min-width: 120px; }
.pnl-lbl { font-size: 12px; color: var(--ink-3); margin-bottom: 4px; }
.pnl-num { font-size: 22px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); }
.pnl-op { font-size: 22px; color: var(--ink-3); font-weight: 400; }
.pnl-plus { color: var(--profit); }
.pnl-minus { color: var(--loss); }

/* ─── правый рейл ─── */
.rail-panel { padding: 16px; }
.rail-head { font-size: 13px; font-weight: 650; color: var(--ink); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.rail-badge { background: var(--loss); color: #fff; font-size: 11px; font-weight: 700; border-radius: 9px; padding: 1px 7px; }
.rail-alerts { display: flex; flex-direction: column; gap: 8px; }
.rail-alert {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: var(--radius-sm);
  background: var(--surface-2); border-left: 3px solid var(--line-2); text-decoration: none; color: var(--ink);
  transition: background .12s;
}
.rail-alert:hover { background: var(--indigo-tint); }
.rail-danger { border-left-color: var(--loss); }
.rail-warn { border-left-color: #d98a2b; }
.rail-alert-count { font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
.rail-danger .rail-alert-count { color: var(--loss); }
.rail-warn .rail-alert-count { color: #c07d1f; }
.rail-alert-title { font-size: 12.5px; font-weight: 500; color: var(--ink-2); flex: 1; }
.rail-alert-arrow { color: var(--ink-3); font-size: 13px; }
.rail-empty { font-size: 13px; color: var(--ink-3); }

/* агент в rail-панели (бывш. «Требует внимания») */
.agent-head { display: flex; gap: 11px; align-items: flex-start; margin-bottom: 13px; }
.agent-orb {
  width: 38px; height: 38px; border-radius: 12px; flex-shrink: 0; position: relative;
  background: linear-gradient(135deg, var(--indigo), #6a6fe0);
  box-shadow: 0 6px 16px rgba(59, 63, 181, .3);
}
.agent-orb::after {
  content: ''; position: absolute; inset: 0; border-radius: 12px;
  background: radial-gradient(circle at 32% 30%, rgba(255, 255, 255, .7), transparent 55%);
}
.agent-pulse {
  position: absolute; inset: -5px; border-radius: 16px; border: 2px solid var(--indigo);
  opacity: .4; animation: agentPulse 2.6s ease-out infinite;
}
@keyframes agentPulse { 0% { transform: scale(.9); opacity: .5; } 100% { transform: scale(1.25); opacity: 0; } }
.agent-name { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--ink-3); font-weight: 600; }
.agent-phrase { font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.4; margin-top: 3px; letter-spacing: -.01em; }
.agent-items { display: flex; flex-direction: column; gap: 7px; }
.agent-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px;
  text-decoration: none; background: var(--surface-2); transition: .15s;
}
.agent-item:hover { background: var(--indigo-tint); }
.agent-item-ic { font-size: 16px; flex-shrink: 0; }
.agent-item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.agent-item-title { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.agent-item-meta { font-size: 11px; color: var(--ink-3); margin-top: 1px; }
.agent-danger .agent-item-meta { color: var(--loss); }
.agent-item-go { font-size: 11.5px; font-weight: 600; color: var(--indigo); flex-shrink: 0; white-space: nowrap; }
.agent-item:hover .agent-item-go { color: var(--indigo-600); }
.agent-allok { font-size: 13px; color: var(--ink-2); padding: 4px 0; }
.agent-phrase-live { animation: agentFade .4s ease; }
@keyframes agentFade { from { opacity: .3; } to { opacity: 1; } }
/* кнопка перехода в полноценный чат с агентом */
.agent-chat-btn {
  display: flex; align-items: center; gap: 9px; margin-top: 13px; padding: 11px 13px;
  border-radius: 11px; text-decoration: none; cursor: pointer;
  background: var(--indigo); color: #fff; font-size: 13px; font-weight: 650;
  box-shadow: 0 4px 12px rgba(59, 63, 181, .22); transition: .15s;
}
.agent-chat-btn:hover { background: var(--indigo-600); box-shadow: 0 6px 16px rgba(59, 63, 181, .3); }
.agent-chat-ic { font-size: 15px; }
.agent-chat-arrow { margin-left: auto; font-weight: 700; }

/* календарь */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-title { font-size: 13.5px; font-weight: 650; color: var(--ink); text-transform: capitalize; }
.cal-nav {
  width: 26px; height: 26px; border: 1px solid var(--line); background: var(--surface);
  border-radius: 7px; cursor: pointer; color: var(--ink-2); font-size: 15px; line-height: 1;
}
.cal-nav:hover { border-color: var(--indigo); color: var(--indigo); background: var(--indigo-tint); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-dow { text-align: center; font-size: 10.5px; font-weight: 600; color: var(--ink-3); padding: 3px 0; }
.cal-day {
  aspect-ratio: 1; border: 1px solid transparent; background: none; cursor: pointer;
  border-radius: 7px; font-size: 12.5px; color: var(--ink-2); font-family: inherit;
  display: flex; align-items: center; justify-content: center;
}
.cal-day:hover { background: var(--surface-2); color: var(--ink); }
.cal-today { border-color: var(--line-2); font-weight: 700; color: var(--ink); }
.cal-range { background: var(--indigo-tint, #eef0ff); color: var(--ink); border-radius: 0; }
.cal-sel { background: var(--indigo); color: #fff; font-weight: 700; }
.cal-sel:hover { background: var(--indigo-600); color: #fff; }
.cal-hint { margin-top: 8px; font-size: 11px; color: var(--ink-3); text-align: center; }
.cal-clear { display: block; margin-top: 6px; font-size: 11.5px; color: var(--indigo); text-decoration: none; text-align: center; }
.cal-clear:hover { text-decoration: underline; }

/* погода */
.weather { text-align: center; padding: 4px 0; }
.weather-main { display: flex; align-items: center; justify-content: center; gap: 10px; }
.weather-icon { font-size: 38px; line-height: 1; }
.weather-temp { font-size: 40px; font-weight: 700; letter-spacing: -.04em; color: var(--ink); }
.weather-cond { font-size: 14px; font-weight: 600; color: var(--ink); margin-top: 2px; }
.weather-meta { font-size: 11.5px; margin-top: 4px; }
.weather-city {
  margin-top: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  border-radius: 20px; padding: 5px 14px; font-size: 12px; color: var(--ink-2); font-family: inherit;
}
.weather-city:hover { border-color: var(--indigo); color: var(--indigo); background: var(--indigo-tint); }
.weather-loading, .weather-fail { padding: 16px 0; font-size: 13px; }

/* ─── C9: курсы валют ─── */
.fx-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.fx-title { font-size: 13px; font-weight: 700; color: var(--ink); }
.fx-date { font-size: 11px; }
.fx-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 0; border-top: 1px solid var(--line); }
.fx-row:first-of-type { border-top: none; }
.fx-cur { font-size: 13px; color: var(--ink-2); min-width: 76px; }
.fx-rate { font-size: 14px; font-weight: 700; color: var(--ink); margin-left: auto; }
.fx-delta { font-size: 11.5px; min-width: 64px; text-align: right; font-variant-numeric: tabular-nums; }
.fx-up { color: #16a34a; }
.fx-down { color: #dc2626; }
.fx-flat { color: var(--ink-3); }
.fx-loading, .fx-fail { padding: 8px 0; font-size: 13px; }

/* ─── C9: пины (закреплённые заметки) ─── */
.pins-head { margin-bottom: 8px; }
.pins-title { font-size: 13px; font-weight: 700; color: var(--ink); }
.pins-list { display: flex; flex-direction: column; gap: 6px; }
.pin {
  position: relative; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
  background: var(--indigo-tint, #f0f1ff); border: 1px solid var(--line);
  border-left: 3px solid var(--indigo); border-radius: 8px; padding: 7px 28px 7px 10px;
}
.pin-text { font-size: 13px; color: var(--ink); line-height: 1.35; word-break: break-word; flex: 1; }
.pin-meta { font-size: 10.5px; width: 100%; }
.pin-del {
  position: absolute; top: 4px; right: 5px; border: none; background: none; cursor: pointer;
  font-size: 17px; line-height: 1; color: var(--ink-3); padding: 0 4px; border-radius: 4px;
}
.pin-del:hover { color: #dc2626; background: var(--surface-2); }
.pins-empty { padding: 6px 0; font-size: 12.5px; }
.pins-add { display: flex; gap: 6px; margin-top: 10px; }
.pin-input {
  flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px;
  font-size: 13px; font-family: inherit; color: var(--ink); background: var(--surface);
}
.pin-input:focus { outline: none; border-color: var(--indigo); }
.pin-add-btn {
  border: none; background: var(--indigo); color: #fff; cursor: pointer;
  border-radius: 8px; padding: 6px 12px; font-size: 12.5px; font-weight: 600; font-family: inherit;
}
.pin-add-btn:hover { background: var(--indigo-600); }

@media (max-width: 1080px) {
  .dash-grid { grid-template-columns: 1fr; }
  .dash-rail { position: static; flex-direction: row; flex-wrap: wrap; }
  .dash-rail .rail-panel { flex: 1; min-width: 240px; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) { .kpi-row { grid-template-columns: 1fr; } }

/* ─── A11Y ─── */
:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ═══ C6: вход, роли, планшет продавца ═══ */
.inp {
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 9px 12px;
  font-size: 13.5px; font-family: inherit; color: var(--ink); background: var(--surface); min-width: 0;
}
.inp:focus { outline: none; border-color: var(--indigo); }
.wh-btn {
  border: 1px solid var(--indigo); background: var(--indigo); color: #fff; cursor: pointer;
  border-radius: var(--radius-sm); padding: 9px 18px; font-size: 13.5px; font-weight: 600; font-family: inherit;
}
.wh-btn:hover { background: var(--indigo-600); }
.wh-danger { color: var(--loss) !important; }

/* — вход — */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--paper); }
.login-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow-md); padding: 34px 32px; width: 340px; max-width: 92vw;
}
.login-logo { font-size: 26px; font-weight: 800; letter-spacing: -.03em; color: var(--ink); }
.login-logo span { color: var(--indigo); }
.login-sub { font-size: 13px; color: var(--ink-3); margin: 2px 0 22px; }
.login-lbl { display: block; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); margin: 14px 0 6px; }
.login-select, .login-pin {
  width: 100%; border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 11px 13px;
  font-size: 14px; font-family: inherit; color: var(--ink); background: var(--surface);
}
.login-select:focus, .login-pin:focus { outline: none; border-color: var(--indigo); }
.login-pin { letter-spacing: .3em; text-align: center; font-size: 20px; }
.login-btn {
  width: 100%; margin-top: 20px; border: none; background: var(--indigo); color: #fff; cursor: pointer;
  border-radius: var(--radius-sm); padding: 12px; font-size: 15px; font-weight: 700; font-family: inherit;
}
.login-btn:hover { background: var(--indigo-600); }
.login-err { margin-top: 14px; font-size: 13px; color: var(--loss); text-align: center; }

/* — управление пользователями — */
.user-form { display: grid; grid-template-columns: 1.4fr 1fr 1fr .8fr auto; gap: 10px; align-items: center; }
.u-inactive { opacity: .5; }
.u-on { color: var(--profit); font-size: 12px; font-weight: 600; }
@media (max-width: 720px) { .user-form { grid-template-columns: 1fr 1fr; } }

/* — топбар: пользователь — */
.topbar-user { display: flex; align-items: center; gap: 8px; padding-left: 14px; border-left: 1px solid var(--line); }
.tu-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.tu-role { font-size: 11px; color: var(--ink-3); background: var(--surface-2); border-radius: 6px; padding: 2px 7px; }
.tu-exit { color: var(--ink-3); text-decoration: none; font-size: 17px; line-height: 1; padding: 2px 4px; }
.tu-exit:hover { color: var(--loss); }

/* — планшет продавца (/pos) — */
.pos-body { background: var(--paper); min-height: 100vh; }
.pos-top {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  background: var(--surface); border-bottom: 1px solid var(--line); padding: 14px 22px;
}
.pos-store { display: flex; align-items: baseline; gap: 14px; }
.pos-logo { font-size: 18px; font-weight: 800; letter-spacing: -.03em; color: var(--ink); }
.pos-logo span { color: var(--indigo); }
.pos-name { font-size: 16px; font-weight: 600; color: var(--ink); }
.pos-user { display: flex; align-items: center; gap: 14px; }
.pos-exit { color: var(--loss); text-decoration: none; font-weight: 600; font-size: 14px; }
.pos-wrap { max-width: 760px; margin: 0 auto; padding: 22px 18px 60px; }
.pos-actions { margin-bottom: 18px; }
.pos-btn {
  border: none; border-radius: var(--radius); cursor: pointer; font-family: inherit;
  font-size: 17px; font-weight: 700; padding: 16px 26px; color: #fff;
}
.pos-btn-in { background: var(--profit); }
.pos-btn-in:hover { filter: brightness(1.07); }
.pos-group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; overflow: hidden; }
.pos-group-head { font-size: 13px; font-weight: 700; color: var(--ink-2); background: var(--surface-2); padding: 11px 18px; }
.pos-neg-head { color: var(--loss); }
.pos-row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-top: 1px solid var(--line); }
.pos-row:first-of-type { border-top: none; }
.pos-row-name { flex: 1; font-size: 15px; font-weight: 500; color: var(--ink); }
.pos-row-qty { font-size: 15px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.pos-btn-sm {
  border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; font-family: inherit;
  border-radius: var(--radius-sm); padding: 9px 16px; font-size: 13.5px; font-weight: 600; color: var(--ink-2);
}
.pos-btn-sm:hover { border-color: var(--loss); color: var(--loss); }

/* ─── B3.1: badge приёмки на пункте «Чаты» + карточка подтверждения в чате ─── */
.nav-badge {
  display: inline-block; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px;
  border-radius: 9px; background: var(--loss, #e5484d); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; vertical-align: middle;
}
/* БАГ 1: явный display:inline-block перебивал атрибут hidden → бейдж не гас при 0.
   Возвращаем UA-поведение hidden для элементов с display. */
.nav-badge[hidden] { display: none; }
/* Р5: подсветка пункта sidebar при непрочитанном/важном (паттерн «Важное»).
   Мягкая красная заливка + жирнее — пункт «горит», пока не открыли. Переиспользуемо:
   класс вешается JS на любой .nav-item с непустым .nav-badge (setNavAlert/syncNavAlertsFromBadges). */
.nav-item.has-alert { background: rgba(229,72,77,.07); color: var(--ink); font-weight: 600; }
.nav-item.has-alert:hover { background: rgba(229,72,77,.12); }
/* Программа лояльности — ПОСТОЯННАЯ лёгкая зелёная подсветка (клиенты+бонусы+акции+push):
   целый блок, чтобы не искать пункт в длинном меню (Дмитрий, 2026-07-01). Паттерн .has-alert,
   но зелёный (--profit) и всегда, а не по бейджу. */
.nav-item.nav-loyalty { background: rgba(47,125,82,.09); color: var(--ink); font-weight: 600; }
.nav-item.nav-loyalty:hover { background: rgba(47,125,82,.15); }
.nav-item.nav-loyalty.active { background: rgba(47,125,82,.16); color: var(--profit); }
.nav-item.nav-loyalty.active::before { background: var(--profit); }
.pending-card {
  margin: 10px 0; padding: 12px 14px; border: 1px solid var(--line-2, #d7dbe0);
  border-radius: 10px; background: var(--surface, #fff);
}
.pending-card .pc-title { font-weight: 600; margin-bottom: 8px; font-size: 13.5px; }
.pending-card .pc-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.pending-card .pc-row label { font-size: 12.5px; color: var(--ink-2, #5b6470); font-weight: 600; }
.pending-card .pc-req { font-size: 12px; margin: -2px 0 10px; line-height: 1.4; }
.pending-card input[type=number] {
  font-family: inherit; font-size: 13px; padding: 6px 9px; max-width: 120px;
  border: 1px solid var(--line-2, #d7dbe0); border-radius: 7px; background: var(--surface, #fff);
}
.pending-card select, .pending-card input[type=date] {
  font-family: inherit; font-size: 13px; padding: 6px 9px;
  border: 1px solid var(--line-2, #d7dbe0); border-radius: 7px; background: var(--surface, #fff);
}
.pending-card .pc-actions { display: flex; gap: 8px; }
.pending-card .pc-confirm, .pending-card .pc-reject {
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  padding: 8px 14px; border-radius: 7px; border: 1px solid transparent;
}
.pending-card .pc-confirm { background: var(--profit, #30a46c); color: #fff; }
.pending-card .pc-confirm:hover { filter: brightness(1.05); }
.pending-card .pc-confirm:disabled { opacity: .6; cursor: default; }
.pending-card .pc-reject { background: var(--surface, #fff); border-color: var(--line-2, #d7dbe0); color: var(--ink-2, #5b6470); }
.pending-card .pc-reject:hover { border-color: var(--loss, #e5484d); color: var(--loss, #e5484d); }
.pending-card .pc-msg { font-size: 12.5px; color: var(--ink-2, #5b6470); margin-top: 6px; }
.pending-card .pc-done { font-weight: 600; font-size: 13.5px; }
.pending-card .pc-done.ok { color: var(--profit, #30a46c); }
.pending-card .pc-done.no { color: var(--loss, #e5484d); }

/* ─── B6: проверка приёмки — бейдж «требуют внимания» + чипы флагов аномалий ─── */
.intake-attn {
  display: inline-block; margin-left: 8px; padding: 2px 9px; border-radius: 9px;
  background: #fcecdf; color: var(--loss); font-size: 12px; font-weight: 700; white-space: nowrap;
}
.il-cat-head {
  margin: 12px 0 4px; font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .03em; color: var(--ink-3);
}
/* Колонки категорийных таблиц документа держим по colgroup: без fixed каждая таблица считала
   ширину сама, и «Ед./Кол-во/Закупка» съезжали от группы к группе. */
.il-table { table-layout: fixed; }
.il-doc-head {
  margin: 10px 0 4px; padding: 10px 12px; border-radius: 8px; background: var(--surface-2);
  font-size: 13px; line-height: 1.6;
}
.il-doc-btns { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.il-doc-total {
  margin-top: 10px; padding: 8px 12px; border-radius: 8px; background: var(--surface-2);
  font-size: 13px; text-align: right;
}
.il-flags { margin-top: 3px; display: flex; flex-wrap: wrap; gap: 5px; }
.il-flag {
  font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 7px;
  background: var(--surface-2); color: var(--ink-2); white-space: nowrap;
}
.il-flag.new  { background: var(--indigo-tint); color: var(--indigo-600); }
.il-flag.up   { background: #fae3dd; color: var(--loss); }      /* дороже прошлого — внимание */
.il-flag.down { background: #e1f0e7; color: var(--profit); }    /* дешевле прошлого — хорошо */
.il-flag.dupe { background: #fcecdf; color: var(--loss); }
.il-flag.neg  { background: #fae3dd; color: var(--loss); }
.wh-table tr.il-attn td { background: #fdf6ef; }                /* строка под вопросом — лёгкая подсветка */

/* ─── B10: «Важное» — разметка непонятых позиций ─── */
.attn-assign { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.attn-assign select, .attn-assign input {
  font-family: inherit; font-size: 13px; padding: 6px 9px;
  border: 1px solid var(--line-2); border-radius: 7px; background: var(--surface);
}
.attn-assign .attn-kw { width: 170px; }
.attn-msg { font-size: 12px; }
.attn-neg b { color: var(--loss); }

/* B10-refine: каждая незакрытая смена — отдельная проблема, не серый блок. Цветная
   левая полоса по severity + точка-индикатор + пилюля дней. */
.attn-shifts td { border-bottom: 1px solid var(--line); }
.attn-shift-row td:first-child { border-left: 3px solid transparent; padding-left: 10px; }
.attn-shift-row.sev-high td:first-child { border-left-color: var(--loss, #d64545); }
.attn-shift-row.sev-mid  td:first-child { border-left-color: #e0a106; }
.attn-shift-row.sev-high { background: rgba(214, 69, 69, .06); }
.attn-shift-row.sev-mid  { background: rgba(224, 161, 6, .06); }
.attn-shift-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 8px; vertical-align: middle; }
.attn-shift-row.sev-high .attn-shift-dot { background: var(--loss, #d64545); }
.attn-shift-row.sev-mid  .attn-shift-dot { background: #e0a106; }
.attn-days { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px;
  background: var(--line, #e8e8ee); }
.attn-shift-row.sev-high .attn-days { background: rgba(214, 69, 69, .15); color: var(--loss, #d64545); }
.attn-shift-row.sev-mid  .attn-days { background: rgba(224, 161, 6, .15); color: #9a6f04; }

/* ─── D5.2: прайс-листы поставщиков ─── */
.wh-h2 { margin: 0 0 4px; font-size: 18px; }
.wh-h3 { margin: 0 0 10px; font-size: 15px; }
.pl-card { border: 1px solid var(--line, #e8e8ee); border-radius: 10px; padding: 10px 12px;
  margin-bottom: 8px; background: var(--card, #fff); }
.pl-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.pl-head > b { margin-right: 2px; }
.pl-note { flex-basis: 100%; font-size: 12px; }
.pl-actions { margin-left: auto; display: inline-flex; gap: 6px; }
.pl-detail { margin-top: 10px; }
.pl-detail .wh-table { width: 100%; }

/* ─── D5.3: миграция (bulk-импорт) ─── */
.mig-input { width: 100%; min-height: 220px; font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px; padding: 10px; border: 1px solid var(--line, #e8e8ee); border-radius: 8px;
  resize: vertical; }
.mig-sample { background: var(--bg2, #f6f6fa); border: 1px solid var(--line, #e8e8ee);
  border-radius: 8px; padding: 10px; font-size: 12px; overflow-x: auto; margin: 8px 0; }
.mig-result { margin-top: 14px; border: 1px solid var(--line, #e8e8ee); border-radius: 10px;
  padding: 12px 14px; background: var(--card, #fff); }
.mig-ok { color: var(--profit, #2e9e5b); font-weight: 600; margin-bottom: 6px; }
.mig-stats { margin: 0; padding-left: 18px; }
.mig-stats li { margin: 3px 0; }
.mig-errs { margin-top: 10px; color: var(--loss, #d64545); font-size: 13px; }
.mig-errs ul { margin: 4px 0 0; padding-left: 18px; }

/* ─── D6: онбординг (баннер + мастер) ─── */
.onb-banner { display: flex; align-items: center; gap: 12px; text-decoration: none;
  background: linear-gradient(90deg, rgba(46,158,91,.12), rgba(46,158,91,.04));
  border: 1px solid rgba(46,158,91,.35); border-radius: 12px; padding: 12px 16px;
  margin-bottom: 16px; color: inherit; }
.onb-banner:hover { border-color: rgba(46,158,91,.6); }
.onb-banner-ic { font-size: 22px; }
.onb-banner-txt { flex: 1; }
.onb-banner-go { color: var(--profit, #2e9e5b); font-weight: 600; white-space: nowrap; }
.onb-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.onb-bar { flex: 1; height: 10px; background: var(--line, #e8e8ee); border-radius: 6px; overflow: hidden; }
.onb-bar-fill { height: 100%; background: var(--profit, #2e9e5b); transition: width .3s ease; }
.onb-prog-txt { font-size: 13px; color: var(--muted, #777); white-space: nowrap; }
.onb-step { border: 1px solid var(--line, #e8e8ee); border-radius: 12px; padding: 14px 16px;
  margin-bottom: 12px; background: var(--card, #fff); }
.onb-step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.onb-check { display: inline-flex; align-items: center; justify-content: center; width: 30px;
  height: 30px; border-radius: 50%; background: var(--line, #e8e8ee); font-weight: 700;
  color: var(--muted, #777); flex-shrink: 0; }
.onb-check.done { background: var(--profit, #2e9e5b); color: #fff; }
.onb-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px;
  margin-bottom: 12px; }
.onb-grid label { display: flex; flex-direction: column; font-size: 13px; color: var(--muted, #777); gap: 4px; }
.onb-grid input { padding: 7px 9px; border: 1px solid var(--line, #e8e8ee); border-radius: 7px; }
.onb-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.onb-points { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.onb-point-chip { background: var(--bg2, #f6f6fa); border: 1px solid var(--line, #e8e8ee);
  border-radius: 14px; padding: 4px 12px; font-size: 13px; }
.onb-cat-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.onb-cat-chip { background: var(--bg2, #f6f6fa); border: 1px solid var(--line, #e8e8ee);
  border-radius: 12px; padding: 3px 10px; font-size: 12px; }
.onb-footer { display: flex; align-items: center; gap: 10px; margin-top: 16px;
  padding-top: 14px; border-top: 1px solid var(--line, #e8e8ee); }

/* ─── D6.2: агент предлагает настройку ─── */
.onb-ai { border: 1px solid rgba(46,158,91,.35); border-radius: 12px; padding: 14px 16px;
  margin-bottom: 16px; background: linear-gradient(180deg, rgba(46,158,91,.06), transparent); }
.onb-ai-head { font-size: 15px; margin-bottom: 6px; }
.onb-ai-input { width: 100%; min-height: 70px; padding: 9px; border: 1px solid var(--line, #e8e8ee);
  border-radius: 8px; resize: vertical; font: inherit; }
.onb-ai-result { margin-top: 12px; border-top: 1px dashed var(--line, #e8e8ee); padding-top: 12px; }
.onb-ai-greet { font-weight: 600; margin-bottom: 6px; }
.onb-prop-group { margin-top: 10px; }
.onb-prop-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.onb-prop-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--card, #fff);
  border: 1px solid rgba(46,158,91,.4); border-radius: 13px; padding: 3px 6px 3px 11px; font-size: 13px; }
.onb-prop-x { border: none; background: none; cursor: pointer; font-size: 15px; line-height: 1;
  color: var(--muted, #999); padding: 0 2px; }
.onb-prop-x:hover { color: var(--loss, #d64545); }

/* ─── D3: внутренний чат команды ─── */
.team-wrap { display: flex; gap: 14px; height: calc(100vh - 180px); min-height: 420px; }
.team-list { width: 280px; flex-shrink: 0; border: 1px solid var(--line, #e8e8ee); border-radius: 12px;
  overflow-y: auto; background: var(--card, #fff); }
.team-list-head { font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--line, #e8e8ee); }
.team-list-sub { font-size: 12px; color: var(--muted, #888); padding: 10px 14px 4px; text-transform: uppercase; }
.team-convo { padding: 9px 14px; cursor: pointer; border-bottom: 1px solid var(--line, #f0f0f4); }
.team-convo:hover { background: var(--bg2, #f6f6fa); }
.team-convo.active { background: rgba(46,158,91,.10); }
.team-convo-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.team-convo-prev { font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-unread { background: var(--loss, #d64545); color: #fff; border-radius: 10px; font-size: 11px;
  padding: 1px 7px; font-weight: 600; }
.team-conv { flex: 1; display: flex; flex-direction: column; border: 1px solid var(--line, #e8e8ee);
  border-radius: 12px; overflow: hidden; background: var(--card, #fff); }
.team-conv-head { font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--line, #e8e8ee); }
.team-msgs { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.team-msg { max-width: 70%; align-self: flex-start; background: var(--bg2, #f1f1f6); border-radius: 12px;
  padding: 7px 11px; }
.team-msg.mine { align-self: flex-end; background: rgba(46,158,91,.14); }
.team-msg-author { font-size: 12px; font-weight: 600; color: var(--profit, #2e9e5b); margin-bottom: 2px; }
.team-msg-body { white-space: pre-wrap; word-break: break-word; }
.team-msg-time { font-size: 10px; color: var(--muted, #999); text-align: right; margin-top: 2px; }
.team-compose { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line, #e8e8ee); }
.team-compose textarea { flex: 1; resize: none; border: 1px solid var(--line, #e8e8ee); border-radius: 18px;
  padding: 9px 14px; font: inherit; max-height: 120px; }
.team-compose button { border-radius: 50%; width: 40px; height: 40px; flex-shrink: 0; }

/* ─── POS Этап 2: «Витрина кассы» — доска групп ─── */
.sc-toolbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 14px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.sc-toolbar select {
  border: 1px solid var(--line-2); border-radius: 8px; padding: 5px 8px; font: inherit; background: var(--surface);
}
.sc-board {
  display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start;
}
.sc-col {
  flex: 0 0 240px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); display: flex; flex-direction: column; max-height: 70vh;
}
.sc-col[data-group="none"] { background: var(--surface-2); }
.sc-col-head {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border-bottom: 1px solid var(--line); position: sticky; top: 0;
}
.sc-col-name { font-weight: 700; font-size: 13.5px; flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-col-actions { display: flex; gap: 2px; }
.sc-col-actions .btn-ghost { padding: 2px 6px; font-size: 13px; line-height: 1; }
.sc-col-body { padding: 6px; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; }
.sc-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px;
  cursor: pointer; font-size: 13px; transition: background .12s;
}
.sc-item:hover { background: var(--surface-2); }
.sc-item input { accent-color: var(--indigo); cursor: pointer; }
.sc-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-unit { font-size: 11px; flex-shrink: 0; }
.sc-qty { font-size: 12px; font-weight: 700; flex-shrink: 0; padding: 1px 7px;
  border-radius: 7px; background: #eafaf0; color: #2f7d52; }
.sc-qty.low { background: #fdecec; color: #c2553f; }
.sc-disc { font-size: 11px; font-weight: 800; flex-shrink: 0; padding: 1px 7px;
  border-radius: 7px; background: #fbecea; color: #c2553f; white-space: nowrap; }
.sc-empty { padding: 10px; text-align: center; color: var(--ink-3); font-size: 12px; }

/* ─── Баг #2: итог перемера (было→стало) + подсветка документа в истории ─── */
.inv-result-banner {
  margin: 14px 0 4px; padding: 11px 15px; border-radius: var(--radius-sm, 10px);
  background: linear-gradient(90deg, rgba(29,122,79,.12), rgba(59,63,181,.05));
  border: 1px solid rgba(29,122,79,.4); border-left: 3px solid var(--indigo, #3b3fb5);
  font-size: 14px; line-height: 1.5; color: var(--ink);
}
.inv-result-banner b { font-weight: 700; }
@keyframes invFlash {
  0%   { background: rgba(59,63,181,.18); }
  100% { background: transparent; }
}
.inv-row.inv-flash { animation: invFlash 2.4s ease-out; border-radius: 8px; }
