:root {
  --ink: #28211c;
  --muted: #776c60;
  --paper: #f7f1e7;
  --panel: #fffdf8;
  --line: #d9cbb8;
  --accent: #bd3e21;
  --accent-dark: #8e2714;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: radial-gradient(circle at top right, #f1d9a9 0, transparent 32rem), var(--paper);
  font-family: Georgia, "Times New Roman", serif;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 64px;
}

.masthead {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 3px solid var(--ink);
}

.brand-logo {
  display: block;
  width: min(112px, 30vw);
  max-inline-size: 100%;
  height: auto;
  margin-bottom: 12px;
}

.masthead-row {
  display: flex;
  gap: 24px;
  align-items: end;
  justify-content: space-between;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font: 700 0.75rem/1.2 ui-monospace, monospace;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2.25rem, 6vw, 4.5rem);
  line-height: 0.95;
  letter-spacing: -0.055em;
}

.version {
  margin: 0;
  color: var(--muted);
  font-weight: bold;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.04fr);
  gap: 24px;
}
.quick-cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-top: 20px; }
.quick-card img { display: block; height: 220px; margin: 0 auto; max-width: 100%; object-fit: contain; }

.panel,
.notice {
  padding: clamp(22px, 4vw, 38px);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 8px 8px 0 rgb(40 33 28 / 8%);
}

.panel h2 {
  margin-bottom: 24px;
  font-size: 1.65rem;
}

form {
  display: grid;
  gap: 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.form-grid > .full-width {
  grid-column: 1 / -1;
}

.field {
  display: grid;
  gap: 8px;
}

.field label,
legend {
  font-weight: bold;
}

.field span {
  color: var(--muted);
  font-size: 0.85em;
  font-weight: normal;
}

input,
select,
button {
  min-height: 48px;
  border-radius: 0;
  font: inherit;
}

input,
select {
  width: 100%;
  padding: 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #a99985;
}

input:focus,
select:focus {
  outline: 3px solid #f1ba54;
  outline-offset: 2px;
  border-color: var(--accent);
}

fieldset {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
}

.opening-row {
  gap: 16px;
}

.catalog-tree, .catalog-results, .selected-door {
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid var(--line);
}

.door-list {
  display: grid;
  gap: .5rem;
  max-height: 26rem;
  overflow: auto;
}

.door-list[hidden] { display: none; }

.door-choice {
  display: grid;
  gap: .2rem;
  padding: .75rem;
  border: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}

.door-choice button {
  display: grid;
  min-height: 0;
  gap: .2rem;
  padding: 0;
  color: inherit;
  text-align: left;
  background: transparent;
  box-shadow: none;
}

.door-choice img,
.door-image-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: #f1ede6;
}

.door-image-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.door-choice small { color: var(--muted); }

.door-choice button:hover {
  color: inherit;
  background: transparent;
}

.door-choice:hover, .door-choice:focus-visible, .door-choice.selected {
  border-color: var(--accent);
  outline: none;
}

.door-choice span { color: var(--muted); }

.cart-summary {
  margin: 0 0 22px;
  padding: 16px;
  border: 1px solid var(--line);
}

