:root {
  --bg: #f5f6f4;
  --surface: #ffffff;
  --text: #18201d;
  --muted: #64706b;
  --line: #dce2df;
  --accent: #0f766e;
  --accent-strong: #0b5d57;
  --danger: #b42318;
  --warn: #9a6700;
  --shadow: 0 18px 45px rgba(22, 31, 28, .08);
}

* {
  box-sizing: border-box;
}

html {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  max-width: 100%;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

input.invalid {
  border-color: var(--danger);
  background: #fff7f6;
}

.field-hint {
  margin: -4px 0 14px;
  border: 1px solid #f3b8b2;
  border-radius: 8px;
  background: #fff7f6;
  color: var(--danger);
  padding: 10px 12px;
  font-weight: 700;
}

.subpanel {
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 12px;
}

.compact-tab {
  padding: 10px 12px;
}

label,
fieldset,
.color-picker-button,
.segmented,
.checkbox-card {
  min-width: 0;
}

.compact-tab > summary {
  cursor: pointer;
  font-weight: 750;
  color: var(--muted);
}

.compact-tab[open] > summary {
  margin-bottom: 12px;
}

.compact-head {
  margin-bottom: 10px;
}

.compact-head h3 {
  margin: 0;
  font-size: 16px;
}

.inline-note {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.inline-note.error {
  color: var(--danger);
}

.input-note {
  display: block;
  min-height: 18px;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 700;
}

.input-note:empty {
  display: none;
}

.input-note.error {
  color: var(--danger);
}

.standard-doors-panel {
  padding: 0;
}

.standard-doors-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  cursor: pointer;
  color: var(--text);
  font-weight: 800;
}

.standard-doors-panel summary::marker {
  color: var(--accent);
}

.standard-doors-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 12px 12px;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

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

.standard-doors-table-wrap {
  overflow-x: auto;
  border-top: 1px solid var(--line);
}

.standard-doors-table {
  min-width: 920px;
}

.standard-doors-table th,
.standard-doors-table td {
  padding: 10px 12px;
}

.standard-door-name {
  min-width: 320px;
  font-weight: 700;
}

.standard-door-qty {
  width: 88px;
  min-height: 38px;
}

.metal-hint {
  display: block;
  margin-top: 6px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
}

.option-form {
  display: grid;
  gap: 10px;
  align-content: start;
}

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

.option-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f4f7f6;
  padding: 6px 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.option-edit-button {
  min-height: auto;
  border: 0;
  background: transparent;
  color: var(--green);
  padding: 0 2px;
  font-size: 13px;
  line-height: 1;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding: 24px clamp(16px, 4vw, 44px);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.topbar > * {
  min-width: 0;
}

.brand {
  color: var(--accent);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  margin-top: 4px;
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.1;
}

h2 {
  font-size: 18px;
}

main {
  width: min(1680px, calc(100% - clamp(24px, 5vw, 80px)));
  margin: 28px auto 48px;
}

.file-warning {
  width: min(1180px, calc(100% - 32px));
  margin: 18px auto 0;
  border: 1px solid #f4c14f;
  border-radius: 8px;
  background: #fff8e1;
  color: #5d4200;
  padding: 12px 14px;
  font-weight: 700;
}

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

.tabs,
.actions,
.compact-fields,
.userbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.quote-ms-ref {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  max-width: 300px;
}

.primary-action-row {
  align-items: end;
}

.quantity-action-field {
  width: 120px;
  margin: 0;
}

.quote-ms-ref input {
  min-height: 36px;
  min-width: 140px;
  margin: 0;
  padding: 7px 9px;
  font-size: 13px;
}

.quote-ms-ref button {
  min-height: 36px;
  padding: 7px 10px;
  white-space: nowrap;
}

[hidden] {
  display: none !important;
}

.userbar {
  align-items: center;
  color: var(--muted);
  font-weight: 700;
}

.login-screen {
  width: min(420px, calc(100% - 32px));
  margin: 48px auto;
}

.login-panel {
  margin: 0;
}

.tab,
button,
.button-link {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  min-height: 42px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 700;
}

.button-link {
  display: inline-grid;
  place-items: center;
  text-decoration: none;
}

.tab {
  background: #eef4f2;
  color: var(--text);
}

.tab.active,
button:hover {
  background: var(--accent-strong);
  color: white;
}

button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

#calculateButton.added,
.standard-door-add-button.added {
  background: white;
  color: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent);
  transform: translateY(-1px);
  opacity: 1;
  cursor: default;
}

#calculateButton.added:hover,
.standard-door-add-button.added:hover {
  background: white;
  color: var(--accent);
}

.secondary,
.ghost {
  background: #eef4f2;
  color: var(--text);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.layout {
  display: grid;
  grid-template-columns: minmax(720px, 1.6fr) minmax(360px, .85fr);
  gap: clamp(18px, 2vw, 28px);
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.panel + .panel,
.quote-panel {
  margin-top: 18px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.result-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

label,
fieldset {
  display: grid;
  gap: 7px;
  margin: 0 0 14px;
  color: var(--muted);
  font-weight: 650;
}

fieldset {
  border: 0;
  padding: 0;
}

legend {
  padding: 0;
  margin-bottom: 7px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--text);
  min-height: 42px;
  padding: 10px 12px;
}

.color-picker-button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  border: 1px solid var(--line);
  background: #fbfcfb;
  color: var(--text);
  gap: 10px;
}

.color-picker-button:hover {
  background: #eef4f2;
  color: var(--text);
}

.antipanic-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.antipanic-fields.is-double {
  grid-template-columns: 1fr;
}

.antipanic-picker-button {
  min-height: 50px;
  justify-content: space-between;
  gap: 12px;
}

.antipanic-picker-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-align: left;
}

.antipanic-picker-summary small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.1;
}

