/* Final desktop theme. Component behavior stays in client-ui.css. */
:root, :root[data-theme] {
  font-family: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  --page:#eff2f5; --surface:#fff; --soft:#f5f7f9; --side:#111317;
  --ink:#17202d; --muted:#5d6877; --line:#dce2e9; --control:#c6ced8;
  --accent:#0052e8; --accent-hover:#0045c7; --accent-soft:#eaf1ff;
  --button-primary:#0052e8; --button-primary-hover:#0045c7; --on-accent:#fff;
  --success:#176347; --success-soft:#eaf6ef; --warning:#85520a; --warning-soft:#fff4df;
  --danger:#b52a3a; --danger-soft:#fff0f1; --focus-color:var(--accent);
  --gray-0:var(--surface); --gray-25:var(--surface); --gray-50:var(--soft); --gray-100:var(--soft);
  --gray-200:var(--line); --gray-300:var(--control); --gray-400:var(--muted); --gray-500:var(--muted);
  --gray-600:var(--muted); --gray-700:var(--ink); --gray-800:var(--ink); --gray-900:var(--ink);
  --blue:var(--accent); --blue-dark:var(--accent-hover); --blue-500:var(--accent); --blue-600:var(--accent-hover);
  --blue-50:var(--accent-soft); --blue-100:var(--accent-soft); --green:var(--success); --green-dark:var(--success);
  --teal:var(--success); --teal-600:var(--success); --teal-50:var(--success-soft);
  --amber:var(--warning); --amber-700:var(--warning); --amber-50:var(--warning-soft);
  --red:var(--danger); --red-600:var(--danger); --red-50:var(--danger-soft);
  --wb-canvas:var(--page); --wb-paper:var(--surface); --wb-soft:var(--soft); --wb-ink:var(--ink);
  --wb-muted:var(--muted); --wb-line:var(--line); --wb-primary:var(--accent); --wb-tint:var(--accent-soft);
  --wb-radius:8px; --wb-shadow:none; color-scheme:light;
}
:root[data-theme="graphite"], :root[data-theme="dark"] {
  --page:#171b22; --surface:#202630; --soft:#282f3b; --ink:#f0f3f8; --muted:#b0bbca;
  --line:#3b4656; --control:#657286; --accent:#9bbcff; --accent-hover:#c4d7ff; --accent-soft:#293b5f;
  --success:#93d8b8; --success-soft:#233e33; --warning:#f2c979; --warning-soft:#44391f;
  --danger:#ffb1bb; --danger-soft:#492b35; color-scheme:dark;
}
:root[data-theme="colorblind"] {
  --success:#24485f; --success-soft:#eaf0f5; --danger:#a34115; --danger-soft:#fff0e7;
}
html, body { background:var(--page); color:var(--ink); }
body { font-size:14px; line-height:1.55; margin:0; padding-bottom:0; caret-color:var(--accent); }
button, input, select, textarea { font-family:inherit; }
[hidden] { display:none!important; }
::selection { background:var(--accent-soft); color:var(--ink); }
::placeholder { color:var(--muted); opacity:1; }
* { scrollbar-width:thin; scrollbar-color:var(--control) var(--soft); }
:focus-visible { outline:2px solid var(--focus-color)!important; outline-offset:3px; }
.skip-workspace { position:fixed; left:16px; top:-80px; z-index:1000; padding:12px 20px; border-radius:6px; background:var(--button-primary); color:#fff; }
.skip-workspace:focus { top:12px; }
.app-shell { display:grid; grid-template-columns:204px minmax(0,1fr); min-height:100dvh; }
.sidebar { position:sticky; inset:0 auto auto 0; width:204px; height:100dvh; display:flex; flex-direction:column; gap:0; padding:26px 14px 18px; background:var(--side); color:#b2bac7; border:0; overflow-y:auto; }
.sidebar>* { flex-shrink:0; }
.sidebar .brand { display:flex; justify-content:flex-start; gap:10px; padding:0 10px 32px; color:#fff; }
.brand-mark { width:32px; height:32px; flex:none; background:var(--button-primary); color:#fff; border:0; border-radius:7px; }
.sidebar .brand>span:last-child { display:grid; gap:3px; font-size:15px; font-weight:650; letter-spacing:0; color:#fff; }
.sidebar .brand small { color:#b2bac7; font-size:10px; font-weight:500; letter-spacing:.04em; }
.sidebar .brand-word, .sidebar .brand-word b { color:#fff; }
.sidebar .side-label { display:block; padding:16px 12px 8px; color:#a7b0be; font-size:11px; letter-spacing:0; }
.sidebar .side-nav { display:grid; grid-template-columns:1fr; gap:5px; padding:0; overflow:visible; }
.sidebar .nav-item { position:relative; display:flex; flex-direction:row; width:100%; min-height:44px; height:auto; gap:10px; padding:10px 12px; justify-content:flex-start; border:0; border-radius:6px; background:transparent; color:#b2bac7; font-size:13px; font-weight:500; }
.sidebar .nav-item>span:not(.nav-icon) { display:block; }
.sidebar .nav-icon { width:18px; color:inherit; flex:none; }
.sidebar .nav-icon .lucide { width:18px; height:18px; }
.sidebar .nav-item:hover { background:#202630; color:#fff; }
.sidebar .nav-item.active { background:var(--button-primary); color:#fff; font-weight:600; }
.sidebar .nav-item.active:before { display:none; }
.sidebar .nav-item.active .nav-icon { color:inherit; }
.sidebar .nav-count { position:static; margin:0 0 0 auto; min-width:23px; padding:1px 5px; border:0; border-radius:4px; background:#282f39; color:#dbe1eb; font-size:11px; font-variant-numeric:tabular-nums; }
.sidebar .nav-item.active .nav-count { background:#ffffff25; color:#fff; }
.sidebar .side-spacer { display:block; flex:1; min-height:20px; }
.sidebar .side-settings { margin:0; }
.sidebar .service-state { display:block; margin-top:20px; color:#b2bac7; font-size:11px; }
.main-shell { min-width:0; padding:0; }
.application-footer { position:static; inset:auto; width:auto; padding:8px 20px; border:0; background:transparent; box-shadow:none; text-align:right; pointer-events:none; }
.application-footer>span { padding:0; border:0; background:transparent; color:var(--muted); }
.topbar { position:sticky; top:0; z-index:10; display:flex; flex-wrap:nowrap; align-items:center; justify-content:space-between; gap:16px; min-height:66px; height:66px; padding:0 28px; border-bottom:1px solid var(--line); background:var(--surface); }
.topbar .store-picker { display:flex; align-items:center; gap:10px; flex:0 1 300px; min-width:0; }
.topbar .store-picker>span { flex:none; color:var(--muted); font-size:12px; }
.topbar .store-picker select { min-width:140px; width:208px; max-width:100%; height:36px; min-height:36px; border-color:var(--line); border-radius:6px; background:var(--soft); font-size:13px; }
.topbar-actions { display:flex; flex-wrap:nowrap; align-items:center; justify-content:flex-end; gap:10px; min-width:0; flex:0 1 auto; }
.topbar-actions .session-user { display:block; max-width:130px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--muted); font-size:12px; }
.icon-button { display:inline-grid; place-items:center; width:36px; height:36px; min-height:36px; flex:none; padding:0; border:1px solid var(--line); border-radius:6px; background:var(--surface); color:var(--ink); }
.icon-button .lucide { width:17px; height:17px; }
.icon-button:hover { background:var(--soft); border-color:var(--control); }
.tenant-entitlement { min-height:36px; padding:4px 10px; gap:7px; border:0; border-radius:6px; background:var(--soft); color:var(--ink); }
.tenant-entitlement small { color:var(--muted); font-size:10px; }
.tenant-entitlement strong { font-size:12px; font-variant-numeric:tabular-nums; }
.workspace-menu { position:relative; }
.workspace-menu>summary { list-style:none; cursor:pointer; }
.workspace-menu>summary::-webkit-details-marker { display:none; }
.workspace-menu[open]>summary { background:var(--soft); }
.workspace-menu-panel { position:absolute; z-index:30; right:0; top:calc(100% + 10px); display:grid; gap:3px; min-width:184px; padding:6px; border:1px solid var(--line); border-radius:8px; background:var(--surface); box-shadow:0 10px 28px #09182e20; }
.workspace-menu-panel>button { display:flex; align-items:center; gap:10px; width:100%; min-height:38px; padding:9px 11px; border:0; border-radius:5px; background:transparent; color:var(--ink); text-align:left; font-size:13px; }
.workspace-menu-panel>button:hover { background:var(--soft); }
.workspace-menu-panel .lucide { width:16px; height:16px; }
.workspace-menu-panel #logout { color:var(--danger); }
.environment-strip { display:flex; align-items:center; gap:12px; min-height:46px; padding:8px 28px; border-bottom:1px solid var(--line); background:var(--warning-soft); color:var(--warning); font-size:12px; }
.environment-strip .automation-state { display:inline-flex; align-items:center; gap:7px; flex:none; color:inherit; font-size:12px; }
.environment-strip .automation-state .lucide { width:16px; height:16px; }
.environment-strip .environment-reason { min-width:0; max-width:none; flex:1; overflow:visible; white-space:normal; color:inherit; }
.environment-strip .secondary { min-height:30px; height:auto; font-size:12px; }
body[data-environment-state="READY"] .environment-strip,
body[data-environment-state="LOGGED_OUT"] .environment-strip,
.environment-strip[data-state="READY"], .environment-strip[data-state="LOGGED_OUT"] { display:none; }
.content-wrap, .wide-wrap { width:100%; max-width:1520px; padding:28px 28px 54px; margin-inline:auto; }
.narrow-wrap { max-width:1120px; }
.page-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:22px; }
.page-heading h1, .compact-heading h1, .settings-hero h1 { margin:0; color:var(--ink); font-size:25px; line-height:1.35; font-weight:650; letter-spacing:-.025em; }
.page-kicker, .panel-kicker, .workflow-route, .workspace-notes, .auth-layout-copy { display:none; }
.page-count { padding:5px 9px; border:1px solid var(--line); border-radius:5px; background:var(--surface); color:var(--muted); font-size:12px; white-space:nowrap; font-variant-numeric:tabular-nums; }
.primary, .secondary, button.danger { display:inline-flex; align-items:center; justify-content:center; gap:7px; min-height:38px; height:auto; padding:9px 14px; border-radius:6px; font-size:13px; line-height:1.4; font-weight:600; box-shadow:none; }
.primary { border:1px solid transparent; background:var(--button-primary); color:#fff; }
.primary:hover { background:var(--button-primary-hover); color:#fff; }
.secondary { border:1px solid var(--line); background:var(--surface); color:var(--ink); }
.secondary:hover { border-color:var(--control); background:var(--soft); }
.secondary.compact, .primary.compact { min-height:32px; height:auto; padding:6px 10px; font-size:12px; }
button.danger { border:1px solid var(--line); background:var(--surface); color:var(--danger); }
button.danger:hover { background:var(--danger-soft); border-color:var(--danger); }
button:disabled, button[aria-disabled="true"] { opacity:.48; cursor:not-allowed; }
.primary .lucide, .secondary .lucide, button.danger .lucide { width:16px; height:16px; flex:none; }
input:not([type=checkbox]):not([type=radio]), select, textarea { border-color:var(--control); border-radius:6px; color:var(--ink); background:var(--surface); font-size:13px; }
input:not([type=checkbox]):not([type=radio]), select { min-height:38px; }
input:focus, select:focus, textarea:focus { border-color:var(--accent); }
input[type=checkbox], input[type=radio] { accent-color:var(--button-primary); }
.source-composer { padding:24px; border:1px solid var(--line); border-radius:10px; background:var(--surface); box-shadow:none; }
.source-composer>label { color:var(--ink); font-size:14px; font-weight:600; }
.source-composer textarea { display:block; width:100%; height:310px; min-height:180px; margin-top:16px; padding:17px; border:1px solid var(--line); border-radius:6px; background:var(--soft); color:var(--ink); resize:vertical; font-size:14px; line-height:1.85; }
.composer-foot { display:flex; align-items:center; justify-content:space-between; gap:18px; padding-top:20px; }
.composer-foot .link-stats { display:flex; flex-wrap:wrap; gap:20px; margin:0; font-size:12px; color:var(--muted); }
.composer-foot .link-stats b { color:var(--ink); font-size:15px; font-weight:600; font-variant-numeric:tabular-nums; }
.composer-foot .primary { min-width:160px; min-height:42px; flex:none; }
.message { min-height:0; margin:12px 0 0; font-size:12px; }
.message:empty { display:none; }
.processing-overview, .settings-relation-summary, .queue-overview { overflow:hidden; border:1px solid var(--line); border-radius:8px; background:var(--surface); box-shadow:none; }
.processing-overview { margin-bottom:18px; }
.processing-toolbar, .pending-toolbar, .sku-selection-actions:first-of-type, .publication-selection { display:flex; flex-wrap:wrap; align-items:center; gap:12px; padding:12px 14px; border:1px solid var(--line); border-radius:7px; background:var(--surface); }
.processing-card, .sku-selection-card, .published-card, .pending-card, .task-card { border:1px solid var(--line); border-radius:8px; background:var(--surface); box-shadow:none; }
.data-table, .sourcing-scroll { overflow:auto; border:1px solid var(--line); border-radius:8px; background:var(--surface); }
th { color:var(--muted); background:var(--soft); font-size:12px; font-weight:600; }
td { font-size:13px; }
tbody tr:hover { background:var(--soft); }
.empty, .queue-empty, .ui-empty { border-radius:8px; background:var(--surface); color:var(--muted); }
.queue-empty, .ui-empty { padding:58px 24px; }
.queue-empty strong, .ui-empty strong { color:var(--ink); font-weight:600; }
.processing-source-group { overflow:hidden; margin-bottom:14px; border:1px solid var(--line); border-radius:8px; background:var(--surface); }
.processing-source-head { padding:12px 16px; background:var(--soft); border-bottom:1px solid var(--line); }
.processing-source-thumb { border-radius:5px; object-fit:contain; background:var(--surface); }
.processing-sku-list { padding:0 16px; }
.processing-sku-card { display:grid; grid-template-columns:22px 46px minmax(100px,1fr) minmax(90px,.6fr) auto; grid-template-areas:"select thumb main state actions"; align-items:center; gap:14px; padding:15px 0; border:0; border-bottom:1px solid var(--line); border-radius:0; background:var(--surface); box-shadow:none; }
.processing-sku-card:last-child { border-bottom:0; }
.processing-sku-card>label:first-child { grid-area:select; }
.processing-sku-thumb { grid-area:thumb; width:46px; height:58px; border:1px solid var(--line); border-radius:5px; object-fit:contain; background:var(--soft); }
.processing-sku-thumb img, .processing-source-thumb img { width:100%; height:100%; object-fit:contain; }
.processing-sku-main { grid-area:main; min-width:0; }
.processing-sku-state { grid-area:state; color:var(--muted); min-width:0; }
.processing-sku-actions { grid-area:actions; display:flex; align-items:center; justify-content:flex-end; gap:7px; flex-wrap:wrap; }
.processing-sku-actions button { min-height:32px; padding:6px 10px; font-size:12px; }
.processing-sku-main strong { font-weight:600; }
.processing-sku-main small { font-size:12px; color:var(--muted); }
.pending-list { overflow:visible; }
.product-row.pending-product-card { min-width:0; margin:0 0 16px; padding:0; overflow:hidden; border:1px solid var(--line); border-radius:8px; background:var(--surface); }
.pending-product-head { padding:16px 18px; border-bottom:1px solid var(--line); background:var(--surface); }
.pending-product-head .product-summary>img { object-fit:contain; background:var(--soft); }
.pending-product-fields { display:grid; grid-template-columns:minmax(0,.9fr) minmax(0,1fr) minmax(0,1.25fr); gap:20px; padding:18px; }
.pending-product-fields>.commercial-group { padding:0; border:0; border-radius:0; background:transparent; box-shadow:none; }
.pending-product-fields .group-fields { gap:10px; }
.pending-product-fields .table-field { min-width:0; }
.product-row.pending-product-card .pending-product-fields .group-fields>.table-field { grid-area:auto; }
.pending-product-fields .table-field .field-control { display:flex; min-height:36px; border-color:var(--control); border-radius:5px; background:var(--surface); }
.pending-product-fields .price-fields .group-fields { grid-template-columns:minmax(0,1fr) minmax(72px,.6fr); }
.pending-row-tail { padding:16px 18px; border-top:1px solid var(--line); background:var(--soft); }
.pending-quote-controls { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.pending-quote-summary { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:14px; padding-block:16px; border-top:1px solid var(--line); }
.pending-quote-summary strong { font-variant-numeric:tabular-nums; }
.pending-action-row { display:flex; flex-wrap:wrap; align-items:center; gap:10px; }
.publication-toolbar { padding:0 0 18px; }
.publication-filters { gap:10px; }
.publication-filters button { min-height:54px; border-radius:7px; }
.published-view-tabs { gap:22px; }
.published-view-tabs button { min-height:42px; font-weight:600; }
.published-row { display:grid; grid-template-columns:24px minmax(180px,1.4fr) minmax(100px,.7fr) minmax(120px,.7fr) auto; grid-template-areas:"check main state facts tail"; align-items:center; gap:14px; padding:16px; background:var(--surface); border-bottom:1px solid var(--line); }
.publication-check { grid-area:check; }
.publication-main { grid-area:main; }
.publication-state { grid-area:state; }
.publication-facts { grid-area:facts; }
.publication-tail { grid-area:tail; }
.published-row.published-head { padding-block:11px; background:var(--soft); color:var(--muted); font-size:12px; }
.published-row.is-selected { background:var(--accent-soft); }
.publication-main, .publication-product { min-width:0; }
.publication-thumb img { object-fit:contain; background:var(--soft); border-color:var(--line); }
.publication-state { min-width:0; font-size:12px; }
.publication-facts { font-size:12px; color:var(--muted); }
.publication-tail, .publication-actions { display:flex; align-items:center; justify-content:flex-end; gap:7px; flex-wrap:wrap; }
.publication-actions button { min-height:32px; padding:6px 10px; font-size:12px; }
.settings-hero { align-items:center; margin-bottom:22px; }
.settings-workspace { display:grid; grid-template-columns:172px minmax(0,1fr); align-items:start; gap:22px; }
.settings-sections { display:grid; gap:4px; padding:6px; border:1px solid var(--line); border-radius:8px; background:var(--surface); }
.settings-section-tab { display:flex; align-items:center; min-height:44px; gap:9px; padding:11px 12px; border:0; border-radius:5px; background:transparent; color:var(--muted); text-align:left; }
.settings-section-tab>span { flex:1; min-width:0; }
.settings-section-tab strong { font-size:13px; font-weight:550; }
.settings-section-tab small, .settings-section-tab b { display:none; }
.settings-section-tab .lucide { width:17px; height:17px; flex:none; }
.settings-section-tab:hover { background:var(--soft); color:var(--ink); }
.settings-section-tab.active { background:var(--accent-soft); color:var(--accent); }
.settings-panel-view { padding:22px; border:1px solid var(--line); border-radius:8px; background:var(--surface); box-shadow:none; }
.settings-panel-intro { padding-bottom:18px; margin-bottom:20px; border-bottom:1px solid var(--line); }
.settings-panel-intro h2 { font-size:18px; line-height:1.4; color:var(--ink); font-weight:600; }
.settings-panel-intro p { color:var(--muted); font-size:12px; }
.settings-field>span { color:var(--ink); font-size:13px; font-weight:550; }
.settings-field small, .settings-form-hint { color:var(--muted); line-height:1.65; font-size:12px; }
.settings-form-footer { padding-top:18px; margin-top:16px; border-top:1px solid var(--line); }
.settings-field-grid { gap:18px; }
.settings-list-heading { margin-top:26px; }
.settings-list-heading h3 { font-weight:600; }
.settings-panel-view .store-list { border:1px solid var(--line); border-radius:7px; overflow:hidden; }
.store-list .store-resource-row { display:grid; grid-template-columns:minmax(140px,1.1fr) minmax(90px,.65fr) minmax(140px,1fr); gap:15px; align-items:center!important; padding:16px; border-bottom:1px solid var(--line); background:var(--surface); }
.store-list .store-resource-row { grid-template-columns:minmax(140px,1.1fr) minmax(90px,.65fr) minmax(140px,1fr)!important; }
.store-list .store-resource-row:last-child { border-bottom:0; }
.store-list .store-resource-row .store-actions { grid-column:1/-1; display:flex; flex-wrap:wrap; gap:8px; padding-top:4px; justify-content:flex-end; }
.store-list .store-resource-row .default-warehouse { width:100%; max-width:100%; min-width:0; }
.store-list .store-card { border-radius:7px; }
.warehouse-status, .settings-state { border-radius:4px; }
.settings-relation-summary { margin-bottom:20px; }
.appearance-options { gap:10px; margin-block:20px; }
.appearance-options label { min-height:68px; padding:12px; border:1px solid var(--line); border-radius:7px; background:var(--surface); }
.appearance-options label:has(:checked) { border-color:var(--accent); background:var(--accent-soft); }
.appearance-options .theme-swatch { flex:none; border-radius:4px; }
.direction-prompt-item { margin-top:16px; padding:18px 0; border:0; border-top:1px solid var(--line); border-radius:0; background:transparent; }
.direction-prompt-item:first-child { margin-top:0; border-top:0; }
.direction-prompt-item textarea { background:var(--soft); }
.commercial-summary-grid>div { background:var(--soft); border-color:var(--line); border-radius:6px; }
.product-retention-policy { padding:16px 0 0; margin:20px 0 0; border-top:1px solid var(--line); color:var(--muted); font-size:12px; }
.data-screen-wrap, .store-data-wrap { padding:28px; color:var(--ink); }
.data-screen-head { margin-bottom:22px; padding-bottom:20px; border-bottom:1px solid var(--line); }
.data-screen-head h1 { font-size:25px; font-weight:650; color:var(--ink); }
.data-screen-wrap .ds-panel, .data-screen-wrap .metric-card, .store-data-wrap .ds-panel, .store-data-wrap .metric-card { border:1px solid var(--line); border-radius:8px; background:var(--surface); box-shadow:none; }
.data-screen-wrap .ds-panel::before, .data-screen-wrap .ds-panel::after, .data-screen-wrap .metric-card::before, .data-screen-wrap .metric-card::after { display:none; }
.data-screen-wrap .metric-card strong, .data-screen-wrap .metric-value { color:var(--ink); font-variant-numeric:tabular-nums; }
.data-screen-wrap .metric-label, .data-screen-wrap .ds-muted { color:var(--muted); }
.data-screen-wrap .ds-panel h2 { color:var(--ink); }
.data-screen-wrap .ds-toolbar input, .data-screen-wrap .ds-toolbar select { background:var(--surface); border-color:var(--control); }
.local-workspace-notice { background:var(--accent-soft); color:var(--ink); border-bottom:1px solid var(--line); font-size:12px; }
.auth-gate { background:var(--page); }
.auth-gate:not([hidden]) { display:flex; align-items:center; justify-content:center; }
.auth-card { width:min(420px,calc(100% - 32px)); padding:34px; border:1px solid var(--line); border-radius:10px; background:var(--surface); box-shadow:0 12px 36px #13243c0b; }
.auth-card h1 { font-size:25px; font-weight:650; margin-top:22px; }
.auth-card>p, .auth-card label { font-size:13px; color:var(--muted); }
.auth-card .primary { min-height:42px; }
.auth-card input { border-color:var(--control); }
.membership-gate-card { border:1px solid var(--line); border-radius:10px; background:var(--surface); }
dialog, .regenerate-dialog { border:1px solid var(--line); border-radius:10px; background:var(--surface); color:var(--ink); box-shadow:0 18px 64px #07142640; }
dialog::backdrop, .regenerate-dialog::backdrop { background:#0a142366; backdrop-filter:none; }
.modal-backdrop { background:#0a142366; backdrop-filter:none; }
.product-modal, .confirm-modal, .password-modal { border:1px solid var(--line); border-radius:10px; background:var(--surface); color:var(--ink); box-shadow:0 18px 64px #07142640; }
.modal-head { border-bottom:1px solid var(--line); }
#productModal .product-modal { width:min(1160px,calc(100vw - 40px)); max-width:none; max-height:calc(100dvh - 40px); display:flex; flex-direction:column; padding:0; overflow:hidden; }
#productModal .modal-head { flex:none; align-items:center; gap:16px; padding:18px 24px; margin:0; background:var(--surface); }
#productModal .modal-head h2 { margin:0; color:var(--ink); font-size:18px; line-height:1.5; font-weight:600; }
#productModal .product-form { display:flex; flex-direction:column; min-height:0; gap:0; padding:0 24px; overflow:auto; overscroll-behavior:contain; }
.product-editor-tabs { display:flex; flex:none; position:sticky; top:0; z-index:3; gap:20px; padding:0; border-bottom:1px solid var(--line); background:var(--surface); }
.product-editor-tabs button { flex:0 1 auto; min-height:50px; padding:10px 3px; border:0; border-bottom:2px solid transparent; border-radius:0; background:transparent; color:var(--muted); font-size:13px; font-weight:600; white-space:nowrap; }
.product-editor-tabs button:hover { background:transparent; color:var(--ink); }
.product-editor-tabs button[aria-selected="true"] { border-bottom-color:var(--accent); background:transparent; color:var(--accent); }
#productModal [data-editor-panel] { padding-block:22px; }
#productModal [data-editor-panel] h3 { margin:0 0 16px; font-size:15px; font-weight:600; }
#productModal .product-form label { font-size:13px; color:var(--muted); }
#productModal .product-form input, #productModal .product-form textarea, #productModal .product-form select { border-color:var(--control); background:var(--surface); color:var(--ink); }
#productModal .ozon-field-grid { gap:14px 22px; }
#productModal .ozon-field-grid label { padding:10px 0; }
#productModal .ozon-field-grid label.required>span:first-child { color:var(--ink); }
#productModal .modal-actions { position:sticky; bottom:0; z-index:4; flex:none; display:flex; gap:10px; align-items:center; margin:0; padding:14px 0; border-top:1px solid var(--line); background:var(--surface); }
#productModal .media-grid { display:block; max-height:none; overflow:visible; }
#mediaGrid .media-slot-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); max-height:none; gap:14px; overflow:visible; }
#mediaGrid .media-slot-card { border:1px solid var(--line); border-radius:7px; background:var(--surface); scroll-margin-top:66px; }
#mediaGrid .media-slot-card>header { padding:10px; border-bottom:1px solid var(--line); background:var(--soft); }
#mediaGrid .media-slot-card>header strong { color:var(--ink); font-size:12px; }
#mediaGrid .media-slot-card>header small { color:var(--muted); font-size:11px; }
#mediaGrid .media-slot-number { background:var(--accent-soft); color:var(--accent); font-family:inherit; font-variant-numeric:tabular-nums; }
#mediaGrid .media-image-frame { display:block; width:100%; height:auto; aspect-ratio:3/4; overflow:hidden; background:var(--soft); }
#mediaGrid .media-image-frame>img { display:block; width:100%; height:100%; object-fit:contain; }
#mediaGrid .media-slot-empty { background:var(--soft); }
#mediaGrid .media-slot-footer { align-items:center; flex-wrap:wrap; gap:7px; padding:8px 9px; }
#mediaGrid .media-slot-footer .secondary { min-height:30px; height:auto; padding:5px 8px; border-radius:5px; font-size:12px; }
#mediaGrid .media-slot-meta span { background:var(--soft); color:var(--muted); }
.media-card, .reference-image img { border-radius:6px; }
.media-primary-panel { border-color:var(--line); border-radius:7px; background:var(--surface); }
.media-primary-info strong { color:var(--ink); }
.regenerate-head { background:var(--surface); }
.regenerate-actions { background:var(--surface); }
.regenerate-body textarea { background:var(--soft); }
.regenerate-dialog .reference-image label { color:var(--ink); }
.regenerate-cost { border-color:var(--line); color:var(--muted); }
.regenerate-prompt-label { color:var(--ink); }
.media-redraw-overlay { background:var(--surface); }
.media-redraw-error { color:var(--danger); }
.modal-actions button, .regenerate-actions button { min-width:88px; }
@media (max-width:1199px) {
  .app-shell { grid-template-columns:172px minmax(0,1fr); }
  .sidebar { width:172px; padding-inline:10px; }
  .sidebar .brand { padding-inline:8px; gap:8px; }
  .sidebar .brand>span:last-child { font-size:13px; }
  .sidebar .brand small { font-size:9px; }
  .sidebar .nav-item { padding-inline:10px; gap:8px; font-size:12px; }
  .sidebar .nav-count { min-width:21px; font-size:10px; }
  .topbar { padding-inline:22px; gap:12px; }
  .topbar .store-picker { flex-basis:235px; gap:7px; }
  .topbar .store-picker select { width:166px; }
  .topbar-actions { gap:7px; }
  .topbar-actions .session-user { max-width:96px; }
  .content-wrap, .wide-wrap, .data-screen-wrap, .store-data-wrap { padding:24px 22px 48px; }
  .pending-product-fields { grid-template-columns:repeat(2,minmax(0,1fr)); gap:18px; }
  .pending-product-fields>.fulfillment-fields { grid-column:1/-1; }
  .pending-quote-summary { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .published-row { grid-template-columns:24px minmax(170px,1.5fr) minmax(100px,.8fr) auto; grid-template-areas:"check main state tail"; gap:12px; }
  .published-row .publication-facts { display:none; }
  .published-head>span:nth-child(4) { display:none; }
  #mediaGrid .media-slot-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
}
@media (max-width:960px) {
  .topbar { padding-inline:18px; }
  .topbar-actions .session-user { display:none; }
  .content-wrap, .wide-wrap, .data-screen-wrap, .store-data-wrap { padding:22px 18px 42px; }
  .environment-strip { flex-wrap:wrap; padding-inline:18px; gap:7px 12px; }
  .environment-strip .environment-reason { flex-basis:55%; }
  .environment-strip .secondary { margin-left:auto; }
  .processing-sku-card { grid-template-columns:22px 46px minmax(100px,1fr) minmax(80px,.6fr); grid-template-areas:"select thumb main state" ". . actions actions"; gap:10px 12px; }
  .processing-sku-actions { justify-content:flex-end; }
  .pending-quote-controls { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .settings-workspace { display:block; }
  .settings-sections { display:flex; flex-wrap:nowrap; overflow:auto; margin-bottom:16px; padding:5px; gap:4px; }
  .settings-section-tab { flex:0 0 auto; min-width:110px; min-height:40px; justify-content:center; padding:9px 12px; }
  .settings-section-tab>span { flex:none; }
  .settings-panel-view { padding:20px; }
  .store-list .store-resource-row { grid-template-columns:repeat(2,minmax(0,1fr))!important; }
  .store-list .store-resource-row .store-actions { justify-content:flex-start; }
  .settings-panel-view .settings-field-grid { grid-template-columns:1fr; }
  .settings-field-wide { grid-column:auto; }
  #productModal .product-modal { width:calc(100vw - 28px); max-height:calc(100dvh - 28px); }
  #productModal .modal-head { padding:16px 20px; }
  #productModal .product-form { padding-inline:20px; }
  #productModal .modal-actions { gap:8px; }
}
@media (max-width:699px) {
  body { padding-bottom:0; }
  .app-shell { display:grid; grid-template-columns:64px minmax(0,1fr); }
  .sidebar { position:sticky; inset:0 auto auto 0; display:flex; flex-direction:column; width:64px; height:100dvh; gap:0; padding:22px 8px 14px; border:0; }
  .sidebar .brand { display:flex; padding:0 8px 24px; }
  .sidebar .brand-mark { width:32px; height:32px; }
  .sidebar .brand>span:last-child, .sidebar .brand-word, .sidebar .side-label, .sidebar .service-state { display:none; }
  .sidebar .side-nav { display:grid; grid-template-columns:1fr; width:100%; flex:none; gap:6px; padding:0; overflow:visible; }
  .sidebar .nav-item, .sidebar #settingsNav { width:100%; min-height:44px; display:flex; flex-direction:row; justify-content:center; gap:0; padding:10px 0; }
  .sidebar .nav-item>span:not(.nav-icon), .sidebar .nav-item .nav-count { display:none; }
  .sidebar .side-spacer { display:block; flex:1; }
  .main-shell { padding:0; }
  .topbar { min-height:62px; height:auto; padding:10px 14px; gap:8px; flex-wrap:nowrap; }
  .topbar .store-picker { flex:1 1 auto; width:auto; gap:0; }
  .topbar .store-picker>span { display:none; }
  .topbar .store-picker select { width:100%; min-width:0; max-width:none; }
  .topbar-actions { flex:0 0 auto; flex-basis:auto; justify-content:flex-end; gap:6px; }
  .topbar .tenant-entitlement { display:none; }
  .topbar .icon-button { width:34px; height:34px; min-height:34px; }
  .environment-strip { align-items:center; padding:10px 14px; }
  .environment-strip .automation-state { flex-basis:100%; }
  .environment-strip .environment-reason { flex-basis:60%; font-size:11px; }
  .environment-strip .secondary { padding-inline:8px; }
  .content-wrap, .wide-wrap, .data-screen-wrap, .store-data-wrap { padding:22px 14px 36px; }
  .page-heading { align-items:center; flex-wrap:wrap; margin-bottom:18px; }
  .page-heading h1, .compact-heading h1, .settings-hero h1, .data-screen-head h1 { font-size:22px; }
  .source-composer { padding:18px; }
  .source-composer textarea { height:280px; padding:13px; }
  .composer-foot { flex-direction:column; align-items:stretch; gap:18px; }
  .composer-foot .link-stats { gap:18px; }
  .composer-foot .primary { width:100%; }
  .processing-source-head { padding:12px; }
  .processing-sku-list { padding-inline:12px; }
  .processing-sku-card { grid-template-columns:18px 42px minmax(0,1fr); grid-template-areas:"select thumb main" ". . state" ". actions actions"; gap:9px; }
  .processing-sku-thumb { width:42px; height:54px; }
  .processing-sku-actions { justify-content:flex-start; }
  .pending-product-fields { grid-template-columns:1fr; padding:16px; gap:20px; }
  .pending-product-fields>.fulfillment-fields { grid-column:auto; }
  .pending-product-head, .pending-row-tail { padding:14px 16px; }
  .pending-quote-controls, .pending-quote-summary { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .pending-action-row { align-items:stretch; }
  .pending-action-row>button { flex:1 1 120px; }
  .published-row { grid-template-columns:22px minmax(0,1fr) auto; grid-template-areas:"check main state" ". tail tail"; gap:10px; padding:14px 12px; }
  .published-row>label:first-child { grid-area:check; }
  .published-row .publication-main { grid-area:main; }
  .published-row .publication-state { grid-area:state; }
  .published-row .publication-tail { grid-area:tail; }
  .published-row.published-head { display:none; }
  .publication-filters { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
  .publication-filters button { min-width:0; }
  .published-view-tabs { gap:14px; overflow:auto; }
  .published-view-tabs button { flex:none; font-size:12px; }
  .settings-sections { margin-bottom:14px; }
  .settings-section-tab { min-width:100px; }
  .settings-panel-view { padding:18px; }
  .store-list .store-resource-row { grid-template-columns:1fr!important; padding:14px; }
  .store-list .store-resource-row .store-actions { grid-column:auto; }
  .appearance-options label { flex-wrap:wrap; gap:10px; }
  .appearance-options label>span:last-child:not(.theme-swatch) { margin-left:28px; }
  .commercial-summary-grid { grid-template-columns:1fr 1fr; }
  .auth-card { padding:28px; }
  #productModal .product-modal { width:calc(100vw - 16px); max-height:calc(100dvh - 16px); }
  #productModal .modal-head { padding:14px 16px; }
  #productModal .product-form { padding-inline:16px; }
  .product-editor-tabs { gap:12px; overflow-x:auto; }
  .product-editor-tabs button { flex:none; min-height:46px; font-size:12px; }
  #productModal .modal-actions { flex-wrap:wrap; gap:8px; }
  #productModal .modal-actions .toolbar-spacer { flex-basis:30%; }
  #productModal .modal-actions button { min-width:0; font-size:12px; }
  #mediaGrid .media-slot-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
  #mediaGrid .media-slot-card>header { padding:8px; }
  #mediaGrid .media-slot-footer { align-items:stretch; flex-direction:column; }
  #mediaGrid .media-slot-footer label { min-height:24px; }
  .regenerate-references { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (min-width:700px) and (max-height:700px) {
  .sidebar { padding-block:16px 12px; }
  .sidebar .brand { padding-bottom:16px; }
  .sidebar .side-label, .sidebar .service-state { display:none; }
  .sidebar .side-nav { gap:3px; }
  .sidebar .side-nav + .side-nav { margin-top:12px; }
  .sidebar .nav-item { min-height:38px; padding-block:8px; }
  .sidebar .side-spacer { min-height:12px; }
}
@media (prefers-reduced-motion:reduce) {
  *, *::before, *::after { animation-duration:0s!important; transition-duration:0s!important; scroll-behavior:auto!important; }
}