.cart-summary h3 { margin: 0 0 12px; }
.cart-summary ol { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.cart-summary li { display: grid; grid-template-columns: 76px 1fr; gap: 12px; }
.cart-summary img, .cart-summary .door-image-placeholder { width: 76px; height: 58px; object-fit: contain; }
.cart-summary strong, .cart-summary span { display: block; }
.cart-summary span { color: var(--muted); }
.cart-opening { display: grid; gap: 4px; margin: 8px 0 0; }
.cart-opening div { display: flex; flex-wrap: wrap; gap: 4px; }
.cart-opening dt { font-weight: bold; }
.cart-opening dd { margin: 0; color: var(--muted); }
.cart-actions { display: flex; gap: 6px; margin-top: 8px; }
.cart-actions button { width: auto; padding: 5px 9px; }

.compatibility-card {
  display: grid;
  gap: .6rem;
  margin: 1rem 0;
}

.compatibility-card div { display: grid; gap: .15rem; }
.compatibility-card dt { color: var(--muted); font-weight: bold; }
.compatibility-card dd { margin: 0; }

.count-field button {
  width: fit-content;
}

.quantity-control {
  display: grid;
  grid-template-columns: 1fr auto minmax(5rem, 7rem) auto;
  gap: 8px;
  align-items: end;
}

.quantity-control label {
  grid-column: 1 / -1;
  font-weight: bold;
}

.opening-schemes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.opening-schemes figure {
  margin: 0;
  padding: 8px;
  border: 1px solid var(--line);
}

.opening-schemes img {
  display: block;
  width: 100%;
  height: auto;
}

.opening-schemes figcaption {
  margin-top: 6px;
  font-size: .85rem;
  font-weight: bold;
}

.opening-result {
  margin: 0 0 22px;
  padding-left: 20px;
}

.check {
  display: flex;
  gap: 10px;
  align-items: center;
}

.check input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

button {
  padding: 10px 18px;
  color: white;
  font-weight: bold;
  cursor: pointer;
  background: var(--accent);
  border: 0;
  box-shadow: 4px 4px 0 var(--accent-dark);
}

button:hover {
  background: var(--accent-dark);
}

.notice {
  margin-bottom: 24px;
}

.error {
  margin: 0 0 18px;
  padding: 12px;
  background: #fbe8e0;
  border-left: 4px solid var(--accent);
}

.unavailable {
  max-width: 680px;
}

.total {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin: 0 0 22px;
  padding: 18px 0;
  border-block: 1px solid var(--line);
}

.total span {
  color: var(--muted);
}

.total strong {
  color: var(--accent);
  font-size: clamp(1.75rem, 4vw, 2.7rem);
  line-height: 1;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 8px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

th {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
}

small {
  display: block;
  margin-top: 4px;
  color: var(--accent);
}

details {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

summary {
  font-weight: bold;
  cursor: pointer;
}

.trace {
  margin-top: 16px;
  padding: 14px;
  background: #f8f2e9;
}

.trace h3 {
  margin-bottom: 6px;
}

.trace p {
  color: var(--muted);
}

dl {
  margin: 0;
}

dl div {
  margin-top: 8px;
}

dt {
  font-weight: bold;
}

dd {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.empty-state {
  max-width: 28ch;
  margin: 48px 0;
  color: var(--muted);
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 24px, 640px);
    padding-top: 28px;
  }

  .masthead-row,
  .workspace {
    display: grid;
  }

  .workspace,
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .quantity-control,
  .opening-schemes {
    grid-template-columns: minmax(0, 1fr);
  }

  .workspace > * {
    min-width: 0;
  }

  .masthead-row {
    gap: 12px;
  }

  .panel,
  .notice {
    padding: 22px;
    box-shadow: 5px 5px 0 rgb(40 33 28 / 8%);
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  thead {
    display: none;
  }

  tr {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }

  td {
    padding: 3px 0;
    border: 0;
  }

  td:not(:first-child)::before {
    display: inline-block;
    width: 8rem;
    color: var(--muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    content: attr(data-label);
  }
}

.leaf-color-surface { min-width: 0; }
.leaf-color-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 5.5rem), 1fr)); gap: 8px; }
.leaf-color-option { display: grid; align-content: start; gap: 4px; min-width: 0; min-height: 44px; padding: 8px; border: 2px solid var(--line); border-radius: 4px; cursor: pointer; overflow-wrap: anywhere; }
.leaf-color-option input { width: 16px; height: 16px; min-height: 16px; margin: 0; padding: 0; accent-color: var(--navy); }
.leaf-color-option img { width: 100%; height: 56px; object-fit: contain; }
.leaf-color-option:has(input:checked) { border-color: var(--navy); }
.leaf-color-option:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.leaf-color-option:has(input:disabled) { cursor: not-allowed; color: var(--muted); }
.leaf-color-selected { visibility: hidden; }
.leaf-color-option:has(input:checked) .leaf-color-selected { visibility: visible; }
.leaf-color-surface:not(:has(input[data-custom-system]:not([data-custom-system=""]):checked)) .leaf-custom-code { display: none; }

/* Reshenie product theme: shared presentation only. */
:root {
  --ink: #333;
  --muted: #66707a;
  --paper: #f8f9fa;
  --panel: #fff;
  --line: #e9e9e9;
  --accent: #ffc60a;
  --accent-dark: #e5af00;
  --navy: #122538;
  --error: #b42318;
  --error-bg: #fff4f2;
  --focus: #245f9f;
}

