:root {
  color-scheme: dark;
  --ink: #eef6f8;
  --muted: #9ba8b7;
  --line: #30456d;
  --panel: #263149;
  --page: #272936;
  --soft: #202a40;
  --field: #1f2a40;
  --field-strong: #2b3854;
  --accent: #1096a1;
  --accent-strong: #29a9a4;
  --accent-soft: rgba(16, 150, 161, 0.18);
  --warn: #e5bd20;
  --warn-soft: rgba(229, 189, 32, 0.16);
  --danger: #ff6f7d;
  --danger-soft: rgba(255, 111, 125, 0.14);
  --shadow: 0 22px 70px rgba(4, 9, 18, 0.34);
  --radius: 8px;
  --control-radius: 10px;
  --sticky-catalog-head-height: 100px;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scrollbar-gutter: stable;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-size: 13px;
}

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

button {
  cursor: pointer;
}

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

a:hover {
  color: #ffffff;
}

::placeholder {
  color: #78879b;
}

.app-shell {
  width: min(1600px, calc(100% - 32px));
  margin: 0 auto;
  padding: 16px 0 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
  margin-bottom: 8px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  width: min(210px, 34vw);
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: 100%;
  height: auto;
}

.topbar h1,
.section-heading h2,
.drawer-header h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  color: #f6fbff;
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.05;
}

.section-heading h2,
.drawer-header h2 {
  font-size: 20px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar-actions,
.form-actions,
.filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.logout-form {
  margin: 0;
}

.app-tabs {
  display: flex;
  gap: 24px;
  min-height: 34px;
  height: auto;
  line-height: normal;
  margin: -8px 0 0;
  padding: 8px 0 8px;
  overflow-x: auto;
  background: var(--page);
  box-shadow: none;
}

.tab {
  min-height: 28px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-weight: 800;
}

.tab.is-active {
  background: transparent;
  color: var(--accent);
}

.tab:hover {
  color: var(--ink);
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.panel,
.order-card,
.profile-panel,
.order-detail-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 13px;
}

.panel h3,
.order-card h3,
.profile-panel h3,
.order-detail-panel h3 {
  margin: 0 0 12px;
  font-size: 20px;
  line-height: 1.15;
  font-weight: 900;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(380px, 0.85fr) minmax(520px, 1.35fr);
  gap: 16px;
  align-items: start;
}

.request-panel,
.ledger-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.request-panel {
  padding: 20px;
}

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

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

#view-catalog > .section-heading {
  position: sticky;
  top: 0;
  z-index: 11;
  align-items: flex-start;
  min-height: 0;
  margin: 0 0 18px;
  padding: 0 0 0;
  background: var(--page);
}

.request-id,
.status-dot {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  white-space: nowrap;
  border-radius: var(--control-radius);
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 800;
}

.status-dot.is-error {
  background: var(--warn-soft);
  color: var(--warn);
}

.topbar #refresh {
  min-height: 28px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 800;
}

fieldset {
  margin: 0 0 18px;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 10px;
  color: var(--muted);
  font-weight: 800;
}

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

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

