/* Дизайн-система Carbon ERP.
   В разметке нет цветовых литералов: только роли из этого файла.
   Тема — ось оформления, плотность — ось рабочего места; они независимы. */

:root {
  color-scheme: dark;

  --bg: #0d1216;
  --surface: #182027;
  --surface-2: #11191e;
  --line: #31414a;
  --line-strong: #465963;
  --text: #edf2f4;
  --text-2: #c7d1d5;
  --text-3: #8fa6ae;
  --text-disabled: #465963;

  --accent: #62d5a0;
  --on-accent: #07120c;
  --accent-text: #62d5a0;
  --accent-line: #39715d;
  --secondary: #2b3d46;

  --ok: #7ee2a8;
  --ok-line: #375a4e;
  --warn: #ffd166;
  --warn-line: #62593b;
  --danger: #ff8e8e;
  --danger-line: #5d4141;
  --info: #7ec8e2;
  --info-line: #35525f;
  --restricted: #b3a6e4;
  --restricted-line: #474860;

  --shadow: 0 1.25rem 4rem rgb(0 0 0 / 18%);
  --backdrop: radial-gradient(circle at 15% 0%, rgb(40 75 74 / 35%), transparent 34rem);

  --r-card: 1rem;
  --r-block: 0.8rem;
  --r-inner: 0.7rem;
  --r-control: 0.65rem;

  --row-h: 40px;
  --control-h: 2.8rem;
  --font: 14px;
  --gap: 1rem;

  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-synthesis: none;
}

/* Светлая тема — не инверсия: у каждой роли собственное значение.
   Пастель тёмной темы на белом даёт около 2:1 и перестаёт читаться. */
:root[data-theme="light"] {
  color-scheme: light;

  --bg: #f2f5f6;
  --surface: #ffffff;
  --surface-2: #eef1f3;
  --line: #d5dcdf;
  --line-strong: #b2bec3;
  --text: #0f1a20;
  --text-2: #3d4b52;
  --text-3: #5d6d75;
  --text-disabled: #98a6ac;

  --accent: #4fc79a;
  --on-accent: #07231a;
  --accent-text: #0f7a54;
  --accent-line: #7fcfae;
  --secondary: #dfe6e8;

  --ok: #0f7a4e;
  --ok-line: #9fd8bb;
  --warn: #8a5d00;
  --warn-line: #e8cf94;
  --danger: #b3261e;
  --danger-line: #eab4b0;
  --info: #0d6d8c;
  --info-line: #a8d3e2;
  --restricted: #5a45a8;
  --restricted-line: #c4bbe8;

  --shadow: 0 0.75rem 2.5rem rgb(15 26 32 / 8%);
  --backdrop: radial-gradient(circle at 15% 0%, rgb(79 199 154 / 12%), transparent 34rem);
}

/* Без выбора пользователя действует системная настройка устройства. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;

    --bg: #f2f5f6;
    --surface: #ffffff;
    --surface-2: #eef1f3;
    --line: #d5dcdf;
    --line-strong: #b2bec3;
    --text: #0f1a20;
    --text-2: #3d4b52;
    --text-3: #5d6d75;
    --text-disabled: #98a6ac;

    --accent: #4fc79a;
    --on-accent: #07231a;
    --accent-text: #0f7a54;
    --accent-line: #7fcfae;
    --secondary: #dfe6e8;

    --ok: #0f7a4e;
    --ok-line: #9fd8bb;
    --warn: #8a5d00;
    --warn-line: #e8cf94;
    --danger: #b3261e;
    --danger-line: #eab4b0;
    --info: #0d6d8c;
    --info-line: #a8d3e2;
    --restricted: #5a45a8;
    --restricted-line: #c4bbe8;

    --shadow: 0 0.75rem 2.5rem rgb(15 26 32 / 8%);
    --backdrop: radial-gradient(circle at 15% 0%, rgb(79 199 154 / 12%), transparent 34rem);
  }
}

/* Плотность выбирает рабочее место, а не страница. */
:root[data-density="journal"] {
  --row-h: 32px;
  --control-h: 2.15rem;
  --font: 13px;
  --gap: 0.7rem;
}

