:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-muted: #eef3f5;
  --text: #172026;
  --muted: #697780;
  --line: #d8e0e5;
  --accent: #176b5f;
  --accent-dark: #0f4f46;
  --danger: #b42318;
  --shadow: 0 18px 45px rgba(23, 32, 38, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

body.modal-open {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

select {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

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

.app {
  height: 100vh;
  overflow: hidden;
}

.login {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #eef4f6 0%, #f8fafb 48%, #e7f2ef 100%);
}

.login__panel {
  width: min(100%, 430px);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.brand__mark {
  display: block;
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  object-fit: contain;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(23, 32, 38, 0.12);
}

h1,
h2,
p {
  margin: 0;
}

.brand h1 {
  font-size: 24px;
  line-height: 1.2;
}

.brand p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.35;
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.login-form input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: #ffffff;
  color: var(--text);
}

.login-form input:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(23, 107, 95, 0.16);
}

.login-form button,
.button-secondary,
.button-primary {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
}

.login-form button:hover {
  background: var(--accent-dark);
}

.form-message {
  min-height: 20px;
  color: var(--danger);
  font-size: 14px;
}

.workspace {
  display: grid;
  grid-template-rows: 48px minmax(0, 1fr) 22px;
  height: 100vh;
  overflow: hidden;
}

.topbar {
  display: flex;
  position: relative;
  z-index: 100;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  padding: 6px 20px;
}

.topbar-brand {
  display: inline-flex;
  min-width: max-content;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-weight: 800;
  line-height: 1;
}

.topbar-brand img {
  display: block;
  width: 34px;
  height: 34px;
  object-fit: contain;
  border-radius: 8px;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

.button-secondary {
  border: 1px solid var(--line);
  background: var(--surface-muted);
  color: var(--text);
}

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

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

.button-danger {
  border-color: #e6c3c3;
  background: #fff3f3;
  color: #8f1f1f;
}

.button-danger:hover {
  background: #ffe6e6;
}

.button-primary:disabled,
.button-secondary:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.layout {
  display: block;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: visible;
}

.nav-item {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
}

.nav-group {
  position: relative;
}

.nav-group::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 6px;
}

.nav-parent {
  width: 100%;
}

.nav-submenu {
  display: none;
  position: absolute;
  z-index: 110;
  top: calc(100% + 6px);
  left: 0;
  min-width: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 6px;
}

.nav-group:hover .nav-submenu {
  display: grid;
  gap: 4px;
}

.nav-subitem {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.nav-item.active,
.nav-item:hover,
.nav-group.active .nav-parent,
.nav-subitem.active,
.nav-subitem:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.content {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
  overflow: hidden;
  height: 100%;
  padding: 12px 18px 8px;
}

.app-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--page);
  color: #8a96a3;
  font-size: 12px;
}

.content-section {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.placeholder-panel {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
}

.placeholder-panel h2 {
  font-size: 22px;
}

.placeholder-panel p:last-child {
  color: var(--muted);
  line-height: 1.5;
}

.wizard-head {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(320px, 640px);
  align-items: center;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
}

.wizard-head h2 {
  margin-top: 4px;
  font-size: 22px;
}

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

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

.toolbar--wrap input {
  flex: 1 1 150px;
}

.sync-status {
  grid-column: 2;
  min-height: 18px;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.toolbar input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: #ffffff;
  color: var(--text);
}

.admin-users-shell {
  grid-row: 1 / -1;
}

.admin-settings-shell {
  align-content: start;
}

.admin-settings-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}

.admin-settings-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 14px;
  background: #ffffff;
}

.admin-settings-card__title {
  flex: 0 0 auto;
}

.settings-switch {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

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

.settings-switch__track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #b8c1c8;
  transition: background-color 160ms ease;
}

.settings-switch__track::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(21, 39, 53, 0.28);
  transition: transform 160ms ease;
  content: "";
}

.settings-switch input:checked + .settings-switch__track {
  background: #16856f;
}

.settings-switch input:checked + .settings-switch__track::after {
  transform: translateX(20px);
}

.settings-switch input:focus-visible + .settings-switch__track {
  outline: 2px solid #1f6feb;
  outline-offset: 2px;
}

.admin-settings-time {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.admin-settings-time-picker {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--text);
  font-weight: 700;
}

