:root {
  --bg: #f3f7f7;
  --surface: #ffffff;
  --soft: #eef5f3;
  --text: #14201d;
  --muted: #64736f;
  --line: #d6e1de;
  --primary: #07967f;
  --primary-dark: #066b5c;
  --lime: #72d341;
  --nav: #0d2520;
  --warning-bg: #fff7e8;
  --warning-text: #7c5212;
  --danger: #b03b3b;
  --shadow: 0 18px 50px rgba(20, 46, 40, 0.10);
  --radius: 18px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(7, 150, 127, .12), transparent 34rem),
    radial-gradient(circle at top left, rgba(114, 211, 65, .10), transparent 30rem),
    var(--bg);
}

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

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  background: var(--nav);
  color: #fff;
  padding: 28px 20px;
}

.brand {
  display: grid;
  gap: 12px;
  align-items: start;
  margin-bottom: 22px;
}

.brand-logo {
  width: 100%;
  max-width: 230px;
  height: auto;
  display: block;
}

.brand-copy strong {
  display: block;
  font-size: 1.18rem;
  line-height: 1.05;
  color: #fff;
}

.brand-copy small {
  display: block;
  margin-top: 4px;
  color: #bad0cb;
  font-weight: 800;
}

.brand-copy em {
  display: block;
  margin-top: 3px;
  color: #8fd1c5;
  font-style: normal;
  font-size: .8rem;
}


.progress { margin-bottom: 26px; }
.progress-track {
  height: 7px;
  border-radius: 99px;
  overflow: hidden;
  background: rgba(255,255,255,.12);
}
.progress-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #d84a43 0%, #f0a022 50%, #72d341 100%);
  clip-path: inset(0 80% 0 0);
  transition: clip-path .25s ease;
}
.progress-meta {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  color: #c1d4cf;
  font-size: .78rem;
}

.step-nav { display: grid; gap: 8px; }
.step-nav button {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 11px;
  color: #d4e2df;
  background: transparent;
  text-align: left;
}
.step-nav button:hover { background: rgba(255,255,255,.06); }
.step-nav button.active { background: rgba(255,255,255,.13); color: #fff; }
.step-nav button span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 50%;
  font-weight: 800;
}
.step-nav button.active span {
  background: var(--lime);
  color: #163228;
  border-color: transparent;
}

.side-actions { display: grid; gap: 9px; margin-top: 28px; }
.side-actions button {
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
  color: #fff;
  padding: 11px;
  border-radius: 10px;
}
.side-actions button:hover { background: rgba(255,255,255,.11); }

.sidebar-note {
  margin-top: 24px;
  color: #aac2bc;
  font-size: .78rem;
  line-height: 1.5;
}

.sidebar-copyright {
  margin-top: 18px;
  color: #7eb3a7;
  font-size: .76rem;
  font-weight: 800;
}

main {
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
  padding: 38px clamp(18px, 4vw, 58px) 60px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 26px;
}
.page-head h1 { margin: 0; font-size: clamp(2rem, 4vw, 2.8rem); line-height: 1.1; }
.page-head p { margin: 9px 0 0; color: var(--muted); line-height: 1.5; }
.save-badge {
  white-space: nowrap;
  padding: 9px 12px;
  border-radius: 999px;
  background: #e5f5ee;
  color: var(--primary-dark);
  font-size: .8rem;
  font-weight: 800;
}

