:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-muted: #f0f4f9;
  --surface-soft: #eaf1fb;
  --ink: #151923;
  --muted: #657181;
  --muted-strong: #3f4a59;
  --line: #dbe3ed;
  --line-strong: #c3cedb;
  --accent: #1264dc;
  --accent-strong: #0b55c7;
  --accent-soft: #e7f0ff;
  --success: #20833b;
  --success-soft: #d8ead9;
  --danger: #c53346;
  --danger-soft: #f3d0d4;
  --warning: #a66a00;
  --warning-soft: #fff3cf;
  --sidebar: #ffffff;
  --sticky-bg: #ffffff;
  --table-head-id-bg: #ffffff;
  --table-head-orders-bg: #edf4ff;
  --table-head-revenue-bg: #eaf6ee;
  --table-head-expenses-bg: #fff0f2;
  --table-head-payout-bg: #fff7dc;
  --table-head-delta-bg: #eef3f9;
  --shadow: 0 12px 28px rgba(21, 31, 48, 0.08);
  --radius: 8px;
  --topbar-height: 52px;
  --sidebar-width: 60px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101721;
  --surface: #172131;
  --surface-muted: #1f2b3b;
  --surface-soft: #223249;
  --ink: #f3f6fa;
  --muted: #9aa9bb;
  --muted-strong: #c7d2df;
  --line: #2d3c4f;
  --line-strong: #44576c;
  --accent: #6aa6ff;
  --accent-strong: #8bb9ff;
  --accent-soft: rgba(106, 166, 255, 0.16);
  --success: #6fc986;
  --success-soft: rgba(111, 201, 134, 0.18);
  --danger: #ff8090;
  --danger-soft: rgba(255, 128, 144, 0.18);
  --warning: #ffd071;
  --warning-soft: rgba(255, 208, 113, 0.16);
  --sidebar: #121b27;
  --sticky-bg: #172131;
  --table-head-id-bg: #172131;
  --table-head-orders-bg: #202d43;
  --table-head-revenue-bg: #1d332f;
  --table-head-expenses-bg: #342433;
  --table-head-payout-bg: #342f22;
  --table-head-delta-bg: #202b3a;
  --shadow: 0 14px 36px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

body {
  overflow-x: hidden;
}

body:has(.stock-workspace) {
  overflow-x: auto;
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.shell {
  min-height: 100vh;
  background: var(--bg);
}

.shell-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
  box-shadow: 4px 0 18px rgba(20, 32, 48, 0.04);
  transition: width 160ms ease;
}

.shell-sidebar:hover,
.shell.nav-open .shell-sidebar {
  width: 224px;
}

.sidebar-brand {
  display: flex;
  min-height: var(--topbar-height);
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.brand-mark {
  display: inline-grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  border-radius: 10px;
  background: transparent;
  color: var(--accent);
  font-weight: 800;
  line-height: 1;
}

.brand-mark svg {
  display: block;
  width: 100%;
  height: 100%;
}

.brand-name {
  font-size: 1.08rem;
  font-weight: 800;
  white-space: nowrap;
}

.shell-nav-list {
  display: grid;
  gap: 4px;
  padding: 12px 8px;
}

.nav-link {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  border-radius: var(--radius);
  color: var(--muted-strong);
  text-decoration: none;
  transition:
    background 140ms ease,
    color 140ms ease;
  padding: 0 12px;
}

.nav-link svg {
  flex: 0 0 auto;
}

.nav-link span,
.brand-name {
  opacity: 0;
  transform: translateX(-4px);
  transition:
    opacity 140ms ease,
    transform 140ms ease;
}

.shell-sidebar:hover .nav-link span,
.shell.nav-open .nav-link span,
.shell-sidebar:hover .brand-name,
.shell.nav-open .brand-name {
  opacity: 1;
  transform: translateX(0);
}

.nav-link:hover {
  background: var(--surface-muted);
  color: var(--ink);
}

.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.sidebar-footer {
  margin-top: auto;
  padding: 10px;
  border-top: 1px solid var(--line);
}

.shell-main {
  min-height: 100vh;
  padding-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  min-height: var(--topbar-height);
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  padding: 0 18px;
  backdrop-filter: blur(14px);
}

:root[data-theme="dark"] .topbar {
  background: rgba(18, 27, 39, 0.9);
}

.topbar-brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.topbar-brand .brand-mark {
  display: none;
}

.topbar-brand strong {
  display: block;
  font-size: 1.02rem;
  line-height: 1.1;
}

.topbar-brand span {
  display: block;
  max-width: 620px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions,
.toolbar,
.finance-actions,
.hero-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.topbar-chip,
.compact-select,
.profile-chip,
.toolbar-group {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted-strong);
  padding: 7px 10px;
  white-space: nowrap;
}

.topbar-chip.success {
  border-color: rgba(32, 131, 59, 0.22);
  background: var(--success-soft);
  color: var(--success);
}

.compact-select select,
.toolbar-group select,
.toolbar select,
.toolbar input,
.search-box input,
.search-box select,
.search-box textarea,
.login-form input {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  outline: none;
  padding: 7px 10px;
}

.compact-select {
  padding: 0 8px;
}

.compact-select select {
  min-height: 30px;
  border: 0;
  background: transparent;
  padding: 0;
}

.profile-chip {
  max-width: 210px;
}

.profile-chip span {
  overflow: hidden;
  color: var(--muted-strong);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button,
.toolbar-button,
.delete-button,
.link-button,
.picker-item,
.run-card,
.drop-cell {
  cursor: pointer;
}

.icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted-strong);
}

.icon-button:hover,
.toolbar-button:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.secondary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted-strong);
  padding: 0 11px;
  font-weight: 800;
  cursor: pointer;
}

.secondary-button:hover,
.ghost-button:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  padding: 0 11px;
  font-weight: 800;
  cursor: pointer;
}

.primary-action:hover {
  background: var(--accent-strong);
}

.secondary-button:disabled,
.ghost-button:disabled,
.primary-action:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.ghost-button {
  background: transparent;
}

.compact-button {
  min-height: 30px;
  padding-inline: 9px;
  font-size: 0.78rem;
}

.nav-toggle {
  display: none;
}

.mobile-nav {
  display: none;
}

.content-area {
  width: 100%;
  min-width: 0;
  padding: 18px 22px 42px;
}

.page-header,
.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.page-header.compact {
  margin-bottom: 8px;
}

.page-header h1,
.hero h1,
.login-panel h1 {
  margin: 3px 0 0;
  font-size: clamp(1.35rem, 2vw, 1.9rem);
  line-height: 1.15;
  letter-spacing: 0;
}

.page-header p,
.hero p {
  max-width: 880px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.hero-eyebrow {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.page-toolbar {
  margin: 10px 0 12px;
}

.toolbar {
  justify-content: flex-start;
  align-items: stretch;
  width: 100%;
}

.dashboard-toolbar {
  align-items: center;
  gap: 10px;
}

.toolbar-group {
  flex: 0 1 auto;
  padding: 0 9px;
}

.dashboard-toolbar .toolbar-group {
  min-height: 42px;
  padding: 4px;
}

.dashboard-toolbar .toolbar-field {
  display: grid;
  grid-template-columns: auto minmax(132px, 1fr);
}

.dashboard-toolbar .period-control {
  grid-template-columns: auto minmax(210px, 1fr);
}

.dashboard-toolbar .comparison-control {
  grid-template-columns: auto minmax(210px, 1fr);
}

.dashboard-toolbar .toolbar-segment {
  gap: 5px;
}

.toolbar-group span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.toolbar-group.compact {
  padding: 3px;
}

.toolbar-accounts {
  max-width: min(100%, 620px);
}

.dashboard-toolbar .toolbar-accounts {
  max-width: none;
}

.toolbar-button,
.delete-button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted-strong);
  padding: 7px 11px;
  text-decoration: none;
  white-space: nowrap;
}

.toolbar-group select {
  max-width: min(34vw, 260px);
}

.dashboard-toolbar .toolbar-group select {
  width: 100%;
  max-width: none;
  min-width: 0;
}

.toolbar-group .toolbar-button {
  min-height: 32px;
  padding: 6px 10px;
}

.toolbar-button.active,
.toolbar-button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.delete-button {
  min-height: 28px;
  color: var(--danger);
  padding: 5px 9px;
}

.session-banner {
  margin-bottom: 12px;
  border: 1px solid var(--warning-soft);
  border-radius: var(--radius);
  background: var(--warning-soft);
  color: var(--warning);
  padding: 10px 12px;
}

.session-banner.danger,
.panel.error,
.login-error {
  border-color: rgba(197, 51, 70, 0.28);
  background: var(--danger-soft);
  color: var(--danger);
}

.info-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 12px;
  border: 1px solid #f2d47b;
  border-radius: var(--radius);
  background: #fff4b8;
  color: #5f4900;
  padding: 11px 13px;
}

:root[data-theme="dark"] .info-banner {
  border-color: rgba(255, 208, 113, 0.34);
  background: rgba(255, 208, 113, 0.14);
  color: var(--warning);
}

.info-banner strong {
  white-space: nowrap;
}

.info-banner span {
  color: inherit;
  opacity: 0.86;
}

.panel,
.widget,
.metric-card,
.login-panel,
.note-card,
.picker-item,
.run-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel {
  margin-top: 12px;
  padding: 14px;
}

.panel h2,
.picker-head h2,
.metric-card h2,
.widget-top h2 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.25;
}

.panel-copy,
.note-copy,
.muted-copy,
.comparison-line,
.metric-meta,
.picker-meta,
.run-meta,
.picker-head p,
.login-panel p {
  color: var(--muted);
  line-height: 1.45;
}

.panel-copy,
.note-copy,
.picker-head p {
  margin: 0;
}

.ops-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.ops-big-value {
  margin: 14px 0 8px;
  min-height: 34px;
  font-size: 24px;
  font-weight: 760;
  line-height: 1.25;
  color: var(--text);
}

