:root { --bg:#f4f6fa; --card:#fff; --text:#1d2433; --muted:#6b7487; --accent:#2f6fed; --line:#e3e7ef; --green:#1c9c5a; --red:#d9473f;
        --sidebar-w:248px; --sidebar-w-collapsed:64px; }
* { box-sizing: border-box; }
/* Атрибут hidden должен скрывать элемент, даже если у класса задан display (вкладки, закрытые ролью). */
[hidden] { display:none !important; }
body { margin:0; font:14px/1.45 "Segoe UI", system-ui, sans-serif; background:var(--bg); color:var(--text); }

/* ---------- Оболочка: боковая навигация + основная область ---------- */
.app-shell { display:flex; min-height:100vh; }
.sidebar { width:var(--sidebar-w); flex:0 0 var(--sidebar-w); background:var(--card); border-right:1px solid var(--line);
           display:flex; flex-direction:column; position:sticky; top:0; height:100vh; transition:width .18s ease, flex-basis .18s ease; z-index:30; }
.sidebar-head { display:flex; align-items:center; gap:10px; padding:14px 14px; border-bottom:1px solid var(--line); }
.sidebar-logo { width:34px; height:34px; flex:0 0 34px; display:flex; align-items:center; justify-content:center;
                border-radius:9px; background:var(--accent); color:#fff; font-weight:700; font-size:13px; letter-spacing:.5px; }
.sidebar-brand { display:flex; flex-direction:column; line-height:1.2; min-width:0; }
.sidebar-brand strong { font-size:14px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sidebar-brand .version-badge { font-size:11px; color:var(--muted); }
.sidebar-toggle { margin-left:auto; background:none; border:0; color:var(--muted); font-size:16px; padding:4px 6px; cursor:pointer; border-radius:6px; }
.sidebar-toggle:hover { background:#eef2f9; color:var(--accent); }
.sidebar-nav { flex:1 1 auto; overflow-y:auto; padding:10px 8px; display:flex; flex-direction:column; gap:2px; }
.nav-group-label { padding:14px 10px 6px; font-size:11px; font-weight:600; letter-spacing:.06em; text-transform:uppercase; color:var(--muted); }
.nav-item { display:flex; align-items:center; gap:10px; width:100%; padding:9px 10px; border:0; border-radius:8px;
            background:none; color:var(--text); font:inherit; text-align:left; cursor:pointer; white-space:nowrap; }
.nav-item:hover { background:#eef2f9; }
.nav-item.active { background:#e8f0ff; color:var(--accent); font-weight:600; }
.nav-icon { width:20px; flex:0 0 20px; text-align:center; font-size:13px; opacity:.75; }
.nav-item.active .nav-icon { opacity:1; }
.nav-text { overflow:hidden; text-overflow:ellipsis; }
.sidebar-account { margin:8px; padding:10px; border-top:1px solid var(--line); flex-wrap:wrap; }

/* Свёрнутое меню: только иконки */
.sidebar.collapsed { width:var(--sidebar-w-collapsed); flex-basis:var(--sidebar-w-collapsed); }
.sidebar.collapsed .sidebar-brand,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .nav-group-label { display:none; }
.sidebar.collapsed .nav-item { justify-content:center; padding:10px 6px; }
.sidebar.collapsed .sidebar-head { justify-content:center; padding:14px 6px; }
.sidebar.collapsed .sidebar-toggle { margin-left:0; }
.sidebar.collapsed .sidebar-account { display:none; }

.app-main { flex:1 1 auto; min-width:0; display:flex; flex-direction:column; }
.topbar { display:flex; align-items:center; gap:14px; padding:14px 24px; background:var(--card);
          border-bottom:1px solid var(--line); position:sticky; top:0; z-index:20; }
.topbar h1 { font-size:17px; margin:0; font-weight:600; }
.topbar-actions { margin-left:auto; display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.topbar-burger { display:none; background:none; border:0; font-size:18px; color:var(--muted); cursor:pointer; padding:4px 6px; }

/* ---------- Блок «Требует внимания» ---------- */
.attention-box { margin:18px 0 4px; padding:14px 16px; border:1px solid #f0c36d; border-radius:10px; background:#fffbf0; }
.attention-box[hidden] { display:none; }
.attention-title { font-weight:600; margin-bottom:8px; font-size:13px; }
.attention-list { display:flex; flex-direction:column; gap:6px; }
.attention-row { display:flex; align-items:center; gap:10px; padding:8px 10px; border-radius:8px; background:#fff; border:1px solid var(--line); font-size:13px; cursor:pointer; text-align:left; width:100%; font-family:inherit; }
.attention-row:hover { border-color:#e0b55a; background:#fffdf7; }
.attention-badge { flex:0 0 auto; font-size:12px; font-weight:600; padding:2px 8px; border-radius:999px; background:#fdf0d5; color:#8a6100; }
.attention-text { flex:1 1 auto; }
.attention-arrow { color:var(--muted); }

/* ---------- Страница остатков ---------- */
.inv-cards { display:grid; grid-template-columns:repeat(auto-fit,minmax(170px,1fr)); gap:12px; margin:18px 0 4px; }
.inv-card { text-align:left; padding:14px 16px; border:1px solid var(--line); border-radius:10px; background:var(--card);
            display:flex; flex-direction:column; gap:2px; cursor:pointer; font:inherit; color:var(--text); }
.inv-card:hover { border-color:#b8cdfc; background:#fbfcff; }
.inv-card-static { cursor:default; }
.inv-card-static:hover { border-color:var(--line); background:var(--card); }
.inv-card.active { border-color:var(--accent); box-shadow:0 0 0 2px rgba(47,111,237,.12); }
.inv-card-name { font-size:12px; color:var(--muted); }
.inv-card-value { font-size:22px; font-weight:600; font-variant-numeric:tabular-nums; }
.inv-card-sub { font-size:12px; color:var(--muted); }
.inv-catalog-note { margin:10px 0 0; font-size:12px; color:var(--muted); }
.inv-catalog-note strong { color:var(--text); font-size:13px; }
.inv-actions-row { display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin:16px 0 4px; }
.inv-sync-note { font-size:12px; color:var(--muted); margin-left:4px; }
.inv-more { position:relative; }
.inv-more summary { list-style:none; cursor:pointer; padding:8px 14px; border:1px solid var(--line); border-radius:8px; color:var(--accent); font-size:14px; }
.inv-more summary::-webkit-details-marker { display:none; }
.inv-toolbar { margin-top:14px; }
.inv-count { margin-left:auto; font-size:12px; color:var(--muted); }
.inv-details-toggle.active { border-color:var(--accent); color:var(--accent); }
.inv-table-wrap { max-height:none; }
.inv-table { font-variant-numeric:tabular-nums; }
.inv-table tbody tr.inv-row-empty td { color:var(--muted); }
.inv-name { max-width:420px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.inv-status { display:inline-block; padding:2px 9px; border-radius:999px; font-size:12px; white-space:nowrap; }
.inv-status-ok { background:#e8f6ee; color:#1c6b40; }
.inv-status-warn { background:#fdf0d5; color:#8a6100; }
.inv-status-bad { background:#fdecea; color:#b3261e; }
.inv-pair { display:inline-flex; align-items:baseline; gap:4px; font-variant-numeric:tabular-nums; }
.inv-sep { color:var(--line); }
.inv-fbs { color:var(--muted); font-size:13px; }
.inv-table thead th small { display:block; font-weight:400; font-size:11px; color:var(--muted); }
.inv-import { margin-top:22px; }
.inv-import summary { cursor:pointer; font-weight:600; color:var(--accent); font-size:14px; }

/* ---------- Пошаговое окно отправки ---------- */
.stock-modal-steps { width:min(960px,100%); }
.step-bar { display:flex; gap:0; list-style:none; margin:16px 0 20px; padding:0; }
.step-bar .step { display:flex; align-items:center; gap:8px; flex:1 1 0; padding:10px 12px;
                  font-size:13px; color:var(--muted); border-bottom:2px solid var(--line); }
.step-bar .step.active { color:var(--accent); font-weight:600; border-bottom-color:var(--accent); }
.step-bar .step.done { color:var(--green); border-bottom-color:var(--green); }
.step-num { width:22px; height:22px; flex:0 0 22px; display:flex; align-items:center; justify-content:center;
            border-radius:50%; background:#eef2f9; font-size:12px; font-weight:600; }
.step-bar .step.active .step-num { background:var(--accent); color:#fff; }
.step-bar .step.done .step-num { background:var(--green); color:#fff; }
.step-actions { margin-top:18px; justify-content:space-between; }
.mp-summary { display:flex; flex-direction:column; gap:8px; margin:16px 0; }
.mp-summary-row { display:grid; grid-template-columns:140px 1fr auto auto; gap:12px; align-items:center;
                  padding:12px 14px; border:1px solid var(--line); border-radius:10px; background:var(--card); font-size:13px; }
.mp-summary-row.muted { opacity:.55; }
.mp-summary-name { font-weight:600; }
.mp-summary-warehouse { color:var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mp-summary-target { color:var(--muted); font-size:12px; }
.mp-summary-total { font-weight:600; font-variant-numeric:tabular-nums; }
.mp-summary-grand { margin-top:6px; padding:12px 14px; border-radius:10px; background:#eef2f9; font-size:14px; }
h1 { font-size:18px; margin:0; }
nav { display:flex; gap:4px; }
.nav-dropdown { position:relative; }
.tab { border:0; background:none; padding:8px 14px; border-radius:8px; cursor:pointer; color:var(--muted); font:inherit; }
.tab.active { background:#e8f0ff; color:var(--accent); font-weight:600; }
.nav-dropdown-menu { display:none; position:absolute; z-index:20; top:100%; left:0; min-width:240px; padding:6px; background:var(--card); border:1px solid var(--line); border-radius:8px; box-shadow:0 8px 24px rgba(29,36,51,.14); }
.nav-dropdown:hover .nav-dropdown-menu, .nav-dropdown.open .nav-dropdown-menu { display:block; }
.nav-dropdown .nav-dropdown-menu .finance-menu-item { display:block; width:100%; min-width:0; height:auto; margin:0; padding:8px 10px; border:0; border-radius:6px; background:var(--card); color:var(--text); text-align:left; cursor:pointer; font:inherit; font-weight:400; box-shadow:none; }
.nav-dropdown .nav-dropdown-menu .finance-menu-item:hover, .nav-dropdown .nav-dropdown-menu .finance-menu-item:focus-visible { background:#e8f0ff; color:var(--accent); }
.nav-dropdown .nav-dropdown-menu .finance-menu-item:active { background:#dce9ff; color:var(--accent); }
.filters { display:flex; gap:12px; flex-wrap:wrap; align-items:end; padding:12px 24px; }
.periods { display:flex; gap:4px; align-items:end; flex-wrap:wrap; }
.periods .period-btn { margin:0; }
.periods .period-btn.active { background:#e8f0ff; color:var(--accent); border-color:#b8cdfc; font-weight:600; }
label { display:flex; flex-direction:column; gap:4px; color:var(--muted); font-size:12px; }
input, select { padding:7px 9px; border:1px solid var(--line); border-radius:8px; font:inherit; background:#fff; color:var(--text); }
button, .btn { padding:8px 14px; border:0; border-radius:8px; background:var(--accent); color:#fff; cursor:pointer; font:inherit; text-decoration:none; }
button.ghost { background:none; color:var(--accent); border:1px solid var(--line); }
main { padding:0 24px 32px; }
.panel { display:none; } .panel.active { display:block; }
.cards { display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:12px; margin-bottom:16px; }
.page-heading { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; margin:20px 0 16px; }
.page-heading h2 { margin:0 0 4px; font-size:22px; }
.finance-primary-action { white-space:nowrap; }
.finance-link-primary { border-color:#b8cdfc; box-shadow:0 2px 8px rgba(47,111,237,.08); }
.finance-link em { color:var(--accent); font-style:normal; font-size:12px; font-weight:600; margin-top:auto; }
.finance-summary { display:grid; grid-template-columns:repeat(3,minmax(160px,1fr)); gap:12px; margin-bottom:16px; max-width:760px; }
.finance-links { display:grid; grid-template-columns:repeat(2,minmax(260px,1fr)); gap:16px; max-width:900px; }
.finance-link { display:flex; flex-direction:column; align-items:flex-start; gap:6px; min-height:112px; padding:18px; text-align:left; background:var(--card); color:var(--text); border:1px solid var(--line); box-shadow:0 1px 2px rgba(29,36,51,.03); }
.finance-link:hover { border-color:#b8cdfc; background:#fbfdff; }
.finance-link strong { color:var(--accent); font-size:15px; }
.finance-link span { color:var(--muted); font-size:13px; font-weight:400; }
.inventory-status { display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:12px; margin:16px 0; }
.inventory-value { font-size:16px !important; }
.inventory-settings-form { max-width:560px; }
.inventory-actions { display:flex; gap:8px; flex-wrap:wrap; }
.inventory-hero { display:flex; justify-content:space-between; align-items:flex-start; gap:24px; padding:22px; margin:-4px 0 16px; border:1px solid #dbe5f5; border-radius:16px; background:linear-gradient(135deg,#f8fbff 0%,#eef5ff 100%); }
.inventory-hero h2 { margin:2px 0 5px; font-size:28px; letter-spacing:-.02em; }
.inventory-hero-actions { display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; align-items:center; }
.inventory-hero-note { color:var(--muted); font-size:12px; max-width:220px; text-align:right; }
.eyebrow { color:var(--accent); font-size:11px; font-weight:700; letter-spacing:.12em; }
.inventory-status { grid-template-columns:repeat(4,minmax(150px,1fr)); margin:0 0 18px; }
.inventory-stat { display:flex; align-items:center; gap:12px; min-height:86px; box-shadow:0 3px 12px rgba(29,36,51,.04); }
.inventory-stat .value { font-size:20px; }
.stat-icon { display:grid; place-items:center; width:36px; height:36px; border-radius:10px; background:#e8f0ff; color:var(--accent); font-size:20px; font-weight:700; }
.stat-icon-green { background:#e8f7ef; color:var(--green); }
.stat-icon-blue { background:#e8f0ff; color:var(--accent); }
.stat-icon-yellow { background:#fff5d9; color:#b87900; }
.inventory-command-card { padding:16px; margin:0 0 18px; border:1px solid var(--line); border-radius:14px; background:#fff; }
.inventory-command-title { display:flex; justify-content:space-between; gap:16px; align-items:flex-start; margin-bottom:12px; }
.inventory-command-title h3 { margin:0 0 3px; }
.inventory-command-badge { padding:5px 9px; border-radius:999px; background:#e8f7ef; color:var(--green); font-size:12px; white-space:nowrap; }
.inventory-main-actions { align-items:center; flex-wrap:wrap; }
.inventory-more { position:relative; }
.inventory-more summary { list-style:none; cursor:pointer; padding:8px 14px; border:1px solid var(--line); border-radius:8px; background:#fff; color:var(--muted); font:inherit; }
.inventory-more summary::-webkit-details-marker { display:none; }
.inventory-more summary:hover { background:#f0f5ff; color:var(--accent); }
.inventory-more[open] summary { background:#e8f0ff; color:var(--accent); }
.inventory-more-menu { display:flex; flex-direction:column; gap:4px; position:absolute; top:calc(100% + 4px); right:0; min-width:220px; padding:6px; background:var(--card); border:1px solid var(--line); border-radius:10px; box-shadow:0 8px 24px rgba(29,36,51,.14); z-index:15; }
.inventory-more-menu button { justify-content:flex-start; }
@media (max-width:700px) { .inventory-more { width:100%; } .inventory-more-menu { right:auto; left:0; } }
.inventory-operation-message { margin-top:12px; padding:10px 12px; border-radius:8px; background:#f7f9fc; color:var(--muted); }
@media (max-width:700px) { .inventory-hero { flex-direction:column; padding:16px; } .inventory-hero-actions { justify-content:flex-start; } .inventory-status { grid-template-columns:repeat(2,minmax(0,1fr)); } .inventory-command-title { flex-direction:column; } }
.card, .box { background:var(--card); border:1px solid var(--line); border-radius:12px; padding:16px; }
.card .label { color:var(--muted); font-size:12px; } .card .value { font-size:22px; font-weight:600; margin-top:4px; }
.grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(380px,1fr)); gap:16px; }
.wide { grid-column:1/-1; }
h3 { margin:0 0 12px; font-size:15px; }
.hint { color:var(--muted); margin:0 0 12px; }
.pos { color:var(--green); } .neg { color:var(--red); }
.toolbar { display:flex; gap:8px; margin:8px 0 12px; align-items:center; flex-wrap:wrap; }
.toolbar input { flex:1; min-width:130px; }
table { width:100%; border-collapse:collapse; background:var(--card); border-radius:12px; overflow:hidden; border:1px solid var(--line); }
th, td { padding:9px 12px; text-align:left; border-bottom:1px solid var(--line); vertical-align:middle; }
th { color:var(--muted); font-size:12px; font-weight:600; background:#fafbfd; }
.num { text-align:right; white-space:nowrap; font-variant-numeric:tabular-nums; }
td select, td input { width:100%; min-width:130px; }
.category-editor { display:flex; gap:4px; align-items:center; min-width:210px; }
.category-editor .cat { min-width:0; flex:1; }
.category-editor button { flex:none; width:30px; height:32px; padding:0; font-size:18px; line-height:1; }
.category-editor button:disabled { opacity:.35; cursor:not-allowed; }
.category-editor .category-edit { background:none; color:var(--accent); border:1px solid var(--line); }
.pager { display:flex; justify-content:center; align-items:center; gap:16px; margin-top:12px; }
#dropzone { border:2px dashed var(--line); border-radius:12px; padding:40px; text-align:center; color:var(--muted); cursor:pointer; margin:12px 0; }
#dropzone.over { border-color:var(--accent); background:#f0f5ff; }
form { display:grid; gap:10px; margin-bottom:16px; }
.list-item { display:flex; justify-content:space-between; align-items:center; padding:8px 0; border-bottom:1px solid var(--line); gap:8px; }
.list-item button { padding:4px 10px; background:none; color:var(--red); border:1px solid var(--line); }
.badge { font-size:11px; padding:2px 8px; border-radius:10px; background:#eef1f7; color:var(--muted); margin-left:6px; }
.empty { color:var(--muted); padding:24px; text-align:center; }
.legend { display:flex; flex-direction:column; gap:6px; flex:1; min-width:180px; }
.legend div { display:flex; align-items:center; gap:8px; }
.dot { width:10px; height:10px; border-radius:50%; flex:none; }
.donut-wrap { display:flex; gap:16px; align-items:center; flex-wrap:wrap; }
#toast { position:fixed; bottom:20px; right:20px; background:#1d2433; color:#fff; padding:10px 16px; border-radius:8px; display:none; max-width:420px; z-index:30; }
.stock-modal { position:fixed; inset:0; z-index:25; background:rgba(29,36,51,.45); display:flex; align-items:center; justify-content:center; padding:20px; }
.stock-modal[hidden] { display:none; }
.stock-modal-card { width:min(900px,100%); max-height:90vh; overflow:auto; padding:20px; background:var(--card); border-radius:12px; box-shadow:0 12px 40px rgba(29,36,51,.25); }
.stock-modal-close { float:right; }
.replenishment-providers { display:flex; flex-direction:column; gap:10px; margin:14px 0; }
.replenishment-provider { display:flex; flex-wrap:wrap; gap:10px; align-items:center; padding:10px 12px; background:#f7f9fc; border:1px solid var(--line); border-radius:8px; }
.replenishment-provider label { min-width:130px; font-weight:600; }
.replenishment-provider select { min-width:220px; flex:1 1 220px; }
.replenishment-provider input { width:110px; text-align:right; }
#marketplace-stock-preview-body .mp-send-input { width:70px; text-align:right; padding:2px 4px; }
#marketplace-stock-preview-body .mp-send-input-disabled { background:#f1f3f7; color:var(--muted); }
#marketplace-stock-preview-body .mp-send-hint { display:block; margin-top:2px; font-size:11px; color:var(--muted); white-space:nowrap; }
#marketplace-stock-preview-body .mp-send-hint-warn { color:#b8860b; }
#marketplace-stock-preview-table th.num, #marketplace-stock-preview-table td.num { white-space:nowrap; }
.account-bar { margin-left:auto; display:flex; align-items:center; gap:10px; font-size:13px; color:var(--muted); }
.account-bar[hidden] { display:none; }
.account-name { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:280px; }
.account-bar button { padding:6px 12px; font:inherit; font-size:13px; }
.users-invite-form input, .users-invite-form select { padding:9px 11px; font:inherit; border:1px solid var(--line); border-radius:8px; }
.invite-link-box { margin:14px 0; padding:12px 14px; background:#f7f9fc; border:1px solid var(--line); border-radius:8px; }
.invite-link-box[hidden] { display:none; }
.invite-link-box label { display:block; font-size:13px; color:var(--muted); margin-bottom:6px; }
.invite-link-row { display:flex; gap:8px; }
.invite-link-row input { flex:1; padding:9px 11px; font:inherit; font-size:13px; border:1px solid var(--line); border-radius:8px; background:#fff; }
.roles-layout { display:grid; grid-template-columns:220px 1fr; gap:16px; margin:12px 0 24px; align-items:start; }
.roles-list { display:flex; flex-direction:column; gap:6px; }
.role-chip { text-align:left; padding:9px 12px; font:inherit; font-size:13px; border:1px solid var(--line); border-radius:8px; background:#fff; cursor:pointer; }
.role-chip.active { border-color:var(--accent); background:#e8f0ff; color:var(--accent); font-weight:600; }
.role-custom { font-size:11px; color:var(--muted); font-weight:400; }
.roles-create { display:flex; flex-direction:column; gap:6px; margin-top:10px; padding-top:10px; border-top:1px solid var(--line); }
.roles-create input { padding:8px 10px; font:inherit; font-size:13px; border:1px solid var(--line); border-radius:8px; }
#roles-table td:first-child { white-space:nowrap; }
#roles-table input[type="checkbox"] { width:16px; height:16px; cursor:pointer; }
#roles-table input[type="checkbox"]:disabled { cursor:default; }

/* ---------- Адаптация под узкие экраны ---------- */
@media (max-width: 900px) {
  .sidebar { position:fixed; left:0; top:0; height:100vh; transform:translateX(-100%);
             transition:transform .2s ease; box-shadow:0 12px 40px rgba(29,36,51,.18); }
  .sidebar.collapsed { width:var(--sidebar-w); flex-basis:var(--sidebar-w); }
  .sidebar.collapsed .nav-text,
  .sidebar.collapsed .sidebar-brand,
  .sidebar.collapsed .nav-group-label { display:block; }
  .sidebar.collapsed .nav-item { justify-content:flex-start; padding:9px 10px; }
  body.sidebar-open .sidebar { transform:translateX(0); }
  .topbar-burger { display:block; }
  main { padding:0 14px 32px; }
  .topbar { padding:12px 14px; }
  .page-heading { flex-direction:column; align-items:stretch; }
  .roles-layout { grid-template-columns:1fr; }
}
.diagnostics-result { white-space: pre-wrap; overflow:auto; max-height:420px; background:#f7f9fc; border:1px solid var(--line); border-radius:8px; padding:12px; font:12px/1.45 ui-monospace, Consolas, monospace; }
button:focus-visible, input:focus-visible, select:focus-visible { outline:3px solid #8ab4ff; outline-offset:2px; }
body.busy { cursor: progress; } body.busy button, body.busy input, body.busy select { cursor: progress; }
[aria-busy="true"] { opacity:.72; }
@media (max-width: 700px) { header { padding:10px 12px; gap:10px; } nav { overflow-x:auto; max-width:100%; width:100%; scrollbar-width:thin; } .nav-dropdown-menu { position:fixed; top:58px; left:12px; } .tab { flex:0 0 auto; min-height:42px; } .subnav { padding:8px 12px; overflow-x:auto; align-items:flex-start; } .subnav-group { min-width:max-content; } main, .filters { padding-left:12px; padding-right:12px; } .filters > label { flex:1 1 140px; } .finance-summary { grid-template-columns:repeat(3,1fr); } .finance-links { grid-template-columns:1fr; } .filters .periods { width:100%; } .periods .period-btn { flex:1 1 90px; } .grid { grid-template-columns:1fr; } .box { min-width:0; } .toolbar { align-items:stretch; } .toolbar > * { max-width:100%; } table { display:block; overflow-x:auto; white-space:nowrap; } th, td { padding:7px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior:auto !important; transition:none !important; } }
.marketplace-card { min-width:0; }
.marketplace-card form { margin:0; }
.marketplace-card .marketplace-actions { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.marketplace-status { font-weight:600; }
.inventory-table-wrap { overflow:auto; margin-top:12px; max-height:70vh; } .inventory-toolbar { position:sticky; top:0; z-index:6; background:var(--card); padding:10px 0; border-bottom:1px solid var(--line); } #inventory-table { overflow:visible; } #inventory-table thead th, #cost-table thead th { position:sticky; top:0; z-index:3; background:#f7f9fc; box-shadow:inset 0 -1px 0 var(--line); } #inventory-table tfoot td { position:sticky; bottom:0; z-index:3; font-weight:700; background:#fafbfd; box-shadow:inset 0 1px 0 var(--line); } #cost-table { overflow:visible; } #cost-table thead th { top:58px; z-index:5; } #cost-table tfoot td { font-weight:700; background:#fafbfd; } #tab-cost .inventory-table-wrap { max-height:none; overflow:visible; } #inventory-table .own-stock-input { width:76px; min-width:76px; text-align:right; padding:2px 4px; } #cost-table .cost-input { width:110px; min-width:110px; text-align:right; } .wb-details-toggle { padding:2px 5px; background:transparent; color:var(--accent); border:0; } .wb-details-toggle[aria-expanded="true"] { transform:rotate(90deg); } .inventory-table tfoot { font-weight:700; background:#fafbfd; } .replenishment-box { margin:16px 0; border-color:#f0c36d; } .replenishment-box select { min-width:240px; } .replenishment-box input { width:120px; } #replenishment-table { margin-top:10px; } .inventory-diff { background:#fff8e1; } .inventory-zero { color:var(--red); } .inventory-diff .num:nth-child(5) { font-weight:600; }
.warehouse-report-legend { display:grid; grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); gap:8px 18px; margin-top:12px; padding:12px; background:#f7f9fc; border:1px solid var(--line); border-radius:8px; }
.warehouse-report-legend-item { display:flex; gap:8px; align-items:flex-start; }
.warehouse-report-legend-item strong { color:var(--accent); white-space:nowrap; }
.warehouse-report-legend-item span { color:var(--muted); }
#tx-table th:first-child, #tx-table td:first-child { width:34px; padding-left:10px; padding-right:4px; }
#tx-table .purpose { min-width:125px; }
.imp-ok { color:var(--green); } .imp-err { color:var(--red); }
@media (max-width: 1200px) { #tab-cost .inventory-table-wrap { overflow-x:auto; } #cost-table thead th { top:0; } }

/* ---------- Окно «Профиль»: смена пароля и активные сессии ---------- */
.profile-dialog { border:1px solid var(--line); border-radius:12px; padding:20px 22px; width:min(460px, calc(100vw - 32px)); color:var(--text); background:var(--card); }
.profile-dialog::backdrop { background:rgba(20,28,45,.45); }
.profile-dialog h3 { margin:0 0 12px; }
.profile-dialog h4 { margin:16px 0 8px; font-size:13px; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; }
.profile-dialog label { display:block; margin-bottom:10px; font-size:13px; color:var(--muted); }
.profile-dialog input { display:block; width:100%; margin-top:4px; }
.profile-actions { display:flex; gap:8px; flex-wrap:wrap; margin-top:12px; }
.profile-sessions { list-style:none; margin:0; padding:0; font-size:13px; }
.profile-sessions li { padding:8px 0; border-top:1px solid var(--line); }
.profile-sessions .session-current { color:var(--green); font-weight:600; }
.profile-sessions .session-meta { color:var(--muted); display:block; }
.profile-dialog .recovery-codes { margin:6px 0; padding:10px; background:var(--bg, #f4f6fa); border:1px solid var(--line); border-radius:8px; font-size:14px; user-select:all; }

.field-error { color:var(--red); }

/* ---------- Замена inline-стилей: страница работает с CSP без 'unsafe-inline' ---------- */
.dot.pal0 { background:#2f6fed; }
.dot.pal1 { background:#e8590c; }
.dot.pal2 { background:#1c9c5a; }
.dot.pal3 { background:#9c36b5; }
.dot.pal4 { background:#f59f00; }
.dot.pal5 { background:#0c8599; }
.dot.pal6 { background:#d6336c; }
.dot.pal7 { background:#5c7cfa; }
.dot.pal8 { background:#74b816; }
.dot.pal9 { background:#868e96; }
.dot-income, .dot-expense { display:inline-block; }
.dot-income { background:#1c9c5a; }
.dot-expense { background:#d9473f; margin-left:12px; }
.grow { flex:1; }
.scroll-x { overflow-x:auto; }
.value-small { font-size:14px; }
.subcat-group { margin-bottom:16px; }
.subcat-title { margin:8px 0 4px; font-size:13px; color:var(--accent); }
.list-item.tight { padding:6px 0; }

/* ---------- Страница «Себестоимость»: карточки, чипы, раскрытие по складам, импорт ---------- */
.cost-cards { display:grid; grid-template-columns:repeat(auto-fit, minmax(170px, 1fr)); gap:12px; margin:14px 0 4px; }
.cost-card { background:var(--card); border:1px solid var(--line); border-radius:12px; padding:12px 14px; }
.cost-card .label { font-size:12px; color:var(--muted); }
.cost-card .value { font-size:20px; font-weight:700; margin-top:4px; white-space:nowrap; }
.cost-card .value.value-small { font-size:15px; white-space:normal; word-break:break-word; }
.cost-card .sub { font-size:12px; color:var(--muted); margin-top:2px; }
.cost-card-main { grid-column:span 2; background:#eef4ff; border-color:#c9dafc; }
.cost-card-main .value { font-size:26px; }
.cost-card-warn { background:#fff8e1; border-color:#f0c36d; }
.cost-card-warn.ok { background:#edf8f1; border-color:#bfe3cc; }
.chips { display:inline-flex; gap:6px; flex-wrap:wrap; }
.chip { padding:5px 12px; border-radius:999px; border:1px solid var(--line); background:var(--card); color:var(--text); cursor:pointer; font-size:13px; }
.chip.active { background:var(--accent); border-color:var(--accent); color:#fff; }
.cost-bulk { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-top:10px; padding:10px 12px; border:1px solid #c9dafc; background:#eef4ff; border-radius:10px; }
.cost-bulk input { width:170px; }
#cost-table .cost-check { width:34px; text-align:center; }
#cost-table .cost-row.row-nocost td { background:#fffaf0; }
.cost-article { font-weight:600; }
.cost-name { color:var(--muted); font-size:12px; max-width:420px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.cost-expand { background:transparent; color:var(--text); border:0; padding:2px 6px; cursor:pointer; font:inherit; }
.cost-expand .cost-caret { display:inline-block; color:var(--accent); transition:transform .15s; }
.cost-expand[aria-expanded="true"] .cost-caret { transform:rotate(90deg); }
.cost-cost-cell { white-space:nowrap; }
.cost-state { display:inline-block; min-width:92px; margin-left:8px; font-size:12px; color:var(--muted); text-align:left; }
.cost-state.ok { color:var(--green); }
.cost-state.error { color:var(--red); }
.cost-undo { background:transparent; border:0; color:var(--accent); cursor:pointer; font-size:16px; padding:0 4px; }
.cost-detail td { background:#f7f9fc; padding-top:6px; padding-bottom:10px; }
.cost-splits { display:flex; gap:24px; flex-wrap:wrap; }
.cost-split { display:grid; grid-template-columns:auto auto auto; gap:2px 12px; font-size:13px; align-items:baseline; }
.cost-split span:first-child { color:var(--muted); }
.cost-dialog { border:1px solid var(--line); border-radius:12px; padding:20px 22px; width:min(860px, calc(100vw - 32px)); color:var(--text); background:var(--card); }
.cost-dialog::backdrop { background:rgba(20,28,45,.45); }
.cost-dialog h3 { margin:0 0 8px; }
.cost-diff { max-height:48vh; overflow:auto; margin-top:10px; }
.cost-diff-table { width:100%; }
.cost-diff-new td { background:#edf8f1; }
.cost-diff-up td:last-child { color:var(--red); }
.cost-diff-down td:last-child { color:var(--green); }
.cost-problems { margin-top:10px; padding:8px 12px; border:1px solid #f0c36d; background:#fff8e1; border-radius:8px; font-size:13px; }
.cost-problems ul { margin:6px 0 0 18px; padding:0; }
@media (max-width: 700px) { .cost-card-main { grid-column:span 1; } }

/* ---------- «Себестоимость»: история и вид для телефона ---------- */
.cost-history-box { flex-basis:100%; margin-top:6px; }
.cost-history-open { padding:3px 10px; font-size:12px; }
.cost-history-table { margin-top:8px; font-size:13px; }
.cost-toolbar { align-items:center; flex-wrap:wrap; }
@media (max-width: 700px) {
  #cost-table, #cost-table tbody, #cost-table tfoot { display:block; }
  #cost-table thead { display:none; }
  #cost-table tr.cost-row { display:flex; flex-wrap:wrap; align-items:center; padding:10px 8px; border:1px solid var(--line); border-radius:10px; margin-top:10px; background:var(--card); }
  #cost-table tr.cost-row td { border:0; padding:2px 0; background:transparent; text-align:left; }
  #cost-table tr.cost-row td:nth-child(1) { flex:0 0 34px; }
  #cost-table tr.cost-row td:nth-child(2) { flex:1 1 calc(100% - 34px); min-width:0; }
  #cost-table tr.cost-row td:nth-child(n+3) { flex:0 0 100%; padding-left:34px; }
  #cost-table tr.cost-row td:nth-child(3)::before { content:"Остаток: "; color:var(--muted); font-size:12px; }
  #cost-table tr.cost-row td:nth-child(5) { font-weight:700; }
  #cost-table tr.cost-row td:nth-child(5)::before { content:"Сумма: "; color:var(--muted); font-weight:400; font-size:12px; }
  #cost-table tr.cost-detail { display:block; margin:0 0 4px; }
  #cost-table tr.cost-detail[hidden] { display:none; }
  #cost-table tr.cost-detail td { display:block; padding:6px 8px; }
  #cost-table tr.cost-detail td:first-child { display:none; }
  #cost-table tfoot tr { display:flex; justify-content:space-between; padding:10px 8px; font-weight:700; }
  #cost-table tfoot td { display:block; padding:0; }
  #cost-table tfoot td:first-child { display:none; }
  .cost-toolbar { position:static; }
  .cost-toolbar input { width:100%; }
  .cost-state { min-width:0; }
  .cost-cards { grid-template-columns:1fr 1fr; }
  .cost-card-main { grid-column:span 2; }
  .cost-dialog { padding:14px; }
  .cost-diff-table th:nth-child(2), .cost-diff-table td:nth-child(2) { display:none; }
}

#cost-table input[type="checkbox"] { width:16px; min-width:0; height:16px; padding:0; cursor:pointer; }

/* ---------- Контур «Личное / Бизнес» ---------- */
.contour-switch { display:inline-flex; border:1px solid var(--line); border-radius:999px; overflow:hidden; background:var(--card); margin-left:auto; }
.contour-switch button { border:0; background:transparent; color:var(--text); padding:6px 14px; cursor:pointer; font-size:13px; border-radius:0; }
.contour-switch button.active { background:var(--accent); color:#fff; }
.contour-badge { margin-left:auto; padding:4px 12px; border-radius:999px; background:#eef4ff; border:1px solid #c9dafc; font-size:13px; }
.contour-switch ~ .topbar-actions, .contour-badge ~ .topbar-actions { margin-left:12px; }
body[data-contour="personal"] .nav-item[data-business] { display:none; }
.card-cross { background:#f3f0ff; border-color:#d6ccff; }
.label-check { margin:10px 0; padding:10px 14px; border:1px solid #f0c36d; background:#fff8e1; border-radius:10px; font-size:13px; }
.label-check-row { margin-top:6px; }
.acc-bulk { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:8px; }
.acc-pick { margin-right:6px; }
.acc-pick input, .acc-bulk input[type="checkbox"] { width:16px; min-width:0; height:16px; padding:0; }
.badge-business { background:#e8efff; }
.badge-personal { background:#eef8f1; }
.imp-warn { color:#8a5a00; }

.card .value.value-small { font-size:14px; font-weight:600; line-height:1.4; }

/* ---------- Обзор (пункт 36) ---------- */
.ov-grid { display:grid; grid-template-columns:repeat(12, 1fr); gap:14px; margin-top:12px; }
.ov-c3 { grid-column:span 3; } .ov-c4 { grid-column:span 4; } .ov-c6 { grid-column:span 6; } .ov-c8 { grid-column:span 8; } .ov-c12 { grid-column:span 12; }
.ov-grid h3 { margin:0 0 12px; font-size:14px; display:flex; align-items:center; gap:8px; }
.ov-grid h3 span { margin-left:auto; font-weight:400; font-size:12px; color:var(--muted); }
.ov-kpi .label { color:var(--muted); font-size:12px; }
.ov-kpi .value { font-size:26px; font-weight:700; margin:4px 0 2px; white-space:nowrap; }
.ov-kpi .delta { font-size:12px; color:var(--muted); }
.ov-hero { background:linear-gradient(135deg,#eef4ff,#fff); border-color:#c9dafc; }
.ov-ring { width:64px; height:64px; border-radius:50%; float:right; display:flex; align-items:center; justify-content:center; background:#e8ecf4; }
.ov-ring::after { content:attr(data-value); width:48px; height:48px; border-radius:50%; background:#fff; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:13px; }
.ov-row { display:flex; justify-content:space-between; gap:10px; padding:7px 0; border-top:1px solid var(--line); font-size:13px; }
.ov-row:first-child { border-top:0; }
.ov-note { margin-top:8px; font-size:12px; color:var(--muted); }
.ov-svg { width:100%; height:220px; }
.ov-legendbar { display:flex; gap:14px; font-size:12px; color:var(--muted); margin-top:6px; }
.ov-violet { color:#7048e8; }
.ov-donut-svg { width:130px; height:130px; display:block; margin:0 auto 10px; }
.ov-legend { font-size:13px; }
.ov-legend div { display:flex; gap:8px; align-items:center; padding:3px 0; }
.ov-legend .n { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ov-legend b { white-space:nowrap; } .ov-legend small { width:52px; text-align:right; font-size:12px; white-space:nowrap; }
.ov-cross { background:#f3f0ff; border-color:#d6ccff; }
.ov-compare { display:inline-flex; gap:6px; align-items:center; font-size:13px; color:var(--muted); }
.ov-compare input { width:16px; min-width:0; height:16px; padding:0; }
@media (max-width:1100px) { .ov-c3, .ov-c4, .ov-c6, .ov-c8 { grid-column:span 6; } }
@media (max-width:700px) { .ov-c3, .ov-c4, .ov-c6, .ov-c8 { grid-column:span 12; } }
.ov-pal0 { background:#2f6fed; }
.ov-pal1 { background:#e8590c; }
.ov-pal2 { background:#1c9c5a; }
.ov-pal3 { background:#9c36b5; }
.ov-pal4 { background:#f59f00; }
.ov-pal5 { background:#0c8599; }
.ov-pal6 { background:#d6336c; }
.ov-pal7 { background:#5c7cfa; }
.ov-pal8 { background:#74b816; }
.ov-pal9 { background:#868e96; }
.ov-fill-0 { background:conic-gradient(var(--green) 0%, #e8ecf4 0); }
.ov-fill-5 { background:conic-gradient(var(--green) 5%, #e8ecf4 0); }
.ov-fill-10 { background:conic-gradient(var(--green) 10%, #e8ecf4 0); }
.ov-fill-15 { background:conic-gradient(var(--green) 15%, #e8ecf4 0); }
.ov-fill-20 { background:conic-gradient(var(--green) 20%, #e8ecf4 0); }
.ov-fill-25 { background:conic-gradient(var(--green) 25%, #e8ecf4 0); }
.ov-fill-30 { background:conic-gradient(var(--green) 30%, #e8ecf4 0); }
.ov-fill-35 { background:conic-gradient(var(--green) 35%, #e8ecf4 0); }
.ov-fill-40 { background:conic-gradient(var(--green) 40%, #e8ecf4 0); }
.ov-fill-45 { background:conic-gradient(var(--green) 45%, #e8ecf4 0); }
.ov-fill-50 { background:conic-gradient(var(--green) 50%, #e8ecf4 0); }
.ov-fill-55 { background:conic-gradient(var(--green) 55%, #e8ecf4 0); }
.ov-fill-60 { background:conic-gradient(var(--green) 60%, #e8ecf4 0); }
.ov-fill-65 { background:conic-gradient(var(--green) 65%, #e8ecf4 0); }
.ov-fill-70 { background:conic-gradient(var(--green) 70%, #e8ecf4 0); }
.ov-fill-75 { background:conic-gradient(var(--green) 75%, #e8ecf4 0); }
.ov-fill-80 { background:conic-gradient(var(--green) 80%, #e8ecf4 0); }
.ov-fill-85 { background:conic-gradient(var(--green) 85%, #e8ecf4 0); }
.ov-fill-90 { background:conic-gradient(var(--green) 90%, #e8ecf4 0); }
.ov-fill-95 { background:conic-gradient(var(--green) 95%, #e8ecf4 0); }
.ov-fill-100 { background:conic-gradient(var(--green) 100%, #e8ecf4 0); }

.attention-row { color:var(--text); }
.dashboard-toolbar .ov-compare { flex-direction:row; align-items:center; }
#top-expenses td:first-child, #top-income td:first-child { white-space:nowrap; }

/* ---------- Разметка (пункт 38) ---------- */
.nav-badge { margin-left:auto; min-width:20px; padding:0 7px; border-radius:99px; background:#fdf0d5; color:#8a6100; font-size:11px; font-weight:600; text-align:center; }
.triage-group { margin-top:12px; }
.triage-head { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.triage-name { font-size:15px; }
.triage-examples { margin:6px 0 10px; }
.triage-actions { display:flex; gap:12px; align-items:center; flex-wrap:wrap; }
.triage-category { min-width:240px; }
.triage-rule { flex-direction:row; align-items:center; gap:6px; font-size:13px; }
.triage-rule input { width:16px; min-width:0; height:16px; padding:0; }

/* ---------- Бюджеты (пункт 37) ---------- */
.budget-form { display:flex; gap:12px; align-items:flex-end; flex-wrap:wrap; margin-top:12px; }
.budget-form input, .budget-form select { min-width:200px; }
.budget-row { padding:10px 0; border-top:1px solid var(--line); }
.budget-row:first-child { border-top:0; }
.budget-line { display:flex; gap:10px; align-items:center; font-size:13px; }
.budget-amounts { margin-left:auto; font-weight:600; }
.budget-delete { padding:2px 8px; }
.budget-bar { height:8px; border-radius:99px; background:#e8ecf4; overflow:hidden; margin:6px 0; }
.budget-fill { display:block; height:100%; width:0; background:var(--green); }
.budget-warn .budget-fill { background:var(--amber, #f59f00); }
.budget-over .budget-fill { background:var(--red); }
#tab-budgets .budget-row, #tab-budgets #budget-list { background:var(--card); }
#tab-budgets #budget-list { border:1px solid var(--line); border-radius:12px; padding:4px 16px; margin-top:12px; }

/* ---------- Регулярные платежи (пункт 39) ---------- */
.section-title { margin:26px 0 4px; font-size:16px; }
.date-chip { display:inline-block; min-width:46px; padding:2px 7px; margin-right:8px; border-radius:7px; background:#eef2f9; font-size:12px; text-align:center; }
.date-chip.soon { background:#fff1d6; color:#8a5a00; }
.badge-warn { background:#fff1d6; color:#8a5a00; margin-left:6px; }

/* ---------- Прогноз остатка (пункт 40) ---------- */
.fc-base { color:#2f6fed; } .fc-low { color:#9aa3b5; } .fc-warn { color:#8a5a00; font-weight:600; }
.fc-svg { height:190px; }

/* ---------- Динамика денег на счетах (пункт 41) ---------- */
.nw-spark { width:100%; height:52px; margin-top:8px; }
.nw-chart { height:140px; }
.nw-warn { margin-bottom:8px; padding:8px 12px; border:1px solid #f0c36d; background:#fff8e1; border-radius:8px; font-size:13px; }

/* ---------- Бизнес на обзоре (пункт 42) ---------- */
.ov-biz { background:linear-gradient(135deg,#f6f3ff,#fff); border-color:#d6ccff; }
.biz-cards { display:grid; grid-template-columns:repeat(auto-fit, minmax(170px, 1fr)); gap:12px; margin-bottom:12px; }
.biz-cards .label { display:block; color:var(--muted); font-size:12px; }
.biz-cards b { font-size:18px; }
.biz-tax { display:flex; gap:14px; align-items:center; flex-wrap:wrap; margin-top:12px; font-size:13px; }
.biz-tax-select { flex-direction:row; align-items:center; gap:8px; font-size:13px; }

/* ---------- Необычное (пункт 43) ---------- */
.anomaly { display:flex; gap:12px; align-items:center; padding:9px 0; border-top:1px solid var(--line); }
.anomaly:first-child { border-top:0; }
.anomaly-text { flex:1; min-width:0; }
.anomaly-badge { flex:none; background:#eef2f9; }
.anomaly-high .anomaly-badge { background:#fde7e5; color:#a02820; }
.anomaly-medium .anomaly-badge { background:#fff1d6; color:#8a5a00; }

/* ---------- Сводка в уведомления (пункт 44) ---------- */
.digest-box { margin-top:10px; }
.digest-actions { display:flex; gap:12px; align-items:center; flex-wrap:wrap; }
.digest-text { margin:12px 0 0; padding:12px; background:#f7f9fc; border:1px solid var(--line); border-radius:8px; white-space:pre-wrap; font:13px/1.5 "Segoe UI", system-ui, sans-serif; }

/* ---------- Цели накопления (пункт 45) ---------- */
.budget-ok .budget-fill { background:var(--green); }
#goal-list .box { padding-top:4px; padding-bottom:4px; }

/* ---------- Отчёты для бухгалтера (пункт 47) ---------- */
.reports-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(260px, 1fr)); gap:14px; margin-top:12px; }
.rep-scroll { overflow-x:auto; }
.rep-table { width:100%; margin-top:6px; }
.rep-table .rep-group td { background:#f7f9fc; font-weight:600; }
.rep-table .rep-total td { font-weight:700; background:#fafbfd; border-top:2px solid var(--line); }