.step { display: none; }
.step.active { display: block; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.card + .card { margin-top: 18px; }

.card-head { margin-bottom: 18px; }
.card-head.split {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}
.card h2 { margin: 0; font-size: 1.18rem; }
.card-head p, .card > p { margin: 6px 0 0; color: var(--muted); line-height: 1.45; }

.form-grid {
  display: grid;
  gap: 15px;
}
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

label, .full-label {
  display: grid;
  gap: 7px;
  font-size: .87rem;
  font-weight: 800;
}

input, select, textarea {
  width: 100%;
  border: 1px solid #c8d6d2;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(7, 150, 127, .12);
}
textarea { min-height: 100px; resize: vertical; }

.top-gap { margin-top: 17px; }
.section-title { margin: 22px 0 12px; }

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

.choice, .system-card { position: relative; display: block; }
.choice input, .system-card input { position: absolute; opacity: 0; pointer-events: none; }
.choice span, .system-card span {
  display: flex;
  height: 100%;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  transition: .15s ease;
}
.choice input:checked + span, .system-card input:checked + span {
  border-color: var(--primary);
  background: var(--soft);
  box-shadow: inset 0 0 0 1px var(--primary);
}
.choice small, .system-card small { color: var(--muted); font-weight: 500; line-height: 1.4; }
.system-card b { color: var(--primary-dark); font-size: .8rem; margin-top: auto; }

.actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
}
.actions.end { justify-content: flex-end; }
button.primary, button.secondary, button.danger {
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  font-weight: 850;
}
button.primary { background: var(--primary); color: #fff; }
button.primary:hover { background: var(--primary-dark); }
button.secondary { background: #e6eeec; color: var(--text); }
button.secondary:hover { background: #dce7e4; }
button.danger { background: #fff0f0; color: var(--danger); }

.inline-buttons { display: flex; flex-wrap: wrap; gap: 8px; }

.summary-strip {
  padding: 12px 14px;
  border-radius: 11px;
  background: var(--soft);
  color: var(--primary-dark);
  font-weight: 800;
  margin-bottom: 14px;
}

.room-list { display: grid; gap: 11px; }
.room-row {
  display: grid;
  grid-template-columns: 1.25fr 1fr .6fr .55fr auto;
  gap: 10px;
  align-items: end;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fbfdfd;
}

.feature-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin-bottom: 18px;
}
.feature-toolbar > label { min-width: 320px; }

.feature-groups { display: grid; gap: 16px; }
.feature-group {
  border: 1px solid var(--line);
  border-radius: 15px;
  overflow: hidden;
}
.feature-group h3 {
  margin: 0;
  padding: 13px 15px;
  background: var(--soft);
  border-bottom: 1px solid var(--line);
  font-size: .98rem;
}
.feature-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.feature-item {
  display: grid;
  grid-template-columns: 1fr 112px;
  gap: 12px;
  align-items: center;
  padding: 13px 15px;
  border-bottom: 1px solid #edf1f0;
}
.feature-item:nth-child(odd) { border-right: 1px solid #edf1f0; }
.feature-name { font-weight: 800; }
.feature-help { margin-top: 3px; color: var(--muted); font-size: .79rem; line-height: 1.35; }
.qty {
  display: grid;
  grid-template-columns: 32px 1fr 32px;
  gap: 5px;
}
.qty button {
  border: 1px solid #c8d6d2;
  background: #fff;
  border-radius: 8px;
  font-weight: 900;
}
.qty input { padding: 7px 3px; text-align: center; }

.system-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
}
.system-card span { min-height: 155px; }
.system-card strong { font-size: 1.05rem; }

.catalog-help { margin: 14px 0; }
.catalog-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 14px;
}
.catalog-toolbar label { max-width: 280px; width: 100%; }

.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.data-table th, .data-table td {
  padding: 10px 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.data-table th {
  color: var(--muted);
  font-size: .73rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.data-table input { min-width: 105px; padding: 7px 8px; }
.data-table a { color: var(--primary-dark); font-weight: 750; }

.result-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(330px, .62fr);
  gap: 18px;
  align-items: start;
}
.result-main { min-width: 0; }

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 11px;
}
.metrics > div {
  padding: 15px;
  border-radius: 13px;
  border: 1px solid #dbe7e4;
  background: #f1f7f5;
}
.metrics small { color: var(--muted); }
.metrics strong { display: block; margin-top: 4px; font-size: 1.35rem; }

.comparison-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 11px;
}
.comparison-card {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
}
.comparison-card.selected {
  border-color: var(--primary);
  background: var(--soft);
}
.comparison-card small { color: var(--muted); }
.comparison-card strong { display: block; font-size: 1.35rem; margin: 5px 0; }
.comparison-card span { font-size: .8rem; color: var(--muted); }

.cost-card { position: sticky; top: 22px; }
.total-box {
  margin: 18px 0;
  padding: 18px;
  border-radius: 15px;
  background: var(--nav);
  color: #fff;
}
.total-box small { color: #bdd1cc; }
.total-box strong { display: block; margin-top: 5px; font-size: 2rem; }
.cost-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: .9rem;
}
.warning {
  margin-top: 15px;
  padding: 13px;
  border: 1px solid #efd49e;
  border-radius: 11px;
  background: var(--warning-bg);
  color: var(--warning-text);
  font-size: .82rem;
  line-height: 1.45;
}
.export-buttons { display: grid; gap: 9px; margin-top: 15px; }

.room-book-item { padding: 14px 0; border-bottom: 1px solid var(--line); }
.room-book-title { display: flex; justify-content: space-between; gap: 15px; }
.room-book-features { margin-top: 6px; color: var(--muted); font-size: .85rem; line-height: 1.55; }

.price-date {
  padding: 7px 10px;
  border-radius: 999px;
  background: #eef3f2;
  color: var(--muted);
  font-size: .77rem;
  font-weight: 800;
}

.validation-box {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #fff0f0;
  color: #8d2f2f;
  border: 1px solid #efbbbb;
  font-weight: 750;
}
.hidden { display: none !important; }

.badge {
  display: inline-flex;
  padding: 4px 7px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 850;
}
.badge.online { background: #e3f5ed; color: #07654f; }
.badge.plan { background: #fff3dd; color: #805616; }

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 100;
  padding: 12px 15px;
  border-radius: 10px;
  color: #fff;
  background: var(--nav);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: .2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1100px) {
  .app { grid-template-columns: 230px minmax(0, 1fr); }
  .form-grid.four, .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .result-layout { grid-template-columns: 1fr; }
  .cost-card { position: static; }
}

@media (max-width: 760px) {
  .app { display: block; }
  .sidebar { position: static; height: auto; padding: 18px; }
  .step-nav { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .step-nav button { display: flex; justify-content: center; padding: 7px; }
  .step-nav button:not(.active) { color: transparent; }
  .step-nav button span { color: #fff; flex: 0 0 30px; }
  .side-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sidebar-note { display: none; }
  main { padding: 24px 14px 44px; }
  .page-head, .card-head.split, .feature-toolbar, .catalog-toolbar { display: block; }
  .save-badge { display: inline-flex; margin-top: 12px; }
  .form-grid.two, .form-grid.three, .form-grid.four,
  .choice-grid.three, .system-grid, .metrics, .comparison-cards {
    grid-template-columns: 1fr;
  }
  .room-row { grid-template-columns: 1fr 1fr; }
  .room-row label:first-child { grid-column: 1 / -1; }
  .feature-toolbar > label { min-width: 0; margin-bottom: 12px; }
  .feature-list { grid-template-columns: 1fr; }
  .feature-item:nth-child(odd) { border-right: 0; }
  .actions { flex-direction: column-reverse; }
  .actions button { width: 100%; }
}

@page {
  size: A4 portrait;
  margin: 27mm 11mm 17mm;
}

@media print {
  :root {
    --print-green: #0d342d;
    --print-mint: #e9f4f1;
    --print-red: #d3463e;
    --print-line: #c9d7d3;
  }

  html,
  body {
    width: auto;
    min-height: auto;
    margin: 0;
    padding: 0;
    background: #fff !important;
    color: #17231f;
    font-size: 8.2pt;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .sidebar,
  .page-head,
  .actions,
  .export-buttons,
  .warning,
  .catalog-card,
  .company-print-settings,
  .toast {
    display: none !important;
  }

  .print-document-header {
    position: fixed;
    top: -22mm;
    left: 0;
    right: 0;
    height: 17mm;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 8mm;
    padding: 0 0 3mm;
    border-bottom: 1.2pt solid var(--print-green);
    background: #fff;
    z-index: 1000;
  }

  .print-document-brand {
    min-width: 0;
    display: grid;
    gap: .7mm;
  }

  .print-document-brand > strong {
    color: var(--print-green);
    font-size: 14pt;
    line-height: 1;
    letter-spacing: -.02em;
  }

  .print-document-brand > span {
    overflow: hidden;
    color: #263a34;
    font-size: 8.2pt;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .print-document-brand > small {
    color: #667871;
    font-size: 6.8pt;
  }

  .print-document-company {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4mm;
    max-width: 92mm;
    text-align: right;
  }

  .print-company-copy {
    display: grid;
    gap: .8mm;
    max-width: 55mm;
  }

  .print-company-copy strong {
    color: var(--print-green);
    font-size: 8pt;
  }

  .print-company-copy span {
    color: #5e706a;
    font-size: 6.5pt;
    line-height: 1.28;
    white-space: pre-line;
  }

  .print-document-company img {
    width: auto;
    max-width: 38mm;
    height: auto;
    max-height: 13mm;
    object-fit: contain;
  }

  .print-document-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: -11mm;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding-top: 2mm;
    border-top: .7pt solid var(--print-line);
    color: #72817c;
    font-size: 6.5pt;
  }

  .app {
    display: block;
    min-height: 0;
  }

  main {
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
  }

  .step {
    display: none !important;
  }

  #step5 {
    display: block !important;
  }

  #validationBox {
    display: none !important;
  }

  .result-layout {
    display: flex;
    flex-direction: column;
    gap: 4mm;
    align-items: stretch;
  }

  .result-main {
    display: contents;
  }

  .result-main > .card:first-child { order: 1; }
  .cost-card { order: 2; }
  #logicResultCard { order: 3; }
  #prePlanningResultCard { order: 4; }
  #offerPlanningResultCard { order: 5; }
  #executionResultCard { order: 6; }
  #bomPrintCard { order: 7; }
  #roomBookPrintCard { order: 8; }

  .card,
  details.card {
    margin: 0 !important;
    padding: 4mm;
    border: .7pt solid var(--print-line);
    border-radius: 3.5mm;
    background: #fff;
    box-shadow: none;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .result-main > .card:first-child {
    padding: 0;
    overflow: hidden;
    border-color: #b9cbc6;
  }

  .result-main > .card:first-child > .card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 6mm;
    margin: 0;
    padding: 4.5mm 5mm 4mm;
    background: linear-gradient(120deg, var(--print-green), #176657);
    color: #fff;
  }

  .result-main > .card:first-child > .card-head h2 {
    color: #fff;
    font-size: 15pt;
    line-height: 1.05;
  }

  .result-main > .card:first-child > .card-head p {
    margin-top: 1.5mm;
    color: #d7ebe6;
    font-size: 7.4pt;
  }

  .result-head-meta {
    display: grid;
    justify-items: end;
    gap: 1.2mm;
    min-width: 42mm;
  }

  .phase-badge,
  .package-badge,
  .price-date {
    padding: 1.2mm 2.2mm;
    border: .5pt solid rgba(255,255,255,.38);
    border-radius: 99mm;
    background: rgba(255,255,255,.13) !important;
    color: #fff !important;
    font-size: 6.5pt;
    font-weight: 850;
  }

  .metrics {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1.5mm;
    padding: 3mm 4mm 1.5mm;
  }

  .metrics > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1.2mm;
    padding: 2mm 2.3mm;
    border: .55pt solid #d5e3df;
    border-radius: 2.2mm;
    background: #f2f7f5;
  }

  .metrics small {
    color: #5e706a;
    font-size: 6pt;
    line-height: 1.15;
  }

  .metrics strong {
    margin: 0;
    color: var(--print-green);
    font-size: 9.4pt;
    line-height: 1;
    white-space: nowrap;
  }

  .result-main > .card:first-child > .section-title {
    margin: 2.2mm 4mm 1.5mm;
    color: #435b54;
    font-size: 7pt;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
  }

  .comparison-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.6mm;
    padding: 0 4mm 4mm;
  }

  .comparison-card {
    min-height: 0;
    padding: 2.4mm;
    border: .6pt solid #d3dfdc;
    border-radius: 2.4mm;
    background: #fff;
  }

  .comparison-card.selected {
    border: 1.2pt solid var(--print-green);
    background: var(--print-mint);
  }

  .comparison-system-label {
    min-height: 0;
  }

  .comparison-system-name {
    color: #20332d;
    font-size: 7.4pt;
    font-weight: 900;
  }

  .comparison-system-mode {
    color: #71817c;
    font-size: 6pt;
  }

  .comparison-card strong {
    margin: 1mm 0;
    color: var(--print-green);
    font-size: 11pt;
    line-height: 1;
  }

  .comparison-card span {
    color: #667771;
    font-size: 5.8pt;
    line-height: 1.22;
  }

  .cost-card {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, .72fr) minmax(0, 1.28fr);
    column-gap: 6mm;
    align-items: start;
    padding: 4.5mm 5mm;
    border: 1pt solid #aec5bf;
    background: linear-gradient(120deg, #f8fbfa, #eef6f3);
  }

  .cost-card > h2,
  .cost-card > p,
  .cost-card > .total-box {
    grid-column: 1;
  }

  .cost-card > h2 {
    margin: 0;
    color: var(--print-green);
    font-size: 11pt;
  }

  .cost-card > p {
    margin: 1.5mm 0 0;
    color: #667771;
    font-size: 6.6pt;
    line-height: 1.35;
  }

  .total-box {
    position: relative;
    margin: 4mm 0 0;
    padding: 5mm 4mm 4mm;
    overflow: hidden;
    border: 0;
    border-radius: 3mm;
    background: linear-gradient(135deg, var(--print-green), #176657);
    color: #fff;
  }

  .total-box::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 2.3mm;
    height: 100%;
    background: var(--print-red);
  }

  .total-box small {
    color: #cde3dd;
    font-size: 7pt;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
  }

  .total-box strong {
    margin-top: 2mm;
    font-size: 20pt;
    line-height: 1;
    letter-spacing: -.03em;
  }

  .cost-row {
    grid-column: 2;
    display: flex;
    justify-content: space-between;
    gap: 4mm;
    padding: 1.25mm 0;
    border-bottom: .45pt solid #d6e1de;
    font-size: 6.8pt;
    line-height: 1.15;
  }

  .cost-row strong {
    color: #1d332d;
    white-space: nowrap;
  }

  .cost-row.sub-cost {
    padding-left: 4mm;
    color: #6d7d78;
  }

  .logic-summary {
    min-height: 0;
    padding: 3mm 3.5mm;
    background: #f7faf9;
  }

  .logic-summary::after,
  .logic-card[open] .logic-summary::after {
    display: none !important;
    content: none !important;
  }

  .logic-summary-copy {
    gap: .8mm;
  }

  .logic-summary-copy strong {
    color: var(--print-green);
    font-size: 9pt;
  }

  .logic-summary-copy small {
    color: #697a74;
    font-size: 6.3pt;
  }

  .logic-summary-hours {
    padding: 1.2mm 2.3mm;
    background: var(--print-mint);
    color: var(--print-green);
    font-size: 7pt;
  }

  .logic-card-content {
    padding: 3mm 3.5mm;
  }

  .card-head {
    margin-bottom: 3mm;
  }

  .card h2 {
    color: var(--print-green);
    font-size: 10pt;
  }

  .card-head p,
  .card > p {
    margin-top: 1mm;
    color: #6b7b76;
    font-size: 6.5pt;
  }

  .table-scroll {
    overflow: visible;
  }

  .data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 6.6pt;
  }

  .data-table thead {
    display: table-header-group;
  }

  .data-table tr,
  .room-book-item {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .data-table th,
  .data-table td {
    padding: 1.55mm 1.4mm;
    border-bottom: .45pt solid #d9e3e0;
  }

  .data-table th {
    background: #eef5f3;
    color: #4d625c;
    font-size: 5.8pt;
    letter-spacing: .035em;
  }

  .badge {
    padding: .8mm 1.4mm;
    font-size: 5.4pt;
  }

  .offer-result-meta {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.5mm;
    margin-bottom: 3mm;
  }

  .offer-result-meta > div {
    padding: 2mm;
    border-radius: 2mm;
  }

  .offer-result-meta small {
    font-size: 5.6pt;
  }

  .offer-result-meta strong {
    margin-top: .7mm;
    font-size: 6.7pt;
  }

  .room-book-item {
    padding: 2.3mm 0;
  }

  .room-book-title {
    gap: 4mm;
    font-size: 7pt;
  }

  .room-book-features {
    margin-top: 1mm;
    color: #65766f;
    font-size: 6.3pt;
    line-height: 1.35;
  }

  #bomPrintCard,
  #roomBookPrintCard {
    break-before: page;
    page-break-before: always;
  }
}


.work-rate-table td:first-child {
  min-width: 250px;
  font-weight: 800;
}

.work-rate-table input {
  min-width: 120px;
  text-align: right;
}

.work-rate-table td:last-child {
  min-width: 150px;
  color: var(--primary-dark);
}


.logic-mode-field {
  min-width: 210px;
}

.logic-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.logic-toolbar .summary-strip {
  margin: 0;
  flex: 1;
}

.logic-groups {
  display: grid;
  gap: 14px;
}

.logic-group {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.logic-group h3 {
  margin: 0;
  padding: 12px 14px;
  background: var(--soft);
  border-bottom: 1px solid var(--line);
  font-size: .95rem;
}

.logic-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .84rem;
}

.logic-table th,
.logic-table td {
  padding: 9px 10px;
  border-bottom: 1px solid #edf1f0;
  text-align: left;
  vertical-align: middle;
}

.logic-table tr:last-child td {
  border-bottom: 0;
}

.logic-table th {
  color: var(--muted);
  font-size: .72rem;
  text-transform: uppercase;
}

.logic-table input {
  min-width: 82px;
  max-width: 110px;
  padding: 7px 8px;
}

.logic-hours {
  white-space: nowrap;
  font-weight: 850;
  color: var(--primary-dark);
}

.logic-manual-note {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: .72rem;
}

.sub-cost {
  padding-left: 12px;
  color: var(--muted);
  font-size: .82rem;
}

@media (max-width: 760px) {
  .logic-toolbar {
    display: block;
  }
  .logic-toolbar button {
    width: 100%;
    margin-top: 10px;
  }
  .logic-mode-field {
    min-width: 0;
    margin-top: 12px;
  }
}


/* Paketauswahl und einklappbare Programmierleistungen */
.logic-card {
  padding: 0;
  overflow: hidden;
}

.logic-card > summary {
  list-style: none;
}

.logic-card > summary::-webkit-details-marker {
  display: none;
}

.logic-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px;
  cursor: pointer;
  background: #fff;
  transition: background .15s ease;
}