:root[data-density="shop"] {
  --row-h: 56px;
  --control-h: 3.5rem;
  --font: 15px;
  --gap: 1.15rem;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--backdrop), var(--bg);
  color: var(--text);
  font-size: var(--font);
}

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

a {
  color: var(--accent-text);
}

.eyebrow {
  margin-bottom: 0.4rem;
  color: var(--text-3);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.mono {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

.num {
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--text-3);
}

/* --- Оболочка ------------------------------------------------------------ */

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


.rail {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  padding: 1.4rem 1rem;
  border-right: 1px solid var(--line);
  background: var(--surface-2);
}

.rail-brand {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding-inline: 0.5rem;
}

.rail-brand strong {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.rail-brand small {
  color: var(--text-3);
  font-size: 0.7rem;
}

.rail-sections {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.rail-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: var(--control-h);
  padding: 0.5rem 0.65rem;
  border: 0;
  border-radius: var(--r-control);
  background: transparent;
  color: var(--text-2);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.rail-item:hover {
  color: var(--text);
}

.rail-item[aria-current="page"] {
  background: var(--secondary);
  color: var(--text);
  font-weight: 700;
}

.rail-item .badge {
  margin-left: auto;
  color: var(--text-3);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
}

.rail-profile {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: auto;
  padding: 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--r-block);
  background: var(--surface);
}

.rail-identity {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.avatar {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: var(--secondary);
  font-size: 0.75rem;
  font-weight: 700;
}

.rail-identity div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.rail-identity strong {
  font-size: 0.75rem;
}

.rail-identity small {
  color: var(--text-3);
  font-size: 0.7rem;
}

.theme-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.7rem;
  color: var(--text-3);
}

.theme-toggle {
  display: flex;
  gap: 2px;
  margin-left: auto;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
}

.theme-toggle button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  min-height: 1.6rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
}

.theme-toggle button[aria-pressed="true"] {
  background: var(--secondary);
  color: var(--text);
}

.theme-toggle svg {
  width: 15px;
  height: 15px;
}

main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.screen-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.4rem 1.6rem 1rem;
  border-bottom: 1px solid var(--line);
}

.screen-head h1 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.screen-tools {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.screen-body {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
}


.screen {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
}

.screen-main {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
  padding: 1.1rem 1.4rem 1.4rem 1.6rem;
}

/* --- Общие элементы ------------------------------------------------------ */

.card {
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.narrow {
  width: min(28rem, 100%);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(24rem, 100%), 1fr));
  gap: var(--gap);
}

.health {
  margin-bottom: 0.5rem;
  color: var(--warn);
}

.health.ready {
  color: var(--ok);
}

form,
label {
  display: grid;
  gap: 0.55rem;
}

form {
  gap: 1rem;
}

label {
  color: var(--text-2);
  font-size: 0.9rem;
}

input,
select,
button {
  min-height: var(--control-h);
  border-radius: var(--r-control);
  font: inherit;
}

input,
select {
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
}

fieldset {
  display: grid;
  gap: 0.8rem;
  margin: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
}

legend {
  padding-inline: 0.35rem;
  color: var(--text-3);
  font-size: 0.82rem;
  font-weight: 700;
}

button {
  padding: 0.7rem 1rem;
  border: 0;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 750;
  cursor: pointer;
}

button.secondary {
  min-height: auto;
  padding: 0.45rem 0.7rem;
  background: var(--secondary);
  color: var(--text);
}

button:disabled {
  cursor: progress;
  opacity: 0.6;
}

.error {
  min-height: 1.25rem;
  margin-block: 1rem 0;
  color: var(--danger);
}

.error.compact {
  margin-bottom: 0;
}

.results {
  display: grid;
  gap: 0.7rem;
  margin-top: 1rem;
}

.result {
  display: flex;
  min-height: var(--row-h);
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--r-inner);
}

.result p {
  margin-bottom: 0.2rem;
}

.result small {
  color: var(--text-3);
}

