:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-2: #f8fbff;
  --line: #d7e0ea;
  --line-strong: #bfccd9;
  --text: #17324d;
  --muted: #6d8196;
  --brand: #0f8df5;
  --brand-dark: #0b6bc7;
  --success: #12715b;
  --danger: #c84343;
  --shadow: 0 18px 50px rgba(23, 50, 77, 0.08);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(15, 141, 245, 0.12), transparent 32%),
    linear-gradient(180deg, #f7fbff 0%, var(--bg) 100%);
  color: var(--text);
}

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

.shell {
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px;
}

.hero,
.install-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 251, 255, 0.95));
  border: 1px solid rgba(191, 204, 217, 0.7);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.hero {
  padding: 22px 22px 18px;
}

.hero-top {
  display: grid;
  grid-template-columns: minmax(280px, 1.1fr) minmax(540px, 0.95fr);
  gap: 20px;
  align-items: start;
  margin-bottom: 16px;
}

.hero-intro {
  min-width: 0;
}

.hero-actions {
  min-width: 0;
}

.hero-feedback {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 141, 245, 0.1);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero h1,
.install-card h1 {
  margin: 4px 0 0;
  font-size: clamp(28px, 3.1vw, 38px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  max-width: 420px;
}

.hero p,
.install-card p {
  margin: 0;
  color: var(--muted);
  max-width: 820px;
  line-height: 1.5;
}

.hero-hint {
  margin-top: 10px;
  max-width: 460px;
  font-size: 15px;
}

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

.button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  min-height: 56px;
  padding: 11px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    background 120ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button.primary {
  background: linear-gradient(180deg, var(--brand), var(--brand-dark));
  color: #fff;
}

.button.secondary {
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}

.button.action-bitrix {
  background: linear-gradient(180deg, rgba(15, 141, 245, 0.12), rgba(15, 141, 245, 0.05));
  border-color: rgba(15, 141, 245, 0.28);
  color: var(--brand-dark);
}

.button.action-excel {
  background: linear-gradient(180deg, rgba(22, 163, 74, 0.12), rgba(22, 163, 74, 0.05));
  border-color: rgba(22, 163, 74, 0.28);
  color: #177245;
}

.button.action-approval {
  background: linear-gradient(180deg, rgba(124, 58, 237, 0.15), rgba(124, 58, 237, 0.07));
  border-color: rgba(124, 58, 237, 0.35);
  color: #5b21b6;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  color: var(--muted);
  font-weight: 600;
}

.status.ok {
  color: var(--success);
  border-color: rgba(18, 113, 91, 0.22);
  background: rgba(18, 113, 91, 0.08);
}

.status.error {
  color: var(--danger);
  border-color: rgba(200, 67, 67, 0.2);
  background: rgba(200, 67, 67, 0.08);
}

.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.stat {
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid rgba(215, 224, 234, 0.8);
}

.stat-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.stat-value {
  margin-top: 8px;
  font-size: 24px;
  font-weight: 700;
}

.card {
  margin-top: 18px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(191, 204, 217, 0.7);
  border-radius: 22px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.approval-banner {
  margin-top: 18px;
  padding: 20px 22px;
  border-color: rgba(242, 165, 54, 0.32);
  background: linear-gradient(180deg, rgba(255, 249, 238, 0.98), rgba(255, 244, 224, 0.95));
}

.approval-banner-head h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.approval-banner-head p {
  margin: 0;
  color: #8a5a12;
}

.approval-summary,
.approval-removed {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(242, 165, 54, 0.22);
  background: rgba(255, 255, 255, 0.72);
}

.approval-summary-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8a5a12;
}

.approval-summary-text {
  margin: 10px 0 0;
  white-space: pre-wrap;
  font: inherit;
  line-height: 1.5;
  color: var(--text);
}

.approval-removed-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.approval-removed-item strong {
  display: block;
  margin-bottom: 6px;
}

.approval-removed-item ul,
.group-approval-list {
  margin: 0;
  padding-left: 18px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(215, 224, 234, 0.9);
}

.card-head h2 {
  margin: 0;
  font-size: 20px;
}

.card-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

.hint-box {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(15, 141, 245, 0.07);
  border: 1px solid rgba(15, 141, 245, 0.14);
  color: var(--text);
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid #e5edf5;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(180deg, #fdfefe, #f2f7fc);
  text-align: left;
  font-size: 13px;
  color: var(--muted);
}

tbody tr:nth-child(odd) {
  background: rgba(248, 251, 255, 0.55);
}

.product-cell {
  min-width: 260px;
}

.cell-number {
  width: 48px;
  text-align: center;
  font-weight: 700;
}

.cell-merged {
  vertical-align: top;
  background: rgba(247, 251, 255, 0.95);
}

.request-table td:nth-child(7),
.request-table td:nth-child(11) {
  white-space: nowrap;
}

.product-title {
  font-weight: 700;
}

.product-meta {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.money,
.qty {
  white-space: nowrap;
}

.field {
  width: 100%;
  min-width: 100px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: #fff;
  outline: none;
}

.field:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 141, 245, 0.14);
}