.logic-summary:hover {
  background: #f7faf9;
}

.logic-summary-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.logic-summary-copy strong {
  font-size: 1.06rem;
}

.logic-summary-copy small {
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.4;
}

.logic-summary-hours {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--primary-dark);
  white-space: nowrap;
  font-size: .8rem;
  font-weight: 850;
}

.logic-summary::after {
  content: "öffnen";
  color: var(--primary-dark);
  font-size: .76rem;
  font-weight: 850;
  white-space: nowrap;
}

.logic-card[open] .logic-summary::after {
  content: "schließen";
}

.logic-card[open] .logic-summary {
  border-bottom: 1px solid var(--line);
  background: var(--soft);
}

.logic-card-content {
  padding: 22px;
}

.logic-card-head {
  margin-bottom: 16px;
}

.result-head-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 9px;
}

.package-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 900;
  white-space: nowrap;
  border: 1px solid transparent;
}

.package-badge.basis {
  background: #eef1f2;
  color: #53615d;
  border-color: #d7dfdd;
}

.package-badge.komfort {
  background: #e5f5ee;
  color: var(--primary-dark);
  border-color: #c5e7db;
}

.package-badge.premium {
  background: #fff4d9;
  color: #7a5410;
  border-color: #ead6a3;
}

.package-badge.benutzer {
  background: #e9eef9;
  color: #314e86;
  border-color: #cbd6ee;
}