/* --- Пилюли и чипы ------------------------------------------------------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.7rem;
  white-space: nowrap;
}

.pill.ok {
  border-color: var(--ok-line);
  color: var(--ok);
}

.pill.warn {
  border-color: var(--warn-line);
  color: var(--warn);
}

.pill.danger {
  border-color: var(--danger-line);
  color: var(--danger);
}

.pill.info {
  border-color: var(--info-line);
  color: var(--info);
}

.pill.restricted {
  border-color: var(--restricted-line);
  color: var(--restricted);
}

.snapshot-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--info-line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.75rem;
}

.snapshot-chip svg {
  width: 15px;
  height: 15px;
  color: var(--info);
}

.scope-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: var(--control-h);
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
  background: var(--surface-2);
  color: var(--text);
}

.scope-chip select {
  min-height: auto;
  width: auto;
  padding: 0;
  border: 0;
  background: transparent;
  font-weight: 700;
}

/* --- Карточка показателя ------------------------------------------------- */

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(19rem, 100%), 1fr));
  gap: 0.75rem;
}

.metric {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  text-align: left;
  font: inherit;
  color: var(--text);
  cursor: pointer;
}

.metric[aria-pressed="true"] {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 1px var(--accent-line);
}

.metric:disabled {
  cursor: default;
  opacity: 1;
}

.metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.metric-title {
  font-size: 0.82rem;
  font-weight: 700;
}

.metric-through {
  color: var(--text-3);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.metric-value {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.metric-value b {
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.metric-value.is-empty b,
.metric-value.is-restricted b {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-3);
}

.metric-value.is-restricted b {
  color: var(--restricted);
}

.metric-definition {
  margin: 0;
  color: var(--text-3);
  font-size: 0.7rem;
  line-height: 1.45;
}

.metric-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.metric-open {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--accent-text);
  font-size: 0.75rem;
  font-weight: 700;
}

.metric-open.is-idle {
  color: var(--text-disabled);
}

/* --- Панель источника ---------------------------------------------------- */

.source-panel {
  display: flex;
  flex-direction: column;
  width: 26.5rem;
  flex: 0 0 26.5rem;
  min-height: 0;
  border-left: 1px solid var(--line);
  background: var(--surface-2);
}


.source-head {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1.1rem 1.25rem 0.85rem;
  border-bottom: 1px solid var(--line);
}

.source-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.source-title strong {
  font-size: 1.05rem;
}

.source-close {
  min-height: auto;
  padding: 0.2rem 0.5rem;
  background: transparent;
  color: var(--text-3);
}

.source-items {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  overflow-y: auto;
}

.source-item {
  display: flex;
  min-height: var(--row-h);
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--r-block);
  background: var(--surface);
}

.source-item-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
}

.source-item-head strong {
  font-size: 0.82rem;
}

.source-item-figures {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  color: var(--text-3);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
}

.source-item-context {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  color: var(--text-2);
  font-size: 0.7rem;
}

.source-foot {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid var(--line);
}

.source-foot p {
  margin: 0;
  color: var(--text-3);
  font-size: 0.7rem;
  line-height: 1.5;
}

/* --- Объяснимые состояния ------------------------------------------------ */

.notice {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--r-block);
  background: var(--surface-2);
}

.notice svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

.notice div {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.notice strong {
  font-size: 0.82rem;
}

.notice p {
  margin: 0;
  color: var(--text-2);
  font-size: 0.75rem;
  line-height: 1.5;
}

.notice.denied {
  border-color: var(--restricted-line);
}

.notice.denied svg,
.notice.denied strong {
  color: var(--restricted);
}

.notice.expired {
  border-color: var(--info-line);
}

.notice.expired svg,
.notice.expired strong {
  color: var(--info);
}

.notice.attention {
  border-color: var(--warn-line);
}

.notice.attention svg,
.notice.attention strong {
  color: var(--warn);
}

.notice.failure {
  border-color: var(--danger-line);
}

.notice.failure svg,
.notice.failure strong {
  color: var(--danger);
}

.notice-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* --- Экраны клиентов и работы -------------------------------------------- */

.workspace-heading {
  display: flex;
  justify-content: space-between;
  margin-block: 0.5rem 1rem;
}

.history-card {
  margin-block: 1rem 2.5rem;
}

.mobile-work-card {
  margin-bottom: 1rem;
}

.mobile-work-heading,
.mobile-operation-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.mobile-work-heading h3,
.mobile-operation h4 {
  margin-bottom: 0;
}

.mobile-work-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(19rem, 100%), 1fr));
  gap: 0.8rem;
}