.form-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.wide {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: var(--field);
  color: var(--ink);
  padding: 7px 10px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

select {
  color: var(--muted);
  font-weight: 500;
}

.app-shell input:not([type]),
.app-shell input[type="text"]:not(.browser-default),
.app-shell input[type="search"]:not(.browser-default),
.app-shell input[type="email"]:not(.browser-default),
.app-shell input[type="number"]:not(.browser-default),
.app-shell textarea,
.app-shell .select-wrapper input.select-dropdown {
  box-sizing: border-box !important;
  width: 100% !important;
  min-height: 36px;
  height: auto !important;
  margin: 0 !important;
  border: 1px solid var(--line) !important;
  border-bottom: 1px solid var(--line) !important;
  border-radius: var(--control-radius) !important;
  background: var(--field) !important;
  color: var(--muted) !important;
  padding: 7px 32px 7px 10px !important;
  font-size: inherit;
  font-weight: 500;
  line-height: 1.35;
  box-shadow: none !important;
}

.app-shell input:not([type]):focus,
.app-shell input[type="text"]:not(.browser-default):focus,
.app-shell input[type="search"]:not(.browser-default):focus,
.app-shell input[type="email"]:not(.browser-default):focus,
.app-shell input[type="number"]:not(.browser-default):focus,
.app-shell textarea:focus,
.app-shell .select-wrapper input.select-dropdown:focus {
  border: 1px solid var(--accent) !important;
  border-bottom: 1px solid var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(16, 150, 161, 0.18) !important;
}

.app-shell .select-wrapper .caret {
  right: 10px;
  z-index: 1;
  fill: var(--muted);
  pointer-events: none;
}

.app-shell .select-wrapper {
  width: 100%;
}

.app-shell .dropdown-content,
.select-dropdown.dropdown-content {
  overflow-x: hidden !important;
  overflow-y: auto;
  max-height: min(70vh, 560px) !important;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: var(--field);
}

.app-shell .dropdown-content li > a,
.app-shell .dropdown-content li > span,
.select-dropdown.dropdown-content li > a,
.select-dropdown.dropdown-content li > span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.app-shell .dropdown-content li:hover,
.app-shell .dropdown-content li.active,
.select-dropdown.dropdown-content li:hover,
.select-dropdown.dropdown-content li.active {
  background: var(--accent-soft);
}

textarea {
  border-radius: var(--control-radius);
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(94, 219, 212, 0.18);
}

input:disabled,
select:disabled,
textarea:disabled {
  color: #8290a2;
  background: rgba(31, 42, 64, 0.64);
}

.preview-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 176px;
  gap: 12px;
  align-items: stretch;
  margin-top: 4px;
}

.label-preview {
  min-height: 162px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--field);
}

.label-preview canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.image-preview {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.image-preview img,
.detail-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.calc-summary {
  display: grid;
  gap: 8px;
}

.calc-summary div,
.metric {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
  padding: 11px;
}

.calc-summary span,
.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.calc-summary strong,
.metric strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.1;
}

.form-actions {
  justify-content: flex-end;
  margin-top: 18px;
}