.package-btn.active-package {
  background: var(--primary);
  color: #fff;
}

@media (max-width: 760px) {
  .logic-summary {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .logic-summary::after {
    width: 100%;
  }
  .logic-summary-hours {
    margin-left: auto;
  }
  .result-head-meta {
    justify-content: flex-start;
    margin-top: 12px;
  }
}


/* Einheitliche aufklappbare Einstellungsbereiche */
.settings-card,
.catalog-card {
  padding: 0;
  overflow: hidden;
}

.logic-summary-hours {
  margin-left: auto;
}

.logic-summary::after {
  margin-left: 0;
  min-width: 58px;
  text-align: right;
}

.catalog-card .catalog-help {
  margin-top: 0;
}

.package-btn.active-package {
  background: var(--primary) !important;
  color: #fff !important;
  box-shadow: 0 0 0 2px rgba(7, 150, 127, .14);
}

.package-btn[aria-pressed="true"] {
  background: var(--primary) !important;
  color: #fff !important;
}


/* Einheitliche Spaltenbreiten für alle Tabellen der Zusatzprogrammierung */
.logic-table {
  table-layout: fixed;
  min-width: 820px;
}

.logic-table col.logic-col-function { width: 48%; }
.logic-table col.logic-col-minimum { width: 13%; }
.logic-table col.logic-col-maximum { width: 13%; }
.logic-table col.logic-col-quantity { width: 12%; }
.logic-table col.logic-col-hours { width: 14%; }

.logic-table th,
.logic-table td {
  box-sizing: border-box;
}

.logic-table th:nth-child(2),
.logic-table th:nth-child(3),
.logic-table th:nth-child(4),
.logic-table th:nth-child(5),
.logic-table td:nth-child(2),
.logic-table td:nth-child(3),
.logic-table td:nth-child(4),
.logic-table td:nth-child(5) {
  text-align: right;
}

.logic-table td:nth-child(4) input,
.logic-table td:nth-child(5) input {
  width: 100%;
  min-width: 0;
  max-width: none;
  text-align: right;
}

#resetRoomStandardBtn {
  border: 1px solid #c9d8d4;
}

