/*
 * Единая визуальная оболочка раздела /metal.
 * Все правила намеренно ограничены .metal-shell-body и не влияют на другие
 * производственные контуры. Специальный metal-dashboard.css подключается ниже
 * этого файла и сохраняет приоритет на главной странице.
 */

.metal-shell-body {
  --metal-shell-navy-950: #061422;
  --metal-shell-navy-900: #081b2d;
  --metal-shell-navy-800: #0e2944;
  --metal-shell-blue: #075bb5;
  --metal-shell-blue-strong: #034a99;
  --metal-shell-blue-soft: #e9f3ff;
  --metal-shell-cyan: #42adff;
  --metal-shell-orange: #f27a17;
  --metal-shell-orange-soft: #fff2e5;
  --metal-shell-green: #238451;
  --metal-shell-green-soft: #e7f7ed;
  --metal-shell-red: #b83232;
  --metal-shell-red-soft: #fff0f0;
  --metal-shell-amber: #9a6500;
  --metal-shell-amber-soft: #fff7df;
  --metal-shell-ink: #102338;
  --metal-shell-text: #273d52;
  --metal-shell-muted: #687c8f;
  --metal-shell-line: #d7e1ea;
  --metal-shell-line-strong: #bccbd8;
  --metal-shell-surface: #ffffff;
  --metal-shell-surface-soft: #f5f8fb;
  --metal-shell-radius: 16px;
  --metal-shell-shadow: 0 12px 32px rgba(15, 42, 67, 0.09);
  --metal-shell-shadow-hover: 0 18px 42px rgba(14, 45, 75, 0.14);
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(rgba(25, 77, 125, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(25, 77, 125, 0.035) 1px, transparent 1px),
    radial-gradient(circle at 85% 0, rgba(46, 138, 220, 0.13), transparent 33rem),
    linear-gradient(180deg, #f3f7fa 0, #ebf1f6 100%);
  background-attachment: fixed;
  background-size: 34px 34px, 34px 34px, auto, auto;
  color: var(--metal-shell-text);
  font-family: "Segoe UI Variable Text", "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.metal-shell-body *,
.metal-shell-body *::before,
.metal-shell-body *::after {
  box-sizing: border-box;
}

.metal-shell-body a,
.metal-shell-body button,
.metal-shell-body input,
.metal-shell-body select,
.metal-shell-body textarea {
  font-family: inherit;
}

.metal-shell-body :where(a, button, input, select, textarea, summary):focus-visible {
  outline: 3px solid rgba(42, 151, 244, 0.34);
  outline-offset: 2px;
}

/* Тёмная промышленная шапка для всех страниц раздела. */
.metal-shell-body > .metal-shell-topbar.metal-private-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  min-height: 68px;
  align-items: stretch;
  justify-content: space-between;
  gap: clamp(14px, 2vw, 34px);
  overflow: visible;
  border: 0;
  padding: 0 clamp(16px, 2vw, 32px);
  background:
    radial-gradient(circle at 38% 120%, rgba(32, 133, 231, 0.17), transparent 34%),
    repeating-linear-gradient(105deg, rgba(255, 255, 255, 0.022) 0 1px, transparent 1px 13px),
    linear-gradient(95deg, var(--metal-shell-navy-950), var(--metal-shell-navy-900) 60%, #071725);
  box-shadow: 0 9px 26px rgba(3, 18, 32, 0.24);
}

.metal-shell-body > .metal-shell-topbar::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(rgba(91, 173, 242, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(91, 173, 242, 0.035) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(90deg, #000, transparent 56%);
  pointer-events: none;
  content: "";
}

.metal-shell-body > .metal-shell-topbar::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 3;
  height: 2px;
  background: linear-gradient(90deg, var(--metal-shell-orange), #ff9a38 35%, rgba(255, 151, 54, 0.45));
  box-shadow: 0 0 10px rgba(242, 122, 23, 0.38);
  content: "";
}

.metal-shell-body > .metal-shell-topbar > * {
  position: relative;
  z-index: 2;
}

.metal-shell-body > .metal-shell-topbar .brand {
  display: inline-flex;
  min-width: 0;
  flex: 0 1 auto;
  align-items: center;
  gap: 12px;
  padding-block: 7px;
  color: #fff;
  text-decoration: none;
}

.metal-shell-body > .metal-shell-topbar .brand-mark {
  display: inline-flex;
  width: 50px;
  height: 50px;
  flex: 0 0 50px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.metal-shell-body > .metal-shell-topbar .brand-mark img {
  display: block;
  max-width: 48px;
  max-height: 48px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(64, 162, 255, 0.2)) drop-shadow(0 0 7px rgba(242, 122, 23, 0.18));
}

.metal-shell-body > .metal-shell-topbar .brand-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.metal-shell-body > .metal-shell-topbar .brand-copy strong {
  overflow: hidden;
  color: #f7fbff;
  font-size: clamp(15px, 1.25vw, 18px);
  font-weight: 850;
  letter-spacing: 0.025em;
  line-height: 1.1;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.metal-shell-body > .metal-shell-topbar .brand-copy small {
  overflow: hidden;
  color: #9fb1c4;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.075em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.metal-shell-body > .metal-shell-topbar .top-nav {
  display: flex;
  min-width: 0;
  align-self: stretch;
  align-items: stretch;
  justify-content: flex-end;
  gap: 0;
}

.metal-shell-body > .metal-shell-topbar .top-nav-link {
  position: relative;
  display: inline-flex;
  min-width: 0;
  min-height: 66px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-left: 1px solid rgba(164, 191, 216, 0.12);
  border-radius: 0;
  padding: 0 clamp(12px, 1.45vw, 22px);
  background: transparent;
  box-shadow: none;
  color: #c9d5e0;
  font-size: clamp(11px, 0.9vw, 14px);
  font-weight: 760;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}

.metal-shell-body > .metal-shell-topbar .top-nav-link:last-child {
  border-right: 1px solid rgba(164, 191, 216, 0.12);
}

.metal-shell-body > .metal-shell-topbar .top-nav-link:hover {
  background: rgba(38, 116, 188, 0.14);
  box-shadow: none;
  color: #fff;
  transform: none;
}

.metal-shell-body > .metal-shell-topbar .top-nav-link.is-active {
  border-color: rgba(63, 157, 245, 0.23);
  background: linear-gradient(180deg, rgba(24, 103, 180, 0.15), rgba(8, 88, 168, 0.4));
  box-shadow: inset 0 -3px 0 #53b2ff, inset 0 -11px 20px rgba(21, 120, 219, 0.17), 0 0 20px rgba(21, 124, 224, 0.12);
  color: #fff;
  text-shadow: 0 0 10px rgba(77, 174, 255, 0.42);
}

.metal-shell-body > .metal-shell-topbar .top-nav-link.ghost {
  margin-left: 8px;
  color: #aebdca;
}

.metal-shell-body > .metal-shell-topbar .metal-nav-icon {
  display: block;
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.metal-shell-body > .metal-shell-topbar .metal-inbox-badge {
  display: inline-flex;
  min-width: 21px;
  height: 21px;
  align-items: center;
  justify-content: center;
  border: 2px solid #102b45;
  border-radius: 999px;
  padding: 0 5px;
  background: var(--metal-shell-orange);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

/* Рабочая область и заголовки внутренних страниц. */
.metal-shell-body :where(.page-shell, .terminal-screen) {
  width: min(100%, 1600px);
  margin-inline: auto;
}

.metal-shell-body .metal-production-header:is(.terminal-header, .metal-panel) {
  isolation: isolate;
}

.metal-shell-body.metal-shell-workspace :where(.terminal-screen, .page-shell) {
  padding: clamp(14px, 2vw, 28px) clamp(12px, 2vw, 28px) 72px;
}

.metal-shell-body .metal-production-screen:not(.metal-page) {
  display: grid;
  gap: 16px;
}

.metal-shell-body .metal-production-header {
  position: relative;
  display: flex;
  min-height: 112px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  overflow: hidden;
  border: 1px solid var(--metal-shell-line);
  border-radius: 18px;
  padding: 21px 24px;
  background:
    linear-gradient(rgba(22, 88, 148, 0.038) 1px, transparent 1px),
    linear-gradient(90deg, rgba(22, 88, 148, 0.038) 1px, transparent 1px),
    linear-gradient(110deg, rgba(255, 255, 255, 0.99), rgba(239, 246, 252, 0.96));
  background-size: 27px 27px, 27px 27px, auto;
  box-shadow: var(--metal-shell-shadow);
}

.metal-shell-body .metal-production-header::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 1;
  height: 3px;
  background: linear-gradient(90deg, var(--metal-shell-blue), #43a8f6 62%, var(--metal-shell-orange));
  content: "";
}

.metal-shell-body .metal-production-header > * {
  position: relative;
  z-index: 2;
}

.metal-shell-body .screen-label {
  margin: 0 0 5px;
  color: var(--metal-shell-blue);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.14em;
  line-height: 1.2;
  text-transform: uppercase;
}

.metal-shell-body .metal-production-header h1,
.metal-shell-body .metal-auth-card h1 {
  margin: 0;
  color: var(--metal-shell-ink);
  font-size: clamp(27px, 2.4vw, 38px);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: -0.025em;
}

.metal-shell-body .compact-order-title,
.metal-shell-body .metal-production-header > div > p:last-child {
  max-width: 940px;
  margin: 8px 0 0;
  color: var(--metal-shell-muted);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.45;
}

.metal-shell-body .order-header-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
}

/* Кнопки и ссылки-действия. */
.metal-shell-body :where(
  .header-link,
  .toolbar-button,
  .metal-step-button,
  .metal-add-line-button,
  .metal-kmc-add-button,
  .metal-file-download,
  .metal-file-preview
) {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--metal-shell-blue);
  border-radius: 10px;
  padding: 9px 15px;
  background: linear-gradient(180deg, #0c6bc8, var(--metal-shell-blue));
  box-shadow: 0 6px 14px rgba(7, 91, 181, 0.15);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.15;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.metal-shell-body :where(.header-link, .metal-step-button, .metal-file-download, .metal-file-preview):hover {
  border-color: var(--metal-shell-blue-strong);
  background: linear-gradient(180deg, #1478d8, var(--metal-shell-blue-strong));
  box-shadow: 0 9px 20px rgba(7, 74, 146, 0.2);
  color: #fff;
  transform: translateY(-1px);
}

.metal-shell-body .toolbar-button:where(:not(.toolbar-link):not(.start-button)) {
  border-color: var(--metal-shell-line-strong);
  background: #fff;
  box-shadow: none;
  color: var(--metal-shell-ink);
}

.metal-shell-body .toolbar-button:where(:not(.toolbar-link):not(.start-button)):hover {
  border-color: var(--metal-shell-blue);
  background: var(--metal-shell-blue-soft);
  color: var(--metal-shell-blue-strong);
}

.metal-shell-body .metal-step-button.is-complete,
.metal-shell-body .metal-manual-submit {
  border-color: var(--metal-shell-green);
  background: linear-gradient(180deg, #2f9a61, var(--metal-shell-green));
  color: #fff;
}

.metal-shell-body .metal-step-button.is-warning,
.metal-shell-body .toolbar-button.is-warning {
  border-color: #d19a28;
  background: var(--metal-shell-amber-soft);
  box-shadow: none;
  color: #795000;
}

.metal-shell-body .toolbar-button.is-danger,
.metal-shell-body .metal-manual-remove-line {
  border-color: #d7a3a3;
  background: var(--metal-shell-red-soft);
  box-shadow: none;
  color: var(--metal-shell-red);
}

.metal-shell-body .metal-step-button:disabled,
.metal-shell-body .toolbar-button:disabled,
.metal-shell-body .header-link:disabled {
  border-color: #ccd6df;
  background: #e7edf2;
  box-shadow: none;
  color: #8291a0;
  cursor: not-allowed;
  transform: none;
}

.metal-shell-body :where(.header-inline-form, .metal-urgency-form, .metal-recalculate-form) {
  margin: 0;
}

.metal-shell-body .metal-recalculate-button::before {
  display: inline-block;
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
  content: "↻";
}

.metal-shell-body .metal-urgency-state {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-top: 10px;
}

.metal-shell-body .metal-urgency-state small {
  color: var(--metal-shell-muted);
  font-size: 12px;
  font-weight: 800;
}

.metal-shell-body .metal-urgent-badge {
  display: inline-flex;
  width: fit-content;
  min-height: 29px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid #b92929;
  border-radius: 999px;
  padding: 5px 10px;
  background: linear-gradient(180deg, #df4848, #bd2929);
  box-shadow: 0 5px 12px rgba(176, 35, 35, 0.16);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.metal-shell-body .metal-urgency-toggle {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid #bb3030;
  border-radius: 10px;
  padding: 9px 14px;
  background: linear-gradient(180deg, #d94343, #b92727);
  box-shadow: 0 6px 14px rgba(170, 31, 31, 0.14);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 850;
  cursor: pointer;
  touch-action: manipulation;
}

.metal-shell-body .metal-urgency-toggle:hover {
  border-color: #9d2020;
  background: linear-gradient(180deg, #c73535, #9f2020);
}

.metal-shell-body .metal-urgency-toggle.is-active {
  border-color: #d6a1a1;
  background: var(--metal-shell-red-soft);
  box-shadow: none;
  color: #8e2c2c;
}

/* Карточки, секции и системные сообщения. */
.metal-shell-body :where(.section-card, .empty-state) {
  border: 1px solid var(--metal-shell-line);
  border-radius: var(--metal-shell-radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--metal-shell-shadow);
  color: var(--metal-shell-text);
}

.metal-shell-body .section-card {
  padding: clamp(17px, 1.7vw, 24px);
}

.metal-shell-body .metal-view-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.metal-shell-body .metal-view-option {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--metal-shell-line-strong);
  border-radius: 13px;
  padding: 12px 15px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 6px 18px rgba(17, 50, 79, 0.06);
  color: var(--metal-shell-text);
  text-decoration: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.metal-shell-body .metal-view-option > span {
  display: grid;
  gap: 3px;
}

.metal-shell-body .metal-view-option strong {
  color: var(--metal-shell-ink);
  font-size: 19px;
}

.metal-shell-body .metal-view-option small {
  color: var(--metal-shell-muted);
  font-size: 12px;
  font-weight: 750;
}

.metal-shell-body .metal-view-option b {
  display: inline-flex;
  min-width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  padding-inline: 8px;
  background: #e9eef3;
  color: var(--metal-shell-ink);
  font-size: 20px;
}

.metal-shell-body .metal-view-option:hover {
  border-color: #90b8dc;
  box-shadow: 0 10px 24px rgba(12, 63, 109, 0.11);
  transform: translateY(-1px);
}

.metal-shell-body .metal-view-option.is-active {
  border-color: var(--metal-shell-blue);
  background: var(--metal-shell-blue-soft);
  box-shadow: inset 0 0 0 1px rgba(7, 91, 181, 0.12);
}

.metal-shell-body .metal-view-option.is-active b {
  background: var(--metal-shell-blue);
  color: #fff;
}

.metal-shell-body .metal-view-option.is-completed.is-active {
  border-color: #76ad89;
  background: var(--metal-shell-green-soft);
}

.metal-shell-body .metal-view-option.is-completed.is-active b {
  background: var(--metal-shell-green);
}

.metal-shell-body .metal-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px 24px;
  margin-bottom: 16px;
}

.metal-shell-body .metal-section-head h2,
.metal-shell-body .section-card h2,
.metal-shell-body .section-card h3 {
  margin: 0;
  color: var(--metal-shell-ink);
  font-weight: 900;
  letter-spacing: -0.015em;
}

.metal-shell-body .metal-section-head h2,
.metal-shell-body .section-card h2 {
  font-size: clamp(20px, 1.7vw, 27px);
}

.metal-shell-body .metal-section-head > p,
.metal-shell-body .section-card > p {
  color: var(--metal-shell-muted);
  line-height: 1.5;
}

.metal-shell-body .terminal-message {
  position: relative;
  display: none;
  min-height: 50px;
  align-items: center;
  overflow: hidden;
  border: 1px solid #b8d8c6;
  border-left: 5px solid var(--metal-shell-green);
  border-radius: 12px;
  padding: 12px 16px;
  background: var(--metal-shell-green-soft);
  box-shadow: 0 8px 18px rgba(28, 92, 58, 0.07);
  color: #1d623d;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.4;
}

.metal-shell-body .terminal-message.is-visible {
  display: block;
}

.metal-shell-body .terminal-message.is-warning {
  border-color: #ecd28e;
  border-left-color: #d89b1e;
  background: var(--metal-shell-amber-soft);
  color: #785100;
}

.metal-shell-body .terminal-message.is-error {
  border-color: #e3b8b8;
  border-left-color: var(--metal-shell-red);
  background: var(--metal-shell-red-soft);
  color: #8b2929;
}

.metal-shell-body .empty-state {
  padding: clamp(26px, 4vw, 52px);
  text-align: center;
}

.metal-shell-body .empty-state :where(h1, h2, p) {
  margin-top: 0;
}

.metal-shell-body .empty-state p,
.metal-shell-body .home-current-empty {
  color: var(--metal-shell-muted);
  line-height: 1.45;
}

.metal-shell-body :where(.metal-status-badge, .metal-source-badge, .metal-kmc-badge, .metal-inbox-kind) {
  border-radius: 999px;
  font-weight: 850;
  letter-spacing: 0.01em;
}

/* Поля ввода и формы. */
.metal-shell-body :where(
  input[type="text"],
  input[type="search"],
  input[type="password"],
  input[type="date"],
  input[type="number"],
  input[type="file"],
  select,
  textarea
) {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--metal-shell-line-strong);
  border-radius: 10px;
  padding: 10px 13px;
  background: #fff;
  box-shadow: inset 0 1px 2px rgba(20, 48, 73, 0.035);
  color: var(--metal-shell-ink);
  font-size: 15px;
  line-height: 1.35;
  transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

.metal-shell-body textarea {
  min-height: 108px;
  resize: vertical;
}

.metal-shell-body :where(
  input[type="text"],
  input[type="search"],
  input[type="password"],
  input[type="date"],
  input[type="number"],
  input[type="file"],
  select,
  textarea
):focus {
  border-color: var(--metal-shell-blue);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(7, 91, 181, 0.13), inset 0 1px 2px rgba(20, 48, 73, 0.03);
}

.metal-shell-body :where(input, select, textarea)::placeholder {
  color: #8c9cab;
  opacity: 1;
}

.metal-shell-body input[type="file"] {
  padding: 7px;
}

.metal-shell-body input[type="file"]::file-selector-button {
  min-height: 34px;
  margin-right: 10px;
  border: 0;
  border-radius: 7px;
  padding: 6px 11px;
  background: var(--metal-shell-blue-soft);
  color: var(--metal-shell-blue-strong);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.metal-shell-body :where(.metal-touch-form, .metal-manual-order-form, .metal-file-upload, .admin-login-form) label,
.metal-shell-body .metal-inventory-toolbar label {
  color: var(--metal-shell-ink);
  font-size: 14px;
  font-weight: 800;
}

.metal-shell-body :where(.metal-touch-form, .metal-manual-order-form, .metal-file-upload, .admin-login-form) label > span,
.metal-shell-body .metal-inventory-toolbar label > span {
  display: block;
  margin-bottom: 6px;
}

.metal-shell-body :where(.metal-touch-form, .metal-manual-order-form) {
  gap: 17px;
}

.metal-shell-body .metal-choice-fieldset {
  border-color: var(--metal-shell-line);
  border-radius: 13px;
  background: var(--metal-shell-surface-soft);
}

.metal-shell-body .metal-touch-choice {
  border-color: var(--metal-shell-line);
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 4px 10px rgba(17, 51, 82, 0.04);
}

.metal-shell-body .metal-touch-choice:has(input:checked) {
  border-color: var(--metal-shell-blue);
  background: var(--metal-shell-blue-soft);
  box-shadow: inset 0 0 0 1px rgba(7, 91, 181, 0.16);
}

.metal-shell-body :where(input[type="checkbox"], input[type="radio"]) {
  accent-color: var(--metal-shell-blue);
}

.metal-shell-body .metal-manual-order-number {
  border: 1px solid var(--metal-shell-line);
  border-radius: 14px;
  padding: 18px;
  background:
    linear-gradient(rgba(26, 88, 145, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(26, 88, 145, 0.035) 1px, transparent 1px),
    var(--metal-shell-surface-soft);
  background-size: 26px 26px, 26px 26px, auto;
}

.metal-shell-body .metal-manual-order-number > label {
  max-width: 560px;
}

.metal-shell-body .metal-product-kmc-actions {
  border: 1px dashed #d7b76e;
  border-radius: 11px;
  padding: 11px 12px;
  background: #fffaf0;
}

.metal-shell-body .metal-product-kmc-actions > span {
  color: #745b2d;
  font-size: 13px;
  font-weight: 850;
}

.metal-shell-body .metal-product-kmc-actions .metal-kmc-add-button {
  border-color: #c48a1f;
  background: #fff1c9;
  box-shadow: none;
  color: #744900;
}

.metal-shell-body .metal-product-kmc-actions .metal-kmc-add-button:hover {
  border-color: #a56c08;
  background: #ffe7a7;
  color: #684000;
}

.metal-shell-body .metal-product-kmc-actions .metal-add-line-button {
  border-color: #8ab5da;
  background: #f0f7ff;
  box-shadow: none;
  color: var(--metal-shell-blue-strong);
}

.metal-shell-body .metal-product-kmc-actions .metal-kmc-add-button:disabled,
.metal-shell-body .metal-product-kmc-actions .metal-add-line-button:disabled {
  border-color: #d3dce4;
  background: #edf1f4;
  color: #8997a4;
  cursor: not-allowed;
}

.metal-shell-body .metal-kmc-badge {
  border-color: #d09a2f;
  background: #fff0c3;
  color: #744900;
}

/* Таблицы сохраняют горизонтальный скролл на малых экранах. */
.metal-shell-body :where(.metal-lines-wrap, .metal-inventory-table-wrap) {
  overflow: auto;
  border: 1px solid var(--metal-shell-line);
  border-radius: 12px;
  background: #fff;
  scrollbar-color: #94aabd #eaf0f5;
  scrollbar-width: thin;
}

.metal-shell-body .metal-production-screen table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--metal-shell-text);
  font-size: 14px;
}

.metal-shell-body .metal-inventory-table {
  min-width: 760px;
}

.metal-shell-body .metal-production-screen table th,
.metal-shell-body .metal-production-screen table td {
  border-right: 1px solid var(--metal-shell-line);
  border-bottom: 1px solid var(--metal-shell-line);
  padding: 11px 12px;
  text-align: left;
  vertical-align: middle;
}

.metal-shell-body .metal-production-screen table th:last-child,
.metal-shell-body .metal-production-screen table td:last-child {
  border-right: 0;
}

.metal-shell-body .metal-production-screen table tbody tr:last-child td {
  border-bottom: 0;
}

.metal-shell-body .metal-production-screen table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, #143654, #0d2944);
  color: #f4f9fd;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.015em;
}

.metal-shell-body .metal-production-screen table tbody tr:nth-child(even) td {
  background: #f8fafc;
}

.metal-shell-body .metal-production-screen table tbody tr:hover td {
  background: #eef6ff;
}

.metal-shell-body .metal-production-screen table td strong {
  color: var(--metal-shell-ink);
}

/* Сводки и рабочие списки. */
.metal-shell-body :where(.metal-task-facts, .metal-inventory-summary, .metal-inbox-summary) {
  border-color: var(--metal-shell-line);
  background: linear-gradient(135deg, #fff, #f4f8fb);
}

.metal-shell-body :where(.metal-task-facts > div, .metal-inventory-summary > div, .metal-inbox-summary > div) {
  border-color: var(--metal-shell-line);
}

.metal-shell-body :where(.metal-task-facts dt, .metal-inventory-summary span, .metal-inbox-summary span) {
  color: var(--metal-shell-muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.metal-shell-body :where(.metal-task-facts dd, .metal-inventory-summary strong, .metal-inbox-summary strong) {
  color: var(--metal-shell-ink);
  font-weight: 900;
}

.metal-shell-body :where(
  .metal-checklist-row,
  .metal-chat-message,
  .metal-approval-item,
  .metal-approval-recipient,
  .metal-paint-item,
  .metal-purchase-item,
  .metal-inbox-item,
  .metal-admin-archive-item,
  .metal-manual-line
) {
  border-color: var(--metal-shell-line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 5px 14px rgba(17, 50, 79, 0.05);
}

.metal-shell-body :where(.metal-checklist-row, .metal-inbox-item, .metal-admin-archive-item) {
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.metal-shell-body :where(.metal-checklist-row, .metal-inbox-item, .metal-admin-archive-item):hover {
  border-color: #a9c7e1;
  box-shadow: 0 10px 24px rgba(14, 62, 104, 0.1);
}

.metal-shell-body .metal-checklist-row.status-in_progress {
  border-color: #8cbce9;
  background: linear-gradient(90deg, #edf6ff, #fff 36%);
}

.metal-shell-body .metal-checklist-row.is-completed {
  border-color: #b8ddc6;
  background: linear-gradient(90deg, #edf9f2, #fff 35%);
}

.metal-shell-body .metal-step-number {
  border: 1px solid #b6cadc;
  background: var(--metal-shell-blue-soft);
  color: var(--metal-shell-blue-strong);
  box-shadow: none;
}

.metal-shell-body .metal-step-finished-mark {
  background: var(--metal-shell-green);
  color: #fff;
}

.metal-shell-body .metal-progress {
  overflow: hidden;
  border-radius: 999px;
  background: #dde7ef;
  box-shadow: inset 0 1px 2px rgba(15, 40, 65, 0.08);
}

.metal-shell-body .metal-progress > span {
  background: linear-gradient(90deg, var(--metal-shell-blue), #37a9f4);
}

.metal-shell-body .metal-chat-message.is-own {
  border-color: #9fc8ec;
  background: #eef7ff;
}

.metal-shell-body .metal-approval-recipients {
  display: grid;
  gap: 10px;
}

.metal-shell-body .metal-approval-recipient.status-approved {
  border-color: #a9d8ba;
  background: var(--metal-shell-green-soft);
}

.metal-shell-body .metal-approval-recipient.status-changes_requested {
  border-color: #e4b2b2;
  background: var(--metal-shell-red-soft);
}

.metal-shell-body .metal-recipient-state {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 9px 14px;
}

.metal-shell-body .metal-recipient-state > span {
  display: grid;
  gap: 2px;
}

.metal-shell-body .metal-recipient-state strong {
  color: var(--metal-shell-ink);
}

.metal-shell-body .metal-recipient-state small,
.metal-shell-body .metal-approval-recipient time {
  color: var(--metal-shell-muted);
}

.metal-shell-body .metal-recipient-state b {
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--metal-shell-amber-soft);
  color: var(--metal-shell-amber);
}

.metal-shell-body .status-approved .metal-recipient-state b {
  background: #d8f0e1;
  color: #17673c;
}

.metal-shell-body .status-changes_requested .metal-recipient-state b {
  background: #f7dede;
  color: #922b2b;
}

.metal-shell-body .metal-decision-form {
  display: grid;
  gap: 12px;
  border: 1px solid #cbdbe9;
  border-radius: 11px;
  padding: 13px;
  background: #f7fafc;
}

.metal-shell-body .metal-decision-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.metal-shell-body :where(.metal-chat-files a, .metal-approval-files a, .metal-file-list a) {
  overflow-wrap: anywhere;
}

.metal-shell-body .metal-file-list li {
  border: 1px solid var(--metal-shell-line);
  border-radius: 11px;
  background: var(--metal-shell-surface-soft);
}

.metal-shell-body .metal-manual-privacy-note {
  border: 1px solid #ead6a3;
  border-left: 5px solid #d39820;
  border-radius: 12px;
  background: var(--metal-shell-amber-soft);
  box-shadow: none;
}

.metal-shell-body .metal-manual-line.is-kmc,
.metal-shell-body .metal-production-screen .metal-lines-table tr.is-kmc-line td {
  background: #fff9e9;
}

.metal-shell-body .metal-production-screen .metal-inventory-table tr.is-empty td {
  background: #fff8f7;
}

.metal-shell-body .metal-admin-archive-item:has(input:checked) {
  border-color: var(--metal-shell-blue);
  background: var(--metal-shell-blue-soft);
  box-shadow: 0 0 0 2px rgba(7, 91, 181, 0.12);
}

.metal-shell-body .metal-inbox-item.is-unread {
  border-color: #8dbde8;
  border-left: 5px solid var(--metal-shell-blue);
  background: linear-gradient(100deg, #edf6ff, #fff 34%);
}

.metal-shell-body .metal-unread-dot {
  border-radius: 999px;
  background: var(--metal-shell-orange-soft);
  color: #9a4a05;
}

.metal-shell-body .metal-inventory-section {
  overflow: clip;
  padding: 0;
}

.metal-shell-body .metal-inventory-section > summary {
  min-height: 58px;
  border-bottom: 1px solid transparent;
  padding: 14px 18px;
  background: linear-gradient(180deg, #fff, #f5f8fb);
  color: var(--metal-shell-ink);
}

.metal-shell-body .metal-inventory-section[open] > summary {
  border-bottom-color: var(--metal-shell-line);
}

.metal-shell-body .metal-inventory-section > summary::marker {
  color: var(--metal-shell-blue);
}

.metal-shell-body .metal-inventory-savebar {
  position: sticky;
  bottom: 10px;
  z-index: 15;
  border-color: #a9c8e3;
  background: rgba(250, 253, 255, 0.94);
  box-shadow: 0 15px 36px rgba(14, 54, 89, 0.16);
  backdrop-filter: blur(12px);
}

.metal-shell-body .metal-inventory-save-actions {
  display: flex;
  min-width: min(100%, 360px);
  flex-direction: column;
  gap: 7px;
  align-items: stretch;
}

.metal-shell-body .metal-inventory-inline-message {
  border: 1px solid #b9d2e8;
  border-radius: 9px;
  padding: 7px 10px;
  background: #edf6ff;
  color: #24547c;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
}

.metal-shell-body .metal-inventory-inline-message.is-error {
  border-color: #e3b8b8;
  background: var(--metal-shell-red-soft);
  color: #8b2929;
}

.metal-shell-body .metal-inventory-table input.is-dirty {
  border-color: var(--metal-shell-blue);
  box-shadow: 0 0 0 3px rgba(0, 94, 184, 0.12);
}

/* Материальный учёт МП: приходы, спецификации и выпуск продукции. */
.metal-shell-body .metal-inventory-create {
  overflow: hidden;
  border-color: #a9c8e3;
}

.metal-shell-body .metal-inventory-create > summary {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--metal-shell-blue-strong);
  font-weight: 900;
  cursor: pointer;
}

.metal-shell-body .metal-inventory-create > summary small {
  color: var(--metal-shell-muted);
  font-weight: 700;
}

.metal-shell-body .metal-inventory-create-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 12px;
  border-top: 1px solid var(--metal-shell-line);
  padding-top: 16px;
}

.metal-shell-body .metal-inventory-create-form .is-wide {
  grid-column: span 2;
}

.metal-shell-body .metal-inventory-create-form label,
.metal-shell-body .metal-inventory-receipt label,
.metal-shell-body .metal-purchase-catalog-item label {
  color: var(--metal-shell-ink);
  font-size: 13px;
  font-weight: 800;
}

.metal-shell-body .metal-inventory-create-form label > span,
.metal-shell-body .metal-inventory-receipt label > span,
.metal-shell-body .metal-purchase-catalog-item label > span {
  display: block;
  margin-bottom: 5px;
}

.metal-shell-body .metal-inventory-create-hint {
  margin: 12px 0 0;
  color: var(--metal-shell-muted);
  font-size: 13px;
}

.metal-shell-body .metal-inventory-table {
  min-width: 1120px;
}

.metal-shell-body .metal-inventory-conversion {
  display: inline-flex;
  border-radius: 999px;
  padding: 5px 9px;
  background: #edf5fc;
  color: #285b86;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.metal-shell-body .metal-production-screen .metal-inventory-table tr.is-negative td {
  background: #fff0f0;
  color: #8e2525;
}

.metal-shell-body .metal-inventory-receipt {
  min-width: 230px;
}

.metal-shell-body .metal-inventory-receipt > summary {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  border: 1px solid #85b5df;
  border-radius: 8px;
  padding: 6px 11px;
  background: #edf6ff;
  color: var(--metal-shell-blue-strong);
  font-weight: 900;
  cursor: pointer;
}

.metal-shell-body .metal-inventory-receipt > form {
  display: grid;
  gap: 9px;
  margin-top: 9px;
  border: 1px solid var(--metal-shell-line);
  border-radius: 10px;
  padding: 11px;
  background: #fff;
}

.metal-shell-body .metal-inventory-receipt > small {
  display: block;
  margin-top: 7px;
  color: var(--metal-shell-muted);
}

.metal-shell-body .metal-specification-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid #8ab8df;
  border-radius: 9px;
  padding: 7px 11px;
  background: #edf6ff;
  color: var(--metal-shell-blue-strong);
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.metal-shell-body .metal-specification-button.is-filled {
  border-color: #86c79e;
  background: var(--metal-shell-green-soft);
  color: #17673c;
}

.metal-shell-body .metal-specification-button.is-missing {
  border-color: #df8b8b;
  background: var(--metal-shell-red-soft);
  color: #982d2d;
  box-shadow: 0 0 0 2px rgba(196, 53, 53, 0.08);
}

.metal-shell-body .metal-material-release-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-left: 5px solid var(--metal-shell-blue);
}

.metal-shell-body .metal-material-release-card h2,
.metal-shell-body .metal-material-release-card p {
  margin: 0;
}

.metal-shell-body .metal-material-release-card.is-warning {
  border-color: #dc9a22;
  background: var(--metal-shell-amber-soft);
}

.metal-shell-body .metal-material-release-card.is-released {
  border-color: var(--metal-shell-green);
  background: var(--metal-shell-green-soft);
}

.metal-shell-body .metal-specification-form {
  display: grid;
  gap: 16px;
}

.metal-shell-body .metal-specification-table-wrap {
  overflow: auto;
  border: 1px solid var(--metal-shell-line);
  border-radius: 12px;
}

.metal-shell-body .metal-specification-table {
  min-width: 760px;
}

.metal-shell-body .metal-specification-table th:first-child {
  width: 72%;
}

.metal-shell-body .metal-specification-table select {
  width: 100%;
}

.metal-shell-body .metal-specification-table small {
  display: block;
  margin-top: 6px;
  color: var(--metal-shell-muted);
}

.metal-shell-body .metal-specification-remove {
  margin-top: 7px;
  border: 0;
  background: transparent;
  color: #a23535;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.metal-shell-body .metal-specification-remove:disabled {
  color: #9aa6b0;
  cursor: not-allowed;
}

.metal-shell-body .metal-specification-quantity {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.metal-shell-body .metal-specification-quantity strong {
  min-width: 38px;
  color: var(--metal-shell-blue-strong);
}

.metal-shell-body .metal-purchase-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.metal-shell-body .metal-purchase-group {
  overflow: hidden;
  border: 1px solid var(--metal-shell-line);
  border-radius: 12px;
  background: #fff;
}

.metal-shell-body .metal-purchase-group > summary,
.metal-shell-body .metal-purchase-catalog-item > summary {
  display: flex;
  min-height: 50px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
}

.metal-shell-body .metal-purchase-group > summary {
  background: linear-gradient(180deg, #f8fbfe, #eef5fb);
  color: var(--metal-shell-ink);
}

.metal-shell-body .metal-purchase-group > summary span,
.metal-shell-body .metal-purchase-catalog-item > summary small {
  color: var(--metal-shell-muted);
  font-size: 12px;
}

.metal-shell-body .metal-purchase-group-items {
  display: grid;
  gap: 1px;
  border-top: 1px solid var(--metal-shell-line);
  background: var(--metal-shell-line);
}

.metal-shell-body .metal-purchase-catalog-item {
  background: #fff;
}

.metal-shell-body .metal-purchase-catalog-item > summary:hover {
  background: #f2f8fd;
}

.metal-shell-body .metal-purchase-catalog-item > form {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto;
  align-items: end;
  gap: 10px;
  border-top: 1px dashed var(--metal-shell-line);
  padding: 11px 14px 14px;
  background: #fbfdff;
}

/* Внешняя оболочка 3D-просмотра; canvas и его управление живут в viewer-CSS. */
.metal-shell-body .metal-step-page {
  min-height: calc(100vh - 68px);
  padding: clamp(14px, 2vw, 28px);
  background:
    radial-gradient(circle at 15% 0, rgba(38, 129, 222, 0.11), transparent 34%),
    transparent;
}

.metal-shell-body .metal-step-shell {
  width: min(1680px, 100%);
  margin-inline: auto;
  overflow: hidden;
  border: 1px solid var(--metal-shell-line-strong);
  border-radius: 18px;
  background: var(--metal-shell-surface);
  box-shadow: var(--metal-shell-shadow-hover);
}

/* Страница входа. */
.metal-shell-body.metal-shell-auth-page {
  background:
    radial-gradient(circle at 78% 18%, rgba(42, 139, 224, 0.17), transparent 26rem),
    linear-gradient(rgba(31, 91, 143, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 91, 143, 0.04) 1px, transparent 1px),
    linear-gradient(145deg, #eaf1f7, #f8fafc);
  background-size: auto, 34px 34px, 34px 34px, auto;
}

.metal-shell-body.metal-shell-auth-page > .metal-shell-topbar {
  position: relative;
}

.metal-shell-body.metal-shell-auth-page .metal-auth-page {
  display: grid;
  min-height: calc(100vh - 70px);
  place-items: center;
  padding: clamp(24px, 5vw, 70px) 16px;
}

.metal-shell-body .metal-auth-card {
  position: relative;
  display: grid;
  width: min(100%, 520px);
  gap: 17px;
  overflow: hidden;
  border: 1px solid var(--metal-shell-line);
  border-radius: 20px;
  padding: clamp(25px, 4vw, 38px);
  background:
    linear-gradient(rgba(20, 89, 151, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 89, 151, 0.035) 1px, transparent 1px),
    rgba(255, 255, 255, 0.98);
  background-size: 28px 28px, 28px 28px, auto;
  box-shadow: 0 24px 60px rgba(11, 39, 66, 0.18);
}

.metal-shell-body .metal-auth-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--metal-shell-blue), var(--metal-shell-cyan) 70%, var(--metal-shell-orange));
  content: "";
}

.metal-shell-body .metal-auth-card > * {
  position: relative;
  z-index: 2;
}

.metal-shell-body .metal-auth-card > p:not(.screen-label) {
  margin: -4px 0 3px;
  color: var(--metal-shell-muted);
  line-height: 1.5;
}

.metal-shell-body .metal-auth-card .admin-login-form {
  display: grid;
  gap: 15px;
}

.metal-shell-body .metal-auth-card .admin-login-form label {
  display: grid;
  gap: 7px;
}

.metal-shell-body .metal-auth-card .start-button,
.metal-shell-body .metal-auth-card > .header-link {
  width: 100%;
}

.metal-shell-body .metal-auth-card > .header-link {
  border-color: var(--metal-shell-line-strong);
  background: #f7fafc;
  box-shadow: none;
  color: var(--metal-shell-blue-strong);
}

@media (max-width: 1280px) {
  .metal-shell-body > .metal-shell-topbar {
    gap: 12px;
    padding-inline: 14px;
  }

  .metal-shell-body > .metal-shell-topbar .brand-copy small {
    display: none;
  }

  .metal-shell-body > .metal-shell-topbar .top-nav-link {
    padding-inline: 11px;
    font-size: 11px;
  }
}

@media (max-width: 1180px) {
  .metal-shell-body > .metal-shell-topbar {
    min-height: 58px;
    align-items: center;
    overflow: hidden;
    padding-block: 4px;
  }

  .metal-shell-body > .metal-shell-topbar .brand {
    flex: 0 0 auto;
  }

  .metal-shell-body > .metal-shell-topbar .brand-copy {
    display: none;
  }

  .metal-shell-body > .metal-shell-topbar .brand-mark {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
  }

  .metal-shell-body > .metal-shell-topbar .brand-mark img {
    max-width: 40px;
    max-height: 40px;
  }

  .metal-shell-body > .metal-shell-topbar .top-nav {
    overflow-x: auto;
    justify-content: flex-start;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .metal-shell-body > .metal-shell-topbar .top-nav::-webkit-scrollbar {
    display: none;
  }

  .metal-shell-body > .metal-shell-topbar .top-nav-link {
    min-height: 50px;
    flex: 0 0 auto;
    padding-inline: 10px;
  }

  .metal-shell-body > .metal-shell-topbar .top-nav-link.ghost {
    margin-left: 0;
  }

  .metal-shell-body .metal-production-header {
    min-height: 0;
    align-items: stretch;
    flex-direction: column;
    padding: 18px;
  }

  .metal-shell-body .order-header-actions {
    justify-content: flex-start;
  }

  .metal-shell-body :where(.metal-touch-form, .metal-file-upload) {
    grid-template-columns: 1fr;
  }

  .metal-shell-body .metal-inventory-create-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metal-shell-body .metal-purchase-groups {
    grid-template-columns: 1fr;
  }

  .metal-shell-body :where(.metal-form-wide, .metal-choice-fieldset, .metal-submit-button) {
    grid-column: auto;
  }
}

@media (max-width: 760px) {
  .metal-shell-body.metal-shell-workspace :where(.terminal-screen, .page-shell) {
    padding: 10px 9px 46px;
  }

  .metal-shell-body .metal-production-screen:not(.metal-page) {
    gap: 11px;
  }

  .metal-shell-body .metal-production-header {
    border-radius: 13px;
    padding: 16px 14px;
  }

  .metal-shell-body .metal-production-header h1,
  .metal-shell-body .metal-auth-card h1 {
    font-size: 25px;
  }

  .metal-shell-body .order-header-actions,
  .metal-shell-body .metal-admin-archive-toolbar,
  .metal-shell-body .metal-manual-form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .metal-shell-body .order-header-actions > *,
  .metal-shell-body .metal-admin-archive-toolbar :where(button, a),
  .metal-shell-body .metal-manual-form-actions :where(button, a) {
    width: 100%;
  }

  .metal-shell-body .section-card {
    border-radius: 13px;
    padding: 14px;
  }

  .metal-shell-body .metal-section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .metal-shell-body :where(.metal-inventory-summary, .metal-task-facts) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metal-shell-body .metal-choice-grid {
    grid-template-columns: 1fr;
  }

  .metal-shell-body :where(.metal-view-switch, .metal-decision-actions) {
    grid-template-columns: 1fr;
  }

  .metal-shell-body .metal-product-kmc-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .metal-shell-body .metal-product-kmc-actions :where(button, .metal-kmc-add-button, .metal-add-line-button),
  .metal-shell-body .order-header-actions :where(.metal-urgency-form, .metal-recalculate-form, .metal-urgency-toggle, .metal-recalculate-button) {
    width: 100%;
  }

  .metal-shell-body .metal-production-screen table:not(.metal-lines-table) {
    min-width: 720px;
  }

  .metal-shell-body .metal-inventory-savebar {
    bottom: 4px;
    align-items: stretch;
    flex-direction: column;
  }

  .metal-shell-body .metal-inventory-savebar > * {
    width: 100%;
  }

  .metal-shell-body .metal-inventory-create-form,
  .metal-shell-body .metal-purchase-catalog-item > form {
    grid-template-columns: 1fr;
  }

  .metal-shell-body .metal-inventory-create-form .is-wide {
    grid-column: auto;
  }

  .metal-shell-body .metal-material-release-card {
    align-items: stretch;
    flex-direction: column;
  }
}

.metal-shell-body .metal-sheet-page {
  width: min(100%, 1680px);
  margin: 0 auto;
  padding: 22px clamp(12px, 2vw, 30px) 36px;
}

.metal-shell-body .metal-sheet-shell {
  overflow: hidden;
  border: 1px solid #cbd9e8;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 18px 46px rgba(19, 52, 87, 0.14);
}

.metal-shell-body .metal-sheet-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding: 24px 26px 18px;
  border-bottom: 1px solid #dce6f0;
}

.metal-shell-body .metal-sheet-header h1 {
  margin: 3px 0 6px;
  color: #0b1d33;
}

.metal-shell-body .metal-sheet-header p:last-child {
  margin: 0;
  color: #61748b;
}

.metal-shell-body .metal-sheet-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 14px 18px;
  border-bottom: 1px solid #dce6f0;
  background: #f6f9fd;
}

.metal-shell-body .metal-sheet-tabs a {
  flex: 0 0 auto;
  padding: 9px 14px;
  border: 1px solid #c8d7e8;
  border-radius: 10px;
  color: #164b84;
  background: #fff;
  font-weight: 750;
  text-decoration: none;
}

.metal-shell-body .metal-sheet-tabs a.is-active {
  border-color: #0d64be;
  color: #fff;
  background: #075bad;
  box-shadow: 0 5px 14px rgba(7, 91, 173, 0.22);
}

.metal-shell-body .metal-sheet-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  align-items: center;
  padding: 12px 20px;
  color: #526980;
}

.metal-shell-body .metal-sheet-meta strong {
  color: #102d4c;
}

.metal-shell-body .metal-sheet-grid-wrap {
  max-height: calc(100vh - 310px);
  min-height: 360px;
  overflow: auto;
  border-top: 1px solid #dce6f0;
}

.metal-shell-body .metal-sheet-grid {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-family: "Arial", sans-serif;
  font-size: 14px;
}

.metal-shell-body .metal-sheet-grid th,
.metal-shell-body .metal-sheet-grid td {
  min-width: 110px;
  max-width: 420px;
  padding: 8px 10px;
  border-right: 1px solid #d7e1ec;
  border-bottom: 1px solid #d7e1ec;
  color: #172c43;
  background: #fff;
  text-align: left;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.metal-shell-body .metal-sheet-grid thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  min-width: 74px;
  color: #fff;
  background: #123e6b;
  text-align: center;
}

.metal-shell-body .metal-sheet-grid .is-row-number {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 54px;
  width: 54px;
  color: #557087;
  background: #eef4fa;
  text-align: center;
}

.metal-shell-body .metal-sheet-grid thead .is-row-number {
  z-index: 3;
  color: #fff;
  background: #0d3158;
}

@media (max-width: 760px) {
  .metal-shell-body .metal-sheet-header {
    flex-direction: column;
  }

  .metal-shell-body .metal-sheet-header .metal-step-header-actions {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .metal-shell-body *,
  .metal-shell-body *::before,
  .metal-shell-body *::after {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }

  .metal-shell-body :where(.header-link, .toolbar-button, .metal-step-button):hover {
    transform: none;
  }
}

@media (forced-colors: active) {
  .metal-shell-body > .metal-shell-topbar,
  .metal-shell-body .metal-production-header,
  .metal-shell-body :where(.section-card, .metal-auth-card) {
    border: 1px solid CanvasText;
  }

  .metal-shell-body > .metal-shell-topbar .top-nav-link.is-active {
    outline: 2px solid Highlight;
    outline-offset: -3px;
  }
}
/* Отгрузка и складские операции: сенсорные формы внутри текущей страницы. */
.metal-logistics-dialog {
  box-sizing: border-box;
  width: min(1180px, calc(100vw - 32px));
  max-height: calc(100dvh - 40px);
  padding: 24px;
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  color: #14243a;
  background: #fff;
  box-shadow: 0 24px 80px #14243a55;
  overflow: auto;
}
.metal-logistics-dialog::backdrop { background: #0f1d32aa; }
.metal-logistics-dialog.is-compact { width: min(560px, calc(100vw - 24px)); }
.metal-dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.metal-dialog-heading h2 { margin: 0; font-size: 24px; }
.metal-dialog-table-wrap { overflow-x: auto; margin: 18px 0; }
.metal-logistics-dialog table { min-width: 900px; width: 100%; }
.metal-logistics-dialog input, .metal-logistics-dialog select {
  box-sizing: border-box; min-height: 44px; padding: 8px 10px;
  border: 1px solid #94a3b8; border-radius: 8px; font: inherit; width: 100%;
  background: white; color: #14243a;
}
.metal-logistics-dialog input[inputmode="decimal"] { min-width: 100px; }
.metal-logistics-dialog select { min-width: 160px; }
.metal-logistics-dialog input[readonly] { background: #f1f5f9; color: #64748b; }
.metal-logistics-dialog label { display: grid; gap: 8px; margin: 16px 0; }
.metal-dialog-actions { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.metal-dialog-error { color: #a61818; background: #fff0f0; border-radius: 8px; padding: 12px; }
.metal-dialog-error[hidden] { display: none; }
.metal-stock-comment { margin-top: 18px; padding: 16px 20px; border: 1px solid #e5c46d; border-left: 5px solid #c18a16; border-radius: 10px; background: #fff9e8; color: #634711; }
.metal-stock-comment p { margin: 8px 0 0; line-height: 1.5; }
.metal-movements-table { min-width: 1050px; }
.metal-movements-table td { vertical-align: top; }
.metal-logistics-dialog small { display: block; color: #64748b; }
.metal-logistics-dialog :focus-visible { outline: 3px solid #2563eb; outline-offset: 2px; }
@media (max-width: 600px) { .metal-logistics-dialog { padding: 16px; } .metal-dialog-heading h2 { font-size: 20px; } }

.metal-shell-body .metal-checklist-row { grid-template-columns: 38px minmax(180px, 1fr) max-content max-content; }
.metal-shell-body .metal-stage-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: nowrap; }
.metal-shell-body .metal-stage-actions .metal-step-button { width: auto; flex: 0 0 auto; white-space: nowrap; min-height: 44px; padding: 9px 12px; }
.metal-shell-body .metal-stage-actions .metal-stage-print { flex: 0 0 auto; white-space: nowrap; }
.metal-shell-body .metal-stage-print { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 10px; border: 1px solid #b9c5cc; border-radius: 8px; color: #294855; background: #fff; font-size: 12px; text-decoration: none; }
.metal-shell-body .metal-stage-print:hover { background: #edf4f7; }
.metal-shell-body .metal-history-legacy { padding: 10px 14px; background: #fff7e5; border-left: 3px solid #b88b2e; }
.metal-shell-body .metal-operation-card .metal-lines-table small { display: block; }
@media (max-width: 1180px) {
  .metal-shell-body .metal-checklist-row { grid-template-columns: 38px minmax(140px, 1fr) max-content; }
  .metal-shell-body .metal-step-state { grid-column: 2; }
  .metal-shell-body .metal-stage-actions { grid-column: 3; grid-row: 1 / 3; }
}
@media (max-width: 760px) {
  .metal-shell-body .metal-checklist-row { grid-template-columns: 38px minmax(0, 1fr); }
  .metal-shell-body .metal-stage-actions { grid-column: 1 / -1; grid-row: auto; justify-content: flex-start; }
}
.metal-shell-body .metal-paint-disclosure > summary { width: fit-content; list-style: none; cursor: pointer; }
.metal-shell-body .metal-paint-disclosure > summary::-webkit-details-marker { display: none; }
.metal-shell-body .metal-paint-disclosure > summary::after { content: "＋"; margin-left: 10px; }
.metal-shell-body .metal-paint-disclosure[open] > summary::after { content: "−"; }
.metal-shell-body .metal-paint-disclosure .metal-paint-card { margin-top: 14px; }
.metal-shell-body .metal-specification-cell > .metal-specification-button { margin: 3px 3px 3px 0; font-size: 13px; cursor: pointer; }
.metal-shell-body .metal-standard-fields { display: grid; grid-template-columns: minmax(0, 2fr) minmax(180px, 1fr); gap: 16px; }
.metal-shell-body :is(.metal-standard-fields label, .metal-standard-search label, .metal-standard-search-label) { display: grid; gap: 6px; font-weight: 700; }
.metal-shell-body .metal-standard-search { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.metal-shell-body .metal-standard-search label { flex: 1 1 300px; }
.metal-shell-body .metal-standard-results { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; max-height: 260px; overflow: auto; }
.metal-shell-body .metal-standard-choice { text-align: left; display: grid; gap: 5px; min-height: 62px; padding: 12px; border: 1px solid #bacbd9; border-radius: 9px; background: #fff; color: var(--metal-shell-ink); font: inherit; cursor: pointer; }
.metal-shell-body .metal-standard-choice span { color: var(--metal-shell-muted); font-size: 12px; }
.metal-shell-body .metal-standard-choice[aria-pressed="true"] { border: 2px solid var(--metal-shell-blue); background: #edf6ff; }
.metal-shell-body .metal-standard-pages { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 12px 0; }
.metal-shell-body .metal-standard-pages button:disabled { opacity: .45; cursor: default; }
@media (max-width: 760px) { .metal-shell-body .metal-standard-fields { grid-template-columns: minmax(0, 1fr); } }
.metal-shell-body .metal-standard-materials-table { display: table; width: 100%; min-width: 0; }
.metal-shell-body .metal-standard-materials-table thead { display: table-header-group; }
.metal-shell-body .metal-standard-materials-table tbody { display: table-row-group; }
.metal-shell-body .metal-standard-materials-table tr { display: table-row; }
.metal-shell-body .metal-standard-materials-table td { display: table-cell; font-size: 14px; font-weight: 400; color: inherit; padding: 10px; overflow-wrap: anywhere; }
.metal-shell-body .metal-standard-materials-table td::before { display: none; }
@media (max-width: 760px) {
  .metal-shell-body .metal-lines-card .metal-lines-table tr { grid-template-columns: 34px repeat(2, minmax(0, 1fr)); }
  .metal-shell-body .metal-lines-card .metal-lines-table td { min-width: 0; border: 0; }
  .metal-shell-body .metal-lines-card .metal-lines-table td:nth-child(4) { grid-column: 2; }
  .metal-shell-body .metal-lines-card .metal-lines-table td:nth-child(6),
  .metal-shell-body .metal-lines-card .metal-specification-cell { grid-column: 2 / -1; }
  .metal-shell-body .metal-specification-cell > .metal-specification-button { max-width: 100%; white-space: normal; }
  .metal-shell-body .metal-standard-pages { gap: 6px; flex-wrap: wrap; }
}