.button,
.icon-button,
.round-button,
.tool-button {
  border: 1px solid transparent;
  border-radius: var(--control-radius);
  font-weight: 800;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.button,
.icon-button {
  min-height: 34px;
  padding: 7px 14px;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.icon-button span:first-child {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  font-size: 18px;
  line-height: 1;
}

.primary {
  background: var(--accent);
  color: #172233;
}

.secondary,
.ghost {
  background: var(--panel);
  color: var(--ink);
  border-color: var(--line);
}

.button:hover,
.icon-button:hover,
.tool-button:hover,
.round-button:hover {
  transform: translateY(-1px);
}

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

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

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(112px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.filters {
  align-items: end;
  margin-bottom: 12px;
}

.filters label {
  min-width: 150px;
}

.search-box {
  position: relative;
  width: 100%;
}

.search-box span {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  display: grid;
  place-items: center;
  width: 24px;
  color: var(--accent-strong);
  font-size: 16px;
  line-height: 1;
  pointer-events: none;
}

.search-box input {
  padding-left: 14px !important;
  padding-right: 52px !important;
}

.app-shell .search-box input[type="search"]:not(.browser-default) {
  padding-left: 14px !important;
  padding-right: 62px !important;
}

.catalog-tools {
  display: grid;
  flex: 1 1 520px;
  gap: 10px;
}

.orders-tools {
  flex: 1 1 100%;
}

.catalog-title-block {
  display: grid;
  gap: 6px;
  align-content: start;
}

.catalog-title-block h2 {
  line-height: 1.05;
}

.catalog-title-block .button {
  width: max-content;
}

.quick-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 10px;
}

.select-wrapper {
  width: 100%;
}

@media (max-width: 980px) {
  .quick-filters {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
}

.table-wrap {
  position: relative;
  min-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.order-builder-wrap {
  margin-top: 14px;
}

table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
  background: var(--panel);
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

td {
  font-size: 14px;
}

.order-builder-table {
  min-width: 1180px;
  table-layout: fixed;
}

.order-builder-table .col-sku {
  width: 10ch;
}

.order-builder-table .col-name {
  width: auto;
}

.order-builder-table .col-size,
.order-builder-table .col-material {
  width: 15ch;
}

.order-builder-table .col-runs {
  width: 22ch;
}

.order-builder-table .col-price {
  width: 10ch;
}

.order-builder-table .col-actions {
  width: 86px;
}

.order-builder-table th,
.order-builder-table td {
  padding: 10px 8px;
}

.order-builder-table td {
  vertical-align: top;
}

.order-builder-table input,
.order-builder-table select {
  display: block;
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.2;
  height: 42px;
  min-height: 42px;
  padding-inline: 10px;
}

.row-action-buttons {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  align-items: center;
  min-height: 42px;
}

.order-builder-table .tool-button {
  width: 42px;
  height: 42px;
  min-width: 42px;
  font-size: 18px;
}

.row-action-buttons .tool-button[hidden] {
  display: none;
}

.order-builder-table [data-field="label_sku"] {
  text-transform: uppercase;
}

.order-builder-table [data-field="name"] {
  min-width: 0;
}

.order-builder-table [data-field="size_id"],
.order-builder-table [data-field="material_id"] {
  max-width: 15ch;
}

.order-builder-table [data-run-option],
.order-builder-table [data-field="price_option_1"] {
  max-width: 10ch;
  font-variant-numeric: tabular-nums;
}

tbody tr {
  transition: background 0.12s ease;
}

tbody tr:hover {
  background: rgba(94, 219, 212, 0.06);
}

.table-id {
  color: var(--accent-strong);
  font-weight: 900;
}

.subtext {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.table-thumb {
  display: block;
  width: 72px;
  height: 52px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.image-empty {
  display: inline-grid;
  place-items: center;
  width: 72px;
  height: 52px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.status-select,
.amount-input,
.owner-input {
  min-height: 34px;
  padding: 6px 8px;
  font-size: 13px;
}

.status-select {
  min-width: 138px;
  font-weight: 800;
}

.amount-input {
  width: 112px;
}

.row-tools {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.orders-list {
  display: grid;
  gap: 14px;
}

.orders-archive-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.75fr) minmax(520px, 1.25fr);
  gap: 14px;
  align-items: start;
}

.orders-archive-list {
  display: grid;
  gap: 8px;
}

.order-archive-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 10px 12px;
  text-align: left;
}

.order-archive-row > span {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.order-archive-row > span:last-child {
  justify-items: end;
  flex-shrink: 0;
}

.order-archive-row small {
  color: var(--muted);
  font-weight: 700;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  width: max-content;
  max-width: 100%;
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: var(--control-radius);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.status-badge.status-quote {
  border-color: rgba(111, 151, 255, 0.45);
  color: #b9c9ff;
  background: rgba(89, 121, 218, 0.16);
}

.status-badge.status-approval {
  border-color: rgba(229, 189, 32, 0.56);
  color: #f1d766;
  background: rgba(229, 189, 32, 0.16);
}

.status-badge.status-payment {
  border-color: rgba(180, 137, 255, 0.46);
  color: #d1b8ff;
  background: rgba(137, 92, 218, 0.17);
}

.status-badge.status-work {
  border-color: rgba(94, 219, 212, 0.5);
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.status-badge.status-done {
  border-color: rgba(158, 170, 184, 0.38);
  color: #a9b2bf;
  background: rgba(158, 170, 184, 0.12);
}

.status-badge.status-default {
  border-color: var(--line);
  color: var(--muted);
  background: var(--soft);
}

.order-archive-row.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(94, 219, 212, 0.17);
}

.order-detail-panel {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 14px;
  max-height: none;
  overflow: visible;
  align-content: start;
}

.archive-items {
  display: grid;
  gap: 8px;
}

.archive-item {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(110px, 0.35fr) minmax(110px, 0.35fr) minmax(130px, 0.4fr);
  gap: 14px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: rgba(31, 42, 64, 0.45);
}

.archive-item > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.archive-item span,
.archive-item small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

.order-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  min-height: 76px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.order-head-meta {
  display: grid;
  align-self: stretch;
  align-content: space-between;
  justify-items: end;
  text-align: right;
}

.order-items {
  display: grid;
  gap: 10px;
}

.order-item {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(520px, 1.7fr);
  gap: 14px;
  align-items: start;
  padding: 10px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
}

.item-main {
  display: grid;
  gap: 3px;
}

.item-title {
  color: var(--muted);
}

.preview-open-button {
  width: max-content;
  min-height: 32px;
  margin-top: 8px;
  padding: 6px 10px;
  font-size: 13px;
}

.preview-missing {
  width: max-content;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

body.is-modal-open {
  overflow: hidden;
}

.image-modal[hidden] {
  display: none !important;
}

.image-modal {
  position: fixed !important;
  inset: 0 !important;
  z-index: 9999 !important;
  box-sizing: border-box !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100vw !important;
  height: 100vh !important;
  padding: 24px !important;
}

.image-modal-backdrop {
  all: unset;
  position: fixed !important;
  inset: 0 !important;
  display: block !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(12, 22, 24, 0.72) !important;
  cursor: pointer;
}

.image-modal-panel {
  position: relative !important;
  z-index: 1 !important;
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  width: min(1100px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 14px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
}

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

.image-modal-panel img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 132px);
  object-fit: contain;
  justify-self: center;
  align-self: center;
  overflow: auto;
}

.price-options-table {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.price-options-head,
.price-option {
  display: grid;
  grid-template-columns: minmax(110px, 0.9fr) minmax(110px, 0.9fr) minmax(130px, 1fr) minmax(104px, 0.75fr);
  gap: 8px;
  align-items: center;
}

.price-options-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  padding: 0 8px 2px;
}

.price-option {
  padding: 3px 5px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  transition: color 120ms ease, opacity 120ms ease, background 120ms ease;
}

.price-option label,
.option-total {
  display: grid;
  min-width: 0;
}

.option-total {
  align-self: stretch;
  justify-content: start;
}

.option-total strong {
  align-content: center;
  min-height: 38px;
  font-variant-numeric: tabular-nums;
}

.option-total small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.price-option.is-muted {
  background: transparent;
  color: var(--muted);
}

.price-option.is-muted input,
.price-option.is-muted strong,
.price-option.is-muted .tool-button {
  color: var(--muted);
}

.price-option.is-muted input {
  background: rgba(31, 42, 64, 0.75);
}

.price-option.chosen {
  background: rgba(13, 20, 34, 0.24);
  outline: 0;
  border-radius: var(--control-radius);
}

.price-option .tool-button {
  width: 100%;
  min-width: 0;
  padding: 0 10px;
  color: var(--muted);
  font-size: inherit;
  font-weight: 500;
  white-space: nowrap;
}

.price-option .tool-button.is-selected {
  background: var(--accent);
  color: #172233;
  border-color: var(--accent);
  font-weight: 500;
}

.price-option.chosen .option-total strong {
  font-weight: 500 !important;
}

.empty-options {
  color: var(--muted);
  font-weight: 800;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.payment-grid {
  display: grid;
  grid-template-columns: repeat(4, 170px);
  justify-content: start;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  align-items: center;
}

.upload-box,
.file-button {
  position: relative;
  cursor: pointer;
}

.upload-box,
.document-button,
.document-placeholder {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  width: 170px;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  padding: 7px 11px;
  color: var(--ink);
  background: var(--field);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
}

.order-card .preview-open-button,
.order-card .payment-grid .button,
.order-card .payment-grid .tool-button {
  font-weight: 600;
}

.order-card .price-option input {
  font-weight: 500 !important;
}

.order-card .price-option.chosen input {
  font-weight: 500 !important;
}

.order-card .price-option.is-muted input,
.order-card .price-option.is-muted strong,
.order-card .price-option.is-muted .tool-button {
  font-weight: 500;
}

.upload-box:hover,
.document-button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.upload-box.danger {
  border-color: rgba(255, 111, 125, 0.35);
  color: var(--danger);
  background: rgba(255, 111, 125, 0.06);
}

.upload-box:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.document-links {
  display: grid;
  gap: 8px;
}

.document-placeholder {
  color: var(--muted);
  pointer-events: none;
}

.preview-upload {
  min-height: 42px;
  align-items: center;
  justify-content: center;
}

.upload-box input,
.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.row-warning {
  margin-top: 4px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 800;
}

tr.has-warning {
  background: var(--danger-soft);
}

.processing-grid {
  display: grid;
  grid-template-columns: minmax(320px, 760px);
  gap: 16px;
}

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

.processing-note,
.processing-message {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
  padding: 12px;
}

.processing-note span,
.processing-message span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.processing-actions {
  justify-content: flex-start;
  margin-top: 0;
}

.processing-message.is-success {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.processing-message.is-error {
  border-color: var(--warn);
  background: var(--warn-soft);
}

.run-options {
  display: grid;
  min-width: 10ch;
  gap: 8px;
}

.run-option-row {
  display: grid;
  grid-template-columns: 10ch;
  gap: 6px;
  align-items: center;
}

.run-option-row.has-add {
  grid-template-columns: 10ch 42px;
}

.run-option-row.has-remove {
  grid-template-columns: 10ch 42px;
}

.run-option-row.has-remove.has-add {
  grid-template-columns: 10ch 42px 42px;
}

.last-order-hint {
  max-width: 14ch;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.history-hint {
  min-width: 180px;
  color: var(--muted);
  font-size: 12px;
}

.history-hint button {
  display: block;
  margin-top: 4px;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: var(--panel);
  padding: 4px 6px;
  font-size: 12px;
  font-weight: 800;
}

.catalog-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(420px, 1.1fr);
  gap: 14px;
  align-items: start;
}

.catalog-list,
.directory-list {
  display: grid;
  gap: 8px;
}

.catalog-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  grid-template-rows: auto auto auto;
  gap: 2px 10px;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 10px;
  text-align: left;
}

.catalog-card.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(94, 219, 212, 0.17);
}

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

.catalog-card img,
.profile-image {
  width: 72px;
  height: 52px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.catalog-card img,
.catalog-card .image-empty {
  grid-row: 1 / 4;
}

.profile-panel {
  position: sticky;
  top: var(--sticky-catalog-head-height);
  display: grid;
  gap: 10px;
  max-height: calc(100vh - var(--sticky-catalog-head-height) - 16px);
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(155, 168, 183, 0.48) transparent;
  align-content: start;
}

.profile-panel.is-select-open {
  overflow: visible;
}

.profile-panel::-webkit-scrollbar {
  width: 8px;
}

.profile-panel::-webkit-scrollbar-track {
  background: transparent;
}

.profile-panel::-webkit-scrollbar-thumb {
  border-radius: 8px;
  background: rgba(155, 168, 183, 0.42);
}

.profile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.profile-header h3 {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.profile-image {
  width: 100%;
  height: 180px;
}

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

.profile-panel .preview-upload {
  width: max-content;
  min-width: 176px;
}

.empty-profile {
  color: var(--muted);
  font-weight: 800;
}

.history-table {
  display: grid;
  gap: 6px;
  font-size: 13px;
}

.history-table div {
  display: grid;
  grid-template-columns: 90px 70px 1fr 90px 100px 110px;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
}

.directory-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

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

.directory-panel-header h3 {
  margin: 0;
}

.directory-panel-content {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.directory-panel.is-collapsed .directory-panel-content {
  display: none;
}

.directory-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(130px, 0.35fr);
  gap: 8px;
  margin-top: 8px;
}

.printing-house-add-row {
  grid-template-columns: minmax(150px, 1fr) minmax(150px, 1fr) minmax(170px, 1fr) minmax(120px, 0.4fr);
}

.printing-house-edit-fields {
  grid-template-columns: minmax(150px, 1fr) minmax(150px, 1fr) minmax(170px, 1fr);
}

.directory-list > .directory-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  background: rgba(31, 42, 64, 0.5);
}

.directory-list > .directory-row > strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.directory-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.directory-main span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.directory-list > .directory-row.is-editing {
  padding: 8px;
}

.directory-actions {
  display: flex;
  flex-shrink: 0;
  gap: 6px;
}

.directory-edit-fields {
  display: grid;
  flex: 1;
  min-width: 0;
  gap: 8px;
}

.size-edit-fields {
  grid-template-columns: repeat(3, minmax(90px, 1fr));
}

.directory-edit-fields input,
.directory-edit-fields select {
  min-height: 34px;
  padding: 6px 8px;
  font-size: 14px;
  font-weight: 400;
}

.empty-state.inline {
  position: static;
  min-height: 220px;
  display: flex;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.tool-button,
.round-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  background: var(--field);
  border-color: var(--line);
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
}

.tool-button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #172233;
}

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

.empty-state {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  background: var(--panel);
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--ink);
}

.table-wrap.is-empty table {
  visibility: hidden;
}

.table-wrap.is-empty .empty-state {
  display: flex;
}

.details-drawer {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
}

.details-drawer.is-open {
  display: block;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 18, 0.62);
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  width: min(520px, 100%);
  height: 100%;
  background: var(--panel);
  box-shadow: -24px 0 60px rgba(4, 9, 18, 0.34);
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

#details-content {
  display: grid;
  gap: 14px;
  overflow: auto;
  padding: 20px;
}

.detail-block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

.detail-block h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.detail-image {
  max-height: 220px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

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

.detail-grid div {
  min-width: 0;
}

.detail-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.detail-grid strong,
.detail-grid p {
  display: block;
  margin: 3px 0 0;
  overflow-wrap: anywhere;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: var(--control-radius);
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 900;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

@media (max-width: 1180px) {
  .workspace,
  .orders-archive-layout {
    grid-template-columns: 1fr;
  }

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

  .request-panel {
    order: 1;
  }

  .ledger-panel {
    order: 2;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 20px, 1600px);
    padding-top: 12px;
  }

  .topbar,
  .section-heading,
  .preview-row {
    display: grid;
  }

  .app-tabs,
  #view-catalog > .section-heading {
    position: static;
  }

  .topbar-actions,
  .form-actions {
    width: 100%;
    justify-content: stretch;
  }

  .icon-button,
  .button {
    flex: 1 1 auto;
    justify-content: center;
  }

  .request-panel,
  .ledger-panel {
    padding: 14px;
  }

  .form-grid.two,
  .form-grid.four,
  .preview-row,
  .metrics,
  .detail-grid,
  .quick-filters,
  .directory-grid,
  .directory-add-row,
  .profile-fields-grid,
  .printing-house-edit-fields {
    grid-template-columns: 1fr;
  }

  .profile-panel {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .order-detail-panel {
    position: static;
    max-height: none;
    overflow: visible;
  }

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

  .price-options-head {
    display: none;
  }

  .price-option {
    grid-template-columns: 1fr;
  }

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

  .upload-box,
  .document-button,
  .document-placeholder {
    width: 100%;
  }

  .filters label {
    flex: 1 1 100%;
  }
}