#resetRoomStandardBtn:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
}


/* Globale und raumweise Paketauswahl */
.global-package-card {
  border-color: #c7ddd7;
  background:
    linear-gradient(135deg, rgba(7, 150, 127, .055), rgba(114, 211, 65, .035)),
    var(--surface);
}

.global-package-actions {
  align-items: center;
}

.global-package-btn {
  border: 1px solid #c9d8d4;
}

.global-package-btn.active-package,
.global-package-btn[aria-pressed="true"] {
  background: var(--primary) !important;
  color: #fff !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 2px rgba(7, 150, 127, .14);
}

#globalPackageStatus.gemischt {
  background: #f0edf8;
  color: #5a4385;
  border-color: #d8cfea;
}

@media (max-width: 760px) {
  .global-package-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .global-package-actions button {
    width: 100%;
  }
}


.side-action-link {
  display: block;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
  color: #fff;
  padding: 11px;
  border-radius: 10px;
  text-align: center;
  text-decoration: none;
  font-weight: 700;
}

.side-action-link:hover {
  background: rgba(255,255,255,.11);
}


/* Projektphasen und Ausführungsplanung */
.field-hint {
  display: block;
  min-height: 1.1em;
  color: var(--muted);
  font-size: .74rem;
  font-weight: 600;
  line-height: 1.35;
}

