/* Portal DSS — cambia los colores de marca aquí */
:root {
  --ink: #1B1022; --brand: #3A2150; --brand-2: #5B3A78; --tint: #F1ECF6;
  --bg: #F7F5F9; --card: #fff; --line: #E3DCEB; --text: #1B1022; --muted: #655A70;
  --ok: #1F7A4D; --bad: #B3261E; --radius: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--brand-2); }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 .3rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 0; }
h3 { margin: 0 0 .5rem; }
small { color: var(--muted); display: block; font-size: .8rem; }
code { background: var(--tint); padding: .1em .35em; border-radius: 4px; }
[hidden] { display: none !important; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.wrap.wide { max-width: 1200px; }
main.wrap { padding-top: 24px; padding-bottom: 48px; min-height: 70vh; }
.narrow { max-width: 440px; margin-left: auto; margin-right: auto; }
.muted { color: var(--muted); font-size: .9rem; }

.top { background: var(--ink); color: #fff; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; letter-spacing: .06em; font-size: .85rem; }
.brand img { height: 34px; width: auto; filter: brightness(0) invert(1); }
.brand img + span { display: none; }
.brand sup { font-size: .6em; }
.top nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: .9rem; }
.top nav a { color: #E9E1F1; text-decoration: none; }
.top nav a:hover { color: #fff; text-decoration: underline; }
.top nav .pill { background: #fff; color: var(--ink); padding: 5px 12px; border-radius: 99px; font-weight: 600; }
.langs { display: inline-flex; gap: 6px; font-size: .75rem; letter-spacing: .05em; }
.langs a { opacity: .6; } .langs a.on { opacity: 1; font-weight: 700; text-decoration: underline; }

.hero { margin: 4px 0 20px; } .hero p { margin: 0; color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.card-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }

.btn { display: inline-block; background: var(--brand); color: #fff; border: 1px solid var(--brand); border-radius: 8px; padding: 10px 16px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--ink); }
.btn.ghost { background: transparent; color: var(--brand); border-color: var(--line); }
.btn.ghost:hover { background: var(--tint); }
.btn.sm { padding: 6px 12px; font-size: .85rem; }
:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; }

label { display: block; font-size: .82rem; color: var(--muted); font-weight: 500; }
input, select, textarea { display: block; width: 100%; margin-top: 4px; padding: 9px 10px; font: inherit; color: var(--text); background: #fff; border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
input[readonly] { background: var(--tint); }
.form { display: grid; gap: 14px; margin: 14px 0; }
.hp { position: absolute; left: -9999px; }
.msg { padding: 10px 12px; border-radius: 8px; font-size: .9rem; margin: 12px 0; }
.msg.ok { background: #E7F4EC; color: var(--ok); } .msg.bad { background: #FBEAE8; color: var(--bad); }

/* carga */
.rows-head, .row { display: grid; grid-template-columns: 1.6fr repeat(5, 1fr) 64px 32px; gap: 8px; align-items: end; }
.rows-head { font-size: .75rem; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.row { margin-bottom: 8px; }
.row label span { display: none; }
.row input { margin-top: 0; }
.row output { font-variant-numeric: tabular-nums; font-size: .85rem; color: var(--muted); padding-bottom: 10px; text-align: right; }
.row .x { border: 0; background: none; font-size: 1.3rem; color: var(--muted); cursor: pointer; padding: 0 0 8px; }
.row .x:hover { color: var(--bad); }
.totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.totals div { background: var(--tint); border-radius: 10px; padding: 12px; }
.totals span { display: block; font-size: .75rem; color: var(--muted); }
.totals b { font-size: 1.35rem; font-variant-numeric: tabular-nums; }

/* pestañas y resultados */
.tabs { display: flex; gap: 6px; border-bottom: 3px solid var(--ink); margin: -4px 0 18px; overflow-x: auto; }
.tabs button { border: 1px solid var(--line); border-bottom: 0; background: var(--tint); font: inherit; font-weight: 600; color: var(--brand); padding: 10px 16px; cursor: pointer; border-radius: 10px 10px 0 0; white-space: nowrap; }
.tabs button:hover { background: #E4DAEE; }
.tabs button[aria-selected="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.verdict { display: inline-block; margin-top: 16px; padding: 6px 12px; border-radius: 99px; background: var(--ink); color: #fff; font-weight: 600; font-size: .9rem; }
.verdict.alt { background: var(--brand-2); }
.res { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 16px 0 0; }
.res div { border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.res .key { background: var(--tint); border-color: transparent; }
.res dt { font-size: .75rem; color: var(--muted); }
.res dd { margin: 2px 0 0; font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.note { font-size: .8rem; color: var(--muted); margin: 14px 0 0; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 20px; }
.actions .muted { flex-basis: 100%; margin: 0; }

.tblwrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; font-size: .75rem; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr.rec td { background: var(--tint); }
.tbl .n { text-align: right; font-variant-numeric: tabular-nums; }
.meter { height: 8px; background: var(--tint); border-radius: 4px; overflow: hidden; min-width: 80px; }
.meter i { display: block; height: 100%; background: var(--brand-2); border-radius: 4px; }
.meter.over i { background: var(--bad); }
.tag { display: inline-block; font-size: .78rem; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: var(--tint); color: var(--brand); white-space: nowrap; }
.tag.ok { background: #E7F4EC; color: var(--ok); } .tag.no { background: #FBEAE8; color: var(--bad); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.list li:last-child { border-bottom: 0; }
.acts { display: flex; gap: 8px; }

dialog { border: 0; border-radius: var(--radius); padding: 22px; width: min(440px, 92vw); }
dialog::backdrop { background: rgba(27, 16, 34, .55); }
dialog .form { margin: 0; }
dialog.wide { width: min(720px, 94vw); }
.imp-tbl { max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.imp-tbl input { width: auto; margin: 0; }
.pal { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
#pal_box { margin-top: 12px; }
#pal_box .tblwrap { margin-top: 14px; }
.imp-hint { margin: -6px 0 12px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 0; }
legend { font-size: .82rem; color: var(--muted); padding: 0 4px; }
label.radio { display: inline-flex; align-items: center; gap: 6px; margin-right: 16px; color: var(--text); font-size: .9rem; }
label.radio input { width: auto; margin: 0; }

.foot { background: var(--ink); color: #CFC5DA; font-size: .8rem; padding: 20px 0; }
.foot p { margin: 2px 0; } .foot a { color: #fff; }

/* admin */
.subnav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.subnav a { padding: 7px 14px; border-radius: 99px; text-decoration: none; color: var(--brand); border: 1px solid var(--line); background: #fff; font-weight: 600; font-size: .88rem; }
.subnav a.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile span { font-size: .78rem; color: var(--muted); display: block; }
.tile b { font-size: 1.7rem; font-variant-numeric: tabular-nums; line-height: 1.2; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.cols .card { margin: 0; }
.chart { width: 100%; height: auto; display: block; }
.chart .bar { fill: var(--brand-2); } .chart .bar:hover, .chart .hit:hover + .bar { fill: var(--ink); }
.chart .hit { fill: transparent; }
.chart text { font-size: 11px; fill: var(--muted); font-family: inherit; }
.chart .gl { stroke: var(--line); stroke-width: 1; }
.tip { position: fixed; pointer-events: none; background: var(--ink); color: #fff; font-size: .78rem; padding: 5px 9px; border-radius: 6px; z-index: 9; white-space: nowrap; }
.inline { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inline select, .inline input { width: auto; margin: 0; padding: 6px 8px; font-size: .85rem; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) 46px; gap: 8px; align-items: center; padding: 5px 0; font-size: .88rem; }
.hbar div { position: relative; padding: 4px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 4px; }
.hbar div i { position: absolute; inset: 0 auto 0 0; background: var(--tint); border-radius: 4px; z-index: 0; }
.hbar div span { position: relative; }
.hbar b { text-align: right; font-variant-numeric: tabular-nums; }

@media (max-width: 720px) {
  .rows-head { display: none; }
  .row { grid-template-columns: repeat(6, 1fr); border: 1px solid var(--line); border-radius: 10px; padding: 10px; position: relative; gap: 8px; }
  .row label span { display: block; font-size: .7rem; }
  .row label:nth-child(1) { grid-column: 1 / 6; }
  .row label:nth-child(2), .row label:nth-child(3), .row label:nth-child(4) { grid-column: span 2; }
  .row label:nth-child(5), .row label:nth-child(6) { grid-column: span 2; }
  .row output { grid-column: span 2; text-align: right; }
  .row output:not(:empty)::before { content: "CBM "; font-size: .7rem; }
  .row .x { position: absolute; top: 6px; right: 10px; }
  .totals b { font-size: 1.1rem; }
  .card { padding: 16px; }
}

.gate ul { margin: 12px 0 0; padding-left: 20px; }
.gate li { margin: 6px 0; }

.privacy { display: flex; gap: 12px; align-items: flex-start; background: var(--tint); border-left: 4px solid var(--ink); border-radius: 10px; padding: 14px 16px; margin: 0 0 20px; color: var(--ink); }
.privacy svg { flex: none; margin-top: 2px; color: var(--brand-2); }
.privacy p { margin: 0; font-size: .92rem; line-height: 1.5; }
.ask { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 14px 0 0; padding: 10px 12px; border: 1px dashed var(--brand-2); border-radius: 10px; font-size: .9rem; }
.hub { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.tool { display: flex; flex-direction: column; gap: 10px; min-height: 260px; padding: 24px; border-radius: 20px; background: var(--ink); color: #fff; text-decoration: none; transition: transform .15s; }
.tool:hover { transform: translateY(-3px); }
.tool h2 { font-size: 1.2rem; line-height: 1.25; }
.tool p { margin: 0; color: #D9CFE3; font-size: .92rem; }
.tool .go { margin-top: auto; font-weight: 700; }
.tool.soon { background: #fff; border: 2px dashed var(--line); color: var(--muted); align-items: center; justify-content: center; text-align: center; }
.tool.soon:hover { transform: none; }
.tool.soon p { color: var(--muted); font-weight: 600; }
.tool.soon .plus { font-size: 2rem; line-height: 1; color: var(--line); }
@media (max-width: 760px) { .hub { grid-template-columns: 1fr; } .tool { min-height: 0; } .tool.soon { min-height: 120px; } }
@media (prefers-reduced-motion: reduce) { .tool { transition: none; } }

.p3d { margin-top: 16px; border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fff; }
.p3d-h { display: flex; gap: 12px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; margin-bottom: 8px; }
.p3d-h label { flex: 1 1 260px; }
#p3d_cv { display: block; width: 100%; height: auto; cursor: grab; touch-action: pan-y; border-radius: 8px; background: linear-gradient(#FBFAFC, #F1ECF6); }
#p3d_cv:active { cursor: grabbing; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
label.chk { align-self: end; padding-bottom: 10px; margin: 0; }
.seo p { color: var(--muted); font-size: .95rem; max-width: 75ch; }
.seo details { border-top: 1px solid var(--line); padding: 10px 0; }
.seo summary { cursor: pointer; font-weight: 600; }
.seo details p { margin: 8px 0 0; }

/* Cajas en pallet */
h2.sub { margin: 22px 0 12px; }
.lbl { font-size: .85rem; color: var(--muted); margin: 0 0 8px; }
.opts { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.opt { display: flex; flex-direction: column; gap: 2px; text-align: left; font: inherit; color: var(--brand); background: var(--tint); border: 2px solid transparent; border-radius: 12px; padding: 10px 14px; cursor: pointer; min-width: 150px; }
.opt small { color: var(--muted); font-size: .75rem; }
.opt.on { background: var(--ink); color: #fff; } .opt.on small { color: #D9CFE3; }
.edwrap { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.edbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
#ed { display: block; width: 100%; max-height: 460px; touch-action: none; user-select: none; -webkit-user-select: none; }
#ed .pl { fill: var(--brand); }
#ed .bx { cursor: grab; outline: none; }
#ed .bx rect { fill: #E6DAF2; stroke: #4B2A63; stroke-width: .6; }
#ed .bx text { fill: var(--brand); font-weight: 700; text-anchor: middle; pointer-events: none; }
#ed .bx.on rect, #ed .bx:focus-visible rect { fill: #fff; stroke: #E8B923; stroke-width: 1.6; }
#ed .bx.bad rect { fill: #F6C9C4; stroke: #B3261E; }
.edside .p3d { margin-top: 14px; }
@media (max-width: 860px) { .edwrap { grid-template-columns: 1fr; } }
@media print { .top, .foot, .noprint, .subnav { display: none !important; } .card { border: 0; padding: 0; break-inside: avoid; } body { background: #fff; } }

/* Enlace destacado a Cajas en pallet (calculadora) */
.pal-cta { display: flex; align-items: center; gap: 14px; margin-top: 16px; padding: 14px 18px; border-radius: 10px; background: var(--brand); color: #fff; text-decoration: none; font-size: .92rem; line-height: 1.4; box-shadow: 0 6px 18px rgba(27,16,34,.18); transition: background .15s, transform .15s; }
.pal-cta:hover { background: var(--ink); transform: translateY(-1px); }
.pal-cta b { display: block; font-size: 1.05rem; color: #fff; }
.pal-cta svg { flex: none; color: #E8B923; }
.pal-cta-go { margin-left: auto; font-size: 1.5rem; font-weight: 700; color: #E8B923; }
/* Cajas en pallet: pasos */
.step-nav { margin-top: 20px; }
#pt_next { font-size: 1.02rem; padding: 12px 22px; }
