@font-face { font-family: Inter; src: url(fonts/Inter-Regular.otf); font-weight: 400; font-display: swap; }
@font-face { font-family: Inter; src: url(fonts/Inter-Medium.otf); font-weight: 500; font-display: swap; }
@font-face { font-family: Inter; src: url(fonts/Inter-SemiBold.otf); font-weight: 600; font-display: swap; }
@font-face { font-family: Inter; src: url(fonts/Inter-Bold.otf); font-weight: 700; font-display: swap; }

:root {
  --primary: #0b7285;
  --primary-ink: #095c6b;
  --secondary: #2f9e78;
  /* El arcoíris de Bifröst es solo marca: un hilo, nunca fondo de una acción. */
  --grad: linear-gradient(90deg, #4c6ef5, #15aabf 35%, #40c057 65%, #fab005);
  --night: #0c1220;
  --ink: #111827;
  --muted: #566273;
  --line: #e2e7ee;
  --soft: #f2f5f9;
  --bg: #eef1f6;
  --card: #ffffff;
  --ok: #147a4b;
  --warn: #8a5d00;
  --bad: #c4282d;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(17, 24, 39, .05), 0 6px 20px rgba(17, 24, 39, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: Inter, system-ui, sans-serif; color: var(--ink); background: var(--bg); font-size: 14px; line-height: 1.45; }
a { color: var(--primary-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; word-break: break-all; }
.label { font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* Estructura */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--night); color: #cfd8df; padding: 18px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.side::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--grad); }
.side .brand-wrap { position: relative; margin-bottom: 12px; }
.side .brand { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; cursor: pointer; }
.side .brand:disabled { cursor: default; }
.side .brand:not(:disabled):hover { background: rgba(255, 255, 255, .06); }
.side .brand:focus-visible { outline: 2px solid #8fd8e3; outline-offset: 1px; }
.side .brand > div { min-width: 0; flex: 1; }
.side .brand span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .co-chev { color: #8da0ad; font-size: 12px; flex: none; }
.co-menu { position: absolute; top: calc(100% + 4px); left: 0; width: 290px; z-index: 60; background: #fff; color: var(--ink); border-radius: 12px; box-shadow: 0 12px 32px rgba(10, 30, 40, .28); padding: 6px; max-height: 70vh; overflow: auto; }
.co-menu .co-h { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 8px 10px 6px; }
.co-menu button { all: unset; box-sizing: border-box; width: 100%; display: grid; grid-template-columns: 1fr auto; column-gap: 8px; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.co-menu button:hover, .co-menu button:focus-visible { background: var(--soft); }
.co-menu button.on { background: rgba(11, 114, 133, .1); }
.co-menu button b { font-size: 14px; color: var(--ink); font-weight: 600; }
.co-menu button span { grid-column: 1; font-size: 12px; color: var(--muted); }
.co-menu button i { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-style: normal; color: var(--primary-ink); font-weight: 700; }
.co-menu .co-admin { display: block; color: var(--primary-ink); background: none; border-top: 1px solid var(--line); margin-top: 6px; padding: 10px 10px 6px; font-size: 13px; font-weight: 600; }
.side .brand img { width: 38px; height: auto; background: #fff; border-radius: 8px; padding: 3px; }
.side .brand b { color: #fff; font-size: 15px; display: block; }
.side .brand span { font-size: 11px; color: #8da0ad; }
.side a { color: #cfd8df; padding: 9px 12px; border-radius: 8px; display: flex; gap: 10px; align-items: center; font-weight: 500; }
.side a:hover { background: rgba(255, 255, 255, .06); text-decoration: none; }
.side a.on { background: rgba(21, 170, 191, .16); color: #fff; }
.side a.on::before { content: ""; width: 3px; height: 16px; border-radius: 2px; background: #15aabf; margin-left: -6px; }
.side .navs { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; min-height: 0; }
.side .ic { width: 18px; text-align: center; flex: none; opacity: .9; }
.side .gh { all: unset; box-sizing: border-box; width: 100%; cursor: pointer; color: #cfd8df; padding: 9px 12px; border-radius: 8px; display: flex; gap: 10px; align-items: center; font-weight: 500; }
.side .gh:hover { background: rgba(255, 255, 255, .06); }
.side .gh:focus-visible { outline: 2px solid #8fd8e3; outline-offset: -2px; }
.side .grp.here > .gh { color: #fff; }
.side .chev { margin-left: auto; transition: transform .15s; font-size: 16px; line-height: 1; color: #8da0ad; }
.side .grp.open .chev { transform: rotate(90deg); }
.side .gi { display: none; flex-direction: column; gap: 1px; margin: 2px 0 6px 21px; padding-left: 10px; border-left: 1px solid rgba(255, 255, 255, .1); }
.side .grp.open .gi { display: flex; }
.side .gi a { padding: 7px 10px; font-size: 13.5px; font-weight: 450; }
.side .gi a.on::before { margin-left: -21px; margin-right: 8px; }
.side .subnav { display: none; }
.side .grow { flex: 1; }
.side .who { border-top: 1px solid rgba(255, 255, 255, .08); padding: 12px 8px 0; font-size: 12px; }
.side .who b { color: #fff; display: block; font-size: 13px; }
.main { padding: 0; width: 100%; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.env { display: inline-flex; gap: 6px; align-items: center; font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 99px; background: #fff3d6; color: #8a5a00; }
.env.prod { background: #dcf6e8; color: #0d6b3a; }

/* Tarjetas */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { padding: 18px 20px; }
.stat .v { font-size: 26px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat.hl { background: var(--night); color: #fff; position: relative; overflow: hidden; }
.stat.hl::after, .totals .grand::after { content: ""; position: absolute; inset: auto 0 0 0; height: 3px; background: var(--grad); }
.stat.hl .label { color: #9fb0c4; }

/* Botones y campos */
button, .btn { font: inherit; font-weight: 600; border: 0; border-radius: 9px; padding: 9px 16px; cursor: pointer; background: var(--soft); color: var(--ink); display: inline-flex; gap: 8px; align-items: center; justify-content: center; white-space: nowrap; }
button:hover, .btn:hover { filter: brightness(.97); text-decoration: none; }
button.primary, .btn.primary { background: var(--primary); color: #fff; }
button.primary:hover, .btn.primary:hover { background: var(--primary-ink); filter: none; }
button.dark { background: var(--ink); color: #fff; }
button.danger { background: #fde8e8; color: var(--bad); }
button.ghost { background: transparent; color: var(--primary-ink); padding: 6px 10px; }
button:disabled { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); min-width: 0; }
label.f.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-weight: 500; font-size: 13px; }
input, select, textarea { font: inherit; color: var(--ink); border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 9px 11px; width: 100%; min-width: 0; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(11, 114, 133, .3); border-color: var(--primary); }
.err { color: var(--bad); font-size: 12px; font-weight: 500; }
.form { display: grid; gap: 14px; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.form > .s1 { grid-column: span 1; } .form > .s2 { grid-column: span 2; } .form > .s3 { grid-column: span 3; } .form > .s4 { grid-column: span 4; } .form > .s6 { grid-column: span 6; }
.form h3 { grid-column: span 6; margin: 8px 0 -4px; font-size: 13px; }

/* Tablas */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; }
table.t th { text-align: left; font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; font-variant-numeric: tabular-nums; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: var(--soft); }
table.t .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t .c { text-align: center; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

/* Estados */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-aceptado { background: #dcf6e8; color: #0d6b3a; }
.st-aceptado_notificaciones { background: #e6f4ff; color: #0b5c99; }
.st-rechazado { background: #fde8e8; color: #b42318; }
.st-pendiente, .st-por_enviar { background: #fff3d6; color: #8a5a00; }
.st-error_envio { background: #f1e8fd; color: #6b2fb3; }
.msg { border-radius: 10px; padding: 10px 12px; font-size: 13px; display: flex; gap: 10px; align-items: flex-start; }
.msg + .msg { margin-top: 8px; }
.msg b { font-family: ui-monospace, monospace; font-size: 12px; }
.msg.rechazo { background: #fde8e8; }
.msg.notificacion { background: #e6f4ff; }
.msg.error { background: #f1e8fd; }
.msg.info { background: var(--soft); }

/* Modal y avisos */
.backdrop { position: fixed; inset: 0; background: rgba(15, 27, 36, .45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 50; overflow-y: auto; }
.modal { background: #fff; border-radius: 16px; width: min(760px, 100%); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal.wide { width: min(1100px, 100%); }
.modal header { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.modal .body { padding: 20px 22px; }
.modal footer { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
#toasts .toast { position: static; pointer-events: auto; }
.toast { position: fixed; right: 20px; bottom: 20px; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px; box-shadow: var(--shadow); z-index: 60; max-width: 420px; }
.toast.bad { background: var(--bad); }
/* Con barra de acciones abajo (Emitir, recibos…), los avisos suben para no tapar sus botones. */
body:has(.actionbar) #toasts, body:has(.actionbar) .toast:not(#toasts .toast) { bottom: 96px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--ink); border-color: var(--primary); }
.tabs a:hover { text-decoration: none; color: var(--ink); }

/* Emisión */
.lines td { padding: 6px 6px; }
.lines input, .lines select { padding: 7px 8px; }
.lines .w-code { width: 150px; } .lines .w-qty { width: 96px; } .lines .w-money { width: 130px; } .lines .w-pct { width: 74px; } .lines .w-tax { width: 120px; }
.totals { min-width: 300px; }
.totals .r { display: flex; justify-content: space-between; padding: 5px 0; color: var(--muted); }
.totals .r b { color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 600; }
.totals .grand { margin-top: 8px; background: var(--night); position: relative; overflow: hidden; color: #fff; border-radius: 12px; padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; }
.totals .grand b { font-size: 20px; }
.pdf { width: 100%; height: 78vh; border: 0; border-radius: 8px; background: var(--soft); }
.combo { position: relative; }
.combo .opts { position: absolute; z-index: 20; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); max-height: 280px; overflow-y: auto; margin-top: 4px; }
.combo .opts div { padding: 9px 12px; cursor: pointer; }
.combo .opts div:hover, .combo .opts div.on { background: var(--soft); }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--night); }
.login .card { width: min(400px, 100%); padding: 32px; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); }
.login img.logo { width: 120px; display: block; margin: 0 auto 18px; }
.login h1 { text-align: center; margin-bottom: 4px; }
.login p.sub { text-align: center; margin: 0 0 22px; }
.login form { display: grid; gap: 14px; }
.code { letter-spacing: .4em; text-align: center; font-size: 20px; font-weight: 600; }
.qr { display: block; margin: 8px auto; border-radius: 10px; border: 1px solid var(--line); }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .table-wrap > table.t { min-width: 680px; }
  .grid[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  .topbar { flex-wrap: wrap; gap: 10px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .seg { flex-wrap: wrap; max-width: 100%; }
  .seg button { white-space: normal; }
  .page { padding: 18px 16px 40px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .form { grid-template-columns: 1fr; }
  .form > * { grid-column: span 1 !important; }
}
div.f { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); min-width: 0; }
.flag { display: inline-block; width: 20px; height: 15px; flex: none; background: url(flags.png) 0 0 / 20px auto no-repeat; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.08); vertical-align: -2px; }
.phone { display: flex; }
.phone .cc { display: flex; align-items: center; gap: 6px; padding: 0 10px; border: 1px solid var(--line); border-right: 0; border-radius: 9px 0 0 9px; background: var(--soft); color: var(--ink); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; }
.phone .cc .caret { font-size: 10px; color: var(--muted); }
.phone > input[type=tel] { border-radius: 0 9px 9px 0; flex: 1; }
.phone .opts { font-weight: 400; color: var(--ink); font-size: 13px; }
.phone .opts .q { margin: 8px; width: calc(100% - 16px); }
.phone .opts div { display: flex; align-items: center; gap: 8px; }
.phone .opts div[hidden] { display: none; }
button.sm, .btn.sm { padding: 5px 11px; font-size: 12px; }
.st-pendiente::before, .st-por_enviar::before { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
@keyframes flashrow { from { background: #fff7cc; } to { background: transparent; } }
tr.flash td { animation: flashrow 2.2s ease-out; }
input.serials { margin-top: 4px; font-size: 12px; padding: 4px 8px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
table.t tfoot td { border-top: 2px solid var(--line, #e3e6ea); padding-top: 10px; }

/* QA: [hidden] debe ganar siempre sobre display de los componentes. */
[hidden] { display: none !important; }
/* Errores por campo */
.invalid, .invalid:focus { border-color: var(--bad) !important; box-shadow: 0 0 0 3px rgba(180, 35, 24, .12) !important; }
.field-err { color: var(--bad); font-size: 12px; font-weight: 500; }
.err-summary { background: #fde8e8; color: #8a1c13; border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.pw { position: relative; }
.pw input { padding-right: 76px; }
.pw button { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.steps { text-align: center; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--primary-ink); margin: 0 0 4px; }
.file-btn { margin: 0 auto; display: flex; width: fit-content; }
.seg { display: inline-flex; background: var(--soft); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { background: transparent; padding: 6px 12px; font-size: 13px; color: var(--muted); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* Contabilidad */
.lvl-1 td { font-weight: 800; background: var(--soft); }
.lvl-2 td { font-weight: 700; }
.lvl-4 td:first-child { font-weight: 600; }
.jl-head, .jl { display: grid; grid-template-columns: minmax(160px, 2fr) minmax(130px, 1.6fr) 96px minmax(90px, 1.2fr) 108px 108px 88px 28px; gap: 8px; align-items: start; }
.jl-head { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .02em; padding-bottom: 6px; }
.jl { padding: 6px 0; border-top: 1px solid var(--line); }
.jl input, .jl select { width: 100%; }
.money-in { text-align: right; font-variant-numeric: tabular-nums; }
.jtot { display: flex; gap: 22px; flex-wrap: wrap; justify-content: flex-end; font-variant-numeric: tabular-nums; }
.jtot .bad { color: var(--bad); }
.jtot .ok { color: var(--ok, #1a7f4b); }
.btnlink { display: inline-block; padding: 9px 14px; border: 1px solid var(--line); border-radius: 10px; font-weight: 600; color: var(--ink); background: #fff; }
.btnlink:hover { text-decoration: none; background: var(--soft); }
table.tb td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 900px) {
  .jl-head { display: none; }
  .jl { grid-template-columns: 1fr 1fr; padding: 10px 0; }
  .jl .c-acc, .jl .c-third, .jl .c-desc { grid-column: 1 / -1; }
}
/* Tesorería */
.grid > * { min-width: 0; }
.t tr.on td { background: rgba(11, 114, 133, .1); }
.t tr.det td { background: var(--soft); padding-top: 6px; padding-bottom: 6px; }

.st-neutro { background: #eef0f3; color: #475467; }
.st-por_recibir { background: #fff3d6; color: #8a5a00; }
.pl td { vertical-align: top; }
.pl td input, .pl td select { width: 100%; min-width: 0; }
.pl td .row input, .pl td .row select { width: auto; }

/* Emisión: barra de acciones fija, confirmación como recibo y envío en curso */
.actionbar { position: sticky; bottom: 0; z-index: 15; margin: 20px -32px -40px; padding: 14px 32px; background: rgba(255, 255, 255, .94); backdrop-filter: blur(8px); border-top: 1px solid var(--line); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.actionbar .ab-sum { display: flex; flex-direction: column; line-height: 1.2; }
.actionbar .ab-sum b { font-size: 22px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.actionbar button.primary { padding: 11px 20px; }
.receipt { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px 16px; margin: 0 0 14px; padding: 16px; background: var(--soft); border-radius: 10px; }
.receipt dt { color: var(--muted); font-size: 12px; font-weight: 600; padding-top: 2px; }
.receipt dd { margin: 0; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.receipt dd.big { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sending { display: flex; gap: 14px; align-items: flex-start; margin-top: 14px; padding: 14px 16px; border-radius: 10px; background: rgba(11, 114, 133, .08); }
.sending p { margin: 4px 0 0; }
.spin { width: 20px; height: 20px; flex: none; border-radius: 50%; border: 3px solid rgba(11, 114, 133, .25); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.backdrop.locked { cursor: progress; }
.backdrop.locked [data-close] { visibility: hidden; }
@media (max-width: 900px) {
  .actionbar { margin: 16px -16px -40px; padding: 12px 16px; }
  .actionbar .ab-sum { flex-basis: 100%; }
  .actionbar button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { .spin, .st-pendiente::before, .st-por_enviar::before { animation: none; } }

/* Números en formato colombiano */
input.num-co { text-align: right; font-variant-numeric: tabular-nums; }

/* Tablas de consulta como tarjetas en pantallas angostas */
@media (max-width: 640px) {
  .table-wrap > table.t.cards { min-width: 0; }
  table.t.cards, table.t.cards tbody, table.t.cards tfoot, table.t.cards tr, table.t.cards td { display: block; }
  table.t.cards thead { display: none; }
  table.t.cards tr { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 10px; }
  table.t.cards td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; align-items: baseline; gap: 14px; text-align: right; min-width: 0; overflow-wrap: anywhere; }
  table.t.cards td::before { content: attr(data-label); flex: none; max-width: 45%; text-align: left; color: var(--muted); font-size: 12px; font-weight: 500; }
  table.t.cards td:first-child { justify-content: flex-start; text-align: left; font-size: 15px; padding-bottom: 8px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
  table.t.cards td:first-child::before { content: none; }
  table.t.cards td:empty, table.t.cards td[data-label=""] { display: none; }
  table.t.cards td.num, table.t.cards td.c { text-align: right; }
  table.t.cards tr.click:hover td { background: transparent; }
  table.t.cards tfoot td { border-top: 0; }
  .card:has(> .table-wrap > table.t.cards), .card:has(> table.t.cards) { background: transparent; box-shadow: none; padding: 0; }
}

/* Buscador de pantallas */
.side .find { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 10px; padding: 8px 10px; border-radius: 8px; background: rgba(255, 255, 255, .06); color: #9fb0c4; font-size: 13px; cursor: pointer; }
.side .find:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.side .find:focus-visible { outline: 2px solid #8fd8e3; outline-offset: 1px; }
kbd { font: 600 11px/1 Inter, system-ui, sans-serif; padding: 3px 6px; border-radius: 5px; border: 1px solid rgba(255, 255, 255, .18); }
.pal-wrap .modal { width: min(560px, 100%); }
.pal-wrap .modal .body { padding: 14px; }
.pal { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; max-height: 50vh; overflow-y: auto; }
.pal a { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 12px; border-radius: 8px; color: var(--ink); }
.pal a span { color: var(--muted); font-size: 12px; }
.pal a:hover, .pal a.on { background: rgba(11, 114, 133, .1); text-decoration: none; }
.pal a.on b { color: var(--primary-ink); }

/* Celular: barra superior con ☰ y menú en cajón lateral */
.mtop, .scrim { display: none; }
@media (max-width: 900px) {
  .mtop { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30; padding: 10px 14px; background: var(--night); color: #fff; box-shadow: inset 0 3px 0 #15aabf; }
  .mtop b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
  .menu-btn { background: rgba(255, 255, 255, .08); color: #fff; font-size: 20px; line-height: 1; width: 40px; height: 40px; padding: 0; border-radius: 10px; flex: none; }
  .side { position: fixed; inset: 0 auto 0 0; z-index: 45; width: min(300px, 86vw); height: 100%; overflow-y: auto; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0, 0, 0, .35); }
  .shell.nav-open .side { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 44; background: rgba(12, 18, 32, .5); }
  .scrim[hidden] { display: none; }
  .side a, .side .gh { padding-block: 11px; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }

/* ═══ Estructura Puente: base común de todas las pantallas ═══ */
:root { --field: #d5dce5; --head: #f7f9fb; }
/* Barra superior: ruta y ambiente DIAN */
.top { height: 56px; flex: none; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 0 32px; position: sticky; top: 0; z-index: 20; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); min-width: 0; overflow: hidden; white-space: nowrap; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--primary-ink); }
.crumbs .here { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.top .env { margin-left: auto; font-size: 12px; padding: 5px 10px; }
.env .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
/* Página: ancho fijo y ritmo vertical */
.page { padding: 28px 32px 40px; max-width: 1240px; width: 100%; box-sizing: border-box; }
#view > * + * { margin-top: 20px; }
#view > .topbar + * { margin-top: 0; }
/* Encabezado de página: título, para qué sirve y acción principal a la derecha */
.topbar { align-items: flex-end; margin-bottom: 20px; }
.topbar .ttl { flex: 1 1 320px; min-width: 0; }
.topbar .purpose { margin: 4px 0 0; font-size: 14px; color: var(--muted); max-width: 680px; }
h1 { font-size: 24px; font-weight: 600; }
h2 { font-size: 16px; font-weight: 600; }
/* Una superficie: borde fino, sin sombra; nada de cajas dentro de cajas */
.card { box-shadow: none; border: 1px solid var(--line); }
.card .card { border: 0; padding: 0; border-radius: 0; background: transparent; }
.card > h2:first-child, .card > .row:first-child > h2 { margin-bottom: 12px; }
/* Etiquetas en frase (no en mayúsculas) */
.label { font-size: 12px; letter-spacing: 0; text-transform: none; color: var(--muted); }
.stat.hl { background: var(--card); color: var(--ink); }
.stat.hl .label { color: var(--muted); }
.stat.hl::after { display: none; }
.stat .v { font-size: 28px; }
/* Formularios: 4 columnas; el ancho lo decide el dato */
.form { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 20px; }
.form > .s1, .form > .s2 { grid-column: span 1; }
.form > .s3 { grid-column: span 2; }
.form > .s4 { grid-column: span 3; }
.form > .s6, .form h3 { grid-column: 1 / -1; }
.form h3 { margin: 12px 0 0; padding-top: 16px; border-top: 1px solid var(--line); font-size: 14px; }
.form h3:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
label.f, div.f { gap: 6px; }
/* Todos los campos miden 40 px */
input:not([type=checkbox]):not([type=radio]):not([type=file]):not(.code), select { height: 40px; }
input, select, textarea { border-color: var(--field); border-radius: 8px; padding: 0 12px; }
textarea { padding: 10px 12px; }
.lines input:not([type=checkbox]), .lines select, .jl input, .jl select, .pl td input, .pl td select { height: 36px; padding: 0 8px; }
input.code { height: 52px; }
/* Botones de 40 px */
button, .btn { height: 40px; padding: 0 16px; border-radius: 8px; box-sizing: border-box; }
button.sm, .btn.sm { height: 32px; padding: 0 12px; }
button.ghost { height: auto; padding: 6px 10px; }
.btnlink { height: 40px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: 8px; box-sizing: border-box; }
.side button, .side .gh, .side .find, .co-menu button { height: auto; }
/* Tablas: encabezado en frase, filas de 48 px, cifras a la derecha */
table.t th { text-transform: none; letter-spacing: 0; font-size: 12px; background: var(--head); padding: 10px 14px; }
table.t td { padding: 10px 14px; }
.card > .table-wrap:last-child, .card > div > .table-wrap:last-child { margin-bottom: -4px; }
/* Menú lateral con iconos de línea */
.side svg.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side a.on svg.ic, .side .grp.here > .gh svg.ic { color: #3cc6d8; }
.side a, .side .gh { gap: 12px; }
@media (max-width: 900px) {
  .top { padding: 0 16px; height: 44px; top: 58px; }
  .top .env { font-size: 11px; }
}
@media (max-width: 600px) { .crumbs a, .crumbs > span[aria-hidden] { display: none; } }

/* Página a lo alto: la barra de acciones queda abajo aunque haya poco contenido */
.page { flex: 1; display: flex; flex-direction: column; }
#view > * { flex: none; }
.actionbar { margin-top: auto !important; }
#view > .topbar + .actionbar, #view > * + .actionbar { margin-top: auto; }
/* Totales: resumen claro, sin bloque negro */
.totals .grand { background: transparent; color: var(--ink); border-top: 1px solid var(--line); border-radius: 0; padding: 12px 0 4px; }
.totals .grand::after { display: none; }
.totals .grand .label { color: var(--ink) !important; font-size: 14px; font-weight: 600; }
.totals .grand b { font-size: 26px; }
/* Superficie con encabezado propio (Panel y Lista) */
.card.flush { padding: 0; overflow: hidden; }
.card .sh { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card .sh h2 { margin: 0; }
.card.flush > .table-wrap { margin: 0; }
.card.flush table.t th:first-child, .card.flush table.t td:first-child { padding-left: 20px; }
.card.flush table.t th:last-child, .card.flush table.t td:last-child { padding-right: 20px; }
.card.flush table.t tr:last-child td { border-bottom: 0; }
/* Panel: lista de pendientes */
.task { display: flex; align-items: center; gap: 16px; padding: 14px 20px; border-bottom: 1px solid #eef1f5; }
.task:last-child { border-bottom: 0; }
.task .pill { min-width: 108px; justify-content: center; }
.task .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.task .tx b { font-size: 14px; }
.task .tx span { font-size: 13px; color: var(--muted); }
.task > a { font-weight: 600; white-space: nowrap; }
.st-wa { background: #fff4d9; color: #8a5d00; } .st-ba { background: #fde8e8; color: #b42318; } .st-er { background: #f1e8fd; color: #6b2fb3; }
.ok-t { color: var(--ok); font-weight: 600; } .bad-t { color: var(--bad); font-weight: 600; } .warn-t { color: var(--warn); font-weight: 600; }
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat .v { margin-top: 0; }
td.neg { color: var(--bad); }
/* Lista: filtros en una fila, chips de estado y paginación */
.filters { display: grid; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); align-items: end; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.chip { height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--field); background: #fff; color: #344054; font-size: 13px; font-weight: 600; display: inline-flex; gap: 6px; align-items: center; }
.chip b { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip.on b { color: #cdeef2; }
.pager { display: flex; align-items: center; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.pager b { color: var(--ink); }
.pager .sq { width: 36px; height: 36px; padding: 0; background: #fff; border: 1px solid var(--field); }
@media (max-width: 900px) {
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .fl-q { grid-column: 1 / -1; }
  .task { flex-wrap: wrap; }
}

/* Botones secundarios: blancos con borde; el primario es el único lleno */
button, .btn { background: #fff; border: 1px solid var(--field); color: var(--ink); }
button.primary, .btn.primary { border-color: var(--primary); }
button.dark { border-color: var(--ink); }
button.danger { border-color: #f5c2c2; }
button.ghost, .seg button, .tabs button, button.x, .menu-btn, .mtop button { border-color: transparent; }
.seg button.on { border-color: transparent; }
.stat .v { white-space: nowrap; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* Documento: una superficie con secciones; tipo de documento como selector */
.dsec { margin: 20px -20px 0; padding: 20px 20px 0; border-top: 1px solid var(--line); }
.topbar .seg-tabs { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border: 0; border-radius: 10px; background: #e4e9f0; }
.topbar .seg-tabs a { padding: 7px 14px; border: 0; border-radius: 8px; font-size: 13px; color: var(--muted); }
.topbar .seg-tabs a.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(17, 24, 39, .08); }
.totals { min-width: 340px; background: var(--head); border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; }
.totals .r { padding: 4px 0; }
.totals p { margin: 6px 0 0; text-align: right; }
@media (max-width: 900px) { .totals { min-width: 0; width: 100%; box-sizing: border-box; } }

/* Informe: parámetros en una fila y resultado con jerarquía de cuentas */
.card.params { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 12px 16px; align-items: end; }
.card.flush .sh > div { display: flex; flex-direction: column; gap: 2px; }
table.tb .lvl-1 td { font-weight: 700; background: #f2f5f9; }
table.tb .lvl-2 td { font-weight: 600; }
table.tb tr[class^="lvl-"]:not(.lvl-1):not(.lvl-2) td:nth-child(2) { padding-left: 34px; }
table.tb td.mono { font-family: inherit; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
table.tb .lvl-1 td.mono, table.tb .lvl-2 td.mono { color: var(--ink); }
table.tb tfoot td { background: #fff; border-top: 2px solid var(--field); font-weight: 700; }
@media (max-width: 900px) { .card.params { grid-template-columns: 1fr 1fr; } }

/* ═══ Cortina ═══ */
.curtain-wrap { position: fixed; top: var(--c-top, 0); left: var(--c-left, 0); right: 0; bottom: 0; z-index: 40; overflow: hidden; }
.curtain-scrim { position: absolute; inset: 0; background: rgba(12, 18, 32, .28); backdrop-filter: blur(6px) saturate(1.1); -webkit-backdrop-filter: blur(6px) saturate(1.1); opacity: 0; transition: opacity .25s ease; cursor: pointer; }
.curtain { position: absolute; top: 0; left: 0; right: 0; max-height: calc(100% - 48px); display: flex; flex-direction: column; background: rgba(255, 255, 255, .93); backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2); box-shadow: 0 24px 48px rgba(12, 18, 32, .22); border-radius: 0 0 16px 16px; transform: translateY(-102%); transition: transform .26s cubic-bezier(.2, .8, .2, 1); }
.curtain::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; border-radius: 0 0 16px 16px; background: var(--grad); }
.curtain-wrap.open .curtain { transform: none; }
.curtain-wrap.open .curtain-scrim { opacity: 1; }
.curtain > header { flex: none; display: flex; align-items: center; gap: 12px; padding: 14px 32px; border-bottom: 1px solid var(--line); }
.curtain > header h2 { margin: 0; font-size: 18px; }
.curtain .c-actions { display: flex; gap: 10px; align-items: center; }
.curtain .c-x { width: 40px; height: 40px; padding: 0; font-size: 16px; color: var(--muted); }
.curtain > .body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 20px 32px 28px; }
.curtain .c-inner { max-width: 1120px; margin: 0 auto; }
.curtain-wrap.locked .curtain-scrim, .curtain-wrap.locked .c-x { pointer-events: none; }
/* Formularios más compactos dentro de la cortina */
.curtain .form { gap: 14px 20px; }
.curtain .form h3 { margin-top: 6px; padding-top: 14px; }
.form > label.f.check { align-self: end; min-height: 40px; }
@media (max-width: 900px) {
  .curtain > header { padding: 12px 16px; flex-wrap: wrap; }
  .curtain > .body { padding: 16px; }
  .curtain .c-actions { order: 3; width: 100%; justify-content: flex-end; }
}
@media (prefers-reduced-motion: reduce) { .curtain, .curtain-scrim { transition: none; } }

/* Cabecera de la cortina alineada con el formulario (mismo ancho útil) */
.curtain > header, .curtain > .body { padding-inline: max(32px, calc((100% - 1120px) / 2)); }
.curtain .c-inner { max-width: none; }
.curtain .form h3:first-child { margin-top: 0; padding-top: 0; }
@media (max-width: 900px) { .curtain > header, .curtain > .body { padding-inline: 16px; } }

/* ═══ Cortina compacta: otra escala para otro proceso ═══ */
.curtain { font-size: 13px; }
.curtain > header { padding-block: 10px; }
.curtain > header h2 { font-size: 16px; }
.curtain > header button { height: 34px; padding: 0 14px; font-size: 13px; }
.curtain .c-x { width: 34px; height: 34px; padding: 0; }
.curtain > .body { padding-top: 14px; padding-bottom: 16px; overflow: visible; } /* visible: las listas de ciudad/teléfono pueden asomar */
.curtain.overflow > .body { overflow-y: auto; }
.curtain label.f, .curtain div.f { font-size: 11px; gap: 4px; }
.curtain label.f.check { font-size: 13px; }
.curtain input:not([type=checkbox]):not([type=radio]):not([type=file]), .curtain select { height: 34px; font-size: 13px; padding: 0 10px; border-radius: 7px; }
.curtain textarea { font-size: 13px; padding: 8px 10px; border-radius: 7px; }
.curtain .phone .cc { height: 34px; font-size: 13px; }
.curtain .muted.small, .curtain .small { font-size: 11px; }
.curtain .combo .opts div { padding: 7px 10px; font-size: 13px; }
/* Secciones: apiladas por defecto, en 2 o 3 columnas si hace falta espacio */
.curtain .form { display: flex; flex-direction: column; gap: 14px; }
.curtain .fsec { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 16px; align-content: start; }
.curtain .fsec + .fsec { border-top: 1px solid var(--line); padding-top: 12px; }
.curtain .fsec > h3 { grid-column: 1 / -1; margin: 0; padding: 0; border: 0; font-size: 12px; font-weight: 700; color: var(--ink); }
.curtain .fsec > .s1, .curtain .fsec > .s2 { grid-column: span 1; }
.curtain .fsec > .s3 { grid-column: span 2; }
.curtain .fsec > .s4 { grid-column: span 3; }
.curtain .fsec > .s6 { grid-column: 1 / -1; }
.curtain .fsec > label.f.check { align-self: end; min-height: 34px; }
.curtain.short textarea { height: 52px; min-height: 0; resize: none; }
.tipmark { display: none; margin-left: 4px; color: var(--primary); font-weight: 600; cursor: help; }
.curtain.tips .tipmark { display: inline; }
.curtain.tips label.f > .muted.small { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.curtain.split .form, .curtain.split3 .form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 32px; align-items: start; }
.curtain.split3 .form { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 24px; }
.curtain.split .fsec + .fsec, .curtain.split3 .fsec + .fsec { border-top: 0; padding-top: 0; }
.curtain.split .fsec, .curtain.split3 .fsec { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.curtain.split .fsec > :is(.s3, .s4, .s6), .curtain.split3 .fsec > :is(.s3, .s4, .s6) { grid-column: 1 / -1; }
.curtain .form + .err:empty { display: none; }

/* Columnas tipo periódico: las secciones se acomodan y se equilibran solas */
.curtain.split .form, .curtain.split3 .form { display: block; column-count: 2; column-gap: 32px; }
.curtain.split3 .form { column-count: 3; column-gap: 24px; }
.curtain.split .fsec, .curtain.split3 .fsec { break-inside: avoid; margin-bottom: 14px; }
.curtain label.f > .lt { display: flex; align-items: center; gap: 2px; }

/* ═══ Ancho según el dato: cuadrícula de 12 / 6 / 1 columnas ═══ */
.form[data-cols], .fsec[data-cols] { display: grid; }
[data-cols="12"] { grid-template-columns: repeat(12, minmax(0, 1fr)) !important; }
[data-cols="6"] { grid-template-columns: repeat(6, minmax(0, 1fr)) !important; }
[data-cols="1"] { grid-template-columns: minmax(0, 1fr) !important; }
[data-cols] > h3, [data-cols] > .err, [data-cols] > p { grid-column: 1 / -1 !important; }
[data-cols="12"] > [data-w="xs"] { grid-column: span 1 !important; }
[data-cols="12"] > :is([data-w="s"], [data-w="date"], [data-w="money"]) { grid-column: span 2 !important; }
[data-cols="12"] > :is([data-w="m"], [data-w="phone"], [data-w="tog"]) { grid-column: span 3 !important; }
[data-cols="12"] > [data-w="l"] { grid-column: span 4 !important; }
[data-cols="12"] > [data-w="xl"] { grid-column: span 6 !important; }
[data-cols="12"] > [data-w="full"] { grid-column: 1 / -1 !important; }
[data-cols="6"] > [data-w="xs"] { grid-column: span 1 !important; }
[data-cols="6"] > :is([data-w="s"], [data-w="date"], [data-w="money"]) { grid-column: span 2 !important; }
[data-cols="6"] > :is([data-w="m"], [data-w="phone"], [data-w="tog"], [data-w="l"]) { grid-column: span 3 !important; }
[data-cols="6"] > :is([data-w="xl"], [data-w="full"]) { grid-column: 1 / -1 !important; }
[data-cols="1"] > * { grid-column: 1 / -1 !important; }
/* Etiqueta en una línea con su ícono i; sin textos sueltos bajo los campos */
label.f > .lt, div.f > .lt { display: flex; align-items: center; gap: 6px; min-height: 16px; }
button.tip { all: unset; box-sizing: border-box; width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--primary); color: var(--primary); font: 700 10px/13px Georgia, serif; text-align: center; cursor: pointer; flex: none; }
button.tip:hover, button.tip[aria-expanded=true] { background: var(--primary); color: #fff; }
button.tip:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.tip-pop { position: fixed; z-index: 70; width: min(380px, calc(100vw - 24px)); background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(12, 18, 32, .2); padding: 14px 16px; font-size: 13px; line-height: 1.45; }
.tip-pop .tp-t { display: block; font-size: 13px; margin-bottom: 8px; }
.tip-pop p { margin: 6px 0 0; color: var(--muted); }
.tip-pop table { width: 100%; border-collapse: collapse; }
.tip-pop td { padding: 5px 0; border-top: 1px solid #eef1f5; vertical-align: top; }
.tip-pop td:first-child { width: 78px; white-space: nowrap; padding-right: 10px; }
/* Casillas Sí/No con forma de campo: misma altura y alineadas con la fila */
:is(.form, .fsec) > label.f.check { flex-direction: row; align-items: center; gap: 10px; align-self: end; height: 40px; box-sizing: border-box; padding: 0 12px; border: 1px solid var(--field); border-radius: 8px; background: #fff; font-size: 13px; font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; }
.curtain :is(.form, .fsec) > label.f.check { height: 34px; border-radius: 7px; }
/* La casilla nunca se encoge: si el texto no cabe, la cuadrícula le da 2 columnas o la fila completa */
label.f.check > input[type=checkbox] { flex: none; }
:is(.form, .fsec) > label.f.check[data-wrap], .curtain :is(.form, .fsec) > label.f.check[data-wrap] { white-space: normal; height: auto; min-height: 40px; padding-block: 8px; line-height: 1.35; }
/* ═══ Cortina de cristal: el fondo de la cortina es el cristal ═══ */
.curtain { background: rgba(240, 244, 249, .55); backdrop-filter: blur(28px) saturate(1.6); -webkit-backdrop-filter: blur(28px) saturate(1.6); border-bottom: 1px solid rgba(255, 255, 255, .6); }
.curtain > header { border-bottom-color: rgba(17, 24, 39, .08); }
.curtain .fsec + .fsec { border-top-color: rgba(17, 24, 39, .08); }
.curtain-scrim { background: rgba(12, 18, 32, .16); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.curtain input:not([type=checkbox]):not([type=radio]), .curtain select, .curtain textarea, .curtain .phone .cc { background: #fff; border-color: rgba(17, 24, 39, .14); box-shadow: 0 1px 2px rgba(17, 24, 39, .04); }
.curtain label.f, .curtain div.f { color: #3d4757; }

/* ═══ Anatomía: columnas iguales y fijas; el ancho lo pone el JS (filas completas) ═══ */
[data-cols="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
[data-cols="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) var(--pw, 64px); gap: inherit; column-gap: 12px; align-items: end; min-width: 0; }
.pair > .f { min-width: 0; }
/* ═══ Cristal: más transparente, con brillo ═══ */
.curtain { background: linear-gradient(160deg, rgba(255, 255, 255, .34), rgba(255, 255, 255, .14) 60%, rgba(220, 236, 245, .18)); backdrop-filter: blur(22px) saturate(1.8) brightness(1.04); -webkit-backdrop-filter: blur(22px) saturate(1.8) brightness(1.04); border-bottom: 1px solid rgba(255, 255, 255, .7); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), inset 0 0 0 1px rgba(255, 255, 255, .25), 0 24px 48px rgba(12, 18, 32, .22); }
.curtain > header { background: rgba(255, 255, 255, .18); }
.curtain-scrim { background: rgba(12, 18, 32, .10); backdrop-filter: none; -webkit-backdrop-filter: none; }
.curtain label.f, .curtain div.f, .curtain .fsec > h3 { color: #1f2a37; text-shadow: 0 1px 0 rgba(255, 255, 255, .6); }

/* ═══ Borde arcoíris de la cortina: su propio espacio, no encima del contenido ═══ */
.curtain { padding-bottom: 6px; border-bottom: 0; }
.curtain::after { height: 6px; bottom: 0; border-radius: 0 0 16px 16px; }
.curtain > .body { padding-bottom: 28px; }

/* ═══ Ícono de ayuda ═══ */
label.f > .lt, div.f > .lt, .curtain label.f > .lt { gap: 6px; }
button.tip { all: unset; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin: -2px 0 -2px 2px; border-radius: 6px; color: #8a96a6; cursor: pointer; flex: none; transition: color .15s, background .15s; }
button.tip svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
button.tip svg .dot { fill: currentColor; stroke: none; }
button.tip:hover, button.tip[aria-expanded=true] { color: var(--primary); background: rgba(11, 114, 133, .1); }
button.tip:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.tip-pop { border-radius: 12px; padding: 14px 16px 12px; }
.tip-pop::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; border-radius: 12px 12px 0 0; background: var(--grad); }

/* ═══ Listas de selección en todo el programa ═══ */
select { -webkit-appearance: none; -moz-appearance: none; appearance: none; cursor: pointer; padding-right: 36px !important; background-color: #fff; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%23566273' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; text-overflow: ellipsis; transition: border-color .15s, box-shadow .15s; }
select:hover, input:not([type=checkbox]):not([type=radio]):hover, textarea:hover { border-color: #b4c0ce; }
select:focus, input:focus, textarea:focus { outline: none !important; border-color: var(--primary) !important; box-shadow: 0 0 0 3px rgba(11, 114, 133, .16) !important; }
select:disabled, input:disabled { background-color: var(--soft); color: var(--muted); cursor: not-allowed; }
.curtain select { background-position: right 10px center; padding-right: 32px !important; background-color: #fff; }
.lines select, .jl select, .pl td select { background-position: right 8px center; padding-right: 28px !important; }
select option { color: var(--ink); }
/* Desplegables de búsqueda (cliente, artículo, ciudad, país) */
.combo .opts { border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(12, 18, 32, .16); padding: 4px; margin-top: 6px; background: #fff; }
.combo .opts > div { padding: 9px 12px; border-radius: 7px; display: flex; align-items: baseline; gap: 6px; line-height: 1.35; }
.combo .opts > div:hover, .combo .opts > div.on { background: rgba(11, 114, 133, .09); }
.combo .opts > div.on { box-shadow: inset 3px 0 0 var(--primary); }
.combo .opts .muted { font-size: 12px; }
.combo .opts:empty { display: none; }

/* La flecha de las listas no la borra ninguna regla de fondo */
select, .curtain select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%23566273' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E") !important; background-repeat: no-repeat !important; background-size: 16px !important; }
select:focus { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%230b7285' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E") !important; }

/* ═══ Cortina amplia: el espacio es para respirar, no para apretar ═══ */
.curtain { font-size: 14px; }
.curtain > header { padding-block: 16px; }
.curtain > header h2 { font-size: 18px; }
.curtain > header button { height: 38px; padding: 0 16px; font-size: 14px; }
.curtain .c-x { width: 38px; height: 38px; }
.curtain > .body { padding-top: 28px; padding-bottom: 36px; }
.curtain label.f, .curtain div.f { font-size: 12px; gap: 6px; }
.curtain input:not([type=checkbox]):not([type=radio]):not([type=file]), .curtain select { height: 40px; font-size: 14px; padding: 0 12px; border-radius: 8px; }
.curtain textarea { font-size: 14px; padding: 10px 12px; border-radius: 8px; min-height: 84px; }
.curtain .phone .cc { height: 40px; font-size: 14px; }
.curtain :is(.form, .fsec) > label.f.check { height: 40px; border-radius: 8px; font-size: 14px; }
.curtain .form { gap: 28px; }
.curtain .fsec { gap: 20px 24px; }
.curtain .fsec + .fsec { padding-top: 24px; }
.curtain .fsec > h3 { font-size: 13px; margin-bottom: 2px; letter-spacing: .01em; }
.curtain .body > .c-inner > p, .curtain .body > .c-inner > .small { margin: 0 0 20px; }
.curtain.split .form, .curtain.split3 .form { column-gap: 40px; }
.curtain.split .fsec, .curtain.split3 .fsec { margin-bottom: 24px; }
/* Último recurso cuando ni bajando del todo cabe: aire más ajustado */
.curtain.tight > header { padding-block: 10px; }
.curtain.tight > .body { padding-top: 16px; padding-bottom: 24px; }
.curtain.tight label.f, .curtain.tight div.f { font-size: 11px; gap: 4px; }
.curtain.tight input:not([type=checkbox]):not([type=radio]):not([type=file]), .curtain.tight select, .curtain.tight .phone .cc, .curtain.tight :is(.form, .fsec) > label.f.check { height: 34px; font-size: 13px; }
.curtain.tight textarea { min-height: 0; font-size: 13px; }
.curtain.tight .form { gap: 14px; }
.curtain.tight .fsec { gap: 10px 16px; }
.curtain.tight .fsec + .fsec { padding-top: 12px; }
.curtain.tight.split .fsec, .curtain.tight.split3 .fsec { margin-bottom: 14px; }

/* En columnas la cortina usa más ancho útil (hasta 1440 px) para no apretar los campos */
.curtain.split > header, .curtain.split > .body, .curtain.split3 > header, .curtain.split3 > .body { padding-inline: max(32px, calc((100% - 1440px) / 2)); }

/* Notas del formulario: recuadro informativo, no texto suelto bajo un campo */
:is(.form, .fsec) > p, .curtain .c-inner > p { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 0; padding: 12px 14px; border-radius: 10px; background: rgba(11, 114, 133, .07); color: #2f3b4a; font-size: 13px; line-height: 1.45; }
:is(.form, .fsec) > p::before, .curtain .c-inner > p::before { content: ""; flex: none; width: 16px; height: 16px; margin-top: 1px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%230b7285' stroke-width='1.6' stroke-linecap='round'%3E%3Ccircle cx='10' cy='10' r='7.25'/%3E%3Cpath d='M10 9v4.6'/%3E%3Ccircle cx='10' cy='6.4' r='.6' fill='%230b7285'/%3E%3C/svg%3E") no-repeat center / 16px; }
.curtain .c-inner > p, .form + p, .curtain .form + .err + p { margin-top: 20px; }
.curtain .c-inner > p:first-child { margin: 0 0 20px; }
.curtain .body > .c-inner > .form ~ p, .curtain .body > .c-inner > .err ~ p { margin: 20px 0 0; }

/* ═══ Menú lateral: más ancho y barra de desplazamiento con diseño ═══ */
.shell { grid-template-columns: 272px minmax(0, 1fr); }
.side { padding: 18px 14px; }
.side .navs { margin-right: -8px; padding-right: 8px; scrollbar-width: thin; scrollbar-color: transparent transparent; scrollbar-gutter: stable; transition: scrollbar-color .2s; }
.side:hover .navs { scrollbar-color: rgba(255, 255, 255, .22) transparent; }
.side .navs::-webkit-scrollbar { width: 6px; }
.side .navs::-webkit-scrollbar-track { background: transparent; margin: 4px 0; }
.side .navs::-webkit-scrollbar-thumb { background: transparent; border-radius: 999px; }
.side:hover .navs::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .2); }
.side .navs::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .35); }
.side .navs::-webkit-scrollbar-thumb:active { background: #15aabf; }
.side .navs::-webkit-scrollbar-button { display: none; height: 0; }
.side .gi a { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 900px) { .shell { grid-template-columns: minmax(0, 1fr); } .side .navs { margin-right: 0; padding-right: 0; } }
/* Chrome/Edge: si se declara scrollbar-width ignora el diseño ::-webkit-scrollbar; se deja solo para Firefox */
@supports selector(::-webkit-scrollbar) { .side .navs, .side:hover .navs { scrollbar-width: auto; scrollbar-color: auto; } }

/* ═══ Barra de acciones alineada con la superficie de arriba ═══ */
.actionbar { margin: 20px 0 -40px !important; padding: 14px 20px; border: 1px solid var(--line); border-bottom: 0; border-radius: 12px 12px 0 0; box-shadow: 0 -8px 24px rgba(17, 24, 39, .06); }
@media (max-width: 900px) { .actionbar { margin: 16px 0 -40px !important; padding: 12px 14px; } }

/* ═══ Selectores segmentados: la opción activa se ve de inmediato ═══ */
.topbar .seg-tabs, .seg { background: #e4e9f0; padding: 4px; border-radius: 10px; gap: 4px; }
.topbar .seg-tabs a, .seg button { color: #475467; font-weight: 600; border-radius: 7px; transition: background .15s, color .15s; }
.topbar .seg-tabs a:hover, .seg button:hover { background: rgba(255, 255, 255, .7); color: var(--ink); text-decoration: none; }
.topbar .seg-tabs a.on, .seg button.on { background: var(--primary); color: #fff; box-shadow: 0 2px 6px rgba(11, 114, 133, .35); }
.topbar .seg-tabs a.on:hover, .seg button.on:hover { background: var(--primary-ink); color: #fff; }
.topbar .seg-tabs a:focus-visible, .seg button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
/* Abajo del todo si la página es corta, alineada con la superficie y con 20 px de aire */
.actionbar { margin: auto 0 -40px !important; }
#view > :has(+ .actionbar) { margin-bottom: 20px; }
@media (max-width: 900px) { .actionbar { margin: auto 0 -40px !important; } }

/* Secciones dentro de cada grupo del menú: procesos, consultas y configuración. */
.side .gsec { font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: #7f93a1; padding: 8px 10px 2px; }
.side .gsec.cfg { margin-top: 4px; border-top: 1px solid rgba(255, 255, 255, .08); padding-top: 9px; }

/* ── Pantallas de trabajo más despejadas ─────────────────────────────────── */
/* Pestañas que repiten el menú lateral: solo en celular (allí el menú está escondido). */
@media (min-width: 901px) { .tabs.navdup { display: none; } }
/* Menos aire vertical antes de los datos. */
.page { padding: 20px 24px 32px; max-width: 1440px; }
.topbar { margin-bottom: 14px; }
.topbar h1 { font-size: 22px; }
.topbar .purpose { font-size: 13px; margin-top: 2px; }
.card { padding: 16px; }
table.t td { padding: 9px 12px; }
table.t th { padding: 9px 12px; }
.tabs { margin-bottom: 12px; }
/* Menú recogible a solo íconos. */
.side .navfold { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; color: #8da0ad; cursor: pointer; font-size: 13px; }
.side .navfold:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side .navfold:focus-visible { outline: 2px solid #8fd8e3; }
.side .navfold span { width: 18px; text-align: center; font-size: 16px; }
@media (min-width: 901px) {
  .shell.collapsed { grid-template-columns: 64px minmax(0, 1fr); }
  .shell.collapsed .side { padding: 18px 8px; overflow: hidden; }
  .shell.collapsed .side .brand > div, .shell.collapsed .side .co-chev, .shell.collapsed .side .find, .shell.collapsed .side .gi,
  .shell.collapsed .side .chev, .shell.collapsed .side .who, .shell.collapsed .side .navfold b, .shell.collapsed .side .subnav { display: none !important; }
  .shell.collapsed .side .gh, .shell.collapsed .side .navs > a { font-size: 0; justify-content: center; padding: 10px 0; }
  .shell.collapsed .side .gh .ic, .shell.collapsed .side .navs > a .ic { font-size: 14px; }
  .shell.collapsed .side .navfold { justify-content: center; padding: 8px 0; }
  .shell.collapsed .side .navfold span { transform: rotate(180deg); }
}

/* ── Tarjetas de catálogo (listas de precios, vendedores) ────────────────── */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tile { all: unset; box-sizing: border-box; display: flex; flex-direction: column; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.tile:hover { border-color: var(--primary); box-shadow: 0 4px 14px rgba(11, 114, 133, .12); }
.tile:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.tile .tile-h { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.tile .tile-h b { font-size: 15px; }
.tile p { margin: 0; }
.tile .tile-k { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; margin-top: auto; }
.tile .tile-k div { display: flex; flex-direction: column; }
.tile .tile-k b { font-size: 18px; font-variant-numeric: tabular-nums; }
.tile .tile-k span { font-size: 11.5px; color: var(--muted); }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--soft); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }

/* ── POS ─────────────────────────────────────────────────────────────────── */
.pos { display: flex; flex-direction: column; gap: 14px; }
.pos-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pos-top h1 { margin: 0; font-size: 22px; }
.pos-body { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.pos-cat { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pos-scan { font-size: 17px; padding: 12px 14px; }
.pos-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pos-chips button { border-radius: 99px; padding: 6px 14px; font-size: 13px; background: var(--card); border: 1px solid var(--line); color: var(--muted); }
.pos-chips button.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; max-height: calc(100vh - 290px); overflow: auto; padding: 2px; }
.pos-tile { all: unset; box-sizing: border-box; display: flex; flex-direction: column; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px; min-height: 104px; cursor: pointer; }
.pos-tile:hover { border-color: var(--primary); }
.pos-tile:active { transform: scale(.98); }
.pos-tile:focus-visible { outline: 2px solid var(--primary); }
.pos-tile[data-out] { opacity: .55; }
.pos-tile .nm { font-weight: 600; font-size: 13.5px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pos-tile .cd { font-size: 11px; color: var(--muted); font-family: ui-monospace, monospace; }
.pos-tile .pr { margin-top: auto; font-weight: 700; color: var(--primary); font-variant-numeric: tabular-nums; }
.pos-tile .sk { font-size: 11px; color: var(--muted); }
.pos-tile .sk.zero { color: var(--bad); }
.pos-ticket { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; position: sticky; top: 12px; }
.pos-lines { max-height: 300px; overflow: auto; display: flex; flex-direction: column; }
.pos-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.pos-line .d { display: flex; flex-direction: column; min-width: 0; }
.pos-line .d b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pos-line .q { display: flex; align-items: center; gap: 2px; }
.pos-line .q input { width: 46px; text-align: center; padding: 4px; }
.pos-line .t { font-variant-numeric: tabular-nums; font-size: 13px; }
.pos-empty { color: var(--muted); text-align: center; padding: 26px 8px; font-size: 13px; }
.pos-sum .r { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; }
.pos-sum .r.big { color: var(--ink); font-size: 26px; font-weight: 700; margin-top: 2px; }
.pos-pay { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pos-pay button { font-size: 12.5px; padding: 8px 4px; }
.pos-payrow { display: flex; align-items: center; gap: 6px; }
.pos-payrow span { flex: 1; font-weight: 600; font-size: 13px; }
.pos-payrow input { width: 130px; text-align: right; }
.pos-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.pos-chg { margin: 0; font-weight: 700; font-size: 16px; color: var(--bad); min-height: 20px; }
.pos-chg.ok { color: var(--ok, #1f7a4d); }
.pos-charge { font-size: 18px; padding: 14px; }
.pos-turn { margin-top: 2px; }
@media (max-width: 1100px) { .pos-body { grid-template-columns: 1fr; } .pos-ticket { position: static; } .pos-grid { max-height: none; } }
.pos-top .row { flex-wrap: nowrap; gap: 8px; }
.pos-top select { width: auto; min-width: 180px; }

/* ── Editores de documentos (órdenes, entradas, facturas, comprobantes) ───── */
.actbar { position: sticky; bottom: 0; z-index: 5; margin: auto -24px -32px; padding: 12px 24px; background: rgba(255, 255, 255, .94); backdrop-filter: blur(6px); border-top: 1px solid var(--line); gap: 10px; }
.err[data-errors] + .actbar { margin-top: auto; }
table.t.pl { counter-reset: ln; }
table.t.pl tbody tr { counter-increment: ln; }
table.t.pl tbody tr td:first-child { position: relative; padding-left: 34px; }
table.t.pl tbody tr td:first-child::before { content: counter(ln); position: absolute; left: 10px; top: 19px; width: 18px; height: 18px; border-radius: 50%; background: var(--soft); color: var(--muted); font-size: 11px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
table.t.pl td { vertical-align: top; }
table.t.pl td.num[data-lt], table.t.pl td.num { padding-top: 16px; font-variant-numeric: tabular-nums; font-weight: 600; }
table.t.pl td:first-child .combo + input, table.t.pl td:first-child input[data-f="description"] { font-size: 12.5px; background: var(--soft); border-color: transparent; }
table.t.pl td:first-child input[data-f="description"]:focus { background: #fff; border-color: var(--primary); }
.card > .jtot#tot { margin-left: auto; width: max-content; min-width: 300px; background: var(--soft); border-radius: 10px; padding: 12px 16px; display: grid; grid-template-columns: 1fr; gap: 4px; }
.card > .jtot#tot > span { display: flex; justify-content: space-between; gap: 30px; color: var(--muted); }
.card > .jtot#tot > span b { color: var(--ink); }
.card > .jtot#tot > span:last-child { border-top: 1px solid var(--line); padding-top: 6px; margin-top: 2px; color: var(--ink); font-size: 16px; font-weight: 700; }
@media (max-width: 900px) { .actbar { margin: 16px -14px -20px; padding: 10px 14px; } }

/* Revisor fiscal: aviso de solo consulta en la barra superior. */
.top .ro-pill { margin-left: 10px; white-space: nowrap; }
/* Almacén */
.wms-bar { height: 6px; background: var(--soft); border-radius: 4px; overflow: hidden; margin-top: 4px; }
.wms-bar i { display: block; height: 100%; background: var(--primary); }
/* Áreas de la compañía en el menú */
.side .narea { font-size: 10px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: #6f8796; padding: 14px 12px 4px; }
.shell.collapsed .side .narea { font-size: 0; padding: 0; margin: 8px 10px; border-top: 1px solid rgba(255, 255, 255, .1); }
/* Logo de Bifröst Suite: ingreso y cabecera del menú */
.login .lbox { width: min(400px, 100%); }
.login .lbox .card { width: 100%; }
.login { background: #080a17; }
.login .lbrand { position: relative; width: min(520px, calc(100vw - 40px)); aspect-ratio: 2.2 / 1; margin: 0 0 18px 50%; transform: translateX(-50%); }
.login .lbrand img, .login .lbrand video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 60%; }
.login .lbrand video { visibility: hidden; }
.login .lbrand[data-video="on"] video { visibility: visible; }
.login .lb-toggle { position: absolute; right: 4px; bottom: 4px; width: 28px; height: 28px; padding: 0; border-radius: 50%; border: 1px solid rgba(255,255,255,.18); background: rgba(8,10,23,.55); color: #cfd8df; font-size: 11px; line-height: 1; cursor: pointer; opacity: .55; }
.login .lb-toggle:hover, .login .lb-toggle:focus-visible { opacity: 1; }
.login .lb-toggle:focus-visible { outline: 2px solid #72e6ff; outline-offset: 2px; }
.login .lfoot { text-align: center; color: #8da0ad; font-size: 12px; margin: 16px 0 0; letter-spacing: .04em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.side .brand img.bl-full { display: block; width: 180px; aspect-ratio: 360 / 176; max-width: 100%; height: auto; background: none; border-radius: 0; padding: 0; margin: 6px 0 6px; }
.side .brand img.bl-mark { display: none; width: 40px; height: auto; background: none; border-radius: 0; padding: 0; }
.shell.collapsed .side .brand img.bl-mark { display: block; margin: 0 auto; }

/* ═══ Cortina con tablas ═══ */
.curtain .c-inner .table-wrap { margin-top: 8px; }
.curtain.tdense table.t th { padding: 8px 12px; }
.curtain.tdense table.t td { padding: 6px 12px; }
.curtain.tdense table.t td input[type=radio], .curtain.tdense table.t td input[type=checkbox] { width: 16px; height: 16px; }
.tsplit-wrap { display: block; }
.curtain.tsplit .tsplit-wrap { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; align-items: start; }
/* En columnas, todas las secciones arrancan a la misma altura */
.curtain:is(.split, .split3) .fsec + .fsec { padding-top: 0 !important; border-top: 0 !important; }
/* Casillas y opciones en el turquesa del sistema */
input[type=checkbox], input[type=radio] { accent-color: var(--primary); width: 18px; height: 18px; cursor: pointer; }
table.t td input[type=radio], table.t td input[type=checkbox] { vertical-align: middle; }

/* ═══ Tablas que no caben ═══ */
table.t.t-dense th { padding: 8px 10px; white-space: normal; line-height: 1.25; vertical-align: bottom; }
table.t.t-dense td { padding: 8px 10px; font-size: 13px; }
table.t.t-dense td .btn, table.t.t-dense td button { font-size: 12px; }
table.t.t-stick :is(th, td):first-child { position: sticky; left: 0; z-index: 2; background: var(--card); box-shadow: inset -1px 0 0 var(--line), 8px 0 10px -8px rgba(17, 24, 39, .18); }
table.t.t-stick thead th:first-child { background: var(--head); z-index: 3; }
table.t.t-stick tr.click:hover td:first-child { background: var(--soft); }

/* Segunda mitad de un formulario sin secciones: continúa sin línea divisoria */
.curtain .fsec.cont { border-top: 0 !important; padding-top: 0 !important; }
.curtain:not(.split):not(.split3) .form > .fsec.cont { margin-top: -8px; }

/* En columnas, toda la cortina fluye como un solo periódico (aunque traiga varios formularios) */
.curtain.split .c-inner, .curtain.split3 .c-inner { column-count: 2; column-gap: 40px; }
.curtain.split3 .c-inner { column-count: 3; column-gap: 28px; }
.curtain.split .c-inner > .form, .curtain.split3 .c-inner > .form { display: block !important; column-count: auto !important; }
.curtain:is(.split, .split3) .c-inner > :not(.form) { break-inside: avoid; } /* el formulario sí se reparte; sus secciones no */
.curtain:is(.split, .split3) .c-inner > .form > * { break-inside: avoid; }
.curtain:is(.split, .split3) .c-inner > .err:empty { display: none; }

/* Las tablas de la cortina ocupan todo el ancho aunque el formulario vaya en columnas */
.curtain:is(.split, .split3) .c-inner > :is(.tsplit-wrap, .table-wrap), .curtain:is(.split, .split3) .c-inner > .row { column-span: all; }

/* ── Ambiente de pruebas (PY): franja ámbar fija y marco en toda la pantalla ── */
:root { --sb: 0px; }
body.is-sandbox { --sb: 30px; padding-top: var(--sb); }
#sandbox-band { position: fixed; top: 0; left: 0; right: 0; height: 30px; z-index: 2147483000; display: flex; align-items: center; justify-content: center; gap: 14px; padding: 0 16px; background: #b45309; color: #fff; font-size: 13px; line-height: 1; white-space: nowrap; overflow: hidden; box-shadow: 0 2px 8px rgba(120, 53, 15, .35); }
#sandbox-band b { letter-spacing: .08em; background: #fff; color: #92400e; padding: 4px 8px; border-radius: 4px; font-size: 11px; }
#sandbox-band .sb-meta { opacity: .85; }
#sandbox-band a { color: #fff; font-weight: 600; text-underline-offset: 3px; }
#sandbox-band a:focus-visible { outline: 2px solid #fff; outline-offset: 2px; border-radius: 2px; }
#sandbox-frame { position: fixed; inset: 0; border: 3px solid #f59e0b; pointer-events: none; z-index: 2147483000; }
body.is-sandbox .side { top: var(--sb); height: calc(100vh - var(--sb)); }
body.is-sandbox .shell, body.is-sandbox .login { min-height: calc(100vh - var(--sb)); }
body.is-sandbox .top, body.is-sandbox .mtop { top: var(--sb); }
body.is-sandbox .backdrop, body.is-sandbox .scrim { top: var(--sb); }
@media (max-width: 760px) { #sandbox-band .sb-meta { display: none; } }
@media (max-width: 420px) { #sandbox-band .sb-note { display: none; } }
