:root {
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  color: #243248;
  background: #f5f6f8;
  --orange: #e45724;
  --line: #dee3ea;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
header {
  padding: 20px max(20px, calc((100vw - 1150px) / 2));
  display: flex;
  justify-content: space-between;
  gap: 20px;
  background: white;
  border-bottom: 1px solid var(--line);
}
a {
  color: #9e3915;
  text-decoration: none;
}
main {
  max-width: 1150px;
  margin: auto;
  padding: 30px 22px;
}
h1 {
  font-size: 32px;
  letter-spacing: -1px;
  margin: 5px 0 12px;
}
h2 {
  font-size: 22px;
}
p {
  line-height: 1.5;
}
.heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 2px;
  color: #7e8998;
}
.toolbar {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 20px;
  margin: 24px 0;
}
.toolbar span {
  font-size: 12px;
}
nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 24px 0;
}
button,
select,
input,
textarea {
  font: inherit;
}
button {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px 16px;
  background: white;
  color: inherit;
  cursor: pointer;
}
button:hover {
  border-color: #a1aab7;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
button.primary,
nav button.active {
  background: var(--orange);
  border-color: var(--orange);
  color: white;
}
section,
.card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
}
label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 13px;
}
input,
textarea,
select {
  border: 1px solid #cad1db;
  border-radius: 7px;
  padding: 11px;
  background: #fff;
  color: inherit;
  width: 100%;
}
textarea {
  min-height: 80px;
  resize: vertical;
}
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.full {
  grid-column: 1/-1;
}
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 20px 0;
}
.candidate {
  padding: 16px;
  margin: 16px 0;
  background: #f5f7fa;
  border-radius: 10px;
}
.candidate p {
  font-size: 13px;
  margin: 7px 0;
}
.check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.check input {
  width: auto;
}
.scenarios {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.amount {
  font-size: 26px;
  font-weight: 650;
}
.muted {
  color: #687485;
  font-size: 13px;
}
.warning {
  color: #8b4219;
  background: #fff1dc;
  padding: 12px;
  border-radius: 8px;
  overflow-wrap: anywhere;
}
.badge {
  padding: 5px 9px;
  border-radius: 5px;
  background: #e8f4ee;
  color: #216447;
  font-size: 12px;
}
.badge.bad {
  background: #fff1dc;
  color: #8b4219;
}
.cost {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid #eee;
  font-size: 13px;
}
.selected {
  border: 2px solid var(--orange);
}
footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin: 24px 0;
}
#notice:not(:empty) {
  padding: 15px;
  border-radius: 8px;
  background: #fff1dc;
  margin: 18px 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
details {
  margin-top: 18px;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}
td,
th {
  padding: 8px;
  text-align: left;
  border-bottom: 1px solid #ddd;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid #2d6ac7;
  outline-offset: 3px;
}
@media (max-width: 600px) {
  main {
    padding: 20px 12px;
  }
  header {
    padding: 16px 12px;
    font-size: 12px;
    flex-wrap: wrap;
  }
  h1 {
    font-size: 27px;
  }
  .heading {
    display: block;
  }
  .heading button {
    margin-top: 10px;
  }
  nav {
    grid-template-columns: repeat(2, 1fr);
  }
  nav button {
    font-size: 13px;
    padding: 12px 6px;
  }
  .grid,
  .scenarios {
    grid-template-columns: 1fr;
  }
  section,
  .card {
    padding: 16px;
  }
  footer {
    flex-wrap: wrap;
  }
  footer button {
    flex: 1;
  }
  input,
  textarea,
  select {
    font-size: 16px;
  }
}