.admin-settings-time-picker select {
  width: 48px;
  min-width: 48px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 4px;
  background: #ffffff;
  color: var(--text);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.admin-settings-meta {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 14px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.admin-settings-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
}

.admin-settings-actions .form-message {
  flex: 0 1 auto;
  min-width: 0;
  margin: 0;
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .admin-settings-card {
    flex-wrap: wrap;
  }

  .admin-settings-meta {
    flex-basis: 100%;
    order: 5;
  }
}

.admin-users-title {
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
}

.admin-title-group,
.admin-title-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.admin-title-meta {
  justify-content: flex-end;
  color: var(--muted);
  font-size: 13px;
}

.admin-icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

.admin-icon-button--primary {
  background: #1f6feb;
  color: #ffffff;
}

.admin-filter {
  display: block;
  width: 100%;
  min-height: 30px;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 8px;
  background: #ffffff;
  color: var(--text);
  font-size: 12px;
  font-weight: 400;
}

.admin-row--editing {
  background: #e9f8f2;
}

.cash-transfer-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-content: start;
  gap: 10px;
  height: calc(100vh - 68px);
  min-height: 0;
  padding: 12px 18px 18px;
}

.cash-transfer-workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.cash-transfer-header,
.cash-transfer-card__title,
.cash-transfer-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.cash-transfer-header h2,
.cash-transfer-card h3 {
  margin: 0;
}

.cash-transfer-top {
  display: grid;
  position: relative;
  z-index: 10;
  grid-template-columns: minmax(190px, 230px) minmax(0, 1fr);
  align-items: stretch;
  gap: 12px;
}

.cash-transfer-header {
  min-height: 0;
  align-items: flex-start;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 4px 0;
}

.cash-transfer-header h2 {
  font-size: 17px;
  line-height: 1.25;
}

.cash-transfer-header > div > p:last-child,
.cash-transfer-card__title p,
.cash-transfer-empty p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.cash-transfer-draft-badge {
  border: 1px solid #b9d8cf;
  border-radius: 999px;
  padding: 7px 12px;
  background: #edf8f4;
  color: #126c5a;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.cash-transfer-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 5px 18px rgba(31, 49, 64, 0.05);
}

.cash-transfer-card__title {
  border-bottom: 1px solid var(--line);
  padding: 16px 18px;
}

.cash-transfer-card__title > div:first-child {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cash-transfer-step {
  display: inline-grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: #e8f2ff;
  color: #1f6feb;
  font-size: 13px;
  font-weight: 800;
}

.cash-transfer-fields {
  display: grid;
  grid-template-columns: minmax(180px, 0.75fr) repeat(3, minmax(190px, 1fr));
  gap: 10px 12px;
  padding: 12px 14px;
}

.cash-transfer-fields label {
  display: grid;
  position: relative;
  align-content: start;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.cash-transfer-fields input,
.cash-transfer-fields select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 11px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-weight: 500;
}

.cash-transfer-card--params {
  overflow: visible;
  box-shadow: none;
}

.cash-transfer-workspace {
  position: relative;
  z-index: 1;
}

.cash-transfer-card--params .cash-transfer-fields input,
.cash-transfer-card--params .cash-transfer-fields select {
  min-height: 34px;
}

.cash-transfer-panel-header {
  grid-template-columns: auto minmax(0, 1fr) auto !important;
  align-self: start;
  min-height: 48px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 6px 12px;
  background: #ffffff;
}

.cash-transfer-panel {
  display: grid;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr);
}

.cash-transfer-sources {
  display: grid;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr) auto;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.cash-transfer-fields input[readonly] {
  background: #f5f7f8;
  color: var(--muted);
}

.cash-transfer-field--wide {
  grid-column: span 2;
}

.cash-transfer-field--full {
  grid-column: 1 / -1;
}

.cash-transfer-toolbar {
  display: flex;
  gap: 8px;
}

.cash-transfer-table-wrap {
  min-height: 210px;
}

.cash-transfer-table th:nth-child(1) {
  width: 18%;
}

.cash-transfer-table th:nth-child(2) {
  width: 15%;
}

.cash-transfer-table th:nth-child(3),
.cash-transfer-table th:nth-child(5) {
  width: 12%;
}

.cash-transfer-table th:nth-child(4) {
  width: 8%;
}

.cash-transfer-table th:nth-child(6),
.cash-transfer-table th:nth-child(7) {
  width: 11%;
}

.cash-transfer-table th:nth-child(8) {
  width: 10%;
}

.cash-transfer-table th:nth-child(9) {
  width: 3%;
}

.cash-transfer-table input[type="number"] {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 8px;
}

.cash-transfer-table input.input-error {
  border-color: #cf3f3f;
  background: #fff3f3;
}

.cash-transfer-checkbox-cell {
  text-align: center;
}

.cash-transfer-checkbox-cell input {
  width: 18px;
  height: 18px;
}

.cash-transfer-remove {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #a73a3a;
  font-size: 22px;
  line-height: 1;
}

.cash-transfer-remove:hover {
  background: #fff0f0;
}

.cash-transfer-empty {
  display: grid;
  justify-items: center;
  padding: 38px 20px;
  text-align: center;
}

.cash-transfer-empty__icon {
  display: inline-grid;
  width: 44px;
  height: 44px;
  margin-bottom: 10px;
  place-items: center;
  border-radius: 50%;
  background: #eef3f6;
  color: #627381;
  font-size: 20px;
  font-weight: 800;
}

