:root {
  --ink: #142033;
  --muted: #66758b;
  --line: #d9e2ef;
  --bg: #f2f6fb;
  --green: #2563a9;
  --green2: #4f8ed8;
  --green-dark: #164477;
  --dark: #0b2345;
  --red: #d73750;
  --surface: #ffffff;
  --surface-soft: #eaf1fa;
  --field: #f9fbfe;
  --shadow: 0 14px 38px rgba(22, 58, 100, .09);
  color-scheme: light;
}

html[data-theme="dark"] {
  --ink: #e9f1fb;
  --muted: #96a9c1;
  --line: #29415f;
  --bg: #07111f;
  --green: #63a4eb;
  --green2: #7db6f2;
  --green-dark: #4b91dc;
  --dark: #061326;
  --red: #ff647c;
  --surface: #0e1b2d;
  --surface-soft: #132844;
  --field: #102239;
  --shadow: 0 18px 42px rgba(0, 0, 0, .28);
  color-scheme: dark;
}

body, .app-v2 { background: var(--bg); color: var(--ink); }
.app-v2 { --ink:#142033; --muted:#66758b; --line:#d9e2ef; --bg:#f2f6fb; --green:#2563a9; --green-dark:#164477; }
html[data-theme="dark"] .app-v2 { --ink:#e9f1fb; --muted:#96a9c1; --line:#29415f; --bg:#07111f; --green:#63a4eb; --green-dark:#4b91dc; }
.v2-sidebar { background: linear-gradient(180deg, #123864 0%, #0b274a 58%, #07182f 100%); color: #fff; border-right: 0; box-shadow: 8px 0 30px rgba(4, 24, 52, .18); }
.v2-logo, .v2-logo b { color: #fff; }
.v2-logo>span { background: #fff; color: #123f72; }
.v2-logo small, .nav-caption, .v2-sidebar .side-foot small, .v2-sidebar .side-foot button { color: #a9c8ea !important; }
.v2-sidebar nav a { color: #c5d9ef; }
.v2-sidebar nav i { color: #8fc2fa; }
.v2-sidebar nav a:hover, .v2-sidebar nav a.active { background: rgba(255,255,255,.15); color: #fff; }
.v2-sidebar nav a.active { box-shadow: inset 3px 0 #fff; }
.v2-sidebar .side-foot { border-color: rgba(255,255,255,.18); }
.logo-image { display: block; width: 190px; min-height: 52px; overflow: hidden; }
.logo-image .brand-mark { display: block; position: relative; width: 190px; height: 52px; overflow: hidden; border-radius: 0; background: transparent; }
.logo-image .brand-mark img { position: absolute; width: 190px; height: 190px; max-width: none; left: 0; top: -68px; object-fit: contain; }
.auth-logo { width: 260px; min-height: 76px; }
.auth-logo .brand-mark { width: 260px; height: 76px; }
.auth-logo .brand-mark img { width: 260px; height: 260px; top: -96px; }
.mobile-brand { display: none; position: relative; width: 104px; height: 34px; overflow: hidden; flex: 0 0 104px; }
.mobile-brand img { position: absolute; width: 104px; height: 104px; top: -38px; left: 0; max-width: none; object-fit: contain; }
.auth-body { background: #061326; }
.auth-brand { background: radial-gradient(circle at 85% 20%, #1e5793 0, transparent 42%), linear-gradient(155deg,#0e315b,#061326); }
.auth-brand p { color: #8fc2fa; }
.auth-brand li { border-color: rgba(255,255,255,.22); color: #c4daf1; }
.auth-card { background: var(--bg); }

.panel, .kpis article, .metric-grid-v2 article, .store-card, .bot-hero, .status-line,
.connection-strip, .connector-panel, .hero-empty, .manual-import>div, .store-menu,
.auth-card>form, .success-state, dialog>form, .products-editor, .product-filters {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}
.panel, .metric-grid-v2 article, .store-card, .products-editor, .product-filters { box-shadow: var(--shadow); }
.topbar { background: var(--bg); }
input, textarea, select { background: var(--field); border-color: var(--line); color: var(--ink); }
input:focus, textarea:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(37,99,169,.14); }
.button, .mini { background: var(--surface); border-color: var(--line); color: var(--ink); }
.button.primary, .primary { background: linear-gradient(135deg, #2b6eb7, #164477); border-color: #1d568f; color: #fff; box-shadow: 0 8px 20px rgba(22,68,119,.2); }
.eyebrow, .panel-head a, .back, .connection-strip a, .store-switch>a { color: var(--green); }
.top-user>span, .avatar { background: var(--surface-soft); color: var(--green); }
.v2-topbar .top-actions { margin-left:auto; display:flex; align-items:center; gap:8px; min-height:42px; }
.theme-toggle, .top-icon { width:42px; height:42px; flex:0 0 42px; border:1px solid var(--line); border-radius:13px; display:grid; place-items:center; background:var(--surface-soft); color:var(--green); cursor:pointer; }
.top-user>span { width:42px; height:42px; }
.kaspi-top-status { box-sizing:border-box; display:inline-flex; align-items:center; justify-content:center; gap:7px; height:42px; margin:0; padding:0 13px; border:1px solid #f0d59f; border-radius:13px; background:#fff8e9; color:#9a6613; font-size:.68rem; font-weight:800; line-height:1; white-space:nowrap; }
.kaspi-top-status i { width:7px; height:7px; border-radius:50%; background:#2db574; box-shadow:0 0 0 4px rgba(45,181,116,.12); }
.kaspi-top-status.warning { border-color:#f0d59f; background:#fff8e9; color:#9a6613; }
.kaspi-top-status.warning i { background:#e5a72d; box-shadow:0 0 0 4px rgba(229,167,45,.13); }
.kaspi-top-status:hover { filter:brightness(.98); transform:translateY(-1px); }
.flash { background: #e9f2fd; border-color: #c5daf2; color: #194f88; }
.dot.ok, .status-led.on { background: #22a768; box-shadow: 0 0 8px #22a768; }
.success-text { color: #168457 !important; }
.catalog-connection { background: var(--surface-soft); border-color: #c9d9ed; }
.catalog-tabs a.active, .order-tabs a.active, .periods a.active { background: #dceafa; color: #174f89; }
.catalog-tabs b, .order-tabs b { background: var(--surface); }
.product-status { background: #e8f6ef; color: #14734a; }
.product-status.archive { background: var(--surface-soft); color: var(--muted); }
.product-status.review { background: #fff1d8; color: #8b5a0b; }
.chart-bar { background: linear-gradient(180deg, #4f8ed8, #164477); }
.order-status { background: #dfebf8; color: #194f88; }

.products-head { margin-bottom: 18px; }
.product-tabs { display: flex; gap: 7px; margin: 0 0 12px; overflow-x: auto; padding-bottom: 2px; }
.product-tabs a { border: 1px solid transparent; }
.product-tabs a.active { border-color: #bcd2ec; }
.product-filters { display: grid; grid-template-columns: minmax(240px,1.6fr) repeat(4,minmax(130px,.72fr)) auto; gap: 10px; align-items: end; padding: 14px; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 14px; }
.product-filters label { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.product-filters label>span { font-size: .66rem; color: var(--muted); font-weight: 750; }
.product-filters input, .product-filters select { height: 42px; padding: 9px 11px; }
.filter-actions { display: flex; gap: 7px; }
.filter-actions .button { height: 42px; padding: 9px 12px; white-space: nowrap; }

.products-editor { border: 1px solid var(--line); border-radius: 15px; overflow: hidden; }
.product-editor-head, .product-editor-row { display: grid; grid-template-columns: minmax(270px,2.1fr) .72fr .75fr .78fr .78fr .58fr .58fr .62fr 44px; gap: 10px; align-items: center; }
.product-editor-head { padding: 12px 14px; background: var(--surface-soft); color: var(--muted); text-transform: uppercase; letter-spacing: .055em; font-size: .61rem; font-weight: 750; }
.product-editor-row { padding: 13px 14px; border-top: 1px solid var(--line); margin: 0; }
.product-editor-row:first-of-type { border-top: 0; }
.product-editor-row:hover { background: color-mix(in srgb, var(--surface-soft) 46%, transparent); }
.product-main { display: flex; align-items: center; min-width: 0; gap: 12px; }
.catalog-image { width: 68px; height: 68px; flex: 0 0 68px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.catalog-image img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.catalog-image span { color: var(--green); font-size: 1.1rem; font-weight: 900; }
.product-main>div { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; gap: 4px; }
.product-title { max-width: 100%; font-weight: 800; font-size: .78rem; line-height: 1.35; }
.product-main small, .readonly-cell small { color: var(--muted); font-size: .62rem; line-height: 1.35; }
.readonly-cell { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.readonly-cell b { font-size: .75rem; }
.inline-field { margin: 0; }
.inline-field>span { display: none; }
.inline-field input { height: 40px; min-width: 0; padding: 8px 9px; font-size: .72rem; text-align: right; }
.dump-switch { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; }
.dump-switch input { position: absolute; opacity: 0; pointer-events: none; }
.dump-switch>span { width: 38px; height: 22px; border-radius: 20px; background: #b8c5d5; position: relative; transition: .2s; }
.dump-switch>span::after { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.22); transition: .2s; }
.dump-switch input:checked+span { background: var(--green); }
.dump-switch input:checked+span::after { transform: translateX(16px); }
.dump-switch small { color: var(--muted); font-size: .58rem; }
.row-save { width: 38px; height: 38px; border: 0; border-radius: 10px; background: #2563a9; color: white; font-size: 1.05rem; font-weight: 900; cursor: pointer; box-shadow: 0 7px 16px rgba(37,99,169,.2); }
.row-save:hover { background: #164477; transform: translateY(-1px); }
.product-bulk-save { position: fixed; left: calc(50% + 136px); bottom: 22px; transform: translateX(-50%); z-index: 80; display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; border: 1px solid #b7cee9; border-radius: 14px; background: rgba(11,35,69,.96); color: #fff; box-shadow: 0 18px 42px rgba(7,31,62,.28); backdrop-filter: blur(12px); }
.product-bulk-save[hidden] { display: none; }
.product-bulk-save span { font-size: .76rem; font-weight: 700; white-space: nowrap; }
.product-bulk-save .button { min-height: 39px; padding: 8px 12px; }
.product-bulk-save .button:not(.primary) { border-color: rgba(255,255,255,.24); background: rgba(255,255,255,.1); color: #fff; }
.product-bulk-save .button.primary { background: #4f8ed8; border-color: #4f8ed8; }
.product-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kaspi-card-link { color: var(--green); font-weight: 800; text-decoration: none; white-space: nowrap; }
.kaspi-card-link:hover { color: var(--green-dark); text-decoration: underline; }

/* Warehouse editor */
.warehouse-head { margin-bottom: 16px; }
.warehouse-head .search-inline select { width: 150px; min-width: 150px; }
.warehouse-metrics { margin-bottom: 14px; }
.warehouse-bulk { display: grid; grid-template-columns: minmax(220px,1.2fr) minmax(180px,.75fr) minmax(200px,.9fr) auto auto; gap: 10px; align-items: end; padding: 14px 16px; border: 1px solid var(--line); border-radius: 15px; background: linear-gradient(135deg, var(--surface), var(--surface-soft)); box-shadow: var(--shadow); margin-bottom: 14px; }
.bulk-copy { display: flex; flex-direction: column; gap: 3px; align-self: center; }
.bulk-copy b { font-size: .88rem; }
.bulk-copy small { color: var(--muted); font-size: .7rem; }
.warehouse-bulk label { display: flex; flex-direction: column; gap: 5px; margin: 0; }
.warehouse-bulk label>span { color: var(--muted); font-size: .62rem; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; }
.warehouse-bulk input { height: 41px; padding: 9px 10px; }
.warehouse-bulk .button { height: 41px; padding: 9px 13px; white-space: nowrap; }
.danger-outline { color: var(--red) !important; border-color: color-mix(in srgb, var(--red) 35%, var(--line)) !important; background: color-mix(in srgb, var(--red) 6%, var(--surface)) !important; }
.danger-outline:hover { background: color-mix(in srgb, var(--red) 12%, var(--surface)) !important; }
.warehouse-panel { padding-bottom: 10px; }
.warehouse-table .warehouse-editor-head, .warehouse-table .warehouse-editor-row { grid-template-columns: 38px minmax(300px,1.55fr) minmax(155px,.72fr) 92px minmax(132px,.62fr) minmax(220px,.92fr) 44px; gap: 12px; }
.warehouse-table .warehouse-editor-row { min-width: 1080px; }
.warehouse-table .warehouse-editor-head { font-size: .66rem; letter-spacing: .055em; padding-top: 13px; padding-bottom: 13px; }
.warehouse-editor .product-cell { min-width: 0; }
.warehouse-editor .product-cell>span { min-width: 0; }
.warehouse-editor .product-cell b { line-height: 1.3; font-size: .8rem; }
.warehouse-editor .product-cell small { color: var(--muted); font-size: .68rem; line-height: 1.35; }
.warehouse-editor .product-image { flex: 0 0 42px; }
.warehouse-sku { color: #48698f; font-size: .73rem; font-weight: 650; overflow-wrap: anywhere; }
.warehouse-stock { white-space: nowrap; font-size: .78rem; }
.warehouse-field { margin: 0; }
.warehouse-field input { height: 39px; padding: 8px 9px; font-size: .72rem; }
.row-select { display: grid; place-items: center; margin: 0; }
.row-select input, .warehouse-editor-head input { position: absolute; opacity: 0; pointer-events: none; }
.row-select span, .warehouse-editor-head span:first-child::after { width: 18px; height: 18px; border: 1.5px solid #a8b7c8; border-radius: 6px; background: var(--surface); display: block; content: ""; }
.row-select input:checked+span, .warehouse-editor-head input:checked+span::after { border-color: var(--green); background: var(--green); box-shadow: inset 0 0 0 4px var(--surface); }
.warehouse-editor-head span:first-child { display: grid; place-items: center; }
html[data-theme="dark"] .warehouse-bulk { background: linear-gradient(135deg, var(--surface), #102747); }
html[data-theme="dark"] .row-select span, html[data-theme="dark"] .warehouse-editor-head span:first-child::after { background: var(--field); border-color: #4b6380; }

html[data-theme="dark"] .store-menu form button:hover,
html[data-theme="dark"] .store-menu form button.selected { background: var(--surface-soft); }
html[data-theme="dark"] .bottom-nav { background: rgba(14,27,45,.94); border-color: var(--line); }
html[data-theme="dark"] .catalog-tabs a.active,
html[data-theme="dark"] .order-tabs a.active,
html[data-theme="dark"] .periods a.active { background: #17365a; color: #91c6ff; border-color: #285987; }
html[data-theme="dark"] .catalog-image { background: #fff; }
html[data-theme="dark"] .flash { background: #122f50; border-color: #285987; color: #a9d2ff; }
html[data-theme="dark"] .auth-card { background: var(--bg); }
html[data-theme="dark"] dialog { background: var(--surface); color: var(--ink); }

@media (max-width: 1280px) {
  .product-filters { grid-template-columns: 1.5fr repeat(2,1fr); }
  .filter-actions { align-self: end; }
  .product-editor-head, .product-editor-row { grid-template-columns: minmax(240px,1.8fr) .72fr .72fr repeat(4,.68fr) .62fr 42px; gap: 8px; }
}

@media (max-width: 1180px) {
  .warehouse-bulk { grid-template-columns: minmax(180px,1fr) repeat(2,minmax(150px,.8fr)) auto; }
  .warehouse-bulk .danger-outline { grid-column: 2 / -1; }
}

@media (max-width: 840px) {
  .product-editor-head { display: none; }
  .products-editor { border: 0; background: transparent; box-shadow: none; overflow: visible; }
  .product-editor-row { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-bottom: 12px; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
  .product-main { grid-column: 1/-1; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
  .catalog-image { width: 78px; height: 78px; flex-basis: 78px; }
  .readonly-cell, .inline-field { position: relative; padding-top: 18px; }
  .readonly-cell::before, .inline-field::before, .dump-switch::before { content: attr(data-label); position: absolute; top: 0; left: 0; color: var(--muted); font-size: .6rem; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; }
  .inline-field input { height: 44px; font-size: .82rem; }
  .dump-switch { position: relative; align-items: flex-start; justify-content: flex-end; padding-top: 20px; }
  .dump-switch small { margin-left: 2px; }
  .row-save { width: 100%; height: 46px; align-self: end; }
  .product-filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .product-filters .search-field { grid-column: 1/-1; }
  .filter-actions { grid-column: 1/-1; }
  .filter-actions .button { flex: 1; }
}

@media (max-width: 720px) {
  .mobile-brand { display: block; }
  .store-switch { margin-right: auto; }
  .store-switch>button span { display: none; }
  .store-switch>button b { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .v2-topbar { background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(16px); }
  .v2-bottom-nav { background: color-mix(in srgb, var(--surface) 92%, transparent); border-color: var(--line); }
  .bottom-nav a.active { color: var(--green); }
  .products-head { display: block; }
  .products-head .head-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .products-head .head-actions form, .products-head .head-actions .button { width: 100%; }
  .products-head .head-actions form .button { width: 100%; }
  .catalog-connection small { line-height: 1.45; }
  .product-tabs { margin-left: -14px; margin-right: -14px; padding: 0 14px 4px; }
  .product-tabs a { min-height: 42px; display: flex; align-items: center; }
  .theme-toggle, .top-icon { width: 36px; height: 36px; }
}

@media (max-width: 480px) {
  .product-filters { grid-template-columns: 1fr; }
  .product-filters .search-field, .filter-actions { grid-column: auto; }
  .product-editor-row { grid-template-columns: 1fr 1fr; padding: 13px; gap: 11px; }
  .product-main { align-items: flex-start; }
  .product-title { font-size: .84rem; }
  .catalog-image { width: 72px; height: 72px; flex-basis: 72px; }
  .products-head .head-actions { grid-template-columns: 1fr; }
  .product-bulk-save { left: 14px; right: 14px; bottom: 83px; transform: none; justify-content: space-between; padding: 10px; border-radius: 13px; }
  .product-bulk-save span { display: none; }
  .product-bulk-save .button { flex: 1; }
}

/* Design system: crisp line icons, restrained dark-blue controls and consistent type. */
.app-v2 { font-size: 16px; line-height: 1.45; }
.ui-icon { width: 20px; height: 20px; display: block; flex: 0 0 auto; color: inherit; fill: none !important; stroke: currentColor !important; }
.ui-icon use { fill: none !important; stroke: currentColor !important; color: inherit; }
.v2-sidebar nav a { display: flex; align-items: center; gap: 12px; min-height: 43px; font-size: .82rem; font-weight: 650; }
.v2-sidebar nav .ui-icon { width: 19px; height: 19px; color: #8fc2fa; }
.v2-sidebar nav a.active .ui-icon, .v2-sidebar nav a:hover .ui-icon { color: #fff; }
.v2-sidebar nav i { display: none; }
.v2-sidebar nav a.active { box-shadow: inset 3px 0 #67a9ed; }
.v2-sidebar .nav-group-title { display: block; margin: 20px 10px 5px; color: #80a9d5; font-size: .61rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.v2-sidebar .nav-group-title:first-child { margin-top: 2px; }
.v2-sidebar nav .nav-new { margin-left: auto; padding: 2px 5px; border-radius: 5px; background: rgba(102,174,244,.18); color: #cce6ff; font-size: .56rem; font-style: normal; font-weight: 800; letter-spacing: .04em; }
.v2-sidebar nav { scrollbar-width: none; -ms-overflow-style: none; padding-right: 0; }
.v2-sidebar nav::-webkit-scrollbar { width: 0; height: 0; }
.theme-toggle, .top-icon { border-radius: 11px; background: var(--surface-soft); border-color: transparent; box-shadow: none; transition: background .18s ease, transform .18s ease; }
.theme-toggle:hover, .top-icon:hover { background: #d6e5f7; transform: translateY(-1px); }
.theme-toggle .ui-icon, .top-icon .ui-icon { width: 19px; height: 19px; }
.top-user>span { width:42px; height:42px; border:1px solid color-mix(in srgb, var(--green) 20%, transparent); }
.store-switch>button { padding: 7px 9px; border-radius: 10px; transition: background .18s ease; }
.store-switch>button:hover { background: var(--surface-soft); }
.store-switch>button b { display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.store-switch .store-name { font-size: .92rem; line-height: 1.2; }
.store-switch>button .ui-icon { width: 16px; height: 16px; color: var(--green); transition: transform .18s ease; }
.store-switch>button:focus-visible { outline: 3px solid rgba(37,99,169,.2); }
.store-switch:has(.store-menu.open)>button .ui-icon { transform: rotate(180deg); }
.page-head h1, .v2-page-head h1 { font-size: clamp(1.85rem, 2.25vw, 2.3rem); line-height: 1.12; letter-spacing: -.045em; }
.page-head p { font-size: .86rem; line-height: 1.5; max-width: 650px; }
.panel-head h2 { font-size: 1.06rem; letter-spacing: -.015em; }
.panel-head p, .metric-grid-v2 span, .metric-grid-v2 small { font-size: .72rem; line-height: 1.45; }
.metric-grid-v2 article { min-height: 126px; display: flex; flex-direction: column; justify-content: center; }
.metric-grid-v2 strong { font-size: clamp(1.55rem, 2vw, 1.9rem); }
.leader-summary { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; color: #1d5c9e; font-size: .73rem; font-weight: 750; }
.leader-summary::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #2d7dcb; box-shadow: 0 0 0 4px rgba(45,125,203,.12); }
.product-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.product-status.leader { background: #e4effd; color: #1c5eaa; }
.catalog-image { background: linear-gradient(135deg, #f7fbff, #e8f1fb); }
.catalog-image img { padding: 5px; object-fit: contain; }
.row-save { display: inline-grid; place-items: center; font-size: 0; }
.row-save::before { content: "✓"; font-size: 1.1rem; line-height: 1; }
.v2-bottom-nav a .ui-icon { width: 21px; height: 21px; }
.v2-bottom-nav a { font-size: .64rem; font-weight: 650; letter-spacing: -.01em; }
html[data-theme="dark"] .theme-toggle:hover, html[data-theme="dark"] .top-icon:hover { background: #1c3759; }
html[data-theme="dark"] .kaspi-top-status { border-color:#245b49; background:#102b24; color:#86d9b0; }
html[data-theme="dark"] .kaspi-top-status.warning { border-color:#695122; background:#2c2516; color:#f1ca76; }
html[data-theme="dark"] .leader-summary { color: #91c6ff; }
html[data-theme="dark"] .product-status.leader { background: #173b67; color: #a8d2ff; }

@media (max-width: 720px) {
  .app-v2 { font-size: 16px; }
  .mobile-brand { display: flex; align-items: center; width: 118px; height: 38px; flex-basis: 118px; padding: 0 7px; border-radius: 11px; background: linear-gradient(135deg, #153d6d, #081c37); box-shadow: 0 6px 16px rgba(8,30,61,.22); }
  .mobile-brand img { width: 104px; height: 104px; left: 7px; top: -33px; }
  .v2-topbar { gap: 8px; }
  .top-actions { gap: 6px; }
  .theme-toggle, .top-icon { width: 36px; height: 36px; border-radius: 10px; }
  .kaspi-top-status { width:36px; min-height:36px; justify-content:center; padding:0; border-radius:10px; }
  .kaspi-top-status span { display:none; }
  .store-switch>button b { font-size: .74rem; }
  .page-head h1, .v2-page-head h1 { font-size: 1.7rem; }
  .page-head p { font-size: .82rem; }
  .leader-summary { margin-top: 8px; }
  .metric-grid-v2 article { min-height: 112px; }
  .metric-grid-v2 strong { font-size: 1.42rem; }
  .v2-bottom-nav { height: 68px; left: 8px; right: 8px; bottom: 8px; border-radius: 18px; padding: 0 3px; }
  .v2-bottom-nav a { min-width: 0; flex: 1; gap: 4px; font-size: .6rem; color: #718099; }
  .v2-bottom-nav a.active { color: var(--green); }
  .v2-bottom-nav a.active .ui-icon { stroke-width: 2.25; }
}

@media (max-width: 400px) {
  .mobile-brand { width: 102px; flex-basis: 102px; transform: scale(.9); transform-origin: left center; margin-right: -10px; }
  .store-switch>button b { max-width: 82px; }
  .v2-bottom-nav a { font-size: .55rem; }
  .v2-bottom-nav a .ui-icon { width: 20px; height: 20px; }
}

/* Mobile dashboard: never let wide tables stretch the page horizontally. */
@media (min-width: 721px) {
  .v2-sidebar nav .ui-icon { color: #fff; }
}

@media (max-width: 720px) {
  :root { font-size: 16px; }
  html, body { max-width: 100%; overflow-x: hidden; }
  .v2-workspace, .dashboard-grid-v2, .panel, .metric-grid-v2, .compact-table, .order-list, .event-list { min-width: 0; max-width: 100%; }
  .v2-workspace { padding-left: 14px; padding-right: 14px; }
  .v2-topbar { height: 70px; margin-left: -14px; margin-right: -14px; padding-left: 14px; padding-right: 14px; }
  .mobile-brand { width: 112px; height: 34px; flex-basis: 112px; padding: 0 5px; border: 1px solid rgba(122,180,239,.35); border-radius: 10px; background: #0c315d; box-shadow: 0 5px 14px rgba(7,31,62,.18); }
  .mobile-brand img { width: 102px; height: 102px; top: -37px; left: 5px; }
  .v2-sidebar nav .ui-icon { color: #fff; }
  .v2-bottom-nav .ui-icon, .v2-bottom-nav a .ui-icon { color: #2b6eb7 !important; stroke: currentColor !important; }
  .v2-bottom-nav a { color: #66758b; font-size: .61rem; }
  .v2-bottom-nav a.active { color: #1e5f9f; }
  .metric-grid-v2 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric-grid-v2 article { min-height: 112px; padding: 15px; }
  .metric-grid-v2 span, .metric-grid-v2 small { font-size: .7rem; }
  .metric-grid-v2 strong { margin: 7px 0 4px; font-size: 1.48rem; }
  .dashboard-grid-v2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .dashboard-grid-v2 .span-2 { grid-column: auto; }
  .panel { padding: 17px 15px; border-radius: 15px; }
  .panel-head { margin-bottom: 13px; }
  .panel-head h2 { font-size: 1.1rem; line-height: 1.2; }
  .panel-head p { font-size: .78rem; }
  .compact-table { overflow: hidden; }
  .compact-head { display: none; }
  .compact-row { min-width: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 12px; padding: 13px 0; }
  .compact-row .product-cell { grid-column: 1 / -1; display: grid; grid-template-columns: 50px minmax(0, 1fr); gap: 10px; align-items: center; }
  .compact-row .product-image { width: 48px; height: 48px; border-radius: 10px; }
  .compact-row .product-cell b { font-size: .8rem; line-height: 1.28; }
  .compact-row .product-cell small { font-size: .67rem; }
  .compact-row > b { position: relative; display: flex; flex-direction: column; gap: 2px; padding-top: 15px; min-width: 0; font-size: .76rem; }
  .compact-row > b::before { position: absolute; top: 0; left: 0; color: var(--muted); font-size: .57rem; font-weight: 750; text-transform: uppercase; letter-spacing: .045em; }
  .compact-row > b:nth-of-type(1)::before { content: "Ваша цена"; }
  .compact-row > b:nth-of-type(2)::before { content: "Мин. Kaspi"; }
  .compact-row > b:nth-of-type(3)::before { content: "Остаток"; }
  .compact-row > b:nth-of-type(4)::before { content: "Рекомендация"; }
  .compact-row > b:nth-of-type(4) { grid-column: 1 / -1; }
  .order-list > div { grid-template-columns: minmax(0,1fr) auto; gap: 8px; padding: 14px 2px; }
  .order-list span, .order-list strong, .order-list em { min-width: 0; }
  .order-list b, .order-list strong { font-size: .8rem; }
  .order-list small, .order-list em { font-size: .7rem; }
  .event-list > div { align-items: flex-start; padding: 12px 2px; min-width: 0; }
  .event-list span { min-width: 0; }
  .event-list b { font-size: .72rem; line-height: 1.36; overflow-wrap: anywhere; }
  .event-list small { font-size: .66rem; }
  .warehouse-head { display: block; }
  .warehouse-head .search-inline { margin-top: 13px; width: 100%; }
  .warehouse-head .search-inline input { min-width: 0; }
  .warehouse-head .search-inline select { width: 100%; min-width: 0; }
  .warehouse-bulk { grid-template-columns: 1fr 1fr; gap: 9px; padding: 14px; }
  .bulk-copy { grid-column: 1 / -1; }
  .warehouse-bulk label { min-width: 0; }
  .warehouse-bulk .button { font-size: .7rem; padding: 9px 8px; }
  .warehouse-panel { border: 0; background: transparent; box-shadow: none; padding: 0; }
  .warehouse-editor { overflow: visible; }
  .warehouse-editor-head { display: none; }
  .warehouse-table .warehouse-editor-row { min-width: 0; display: grid; grid-template-columns: 28px minmax(0,1fr); gap: 10px; margin-bottom: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
  .warehouse-editor .row-select { grid-column: 1; grid-row: 1; align-self: start; padding-top: 4px; }
  .warehouse-editor .product-cell { grid-column: 2; grid-row: 1; }
  .warehouse-sku { grid-column: 1 / -1; padding-top: 9px; border-top: 1px solid var(--line); font-size: .68rem; }
  .warehouse-stock, .warehouse-field { position: relative; padding-top: 17px; }
  .warehouse-stock::before, .warehouse-field::before { content: attr(data-label); position: absolute; top: 0; left: 0; color: var(--muted); font-size: .58rem; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; }
  .warehouse-stock { grid-column: 1; }
  .warehouse-stock::before { content: "Остаток"; }
  .warehouse-field { grid-column: 2; }
  .warehouse-field:nth-of-type(3) { grid-column: 1 / -1; }
  .warehouse-field input { height: 42px; font-size: .8rem; }
  .warehouse-editor-row .row-save { grid-column: 1 / -1; width: 100%; height: 44px; }
}
}

/* Decision centre / BESSA AI */
.dashboard-decision-callout, .decision-hero { display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:16px; margin:14px 0; padding:16px 19px; border:1px solid #bfd7f2; border-radius:16px; background:linear-gradient(110deg,#edf6ff 0%,#f9fcff 58%,#e7f2ff 100%); box-shadow:0 12px 28px rgba(27,84,143,.08); }
.dashboard-decision-callout .eyebrow { display:block; margin-bottom:3px; font-size:.61rem; }
.dashboard-decision-callout b { display:block; color:#12365f; font-size:.98rem; }
.dashboard-decision-callout p, .decision-hero p { margin:3px 0 0; color:#53718f; font-size:.78rem; }
.decision-orbit { width:42px; height:42px; position:relative; display:grid; place-items:center; flex:0 0 auto; border:1px solid rgba(51,123,197,.2); border-radius:14px; background:#d9ecff; }
.decision-orbit::before, .decision-orbit::after, .decision-orbit span { content:""; position:absolute; border-radius:50%; background:#2670be; }
.decision-orbit::before { width:9px; height:9px; box-shadow:0 0 0 5px rgba(38,112,190,.12); }
.decision-orbit::after { width:4px; height:4px; right:9px; top:9px; background:#73b5f3; }
.decision-orbit span { width:3px; height:3px; left:10px; bottom:10px; background:#73b5f3; }
.decisions-head .button { align-self:center; }
.decision-hero { margin-top:0; padding:20px; }
.decision-hero .decision-orbit { width:52px; height:52px; border-radius:17px; }
.decision-hero > div:nth-child(2) b { display:block; color:#12365f; font-size:1.04rem; }
.decision-health { min-width:175px; padding-left:18px; border-left:1px solid #c8dcf1; }
.decision-health b { display:block; color:#1d5f9f; font-size:1.25rem; line-height:1.1; }
.decision-health small { color:#557492; font-size:.7rem; line-height:1.35; }
.decision-tabs { display:flex; gap:8px; margin:17px 0 14px; overflow-x:auto; padding-bottom:2px; }
.decision-tabs a { display:inline-flex; flex:0 0 auto; align-items:center; gap:7px; padding:8px 11px; border:1px solid var(--line); border-radius:10px; background:var(--surface); color:var(--muted); font-size:.76rem; font-weight:700; }
.decision-tabs a b { display:grid; min-width:19px; height:19px; place-items:center; padding:0 5px; border-radius:8px; background:var(--surface-soft); color:var(--green); font-size:.65rem; }
.decision-tabs a.active { border-color:#92bce6; background:#e9f4ff; color:#1d5f9f; }
.decision-list { padding-bottom:4px; }
.decision-count { color:var(--muted); font-size:.72rem; font-weight:650; }
.decision-card { display:grid; grid-template-columns:10px minmax(190px,.9fr) minmax(260px,1.7fr) auto; align-items:center; gap:16px; padding:14px 2px; border-top:1px solid var(--line); }
.decision-card:first-of-type { border-top:0; }
.decision-level { width:8px; height:8px; border-radius:50%; background:#7daedc; box-shadow:0 0 0 4px rgba(125,174,220,.13); }
.decision-card.danger .decision-level { background:#db4d62; box-shadow:0 0 0 4px rgba(219,77,98,.12); }
.decision-card.attention .decision-level { background:#d79828; box-shadow:0 0 0 4px rgba(215,152,40,.12); }
.decision-card.opportunity .decision-level { background:#2c84cb; box-shadow:0 0 0 4px rgba(44,132,203,.12); }
.decision-product { display:flex; align-items:center; gap:10px; min-width:0; }
.decision-product .product-image { width:42px; height:42px; flex:0 0 42px; }
.decision-product span, .decision-copy { min-width:0; }
.decision-product b, .decision-copy b { display:block; color:var(--ink); font-size:.78rem; line-height:1.3; }
.decision-product small { display:block; margin-top:2px; color:var(--muted); font-size:.65rem; overflow-wrap:anywhere; }
.decision-copy p { margin:3px 0 0; color:var(--muted); font-size:.71rem; line-height:1.45; }
.decision-card .button { white-space:nowrap; font-size:.71rem; }
.decision-empty { padding:42px 20px; }
.decision-empty .decision-orbit { margin:0 auto 14px; }
.decision-rules { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; margin-top:14px; }
.decision-rules article { padding:15px; border:1px solid var(--line); border-radius:13px; background:var(--surface); }
.decision-rules b { color:var(--ink); font-size:.8rem; }
.decision-rules p { margin:5px 0 0; color:var(--muted); font-size:.7rem; line-height:1.45; }
html[data-theme="dark"] .dashboard-decision-callout, html[data-theme="dark"] .decision-hero { border-color:#2b5785; background:linear-gradient(110deg,#102a48,#0f1f34 60%,#102a48); }
html[data-theme="dark"] .dashboard-decision-callout b, html[data-theme="dark"] .decision-hero > div:nth-child(2) b { color:#cbe5ff; }
html[data-theme="dark"] .dashboard-decision-callout p, html[data-theme="dark"] .decision-hero p, html[data-theme="dark"] .decision-health small { color:#9db4ce; }
html[data-theme="dark"] .decision-orbit { background:#153b63; border-color:#346a9e; }
html[data-theme="dark"] .decision-health { border-color:#315777; }
html[data-theme="dark"] .decision-tabs a.active { background:#163b62; border-color:#2c639a; color:#a7d3ff; }
.dashboard-insights { overflow:hidden; margin:14px 0; border:1px solid #c7dcef; border-radius:18px; background:var(--surface); box-shadow:var(--shadow); }
.insight-intro { display:grid; grid-template-columns:auto minmax(0,1fr) auto auto; align-items:center; gap:15px; padding:18px 20px; background:linear-gradient(105deg,#eaf5ff 0%,#f8fbff 52%,#eef6ff 100%); }
.insight-intro .eyebrow { display:block; margin-bottom:3px; font-size:.6rem; }
.insight-intro h2 { margin:0; color:#12365f; font-size:1.04rem; letter-spacing:-.02em; }
.insight-intro p { max-width:550px; margin:4px 0 0; color:#557492; font-size:.73rem; line-height:1.45; }
.catalog-health { display:flex; align-items:center; gap:8px; padding:3px 17px; border-right:1px solid #c8ddf0; border-left:1px solid #c8ddf0; }
.catalog-health b { color:#205f9e; font-size:1.35rem; letter-spacing:-.04em; }
.catalog-health span { color:#5b7692; font-size:.64rem; line-height:1.25; }
.insight-intro .button { white-space:nowrap; }
.insight-alerts { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:0; }
.insight-alert { position:relative; display:grid; grid-template-columns:11px minmax(0,1fr); column-gap:10px; min-height:142px; padding:17px 16px 15px; border-right:1px solid var(--line); background:var(--surface); }
.insight-alert:last-child { border-right:0; }
.insight-mark { width:8px; height:8px; margin-top:4px; border-radius:50%; background:#86a9c9; box-shadow:0 0 0 4px rgba(134,169,201,.12); }
.insight-alert small { display:block; color:var(--muted); font-size:.66rem; font-weight:750; line-height:1.3; }
.insight-alert b { display:block; margin:5px 0 3px; color:var(--ink); font-size:1.32rem; line-height:1; letter-spacing:-.04em; }
.insight-alert p { min-height:33px; margin:0; color:var(--muted); font-size:.66rem; line-height:1.35; }
.insight-alert a { align-self:end; grid-column:2; margin-top:8px; color:var(--green); font-size:.68rem; font-weight:800; }
.insight-alert a span { margin-left:2px; }
.insight-alert.red { background:linear-gradient(145deg,#fffafa,#fff 60%); }
.insight-alert.red .insight-mark { background:#db5264; box-shadow:0 0 0 4px rgba(219,82,100,.12); }
.insight-alert.red b { color:#c0374a; }
.insight-alert.amber { background:linear-gradient(145deg,#fffdf8,#fff 60%); }
.insight-alert.amber .insight-mark { background:#d6992a; box-shadow:0 0 0 4px rgba(214,153,42,.12); }
.insight-alert.amber b { color:#a66c11; }
.insight-alert.blue { background:linear-gradient(145deg,#f8fbff,#fff 60%); }
.insight-alert.blue .insight-mark { background:#2d7fc7; box-shadow:0 0 0 4px rgba(45,127,199,.12); }
.insight-alert.blue b { color:#2468aa; }
.insight-alert.slate .insight-mark { background:#7c91aa; }
.insight-alert.teal { background:linear-gradient(145deg,#f4fcfb,#fff 60%); }
.insight-alert.teal .insight-mark { background:#299d8d; box-shadow:0 0 0 4px rgba(41,157,141,.12); }
.insight-alert.teal b { color:#187568; }
.insight-alert.violet { background:linear-gradient(145deg,#faf9ff,#fff 60%); }
.insight-alert.violet .insight-mark { background:#7a68c7; box-shadow:0 0 0 4px rgba(122,104,199,.12); }
.insight-alert.violet b { color:#5e4ba9; }
.insight-alert.good { grid-column:1/-1; grid-template-columns:11px minmax(0,1fr) auto; min-height:104px; align-items:start; background:linear-gradient(110deg,#f3fbf7,#fff); }
.insight-alert.good .insight-mark { background:#33a870; box-shadow:0 0 0 4px rgba(51,168,112,.12); }
.insight-alert.good b { color:#1c794f; font-size:1rem; }
.insight-alert.good p { min-height:0; }
.insight-alert.good a { grid-column:auto; align-self:center; }
html[data-theme="dark"] .dashboard-insights { border-color:#2c567f; }
html[data-theme="dark"] .insight-intro { background:linear-gradient(105deg,#102e51,#0f1f34 54%,#102a48); }
html[data-theme="dark"] .insight-intro h2 { color:#c8e3ff; }
html[data-theme="dark"] .insight-intro p, html[data-theme="dark"] .catalog-health span { color:#9cb5d0; }
html[data-theme="dark"] .catalog-health { border-color:#315777; }
html[data-theme="dark"] .insight-alert.red { background:linear-gradient(145deg,#291b29,#0e1b2d 60%); }
html[data-theme="dark"] .insight-alert.amber { background:linear-gradient(145deg,#2d2618,#0e1b2d 60%); }
html[data-theme="dark"] .insight-alert.blue { background:linear-gradient(145deg,#102844,#0e1b2d 60%); }
html[data-theme="dark"] .insight-alert.teal { background:linear-gradient(145deg,#102e2a,#0e1b2d 60%); }
html[data-theme="dark"] .insight-alert.violet { background:linear-gradient(145deg,#251f43,#0e1b2d 60%); }
html[data-theme="dark"] .insight-alert.good { background:linear-gradient(110deg,#102e2a,#0e1b2d); }
@media (max-width:1080px) { .insight-intro { grid-template-columns:auto minmax(0,1fr) auto; } .catalog-health { display:none; } .insight-alerts { grid-template-columns:repeat(2,minmax(0,1fr)); } .insight-alert:nth-child(2) { border-right:0; } .insight-alert:nth-child(n+3) { border-top:1px solid var(--line); } }
@media (max-width:720px) { .dashboard-insights { margin:12px 0; border-radius:15px; } .insight-intro { grid-template-columns:auto minmax(0,1fr); padding:15px; gap:11px; } .insight-intro .decision-orbit { width:42px; height:42px; border-radius:13px; } .insight-intro h2 { font-size:.98rem; } .insight-intro p { font-size:.69rem; } .insight-intro .button { grid-column:1/-1; width:100%; } .insight-alerts { grid-template-columns:1fr; } .insight-alert { min-height:0; grid-template-columns:10px minmax(0,1fr) auto; align-items:start; padding:14px; border-right:0; border-top:1px solid var(--line); } .insight-alert:first-child { border-top:0; } .insight-alert p { min-height:0; max-width:410px; } .insight-alert a { grid-column:3; grid-row:1 / span 2; align-self:center; white-space:nowrap; } .insight-alert.good { grid-template-columns:10px minmax(0,1fr) auto; } .insight-alert.good a { grid-column:3; } }
@media (max-width:720px) { .v2-sidebar .nav-group-title { display:none; } .dashboard-decision-callout, .decision-hero { grid-template-columns:auto minmax(0,1fr); gap:11px; padding:15px; } .dashboard-decision-callout .button { grid-column:1/-1; width:100%; } .decision-hero .decision-health { grid-column:1/-1; min-width:0; padding:11px 0 0; border-left:0; border-top:1px solid #c8dcf1; } .decision-tabs { margin-top:13px; } .decision-card { grid-template-columns:9px minmax(0,1fr); gap:10px; padding:14px 0; } .decision-product { grid-column:2; } .decision-copy { grid-column:2; } .decision-card .button { grid-column:2; justify-self:start; } .decision-rules { grid-template-columns:1fr; } }

/* Orders and waybills: compact enough for daily work, but never hide the
   product composition or the margin behind a separate screen. */
.orders-table .simple-head,.orders-table .simple-row{grid-template-columns:1fr 1.65fr .72fr .78fr .95fr .8fr;min-width:1050px}
.documents-table .simple-head,.documents-table .simple-row{grid-template-columns:1fr 1.55fr .78fr .88fr 1.1fr;min-width:980px}
.order-items{display:flex!important;flex-direction:column;gap:3px;min-width:0}.order-items b{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.order-profit{display:flex!important;flex-direction:column;gap:3px}.order-profit b.positive{color:#147a55}.order-profit b.negative{color:#c94458}.documents-table .simple-row>span:last-child{display:flex;flex-direction:column;align-items:flex-start;gap:5px}.waybill-form{display:flex;align-items:center;gap:6px}.waybill-form label{display:flex;align-items:center;gap:4px;margin:0;font-size:.62rem;color:var(--muted)}.waybill-form input{width:44px;min-height:29px;padding:4px 5px;text-align:center}.document-guide{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:15px 17px;margin-bottom:14px;background:linear-gradient(105deg,#eef6ff,#fff)}.document-guide>div{display:flex;flex-direction:column;gap:4px}.document-guide b{font-size:.78rem}.document-guide small,.document-guide>span{color:var(--muted);font-size:.67rem;line-height:1.5}.document-guide>span{max-width:360px;text-align:right}
html[data-theme="dark"] .document-guide{background:linear-gradient(105deg,#102b4c,#0e1b2d)}
@media(max-width:720px){.document-guide{align-items:flex-start;flex-direction:column;gap:8px}.document-guide>span{text-align:left}.orders-table .simple-head,.orders-table .simple-row{min-width:930px}.documents-table .simple-head,.documents-table .simple-row{min-width:900px}}