.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.status-pill,
.trust-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1;
  padding: 6px 8px;
  white-space: nowrap;
}

.status-pill {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.status-pill.warn {
  background: var(--warning-soft);
  color: var(--warning);
}

.trust-chip.canonical,
.trust-chip.derived-accepted,
.trust-chip.user-defined,
.trust-chip.synthetic {
  background: var(--success-soft);
  color: var(--success);
}

.trust-chip.unresolved {
  background: var(--warning-soft);
  color: var(--warning);
}

.board-panel {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.board-header {
  margin-bottom: 10px;
}

.dashboard-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 14px;
}

.dashboard-board {
  position: relative;
  min-height: 680px;
}

.drop-grid,
.widget-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: 60px;
  gap: 8px;
}

.drop-grid {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.widget-grid {
  position: relative;
  z-index: 2;
}

.drop-cell {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(18, 100, 220, 0.03);
}

.widget {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
  padding: 12px;
}

.widget.synthetic {
  border-color: rgba(166, 106, 0, 0.34);
}

.widget.text-note {
  background: var(--accent-soft);
}

.widget-top,
.metric-card-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.widget-type,
.metric-id {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.metric-card-body {
  display: grid;
  gap: 8px;
  min-height: 0;
}

.metric-main-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.metric-link,
.link-button {
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  padding: 0;
  text-align: left;
  text-decoration: none;
}

.metric-value {
  color: var(--ink);
  font-size: clamp(1.45rem, 2.1vw, 2.05rem);
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
}

.comparison-line,
.metric-meta,
.picker-meta,
.run-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.78rem;
}

.delta,
.comparison-line span:first-child {
  color: var(--success);
  font-weight: 700;
}

.delta.down {
  color: var(--danger);
}

.delta.neutral {
  color: var(--muted);
}

.lineage-panel {
  margin-top: auto;
  color: var(--muted);
  font-size: 0.78rem;
}

.lineage-panel summary {
  cursor: pointer;
  color: var(--accent-strong);
}

.formula-details {
  margin-top: auto;
  color: var(--muted);
  font-size: 0.78rem;
}

.formula-details summary {
  cursor: pointer;
  color: var(--accent-strong);
}

.json-card,
.formula-preview {
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #111827;
  color: #eef4ff;
  font-size: 0.78rem;
  padding: 10px;
}

.picker-panel,
.run-list,
.scenario-stack,
.scenario-form-grid,
.picker-list,
.finance-stack,
.panel-subsection,
.chart-shell,
.bars,
.treemap,
.heatmap-grid,
.placeholder-copy {
  display: grid;
  gap: 10px;
}

.picker-panel {
  align-self: start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
  box-shadow: var(--shadow);
}

.picker-item,
.run-card {
  gap: 5px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: inherit;
  padding: 10px;
  text-align: left;
  box-shadow: none;
}

.picker-item:hover,
.run-card:hover,
.run-card.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.run-card.selected {
  color: var(--accent-strong);
}

.search-box {
  display: grid;
  gap: 6px;
  min-width: 220px;
}

.search-box span,
.search-box label {
  color: var(--muted);
  font-size: 0.78rem;
}

.search-box textarea {
  min-height: 84px;
  resize: vertical;
}

.scenario-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 14px;
}

.scenario-form-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.finance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 14px;
}

.finance-full-span {
  grid-column: 1 / -1;
}

.panel-subsection {
  min-width: 0;
  padding: 0;
}

.note-card {
  padding: 12px;
  background: var(--surface-muted);
  box-shadow: none;
}

.cell-wrap {
  max-width: 420px;
  white-space: normal;
  word-break: break-word;
}

.registry-grid,
.admin-grid {
  display: grid;
  gap: 14px;
}

.registry-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.admin-grid {
  grid-template-columns: 320px minmax(0, 1fr);
}

.admin-detail-stack {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.metric-card {
  padding: 12px;
  box-shadow: none;
}

.metric-card.synthetic {
  border-color: rgba(18, 100, 220, 0.34);
}

.table-scroll {
  max-height: min(68vh, 760px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.data-table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table th,
.data-table td {
  min-width: 118px;
  border-bottom: 1px solid var(--line);
  padding: 10px 11px;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--sticky-bg);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.data-table th:first-child,
.data-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  min-width: 170px;
  background: var(--sticky-bg);
  box-shadow: 8px 0 16px rgba(21, 31, 48, 0.06);
}

.data-table th:first-child {
  z-index: 5;
}

.data-table tr:hover td {
  background: var(--surface-muted);
}

.line-chart {
  width: 100%;
  height: 150px;
  color: var(--accent);
}

.chart-axis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(44px, 1fr));
  gap: 6px;
  color: var(--muted);
  font-size: 0.72rem;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(70px, 100px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
}

.bar-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-muted);
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.workbook-dashboard {
  display: grid;
  gap: 12px;
  min-width: 0;
  margin-top: 12px;
}

.workbook-head,
.workbook-table-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
}

.workbook-head {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  min-height: 76px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.workbook-table-head h3 {
  margin: 2px 0 0;
  font-size: 1.12rem;
  line-height: 1.25;
}

.workbook-head h2 {
  margin: 0;
  font-size: clamp(1.35rem, 1.8vw, 1.65rem);
  line-height: 1.15;
}

.workbook-head p,
.workbook-table-head p {
  max-width: 760px;
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.workbook-tabs {
  display: inline-flex;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 4px;
}

.workbook-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted-strong);
  padding: 0 14px;
  font-weight: 700;
}

.workbook-tabs button.active {
  background: var(--accent);
  color: #fff;
}

.workbook-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted-strong);
  font-size: 0.78rem;
  font-weight: 800;
}

.workbook-section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.workbook-section-title.with-actions {
  justify-content: space-between;
}

.workbook-section-title.with-actions::after {
  order: 1;
}

.workbook-section-title.with-actions button {
  order: 2;
}

.workbook-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 8px;
}

.workbook-kpi-grid.expenses {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.layer-status-panel {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
  box-shadow: var(--shadow);
}

.layer-status-panel.status-ok {
  border-color: rgba(32, 131, 59, 0.22);
}

.layer-status-panel.status-blocked {
  border-color: rgba(197, 51, 70, 0.26);
}

.layer-status-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.layer-status-head strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 1rem;
}

.layer-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 8px;
}

.layer-check-card {
  display: grid;
  gap: 7px;
  min-height: 128px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
  padding: 10px;
}

.layer-check-card.status-ok {
  background: linear-gradient(180deg, var(--surface), var(--success-soft));
}

.layer-check-card.status-blocked {
  background: linear-gradient(180deg, var(--surface), var(--danger-soft));
}

.layer-check-card.status-warn,
.layer-check-card.status-info {
  background: linear-gradient(180deg, var(--surface), var(--warning-soft));
}

.layer-check-card span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.layer-check-card strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 0.92rem;
}

.layer-check-card p {
  margin: 0;
  color: var(--muted-strong);
  font-size: 0.78rem;
  line-height: 1.35;
}

.layer-check-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.layer-check-meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted-strong);
  padding: 3px 7px;
  text-transform: none;
}

.workbook-kpi-card {
  display: grid;
  min-height: 106px;
  align-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
  box-shadow: 0 8px 20px rgba(21, 31, 48, 0.06);
}

.workbook-kpi-card.tone-good {
  border-color: rgba(32, 131, 59, 0.26);
  background: linear-gradient(180deg, var(--surface), var(--success-soft));
}

.workbook-kpi-card.tone-bad {
  border-color: rgba(197, 51, 70, 0.26);
  background: linear-gradient(180deg, var(--surface), var(--danger-soft));
}

.workbook-kpi-card.tone-warn {
  border-color: rgba(166, 106, 0, 0.26);
  background: linear-gradient(180deg, var(--surface), var(--warning-soft));
}

.workbook-kpi-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted-strong);
  font-size: 0.78rem;
  font-weight: 800;
}

.workbook-kpi-card strong {
  color: var(--ink);
  font-size: clamp(1.35rem, 1.8vw, 1.8rem);
  line-height: 1;
  white-space: nowrap;
}

.workbook-delta {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.workbook-delta.tone-good {
  color: var(--success);
}

.workbook-delta.tone-bad {
  color: var(--danger);
}

.workbook-delta small {
  color: var(--muted);
  font-weight: 700;
}

.metric-tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  cursor: help;
  outline: none;
}

.metric-tooltip-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: none;
  width: min(320px, calc(100vw - 32px));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--surface);
  box-shadow: var(--shadow);
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.35;
  padding: 9px 10px;
  white-space: normal;
}

.metric-tooltip:hover .metric-tooltip-popover,
.metric-tooltip:focus .metric-tooltip-popover {
  display: block;
}

.workbook-table th:first-child .metric-tooltip-popover {
  left: 0;
  transform: none;
}

.workbook-table th:last-child .metric-tooltip-popover {
  right: 0;
  left: auto;
  transform: none;
}

.workbook-table-panel {
  display: grid;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
  box-shadow: var(--shadow);
}

.workbook-table-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.column-settings-panel {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
  padding: 10px;
}

.column-settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.column-settings-title,
.column-settings-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar-select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  padding: 6px 8px;
  font-size: 0.78rem;
  font-weight: 800;
}

.table-sort-button {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  width: 100%;
  min-height: 26px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: right;
}

.table-sort-button:hover,
.table-sort-button:focus {
  color: var(--accent);
  outline: none;
}

.display-preset-panel {
  display: grid;
  gap: 8px;
}

.display-preset-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 8px;
}

.display-preset-form input {
  min-height: 34px;
}

