:root {
  color-scheme: light;
  /* «Складно» — фирменный стиль «Зелёный+Графит». Тема меняется только здесь. */
  --brand: #199a4c;        /* основной зелёный */
  --brand-dark: #12723a;   /* тёмно-зелёный: hover, заголовки */
  --brand-tint: #e6f4ec;   /* светло-зелёная подложка */
  --brand-soft: #eef9f2;   /* ещё светлее */
  --graphite: #23272e;     /* графит: текст, тёмные панели, шапка ТСД */
  --ok: #12b76a; --warn: #f79009; --danger: #e5484d;

  --bg: #f3f6f3;
  --surface: #ffffff;
  --surface-2: #eef9f2;
  --ink: #23272e;
  --muted: #5b6270;
  --line: #e3e8e3;
  /* Обратная совместимость: старые имена — алиасы на бренд (значения меняем здесь, не имена по коду). */
  --green: var(--brand);
  --green-dark: var(--brand-dark);
  --teal: var(--brand);
  --amber: var(--warn);
  --red: var(--danger);
  --blue: #3d6fb6;
  --shadow: 0 18px 45px rgba(35, 39, 46, 0.12);
  --font-ui: "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font-ui);
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

input {
  min-width: 0;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

body.nav-open {
  overflow: hidden;
}

.app-shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 22px 16px;
  color: #ecfaf1;
  background: var(--green-dark);
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.nav-toggle,
.drawer-close {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
}

.nav-toggle {
  width: 44px;
  height: 44px;
  padding: 0;
  color: #23272e;
  background: #dffbe9;
  border-color: var(--line);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.4px;
}

.drawer-close {
  width: 42px;
  color: #117335;
  background: #dffbe9;
}

.nav-toggle svg,
.drawer-close svg {
  width: 20px;
  height: 20px;
}

.nav-overlay {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  background: var(--brand);
  font-weight: 800;
}
.brand-mark svg { width: 26px; height: 26px; display: block; }

.brand strong,
.operator strong {
  display: block;
  font-size: 15px;
}

.brand small,
.operator small {
  display: block;
  margin-top: 2px;
  color: #b4ddc3;
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-list a,
.nav-parent {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  color: #dcf0e3;
  text-decoration: none;
  font-size: 14px;
  background: transparent;
  text-align: left;
}

.nav-list a.active,
.nav-list a:hover,
.nav-parent.active,
.nav-parent:hover {
  color: #117335;
  background: #dffbe9;
}

.nav-parent {
  justify-content: space-between;
}

.nav-caret {
  width: 17px;
  height: 17px;
  flex: none;
  transition: transform 160ms ease;
}

.nav-parent[aria-expanded="true"] .nav-caret {
  transform: rotate(180deg);
}

.nav-submenu {
  display: grid;
  gap: 4px;
  padding: 2px 0 6px 12px;
  animation: panel-in 160ms ease-out;
}

.nav-submenu a {
  min-height: 34px;
  padding-left: 14px;
  border-left: 2px solid rgba(237, 223, 251, 0.28);
  color: #cfe9d9;
  font-size: 13px;
}

.operator {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.operator-dot {
  width: 10px;
  height: 10px;
  border-radius: 99px;
  background: #70d49d;
  box-shadow: 0 0 0 6px rgba(112, 212, 157, 0.14);
}

.sidebar-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  margin-top: 14px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  color: #dcf0e3;
  background: transparent;
  font-size: 14px;
  font-weight: 700;
}

.sidebar-logout:hover {
  color: #117335;
  background: #dffbe9;
}

.sidebar-logout svg {
  width: 18px;
  height: 18px;
}

.workspace {
  display: grid;
  align-content: start;
  gap: 22px;
  min-width: 0;
  padding: 26px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 420px) auto;
  align-items: center;
  gap: 18px;
  min-width: 0;
  /* Запас под фиксированный чип аккаунта в правом верхнем углу. */
  padding-right: 270px;
}

.topbar > *,
.item-board > *,
.panel-grid > *,
.status-layout > *,
.economics-layout > *,
.builder-layout > * {
  min-width: 0;
}

.eyebrow,
.muted {
  color: var(--muted);
  font-size: 13px;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1 {
  margin-top: 4px;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
  overflow-wrap: anywhere;
}

h2 {
  margin-top: 10px;
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.08;
  overflow-wrap: anywhere;
}

h3 {
  font-size: 18px;
}

h4 {
  font-size: 17px;
  line-height: 1.25;
}

.search {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.search svg {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-right: 10px;
  stroke: var(--muted);
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

body.status-empty .topbar {
  grid-template-columns: minmax(220px, 1fr);
}

body.status-empty .topbar .search {
  display: none;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.icon-button,
.primary-action,
.secondary-action,
.ghost-action,
.delete-product,
.task-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
}

.icon-button {
  width: 44px;
  color: var(--green-dark);
  background: var(--surface);
  border-color: var(--line);
}

.icon-button svg,
.primary-action svg,
.secondary-action svg,
.delete-product svg,
.ghost-action svg {
  width: 20px;
  height: 20px;
}

.primary-action {
  gap: 8px;
  padding: 0 16px;
  color: #fff;
  background: var(--green-dark);
}

.primary-action.success {
  background: var(--green);
}

.secondary-action {
  gap: 8px;
  padding: 0 12px;
  color: var(--green-dark);
  background: #e2f9ea;
  border-color: #cdeed9;
  font-weight: 800;
}

.delete-product {
  gap: 7px;
  min-height: 34px;
  padding: 0 10px;
  color: var(--red);
  background: #fff4f2;
  border-color: #f0c8c1;
  font-size: 13px;
  font-weight: 800;
}

.delete-product:hover {
  background: #ffe8e3;
}

.item-board {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: 22px;
  align-items: stretch;
}

.product-media {
  display: grid;
  min-height: 320px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fdfa;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.product-media img {
  display: block;
  width: min(100%, 320px);
  aspect-ratio: 1;
  object-fit: cover;
}

.product-summary {
  display: grid;
  gap: 18px;
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.summary-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
}

.summary-head > div {
  min-width: 0;
}

.status-pill,
.task-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  color: #163c32;
  background: #dffbe9;
  font-size: 13px;
  font-weight: 700;
}

.product-summary p {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.summary-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.summary-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid #d5e2da;
  border-radius: 999px;
  color: var(--green-dark);
  background: #f1faf4;
  font-size: 13px;
  font-weight: 700;
}

.ghost-action {
  flex: 0 0 auto;
  gap: 8px;
  padding: 0 14px;
  color: var(--green-dark);
  background: var(--surface-2);
  border-color: #cfe9d9;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
}

.metric {
  display: grid;
  gap: 8px;
  min-height: 96px;
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: 8px;
  background: #fbfdfc;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  font-size: 28px;
}

.metric.reserve {
  border-left-color: var(--amber);
}

.metric.alert {
  border-left-color: var(--red);
}

.current-place {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.current-place div {
  display: grid;
  gap: 4px;
}

.current-place span {
  color: var(--muted);
  font-size: 13px;
}

.current-place strong {
  font-size: 18px;
  overflow-wrap: anywhere;
}

.tabs {
  display: inline-flex;
  width: fit-content;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #e3f1e8;
}

.tab {
  min-width: 150px;
  min-height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 700;
  text-align: center;
}

.tab.active {
  color: var(--green-dark);
  background: var(--surface);
  box-shadow: 0 4px 14px rgba(72, 17, 115, 0.09);
}

.tab-panel,
.workspace-section {
  animation: panel-in 180ms ease-out;
}

.panel-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.82fr) minmax(420px, 1.35fr) minmax(240px, 0.6fr);
  gap: 18px;
}

.panel,
.task-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.panel {
  padding: 20px;
  min-width: 0;
}

.panel-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.data-list {
  display: grid;
  gap: 0;
  margin: 0;
}

.data-list div {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 16px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.data-list div:first-child {
  border-top: 0;
}

.data-list dt {
  color: var(--muted);
}

.data-list dd {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin: 0;
  font-weight: 700;
}

.color-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #343a38;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.4);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

th,
td {
  padding: 14px 12px;
  border-top: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

td {
  font-weight: 650;
}

.cell-status {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 8px;
  border-radius: 999px;
  background: var(--green);
}

.reserve-dot {
  background: var(--amber);
}

.check-list {
  display: grid;
  gap: 14px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.check-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.35;
}

.check-list span {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: inset 0 0 0 5px #dffbe9;
}

.source-list {
  display: grid;
  gap: 14px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.source-list li {
  display: grid;
  gap: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.source-list li:first-child {
  padding-top: 0;
  border-top: 0;
}

.source-list span {
  color: var(--muted);
  font-size: 13px;
}

.source-list strong {
  line-height: 1.35;
}

.status-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.movement-panel {
  display: grid;
  gap: 18px;
}

.movement-head {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.movement-head div {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.movement-head span {
  color: var(--muted);
  font-size: 13px;
}

.movement-head strong {
  overflow-wrap: anywhere;
}

.movement-table-wrap {
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.movement-table {
  min-width: 1120px;
}

.movement-table th {
  background: #f2faf5;
}

.movement-table td {
  vertical-align: middle;
}

.movement-row {
  transition: background 160ms ease;
}

.movement-row:hover,
.movement-row.active {
  background: #f7fdf9;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--green-dark);
  background: #e2f9ea;
  font-size: 13px;
  font-weight: 800;
}

.status-chip.incoming {
  color: #24456d;
  background: #e4eefb;
}

.status-chip.label {
  color: #5f3f0e;
  background: #f7e8cc;
}

.status-chip.storage {
  color: #117335;
  background: #dcf7e6;
}

.status-chip.order {
  color: #63361d;
  background: #fae0d2;
}

.status-chip.pick {
  color: #29456d;
  background: #e1ecfb;
}

.status-chip.box {
  color: #5b3d11;
  background: #f7e5c1;
}

.status-chip.shipped {
  color: #ffffff;
  background: var(--green-dark);
}

.status-chip.alert {
  color: #7a1f1f;
  background: #fbe3e3;
}

.economics-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(360px, 1.2fr) minmax(280px, 0.85fr);
  gap: 18px;
}

.economy-summary,
.demand-panel {
  grid-column: 1 / -1;
}

.owner-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
}

.owner-kpi {
  display: grid;
  gap: 7px;
  min-height: 112px;
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: #fbfdfc;
}

.owner-kpi.good {
  border-left-color: var(--green);
}

.owner-kpi span,
.money-grid span,
.business-list span,
.unit-lines span {
  color: var(--muted);
  font-size: 13px;
}

.owner-kpi strong {
  font-size: 27px;
  line-height: 1.05;
}

.owner-kpi small {
  color: var(--muted);
  line-height: 1.35;
}

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

.money-grid div {
  display: grid;
  gap: 8px;
  min-height: 94px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.money-grid strong {
  font-size: 24px;
}

.compact-list div {
  grid-template-columns: minmax(145px, 0.9fr) minmax(0, 1fr);
}

.risk-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--green);
}

.risk-dot.low {
  box-shadow: 0 0 0 5px rgba(47, 143, 109, 0.13);
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(12, minmax(58px, 1fr));
  gap: 12px;
  min-height: 250px;
  align-items: stretch;
  overflow-x: auto;
  padding-top: 10px;
  padding-bottom: 4px;
}

.bar-item {
  display: grid;
  grid-template-rows: 24px minmax(150px, 1fr);
  gap: 10px;
  min-width: 0;
  min-height: 230px;
  text-align: center;
}

.bar-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.bar-item strong {
  color: #fff;
  font-size: 15px;
  text-shadow: 0 1px 2px rgba(72, 17, 115, 0.28);
}

.bar-item i {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  align-self: end;
  width: 100%;
  min-height: 34px;
  padding: 0 4px 10px;
  height: var(--bar);
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, #3d6fb6, #4bdb80);
}

.score-panel {
  display: grid;
  align-content: start;
}

.score-ring {
  display: grid;
  width: 148px;
  height: 148px;
  place-items: center;
  margin: 0 auto 18px;
  border-radius: 999px;
  background: conic-gradient(var(--green) 0 86%, #e3e9e4 86% 100%);
  position: relative;
}

.score-ring::before {
  position: absolute;
  inset: 12px;
  border-radius: inherit;
  content: "";
  background: var(--surface);
}

.score-ring strong,
.score-ring span {
  position: relative;
  z-index: 1;
}

.score-ring strong {
  align-self: end;
  font-size: 40px;
  line-height: 1;
}

.score-ring span {
  align-self: start;
  color: var(--muted);
  font-size: 12px;
}

.business-list,
.unit-lines {
  display: grid;
  gap: 0;
  padding: 0;
  margin: 0;
  list-style: none;
}

.business-list li,
.unit-lines div {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.business-list li:first-child,
.unit-lines div:first-child {
  border-top: 0;
}

.business-list strong,
.unit-lines strong {
  text-align: right;
}

.unit-lines .total {
  margin-top: 4px;
  padding: 15px 0 0;
  border-top: 2px solid var(--green);
}

.unit-lines .total strong {
  color: var(--green-dark);
  font-size: 22px;
}

.products-layout {
  display: grid;
  gap: 18px;
}

.status-lookup {
  display: grid;
  min-height: 45vh;
  align-items: center;
}

.scan-line {
  display: grid;
  gap: 10px;
  width: min(720px, 100%);
}

.scan-line span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.scan-line input {
  width: 100%;
  min-height: 64px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 24px;
  font-weight: 800;
  outline: 0;
}

.scan-line input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(138, 75, 219, 0.14), var(--shadow);
}

.products-panel {
  display: grid;
  gap: 18px;
}

.catalog-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.catalog-kpis article {
  display: grid;
  gap: 6px;
  min-height: 86px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.catalog-kpis span {
  color: var(--muted);
  font-size: 13px;
}

.catalog-kpis strong {
  color: var(--green-dark);
  font-size: 26px;
}

.products-table {
  min-width: 1120px;
}

.products-table tbody tr[data-product-id],
.added-products-table tbody tr[data-product-id] {
  cursor: pointer;
  transition: background 160ms ease, box-shadow 160ms ease;
}

.products-table tbody tr[data-product-id]:hover,
.products-table tbody tr[data-product-id].active,
.added-products-table tbody tr[data-product-id]:hover {
  background: #f2fcf6;
  box-shadow: inset 4px 0 0 var(--green);
}

.products-table td strong {
  display: block;
  color: var(--ink);
}

.products-table td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.empty-products-row td {
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

.builder-layout {
  display: grid;
  grid-template-columns: minmax(420px, 1.2fr) minmax(320px, 0.8fr);
  gap: 18px;
}

.builder-form-panel {
  grid-row: span 2;
}

.product-form {
  display: grid;
  gap: 18px;
}

.form-section {
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.form-section legend {
  padding: 0 6px;
  color: var(--green-dark);
  font-weight: 800;
}

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

.product-form label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.barcode-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  min-width: 0;
}

.barcode-field label {
  min-width: 0;
}

.barcode-field .secondary-action {
  min-height: 44px;
  white-space: nowrap;
}

.product-form label span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.product-form input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  outline: 0;
}

.product-form input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(138, 75, 219, 0.14);
}

.product-form input[readonly] {
  color: var(--green-dark);
  background: #f1faf4;
  font-weight: 800;
}

.photo-drop {
  min-height: 86px;
  padding: 14px;
  border: 1px dashed #a5c4b0;
  border-radius: 8px;
  background: #f1faf4;
}

.photo-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.photo-drop strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  color: #fff;
  background: var(--green-dark);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.form-actions .ghost-action {
  min-height: 44px;
}

.preview-panel {
  display: grid;
  align-content: start;
  gap: 16px;
}

.preview-card {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.preview-photo {
  display: grid;
  width: 100%;
  aspect-ratio: 1;
  place-items: center;
  border: 1px dashed #a5c4b0;
  border-radius: 8px;
  color: var(--muted);
  background: #f1faf4;
  font-size: 14px;
  font-weight: 800;
}

.preview-photo img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  object-fit: cover;
}

.preview-photo:not(.empty) {
  border-style: solid;
  background: #f8fcf9;
}

.preview-photo:not(.empty) span {
  display: none;
}

.preview-card h4 {
  font-size: 19px;
}

.preview-card p {
  margin-top: 6px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.preview-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preview-tags span {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--green-dark);
  background: #e2f9ea;
  font-size: 13px;
  font-weight: 800;
}

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

.calc-grid div {
  display: grid;
  gap: 7px;
  min-height: 86px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.calc-grid span,
.quick-vars span {
  color: var(--muted);
  font-size: 13px;
}

.calc-grid strong {
  font-size: 23px;
}

.quick-vars {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.quick-vars h4 {
  margin-bottom: 8px;
}

.quick-vars ul {
  display: grid;
  gap: 0;
  padding: 0;
  margin: 0;
  list-style: none;
}

.quick-vars li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.quick-vars li:first-child {
  border-top: 0;
}

.quick-vars strong {
  text-align: right;
}

.added-products {
  grid-column: 1 / -1;
  scroll-margin-top: 18px;
}

.added-products-table {
  min-width: 1120px;
}

.empty-draft-row td {
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

.added-products-table tr.added-row td {
  animation: added-row-flash 1600ms ease;
}

.added-products-table tr.added-row td:first-child {
  box-shadow: inset 4px 0 0 var(--green);
}

.employees-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(420px, 1.1fr);
  gap: 18px;
}

.employee-card-panel,
.employee-log-panel {
  grid-row: span 2;
}

.employee-card {
  display: grid;
  gap: 18px;
}

.employee-avatar {
  display: grid;
  width: 86px;
  height: 86px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--green-dark);
  font-size: 24px;
  font-weight: 900;
}

.employee-card p {
  margin-top: 8px;
  color: var(--muted);
}

.employee-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 4px;
}

.employees-table,
.employees-log-table {
  min-width: 820px;
}

.employees-table tbody tr[data-employee-id] {
  cursor: pointer;
  transition: background 160ms ease, box-shadow 160ms ease;
}

.employees-table tbody tr[data-employee-id]:hover,
.employees-table tbody tr[data-employee-id].active {
  background: #f2fcf6;
  box-shadow: inset 4px 0 0 var(--green);
}

.integrations-layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 18px;
}

.integrations-head-panel,
.integration-tabs,
.integration-card,
.integration-map-panel,
.integration-log-panel {
  grid-column: 1 / -1;
}

.integration-tabs {
  display: inline-flex;
  width: fit-content;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #e3f1e8;
}

.integration-tab {
  min-width: 150px;
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.integration-tab.active {
  color: var(--green-dark);
  background: var(--surface);
  box-shadow: 0 4px 14px rgba(72, 17, 115, 0.09);
}

.integration-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.integration-summary article {
  display: grid;
  gap: 6px;
  min-height: 86px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.integration-summary span,
.integration-form label span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.integration-summary strong {
  color: var(--green-dark);
  font-size: 24px;
}

.integration-card {
  display: grid;
  align-content: start;
}

.integration-form {
  display: grid;
  gap: 12px;
}

.integration-form label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.integration-form input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  outline: 0;
}

.integration-form input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(138, 75, 219, 0.14);
}

.integration-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 4px;
}

.integration-map-table,
.integration-log-table {
  min-width: 920px;
}

.route {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 14px;
}

.route::before {
  position: absolute;
  top: 32px;
  left: 24px;
  right: 24px;
  height: 2px;
  content: "";
  background: linear-gradient(90deg, var(--green) 0 44%, var(--line) 44% 100%);
}

.route-step {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
  min-height: 132px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  text-align: left;
  background: #fbfdfc;
}

.route-step:hover,
.route-step.active {
  border-color: var(--teal);
  box-shadow: 0 10px 22px rgba(138, 75, 219, 0.14);
}

.step-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: var(--green);
  font-weight: 800;
}

.route-step.current {
  border-color: var(--teal);
  background: #edfbf2;
}

.route-step.current .step-icon {
  background: var(--teal);
}

.route-step.next {
  color: #526059;
  background: #f8fcf9;
}

.route-step.next .step-icon {
  color: var(--muted);
  background: #dfe6e1;
}

.route-step strong {
  font-size: 15px;
}

.route-step small {
  color: var(--muted);
  line-height: 1.35;
}

.task-panel {
  display: grid;
  align-content: start;
}

.task-badge {
  color: #5a3311;
  background: #f6dfc3;
}

.task-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  background: #fff9f1;
  border-color: #ead0aa;
}

.task-code {
  color: var(--amber);
  font-size: 13px;
  font-weight: 800;
}

.task-card p {
  color: #6d5d4e;
  line-height: 1.45;
}

.task-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 4px;
}

.task-actions button {
  color: #fff;
  background: var(--green-dark);
}

.task-actions button.secondary {
  color: var(--green-dark);
  background: #fff;
  border-color: #cfe9d9;
}

.event-list {
  display: grid;
  gap: 0;
  padding: 0;
  margin: 20px 0 0;
  list-style: none;
}

.event-list li {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 12px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.event-list time {
  color: var(--muted);
  font-size: 13px;
}

.event-list span {
  line-height: 1.35;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: min(360px, calc(100vw - 32px));
  padding: 14px 16px;
  border-radius: 8px;
  color: #fff;
  background: var(--green-dark);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes added-row-flash {
  0%,
  72% {
    background: #e3faeb;
  }
  100% {
    background: transparent;
  }
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: min(320px, calc(100vw - 48px));
    transform: translateX(-105%);
    box-shadow: 24px 0 55px rgba(22, 10, 32, 0.25);
    transition: transform 180ms ease;
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  .nav-toggle,
  .drawer-close {
    display: inline-flex;
  }

  .nav-overlay {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: block;
    border: 0;
    background: rgba(26, 12, 38, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  body.nav-open .nav-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .topbar {
    grid-template-columns: auto minmax(0, 1fr);
    padding-right: 0;
  }

  .user-chip {
    position: static;
    grid-column: 1 / -1;
    justify-self: end;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .search,
  .top-actions {
    grid-column: 1 / -1;
  }

  .top-actions {
    justify-content: start;
  }

  .panel-grid,
  .status-layout {
    grid-template-columns: 1fr;
  }

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

  .builder-layout {
    grid-template-columns: 1fr;
  }

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

  .employees-layout {
    grid-template-columns: 1fr;
  }

  .employee-card-panel,
  .employee-log-panel {
    grid-row: auto;
  }

  .economy-summary,
  .demand-panel {
    grid-column: 1 / -1;
  }

  .owner-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .catalog-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .workspace {
    padding: 18px;
  }

  .item-board {
    grid-template-columns: 1fr;
  }

  .product-media {
    min-height: 260px;
  }

  .summary-head,
  .current-place {
    grid-template-columns: 1fr;
    display: grid;
  }

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

  .economics-layout,
  .owner-kpis,
  .catalog-kpis,
  .builder-layout,
  .employees-layout,
  .integrations-layout,
  .integration-summary {
    grid-template-columns: 1fr;
  }

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

  .tabs {
    width: 100%;
  }

  .integration-tabs {
    width: 100%;
  }

  .tab,
  .integration-tab {
    flex: 1;
    min-width: 0;
  }

  .route {
    grid-template-columns: 1fr;
  }

  .route::before {
    top: 20px;
    bottom: 20px;
    left: 33px;
    right: auto;
    width: 2px;
    height: auto;
    background: linear-gradient(180deg, var(--green) 0 44%, var(--line) 44% 100%);
  }

  .route-step {
    min-height: 94px;
    grid-template-columns: 38px minmax(0, 1fr);
    align-items: center;
  }

  .route-step small {
    grid-column: 2;
  }

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

@media (max-width: 560px) {
  h1 {
    font-size: 31px;
  }

  h2 {
    font-size: 25px;
  }

  .metrics,
  .task-actions,
  .catalog-kpis,
  .barcode-field,
  .money-grid,
  .form-grid,
  .calc-grid,
  .employee-actions,
  .integration-actions {
    grid-template-columns: 1fr;
  }

  .scan-line input {
    min-height: 56px;
    font-size: 19px;
  }

  .product-summary,
  .panel {
    padding: 16px;
  }

  .movement-head {
    grid-template-columns: 1fr;
  }

  .data-list div {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .business-list li,
  .unit-lines div,
  .quick-vars li {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .business-list strong,
  .unit-lines strong,
  .quick-vars strong {
    text-align: left;
  }
}

/* --- Приёмка --- */
.receiving-layout {
  display: grid;
  gap: 18px;
}

.receiving-operator {
  display: grid;
  gap: 16px;
}

.receiving-operator select {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  font-size: 16px;
  font-weight: 700;
  outline: 0;
}

.receiving-operator select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(138, 75, 219, 0.14);
}

.receiving-flow {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.receiving-step-panel {
  display: grid;
  gap: 14px;
}

.receiving-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.receiving-progress {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 14px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

.receiving-progress strong {
  font-size: 14px;
  color: var(--ink);
}

.receiving-over-warning {
  margin: 0;
  padding: 10px 14px;
  border: 1px solid #ecbcbc;
  border-radius: 10px;
  background: #fbe3e3;
  color: #7a1f1f;
  font-size: 13px;
  font-weight: 700;
}

.supply-row {
  cursor: pointer;
}

/* --- 3D-схема склада --- */
.map3d-scroll {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #f6fdf9 0%, #e6f7ec 100%);
}

.map3d-svg {
  display: block;
}

.map3d-empty {
  padding: 18px;
}

.map3d-top {
  fill: #cdeed9;
  stroke: #afdbbf;
  stroke-width: 1;
}

.map3d-side {
  fill: #b7e0c6;
  stroke: #a1d1b3;
  stroke-width: 1;
}

.map3d-cell {
  cursor: pointer;
}

.map3d-free {
  fill: #ffffff;
  stroke: #cfe9d9;
  stroke-width: 1;
}

.map3d-cell:hover .map3d-free {
  fill: #edfbf2;
}

.map3d-occ {
  fill: var(--green);
  stroke: #139643;
  stroke-width: 1;
}

.map3d-cell:hover .map3d-occ {
  fill: #3bd674;
}

.map3d-cell-text {
  font-size: 11.5px;
  font-weight: 800;
  fill: #356246;
  text-anchor: middle;
  pointer-events: none;
  user-select: none;
}

.map3d-cell-text-inv {
  fill: #ffffff;
}

.map3d-floor {
  fill: #e7f7ed;
  stroke: #d0ecda;
}

.map3d-shelf {
  fill: #c6ead3;
  stroke: #abddbd;
  stroke-width: 1;
}

.map3d-frame {
  fill: #ffffff;
  stroke: #c3e6d0;
}

.map3d-row {
  transition: opacity 0.45s ease;
}

.map3d-dim {
  opacity: 0.4;
}

.map3d-ghost {
  opacity: 0.06;
  pointer-events: none;
}

.map3d-plate {
  cursor: pointer;
}

.map3d-plate rect {
  fill: #18c457;
  stroke: #139643;
  stroke-width: 1;
}

.map3d-plate text {
  fill: #ffffff;
  font-size: 12px;
  font-weight: 800;
  text-anchor: middle;
  letter-spacing: 0.4px;
  pointer-events: none;
}

.map3d-plate:hover rect {
  fill: #2ce06e;
}

.map3d-plate-active rect {
  fill: #117335;
  stroke: #23272e;
}

.map3d-plate {
  transition: opacity 0.45s ease;
}

.map3d-plate-dim {
  opacity: 0.4;
}

.map3d-row-label,
.map3d-zone-label {
  font-size: 13px;
  font-weight: 800;
  fill: #2a6b42;
}

.map3d-row-active {
  fill: #e2601c;
  font-size: 15px;
}

.map3d-hl {
  fill: #ffb35c;
  stroke: #e2601c;
  stroke-width: 2.5;
  animation: map3d-pulse 1s ease-in-out infinite;
}

.map3d-hl ~ .map3d-cell-text {
  fill: #5b2c07;
}

.map3d-arrow {
  fill: #e2601c;
  stroke: #9c3c0a;
  stroke-width: 1;
  animation: map3d-bounce 0.85s ease-in-out infinite;
  pointer-events: none;
}

@keyframes map3d-pulse {
  0%,
  100% {
    fill: #ffb35c;
  }
  50% {
    fill: #ffd9a8;
  }
}

@keyframes map3d-bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-7px);
  }
}

/* --- План склада (вид сверху) и редактор рядов --- */
.map3d-room {
  fill: #f8fefa;
  stroke: #c9ecd6;
  stroke-width: 1.5;
}

.map3d-svg {
  cursor: grab;
  touch-action: none;
}

.map3d-svg:active {
  cursor: grabbing;
}

.map3d-grid {
  stroke: #e6f8ed;
  stroke-width: 1;
}

.map3d-rack-g {
  cursor: grab;
}

.map3d-rack {
  fill: #d4f5e0;
  stroke: #4bdb80;
  stroke-width: 1.6;
}

.map3d-rack-g:hover .map3d-rack {
  fill: #c7f3d7;
}

.map3d-rackface {
  fill: #eafbf0;
  stroke: #6fd093;
  stroke-width: 1.4;
}

.map3d-approach-line {
  stroke: #18c457;
  stroke-width: 4;
  stroke-linecap: round;
}

.map3d-rack-tick-thin {
  stroke-width: 0.7;
  opacity: 0.7;
}

.map3d-rack-tick {
  stroke: #95e0b1;
  stroke-width: 1;
}

.map3d-approach {
  fill: #18c457;
}

.map3d-rack-selected .map3d-rack {
  fill: #ddf3e5;
  stroke: #18c457;
  stroke-width: 3;
}

.map3d-rack-hl .map3d-rack {
  stroke: #e2601c;
  stroke-width: 3;
}

.map3d-rack-dimmed {
  opacity: 0.3;
  transition: opacity 0.4s ease;
}

.map3d-rack-g,
.map3d-rack-label {
  transition: opacity 0.4s ease;
}

.map3d-rack-label {
  font-size: 14px;
  font-weight: 800;
  fill: #117335;
  text-anchor: middle;
  pointer-events: none;
  user-select: none;
  paint-order: stroke;
  stroke: #ffffff;
  stroke-width: 3px;
}

.map3d-rack-label-active {
  fill: #18c457;
  font-size: 15px;
}

.map3d-axis {
  font-size: 12px;
  font-weight: 800;
  fill: #5a856a;
  text-anchor: middle;
}

.map3d-axis-right {
  text-anchor: end;
}

.map3d-wrap {
  position: relative;
}

.map-zoom {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  display: grid;
  gap: 6px;
}

.map-zoom-btn {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #117335;
  background: #ffffff;
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(72, 17, 115, 0.12);
}

.map-zoom-btn:hover {
  background: #dffbe9;
}

.row-tools {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

.row-tools strong {
  font-size: 14px;
  color: #117335;
}

.row-tools-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.row-tools-buttons .ghost-action {
  min-height: 38px;
  padding: 0 12px;
}

.row-tools-delete {
  margin-left: auto;
  color: var(--red);
  border-color: #f0c8c1;
  background: #fff4f2;
}

.map3d-more {
  font-size: 11px;
  font-weight: 700;
  fill: #7d8d84;
}

.cells-preview {
  margin: 4px 0 6px;
}

.report-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 6px;
}

.report-card {
  display: grid;
  gap: 6px;
  justify-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.report-card strong {
  font-size: 30px;
  line-height: 1;
  color: #117335;
}

.report-card small {
  color: var(--muted);
}

.map3d-result {
  padding: 8px 12px;
  border-radius: 8px;
  background: #fbe3e3;
  color: #7a1f1f;
  font-weight: 700;
}

.map3d-result.map3d-result-ok {
  background: #e2f9ea;
  color: #117335;
}

.supply-item-grid {
  align-items: end;
}

.supply-item-add button {
  width: 100%;
}

.receiving-suggest {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
  width: min(720px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.receiving-suggest li {
  display: grid;
  gap: 2px;
  padding: 10px 14px;
  cursor: pointer;
  background: var(--surface);
}

.receiving-suggest li:hover,
.receiving-suggest li:focus {
  background: var(--surface-2);
  outline: 0;
}

.receiving-suggest li strong {
  font-size: 14px;
  color: var(--ink);
}

.receiving-suggest li small {
  color: var(--muted);
  font-size: 12px;
}

.receiving-suggest-empty {
  color: var(--muted);
  cursor: default;
}

.receiving-card {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.receiving-card-media {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2);
}

.receiving-card-media img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}

.receiving-card-body {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.receiving-card-body h2 {
  margin: 0;
  font-size: 20px;
  color: var(--ink);
}

.receiving-card-body > p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.receiving-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

@media (max-width: 720px) {
  .receiving-card {
    grid-template-columns: 1fr;
  }

  .receiving-card-media img {
    height: 200px;
  }
}

/* --- Авторизация --- */
.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--bg);
}

.auth-card {
  width: min(420px, 100%);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.auth-brand strong {
  display: block;
  font-size: 18px;
  color: var(--ink);
}

.auth-brand small {
  color: var(--muted);
  font-size: 12px;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label {
  display: grid;
  gap: 6px;
}

.auth-form label span {
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
}

.auth-form input {
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  outline: 0;
}

.auth-form input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(25, 154, 76, 0.16);
}

/* --- Баннер пробного периода --- */
.trial-banner {
  position: sticky; top: 0; z-index: 60;
  padding: 8px 16px; text-align: center; font-size: 13px; font-weight: 700;
  color: #fff; background: var(--brand-dark);
}
.trial-banner-expired { background: var(--danger); }

/* --- Регистрация: плитки профилей и согласие --- */
.auth-card-register { max-width: 520px; }
.reg-legend { margin: 0 0 10px; font-weight: 800; color: var(--ink); }
.profile-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.profile-tile {
  text-align: left; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--surface); cursor: pointer; display: grid; gap: 4px; transition: border-color .12s, background .12s;
}
.profile-tile:hover { border-color: var(--brand); background: var(--brand-soft); }
.profile-tile strong { font-size: 14px; color: var(--ink); }
.profile-tile small { font-size: 12px; color: var(--muted); line-height: 1.35; }
.reg-chosen { margin: 0 0 6px; font-weight: 800; color: var(--brand-dark); }
.reg-plan-banner { margin: 0 0 14px; padding: 10px 14px; border-radius: 10px; background: var(--brand-tint); border: 1px solid #cfe6d8; color: var(--ink); font-size: 13px; line-height: 1.4; }
.reg-plan-banner b { color: var(--brand-dark); }
.link-back { align-self: start; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; font-size: 13px; }
.reg-consent { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: start; }
.reg-consent input { min-height: 0; width: 18px; height: 18px; margin-top: 2px; }
.reg-consent span { font-size: 12px; color: var(--muted); line-height: 1.4; }
.reg-consent a { color: var(--brand-dark); }
@media (max-width: 520px) { .profile-tiles { grid-template-columns: 1fr; } }

.auth-form .primary-action,
.auth-form .ghost-action {
  width: 100%;
  justify-content: center;
}

.auth-error {
  margin: 0;
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

.auth-hint {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

/* --- Шапка: организация и пользователь --- */
.org-switch {
  display: grid;
  gap: 4px;
}

.org-switch span {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
}

.org-switch select {
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  outline: 0;
}

.user-chip {
  position: fixed;
  top: 12px;
  right: 18px;
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 6px 18px rgba(22, 10, 32, 0.08);
}

.user-chip-info {
  display: grid;
  text-align: right;
}

.user-chip-info strong {
  font-size: 13px;
  color: var(--ink);
}

.user-chip-info small {
  font-size: 11px;
  color: var(--muted);
}

.admin-layout {
  display: grid;
  gap: 18px;
}

/* --- Модальное окно --- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(72, 17, 115, 0.35);
}

.modal-card {
  width: min(420px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
}

.modal-close svg {
  width: 20px;
  height: 20px;
}

.modal-close:hover {
  background: var(--line);
}

/* --- Места хранения и карта склада --- */
.cells-layout {
  display: grid;
  gap: 18px;
}

.warehouse-map {
  display: grid;
  gap: 16px;
}

.map-zone {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-2);
}

.map-zone h4 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.zone-gate {
  border-left: 4px solid var(--teal);
}
.zone-table {
  border-left: 4px solid var(--blue);
}
.zone-shipping {
  border-left: 4px solid var(--amber);
}
.zone-mezzanine {
  border-left: 4px solid var(--green);
}

.map-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.map-cell {
  min-width: 52px;
  min-height: 40px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.map-cell.free {
  border-style: dashed;
  color: var(--muted);
}

.map-cell.occupied {
  background: var(--green);
  border-color: var(--green-dark);
  color: #fff;
}

.map-cell:hover {
  box-shadow: 0 0 0 2px rgba(138, 75, 219, 0.25);
}

.mezz-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.mezz-row:first-of-type {
  border-top: 0;
}

.mezz-row-label {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  padding-top: 8px;
}

.mezz-grid {
  display: grid;
  gap: 4px;
}

.mezz-floor-label {
  display: inline-flex;
  align-items: center;
  min-width: 32px;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
}

/* --- Схема склада (floor plan) --- */
.floor-plan {
  display: grid;
  gap: 3px;
  padding: 12px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  min-height: 120px;
}

.floor-plan-empty {
  display: block;
}

.floor-zone {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 6px 8px;
  border-radius: 6px;
  overflow: hidden;
  color: #fff;
  min-width: 0;
}

.floor-zone strong {
  font-size: 12px;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.floor-zone small {
  font-size: 10px;
  opacity: 0.9;
}

.zt-reception {
  background: var(--teal);
}
.zt-storage {
  background: var(--green);
}
.zt-shipping {
  background: var(--amber);
}
.zt-office {
  background: var(--blue);
}
.zt-aisle {
  background: repeating-linear-gradient(45deg, var(--surface), var(--surface) 6px, var(--surface-2) 6px, var(--surface-2) 12px);
  color: var(--muted);
  border: 1px dashed var(--line);
}

.legend-chip {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}
.legend-chip.zt-aisle {
  color: var(--muted);
}

/* --- Заголовки групп меню --- */
.nav-group-label {
  display: block;
  padding: 16px 12px 4px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  /* Тёмная боковая панель — светлый, но приглушённый заголовок группы (был нечитаемый серый). */
  color: rgba(220, 240, 227, 0.62);
}

.nav-group-label:first-child {
  padding-top: 4px;
}

/* Иконки пунктов меню + интерактивность */
.nav-list a,
.nav-parent { gap: 11px; }
.nav-ico {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.9;
  stroke-linecap: round; stroke-linejoin: round;
  opacity: 0.72; transition: transform 0.18s ease, opacity 0.18s ease;
}
.nav-list a:hover .nav-ico,
.nav-parent:hover .nav-ico { opacity: 1; transform: translateX(2px) scale(1.1); }
.nav-list a.active .nav-ico,
.nav-parent.active .nav-ico { opacity: 1; }
.nav-parent > span:first-child { display: inline-flex; align-items: center; gap: 11px; }

/* Замена эмодзи-иконок на SVG */
.cam-btn { color: var(--brand-dark); }
.cam-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.map-zoom-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.msg-ico { width: 16px; height: 16px; vertical-align: -3px; margin-right: 5px; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.msg-ico.ok { stroke: var(--ok); }
.msg-ico.warn { stroke: var(--warn); }
.cell-kind-ico { width: 15px; height: 15px; vertical-align: -2px; margin-right: 6px; fill: none; stroke: var(--brand-dark); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* --- Камера-сканер у строк ввода ШК --- */
.scan-line,
label.has-cam {
  position: relative;
}

.cam-btn {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2, #f2fbf5);
  font-size: 20px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.cam-btn:hover {
  border-color: var(--brand);
  background: var(--brand-tint);
}

.cam-scan.cam-inline {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  width: min(320px, 100%);
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(35, 12, 61, 0.22);
}

.cam-scan .cam-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
}

.cam-scan .cam-close {
  border: 0;
  background: transparent;
  font-size: 16px;
  cursor: pointer;
  color: var(--muted);
  padding: 4px 8px;
}

.cam-scan .cam-view {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: #23272e;
  aspect-ratio: 4 / 3;
}

.cam-scan video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cam-scan .cam-frame {
  position: absolute;
  inset: 14%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 10px;
  box-shadow: 0 0 0 999px rgba(20, 8, 36, 0.35);
  pointer-events: none;
}

.cam-scan.cam-hit .cam-frame {
  border-color: #35c46a;
}

.cam-scan .cam-status {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.cam-scan .cam-status.cam-error {
  color: #b3261e;
  font-weight: 700;
}

.cam-scan .cam-torch {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

/* --- Формы: группировка полей, данные входа сотрудника --- */
.form-fieldset {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px 4px;
  margin: 0 0 14px;
}
.form-fieldset legend {
  padding: 0 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.employee-credentials {
  margin: 4px 0 14px;
  padding: 14px 16px;
  border: 1px solid var(--teal, #4bdb80);
  border-radius: 12px;
  background: rgba(138, 75, 219, 0.07);
  font-size: 14px;
  line-height: 1.5;
}
.employee-credentials b { color: var(--ink); }
.ghost-action.small {
  padding: 6px 12px;
  font-size: 13px;
  min-height: auto;
}

/* --- Модалки редактирования: доп. элементы --- */
.panel-title-actions { display: flex; align-items: center; gap: 12px; }
.modal-meta { color: var(--muted); font-size: 13px; margin: -4px 0 4px; }
.modal-check { display: flex; align-items: center; gap: 10px; flex-direction: row !important; cursor: pointer; }
.modal-check input { width: 18px; height: 18px; flex: 0 0 auto; }
.modal-check span { font-weight: 600; }

/* --- Список сотрудников в карточке (2 колонки) --- */
.employee-2col { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 18px; align-items: start; }
.employee-picker { display: grid; gap: 6px; max-height: 60vh; overflow-y: auto; }
.employee-pick {
  display: grid; gap: 2px; text-align: left; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface, #fff);
  font: inherit; cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.employee-pick:hover { border-color: var(--teal, #4bdb80); }
.employee-pick.active { border-color: var(--teal, #4bdb80); background: rgba(138, 75, 219, 0.08); }
.employee-pick b { font-size: 14px; color: var(--ink); }
.employee-pick small { font-size: 12px; color: var(--muted); }
.panel-title.compact { margin-bottom: 10px; }
.panel-title.compact h4 { margin: 0; font-size: 15px; }
@media (max-width: 720px) {
  .employee-2col { grid-template-columns: 1fr; }
  .employee-picker { max-height: 40vh; }
}