.antipanic-picker-summary strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.color-chip {
  width: 24px;
  height: 24px;
  border: 1px solid rgba(0, 0, 0, .18);
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35);
}

.color-popup {
  position: fixed;
  z-index: 20;
  left: 50%;
  top: 50%;
  width: min(440px, calc(100% - 32px));
  transform: translate(-50%, -50%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 16px;
}

.color-popup.is-double {
  width: min(760px, calc(100% - 32px));
}

.color-popup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.color-search {
  margin-bottom: 12px;
}

.color-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-bottom: 8px;
}

.color-add input {
  min-height: 38px;
}

.color-add button {
  min-height: 38px;
  white-space: nowrap;
}

.color-swatches {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.color-empty {
  grid-column: 1 / -1;
  padding: 12px;
}

.color-swatch {
  display: grid;
  gap: 8px;
  justify-items: center;
  min-height: 92px;
  border: 1px solid var(--line);
  background: #fbfcfb;
  color: var(--text);
  padding: 10px 6px;
  text-align: center;
}

.color-swatch:hover,
.color-swatch.active {
  border-color: var(--accent);
  background: #eef8f6;
  color: var(--text);
}

.color-square {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(0, 0, 0, .2);
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35);
}

.antipanic-preview {
  width: 42px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f4f7f6 center / contain no-repeat;
}

.antipanic-options {
  display: grid;
  gap: 10px;
}

.antipanic-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.antipanic-column {
  display: grid;
  gap: 10px;
}

.antipanic-column h3 {
  margin: 0;
  font-size: 15px;
}

.antipanic-option {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 86px;
  border: 1px solid var(--line);
  background: #fbfcfb;
  color: var(--text);
  text-align: left;
}

.antipanic-option:hover,
.antipanic-option.active {
  border-color: var(--accent);
  background: #eef8f6;
  color: var(--text);
}

.antipanic-option img {
  width: 82px;
  height: 62px;
  object-fit: contain;
  border-radius: 6px;
  background: white;
}

.antipanic-option strong,
.antipanic-option span {
  display: block;
}

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