.display-preset-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.display-preset-chip {
  display: inline-flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.display-preset-chip button {
  min-height: 30px;
  border: 0;
  background: transparent;
  color: var(--muted-strong);
  font-weight: 800;
  padding: 0 10px;
}

.display-preset-chip button + button {
  border-left: 1px solid var(--line);
  color: var(--muted);
  padding: 0 8px;
}

.column-search-control {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  padding: 8px 10px;
}

.column-search-control input {
  width: 100%;
  min-height: 30px;
  border: 0;
  background: transparent;
  padding: 0;
}

.column-settings-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 10px;
  max-height: 430px;
  overflow: auto;
  padding-right: 2px;
}

.column-settings-group {
  display: grid;
  align-content: start;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 9px;
}

.column-settings-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink);
  font-size: 0.82rem;
}

.column-settings-group-head span {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 7px;
}

.column-settings-list {
  display: grid;
  gap: 5px;
}

.column-setting-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: center;
  gap: 6px;
  border-radius: 7px;
  background: var(--surface-muted);
  padding: 6px;
}

.column-setting-row.hidden-column {
  opacity: 0.68;
}

.column-visible-toggle,
.column-pin-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--muted-strong);
  font-size: 0.78rem;
  font-weight: 800;
}

.column-visible-toggle span,
.column-pin-toggle span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.column-visible-toggle input,
.column-pin-toggle input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
}

.column-visible-toggle input:disabled,
.column-pin-toggle input:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.column-pin-button {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
}

.column-pin-button.active {
  border-color: rgba(65, 124, 214, 0.36);
  background: rgba(65, 124, 214, 0.12);
  color: var(--accent);
}

.column-pin-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.workbook-table-scroll {
  position: relative;
  min-width: 0;
  max-width: 100%;
  max-height: min(72vh, 820px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.workbook-table-scroll.compact {
  max-height: 360px;
}

.workbook-table {
  width: 100%;
  min-width: 5200px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 0.78rem;
}

.workbook-table.wb-table {
  min-width: 2360px;
}

.wb-table-scroll {
  isolation: isolate;
}

.workbook-table.wb-table th,
.workbook-table.wb-table td {
  min-width: 0;
  white-space: normal;
  line-height: 1.28;
}

.workbook-table.wb-table th {
  z-index: 32;
  background-clip: padding-box;
}

.workbook-table.wb-table th.sticky {
  z-index: 42;
  background: var(--surface);
  background-clip: padding-box;
}

.workbook-table.wb-table td.sticky {
  z-index: 18;
  background: var(--surface);
  background-clip: padding-box;
}

.workbook-table.wb-table th.group-id,
.workbook-table.wb-table td.group-id {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workbook-table th,
.workbook-table td {
  min-width: 124px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 8px 9px;
  text-align: right;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workbook-cell-value {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workbook-table th {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--sticky-bg);
  background-clip: padding-box;
  color: var(--muted-strong);
  font-size: 0.72rem;
  font-weight: 800;
  height: 52px;
  overflow: visible;
  white-space: normal;
}

.workbook-table .workbook-sort-button {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0 8px 0 0;
  text-align: right;
  font-weight: inherit;
  line-height: 1.16;
}

.workbook-table .workbook-sort-button span:first-child {
  display: -webkit-box;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  text-overflow: ellipsis;
  white-space: normal;
  word-break: normal;
}

.workbook-table .workbook-sort-button .metric-tooltip {
  flex: 0 0 auto;
}

.workbook-table th.group-id .workbook-sort-button {
  justify-content: flex-start;
  text-align: left;
}

.column-resize-handle {
  position: absolute;
  top: 0;
  right: -3px;
  z-index: 18;
  width: 8px;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: col-resize;
  padding: 0;
}

.column-resize-handle::after {
  content: "";
  position: absolute;
  top: 9px;
  right: 3px;
  width: 1px;
  height: calc(100% - 18px);
  background: transparent;
}

.column-resize-handle:hover::after,
.column-resize-handle:focus-visible::after {
  background: var(--accent);
}

.workbook-table th.group-id,
.workbook-table td.group-id {
  text-align: left;
}

.workbook-table th.group-id {
  background: var(--table-head-id-bg);
}

.workbook-table th.group-orders {
  background: var(--table-head-orders-bg);
}

.workbook-table th.group-revenue {
  background: var(--table-head-revenue-bg);
}

.workbook-table th.group-expenses {
  background: var(--table-head-expenses-bg);
}

.workbook-table th.group-payout {
  background: var(--table-head-payout-bg);
}

.workbook-table th.group-delta {
  background: var(--table-head-delta-bg);
}

.workbook-table th.sorted {
  color: var(--accent-strong);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.workbook-table td.sticky {
  position: sticky;
  z-index: 9;
  background: var(--surface);
  box-shadow: 8px 0 18px rgba(21, 31, 48, 0.06);
}

.workbook-table th.sticky {
  position: sticky;
  z-index: 40;
  background: var(--sticky-bg);
  box-shadow: 8px 0 18px rgba(21, 31, 48, 0.06);
}

.workbook-table th.sticky .column-resize-handle {
  z-index: 22;
}

.workbook-table.wb-table th.sticky,
.workbook-table.wb-table td.sticky {
  box-shadow: none;
}

.workbook-table .sticky-1 {
  left: 0;
  min-width: 132px;
}

.workbook-table .sticky-2 {
  left: 132px;
  min-width: 136px;
}

.workbook-table .sticky-3 {
  left: 268px;
  min-width: 300px;
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workbook-table td.tone-good {
  background: rgba(32, 131, 59, 0.09);
  color: var(--success);
  font-weight: 800;
}

.workbook-table td.tone-bad {
  background: rgba(197, 51, 70, 0.09);
  color: var(--danger);
  font-weight: 800;
}

.workbook-table td.tone-neutral {
  color: var(--muted-strong);
}

.workbook-table td.signal-good {
  background: var(--success-soft);
  color: var(--success);
}

.workbook-table td.signal-warn {
  background: var(--warning-soft);
  color: var(--warning);
}

.workbook-table td.signal-bad {
  background: var(--danger-soft);
  color: var(--danger);
}

.workbook-table td.sticky.tone-good {
  background: color-mix(in srgb, var(--success-soft) 78%, var(--surface));
}

.workbook-table td.sticky.tone-bad {
  background: color-mix(in srgb, var(--danger-soft) 76%, var(--surface));
}

.workbook-table td.sticky.signal-good {
  background: color-mix(in srgb, var(--success-soft) 88%, var(--surface));
}

.workbook-table td.sticky.signal-warn {
  background: color-mix(in srgb, var(--warning-soft) 88%, var(--surface));
}

.workbook-table td.sticky.signal-bad {
  background: color-mix(in srgb, var(--danger-soft) 88%, var(--surface));
}

.workbook-table tr:hover td {
  background: var(--surface-muted);
}

.workbook-table tr:hover td.tone-good {
  background: color-mix(in srgb, var(--success-soft) 70%, var(--surface-muted));
}

.workbook-table tr:hover td.tone-bad {
  background: color-mix(in srgb, var(--danger-soft) 70%, var(--surface-muted));
}

.planning-placeholder {
  padding: 22px !important;
  text-align: left !important;
  color: var(--muted);
  white-space: normal !important;
}

.stock-import-panel,
.stock-preview-panel {
  display: grid;
  grid-template-columns: minmax(240px, 1.2fr) 150px minmax(300px, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  padding: 10px 12px;
}

.stock-import-panel strong,
.stock-preview-panel strong {
  display: block;
  color: var(--ink);
  font-size: 0.9rem;
}

.stock-import-panel p,
.stock-preview-panel p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.stock-field {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted-strong);
  font-size: 0.72rem;
  font-weight: 800;
}

.stock-field.wide {
  min-width: min(360px, 100%);
}

.stock-field input,
.stock-field select {
  min-height: 32px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 10px;
  font: inherit;
  outline: none;
}

.stock-field select {
  cursor: pointer;
}

.stock-file-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
}

.stock-file-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.stock-file-name {
  min-width: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-import-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: nowrap;
}

.stock-preview-panel {
  grid-template-columns: minmax(220px, 1fr);
  align-items: start;
  background: color-mix(in srgb, var(--success-soft) 55%, var(--surface));
}

.stock-stat-grid {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.stock-stat-grid span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted-strong);
  padding: 5px 8px;
  font-size: 0.74rem;
  font-weight: 800;
}

.stock-warning {
  color: var(--warning) !important;
}

.stock-rows-head {
  margin-top: 2px;
}

.stock-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 10px;
  align-items: center;
  justify-content: space-between;
}

.stock-search-control {
  order: 1;
  flex: 0 1 390px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  padding: 0 10px;
}

.stock-search-control input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 0.84rem;
  outline: none;
}

.stock-filter-buttons {
  order: 3;
  flex: 1 0 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-start;
}

.workbook-table-scroll.stock-scroll {
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
}

.stock-workspace-tabs {
  margin: 4px 0 10px;
  width: fit-content;
}

.workbook-table.stock-table {
  width: max-content;
}

.workbook-table.stock-table th,
.workbook-table.stock-table td,
.workbook-table.stock-source-table th,
.workbook-table.stock-source-table td {
  min-width: 0;
}

.stock-mp-cell {
  display: grid;
  gap: 3px;
  line-height: 1.25;
}

.stock-mp-cell span,
.stock-mp-cell small {
  color: var(--muted);
  font-size: 0.72rem;
}

.stock-plan-cell {
  display: grid;
  grid-template-columns: repeat(3, minmax(42px, 1fr));
  gap: 4px;
  font-size: 0.76rem;
  color: var(--muted);
}

.stock-plan-cell.strong {
  color: var(--ink);
  font-weight: 700;
}

.workbook-table.stock-source-table th,
.workbook-table.stock-source-table td {
  min-width: 0;
}

.stock-daily-cell {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.2;
  white-space: nowrap;
}

.stock-daily-cell strong {
  color: var(--ink);
}

.stock-map-input {
  width: 100%;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  padding: 4px 7px;
  font-size: 0.76rem;
  font-weight: 700;
}

.stock-map-input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.stock-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 850;
  white-space: nowrap;
}

.stock-status-pill.status-mapped {
  background: color-mix(in srgb, var(--success) 12%, transparent);
  color: var(--success);
}

.stock-status-pill.status-warning {
  background: color-mix(in srgb, var(--warning) 13%, transparent);
  color: var(--warning);
}

.stock-status-pill.status-unmapped {
  background: color-mix(in srgb, var(--danger) 11%, transparent);
  color: var(--danger);
}

.stock-workspace {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.stock-workspace:not(.stock-workspace-embedded) {
  max-width: none;
}

.stock-workspace-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.stock-workspace-hero h3 {
  margin: 0;
  font-size: 1.18rem;
  line-height: 1.22;
}

.stock-workspace-hero p {
  max-width: 820px;
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.stock-workspace .stock-import-panel,
.stock-workspace .stock-preview-panel {
  border-color: var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-muted) 70%, var(--surface));
  box-shadow: none;
  padding-inline: 12px;
}

.stock-workspace .stock-preview-panel {
  background: color-mix(in srgb, var(--success-soft) 44%, var(--surface));
  padding-inline: 12px;
}

.stock-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.stock-kpi-card {
  display: grid;
  gap: 5px;
  min-height: 54px;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 9px 11px;
}

.stock-kpi-card strong {
  color: var(--ink);
  font-size: 1.2rem;
  line-height: 1;
}

.stock-kpi-card span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.stock-kpi-card.tone-good {
  border-color: rgba(32, 131, 59, 0.28);
  background: color-mix(in srgb, var(--success-soft) 42%, var(--surface));
}

.stock-kpi-card.tone-warn {
  border-color: rgba(166, 106, 0, 0.28);
  background: color-mix(in srgb, var(--warning-soft) 46%, var(--surface));
}

.stock-kpi-card.tone-bad {
  border-color: rgba(197, 51, 70, 0.28);
  background: color-mix(in srgb, var(--danger-soft) 42%, var(--surface));
}

.stock-table-tools,
.stock-row-tools {
  order: 2;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.stock-export-control {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted-strong);
  padding: 0 8px;
  font-size: 0.78rem;
  font-weight: 800;
}

.stock-export-control select {
  min-height: 30px;
  max-width: 185px;
  border: 0;
  background: transparent;
  color: var(--ink);
  outline: none;
}

.stock-density-control {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted-strong);
  padding: 0 8px;
  font-size: 0.78rem;
  font-weight: 800;
}

