/* presupuestos.hacelo.app · mismos tokens que fotos.hacelo.app */
:root {
  --night: #062B3D;
  --night-2: #0D3A50;
  --bg: #F4F6F9;
  --surface: #FFFFFF;
  --accent: #FF640D;
  --accent-ink: #C2410C;
  --accent-deep: #9A3412;
  --accent-soft: #FFEDD5;
  --muted: #5B6577;
  --on-night: #B9CDD8;
  --line: #E2E8F0;
  --line-strong: #CBD5E1;
  --wa: #25D366;
  --wa-ink: #08341B;
  --mp: #009EE3;
  --ok: #15803D;
  --ok-soft: #DCFCE7;
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --r: 16px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--bg); color: var(--night); font-family: var(--font); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent-ink); }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

/* Encabezado */
.top { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.94); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.top .in { max-width: 760px; margin: 0 auto; padding: 0 16px; min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.01em; color: var(--night); text-decoration: none; }
.brand img { width: 34px; height: 34px; border-radius: 10px; }
.brand b { color: var(--accent); }
.brand small { display: block; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-top: -2px; }
.main { max-width: 760px; margin: 0 auto; padding: 16px 16px 140px; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); font-weight: 700; cursor: pointer; text-decoration: none; color: var(--night); }
.btn:hover { border-color: var(--night); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--night); }
.btn.primary:hover { background: #ff7a2f; }
.btn.dark { background: var(--night); border-color: var(--night); color: #fff; }
.btn.mp { background: var(--mp); border-color: var(--mp); color: #fff; }
.btn.wa { background: var(--wa); border-color: var(--wa); color: var(--wa-ink); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { min-height: 38px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn.block { width: 100%; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > .grow { flex: 1 1 auto; }

/* Tarjetas */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin: 12px 0; }
.card h2 { font-size: 18px; margin: 0 0 4px; letter-spacing: -.01em; }
.card h3 { font-size: 15px; margin: 16px 0 8px; }
.hint { color: var(--muted); font-size: 14px; margin: 0 0 12px; }
.tag { display: inline-block; font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; background: var(--bg); color: var(--muted); }
.tag.borrador { background: #EEF2F6; }
.tag.enviado { background: #E0F2FE; color: #075985; }
.tag.confirmado { background: var(--ok-soft); color: var(--ok); }
.tag.archivado { background: #F1F5F9; color: #94A3B8; }
.tag.pagado { background: var(--ok-soft); color: var(--ok); }
.tag.informado { background: var(--accent-soft); color: var(--accent-deep); }
.tag.pendiente { background: #F1F5F9; }

/* Héroe del presupuesto */
.hero { background: var(--night); color: #fff; border-radius: 20px; padding: 22px; position: relative; overflow: hidden; }
.hero::after { content: ''; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border: 10px solid var(--accent); border-radius: 36px; opacity: .14; transform: rotate(18deg); }
.hero .kicker { color: var(--accent); font-weight: 800; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
.hero h1 { font-size: 26px; line-height: 1.15; margin: 6px 0 10px; letter-spacing: -.02em; }
.hero .meta { color: var(--on-night); font-size: 15px; display: grid; gap: 2px; }
.hero .meta b { color: #fff; font-weight: 700; }
.hero .vig { margin-top: 14px; display: inline-block; font-size: 13px; font-weight: 700; background: rgba(255,255,255,.1); padding: 5px 10px; border-radius: 999px; }

/* Ítems */
.items { list-style: none; margin: 0; padding: 0; }
.item { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: start; padding: 12px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item .ic { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; background: var(--ok-soft); color: var(--ok); font-weight: 900; font-size: 14px; margin-top: 1px; }
.item .n { font-weight: 700; line-height: 1.3; }
.item .d { color: var(--muted); font-size: 14px; margin-top: 2px; }
.item .p { font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.item .p.cero { color: var(--ok); font-size: 14px; }
.item.off .n, .item.off .p { color: #94A3B8; }

/* Interruptor */
.sw { position: relative; width: 46px; height: 28px; flex: none; }
.sw input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.sw span { position: absolute; inset: 0; background: var(--line-strong); border-radius: 999px; transition: background .15s; pointer-events: none; }
.sw span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.sw input:checked + span { background: var(--accent); }
.sw input:checked + span::after { transform: translateX(18px); }
.sw input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.item.opt { grid-template-columns: 1fr auto; }
.item.opt .der { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }

/* Planes de pago */
.planes { display: grid; gap: 10px; }
.plan { display: block; border: 2px solid var(--line); border-radius: 14px; padding: 14px; cursor: pointer; position: relative; }
.plan input[type=radio] { position: absolute; opacity: 0; }
.plan:has(input:checked) { border-color: var(--accent); background: #FFF8F3; }
.plan:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.plan .t { font-weight: 800; }
.plan .s { color: var(--muted); font-size: 14px; }
.plan .ahorro { display: inline-block; margin-top: 6px; background: var(--ok-soft); color: var(--ok); font-weight: 800; font-size: 13px; padding: 2px 8px; border-radius: 999px; }
.plan select { margin-top: 8px; min-height: 40px; border-radius: 10px; border: 1px solid var(--line-strong); padding: 0 10px; background: #fff; }
.crono { list-style: none; margin: 10px 0 0; padding: 0; font-size: 14px; }
.crono li { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; border-top: 1px dashed var(--line); }
.crono li:first-child { border-top: 0; }

/* Total fijo abajo */
.bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--night); color: #fff; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 24px rgba(6,43,61,.18); }
.bar .in { max-width: 760px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bar .lbl { color: var(--on-night); font-size: 13px; font-weight: 600; }
.bar .tot { font-size: 24px; font-weight: 800; letter-spacing: -.01em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.bar .tot s { font-size: 14px; color: var(--on-night); font-weight: 600; margin-right: 6px; }

/* Formularios */
.field { display: grid; gap: 6px; margin: 10px 0; }
.field label, .lbl2 { font-weight: 700; font-size: 14px; }
.field input, .field select, .field textarea, .inp { width: 100%; min-height: 46px; border: 1px solid var(--line-strong); border-radius: 12px; padding: 10px 12px; background: #fff; }
.field textarea { min-height: 90px; resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; margin: 12px 0; }
.check input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--accent); }
.err { color: #B91C1C; font-weight: 700; font-size: 14px; }
.okmsg { background: var(--ok-soft); color: var(--ok); border-radius: 12px; padding: 12px 14px; font-weight: 700; }
.aviso { background: var(--accent-soft); color: var(--accent-deep); border-radius: 12px; padding: 12px 14px; font-weight: 600; font-size: 14px; }
details.cond summary { cursor: pointer; font-weight: 800; }
details.cond ul { padding-left: 18px; color: var(--muted); font-size: 14px; }
.copybox { display: flex; gap: 8px; align-items: center; background: var(--bg); border-radius: 12px; padding: 10px 12px; font-family: var(--mono); font-weight: 600; }
.copybox span { flex: 1; overflow-wrap: anywhere; }

/* Pagos (cliente y panel) */
.pagos { list-style: none; margin: 0; padding: 0; }
.pagos li { border-top: 1px solid var(--line); padding: 12px 0; display: grid; gap: 8px; }
.pagos li:first-child { border-top: 0; }
.pagos .l1 { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.pagos .c { font-weight: 700; }
.pagos .v { color: var(--muted); font-size: 13px; }

/* Pie */
.pie { text-align: center; color: var(--muted); font-size: 13px; margin: 28px 0 0; }

/* Tarjeta para exportar como imagen (se dibuja fuera de pantalla) */
.export-host { position: fixed; left: -10000px; top: 0; }
.ex { width: 420px; background: var(--bg); padding: 16px; font-family: var(--font); color: var(--night); }
.ex .hero h1 { font-size: 24px; }
.ex .card { margin: 10px 0; padding: 14px 16px; }
.ex .exnota { font-size: 12px; color: var(--muted); text-align: center; margin-top: 10px; }
.ex .extot { background: var(--night); color: #fff; border-radius: 16px; padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.ex .extot b { font-size: 22px; }
.ex .badge-opc { font-size: 11px; font-weight: 800; color: var(--accent-ink); text-transform: uppercase; letter-spacing: .05em; }

/* Panel */
.tabs { display: flex; gap: 4px; background: #E9EEF3; padding: 4px; border-radius: 14px; margin: 4px 0 12px; }
.tabs button { flex: 1; min-height: 42px; border: 0; background: transparent; border-radius: 10px; font-weight: 800; cursor: pointer; color: var(--muted); }
.tabs button[aria-selected=true] { background: #fff; color: var(--night); box-shadow: 0 1px 3px rgba(6,43,61,.12); }
.lista { display: grid; gap: 10px; }
.pp { display: grid; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; cursor: pointer; text-align: left; width: 100%; }
.pp:hover { border-color: var(--night); }
.pp .l1 { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.pp .cl { font-weight: 800; }
.pp .ev { color: var(--muted); font-size: 14px; }
.pp .num { font-weight: 800; }
.ed-item { border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin: 10px 0; display: grid; gap: 8px; }
.ed-item .row input[type=text] { flex: 1 1 200px; }
.ed-item .precio { width: 130px; }
.ed-item textarea { width: 100%; min-height: 54px; border: 1px solid var(--line-strong); border-radius: 10px; padding: 8px 10px; font-size: 14px; resize: vertical; }
.ed-item select { min-height: 42px; border: 1px solid var(--line-strong); border-radius: 10px; padding: 0 8px; background: #fff; }
.ed-item.quitado { opacity: .5; }
.mini { font-size: 13px; color: var(--muted); }
.kv { display: grid; grid-template-columns: 1fr 150px; gap: 8px 12px; align-items: center; }
.kv label { font-size: 14px; font-weight: 600; }
.kv input { min-height: 42px; border: 1px solid var(--line-strong); border-radius: 10px; padding: 0 10px; text-align: right; width: 100%; }
.kv .sub { grid-column: 1 / -1; font-weight: 800; margin-top: 10px; font-size: 14px; color: var(--accent-ink); text-transform: uppercase; letter-spacing: .05em; }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--night); color: #fff; padding: 10px 16px; border-radius: 12px; font-weight: 700; z-index: 99; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: 90vw; }
.login { max-width: 380px; margin: 12vh auto 0; }
.stickyacts { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 18px 0 calc(12px + env(safe-area-inset-bottom)); display: flex; gap: 8px; z-index: 5; }
.stickyacts .btn { flex: 1 1 0; }
.acts { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 8px; }