.handle-option {
  display: grid;
  grid-template-rows: 92px auto auto;
  gap: 8px;
  width: 100%;
  min-height: 158px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.handle-option:hover,
.handle-option.active {
  border-color: var(--accent);
  background: #eef8f6;
  color: var(--text);
}

.handle-option img {
  width: 100%;
  height: 92px;
  object-fit: contain;
  border-radius: 6px;
  background: white;
}

.handle-option strong {
  font-size: 13px;
  line-height: 1.25;
}

.handle-option small {
  color: var(--muted);
}

.handle-picker-preview {
  width: 36px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background-color: white;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

textarea {
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.5;
}

.json-output {
  overflow: auto;
  max-height: 420px;
  margin: 14px 0 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 14px;
  color: var(--text);
  font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
}

.notice {
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--muted);
  padding: 10px 12px;
  font-weight: 650;
}

.notice.warn {
  border-color: #f4c14f;
  background: #fff8e1;
  color: #5d4200;
}

.notice.ok {
  border-color: #93d5c7;
  background: #ecfdf8;
  color: var(--accent-strong);
}

.checkline {
  align-content: end;
  grid-template-columns: 18px minmax(0, 1fr);
  grid-auto-flow: column;
  align-items: center;
  min-height: 67px;
}

.checkline input {
  min-height: 18px;
  width: 18px;
  padding: 0;
}

.check-line {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  margin: 0 0 12px;
}

.check-line input {
  min-height: 18px;
  width: 18px;
  padding: 0;
}

.checkbox-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 0 14px;
}

.checkbox-card input {
  min-height: 18px;
  width: 18px;
  padding: 0;
}

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

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

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

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

.product-leaf-row {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.85fr);
  gap: 12px;
}

.main-params-row {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 0.9fr) minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 12px;
}

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

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

.glazing-transom-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.antipanic-inline {
  margin: 0 0 14px;
}

.antipanic-inline label {
  margin: 0;
}

.checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.checkbox-grid label {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 36px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 8px 10px;
  color: var(--text);
}

.checkbox-grid input {
  width: 18px;
  min-height: 18px;
  padding: 0;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fbfcfb;
}

.segmented label {
  margin: 0;
  display: block;
  color: var(--text);
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: grid;
  place-items: center;
  min-height: 42px;
  padding: 0 10px;
  font-weight: 750;
}

.segmented input:checked + span {
  background: var(--accent);
  color: white;
}

.segmented-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.segmented-three span,
.segmented-four span {
  padding-inline: 4px;
}

.segmented-four span {
  font-size: 14px;
}

.segmented input:disabled + span {
  color: #9ba6a1;
  background: #eef2f0;
  cursor: not-allowed;
}

.status {
  color: var(--muted);
  font-size: 13px;
}

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

.result.empty,
.muted {
  color: var(--muted);
}

.metrics,
.prices {
  display: grid;
  gap: 10px;
}

.metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 12px;
}

.prices {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.metrics div,
.prices div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  min-height: 56px;
}

.metrics span,
.prices span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 4px;
}