.stock-density-control select {
  min-height: 30px;
  border: 0;
  background: transparent;
  color: var(--ink);
  outline: none;
}

.stock-column-panel {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-muted) 58%, var(--surface));
  padding: 10px 0;
}

.stock-column-panel .column-settings-head {
  padding-inline: 0;
}

.stock-column-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 8px;
}

.stock-column-toggle {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted-strong);
  padding: 5px 6px 5px 10px;
  font-size: 0.76rem;
  font-weight: 800;
}

.stock-column-toggle label,
.stock-column-actions {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.stock-column-toggle label {
  flex: 1 1 auto;
}

.stock-column-toggle label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-column-actions {
  flex: 0 0 auto;
  gap: 3px;
}

.stock-column-actions button {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.stock-column-actions button:hover:not(:disabled),
.stock-column-actions button.active {
  border-color: var(--line-strong);
  background: var(--surface-muted);
  color: var(--ink);
}

.stock-column-actions button:disabled {
  cursor: default;
  opacity: 0.35;
}

.stock-column-toggle.muted {
  opacity: 0.66;
}

.stock-column-toggle input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--accent);
}

.stock-workspace .workbook-table-scroll.stock-scroll {
  width: 100%;
  min-width: 0;
  max-width: none;
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
  border-right: 0;
  border-left: 0;
  border-radius: 0;
}

.stock-workspace .workbook-table th {
  position: sticky;
  top: 0;
  height: 48px;
  vertical-align: middle;
}

.stock-workspace .workbook-table th[draggable="true"] {
  cursor: grab;
}

.stock-workspace .workbook-table th.sticky,
.stock-workspace .workbook-table td.sticky {
  background-clip: padding-box;
}

.stock-workspace .workbook-table td.sticky {
  background-color: var(--surface);
}

.stock-workspace .workbook-table td.sticky.signal-good {
  background: color-mix(in srgb, var(--success) 12%, var(--surface));
}

.stock-workspace .workbook-table td.sticky.signal-warn {
  background: color-mix(in srgb, var(--warning) 14%, var(--surface));
}

.stock-workspace .workbook-table td.sticky.signal-bad {
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
}

.stock-workspace .workbook-table th.drop-before::before,
.stock-workspace .workbook-table th.drop-after::after {
  content: "";
  position: absolute;
  top: 5px;
  bottom: 5px;
  z-index: 45;
  width: 3px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  pointer-events: none;
}

.stock-workspace .workbook-table th.drop-before::before {
  left: -2px;
}

.stock-workspace .workbook-table th.drop-after::after {
  right: -2px;
}

.stock-workspace .workbook-table.stock-table,
.stock-workspace .workbook-table.stock-source-table {
  width: max-content;
}

.stock-workspace .workbook-table.stock-table th,
.stock-workspace .workbook-table.stock-source-table th {
  height: 48px;
  overflow: visible;
}

.stock-workspace .workbook-table.stock-table td,
.stock-workspace .workbook-table.stock-source-table td {
  height: 48px;
}

.stock-align-left {
  text-align: left !important;
}

.stock-align-center {
  text-align: center !important;
}

.stock-item-name {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
}

.stock-plan-table .table-sort-button {
  justify-content: flex-end;
}

.stock-plan-table th.stock-align-left .table-sort-button {
  justify-content: flex-start;
  text-align: left;
}

.stock-plan-table th,
.stock-plan-table td,
.stock-source-table th,
.stock-source-table td {
  white-space: normal;
  line-height: 1.28;
}

.workbook-table.density-compact th,
.workbook-table.density-compact td {
  padding: 5px 7px;
}

.workbook-table.density-normal th,
.workbook-table.density-normal td {
  padding: 8px 9px;
}

.workbook-table.density-comfortable th,
.workbook-table.density-comfortable td {
  padding: 12px 10px;
}

.stock-plan-need-row td {
  background-image: linear-gradient(90deg, rgba(166, 106, 0, 0.055), rgba(166, 106, 0, 0));
}

.treemap,
.heatmap-grid {
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
}

.treemap-cell,
.heatmap-cell {
  display: grid;
  gap: 5px;
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 10px;
}

.saved-view-grid {
  margin-top: 0;
}

.auth-loading,
.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  background: var(--bg);
  padding: 24px;
}

.login-panel {
  width: min(460px, 100%);
  padding: 24px;
}

.login-panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.login-form {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.login-form label {
  display: grid;
  gap: 6px;
  color: var(--muted-strong);
}

.login-error {
  border: 1px solid rgba(197, 51, 70, 0.28);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.login-submit {
  width: 100%;
}

@media (max-width: 1180px) {
  .topbar-brand span {
    max-width: 360px;
  }

  .workbook-head,
  .workbook-table-head {
    align-items: stretch;
    flex-direction: column;
  }

  .workbook-tabs {
    width: fit-content;
  }

  .stock-import-panel {
    grid-template-columns: 1fr 1fr;
  }

  .stock-import-panel > :first-child,
  .stock-field.wide,
  .stock-import-actions {
    grid-column: 1 / -1;
  }

  .stock-import-actions {
    justify-content: flex-start;
  }

  .stock-filter-bar {
    grid-template-columns: 1fr;
  }

  .stock-filter-buttons {
    justify-content: flex-start;
  }

  .dashboard-workbench,
  .scenario-layout,
  .admin-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  :root {
    --sidebar-width: 0px;
  }

  .shell-sidebar {
    width: 0;
    overflow: hidden;
  }

  .shell.nav-open .shell-sidebar {
    width: 224px;
  }

  .topbar {
    padding: 0 12px;
  }

  .topbar-brand .brand-mark {
    display: inline-grid;
  }

  .topbar-brand span,
  .topbar-chip,
  .profile-chip {
    display: none;
  }

  .nav-toggle {
    display: inline-grid;
  }

  .workbook-table {
    min-width: 4700px;
  }

  .column-settings-groups {
    grid-template-columns: 1fr;
  }

  .workbook-table.stock-table {
    min-width: 1320px;
  }

  .stock-import-panel {
    grid-template-columns: 1fr;
  }

  .workbook-table th,
  .workbook-table td {
    min-width: 112px;
    padding: 7px 8px;
  }

  .workbook-table .sticky-1 {
    left: 0;
    min-width: 104px;
  }

  .workbook-table .sticky-2 {
    left: 104px;
    min-width: 116px;
  }

  .workbook-table .sticky-3 {
    left: 220px;
    min-width: 190px;
    max-width: 210px;
  }

  .mobile-nav {
    display: grid;
    gap: 4px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
    padding: 8px 12px;
  }

  .content-area {
    padding: 16px 12px 32px;
  }

  .info-banner {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .info-banner strong {
    white-space: normal;
  }

  .page-header,
  .hero {
    display: block;
  }

  .widget-grid,
  .drop-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: minmax(170px, auto);
  }

  .widget {
    grid-column: 1 !important;
    grid-row: auto !important;
  }

  .drop-grid {
    display: none;
  }

  .toolbar {
    align-items: stretch;
  }

  .toolbar-group,
  .toolbar-button,
  .search-box {
    width: 100%;
  }

  .workbook-kpi-grid,
  .workbook-kpi-grid.expenses {
    grid-template-columns: 1fr;
  }

  .workbook-table {
    min-width: 4600px;
  }

  .workbook-table .sticky-1 {
    min-width: 104px;
  }

  .workbook-table .sticky-2 {
    left: 104px;
    min-width: 112px;
  }

  .workbook-table .sticky-3 {
    left: 216px;
    min-width: 220px;
  }
}

/* Preview design transfer from the supplied dashboard mockup. */
:root {
  --bg: #eef1f8;
  --surface: #ffffff;
  --surface-muted: #f5f7fb;
  --surface-soft: #eef3fa;
  --ink: #172033;
  --muted: #71798b;
  --muted-strong: #4d586a;
  --line: rgba(15, 23, 42, 0.1);
  --line-strong: rgba(15, 23, 42, 0.16);
  --accent: #1f4ed8;
  --accent-strong: #143db8;
  --accent-soft: rgba(31, 78, 216, 0.1);
  --success: #15803d;
  --success-soft: rgba(22, 163, 74, 0.12);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.11);
  --warning: #a16207;
  --warning-soft: rgba(245, 158, 11, 0.14);
  --sidebar: #ffffff;
  --sticky-bg: #ffffff;
  --table-head-id-bg: #ffffff;
  --table-head-orders-bg: #eff6ff;
  --table-head-revenue-bg: #ecfdf5;
  --table-head-expenses-bg: #fff1f2;
  --table-head-payout-bg: #fffbeb;
  --table-head-delta-bg: #f1f5f9;
  --shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
  --radius: 8px;
  --topbar-height: 56px;
  --sidebar-width: 56px;
}

:root[data-theme="dark"] {
  --bg: #0c0e18;
  --surface: #111722;
  --surface-muted: #171f2c;
  --surface-soft: #202a3a;
  --ink: #f6f8fb;
  --muted: #8f9bad;
  --muted-strong: #c4ccd8;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --accent: #7aa7ff;
  --accent-strong: #9bbcff;
  --accent-soft: rgba(122, 167, 255, 0.14);
  --success: #72d28b;
  --success-soft: rgba(114, 210, 139, 0.15);
  --danger: #fb7185;
  --danger-soft: rgba(251, 113, 133, 0.14);
  --warning: #facc15;
  --warning-soft: rgba(250, 204, 21, 0.13);
  --sidebar: #0d0f14;
  --sticky-bg: #111722;
  --table-head-id-bg: #111722;
  --table-head-orders-bg: #142036;
  --table-head-revenue-bg: #12291f;
  --table-head-expenses-bg: #2b1720;
  --table-head-payout-bg: #2a2414;
  --table-head-delta-bg: #182232;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
}

body {
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 255, 255, 0.7), transparent 28rem),
    linear-gradient(135deg, #eef1f8 0%, #e8ecf6 46%, #edeaf8 100%);
  font-size: 13px;
}