.cash-transfer-summary {
  border-top: 1px solid var(--line);
  padding: 14px 18px;
  background: #f8fafb;
}

.cash-transfer-summary > div {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.cash-transfer-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.cash-transfer-summary strong {
  font-size: 16px;
}

.cash-transfer-summary__total strong {
  color: #126c5a;
  font-size: 20px;
}

.cash-transfer-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.cash-transfer-header-actions button {
  min-height: 34px;
  white-space: nowrap;
}

.cash-transfer-header-actions strong {
  min-width: 24px;
  font-weight: 400;
  text-align: right;
}

.cash-transfer-status {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cash-picker-modal__panel {
  display: grid;
  width: min(720px, calc(100vw - 40px));
  height: min(720px, calc(100dvh - 40px));
  max-height: min(720px, calc(100vh - 40px));
  grid-template-rows: auto auto minmax(180px, 1fr) auto;
}

.cash-picker-search {
  padding: 12px 16px;
}

.cash-picker-search input {
  width: 100%;
}

.cash-picker-list {
  display: grid;
  align-content: start;
  overflow: auto;
  padding: 0;
}

.cash-picker-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  border-bottom: 1px solid var(--line);
  padding: 8px 16px;
  background: #ffffff;
  cursor: pointer;
}

.cash-picker-row:hover {
  background: #eef8f5;
}

.cash-picker-row:has(input:checked) {
  background: #e5f4ec;
}

.cash-picker-row input {
  width: 18px;
  height: 18px;
}

.cash-picker-row span {
  display: grid;
  gap: 3px;
}

.cash-picker-row small {
  color: var(--muted);
  font-size: 12px;
}

.cash-picker-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding: 12px 16px;
  background: #ffffff;
}

.cashes-directory-head {
  padding-block: 12px;
}

.cashes-directory-head .toolbar {
  min-width: 0;
}

.cashes-directory-head .toolbar input {
  min-width: 0;
}

.cashes-directory-head .toolbar button {
  flex: 0 0 auto;
  min-height: 40px;
  white-space: nowrap;
}

.cashes-directory-table {
  width: 100%;
  min-width: 100%;
}

.cashes-directory-table col:nth-child(1) {
  width: 34% !important;
}

.cashes-directory-table col:nth-child(2) {
  width: 26% !important;
}

.cashes-directory-table col:nth-child(3) {
  width: 14% !important;
}

.cashes-directory-table col:nth-child(4) {
  width: 8% !important;
}

.cashes-directory-table col:nth-child(5) {
  width: 18% !important;
}

@media (max-width: 1050px) {
  .cash-transfer-top {
    grid-template-columns: 1fr;
  }

  .cash-transfer-fields {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .cash-transfer-field--wide {
    grid-column: span 1;
  }
}

@media (max-width: 760px) {
  .cash-transfer-shell {
    padding: 20px 16px;
  }

  .cash-transfer-header,
  .cash-transfer-card__title {
    align-items: stretch;
    flex-direction: column;
  }

  .cash-transfer-fields {
    grid-template-columns: 1fr;
  }

  .cash-transfer-field--wide,
  .cash-transfer-field--full {
    grid-column: auto;
  }

  .cash-transfer-toolbar,
  .cash-transfer-header-actions {
    width: 100%;
  }

  .cash-transfer-toolbar button,
  .cash-transfer-header-actions button {
    flex: 1;
  }
}

.admin-edit-field {
  width: 100%;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 8px;
  background: #ffffff;
  color: var(--text);
}

.admin-actions-cell {
  min-width: 150px;
}

.admin-actions,
.admin-edit-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.admin-actions button,
.admin-edit-actions button {
  min-height: 32px;
  padding: 0 10px;
}

.admin-action-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  background: #edf2f7;
  color: #314155;
  padding: 0;
}

.admin-action-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.admin-action-button:hover {
  background: #dde7ef;
}

.admin-action-button--danger {
  border-color: #e6c3c3;
  background: #fff3f3;
  color: #8f1f1f;
}

.admin-action-button--danger:hover {
  background: #ffe6e6;
}

.admin-action-button--success {
  border-color: #b8ddcc;
  background: #e9f8f2;
  color: #176b5f;
}

.admin-action-button--success:hover {
  background: #d8f1e8;
}

