/* ===================================================
   Widy — plantilla de presupuesto de reforma
   Se apoya en /diseno-web/web.css y /herramientas/herramientas.css
   =================================================== */
.pr-grid { grid-template-columns: 1fr; max-width: 1060px; margin: 0 auto; }
.pr-out { position: static; display: grid; grid-template-columns: 1fr 320px; gap: 8px 36px; align-items: start; }
.pr-out-btns .btn:first-child { margin-top: 0; }
.pr-span2 { grid-column: 1 / -1; }
.fc-f small { font-weight: 500; color: var(--tx2); font-size: .9rem; }
.fc-f input[type="file"] { font-size: .98rem; padding: 12px; min-height: 0; }
.fc-f input[type="date"] { min-height: 56px; }
.pr-form .fc-f textarea { font-family: inherit; font-size: 1rem; line-height: 1.5; background: var(--sf); }

/* Partidas */
.pr-head, .pr-lin { display: grid; grid-template-columns: minmax(0, 1fr) 74px 80px 96px 124px 104px 36px; gap: 8px; align-items: center; }
.pr-head { font-size: .82rem; font-weight: 700; color: var(--tx2); text-transform: uppercase; letter-spacing: .04em; padding: 0 2px 6px; }
.pr-head span:nth-child(n+3):nth-child(-n+6) { text-align: right; }
.pr-head span:nth-child(5) { text-align: left; }
.pr-lines { display: grid; gap: 8px; }
.pr-line input, .pr-line select { width: 100%; font: inherit; font-size: 1rem; padding: 10px 11px; min-height: 48px; border: 2px solid var(--ln); border-radius: 12px; background: var(--sf); color: var(--tx); }
.pr-line select { padding-right: 6px; }
.pr-line input:focus, .pr-line select:focus { outline: none; border-color: var(--ln2); box-shadow: 0 0 0 4px rgba(0,0,0,.08); }
.pr-q, .pr-p { text-align: right; font-variant-numeric: tabular-nums; }
.pr-imp, .pr-sub { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; font-size: .98rem; }
.pr-cap { display: grid; grid-template-columns: minmax(0, 1fr) 140px 36px; gap: 8px; align-items: center; margin-top: 10px; }
.pr-cap:first-child { margin-top: 0; }
.pr-cap .pr-t { font-weight: 800; background: var(--sf2); }
.pr-del { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--ln); background: transparent; color: var(--tx2); font-size: 1.25rem; line-height: 1; cursor: pointer; }
.pr-del:hover { border-color: var(--ln2); color: var(--tx); }
.pr-add { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.pr-cond { margin-top: 14px; }

/* Resumen */
.pr-total-row strong { font-size: 1.5rem; }
.pr-aviso { margin: 12px 0 4px; padding: 12px 14px; border-radius: 14px; border: 1px solid rgba(245, 158, 11, .55); background: rgba(245, 158, 11, .12); color: var(--tx); font-size: .96rem; line-height: 1.45; }
.pr-aviso[hidden] { display: none; }

/* Documento (papel) */
.pr-paper-wrap { max-width: 880px; margin: 26px auto 0; overflow-x: auto; }
.pr-doc { background: #fff; color: #16161a; border-radius: 8px; box-shadow: 0 30px 70px -40px rgba(0,0,0,.6); padding: 48px 52px; font-size: 14px; line-height: 1.45; min-width: 620px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.pr-doc p { margin: 0; color: inherit; }
.pr-d-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; padding-bottom: 20px; border-bottom: 2px solid #16161a; }
.pr-d-emp img { display: block; max-height: 64px; max-width: 200px; object-fit: contain; margin-bottom: 10px; }
.pr-d-emp strong { display: block; font-size: 17px; margin-bottom: 4px; }
.pr-d-emp p { color: #55555f; font-size: 13px; }
.pr-d-meta { text-align: right; font-size: 13px; color: #55555f; }
.pr-d-meta strong { color: #16161a; }
.pr-d-tit { font-size: 24px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #16161a !important; margin-bottom: 6px !important; }
.pr-d-cli { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 20px 0; }
.pr-d-cli > div { background: #f4f4f6; border-radius: 8px; padding: 12px 14px; }
.pr-d-cli span { display: block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #6b6b76; margin-bottom: 2px; }
.pr-d-cli strong { font-size: 15px; }
.pr-d-cli p { color: #55555f; font-size: 13px; }
.pr-d-tab { width: 100%; border-collapse: collapse; font-size: 13px; }
.pr-d-tab th { background: #16161a; color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; text-align: left; padding: 8px 10px; }
.pr-d-tab td { padding: 8px 10px; border-bottom: 1px solid #e4e4e8; vertical-align: top; }
.pr-d-tab .n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pr-d-tab .c { text-align: center; white-space: nowrap; }
.pr-d-tab tr { break-inside: avoid; }
.pr-d-cap td { background: #f4f4f6; font-weight: 800; border-bottom-color: #d6d6dc; }
.pr-d-n { display: inline-block; min-width: 30px; color: #6b6b76; font-variant-numeric: tabular-nums; }
.pr-d-vacio { text-align: center; color: #6b6b76; padding: 22px 10px !important; }
.pr-d-tot { width: 300px; margin: 16px 0 0 auto; font-size: 14px; break-inside: avoid; }
.pr-d-tot p { display: flex; justify-content: space-between; padding: 6px 0; font-variant-numeric: tabular-nums; }
.pr-d-total { border-top: 2px solid #16161a; margin-top: 4px !important; padding-top: 10px !important; font-size: 18px; font-weight: 800; }
.pr-d-nota { font-size: 12px; color: #55555f !important; margin-top: 12px !important; }
.pr-d-cond { margin-top: 22px; display: grid; gap: 6px; font-size: 13px; break-inside: avoid; }
.pr-d-firma { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 44px; break-inside: avoid; }
.pr-d-firma div { padding-bottom: 64px; border-bottom: 1.5px solid #16161a; }
.pr-d-firma span { font-size: 12px; color: #55555f; }
#prPrint { display: none; }

@media (max-width: 900px) {
  .pr-out { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .pr-head { display: none; }
  .pr-lin { grid-template-columns: 1fr 1fr 1fr 36px; grid-template-areas: "c c c d" "u q p p" "k k i i"; padding: 10px; border: 1px solid var(--ln); border-radius: 14px; }
  .pr-lin .pr-c { grid-area: c; } .pr-lin .pr-u { grid-area: u; } .pr-lin .pr-q { grid-area: q; } .pr-lin .pr-p { grid-area: p; }
  .pr-lin .pr-k { grid-area: k; } .pr-lin .pr-imp { grid-area: i; } .pr-lin .pr-del { grid-area: d; justify-self: end; }
  .pr-cap { grid-template-columns: minmax(0, 1fr) auto 36px; }
  .pr-doc { padding: 30px 26px; }
}

@media print {
  @page { size: A4; margin: 14mm 13mm; }
  html.imprimiendo-presupuesto, body.imprimiendo-presupuesto { background: #fff !important; color-scheme: light !important; }
  body.imprimiendo-presupuesto::before, body.imprimiendo-presupuesto::after { display: none !important; }
  body.imprimiendo-presupuesto > *:not(#prPrint) { display: none !important; }
  body.imprimiendo-presupuesto #prPrint { display: block !important; background: #fff; }
  #prPrint .pr-doc { box-shadow: none; border-radius: 0; padding: 0; min-width: 0; font-size: 12.5px; }
}