:root[data-theme="dark"] body {
  background: linear-gradient(135deg, #0c0c14 0%, #0f0f1e 44%, #0c0e1c 100%);
}

.shell {
  min-height: 100vh;
  background: transparent;
}

.shell-sidebar {
  width: 56px;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
  transition: width 280ms cubic-bezier(0.4, 0, 0.2, 1);
}

.shell-sidebar:hover,
.shell.nav-open .shell-sidebar {
  width: 220px;
}

.sidebar-brand {
  min-height: 56px;
  padding: 0 12px;
  gap: 12px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  flex-basis: 32px;
  border-radius: 9px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 11%, transparent);
}

.brand-name {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0;
}

.shell-nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 10px;
  overflow-x: hidden;
  overflow-y: auto;
}

.shell-nav-section {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
}

.shell-nav-section-label {
  min-height: 20px;
  padding: 6px 12px 2px;
  color: color-mix(in srgb, var(--muted) 72%, transparent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  line-height: 1;
  opacity: 0;
  text-transform: uppercase;
  transform: translateX(-4px);
  transition: opacity 160ms ease, transform 160ms ease;
  white-space: nowrap;
}

.shell-sidebar:hover .shell-nav-section-label,
.shell.nav-open .shell-nav-section-label {
  opacity: 1;
  transform: translateX(0);
}

.nav-link {
  position: relative;
  min-height: 40px;
  border-radius: 8px;
  color: var(--muted);
  gap: 13px;
  padding: 0 12px;
}

.nav-link::before {
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 20px;
  border-radius: 0 999px 999px 0;
  background: transparent;
  content: "";
  transform: translateY(-50%);
}

.nav-link:hover {
  background: color-mix(in srgb, var(--ink) 4%, transparent);
  color: var(--ink);
}

.nav-link.active {
  background: color-mix(in srgb, var(--ink) 5%, transparent);
  color: var(--ink);
}

.nav-link.active::before {
  background: var(--accent);
}

.marketplace-mark {
  display: inline-flex;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 7.5px;
  font-weight: 800;
  letter-spacing: 0;
}

.marketplace-mark.wb {
  background: rgba(203, 17, 171, 0.12);
  color: #cb11ab;
}

.marketplace-mark.ozon {
  background: rgba(0, 91, 255, 0.12);
  color: #005bff;
}

.marketplace-mark.active.wb {
  background: #cb11ab;
  color: #ffffff;
}

.marketplace-mark.active.ozon {
  background: #005bff;
  color: #ffffff;
}

.topbar {
  min-height: 56px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  padding: 0 18px;
  backdrop-filter: blur(18px);
}

:root[data-theme="dark"] .topbar {
  background: rgba(13, 15, 20, 0.82);
}

.topbar-brand strong {
  font-size: 0.96rem;
  font-weight: 700;
}

.topbar-brand span {
  color: var(--muted);
  font-size: 0.74rem;
}

.topbar-chip,
.compact-select,
.profile-chip,
.toolbar-group {
  min-height: 32px;
  border-color: var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: none;
  font-size: 12px;
}

:root[data-theme="dark"] .topbar-chip,
:root[data-theme="dark"] .compact-select,
:root[data-theme="dark"] .profile-chip,
:root[data-theme="dark"] .toolbar-group {
  background: rgba(17, 23, 34, 0.72);
}

.content-area {
  padding: 18px 22px 34px;
}

.page-header {
  margin: 0 0 14px;
}

.page-header h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: 0;
}

.page-header p,
.hero-eyebrow {
  display: none;
}

.page-toolbar {
  margin-bottom: 16px;
}

.toolbar,
.dashboard-toolbar {
  gap: 8px;
}

.toolbar-group {
  padding: 5px 7px;
}

.toolbar-group > span,
.toolbar-field > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.toolbar-button,
.secondary-button,
.primary-action,
.ghost-button {
  min-height: 32px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 650;
}

.toolbar-button,
.secondary-button,
.ghost-button {
  border-color: var(--line);
  background: var(--surface);
  color: var(--muted-strong);
}

.toolbar-button:hover,
.secondary-button:hover,
.ghost-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-muted);
  color: var(--ink);
}

.toolbar-button.active,
.toolbar-button.primary,
.primary-action {
  border-color: color-mix(in srgb, var(--accent) 28%, transparent);
  background: var(--ink);
  color: #ffffff;
}

:root[data-theme="dark"] .toolbar-button.active,
:root[data-theme="dark"] .toolbar-button.primary,
:root[data-theme="dark"] .primary-action {
  background: #f6f8fb;
  color: #111722;
}

.toolbar-field select,
.compact-select select,
.toolbar input,
.search-box input,
.stock-search-control input,
.stock-field input,
.stock-field select,
.stock-density-control select,
.stock-export-control select,
.column-search-control input,
.display-preset-form input,
.login-form input {
  border-color: var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
}

.workbook-dashboard,
.stock-workspace {
  display: grid;
  gap: 16px;
}

.workbook-head,
.stock-workspace-hero {
  align-items: center;
  border: 0;
  background: transparent;
  padding: 0;
}

.workbook-head h2,
.stock-workspace-hero h3 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0;
}

.workbook-head p,
.stock-workspace-hero p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.workbook-tabs {
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 3px;
}

:root[data-theme="dark"] .workbook-tabs {
  background: rgba(17, 23, 34, 0.74);
}

.workbook-tabs button {
  min-height: 30px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  padding: 5px 12px;
}

.workbook-tabs button.active {
  background: var(--surface);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
  color: var(--ink);
}

.workbook-section-title {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.workbook-kpi-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.workbook-kpi-grid.expenses {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.workbook-kpi-card,
.stock-kpi-card,
.panel,
.stock-import-panel,
.stock-preview-panel,
.column-settings-panel,
.stock-column-panel,
.workbook-table-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.055);
}

:root[data-theme="dark"] .workbook-kpi-card,
:root[data-theme="dark"] .stock-kpi-card,
:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .stock-import-panel,
:root[data-theme="dark"] .stock-preview-panel,
:root[data-theme="dark"] .column-settings-panel,
:root[data-theme="dark"] .stock-column-panel,
:root[data-theme="dark"] .workbook-table-panel {
  background: rgba(17, 23, 34, 0.88);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.2);
}

.workbook-kpi-card {
  min-height: 112px;
  padding: 14px;
}

.workbook-kpi-label,
.stock-kpi-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.workbook-kpi-card strong,
.stock-kpi-card strong {
  color: var(--ink);
  font-size: 24px;
  font-weight: 750;
  letter-spacing: 0;
}

