:root {
  --text: #1f2833;
  --muted: #6a7480;
  --border: #d9dde2;
  --accent: #2f6fd6;
  --bg: #f4f5f7;
  --equipo: #2f7bd6;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
}

.cabecera {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 28px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.cabecera h1 {
  margin: 0;
  font-size: 22px;
}

.cabecera p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.acciones {
  display: flex;
  gap: 10px;
  align-items: center;
}

.cabecera .version-desc {
  color: var(--accent);
  font-weight: 600;
}

.versiones {
  display: flex;
}

.versiones button {
  border-radius: 0;
  color: var(--muted);
}

.versiones button:first-child {
  border-radius: 8px 0 0 8px;
}

.versiones button:last-child {
  border-radius: 0 8px 8px 0;
  border-left: none;
}

.versiones button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.acciones a,
button {
  font: inherit;
  font-size: 14px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
}

.indice {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  padding: 10px 28px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.indice a {
  color: var(--accent);
  text-decoration: none;
}

main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px 28px 60px;
}

section {
  margin-top: 26px;
}

h2 {
  font-size: 19px;
  margin: 0 0 8px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--border);
}

h3 {
  font-size: 15px;
  margin: 18px 0 6px;
}

h3 small {
  color: var(--muted);
  font-weight: 400;
}

.nota {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.avisos {
  padding: 10px 14px;
  border: 1px solid #e0a35a;
  background: #fff6ea;
  color: #8a3b00;
  border-radius: 8px;
  font-size: 14px;
}

.avisos[hidden] {
  display: none;
}

/* Resumen */
.resumen {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
  min-width: 120px;
}

.card b {
  display: block;
  font-size: 22px;
}

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

.card.wide b {
  color: var(--accent);
}

.planchas-resumen {
  flex-basis: 100%;
  margin: 2px 0 0;
}

/* Láminas */
.laminas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(520px, 1fr));
  gap: 14px;
  margin-top: 10px;
}

.lamina,
.hoja {
  margin: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
}

.lamina--planta {
  max-width: 720px;
}

figcaption {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
}

.plano {
  width: 100%;
  height: auto;
  display: block;
}