.phase-field {
  align-content: start;
}

#reserveField.phase-inactive {
  opacity: .62;
}

#reserveField.phase-inactive input {
  background: #eef2f1;
  cursor: not-allowed;
}

.phase-notice {
  margin-bottom: 16px;
  padding: 13px 15px;
  border: 1px solid #c8ddd7;
  border-radius: 11px;
  background: #f0f7f5;
  color: #37554e;
  font-size: .84rem;
  line-height: 1.5;
}

.phase-badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border: 1px solid #c9d8d4;
  border-radius: 999px;
  background: #f0f5f4;
  color: #37554e;
  font-size: .77rem;
  font-weight: 850;
}

.phase-badge.estimate {
  border-color: #efd49e;
  background: #fff7e8;
  color: #7c5212;
}

.phase-badge.execution {
  border-color: #b9d8cf;
  background: #e6f5f0;
  color: var(--primary-dark);
}

.execution-table {
  table-layout: fixed;
  min-width: 920px;
}

.execution-table th:first-child,
.execution-table td:first-child {
  width: 36%;
}

.execution-table th:not(:first-child),
.execution-table td:not(:first-child) {
  width: 16%;
  text-align: right;
}

.execution-table input {
  width: 100%;
  min-width: 105px;
  text-align: right;
}