.admin-protected {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.admin-create-modal__panel {
  display: grid;
  width: min(100%, 760px);
  max-height: min(92vh, 620px);
  overflow: hidden;
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.admin-modal-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.admin-create-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

.admin-create-form label:not(.toolbar-check) {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.admin-create-form input,
.admin-create-form select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #ffffff;
  color: var(--text);
}

.admin-active-check {
  min-height: 40px;
  margin: 0;
  white-space: nowrap;
}

.admin-create-form .form-message,
.admin-create-actions {
  grid-column: 1 / -1;
}

.admin-create-actions {
  display: flex;
  gap: 10px;
}

.auto-order-head {
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  padding: 10px 16px;
  overflow: visible;
}

.auto-order-oks {
  position: relative;
  display: inline-grid;
  min-width: 132px;
  min-height: 42px;
  align-content: center;
  gap: 2px;
  border: 1px solid rgba(23, 107, 95, 0.42);
  border-radius: 6px;
  padding: 6px 12px;
  background: #d9f3ec;
  color: var(--accent);
  text-align: center;
}

.auto-order-oks span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.auto-order-oks strong {
  color: #0d453e;
  font-size: 15px;
  font-weight: 800;
}

.auto-order-oks-tooltip {
  position: absolute;
  z-index: 50;
  top: calc(100% + 8px);
  left: 50%;
  display: none;
  min-width: 225px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(25, 44, 52, 0.16);
  color: var(--text);
  text-align: left;
  transform: translateX(-50%);
  pointer-events: none;
}

.auto-order-oks:hover .auto-order-oks-tooltip,
.auto-order-oks:focus .auto-order-oks-tooltip,
.auto-order-oks:focus-within .auto-order-oks-tooltip {
  display: block;
}

.auto-order-oks-tooltip strong {
  display: block;
  margin-bottom: 5px;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.auto-order-oks-tooltip ol {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  color: var(--text);
  font-size: 12px;
  list-style: none;
}

.auto-order-oks-tooltip__empty {
  color: var(--muted);
  white-space: nowrap;
}

.auto-order-oks-tooltip__present {
  color: #16835f;
}

.auto-order-oks-tooltip__missing {
  color: #c43d45;
}

.auto-order-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  grid-template-rows: auto auto;
  gap: 8px 8px;
  align-items: end;
  overflow: visible;
}

.auto-order-status {
  grid-column: 1 / -1;
  min-height: 18px;
}

.auto-order-main-fields,
.auto-order-params {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.auto-order-main-fields {
  grid-column: 1;
  grid-row: 1;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
}

.auto-order-params {
  grid-column: 1;
  grid-row: 2;
  grid-template-columns: repeat(5, max-content) minmax(230px, 1fr);
  justify-content: start;
}

.auto-order-form label,
.auto-order-template-block label {
  display: grid;
  position: relative;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.auto-order-form label {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
}

.auto-order-param {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.auto-order-form label > span {
  min-width: max-content;
}

.auto-order-param > span {
  min-width: max-content;
}

.auto-order-form .combo-list {
  top: calc(100% + 4px);
  left: auto;
  width: min(360px, 100%);
}

.auto-order-template-block .combo-list {
  top: calc(100% + 4px);
  width: 100%;
}

.auto-order-form select,
.auto-order-select-search,
.auto-order-template-block select,
.auto-order-tree-tools input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #ffffff;
  color: var(--text);
}

.auto-order-select-search {
  min-height: 32px;
  font-size: 12px;
}

.auto-order-number-input {
  width: 38px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 5px;
  background: #ffffff;
  color: var(--text);
  font-size: 12px;
}

.auto-order-number-input::-webkit-outer-spin-button,
.auto-order-number-input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
}

.auto-order-number-input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.auto-order-check-label {
  display: inline-flex !important;
  width: max-content;
  max-width: 230px;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  justify-content: flex-start;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.auto-order-check-label span {
  line-height: 1.15;
}

.auto-order-check-label input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

.combo-native-select {
  display: none;
}

.combo-list {
  position: absolute;
  z-index: 80;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.combo-list button,
.combo-list__empty {
  display: block;
  width: 100%;
  min-height: 32px;
  border: 0;
  padding: 6px 10px;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  text-align: left;
}

.combo-list button:hover {
  background: #eef8f5;
  color: var(--accent);
}

.combo-list__empty {
  color: var(--muted);
}

.auto-order-template-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 8px;
}

.auto-order-template-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.auto-order-template-actions button {
  min-height: 32px;
  padding: 0 6px;
  font-size: 12px;
  white-space: nowrap;
}

.clear-selection-button {
  min-height: 26px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.auto-order-actions {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  display: grid;
  gap: 6px;
  min-width: 0;
  width: 100%;
}

.auto-order-actions button {
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  font-size: 14px;
  white-space: nowrap;
}

.auto-order-shell {
  display: grid;
  grid-template-columns: minmax(240px, var(--auto-order-left-width, 390px)) 6px minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.auto-order-splitter {
  position: relative;
  z-index: 4;
  width: 6px;
  cursor: col-resize;
  background:
    linear-gradient(to right, transparent 0 2px, var(--line) 2px 3px, transparent 3px 100%);
}

.auto-order-splitter:hover,
.auto-order-shell.is-resizing .auto-order-splitter {
  background:
    linear-gradient(to right, transparent 0 1px, rgba(23, 107, 95, 0.5) 1px 5px, transparent 5px 100%);
}

.auto-order-shell.is-resizing {
  user-select: none;
}

.auto-order-tree-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  min-height: 56px;
  border-bottom: 1px solid var(--line);
  padding: 8px;
  background: #fbfcfd;
  position: relative;
  z-index: 2;
}

.auto-order-tree-tools input {
  position: relative;
  z-index: 1;
}

.pane-title.pane-title--with-controls {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(80px, 1fr);
  align-items: center;
  gap: 14px;
  min-height: 56px;
  padding: 7px 14px;
}

.pane-title.pane-title--with-controls > strong {
  justify-self: end;
}

.auto-order-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.auto-order-header-actions .button-primary {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
  white-space: nowrap;
}

.auto-order-add-button {
  display: inline-grid;
  width: 28px;
  min-width: 28px;
  height: 28px;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: #13a66f;
  color: #ffffff;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.auto-order-add-button:hover {
  background: #0f8f5f;
}

.auto-order-add-button:focus-visible {
  outline: 2px solid rgba(19, 166, 111, 0.35);
  outline-offset: 2px;
}

.auto-order-add-button:disabled {
  background: #a8b8b3;
  cursor: not-allowed;
  opacity: 0.72;
}

.auto-order-header-actions strong {
  font-weight: 400;
  min-width: 0;
  text-align: right;
  white-space: nowrap;
}

.auto-order-title-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: 0;
}

.auto-order-section-tabs {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-width: 0;
}

.auto-order-section-tab {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  background: #ffffff;
  color: var(--muted);
  font-weight: 700;
}

.auto-order-section-tab.is-active {
  border-color: rgba(23, 107, 95, 0.32);
  background: var(--surface-muted);
  color: var(--text);
}

.auto-order-calculation-toolbar {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 4px 14px;
  background: #fbfcfd;
}

.auto-order-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.auto-order-panel[data-auto-order-panel="documents"] {
  grid-template-rows: minmax(0, 1fr);
}

.auto-order-calculation-loader {
  display: grid;
  min-height: 0;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.loader-spinner {
  width: 38px;
  height: 38px;
  border: 4px solid #d9e5e9;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: loader-spin 0.8s linear infinite;
}

@keyframes loader-spin {
  to {
    transform: rotate(360deg);
  }
}

.compact-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: none;
}

.compact-check input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

.auto-order-distribution-mode {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.auto-order-distribution-mode select {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 8px;
  background: #ffffff;
  color: var(--text);
  font-size: 12px;
}

.auto-order-shell .groups-pane {
  display: flex;
  flex-direction: column;
}

.auto-order-shell .tree {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  position: relative;
  z-index: 1;
}

.tree--check .tree-row {
  grid-template-columns: 20px 18px 18px minmax(120px, 1fr) auto;
}

.tree--check .tree-row--product {
  grid-template-columns: 20px 18px minmax(120px, 1fr) auto;
}

.tree--check .tree-row--product .tree-row__folder {
  display: none;
}

.tree-row__check {
  width: 15px;
  min-height: 15px;
  accent-color: var(--accent);
}

.auto-order-table input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
  width: 100%;
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 7px;
  text-align: right;
}

.auto-order-table input[type="number"]::-webkit-inner-spin-button,
.auto-order-table input[type="number"]::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.auto-order-table tbody td:nth-child(n + 3),
.auto-order-table tfoot th:nth-child(n + 3) {
  text-align: right;
}

.auto-order-documents-table input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

.document-created-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: #0b7a43;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.auto-order-documents-table tbody tr {
  cursor: context-menu;
}

.auto-order-documents-table td:nth-child(3) {
  color: var(--text);
}

.auto-order-table tbody tr.auto-order-row--order td {
  background: #dff4e3;
}

.auto-order-table tbody tr.auto-order-row--not-order td {
  background: #ffe1e1;
}

.auto-order-table tbody tr.auto-order-row--order:hover td {
  background: #ccebd2;
}

.auto-order-table tbody tr.auto-order-row--not-order:hover td {
  background: #ffd0d0;
}

.auto-order-table tbody td.auto-order-cleanup-cell--active {
  background: #ffe88a;
  color: #3d3100;
  font-weight: 700;
}

.auto-order-table tbody td.auto-order-ordered-cell--active {
  background: rgba(223, 244, 227, 0.65);
  color: #124f38;
  font-weight: 700;
}

.auto-order-table tbody td.auto-order-quantity-cell--active input {
  background: rgba(223, 244, 227, 0.45);
  border-color: rgba(19, 166, 111, 0.42);
}

.auto-order-table .auto-order-result-cell--first {
  box-shadow: inset 2px 0 0 #10a866;
}

.auto-order-table .auto-order-result-cell--last {
  box-shadow: inset -2px 0 0 #10a866;
}

.auto-order-table thead tr:first-child .auto-order-result-cell {
  box-shadow: inset 0 2px 0 #10a866;
}

.auto-order-table thead tr:first-child .auto-order-result-cell--first {
  border-top-left-radius: 7px;
  box-shadow: inset 2px 0 0 #10a866, inset 0 2px 0 #10a866;
}

.auto-order-table thead tr:first-child .auto-order-result-cell--last {
  border-top-right-radius: 7px;
  box-shadow: inset -2px 0 0 #10a866, inset 0 2px 0 #10a866;
}

.auto-order-table tfoot .auto-order-result-cell {
  box-shadow: inset 0 -2px 0 #10a866;
}

.auto-order-table tfoot .auto-order-result-cell--first {
  border-bottom-left-radius: 7px;
  box-shadow: inset 2px 0 0 #10a866, inset 0 -2px 0 #10a866;
}

.auto-order-table tfoot .auto-order-result-cell--last {
  border-bottom-right-radius: 7px;
  box-shadow: inset -2px 0 0 #10a866, inset 0 -2px 0 #10a866;
}

.auto-order-table tbody tr.auto-order-row--order td.auto-order-cleanup-cell--active,
.auto-order-table tbody tr.auto-order-row--not-order td.auto-order-cleanup-cell--active,
.auto-order-table tbody tr:hover td.auto-order-cleanup-cell--active {
  background: #ffe15a;
}

.auto-order-table tbody tr.auto-order-row--order td.auto-order-ordered-cell--active,
.auto-order-table tbody tr.auto-order-row--not-order td.auto-order-ordered-cell--active,
.auto-order-table tbody tr:hover td.auto-order-ordered-cell--active {
  background: rgba(207, 238, 214, 0.9);
}

.auto-order-table tbody tr.auto-order-filtered-out {
  display: none;
}

.auto-order-table tfoot th {
  position: sticky;
  z-index: 1;
  bottom: 0;
  height: 34px;
  min-height: 34px;
  line-height: 34px;
  border-top: 1px solid var(--line);
  background: #eef3f5;
  color: var(--text);
}

.toolbar-check {
  display: inline-flex;
  min-height: 40px;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #ffffff;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.toolbar-check input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--accent);
}

.nomenclature-shell {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.data-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.groups-pane,
.items-pane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.groups-pane {
  border-right: 1px solid var(--line);
  background: #fbfcfd;
}

.pane-title {
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 0 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.pane-title strong {
  color: var(--text);
  font-size: 13px;
}

.auto-order-nomenclature-title {
  justify-content: flex-start;
  gap: 8px;
}

.auto-order-nomenclature-title .clear-selection-button {
  margin-left: auto;
}

.tree {
  height: 100%;
  min-height: 0;
  overflow: auto;
  padding: 8px;
}

.tree-loading {
  color: var(--muted);
  padding: 12px;
}

.tree-row {
  display: grid;
  grid-template-columns: 20px 18px minmax(120px, 1fr) auto;
  min-height: 30px;
  align-items: center;
  gap: 6px;
  border-radius: 4px;
  padding: 0 8px 0 calc(8px + var(--level) * 18px);
  color: var(--text);
  font-size: 13px;
  user-select: none;
}

.tree-row:hover,
.tree-row:has(.tree-row__toggle:hover) {
  background: var(--surface-muted);
}

.tree-row[aria-selected="true"] {
  background: #dcebe8;
  color: #0d453e;
}

.tree-row__folder {
  position: relative;
  width: 16px;
  height: 14px;
  color: #d99a22;
}

.tree-row__folder--folder::before {
  content: "";
  position: absolute;
  left: 1px;
  top: 4px;
  width: 14px;
  height: 9px;
  border: 1px solid #c98b18;
  border-radius: 2px;
  background: linear-gradient(180deg, #ffd66b 0%, #f3b43a 100%);
}

.tree-row__folder--folder::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 1px;
  width: 8px;
  height: 5px;
  border: 1px solid #c98b18;
  border-bottom: 0;
  border-radius: 2px 2px 0 0;
  background: #ffe18a;
}

.tree-row__toggle {
  display: grid;
  width: 20px;
  height: 24px;
  place-items: center;
  border: 0;
  border-radius: 4px;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
}

.tree-row__toggle:hover {
  background: rgba(23, 107, 95, 0.12);
  color: var(--accent);
}

.tree-row__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-row__count {
  color: var(--muted);
  font-size: 12px;
}

.table-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.table-wrap--full {
  height: 100%;
}

.items-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}

.items-table.auto-order-table {
  min-width: 0;
}

.items-table th,
.items-table td {
  height: 34px;
  border-bottom: 1px solid var(--line);
  padding: 0 12px;
  text-align: left;
  vertical-align: middle;
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.items-table th {
  position: sticky;
  z-index: 1;
  top: 0;
  background: #f7fafb;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.items-table.auto-order-table th {
  height: auto;
  min-height: 34px;
  line-height: 1.15;
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
  text-overflow: clip;
}

.items-table.auto-order-table thead tr:first-child th {
  text-align: center;
  vertical-align: middle;
  padding-top: 0;
  padding-bottom: 0;
}

.items-table.auto-order-table tfoot th {
  height: 34px;
  min-height: 34px;
  line-height: 34px;
  white-space: nowrap;
}

.items-table .table-filter-row th {
  top: 34px;
  padding: 4px 6px;
  background: #ffffff;
}

.column-filter {
  width: 100%;
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 7px;
  color: var(--text);
  font-size: 12px;
}

.sortable-header {
  cursor: pointer;
  position: sticky;
  user-select: none;
}

.sortable-header::after {
  content: "";
  margin-left: 6px;
  color: var(--muted);
}

.sortable-header[data-sort-direction="asc"]::after {
  content: "▲";
}

.sortable-header[data-sort-direction="desc"]::after {
  content: "▼";
}

.column-resizer {
  position: absolute;
  top: 0;
  right: -4px;
  bottom: 0;
  z-index: 3;
  width: 9px;
  cursor: col-resize;
  touch-action: none;
}

.column-resizer::before {
  content: "";
  position: absolute;
  top: 6px;
  right: 4px;
  bottom: 6px;
  width: 2px;
  border-radius: 2px;
  background: #b8c8d0;
}

.column-resizer:hover {
  background: rgba(23, 107, 95, 0.08);
}

.column-resizer:hover::before {
  background: var(--accent);
}

.items-table tr.filtered-out {
  display: none;
}

.items-table .column-hidden,
.items-table col.column-hidden {
  display: none;
}

.items-table td:nth-child(2) {
  white-space: nowrap;
}

.items-table:not(.auto-order-table) td:nth-child(3) {
  color: var(--muted);
}

.auto-order-table tfoot th {
  text-align: right;
}

.auto-order-table tfoot th:first-child {
  text-align: left;
}

.items-table.auto-order-documents-table td:nth-child(3) {
  color: var(--text);
}

.items-table tbody tr.is-deleted {
  color: var(--muted);
  text-decoration: line-through;
}

.items-table tbody tr.is-archived {
  color: var(--muted);
}

.items-table tbody tr:hover {
  background: #f7fafb;
}

.picker-row {
  cursor: pointer;
}

.picker-row:hover {
  background: #dcebe8 !important;
}

.auto-order-product-picker__panel {
  width: min(1120px, 100%);
}

.auto-order-product-picker__tools {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.auto-order-product-picker__tools #confirmAutoOrderProductPickerButton {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  width: max-content;
}

.auto-order-product-picker__tools #showAutoOrderProductPickerStocksButton {
  grid-column: 1 / -1;
  grid-row: 2;
  justify-self: end;
  width: max-content;
}

.auto-order-product-picker__body {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.auto-order-product-picker__groups {
  display: flex;
  min-height: 0;
  flex-direction: column;
  border-right: 1px solid var(--line);
}

.auto-order-product-picker__groups .tree {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
}

.auto-order-product-picker__items {
  border: 0;
  border-radius: 0;
}

.auto-order-product-picker__row td:first-child {
  text-align: center;
}

.auto-order-product-picker__row input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

.auto-order-product-picker__row input[type="number"] {
  box-sizing: border-box;
  min-width: 84px;
  width: 100%;
}

.auto-order-product-picker__row.is-selected td {
  background: #e5f4ec;
}

.empty-state {
  display: grid;
  min-height: 180px;
  place-items: center;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.modal {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  width: 100vw;
  height: 100dvh;
  place-items: center;
  overflow: hidden;
  padding: 16px;
  background: rgba(23, 32, 38, 0.32);
}

#autoOrderDocumentModal {
  z-index: 25;
}

.modal__panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: min(980px, 100%);
  height: calc(100dvh - 32px);
  max-height: 720px;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

.modal__head h2 {
  margin-top: 4px;
  font-size: 20px;
}

.context-menu {
  position: fixed;
  z-index: 30;
  min-width: 132px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.context-menu button {
  width: 100%;
  min-height: 28px;
  border: 0;
  border-radius: 4px;
  padding: 0 8px;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 400;
  text-align: left;
}

.context-menu button:hover {
  background: #eef8f5;
  color: var(--accent);
}

.table-columns-modal__panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(560px, calc(100vw - 32px));
  max-height: min(720px, calc(100dvh - 32px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.table-columns-modal__body {
  min-height: 0;
  overflow: auto;
  padding: 12px 16px;
}

.table-columns-list {
  display: grid;
  gap: 8px;
}

.table-columns-row {
  display: block;
  align-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  background: #ffffff;
  cursor: grab;
  transition: border-color 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

.table-columns-row.is-dragging {
  opacity: 0.55;
  cursor: grabbing;
}

.table-columns-row.is-drag-over {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.table-columns-row__label {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  cursor: grab;
}

.table-columns-row__drag {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  letter-spacing: 0;
  user-select: none;
}

.table-columns-row__label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-columns-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 12px 16px;
}

.auto-order-drill-cell {
  cursor: context-menu;
}

.document-detail-row {
  cursor: context-menu;
}

.auto-order-drill-cell:hover {
  background: #eef8f5;
  color: var(--accent);
}

.daily-modal__panel {
  display: grid;
  grid-template-rows: auto minmax(280px, 1fr) minmax(120px, 220px);
  width: min(980px, 100%);
  height: calc(100dvh - 32px);
  max-height: 760px;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.document-modal__panel {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  width: min(1060px, 100%);
  height: calc(100dvh - 32px);
  max-height: 760px;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.document-modal__subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.document-head {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
  background: #fbfcfd;
}

.document-head--transfer {
  background: #f6fbf9;
}

.document-head div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.document-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.document-head strong {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#previewDocumentOrganization {
  color: var(--text);
}

.document-table-wrap {
  min-height: 0;
}

.daily-modal__subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.daily-chart {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  padding: 12px 16px;
  background: #fbfcfd;
}

.daily-chart__legend {
  display: flex;
  justify-content: flex-end;
  gap: 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: 999px;
}

.legend-dot--sales {
  background: #168d7c;
}

.legend-dot--stock {
  background: #b6243a;
}

#dailyMovementChart {
  width: 100%;
  height: 100%;
  min-height: 260px;
}

.chart-value {
  fill: #1d3440;
  font-size: 10px;
  font-weight: 700;
}

.chart-axis-label {
  fill: #697780;
  font-size: 10px;
}

.daily-table-wrap {
  min-height: 0;
  border-top: 1px solid var(--line);
}

.modal__tools {
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
}

.modal__tools input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
}

.confirm-modal__panel {
  display: grid;
  width: min(420px, 100%);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.confirm-modal__head,
.confirm-modal__body,
.confirm-modal__actions {
  padding: 16px;
}

.confirm-modal__head {
  border-bottom: 1px solid var(--line);
}

.confirm-modal__head h2 {
  margin-top: 4px;
  font-size: 20px;
}

.confirm-modal__body {
  color: var(--text);
  line-height: 1.45;
}

.confirm-modal__field {
  display: grid;
  gap: 8px;
}

.confirm-modal__field input {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  font: inherit;
}

.confirm-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--line);
}

.calculation-details__panel {
  width: min(760px, calc(100vw - 32px));
}

.calculation-details {
  display: grid;
  gap: 0;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.calculation-details__row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(140px, auto);
  align-items: center;
  min-height: 34px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.calculation-details__row:nth-child(even) {
  background: #fbfcfd;
}

.calculation-details__row span,
.calculation-details__formula span {
  padding: 8px 12px;
  color: var(--muted);
  font-size: 13px;
}

.calculation-details__row strong {
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  border-left: 1px solid var(--line);
  padding: 8px 12px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
}

.calculation-details__formula {
  display: grid;
  gap: 8px;
  padding-bottom: 12px;
  background: #f4faf8;
}

.calculation-details__formula strong,
.calculation-details__formula code {
  margin: 0 12px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

.calculation-details__formula code {
  display: block;
  border: 1px solid #b9d8d1;
  border-radius: 6px;
  background: #fff;
  padding: 10px 12px;
  font-family: inherit;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.picker-table-wrap {
  height: 100%;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

@media (max-width: 760px) {
  .topbar {
    overflow-x: auto;
  }

  .top-nav {
    flex: 0 0 auto;
  }

  .topbar-brand span {
    display: none;
  }

  .user-menu {
    flex: 0 0 auto;
  }

  .nav-submenu {
    top: calc(100% + 8px);
    left: 0;
  }

  .wizard-head,
  .toolbar {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .sync-status {
    grid-column: 1;
    text-align: left;
  }

  .nomenclature-shell {
    grid-template-columns: 1fr;
  }

  .groups-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .tree,
  .table-wrap {
    height: 360px;
  }
}

/* Ссылка «База знаний» (/wiki) в шапке — оформлена как второстепенная кнопка */
.wiki-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.wiki-link svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

@media (max-width: 720px) {
  /* на телефоне остаётся только иконка-книга */
  .wiki-link span {
    display: none;
  }
}

/* Подпись под полем: срок оплаты рядом с выбором договора.
   Оператор выбирает договор из нескольких, и отсрочка — единственное,
   что отличает их по существу. */
.field-hint {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

.field-hint.field-hint--unknown {
  font-style: italic;
}