.mobile-operation {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-block);
  background: var(--surface-2);
}

.mobile-operation-state,
.error.compact {
  margin-bottom: 0;
}

.mobile-operation-state {
  color: var(--ok);
}

.mobile-operation-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.login-layout {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 3rem 1rem;
}

.login-layout header {
  margin-bottom: 1.5rem;
}

.login-layout h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3rem);
}

/* --- Адаптивность --------------------------------------------------------- */

@media (max-width: 62rem) {
  .app {
    grid-template-columns: minmax(0, 1fr);
  }

  .rail {
    position: sticky;
    bottom: 0;
    z-index: 1;
    order: 2;
    flex-direction: row;
    gap: 0.35rem;
    padding: 0.5rem 0.75rem calc(0.5rem + env(safe-area-inset-bottom));
    border-right: 0;
    border-top: 1px solid var(--line);
  }

  .rail-brand,
  .rail-profile {
    display: none;
  }

  .rail-sections {
    flex-direction: row;
    flex: 1 1 auto;
    gap: 0.35rem;
    min-width: 0;
    overflow-x: auto;
  }

  .rail-item {
    flex: 1 0 5.5rem;
    flex-direction: column;
    gap: 0.2rem;
    min-height: 3.5rem;
    justify-content: center;
    font-size: 0.68rem;
    text-align: center;
  }

  .rail-item .badge {
    position: absolute;
    margin: 0;
  }

  .screen-body {
    flex-direction: column;
  }

  .source-panel {
    width: auto;
    flex: 1 1 auto;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .screen-head {
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
  }

  .screen-main {
    padding: 1rem;
  }

  .card {
    padding: 1.1rem;
  }

  .mobile-work-heading {
    align-items: start;
  }

  .mobile-operation-actions button {
    flex: 1 1 8rem;
  }
}

.documentation-modes, .documentation-links { display: flex; flex-wrap: wrap; gap: .75rem; }
.documentation-modes [aria-pressed="false"] { background: var(--surface-2); color: var(--text-2); }
.documentation-sections { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr)); gap: .65rem; }
.documentation-sections a { padding: .85rem; border: 1px solid var(--line); border-radius: var(--r-control); color: var(--text-2); }
.documentation-sections [aria-current="page"] { color: var(--text); border-color: var(--accent); }
.documentation-reader { width: 100%; height: 75vh; min-height: 450px; border: 1px solid var(--line); border-radius: var(--r-card); background: white; }
.documentation-player { width: 100%; max-height: 70vh; background: #101e1c; border-radius: var(--r-card); }
.documentation-video-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(20rem, 100%), 1fr)); gap: 1rem; margin-top: 1rem; }
.documentation-video h2 { font-size: 1.15rem; line-height: 1.4; }
.documentation-video button { margin-bottom: 1rem; }
.documentation-links a { color: var(--text); }

/* --- Экран заказа --------------------------------------------------------- */

.back-link {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-height: auto;
  margin-bottom: 0.35rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-3);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.back-link:hover {
  color: var(--accent-text);
}

.lifecycle {
  display: flex;
  gap: 0.4rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
}

.lifecycle-stage {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.lifecycle-stage i {
  height: 3px;
  border-radius: 999px;
  background: var(--line);
}

.lifecycle-stage.ok i {
  background: var(--ok);
}

.lifecycle-stage.info i {
  background: var(--info);
}

.lifecycle-stage.warn i {
  background: var(--warn);
}

.lifecycle-stage.danger i {
  background: var(--danger);
}

.lifecycle-stage span {
  color: var(--text-3);
  font-size: 0.68rem;
}

.lifecycle-stage b {
  font-size: 0.75rem;
}

.order-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22rem;
  gap: 1rem;
  align-items: start;
}

.order-positions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}