.plano .muro {
  fill: #eceae4;
  stroke: #9aa1a8;
  stroke-width: 4;
}
.plano .vacio {
  fill: #f7f8fa;
  stroke: #c3c8ce;
  stroke-width: 3;
  stroke-dasharray: 20 14;
}
.plano .columna {
  fill: #e6a2aa;
  stroke: #b45a65;
  stroke-width: 4;
}
.plano .piso {
  fill: #f7f7f5;
}
.plano .ventana {
  fill: #dcebf3;
  stroke: #7d97a6;
  stroke-width: 5;
}
.plano .losa,
.plano .losa-planta {
  fill: #e3e6e8;
  stroke: #7c858f;
  stroke-width: 4;
}
.plano .lavadero {
  fill: #c9ced3;
  stroke: #6c757e;
  stroke-width: 4;
}
.plano .libre {
  fill: none;
  stroke: #9aa1a8;
  stroke-width: 3;
  stroke-dasharray: 16 12;
}
.plano .equipo-fijo {
  fill: #d6d9dc;
  stroke: #6c757e;
  stroke-width: 4;
}
.plano .mod {
  fill: #ffffff;
  stroke: #26303a;
  stroke-width: 6;
}
.plano .mod-bajo {
  fill: #f1f2f3;
}
.plano .mod-int {
  fill: #e4e7ea;
  stroke: #26303a;
  stroke-width: 2;
}
.plano .repisa {
  fill: #ffffff;
  stroke: #26303a;
  stroke-width: 2;
}
.plano .repisa-oculta {
  stroke: #26303a;
  stroke-width: 3;
  stroke-dasharray: 18 12;
}
.plano .puerta,
.plano .tapa {
  fill: rgba(255, 255, 255, 0.55);
  stroke: #26303a;
  stroke-width: 4;
}
.plano .tapa {
  fill: #f0f1f2;
}
.plano .apertura {
  fill: none;
  stroke: #6c757e;
  stroke-width: 3;
  stroke-dasharray: 14 10;
}
.plano .tirador {
  stroke: #26303a;
  stroke-width: 12;
  stroke-linecap: round;
}
.plano .mod-alto-planta {
  fill: rgba(47, 111, 214, 0.04);
  stroke: #26303a;
  stroke-width: 5;
  stroke-dasharray: 26 16;
}
.plano .equipo {
  fill: rgba(47, 123, 214, 0.14);
  stroke: var(--equipo);
  stroke-width: 4;
  stroke-dasharray: 14 10;
}
.plano .marco {
  fill: none;
  stroke: #4b545e;
  stroke-width: 5;
}
.plano .cota {
  stroke: #c0392b;
  stroke-width: 3;
}
.plano .guia {
  stroke: #c0392b;
  stroke-width: 1.5;
  stroke-dasharray: 8 10;
  opacity: 0.45;
}
.plano text {
  font-family: system-ui, sans-serif;
}
.plano .tc,
.plano .tn {
  font-size: 50px;
  fill: #c0392b;
  text-anchor: middle;
  font-weight: 600;
}
.plano .tn {
  font-size: 36px;
  text-anchor: start;
  opacity: 0.8;
}
.plano .tnota {
  font-size: 46px;
  fill: #5c6670;
  text-anchor: middle;
}
.plano .tequipo {
  font-size: 40px;
  fill: var(--equipo);
  text-anchor: middle;
  font-weight: 600;
}
.plano .apoyo {
  fill: #fff;
  stroke: #26303a;
  stroke-width: 6;
}
.plano .apoyo-tubo {
  fill: #9aa3ad;
}
.plano .tapoyo {
  font-size: 40px;
  font-weight: 700;
  fill: #26303a;
}
.plano .tlado {
  font-size: 54px;
  fill: #3b4652;
  text-anchor: middle;
  font-weight: 600;
}
.plano .id-bg {
  fill: #26303a;
}
.plano .id-alto {
  fill: #2f6fd6;
}
.plano .tid {
  font-size: 58px;
  fill: #fff;
  text-anchor: middle;
  font-weight: 700;
}
.plano .plancha {
  fill: #f6f1e7;
  stroke: #9b8f78;
  stroke-width: 6;
}
.plano .pieza {
  fill: #ffffff;
  stroke: #26303a;
  stroke-width: 4;
}
.plano .pieza-mdf {
  fill: #f2f2ef;
}
.plano .tpieza {
  fill: #26303a;
  text-anchor: middle;
}

.hojas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 14px;
}

/* Tablas */
.tabla {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 13px;
  border: 1px solid var(--border);
}

th,
td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  background: #f0f2f5;
  font-weight: 600;
  white-space: nowrap;
}

td.n {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.sub {
  color: var(--muted);
  font-size: 12px;
}

.presupuesto input {
  width: 90px;
  font: inherit;
  text-align: right;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

tfoot td {
  font-weight: 600;
  background: #fafbfc;
}

tfoot .total td {
  font-size: 16px;
  color: var(--accent);
}

.estado {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 8px;
  white-space: nowrap;
}
.estado--consultado {
  background: #e3f4ea;
  color: #23784a;
}
.estado--referencial {
  background: #e6eefb;
  color: #2557a8;
}
.estado--estimado {
  background: #fdf0de;
  color: #a35f0c;
}

.opciones {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  align-items: center;
  margin: 6px 0 12px;
  font-size: 14px;
}

.notas {
  font-size: 14px;
  line-height: 1.55;
  padding-left: 20px;
}

.notas li {
  margin-bottom: 6px;
}

@media print {
  body {
    background: #fff;
  }
  .indice,
  .acciones,
  .opciones button {
    display: none;
  }
  main {
    max-width: none;
    padding: 0 10px;
  }
  .lamina,
  .hoja,
  table {
    break-inside: avoid;
  }
  .laminas {
    grid-template-columns: 1fr;
  }
  .presupuesto input {
    border: 0;
  }
}