.workbook-delta,
.status-pill,
.stock-status-pill {
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.workbook-table-panel {
  overflow: hidden;
  padding: 0;
}

.workbook-table-head,
.stock-rows-head {
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
}

.workbook-table-head h3 {
  font-size: 14px;
  font-weight: 700;
}

.workbook-table-head p {
  color: var(--muted);
  font-size: 12px;
}

.workbook-table-scroll {
  border-radius: 0;
  border: 0;
}

.workbook-table {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.workbook-table th {
  height: 40px;
  border-bottom: 1px solid var(--line);
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.workbook-table td {
  border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  color: var(--ink);
}

.workbook-table tr:hover td {
  background: color-mix(in srgb, var(--accent) 4%, var(--surface));
}

.workbook-table .workbook-sort-button,
.stock-plan-table .table-sort-button {
  color: inherit;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.stock-import-panel {
  grid-template-columns: minmax(220px, 1.2fr) minmax(150px, 0.45fr) minmax(320px, 1fr) auto;
  padding: 12px;
}

.stock-kpi-strip {
  gap: 10px;
}

.stock-filter-bar {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 10px;
}

:root[data-theme="dark"] .stock-filter-bar {
  background: rgba(17, 23, 34, 0.72);
}

.stock-search-control {
  border-color: var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.login-shell {
  background:
    linear-gradient(135deg, rgba(238, 241, 248, 0.95), rgba(232, 236, 246, 0.95)),
    radial-gradient(circle at 22% 8%, rgba(31, 78, 216, 0.13), transparent 24rem);
}

:root[data-theme="dark"] .login-shell {
  background: linear-gradient(135deg, #0c0c14 0%, #0f0f1e 44%, #0c0e1c 100%);
}

.login-panel {
  width: min(100%, 420px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
}

:root[data-theme="dark"] .login-panel {
  background: rgba(17, 23, 34, 0.9);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
}

.login-panel h1 {
  font-size: 22px;
  letter-spacing: 0;
}

.login-panel p {
  color: var(--muted);
}

@media (max-width: 860px) {
  .shell-sidebar {
    width: 0;
  }

  .shell.nav-open .shell-sidebar {
    width: min(82vw, 240px);
  }

  .content-area {
    padding: 14px 12px 72px;
  }

  .page-toolbar {
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .toolbar-group,
  .toolbar-button,
  .search-box {
    width: auto;
  }

  .dashboard-toolbar {
    flex-wrap: nowrap;
    justify-content: flex-start;
    min-width: max-content;
  }

  .workbook-kpi-grid,
  .workbook-kpi-grid.expenses {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stock-import-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .workbook-kpi-grid,
  .workbook-kpi-grid.expenses {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    gap: 6px;
  }
}

/* Zip design React frontend */
:root {
  --zip-bg: #f8faff;
  --zip-foreground: rgba(15, 23, 42, 0.9);
  --zip-muted: rgba(15, 23, 42, 0.48);
  --zip-muted-2: rgba(15, 23, 42, 0.32);
  --zip-card: #ffffff;
  --zip-card-soft: #f1f4f9;
  --zip-border: rgba(15, 23, 42, 0.1);
  --zip-border-soft: rgba(15, 23, 42, 0.06);
  --zip-primary: #030213;
  --zip-destructive: #d4183d;
  --zip-warning: #ca8a04;
  --zip-good: #059669;
  --zip-shadow: 0 10px 28px rgba(15, 23, 42, 0.07);
}

:root[data-theme="dark"] {
  --zip-bg: #0c0c14;
  --zip-foreground: rgba(255, 255, 255, 0.9);
  --zip-muted: rgba(255, 255, 255, 0.5);
  --zip-muted-2: rgba(255, 255, 255, 0.28);
  --zip-card: #10121a;
  --zip-card-soft: #181b25;
  --zip-border: rgba(255, 255, 255, 0.1);
  --zip-border-soft: rgba(255, 255, 255, 0.06);
  --zip-primary: #ffffff;
  --zip-shadow: 0 16px 34px rgba(0, 0, 0, 0.24);
}

.zip-shell {
  display: flex;
  min-height: 100vh;
  background: var(--zip-bg);
  color: var(--zip-foreground);
}

.zip-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 60;
  display: flex;
  width: 56px;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--zip-border-soft);
  background: var(--zip-card);
  box-shadow: 14px 0 34px rgba(15, 23, 42, 0.05);
  transition: width 260ms cubic-bezier(0.4, 0, 0.2, 1);
}

:root[data-theme="dark"] .zip-sidebar {
  background: #0d0f14;
  box-shadow: 14px 0 34px rgba(0, 0, 0, 0.28);
}

.zip-sidebar:hover {
  width: 220px;
}

.zip-sidebar-logo {
  display: flex;
  height: 56px;
  flex-shrink: 0;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--zip-border-soft);
  padding: 0 12px;
}

.zip-logo-box {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  border-radius: 9px;
  background: #eef2ff;
  color: #4f46e5;
}

:root[data-theme="dark"] .zip-logo-box {
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.86);
}

.zip-logo-box svg {
  width: 22px;
  height: 22px;
}

.zip-logo-copy,
.zip-nav-link-label,
.zip-sidebar-logout span {
  min-width: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateX(-4px);
  transition: opacity 180ms ease, transform 180ms ease;
  white-space: nowrap;
}

.zip-nav-link-label,
.zip-sidebar-logout span {
  display: inline-block;
  max-width: 0;
  transition: max-width 220ms ease, opacity 180ms ease, transform 180ms ease;
}

.zip-sidebar:hover .zip-logo-copy,
.zip-sidebar:hover .zip-nav-link-label,
.zip-sidebar:hover .zip-sidebar-logout span {
  opacity: 1;
  transform: translateX(0);
}

.zip-sidebar:hover .zip-nav-link-label,
.zip-sidebar:hover .zip-sidebar-logout span {
  max-width: 148px;
}

.zip-logo-copy strong {
  display: block;
  color: var(--zip-foreground);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.zip-logo-copy span {
  display: block;
  margin-top: 4px;
  color: var(--zip-muted-2);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1;
  text-transform: uppercase;
}

.zip-sidebar-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 6px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 16px 8px;
}

.zip-nav-label {
  min-height: 24px;
  padding: 0 12px 4px;
  color: var(--zip-muted-2);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.15em;
  opacity: 0;
  text-transform: uppercase;
  transition: opacity 180ms ease;
}

.zip-sidebar:hover .zip-nav-label {
  opacity: 1;
}

.zip-nav-link,
.zip-sidebar-logout {
  isolation: isolate;
  position: relative;
  display: flex;
  height: 40px;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--zip-muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-decoration: none;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.zip-nav-link > svg,
.zip-sidebar-logout > svg {
  position: relative;
  z-index: 1;
  flex: 0 0 16px;
  opacity: 1;
}

.zip-sidebar:not(:hover) .zip-nav-link {
  flex: 0 0 40px;
  width: 40px;
}

.zip-sidebar:hover .zip-nav-link,
.zip-sidebar:hover .zip-sidebar-logout {
  gap: 14px;
  justify-content: flex-start;
  padding: 0 12px;
}

.zip-nav-link:hover {
  background: rgba(15, 23, 42, 0.03);
  color: var(--zip-foreground);
}

:root[data-theme="dark"] .zip-nav-link:hover {
  background: rgba(255, 255, 255, 0.05);
}

.zip-nav-link.active {
  background: rgba(15, 23, 42, 0.045);
  color: var(--zip-foreground);
}

:root[data-theme="dark"] .zip-nav-link.active {
  background: rgba(255, 255, 255, 0.08);
}

.zip-nav-link.active::before {
  position: absolute;
  left: 3px;
  top: 50%;
  z-index: 0;
  width: 3px;
  height: 18px;
  border-radius: 0 999px 999px 0;
  background: currentColor;
  content: "";
  transform: translateY(-50%);
}

.zip-nav-link.tone-wb.active::before {
  background: #cb11ab;
}

.zip-nav-link.tone-ozon.active::before {
  background: #005bff;
}

.zip-nav-link.tone-neutral.active::before {
  background: #202436;
}

:root[data-theme="dark"] .zip-nav-link.tone-neutral.active::before {
  background: rgba(255, 255, 255, 0.86);
}

.zip-market-mark {
  position: relative;
  z-index: 1;
  display: inline-flex;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-family: Arial, sans-serif;
  font-size: 7.5px;
  font-weight: 800;
}

.zip-market-mark.wb {
  background: rgba(203, 17, 171, 0.12);
  color: #cb11ab;
}

.zip-market-mark.ozon {
  background: rgba(0, 91, 255, 0.12);
  color: #005bff;
}

.zip-market-mark.active.wb,
.zip-market-badge.wb {
  background: #cb11ab;
  color: #ffffff;
}

.zip-market-mark.active.ozon,
.zip-market-badge.ozon {
  background: #005bff;
  color: #ffffff;
}

.zip-sidebar-divider {
  height: 1px;
  margin: 12px 4px 4px;
  background: var(--zip-border-soft);
}

.zip-sidebar-logout {
  margin: 8px;
  width: calc(100% - 16px);
  flex-shrink: 0;
  color: rgba(212, 24, 61, 0.65);
}

.zip-sidebar-logout:hover {
  background: rgba(212, 24, 61, 0.08);
  color: #d4183d;
}

.zip-main {
  min-width: 0;
  flex: 1;
  padding-left: 56px;
}

.zip-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  height: 56px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #eef2ff;
  background: rgba(248, 250, 255, 0.92);
  padding: 0 20px;
  backdrop-filter: blur(18px);
  box-shadow: 0 1px 16px rgba(0, 0, 0, 0.05);
}

:root[data-theme="dark"] .zip-header {
  border-bottom-color: #1f1f2e;
  background: rgba(12, 12, 20, 0.9);
  box-shadow: 0 1px 24px rgba(0, 0, 0, 0.25);
}

.zip-header-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.zip-route-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
}

.zip-header-title strong {
  display: block;
  color: var(--zip-foreground);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.15;
}

.zip-header-title span:not(.zip-route-dot) {
  display: block;
  margin-top: 2px;
  color: var(--zip-muted-2);
  font-size: 10px;
  line-height: 1;
}

.zip-header-actions,
.zip-toolbar-left,
.zip-toolbar-right,
.zip-page-topline,
.zip-filter-row,
.zip-table-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.zip-header-actions {
  flex-shrink: 0;
}

.zip-icon-button,
.zip-button,
.zip-profile-button,
.zip-ghost-button {
  display: inline-flex;
  height: 32px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--zip-muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
  white-space: nowrap;
}

.zip-icon-button {
  width: 32px;
}

.zip-icon-button.small {
  width: 28px;
  height: 28px;
}

.zip-icon-button:hover,
.zip-profile-button:hover,
.zip-ghost-button:hover {
  background: rgba(15, 23, 42, 0.04);
  color: var(--zip-foreground);
}

:root[data-theme="dark"] .zip-icon-button:hover,
:root[data-theme="dark"] .zip-profile-button:hover,
:root[data-theme="dark"] .zip-ghost-button:hover {
  background: rgba(255, 255, 255, 0.06);
}

.zip-icon-button.danger:hover {
  background: rgba(212, 24, 61, 0.1);
  color: #d4183d;
}

.zip-button {
  padding: 0 12px;
}

.zip-button.outline {
  border-color: var(--zip-border);
  background: var(--zip-card);
  color: var(--zip-foreground);
}

.zip-button.outline:hover {
  border-color: rgba(15, 23, 42, 0.18);
  background: var(--zip-card-soft);
}

.zip-profile-button {
  padding: 0 10px;
}

.zip-content {
  min-height: calc(100vh - 56px);
  padding: 20px 24px 32px;
}

.zip-page-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.zip-page-topline {
  justify-content: space-between;
  flex-wrap: wrap;
}

.zip-toolbar-left,
.zip-toolbar-right {
  flex-wrap: wrap;
}

.zip-market-badge {
  display: inline-flex;
  height: 22px;
  align-items: center;
  border-radius: 5px;
  padding: 0 9px;
  font-size: 11px;
  font-weight: 750;
}

.zip-period-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.zip-segment {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border-radius: 7px;
  background: var(--zip-card-soft);
  padding: 2px;
}

.zip-segment button {
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--zip-muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  padding: 0 11px;
}

.zip-segment button.active {
  background: var(--zip-card);
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.08);
  color: var(--zip-foreground);
}

.zip-period-nav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.zip-select-shell {
  position: relative;
  display: inline-flex;
  height: 30px;
  min-width: 174px;
  align-items: center;
  border: 1px solid var(--zip-border);
  border-radius: 8px;
  background: var(--zip-card);
  color: var(--zip-foreground);
}

.zip-select-shell.compact {
  min-width: 134px;
}

.zip-select-shell select {
  width: 100%;
  height: 100%;
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  outline: none;
  padding: 0 28px 0 10px;
}

.zip-select-shell svg {
  position: absolute;
  right: 9px;
  pointer-events: none;
  color: var(--zip-muted);
}

.zip-section-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.zip-section-bar > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.zip-section-bar span {
  color: var(--zip-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.zip-section-bar em {
  color: var(--zip-muted);
  font-size: 11px;
  font-style: normal;
}

.zip-tiles-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.zip-tiles-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.zip-metric-tile,
.zip-mini-kpi,
.zip-settings-card {
  border: 1px solid var(--zip-border);
  border-radius: 8px;
  background: var(--zip-card);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.035);
}

.zip-metric-tile {
  display: flex;
  min-width: 0;
  min-height: 112px;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
}

.zip-metric-tile p,
.zip-mini-kpi span {
  margin: 0;
  overflow: hidden;
  color: var(--zip-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.zip-metric-body {
  display: flex;
  min-width: 0;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

.zip-metric-value-wrap {
  min-width: 0;
}

.zip-metric-tile strong {
  display: block;
  overflow: hidden;
  color: var(--zip-foreground);
  font-size: 22px;
  font-weight: 750;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zip-delta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-top: 5px;
  font-size: 11px;
  font-weight: 750;
}

.zip-delta.good,
.zip-good {
  color: var(--zip-good);
}

.zip-delta.bad {
  color: var(--zip-destructive);
}

.zip-sparkline {
  width: 80px;
  height: 40px;
  flex: 0 0 80px;
}

.zip-alert-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--zip-border);
  border-radius: 8px;
  background: var(--zip-card);
  color: var(--zip-muted);
  font-size: 13px;
  font-weight: 600;
  padding: 11px 12px;
}

.zip-alert-banner.ok {
  border-color: rgba(5, 150, 105, 0.16);
  background: rgba(5, 150, 105, 0.06);
  color: var(--zip-good);
}

.zip-alert-banner.warning {
  border-color: rgba(202, 138, 4, 0.18);
  background: rgba(202, 138, 4, 0.08);
  color: var(--zip-warning);
}

.zip-alert-banner.critical {
  border-color: rgba(212, 24, 61, 0.18);
  background: rgba(212, 24, 61, 0.08);
  color: var(--zip-destructive);
}

.zip-table-toolbar {
  flex-wrap: wrap;
}

.zip-search {
  position: relative;
  display: inline-flex;
  width: 240px;
  height: 34px;
  align-items: center;
  border: 1px solid var(--zip-border);
  border-radius: 8px;
  background: var(--zip-card);
  color: var(--zip-muted);
}

.zip-search > svg {
  margin-left: 10px;
  flex: 0 0 auto;
}

.zip-search input {
  min-width: 0;
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--zip-foreground);
  font-size: 12px;
  outline: none;
  padding: 0 8px;
}

.zip-search button {
  display: inline-grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--zip-muted);
  cursor: pointer;
}

.zip-filter-buttons,
.zip-filter-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.zip-filter-buttons button,
.zip-filter-pill {
  display: inline-flex;
  height: 30px;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--zip-border);
  border-radius: 8px;
  background: var(--zip-card);
  color: var(--zip-muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  padding: 0 10px;
}

.zip-filter-buttons button.active,
.zip-filter-pill.active {
  background: var(--zip-foreground);
  color: var(--zip-bg);
}

.zip-filter-pill span {
  display: inline-flex;
  min-width: 18px;
  justify-content: center;
  border-radius: 999px;
  background: rgba(127, 127, 127, 0.16);
  font-size: 10px;
  padding: 1px 5px;
}

.zip-row-count {
  color: var(--zip-muted);
  font-size: 12px;
  font-weight: 650;
}

.zip-table-frame {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--zip-border);
  border-radius: 12px;
  background: var(--zip-card);
  box-shadow: var(--zip-shadow);
}

.zip-analytics-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.zip-analytics-table th,
.zip-analytics-table td {
  border-right: 1px solid var(--zip-border-soft);
  border-bottom: 1px solid var(--zip-border-soft);
  background: var(--zip-card);
  color: var(--zip-foreground);
  text-align: left;
  vertical-align: middle;
}

.zip-analytics-table th {
  position: sticky;
  top: 0;
  height: 48px;
  padding: 0;
  z-index: 2;
  user-select: none;
}

.zip-analytics-table td {
  height: 45px;
  overflow: hidden;
  padding: 0 12px;
  position: relative;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zip-analytics-table th.pinned,
.zip-analytics-table td.pinned {
  box-shadow: 1px 0 0 var(--zip-border);
}

.zip-analytics-table tr:hover td {
  background: color-mix(in srgb, var(--zip-card-soft) 52%, var(--zip-card));
}

.zip-analytics-table td.right,
.zip-analytics-table th.right {
  text-align: right;
}

.zip-th-sort {
  display: flex;
  width: calc(100% - 30px);
  height: 100%;
  align-items: center;
  gap: 5px;
  border: 0;
  background: transparent;
  color: var(--zip-muted);
  cursor: grab;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  overflow: hidden;
  padding: 0 8px 0 10px;
  text-align: left;
  text-transform: uppercase;
}

.zip-th-sort span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zip-th-sort .muted {
  opacity: 0;
  transition: opacity 120ms ease;
}

th:hover .zip-th-sort .muted {
  opacity: 0.35;
}

.zip-th-pin {
  position: absolute;
  right: 8px;
  top: 50%;
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--zip-muted-2);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%);
  transition: opacity 120ms ease, background 120ms ease, color 120ms ease;
}

.zip-analytics-table th:hover .zip-th-pin,
.zip-analytics-table th:focus-within .zip-th-pin {
  opacity: 1;
  pointer-events: auto;
}

.zip-th-pin:hover {
  background: var(--zip-card-soft);
  color: var(--zip-foreground);
}

.zip-resize {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 6px;
  cursor: col-resize;
}

.zip-resize:hover {
  background: rgba(79, 70, 229, 0.4);
}

.zip-row-resize {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  z-index: 3;
  height: 7px;
  cursor: row-resize;
  opacity: 0;
  transition: opacity 120ms ease, background 120ms ease;
}

.zip-analytics-table tr:hover .zip-row-resize {
  opacity: 1;
}

.zip-row-resize:hover {
  background: rgba(79, 70, 229, 0.28);
}

.zip-empty-cell {
  height: 120px !important;
  color: var(--zip-muted) !important;
  text-align: center !important;
}

.zip-muted-dash,
.zip-muted-text,
.zip-analytics-table td.muted {
  color: var(--zip-muted);
}

.zip-row-alert {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: 5px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 750;
  padding: 5px 7px;
}

.zip-row-alert.warning {
  background: rgba(202, 138, 4, 0.1);
  color: var(--zip-warning);
}

.zip-row-alert.critical {
  background: rgba(212, 24, 61, 0.1);
  color: var(--zip-destructive);
}

.zip-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.28);
  padding: 20px;
}