textarea.field {
  min-height: 92px;
  resize: vertical;
}

.field-compact {
  min-width: 78px;
}

.field-group {
  min-width: 120px;
}

.field-group-textarea {
  min-width: 190px;
  min-height: 96px;
}

.cell-note {
  min-width: 210px;
}

.cell-deliveryPlace,
.cell-stockCode {
  min-width: 130px;
}

.subtotal-row td {
  background: linear-gradient(180deg, rgba(15, 141, 245, 0.08), rgba(15, 141, 245, 0.02));
  font-weight: 700;
}

.request-group {
  padding: 0;
  overflow: hidden;
}

.group-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 12px;
  border-bottom: 1px solid rgba(215, 224, 234, 0.9);
}

.request-group-pending {
  border-color: rgba(242, 165, 54, 0.35);
  box-shadow: 0 18px 50px rgba(242, 165, 54, 0.12);
}

.group-approval-box {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(242, 165, 54, 0.24);
  background: linear-gradient(180deg, rgba(255, 250, 240, 0.95), rgba(255, 245, 228, 0.92));
}

.group-approval-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(242, 165, 54, 0.16);
  color: #9a5e06;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.group-approval-list {
  margin-top: 10px;
  color: #6f4a12;
  line-height: 1.45;
}

.group-head h2 {
  margin: 8px 0 6px;
  font-size: 28px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.group-head p {
  margin: 0;
  color: var(--muted);
}

.group-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-start;
}

.button.danger,
.mini-button.danger {
  background: linear-gradient(180deg, rgba(200, 67, 67, 0.08), rgba(200, 67, 67, 0.03));
  border-color: rgba(200, 67, 67, 0.25);
  color: var(--danger);
}

.group-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding: 18px 22px;
}

.variant-toggles {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding: 0 22px 18px;
}

.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(15, 141, 245, 0.18);
  background: rgba(15, 141, 245, 0.06);
  color: var(--text);
  cursor: pointer;
}

.toggle-chip input {
  margin: 0;
}

.editor-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.editor-field span {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

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

.customer-field-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.customer-create-button {
  min-height: 52px;
  white-space: nowrap;
}

.note-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.note-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.variant-table-wrap {
  padding: 0 22px 18px;
  overflow: auto;
}

.variant-table {
  min-width: 920px;
}

.variant-table label {
  display: block;
}

.variant-table .field {
  min-width: 0;
}

.variant-table tfoot td {
  font-weight: 700;
  background: rgba(15, 141, 245, 0.06);
}

.variant-footer-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 12px;
}

.mini-button {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.row-actions {
  width: 1%;
  white-space: nowrap;
}

.mini-button[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}

.row-actions .mini-button {
  padding: 6px 9px;
  gap: 4px;
}

.multi-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.multi-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(15, 141, 245, 0.18);
  background: rgba(15, 141, 245, 0.05);
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.multi-chip.is-on {
  border-color: rgba(15, 141, 245, 0.55);
  background: rgba(15, 141, 245, 0.16);
  font-weight: 600;
}

.multi-chip input {
  margin: 0;
}

.qty-stepper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.qty-stepper .field {
  text-align: center;
  min-width: 56px;
}

.qty-btn {
  appearance: none;
  flex: 0 0 auto;
  width: 30px;
  height: 34px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 9px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.qty-btn:hover {
  background: rgba(15, 141, 245, 0.08);
  border-color: rgba(15, 141, 245, 0.4);
}

.qty-btn:active {
  transform: scale(0.94);
}

.drag-cell {
  white-space: nowrap;
}

.drag-handle {
  cursor: grab;
  color: var(--muted, #8aa0b8);
  font-size: 16px;
  margin-right: 6px;
  user-select: none;
}

.drag-handle:active {
  cursor: grabbing;
}

.variant-table tr.dragging {
  opacity: 0.45;
}

.variant-table tr.drag-over td {
  border-top: 2px solid var(--accent, #0f8df5);
  background: rgba(15, 141, 245, 0.06);
}

.group-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  padding: 0 22px 22px;
}

.bottom-actions {
  display: flex;
  justify-content: center;
  padding: 6px 0 28px;
}

.group-total {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(15, 141, 245, 0.08);
  color: var(--text);
}

.icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
  flex: 0 0 auto;
}

.icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.button .icon,
.mini-button .icon {
  width: 16px;
  height: 16px;
}

.button .icon svg,
.mini-button .icon svg {
  width: 16px;
  height: 16px;
}

.empty {
  padding: 40px 24px;
  text-align: center;
  color: var(--muted);
}

.install-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.install-card {
  width: min(760px, 100%);
  padding: 28px;
}

.install-log {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #0f1720;
  color: #d9e4f0;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  min-height: 120px;
  white-space: pre-wrap;
}

@media (max-width: 900px) {
  .shell {
    padding: 14px;
  }

  .hero,
  .card {
    border-radius: 18px;
  }

  .hero-top,
  .card-head,
  .group-head {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar {
    width: 100%;
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 1280px) {
  .hero-top {
    grid-template-columns: 1fr;
  }

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

  .hero h1 {
    max-width: none;
  }
}