.execution-row-total {
  white-space: nowrap;
  color: var(--primary-dark);
  font-weight: 900;
}

.execution-card.hidden,
.execution-result-card.hidden {
  display: none !important;
}

@media (max-width: 760px) {
  .phase-badge {
    margin-bottom: 7px;
  }
}


/* Vorplanung und Angebotsplanung */
.phase-service-card.hidden,
.phase-result-card.hidden {
  display: none !important;
}

.offer-data-grid textarea {
  min-height: 88px;
}

.offer-result-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.offer-result-meta > div {
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f5f8f7;
}

.offer-result-meta small {
  display: block;
  color: var(--muted);
  font-size: .72rem;
}

.offer-result-meta strong {
  display: block;
  margin-top: 4px;
  font-size: .9rem;
  white-space: pre-wrap;
}

.discount-row strong {
  color: #8a3434;
}

@media (max-width: 900px) {
  .offer-result-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .offer-result-meta {
    grid-template-columns: 1fr;
  }
}


/* Realistische Arbeitszeiten je System */
.work-rate-table {
  min-width: 1080px;
}

.work-rate-table th:nth-child(4),
.work-rate-table td:nth-child(4) {
  min-width: 235px;
}


/* Getrennte Systembezeichnung und Bauart */
.system-card .system-mode {
  display: block;
  margin-top: -3px;
  color: #506a63;
  font-size: .88rem;
  font-style: normal;
  font-weight: 800;
  line-height: 1.15;
}