.metrics strong,
.prices strong {
  display: block;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.price-visibility-popup {
  right: 24px;
  left: auto;
  top: 72px;
  transform: none;
  width: min(260px, calc(100vw - 32px));
}

.quote-column-popup {
  right: 24px;
  left: auto;
  top: 140px;
  transform: none;
  width: min(300px, calc(100vw - 32px));
}

.quote-color-popup {
  width: min(520px, calc(100vw - 32px));
}

.price-visibility-popup .checkbox-grid {
  display: grid;
  grid-template-columns: 1fr;
}

.quote-column-popup .checkbox-grid {
  display: grid;
  grid-template-columns: 1fr;
}

.tech-info {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.tech-info-result {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 12px;
}

.result-info {
  margin-top: 12px;
}

.result-info summary {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef4f2;
  color: var(--text);
  cursor: pointer;
  font-weight: 750;
}

.result-info[open] summary {
  border-radius: 8px 8px 0 0;
}

.result-info[open] [data-tech-info-body] {
  padding-bottom: 2px;
}

.door-visualization {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.door-visualization-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}

.door-visualization-head span {
  color: var(--muted);
  font-size: 12px;
}

.door-model-wrap {
  display: grid;
  place-items: center;
  min-height: 370px;
  padding: 12px 8px 4px;
  overflow: hidden;
}

.door-model-stack {
  --frame-size: 10px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  width: min(100%, calc(340px * var(--door-ratio)));
  height: 340px;
}

.door-model-stack .door-model {
  width: 100%;
  height: 100%;
}

.door-model-stack.with-transom .door-transom-model {
  flex: var(--transom-share) 1 0;
}

.door-model-stack.with-transom .door-model {
  flex: var(--door-share) 1 0;
  min-height: 0;
}

.door-transom-model {
  position: relative;
  min-height: 44px;
  padding: 8px 9px 8px 8px;
  background: var(--door-color);
  box-shadow: 0 8px 18px rgba(28, 35, 33, .10), inset 0 0 0 1px color-mix(in srgb, var(--door-color) 72%, #000);
}

.door-transom-leaf {
  width: 100%;
  height: 100%;
  border: 1px solid color-mix(in srgb, var(--door-color) 54%, #000);
  background: var(--door-color);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--door-color) 64%, #000), inset 8px 0 20px rgba(255, 255, 255, .04);
}

.door-transom-model .casing {
  display: none;
}

.door-transom-model.forgotten-transom::after {
  content: '';
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 3px;
  height: 5px;
  border-radius: 2px 2px 0 0;
  background: color-mix(in srgb, var(--door-color) 62%, #000);
  opacity: .42;
}

.door-model {
  --frame-size: 10px;
  position: relative;
  width: min(100%, calc(340px * var(--door-ratio)));
  height: 340px;
  padding: var(--frame-size);
  background: var(--door-color);
  box-shadow: 0 10px 24px rgba(28, 35, 33, .16);
}

.door-model-stack > .door-model {
  width: 100%;
  height: 100%;
}

.door-leaves {
  display: flex;
  width: 100%;
  height: 100%;
  gap: 2px;
  background: #555;
}

.door-leaf {
  position: relative;
  min-width: 0;
  background: var(--door-color);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12), inset 7px 0 10px rgba(255, 255, 255, .07);
}

.door-glass {
  position: absolute;
  top: 12%;
  left: 50%;
  width: var(--glass-width);
  height: var(--glass-height);
  transform: translateX(-50%);
  border: 5px solid color-mix(in srgb, var(--door-color) 72%, #333);
  background: linear-gradient(135deg, rgba(204, 225, 227, .92), rgba(119, 153, 158, .62));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .65);
}

.door-glass small {
  position: absolute;
  padding: 3px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .82);
  color: #26312f;
  font-size: 10px;
  font-weight: 750;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
}

.door-distribution-window {
  position: absolute;
  left: 50%;
  bottom: var(--dw-bottom);
  width: var(--dw-width);
  height: var(--dw-height);
  transform: translateX(-50%);
  border: 4px solid color-mix(in srgb, var(--door-color) 62%, #222);
  background: color-mix(in srgb, var(--door-color) 78%, #f4f4ee);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .5), 0 2px 5px rgba(0, 0, 0, .14);
}

.door-distribution-window::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: -9px;
  height: 5px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--door-color) 55%, #333);
}

.door-distribution-window small {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 2px 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .78);
  color: #26312f;
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}

.glass-size-width {
  top: 3px;
  left: 50%;
  transform: translateX(-50%);
}

.glass-size-height {
  top: 50%;
  right: 3px;
  transform: translate(42%, -50%) rotate(-90deg);
}

.door-handle {
  --handle-color: #171918;
  position: absolute;
  top: var(--handle-top);
  transform: translateY(-50%);
  width: 9px;
  height: 30px;
  border-radius: 3px;
  background: var(--handle-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
}

.door-handle::after {
  content: '';
  position: absolute;
  top: 5px;
  width: 28px;
  height: 6px;
  border-radius: 4px;
  background: var(--handle-color);
}

.active-leaf:last-child .door-handle { left: 10px; }
.active-leaf:last-child .door-handle::after { left: 4px; }
.active-leaf:first-child .door-handle { right: 10px; }
.active-leaf:first-child .door-handle::after { right: 4px; }

.door-model.single-door.opening-left .door-handle {
  right: 18px;
  left: auto;
}

.door-model.single-door.opening-left .door-handle::after {
  right: 4px;
  left: auto;
}

.door-model.single-door.opening-right .door-handle {
  right: auto;
  left: 18px;
}

.door-model.single-door.opening-right .door-handle::after {
  right: auto;
  left: 4px;
}

.single-door.single-with-casing .door-handle {
  width: 8px;
  height: 28px;
  border-radius: 3px;
}

.single-door.single-with-casing .door-handle::after {
  top: 6px;
  width: 26px;
  height: 5px;
}

.single-door.no-casing {
  --frame-size: 6px;
  background: var(--door-color);
  box-shadow: 0 8px 18px rgba(28, 35, 33, .13), 0 0 0 1px rgba(0, 0, 0, .22);
}

.single-door.no-casing .door-leaves {
  gap: 0;
  background: transparent;
}

.single-door.no-casing .door-leaf {
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .3);
}

.single-door.single-with-casing {
  --frame-size: 8px;
  padding: 8px 9px 8px 8px;
  background: var(--door-color);
  box-shadow: 0 10px 24px rgba(28, 35, 33, .13), inset 0 0 0 1px color-mix(in srgb, var(--door-color) 72%, #000);
}

.single-door.single-with-casing .door-leaves {
  gap: 0;
  border: 1px solid color-mix(in srgb, var(--door-color) 54%, #000);
  background: transparent;
}

.single-door.single-with-casing .door-leaf {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--door-color) 64%, #000), inset 8px 0 20px rgba(255, 255, 255, .04);
}

.single-door.single-with-casing .casing {
  display: none;
}

.single-door.single-with-casing .door-threshold {
  display: none;
}

.double-door.double-with-casing {
  --frame-size: 8px;
  padding: 8px 9px 8px 8px;
  background: var(--door-color);
  box-shadow: 0 10px 24px rgba(28, 35, 33, .13), inset 0 0 0 1px color-mix(in srgb, var(--door-color) 72%, #000);
}

.double-door.double-with-casing .door-leaves {
  gap: 1px;
  border: 1px solid color-mix(in srgb, var(--door-color) 54%, #000);
  background: color-mix(in srgb, var(--door-color) 50%, #000);
}

.double-door.double-with-casing .door-leaf {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--door-color) 64%, #000), inset 8px 0 20px rgba(255, 255, 255, .035);
}

.double-door.double-with-casing .casing,
.double-door.double-with-casing .door-threshold {
  display: none;
}

.double-door.double-with-casing .door-handle {
  width: 8px;
  height: 28px;
  border-radius: 3px;
}

.double-door.double-with-casing .door-handle::after {
  top: 6px;
  width: 26px;
  height: 5px;
}

.door-hinge {
  position: absolute;
  z-index: 4;
  width: 5px;
  height: 24px;
  border: 1px solid rgba(0, 0, 0, .45);
  background: var(--door-color);
  box-shadow: inset 1px 0 rgba(255, 255, 255, .18);
}

.opening-right .door-hinge { right: 3px; }
.opening-left .door-hinge { left: 3px; }
.single-with-casing.opening-right .door-hinge { right: 4px; }
.single-with-casing.opening-left .door-hinge { left: 4px; }
.hinge-top { top: 12%; }
.hinge-bottom { bottom: 12%; }
.single-with-casing .hinge-top { top: 16%; }
.single-with-casing .hinge-bottom { bottom: 16%; }

.single-with-casing .door-hinge {
  width: 6px;
  height: 28px;
  border-radius: 2px;
  border-color: rgba(0, 0, 0, .22);
  background: color-mix(in srgb, var(--door-color) 82%, #f4f4ee);
  box-shadow: inset 1px 0 rgba(255, 255, 255, .35), 0 1px 2px rgba(0, 0, 0, .16);
}

.double-with-casing .door-hinge {
  width: 6px;
  height: 28px;
  border-radius: 2px;
  border-color: rgba(0, 0, 0, .22);
  background: color-mix(in srgb, var(--door-color) 82%, #f4f4ee);
  box-shadow: inset 1px 0 rgba(255, 255, 255, .35), 0 1px 2px rgba(0, 0, 0, .16);
}

.hinge-left-top,
.hinge-left-bottom { left: 4px; }
.hinge-right-top,
.hinge-right-bottom { right: 4px; }
.hinge-left-top,
.hinge-right-top { top: 16%; }
.hinge-left-bottom,
.hinge-right-bottom { bottom: 16%; }

.casing {
  position: absolute;
  z-index: 2;
  background: var(--door-color);
}

.casing-top {
  left: -8px;
  right: -8px;
  top: -8px;
  height: 10px;
}

.casing-left,
.casing-right {
  top: -8px;
  bottom: -8px;
  width: 10px;
}

.casing-left { left: -8px; }
.casing-right { right: -8px; }

.door-threshold {
  position: absolute;
  z-index: 3;
  left: 4px;
  right: 4px;
  bottom: 1px;
  height: 7px;
  background: var(--door-color);
}

.no-casing .casing,
.no-casing-top .casing-top,
.no-casing-left .casing-left,
.no-casing-right .casing-right,
.no-threshold .door-threshold {
  display: none;
}

.reverse-casing .casing {
  filter: brightness(.88);
}

.tech-info-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto;
  gap: 10px;
}

.tech-info-row strong {
  color: var(--text);
  font-weight: 750;
  white-space: nowrap;
}

.quote-item-details {
  margin-top: 6px;
}

.quote-item-details summary {
  color: var(--accent-strong);
  cursor: pointer;
  font-weight: 700;
}

.quote-item-details-body {
  margin-top: 8px;
}

.table-wrap {
  overflow-x: auto;
}

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

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

th {
  color: var(--muted);
  font-size: 13px;
}

td:last-child,
th:last-child {
  text-align: right;
}

.quote-index-col {
  width: 38px;
  color: var(--muted);
  font-weight: 750;
  text-align: center;
  cursor: grab;
  user-select: none;
}

.quote-draggable-row {
  transition: background-color 0.15s ease, opacity 0.15s ease;
}

.quote-draggable-row:hover {
  background: rgba(24, 128, 116, 0.035);
}

.quote-row-dragging {
  opacity: 0.45;
}

.quote-row-drop-before {
  box-shadow: inset 0 3px 0 var(--accent);
}

.quote-row-drop-after {
  box-shadow: inset 0 -3px 0 var(--accent);
}

.icon-btn {
  width: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 8px;
  background: #eef4f2;
  color: var(--accent-strong);
}

.icon-btn.danger {
  background: #fff1f0;
  color: var(--danger);
}

.qty-input {
  width: 74px;
  min-height: 34px;
  padding: 6px 8px;
}

.quote-item-comment {
  width: 180px;
  min-height: 54px;
  padding: 8px 10px;
  resize: vertical;
}

.price-select {
  min-width: 118px;
  min-height: 34px;
  padding: 6px 8px;
}

.quote-metal-select {
  min-width: 92px;
}

.quote-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  white-space: nowrap;
  color: var(--text);
}

.quote-check input {
  width: 18px;
  height: 18px;
}

.quote-check-head {
  font-weight: 700;
}

.quote-color-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 104px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--text);
  padding: 6px 8px;
  text-align: left;
}

.quote-color-button:hover,
.quote-color-button[aria-expanded="true"] {
  border-color: var(--accent);
  background: #eef8f6;
}

.quote-comment-field {
  display: grid;
  gap: 6px;
  margin: 8px 0 18px;
  max-width: 560px;
}

@media (max-width: 1260px) {
  main {
    width: min(100% - 24px, 1120px);
  }

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

  .result-panel {
    max-width: none;
  }
}

@media (max-width: 820px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .layout,
  .grid.two,
  .grid.three,
  .grid.four,
  .product-leaf-row,
  .main-params-row,
  .hardware-row,
  .glazing-transom-row,
  .metrics,
  .prices {
    grid-template-columns: 1fr;
  }

  .antipanic-fields.is-double {
    grid-template-columns: 1fr;
  }

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

  .tabs,
  .tab {
    width: 100%;
  }

  .tab {
    flex: 1;
  }
}

@media print {
  .topbar,
  #calcForm,
  .result-panel,
  .actions,
  .tabs {
    display: none !important;
  }

  body,
  main,
  .panel {
    background: white;
    box-shadow: none;
  }

  main {
    width: 100%;
    margin: 0;
  }
}