.zip-modal {
  width: min(100%, 460px);
  max-height: min(720px, 88vh);
  overflow: hidden;
  border: 1px solid var(--zip-border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--zip-card) 96%, transparent);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(20px);
}

.zip-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--zip-border-soft);
  background: var(--zip-card-soft);
  padding: 14px 16px;
}

.zip-modal-head strong {
  font-size: 15px;
}

.zip-modal-body {
  max-height: 70vh;
  overflow: auto;
  padding: 14px;
}

.zip-settings-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.zip-settings-item {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 10px;
  border-radius: 9px;
  padding: 6px 8px;
}

.zip-settings-item:hover {
  background: var(--zip-card-soft);
}

.zip-settings-item.disabled {
  opacity: 0.58;
}

.zip-settings-item > span {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zip-eye-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: var(--zip-muted);
  cursor: pointer;
}

.zip-switch {
  display: inline-flex;
  width: 36px;
  height: 20px;
  align-items: center;
  border: 0;
  border-radius: 999px;
  background: #cbd5e1;
  cursor: pointer;
  padding: 2px;
  transition: background 150ms ease;
}

.zip-switch span {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.2);
  transition: transform 150ms ease;
}

.zip-switch.checked {
  background: var(--zip-primary);
}

.zip-switch.checked span {
  transform: translateX(16px);
}