body {
  min-width: 0;
  background: var(--paper);
  font-family: Montserrat, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

.page-shell {
  width: min(1170px, calc(100% - 32px));
  padding: 32px 0 48px;
}

.masthead {
  margin-bottom: 24px;
  padding: 16px 20px;
  color: #fff;
  background: var(--navy);
  border: 0;
  border-radius: 8px;
}

.masthead .brand-logo { margin-bottom: 8px; }
.masthead-primary { display: flex; gap: 20px; align-items: center; }
.masthead-title { min-width: 0; }
.masthead .brand-logo--masthead { width: min(340px, 44vw); height: auto; margin: 0; color: #fff; flex: 0 1 340px; }
.masthead-row { display: flex; gap: 12px 20px; align-items: center; flex-wrap: wrap; }
.masthead-primary + .masthead-row { margin-top: 14px; }
.masthead h1 { color: #fff; }
.masthead a { color: #fff; }
.masthead .version { color: #d6dde3; }
.masthead .manager-name { max-width: 100%; min-width: 0; margin: 0; overflow-wrap: anywhere; color: #fff; font-weight: 700; }
.masthead-links { display: flex; gap: 12px 20px; flex-wrap: wrap; }
.brand-logo { width: min(132px, 40vw); }
.eyebrow,
.panel-kicker { color: #8a6500; font: 600 12px/16px inherit; letter-spacing: .06em; }
.masthead .eyebrow { color: #ffe290; }

h1,
h2,
h3 { color: var(--ink); }
h1 { margin-bottom: 16px; font-size: 32px; line-height: 1.15; letter-spacing: -.02em; }
h2 { font-size: 24px; line-height: 1.25; }
h3 { font-size: 18px; line-height: 1.35; }

.workspace { gap: 24px; }
.panel,
.notice {
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: none;
}

.panel h2 { margin: 0 0 16px; }
.unavailable { max-width: 680px; }
form { gap: 16px; }
.form-grid { gap: 16px; }
.field { gap: 6px; }
label,
legend { color: var(--ink); font-weight: 600; }
.field span { color: var(--muted); font-weight: 400; }
fieldset { padding: 16px; border-color: var(--line); border-radius: 8px; }
input,
select,
output {
  min-height: 42px;
  padding: 9px 12px;
  color: var(--ink);
  font: inherit;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: none;
}
input:disabled,
select:disabled,
button:disabled { color: #77818a; background: #f1f3f5; border-color: #d9dde1; cursor: not-allowed; opacity: 1; }
input:focus-visible,
select:focus-visible,
button:focus-visible,
a:focus-visible,
summary:focus-visible { outline: 3px solid rgb(36 95 159 / 55%); outline-offset: 2px; }

button {
  min-height: 40px;
  padding: 8px 12px;
  color: var(--ink);
  font: 600 14px/20px inherit;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  box-shadow: none;
  transition: background-color 180ms cubic-bezier(.32,.72,0,1), border-color 180ms cubic-bezier(.32,.72,0,1), transform 180ms cubic-bezier(.32,.72,0,1);
}
button:hover:not(:disabled) { background: var(--accent-dark); border-color: var(--accent-dark); }
button:active:not(:disabled) { transform: translateY(1px); }
.masthead button { min-height: 36px; color: #fff; background: transparent; border-color: rgb(255 255 255 / 45%); }
.masthead button:hover:not(:disabled) { background: rgb(255 255 255 / 12%); border-color: #fff; }
a { color: #174f86; font-weight: 600; text-underline-offset: 2px; }
a:hover { color: #0d355c; }

.catalog-tree,
.catalog-results,
.selected-door,
.cart-summary,
.compatibility-card,
.trace { background: #fff; border-color: var(--line); border-radius: 8px; box-shadow: none; }
.catalog-tree,
.catalog-results,
.selected-door { padding: 16px; }
.door-list { gap: 12px; }
.door-choice { border-color: var(--line); border-radius: 8px; background: #fff; }
.door-choice button { min-height: 0; color: var(--ink); background: transparent; border: 0; border-radius: 7px; text-align: left; }
.door-choice button:hover:not(:disabled) { background: #fff9e7; }
.door-choice:hover,
.door-choice:focus-visible,
.door-choice.selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgb(255 198 10 / 24%); }
.door-choice button b { color: #174f86; }
.door-choice button:disabled b { color: var(--muted); }
.door-image-placeholder { color: var(--muted); background: #f1f3f5; border: 1px solid var(--line); }

.cart-summary { margin-bottom: 20px; padding: 16px; }
.cart-summary li { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.cart-summary li:last-child { padding-bottom: 0; border-bottom: 0; }
.cart-actions { flex-wrap: wrap; }
.cart-actions button { min-height: 32px; padding: 5px 9px; color: var(--ink); background: #fff; border-color: var(--line); }
.cart-actions button:hover:not(:disabled) { background: #f8f9fa; border-color: #cdd3d8; }
.cart-actions button[data-cart-action^="remove"] { color: var(--error); border-color: #f2c6c2; }
.cart-actions button[data-cart-action^="remove"]:hover:not(:disabled) { background: var(--error-bg); border-color: var(--error); }

.check input { accent-color: var(--navy); }
.opening-schemes figure { padding: 8px; background: #fff; border-color: var(--line); border-radius: 4px; }
.opening-schemes figcaption { color: var(--muted); }
.notice { margin-bottom: 20px; }
.notice.error,
.error,
[data-cart-error]:not([hidden]) { color: #7a271a; background: var(--error-bg); border: 1px solid #f2c6c2; border-left: 4px solid var(--error); border-radius: 4px; }
.empty-state { max-width: 40ch; margin: 32px 0; padding: 16px; color: var(--muted); background: #fff; border: 1px dashed #cdd3d8; border-radius: 8px; }

.total { margin-bottom: 20px; padding: 16px 0; border-color: var(--line); }
.total strong { color: var(--navy); font-size: 32px; }
.table-wrap { border: 1px solid var(--line); border-radius: 8px; }
table { min-width: 0; }
th,
td { padding: 12px; border-color: var(--line); }
th { color: #53606a; font-size: 12px; font-weight: 600; letter-spacing: .04em; background: #f8f9fa; }
small { color: #66707a; }
details { border-color: var(--line); }
summary { color: var(--navy); }
.trace { margin-top: 12px; padding: 16px; background: #f8f9fa; }
dd { color: var(--muted); }

[aria-busy="true"] { cursor: progress; }
[aria-busy="true"] button,
button[aria-busy="true"] { position: relative; color: #5d4a00; }

@media (max-width: 760px) {
  .page-shell { width: min(100% - 24px, 640px); padding: 16px 0 32px; }
  .masthead { padding: 16px; }
  .masthead-primary { display: grid; gap: 12px; }
  .masthead .brand-logo--masthead { width: min(100%, 340px); }
  .masthead-row { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; }
  .masthead h1 { font-size: 24px; }
  .panel,
  .notice { padding: 16px; }
  .table-wrap { overflow: visible; border: 0; }
  tr { padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
  td { display: grid; grid-template-columns: minmax(7.5rem, 42%) minmax(0, 1fr); gap: 8px; padding: 5px 0; word-break: break-word; }
  td[data-label]::before { width: auto; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .03em; text-transform: none; content: attr(data-label); }
  td:not([data-label])::before { content: none; }
  .opening-schemes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

.admin-page { max-width: 980px; }
.admin-page > * { margin-bottom: 20px; }
.admin-page article { margin-bottom: 16px; padding: 20px 24px; }
.admin-page section[aria-labelledby="accounts-title"] > h2 { margin-bottom: 12px; }
.admin-page article > h3 { margin-bottom: 4px; }
.admin-page article > p { margin-bottom: 14px; color: var(--muted); font-size: 13px; }
.admin-page form { gap: 12px; }
.admin-page .form-grid { gap: 12px 16px; }
.admin-page article form > p { margin-bottom: 0; color: var(--muted); font-size: 13px; }
.admin-page form > button { min-width: 190px; min-height: 44px; justify-self: start; }
.admin-page details { margin-top: 16px; padding-top: 12px; }
.admin-page details form { margin-top: 16px; }
.admin-page summary { display: flex; min-height: 44px; align-items: center; }
.admin-page article > form:last-child { margin-top: 16px; }
.admin-page .form-grid > * { min-width: 0; }
.admin-page h3, .admin-page p { overflow-wrap: anywhere; }
.admin-page button.danger { color: #7a271a; background: #fff; border-color: #f2c6c2; }
.admin-page button.danger:hover:not(:disabled) { background: var(--error-bg); border-color: var(--error); }

@media (max-width: 760px) {
  .admin-page article { padding: 16px; }
  .admin-page form > button { width: 100%; min-width: 0; justify-self: stretch; }
}
