/* Estructura común de las 3 variaciones. El aspecto (fuentes, paleta, botones 3D, navegación) lo define cada variación. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, dl, dd, figure, ul { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.ic { flex: none; display: block; }
:focus-visible { outline: 2px solid var(--focus, var(--accent)); outline-offset: 2px; }
.mono { font-family: var(--font-mono); font-size: .92em; letter-spacing: -.01em; }
.grow { flex: 1; }
[hidden] { display: none !important; }
body.has-sheet { overflow: hidden; }

/* Sleek custom scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong, #CBD5E1); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted, #94A3B8); }

/* ---------- Vista ---------- */
.view { display: block; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }
.view-title { font-family: var(--font-display); }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.view-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hint { font-size: 13px; color: var(--muted); margin-top: 14px; display: flex; gap: 8px; align-items: center; }
.hint--top { margin: 0 0 14px; }
[data-reveal] { opacity: 1; transform: none; animation: rise .2s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes rise { from { opacity: 0.8; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- Botones (base; el skin 3D lo pone cada variación) ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 44px; padding: 0 18px; border: 0; font-weight: 600; font-size: 14.5px; white-space: nowrap; text-decoration: none; user-select: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.ibtn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); }
.ibtn:hover { background: var(--hover); color: var(--ink); }
.ibtn--sm { width: 28px; height: 28px; border-radius: 8px; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap, 18px); margin-bottom: 22px; }
.kpis--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi__top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 13px; font-weight: 500; }
.kpi__ic { display: inline-grid; place-items: center; }
.kpi__value { display: block; font-family: var(--font-display); font-size: 34px; line-height: 1.1; margin: 10px 0 12px; font-weight: 600; letter-spacing: -.02em; }
.kpi__foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.kpi__note { font-size: 12.5px; color: var(--muted); }
.spark { width: 84px; height: 26px; color: var(--accent); }

/* ---------- Tarjetas y listas ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: var(--gap, 18px); margin-bottom: 22px; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card__head h2 { font-size: 16px; font-family: var(--font-display); font-weight: 600; }
.link { font-size: 13px; font-weight: 600; color: var(--accent-strong, var(--accent)); text-decoration: none; }
.link:hover { text-decoration: underline; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.lg--a { background: var(--bar-a); } .lg--b { background: var(--bar-b); }
.chart { width: 100%; height: auto; display: block; }
.bar--a { fill: var(--bar-a); } .bar--b { fill: var(--bar-b); }
.bar-l { font-size: 10px; fill: var(--muted); font-family: var(--font-body); }
.list__row { display: flex; align-items: center; gap: 12px; padding: 12px 10px; margin: 0 -10px; border-radius: 10px; cursor: pointer; transition: background .15s; }
.list__row > div { flex: 1; min-width: 0; }
.list__row strong { display: block; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list__row span { font-size: 12.5px; color: var(--muted); }
.list__row b { font-variant-numeric: tabular-nums; font-size: 14px; }
.list__row .ic { color: var(--muted); }
.list__row:hover { background: var(--hover); }
.list--2col { display: grid; grid-template-columns: 1fr 1fr; column-gap: 34px; }

/* ---------- Filtros ---------- */
.toolbar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.search { display: flex; align-items: center; gap: 10px; flex: 1 1 320px; max-width: 460px; height: 44px; padding: 0 14px; color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; color: var(--ink); height: 100%; }
.search:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { min-height: 38px; padding: 0 16px; border: 0; font-size: 13.5px; font-weight: 600; }

