.module-card {
  min-width: 0;
}
.module-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 4px;
  margin: 18px 0;
}
.module-tabs button {
  min-height: 48px;
  white-space: normal;
}
.module-panel {
  min-width: 0;
}
.module-fields {
  margin: 14px 0;
}
.module-fields .field {
  min-width: 0;
}
.module-fields input,
.module-fields select {
  width: 100%;
}
.module-fields input[type="checkbox"] {
  width: 20px;
  height: 20px;
}
.module-table {
  margin: 14px 0;
}
.module-table th {
  white-space: nowrap;
}
.module-table td input:not([type="checkbox"]),
.module-table td select {
  min-width: 100px;
  width: 100%;
}
.module-table td:first-child input {
  min-width: 170px;
}
.module-table input[type="checkbox"] {
  width: 18px;
  height: 18px;
}
.module-details {
  margin: 14px 0;
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 9px;
}
.module-details summary {
  font-weight: 600;
  cursor: pointer;
}
.module-details[open] > summary {
  margin-bottom: 14px;
}
.module-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding: 18px 0;
  border-top: 1px solid var(--border);
  margin-top: 20px;
}
.module-totals span {
  color: var(--text-mute);
}
.module-totals strong {
  display: block;
  color: var(--text);
  margin-top: 6px;
}
.module-totals span:last-child strong {
  color: var(--gold);
}
.roof-grid {
  width: 100%;
  max-height: 540px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: crosshair;
  touch-action: manipulation;
}
.roof-grid .grid-line {
  stroke: var(--border);
  stroke-width: 0.02;
}
.roof-grid .roof-marker {
  stroke: var(--gold);
  stroke-width: 0.12;
}
.roof-grid text {
  fill: var(--text);
  font-size: 0.35px;
}
.roof-grid circle {
  fill: var(--gold);
  cursor: pointer;
}
.truss-diagram {
  width: 100%;
  height: 210px;
  background: var(--bg);
  border-radius: 8px;
  margin: 14px 0;
}
.truss-diagram line {
  stroke: var(--steel);
  stroke-width: 0.04;
}
.truss-diagram line.main {
  stroke: var(--gold);
  stroke-width: 0.065;
}
.cost-chain {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 20px;
}
.cost-chain dl {
  margin: 0;
}
.cost-chain .cost-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 15px 0;
  border-bottom: 1px solid var(--border);
}
.cost-chain dt {
  font-weight: 600;
}
.cost-chain dd {
  margin: 0;
  text-align: right;
  font-weight: 700;
}
.cost-chain .grand-total {
  border: 0;
  padding: 26px 0;
  font-size: 1.4em;
}
.cost-chain .grand-total dd {
  color: var(--gold);
}
.cost-chain .per-sqm {
  text-align: right;
  color: var(--text-mute);
}
@media (max-width: 600px) {
  .module-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .cost-chain {
    padding: 8px 12px;
  }
  .cost-chain .grand-total {
    font-size: 1.1em;
  }
}
@media print {
  .module-tabs,
  .module-details:not([open]) {
    display: none;
  }
  .module-totals,
  .cost-chain {
    break-inside: avoid;
  }
}