.order-side {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.side-block {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.table {
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  overflow: hidden;
}

.table-row {
  display: grid;
  grid-template-columns: 2.3fr 0.7fr 1fr 1.8fr 0.9fr;
  gap: 0.75rem;
  align-items: center;
  min-height: var(--row-h);
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
}

.table-row:last-child {
  border-bottom: 0;
}

.table-row.head {
  color: var(--text-3);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.table-cell-title {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.table-cell-title strong {
  font-size: 0.85rem;
}

.table-cell-title small {
  color: var(--text-3);
  font-size: 0.7rem;
}

.money-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.35rem 0;
  font-size: 0.78rem;
  color: var(--text-2);
}

.money-line.total {
  padding-top: 0.6rem;
  border-top: 1px solid var(--line);
  color: var(--text);
  font-weight: 700;
}

.money-line b {
  font-variant-numeric: tabular-nums;
}

.doc-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--r-inner);
  background: var(--surface);
  font-size: 0.75rem;
}

@media (max-width: 62rem) {
  .order-columns {
    grid-template-columns: minmax(0, 1fr);
  }

  .table-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.3rem;
  }

  .table-row.head {
    display: none;
  }

  .lifecycle {
    flex-wrap: wrap;
  }

  .lifecycle-stage {
    flex: 1 1 8rem;
  }
}

/* --- Цеховая карточка операции -------------------------------------------- */

.current-operation {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 1.1rem;
  border: 1px solid var(--info-line);
  border-radius: var(--r-card);
  background: var(--surface);
  grid-column: 1 / -1;
}

.current-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.current-badge {
  color: var(--info);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.current-title {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.25;
}

.current-timer-row {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.current-timer {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.current-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.shop-action {
  flex: 1 1 8rem;
  min-height: 3.5rem;
  padding: 0 1.25rem;
  font-size: 1rem;
}

.shop-action.secondary {
  min-height: 3.5rem;
  padding: 0 1.25rem;
}

/* --- Приёмка на складе ---------------------------------------------------- */

.receipt-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 1rem;
  align-items: start;
}

.po-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 100%;
  min-height: var(--control-h);
  margin-bottom: 0.5rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--r-block);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.po-card[aria-pressed="true"] {
  border-color: var(--accent-line);
}

.po-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
}

.po-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--r-inner);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.po-line[aria-pressed="true"] {
  border-color: var(--accent-line);
  background: var(--surface);
}

.po-lines {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.scan-field {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
  background: var(--surface-2);
}

.scan-field svg {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  color: var(--accent-text);
}

.scan-field input {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1rem;
}

.scan-state {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.72rem;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.stepper button {
  flex: 0 0 auto;
  width: 3.5rem;
  min-height: 3.5rem;
  padding: 0;
  background: var(--secondary);
  color: var(--text);
  font-size: 1.5rem;
}

.stepper-value {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.stepper-value input {
  width: 100%;
  min-width: 0;
  text-align: center;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.stepper-value small {
  color: var(--text-3);
  font-size: 0.72rem;
}

@media (max-width: 62rem) {
  .receipt-columns {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Справочники администратора */
.admin-setup { margin-bottom: 1.25rem; }
.admin-setup summary { cursor: pointer; font-weight: 600; }
.admin-setup p { line-height: 1.6; max-width: 72ch; }
.admin-scope { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin: 1.25rem 0; }
.admin-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.admin-columns h2 { margin: 0 0 1rem; font-size: 1.1rem; }
.admin-columns select[multiple] { min-height: 6rem; }
.admin-check { display: flex; align-items: center; gap: .6rem; }
.admin-check input { width: 1.15rem; height: 1.15rem; margin: 0; }
.admin-item { display: flex; flex-direction: column; gap: .6rem; padding: 1rem 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.admin-item:first-child { padding-top: 0; }
.admin-item button { align-self: flex-start; }
.admin-operations { display: flex; flex-direction: column; gap: 1rem; }
#admin-notice:not(:empty) { padding: .8rem 0; line-height: 1.5; }
@media (max-width: 900px) {
  .admin-scope { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-columns { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .admin-scope { grid-template-columns: minmax(0, 1fr); }
}