/* ---------- Tablas (cada fila es clicable) ---------- */
.tablewrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; min-width: 720px; }
.tbl th { text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 12px 16px; white-space: nowrap; }
.tbl td { padding: 15px 16px; vertical-align: middle; font-size: 14px; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl td strong { display: block; font-weight: 600; }
.sub { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.row-link { cursor: pointer; transition: background .15s, box-shadow .15s; }
.row-link:hover { background: var(--hover); }
.row-link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.acts { text-align: right; white-space: nowrap; }
.acts .ibtn { display: inline-grid; vertical-align: middle; }
.go { display: inline-grid; vertical-align: middle; width: 28px; place-items: center; color: var(--muted); transition: transform .18s, color .18s; }
.row-link:hover .go, .row-link:focus-visible .go { transform: translateX(3px); color: var(--accent-strong, var(--accent)); }
.paid { color: var(--ok); font-weight: 600; }
.thumbcell { width: 84px; }
.thumb { display: grid; place-items: center; width: 64px; height: 46px; border-radius: 10px; background: var(--thumb, var(--surface-2)); color: var(--accent); overflow: hidden; }
.art { width: 100%; height: 100%; }
.tag { display: inline-flex; align-items: center; gap: 5px; margin-left: 10px; padding: 2px 8px; font-size: 11.5px; font-weight: 600; border-radius: 999px; background: var(--surface-2); color: var(--muted); vertical-align: middle; }

/* ---------- Estados ---------- */
.badge { display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px 4px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.badge__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge--ok { color: var(--ok); background: var(--ok-bg); }
.badge--warn { color: var(--warn); background: var(--warn-bg); }
.badge--bad { color: var(--bad); background: var(--bad-bg); }
.badge--info { color: var(--info); background: var(--info-bg); }
.badge--neutral { color: var(--muted); background: var(--surface-2); }

/* ---------- Medidor del plan ---------- */
.meter { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 18px; padding: 18px 22px; }
.meter strong { display: block; font-size: 15px; }
.meter span { font-size: 13px; color: var(--muted); }
.meter__bar { flex: 1 1 260px; max-width: 420px; height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter__bar i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }

/* ---------- Marketing embebido ---------- */
.frame { border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.frame iframe { display: block; width: 100%; height: calc(100vh - 230px); min-height: 700px; border: 0; background: #fff; }

/* ---------- Hoja lateral y modal ---------- */
#sheetroot { position: relative; z-index: 60; }
.scrim { position: fixed; inset: 0; background: var(--scrim, rgba(10, 12, 16, .48)); animation: fade .25s both; }
.sheet { position: fixed; display: flex; flex-direction: column; background: var(--sheet-bg, var(--surface)); color: var(--ink); z-index: 61; box-shadow: var(--shadow-sheet, 0 30px 80px rgba(0, 0, 0, .3)); }
.sheet--drawer { top: 0; right: 0; bottom: 0; width: min(1140px, 100vw); animation: slide .42s cubic-bezier(.2, .8, .2, 1) both; }
.sheet--modal { top: 50%; left: 50%; width: min(1080px, calc(100vw - 32px)); max-height: calc(100vh - 32px); border-radius: var(--radius); transform: translate(-50%, -50%); animation: pop .32s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pop { from { transform: translate(-50%, -48%) scale(.98); opacity: 0; } to { transform: translate(-50%, -50%); opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 28px; border-bottom: 1px solid var(--line); }
.sheet__head h2 { font-family: var(--font-display); font-size: 26px; font-weight: 600; letter-spacing: -.01em; }
.sheet__state { display: flex; align-items: center; gap: 12px; }
.sheet__body { flex: 1; overflow-y: auto; padding: 26px 28px; }
.sheet__body--2 { display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 32px; align-items: start; }
.sheet__foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 16px 28px; border-top: 1px solid var(--line); background: var(--sheet-foot, transparent); }
.previewcol { position: sticky; top: 0; }
.previewcol__label { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }

/* ---------- Formularios ---------- */
.form { display: grid; gap: 30px; }
.fsec h3 { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.opt { text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field span { font-size: 13px; font-weight: 600; color: var(--muted); }
.field--2 { grid-column: 1 / -1; }
.in { width: 100%; min-height: 44px; padding: 10px 14px; border: 1px solid var(--line-strong, var(--line)); border-radius: var(--radius-sm); background: var(--field-bg, var(--surface)); color: var(--ink); outline: none; }
.in:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring, rgba(0, 0, 0, .08)); }
textarea.in { resize: vertical; font-family: var(--font-mono); font-size: 13px; }
.itemhead, .itemrow { display: grid; grid-template-columns: 1fr 72px 130px 40px; gap: 10px; align-items: center; }
.itemhead { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; padding: 0 2px; }
.itemrow { margin-bottom: 8px; }
.in--n { text-align: right; }
.dl { display: grid; gap: 14px; }
.dl div { display: grid; grid-template-columns: 170px 1fr; gap: 12px; align-items: baseline; }
.dl dt { font-size: 13px; color: var(--muted); }
.dl dd { font-weight: 600; }
.dl .big { font-family: var(--font-display); font-size: 28px; letter-spacing: -.02em; }
.balance { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-radius: var(--radius-sm); background: var(--warn-bg); color: var(--warn); }
.balance strong { font-family: var(--font-display); font-size: 26px; }
.balance--paid { background: var(--ok-bg); color: var(--ok); }

/* ---------- Carga de fotos ---------- */
.cols { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.dz { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 30px 20px; border: 2px dashed var(--line-strong, var(--line)); border-radius: var(--radius); cursor: pointer; transition: border-color .2s, background .2s; background: var(--surface-2); }
.dz:hover, .dz.is-drag { border-color: var(--accent); background: var(--accent-soft, var(--hover)); }
.dz__ic { color: var(--accent-strong, var(--accent)); }
.dz small { color: var(--muted); }
.dz__err { min-height: 20px; margin-top: 8px; color: var(--bad); font-size: 13px; }
.dz__hint { margin-top: 10px; font-size: 13px; color: var(--muted); }
.photogrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 12px; margin-top: 12px; }
.ph { position: relative; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); padding: 8px; cursor: grab; }
.ph__img { aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: var(--surface); color: var(--accent); display: grid; place-items: center; }
.ph__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph figcaption { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.ph__tag { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.ph__tag--cover { color: var(--accent-strong, var(--accent)); }
.ph__bar { position: absolute; left: 8px; right: 8px; bottom: 44px; height: 4px; border-radius: 4px; background: rgba(0, 0, 0, .12); overflow: hidden; }
.ph__bar i { display: block; height: 100%; background: var(--accent); transition: width .14s linear; }
.switchrow { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--surface-2); }
.switchrow small { display: block; color: var(--muted); font-size: 12.5px; }
.switch { position: relative; flex: none; width: 52px; height: 30px; border-radius: 99px; border: 0; background: var(--line-strong, #ccc); transition: background .2s; padding: 0; }
.switch i { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0, 0, 0, .25); transition: transform .22s cubic-bezier(.3, 1.4, .5, 1); }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"] i { transform: translateX(22px); }
.g360 { display: grid; gap: 14px; margin-top: 14px; opacity: .45; pointer-events: none; transition: opacity .2s; }
.g360.is-on { opacity: 1; pointer-events: auto; }
.filebtn { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px; border: 1px dashed var(--line-strong, var(--line)); border-radius: var(--radius-sm); color: var(--muted); font-size: 14px; }

/* ---------- PDF en vivo ---------- */
.pdf { background: #fff; color: #1c1b19; border-radius: 6px; padding: 26px 26px 22px; box-shadow: 0 1px 0 rgba(0, 0, 0, .04), 0 18px 40px rgba(0, 0, 0, .16); font-family: 'Helvetica Neue', Arial, sans-serif; font-size: 12px; line-height: 1.45; position: relative; }
.pdf__head { display: flex; justify-content: space-between; gap: 14px; padding-bottom: 14px; border-bottom: 2px solid #1c1b19; }
.pdf__logo { display: block; font-weight: 800; font-size: 17px; letter-spacing: -.02em; }
.pdf small { display: block; color: #6b6963; font-size: 11px; }
.pdf__id { text-align: right; }
.pdf__id b { font-family: var(--font-mono); font-size: 12.5px; }
.pdf__to { margin: 16px 0; }
.pdf__to b { display: block; font-size: 14px; }
.pdf__to span { color: #6b6963; }
.pdf table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.pdf th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: #6b6963; padding: 6px 4px; border-bottom: 1px solid #d9d6cf; }
.pdf td { padding: 7px 4px; border-bottom: 1px solid #ecebe6; vertical-align: top; }
.pdf .r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pdf__tot { margin-left: auto; width: 62%; }
.pdf__tot div { display: flex; justify-content: space-between; padding: 3px 0; }
.pdf__grand { border-top: 2px solid #1c1b19; margin-top: 4px; padding-top: 6px !important; font-size: 14px; }
.pdf__pay { margin-top: 12px; color: #4a4843; }
.pdf__law { margin-top: 10px; padding-top: 10px; border-top: 1px solid #ecebe6; font-size: 10px; color: #8a877f; }
.pdf__amount { margin: 14px 0; padding: 14px; background: #f5f3ee; border-radius: 4px; }
.pdf__amount b { display: block; font-size: 24px; letter-spacing: -.02em; margin: 2px 0; }
.pdf__amount span { font-size: 10.5px; color: #6b6963; }
.stamp { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; padding: 8px 16px; border: 3px solid #1f7a4d; color: #1f7a4d; border-radius: 8px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; transform: rotate(-6deg); opacity: .9; }
.stamp--wait { border-color: #b7791f; color: #b7791f; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); display: grid; gap: 10px; z-index: 90; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 12px; background: var(--toast-bg, #17181c); color: var(--toast-ink, #fff); font-size: 14px; box-shadow: 0 14px 34px rgba(0, 0, 0, .28); animation: pop-t .3s cubic-bezier(.2, .8, .2, 1) both; }
.toast .ic { color: var(--toast-ic, #6ee7a8); }
.toast.is-out { opacity: 0; transform: translateY(8px); transition: .25s; }
@keyframes pop-t { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
  .list--2col { grid-template-columns: 1fr; }
  .sheet__body--2 { grid-template-columns: 1fr; }
  .previewcol { position: static; }
  .cols { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .kpis, .kpis--3 { grid-template-columns: 1fr; }
  .fgrid { grid-template-columns: 1fr; }
  .dl div { grid-template-columns: 1fr; gap: 2px; }
  .sheet__head, .sheet__body, .sheet__foot { padding-left: 18px; padding-right: 18px; }
  .itemhead, .itemrow { grid-template-columns: 1fr 58px 96px 36px; }
  .frame iframe { min-height: 560px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0ms !important; transition-duration: .001ms !important; }
}