.zip-tile-style-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.zip-tile-style-grid button {
  display: flex;
  min-height: 112px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 2px solid var(--zip-border);
  border-radius: 12px;
  background: var(--zip-card);
  color: var(--zip-foreground);
  cursor: pointer;
}

.zip-tile-style-grid button.active {
  border-color: var(--zip-primary);
  background: color-mix(in srgb, var(--zip-primary) 5%, var(--zip-card));
}

.zip-tile-style-grid span {
  color: var(--zip-muted);
  font-size: 11px;
  font-weight: 650;
}

.zip-popover-wrap {
  position: relative;
}

.zip-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 80;
  width: 260px;
  border: 1px solid var(--zip-border);
  border-radius: 12px;
  background: var(--zip-card);
  box-shadow: var(--zip-shadow);
  padding: 12px;
}

.zip-popover strong {
  display: block;
  margin-bottom: 10px;
  font-size: 13px;
}

.zip-popover p {
  margin: 8px 0 0;
  color: var(--zip-muted);
  font-size: 12px;
}

.zip-save-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
}

.zip-save-row input {
  min-width: 0;
  height: 30px;
  border: 1px solid var(--zip-border);
  border-radius: 7px;
  background: var(--zip-card);
  color: var(--zip-foreground);
  font-size: 12px;
  outline: none;
  padding: 0 8px;
}

.zip-save-row button,
.zip-view-list button {
  border: 0;
  border-radius: 7px;
  background: var(--zip-card-soft);
  color: var(--zip-foreground);
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  padding: 0 9px;
}

.zip-view-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 8px;
}

.zip-view-list button {
  min-height: 30px;
  text-align: left;
}

.zip-inline-title {
  margin: 0;
  color: var(--zip-foreground);
  font-size: 14px;
  font-weight: 700;
}

.zip-hidden-input {
  display: none;
}

.zip-filter-row {
  justify-content: flex-start;
}

.zip-filter-row .zip-search {
  margin-left: auto;
}

.zip-filter-row.solo-search .zip-search {
  margin-left: 0;
}

.zip-footer-row td {
  background: var(--zip-card) !important;
}

.zip-footer-row strong {
  font-size: 12px;
}

.zip-inventory-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  padding: 4px 7px;
}

.zip-inventory-status.matched {
  background: rgba(5, 150, 105, 0.12);
  color: var(--zip-good);
}

.zip-inventory-status.unmatched {
  background: rgba(202, 138, 4, 0.12);
  color: var(--zip-warning);
}

.zip-inventory-status.barcode_issue {
  background: rgba(212, 24, 61, 0.1);
  color: var(--zip-destructive);
}

.zip-production-status {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  padding: 4px 8px;
}

.zip-production-status.critical {
  background: rgba(212, 24, 61, 0.1);
  color: var(--zip-destructive);
}

.zip-production-status.planned {
  background: rgba(202, 138, 4, 0.12);
  color: var(--zip-warning);
}

.zip-production-status.ok {
  background: rgba(5, 150, 105, 0.12);
  color: var(--zip-good);
}

.zip-production-status.idle {
  background: var(--zip-card-soft);
  color: var(--zip-muted);
}

.zip-stock.critical,
.zip-days.bad {
  color: var(--zip-destructive);
  font-weight: 750;
}

.zip-stock.warning,
.zip-days.warning {
  color: var(--zip-warning);
  font-weight: 750;
}

.zip-stock.ok,
.zip-days.good {
  color: var(--zip-foreground);
}

.zip-mini-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.zip-mini-kpi {
  min-height: 104px;
  padding: 14px;
}

.zip-mini-kpi strong {
  display: block;
  margin-top: 7px;
  color: var(--zip-foreground);
  font-size: 24px;
  font-weight: 780;
  line-height: 1.1;
}

.zip-mini-kpi strong.bad {
  color: var(--zip-destructive);
}

.zip-mini-kpi strong.muted {
  color: var(--zip-muted);
}

.zip-mini-kpi em {
  display: block;
  margin-top: 3px;
  color: var(--zip-muted);
  font-size: 11px;
  font-style: normal;
}

.zip-settings-page {
  max-width: 760px;
  margin: 0 auto;
}

.zip-settings-head {
  margin-bottom: 24px;
}

.zip-settings-head h1 {
  margin: 0;
  color: var(--zip-foreground);
  font-size: 26px;
  font-weight: 780;
  letter-spacing: 0;
}

.zip-settings-head p {
  margin: 6px 0 0;
  color: var(--zip-muted);
  font-size: 13px;
}

.zip-settings-grid {
  display: grid;
  gap: 18px;
}

.zip-settings-card {
  overflow: hidden;
}

.zip-settings-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--zip-border-soft);
  background: var(--zip-card-soft);
  padding: 15px 18px;
}

.zip-settings-card-head > span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--zip-border);
  border-radius: 10px;
  background: var(--zip-card);
  color: var(--zip-muted);
}

.zip-settings-card-head strong {
  display: block;
  color: var(--zip-foreground);
  font-size: 14px;
  font-weight: 750;
}

.zip-settings-card-head p,
.zip-settings-row p {
  margin: 3px 0 0;
  color: var(--zip-muted);
  font-size: 12px;
}

.zip-settings-card-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
}

.zip-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--zip-border-soft);
  padding-bottom: 16px;
}

.zip-settings-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.zip-settings-row-copy {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.zip-settings-row strong {
  display: block;
  color: var(--zip-foreground);
  font-size: 13px;
  font-weight: 700;
}

.zip-select {
  height: 34px;
  border: 1px solid var(--zip-border);
  border-radius: 8px;
  background: var(--zip-card);
  color: var(--zip-foreground);
  font-size: 12px;
  font-weight: 650;
  padding: 0 10px;
}

.zip-connection-field {
  display: grid;
  gap: 8px;
}

.zip-connection-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.zip-connection-label > span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.zip-connection-label strong {
  color: var(--zip-foreground);
  font-size: 13px;
}

.zip-connection-label em {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  border-radius: 999px;
  background: var(--zip-card-soft);
  color: var(--zip-muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
  padding: 3px 7px;
}

.zip-connection-label em.connected {
  background: rgba(5, 150, 105, 0.1);
  color: var(--zip-good);
}

.zip-connection-input {
  position: relative;
}

.zip-connection-input input {
  width: 100%;
  height: 38px;
  border: 1px solid var(--zip-border);
  border-radius: 9px;
  background: var(--zip-card);
  color: var(--zip-foreground);
  font-size: 13px;
  outline: none;
  padding: 0 38px 0 11px;
}

.zip-connection-input button {
  position: absolute;
  right: 8px;
  top: 50%;
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--zip-muted);
  cursor: pointer;
  transform: translateY(-50%);
}

.zip-link-danger {
  display: inline-flex;
  width: max-content;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--zip-destructive);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 0;
}

.zip-mobile-nav {
  display: none;
}

.login-shell {
  background: linear-gradient(135deg, #eef1f7 0%, #e8ecf5 42%, #ede8f5 100%);
}

:root[data-theme="dark"] .login-shell {
  background: linear-gradient(135deg, #0c0c14 0%, #0f0f1e 44%, #0c0e1c 100%);
}

.login-panel {
  max-width: 380px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(26px) saturate(160%);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.08), 0 2px 12px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

:root[data-theme="dark"] .login-panel {
  background: rgba(16, 18, 26, 0.78);
}

@media (max-width: 1180px) {
  .zip-tiles-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .zip-sidebar {
    display: none;
  }

  .zip-main {
    padding-left: 0;
  }

  .zip-content {
    padding: 16px 14px 86px;
  }

  .zip-header {
    padding: 0 14px;
  }

  .zip-header-actions .zip-profile-button span {
    display: none;
  }

  .zip-tiles-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .zip-mini-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .zip-filter-row .zip-search {
    width: 100%;
    margin-left: 0;
  }

  .zip-mobile-nav {
    position: fixed;
    right: 10px;
    bottom: 10px;
    left: 10px;
    z-index: 90;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    border: 1px solid var(--zip-border);
    border-radius: 16px;
    background: color-mix(in srgb, var(--zip-card) 92%, transparent);
    box-shadow: 0 16px 42px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(20px);
    padding: 6px;
  }

  .zip-mobile-nav a {
    display: flex;
    min-width: 0;
    height: 48px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border-radius: 12px;
    color: var(--zip-muted);
    font-size: 10px;
    font-weight: 700;
    text-decoration: none;
  }

  .zip-mobile-nav a.active {
    background: var(--zip-card-soft);
    color: var(--zip-foreground);
  }

  .zip-mobile-nav .zip-market-mark {
    width: 20px;
    height: 20px;
    flex-basis: 20px;
  }
}

@media (max-width: 560px) {
  .zip-tiles-grid,
  .zip-mini-kpi-grid {
    grid-template-columns: 1fr;
  }

  .zip-period-selector,
  .zip-page-topline,
  .zip-toolbar-left,
  .zip-toolbar-right {
    align-items: stretch;
    width: 100%;
  }

  .zip-segment {
    overflow-x: auto;
    max-width: 100%;
  }

  .zip-select-shell,
  .zip-search,
  .zip-button {
    width: 100%;
  }

  .zip-period-nav {
    width: 100%;
  }

  .zip-period-nav .zip-select-shell {
    flex: 1;
  }

  .zip-settings-row {
    align-items: flex-start;
    flex-direction: column;
  }
}
