/* Reformas Brétema: herramienta de oficina técnica. Menú lateral oscuro,
   esquinas casi rectas, letra técnica y mucha información a la vista.
   El presupuesto se ve como un documento en papel. */
:root {
  --primario: #0f766e;
  --primario-texto: #ffffff;
  --pizarra: #10201f;
  --fondo: #eef1f1;
  --borde: #d5dcdc;
  --radio: 4px;
  --radio-sm: 3px;
  --fuente: "Bahnschrift", "DIN Alternate", "Segoe UI", "Roboto Condensed", "Arial Narrow", system-ui, sans-serif;
  --fuente-titulos: var(--fuente);
}
@media (prefers-color-scheme: dark) {
  :root { --primario: #2bb3a6; --primario-texto: #04201d; --pizarra: #081211; --fondo: #0d1314; --borde: #26302f; }
}
body { font-size: 14.5px; }
h1 { font-size: 1.45rem; font-weight: 700; letter-spacing: -.01em; }
.kpi-titulo, .tabla th { text-transform: uppercase; letter-spacing: .06em; font-size: .7rem; }
.kpi-valor { font-size: 1.45rem; }
.tarjeta { box-shadow: none; }
.rejilla-kpi .tarjeta { border-left: 3px solid var(--primario); }
.tabla tbody tr:nth-child(even) td { background: var(--superficie-2); }
.btn { border-radius: var(--radio-sm); }

/* ---------- Menú lateral en escritorio ---------- */
@media (min-width: 900px) {
  .app-barra { position: fixed; inset: 0 auto 0 0; width: 232px; background: var(--pizarra); color: #e6eeed; border: 0; }
  .app-barra-dentro { height: 100%; display: flex; flex-direction: column; align-items: stretch; gap: 18px; padding: 18px 14px; max-width: none; }
  .app-logo { border-radius: 4px; }
  .app-tipo { color: #8fa5a3; }
  .app-acciones { order: 3; margin-top: auto; flex-direction: column; }
  .app-acciones .btn { justify-content: flex-start; color: #b7c8c6; width: 100%; }
  .app-acciones .btn-icono::after { content: "Restablecer demo"; font-size: .85rem; }
  .app-acciones .btn-icono { width: 100%; padding: 0 14px; gap: 7px; }
  .app-acciones .btn:hover { background: rgb(255 255 255 / .06); }
  .pestanas { order: 2; flex-direction: column; margin: 0; gap: 2px; }
  .pestanas a { color: #b7c8c6; border: 0; border-radius: 3px; padding: 10px 12px; border-left: 3px solid transparent; }
  .pestanas a:hover { background: rgb(255 255 255 / .05); color: #fff; }
  .pestanas a[aria-current="page"] { background: rgb(43 179 166 / .14); color: #fff; border-left-color: #2bb3a6; }
  .contenido { margin-left: 232px; max-width: 1240px; padding: 26px 32px 120px; }
}
@media (max-width: 899px) {
  .app-barra { background: var(--pizarra); color: #e6eeed; border: 0; }
  .app-tipo { color: #8fa5a3; }
  .app-barra .btn-fantasma { color: #b7c8c6; }
  .pestanas a { color: #b7c8c6; }
  .pestanas a[aria-current="page"] { color: #fff; border-bottom-color: #2bb3a6; }
}

.texto-peligro { color: var(--peligro); }
.texto-ok { color: var(--ok); }
.alerta-caja { display: flex; gap: 10px; align-items: flex-start; background: var(--aviso-fondo); color: var(--aviso); border-left: 4px solid var(--aviso); padding: 12px 14px; margin-bottom: 16px; font-size: .9rem; }
.alerta-caja a { color: inherit; font-weight: 700; }
.fila-enlace { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px; margin: 0 -10px; color: inherit; text-decoration: none; border-bottom: 1px solid var(--borde); }
.fila-enlace:last-child { border-bottom: 0; }
.fila-enlace:hover { background: var(--superficie-2); }
.fila-enlace .progreso { display: block; }
.progreso { height: 6px; border-radius: 0; }
.progreso > span { border-radius: 0; }
.obra-tarjeta { display: grid; gap: 8px; color: inherit; text-decoration: none; border-top: 3px solid var(--primario); }
.obra-tarjeta:hover { background: var(--superficie-2); }

/* ---------- Presupuesto: hoja de papel ---------- */
.hoja { max-width: 860px; margin: 0 auto; padding: 36px 40px; background: #fff; color: #1b2322; box-shadow: 0 1px 3px rgb(0 0 0 / .08), 0 10px 30px rgb(16 32 31 / .1); border: 0;
  --superficie: #fff; --superficie-2: #f4f7f7; --borde: #dde3e3; --texto: #1b2322; --texto-2: #4f5c5b; --texto-3: #7a8786; }
@media (max-width: 599px) { .hoja { padding: 20px 16px; margin: 0 -4px; } }
.hoja .solo-imprimir { display: block; }
.membrete { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; padding-bottom: 16px; border-bottom: 3px solid #0f766e; font-size: .9rem; }
.membrete-marca { display: flex; gap: 12px; align-items: center; }
.membrete .app-logo { background: #0f766e; color: #fff; border-radius: 4px; }
.membrete-tipo { text-transform: uppercase; letter-spacing: .14em; font-size: .72rem; color: #0f766e; font-weight: 700; }
.cliente-bloque { margin-bottom: 12px; padding: 10px 12px; background: #f4f7f7; border-left: 3px solid #0f766e; }
.partidas td { vertical-align: middle; }
.partidas thead th { border-bottom: 2px solid #1b2322; }
.entrada-num { width: 84px; min-height: 34px; padding: 4px 8px; text-align: right; background: #fff; color: #1b2322; }
.entrada-iva { width: auto; min-height: 30px; padding: 2px 6px; margin-left: 6px; font-size: .82rem; background: #fff; color: #1b2322; }
.hoja select.entrada { background: #fff; color: #1b2322; }
.totales { margin: 18px 0 0 auto; width: min(100%, 360px); display: grid; gap: 6px; }
.totales > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.total-final { border-top: 3px solid #1b2322; padding-top: 8px; font-size: 1.25rem; }

.fases { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; counter-reset: fase; }
.fases li { border-bottom: 1px solid var(--borde); }
.fases li:last-child { border-bottom: 0; }
.fases label { display: flex; gap: 10px; align-items: center; padding: 11px 6px; cursor: pointer; }
.fases label::before { counter-increment: fase; content: counter(fase, decimal-leading-zero); font-variant-numeric: tabular-nums; color: var(--texto-3); font-size: .8rem; width: 22px; }
.fases label:hover { background: var(--superficie-2); }
.fases input { width: 20px; height: 20px; accent-color: var(--primario); }
.fases input:checked + span { text-decoration: line-through; color: var(--texto-3); }

@media print {
  .contenido { margin-left: 0 !important; }
  .hoja { box-shadow: none; padding: 0; max-width: none; }
  .entrada-num { border: 0; padding: 0; width: auto; }
}