.product-suggestions { position: relative; min-width: 0; }
.dictionary-options { position: absolute; top: 100%; left: 0; right: 0; z-index: 20; max-height: 320px; overflow-y: auto; background: white; border: 1px solid #cbd5e1; border-radius: 12px; box-shadow: 0 8px 24px #17233a20; padding: 6px; }
.dictionary-options [role="option"] { padding: 10px; cursor: pointer; border-radius: 6px; overflow-wrap: anywhere; }
.dictionary-options [role="option"]:hover, .dictionary-options [aria-selected="true"] { background: #fff0e8; }
.dictionary-options small { display: block; color: #64748b; margin-top: 4px; }

input[name="import_product_title"]::-webkit-contacts-auto-fill-button { visibility: hidden; display: none !important; pointer-events: none; }
.saved-picker { position: relative; min-width: 240px; max-width: 100%; }
#saved-trigger { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; margin-top: 6px; text-align: left; }
#saved-options { position: absolute; top: 100%; left: 0; right: 0; z-index: 40; padding: 6px; max-height: 320px; overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px #17233a20; }
#saved-options button { display: block; width: 100%; text-align: left; border: 0; overflow-wrap: anywhere; }
#saved-options button:hover, #saved-options button:focus, #saved-options [aria-selected="true"] { background: #fff0e8; color: #b63c12; }
#saved-options p { padding: 10px; color: #64748b; margin: 0; }
[hidden] { display: none !important; }

.custom-select { position: relative; min-width: 0; }
.custom-select > button { width: 100%; text-align: left; }
.custom-select-options { position: absolute; top: 100%; left: 0; right: 0; z-index: 35; max-height: 300px; overflow: auto; padding: 6px; background: white; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px #17233a20; }
.custom-select-options button { width: 100%; display: block; text-align: left; border: 0; }
.custom-select-options button:focus, .custom-select-options button:hover, .custom-select-options [aria-selected="true"] { background: #fff0e8; }

.composition-editor h3 { margin: 0 0 12px; font-size: 1rem; font-weight: 500; }
.composition-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px auto; align-items: end; gap: 12px; margin-bottom: 12px; }
@media (max-width: 600px) { .composition-row { grid-template-columns: minmax(0, 1fr) 90px; } .composition-row > button { grid-column: 1 / -1; justify-self: end; } }

/* Product form: clear hierarchy without nested cards or technical metadata. */
.item-picker { margin-bottom: 24px; }
.composition-editor { padding: 20px 0; border: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; }
.composition-editor h3 { margin-bottom: 6px; font-weight: 650; }
.composition-hint { margin: 0 0 18px; color: #738095; font-size: 13px; }
.composition-row { grid-template-columns: minmax(0, 1fr) 140px 44px; gap: 12px; }
.composition-row .remove-material { padding: 0; height: 44px; width: 44px; font-size: 24px; color: #8792a3; border-color: transparent; background: transparent; }
.composition-row .remove-material:hover { color: #b63c12; background: #fff0e8; }
.composition-row [data-percent] { appearance: textfield; -moz-appearance: textfield; }
.composition-row [data-percent]::-webkit-inner-spin-button, .composition-row [data-percent]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
#composition-add { border-style: dashed; color: #b63c12; font-size: 13px; }
#composition-total { margin: 12px 0 0; font-size: 13px; }
.toolbar { align-items: center; gap: 12px; }
.saved-picker { width: min(100%, 540px); }
#saved-caption { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#calc-state { padding: 6px 12px; border-radius: 20px; background: #edf1f6; color: #596b80; }
#identity { display: none; }
@media (max-width: 600px) {
  .composition-row { grid-template-columns: minmax(0, 1fr) 96px 36px; gap: 6px; }
  .composition-row > .remove-material { grid-column: auto; width: 36px; }
  .composition-row label { font-size: 12px; }
  .composition-editor { padding: 16px 0; }
}

.toolbar { align-items: flex-end; }
#saved-trigger { min-height: 46px; padding: 10px 14px; line-height: 24px; }
.saved-chevron { display: block; flex: 0 0 20px; color: #65758b; transition: transform 150ms ease; }
#saved-trigger[aria-expanded="true"] .saved-chevron { transform: rotate(180deg); }
#calc-state { align-self: flex-end; margin-bottom: 9px; }

.import-brand-header { align-items: center; gap: 24px; }
.import-brand-header a, .import-brand-title { color: #11182b; font-weight: 800; letter-spacing: -.018em; line-height: 1.2; }
.import-brand-home { display: inline-flex; align-items: center; gap: 10px; flex-shrink: 0; font-size: 26px; }
.import-brand-back { font-size: 20px; color: #65758b; }
.import-brand-title { flex: 1; text-align: center; font-size: 19px; }
.import-brand-directory { flex-shrink: 0; font-size: 20px; }
.import-brand-header .import-brand-accent { background: linear-gradient(100deg, #4966ff 0%, #7454ff 65%, #a16aff 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.import-brand-header a:focus-visible { outline: 2px solid #7454ff; outline-offset: 5px; border-radius: 4px; }
@media (max-width: 800px) {
  .import-brand-header { flex-wrap: wrap; gap: 14px; }
  .import-brand-title { order: 3; flex-basis: 100%; text-align: left; font-size: 17px; }
  .import-brand-directory { margin-left: auto; font-size: 18px; }
  .import-brand-home { font-size: 24px; }
}

.import-admin-page #file { padding: 14px; background: #f8f9fc; border-style: dashed; }
.import-admin-page #file::file-selector-button { font: inherit; font-weight: 650; border: 1px solid #ddd8ff; border-radius: 8px; padding: 9px 14px; margin-right: 12px; color: #6545d8; background: #eeeaff; cursor: pointer; }
.import-admin-page #versions:empty::before { content: "Справочники пока не загружены"; color: #738095; font-size: 14px; }
@media(max-width: 600px) { .import-admin-page .import-brand-home { font-size: 20px; } }