.system-card .system-mode:empty,
.system-setting-label small:empty,
.system-table-label small:empty,
.comparison-system-mode:empty {
  display: none;
}

.system-setting-label,
.system-table-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.15;
}

.system-setting-label strong,
.system-table-label strong {
  font-size: .9rem;
}

.system-setting-label small,
.system-table-label small {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 750;
}

.comparison-system-label {
  min-height: 38px;
}

.comparison-system-name {
  display: block;
  color: var(--text);
  font-size: .88rem;
  font-weight: 850;
}

.comparison-system-mode {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 750;
}

.master-data-status {
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 9px;
  color: #bcd2cc;
  background: rgba(255,255,255,.035);
  font-size: .74rem;
  font-weight: 750;
  line-height: 1.35;
}

.master-data-status.active {
  border-color: rgba(114, 211, 65, .34);
  color: #d4edc7;
  background: rgba(114, 211, 65, .08);
}


/* Bedienstellen und projektweite Ausstattung */
.project-feature-group {
  border-color: #bcd8d0;
  background: linear-gradient(135deg, rgba(7,150,127,.045), rgba(114,211,65,.025));
}
.project-feature-group h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.project-feature-badge {
  padding: 4px 8px;
  border: 1px solid #bcd8d0;
  border-radius: 999px;
  color: var(--primary-dark);
  background: #eef8f5;
  font-size: .72rem;
  font-weight: 850;
}
.project-book-item { border-color: #bcd8d0; }


/* Raumflächensumme */

.summary-strip.area-match {
  background: #edf7e9;
  color: #2f6330;
}

.summary-strip.area-warning {
  background: #fff5df;
  color: #7a5415;
}


/* Firmendaten für den PDF Druck */
.print-document-header,
.print-document-footer {
  display: none;
}

.company-print-settings {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #f7faf9;
  overflow: hidden;
}

.company-print-settings > summary {
  list-style: none;
  cursor: pointer;
  padding: 13px 15px;
}

.company-print-settings > summary::-webkit-details-marker {
  display: none;
}

.company-print-settings > summary span {
  display: grid;
  gap: 3px;
}

.company-print-settings > summary strong {
  font-size: .9rem;
}

.company-print-settings > summary small {
  color: var(--muted);
  font-size: .77rem;
}

.company-print-settings > summary::after {
  content: "Angaben bearbeiten";
  float: right;
  margin-top: -28px;
  color: var(--primary-dark);
  font-size: .75rem;
  font-weight: 850;
}

.company-print-settings[open] > summary::after {
  content: "schließen";
}

.company-print-fields {
  padding: 0 15px 15px;
}

.company-print-fields textarea {
  min-height: 82px;
}
