:root {
  --pri: #1f3a8a;
  --pri-ink: #ffffff;
  --pri-soft: #e8edf9;
  --banda: #dde9f7;
  --folio: #e00000;
  --bg: #f3f4f6;
  --surface: #ffffff;
  --ink: #111827;
  --ink-2: #4b5563;
  --ink-3: #6b7280;
  --line: #e5e7eb;
  --line-2: #d1d5db;
  --ok: #047857;
  --ok-bg: #d1fae5;
  --warn: #92400e;
  --warn-bg: #fef3c7;
  --bad: #b91c1c;
  --bad-bg: #fee2e2;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 1px 3px rgba(0,0,0,.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 var(--font); -webkit-text-size-adjust: 100%; }
a { color: var(--pri); }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { padding: 40vh 0; text-align: center; color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.grow { flex: 1; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: 14px; }

/* ---------- barra superior ---------- */
/* ---------- menú lateral ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; width: 228px; flex: none; z-index: 40; background: var(--pri); color: var(--pri-ink);
  display: flex; flex-direction: column; gap: 18px; padding: calc(18px + env(safe-area-inset-top)) 12px calc(14px + env(safe-area-inset-bottom)); overflow-y: auto; }
.sidebar .brand { gap: 10px; padding: 0 6px; }
.brand .b-ico { flex: none; width: 46px; height: 46px; border-radius: 12px; background: #fff; display: grid; place-items: center; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.brand .b-ico img { width: 38px; height: 38px; object-fit: contain; filter: none; }
.brand .b-txt { color: var(--pri-ink); font-size: 13px; font-weight: 800; line-height: 1.2; letter-spacing: .04em; white-space: nowrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .02em; color: inherit; text-decoration: none; }
.brand img { object-fit: contain; filter: drop-shadow(0 0 1px rgba(255,255,255,.35)); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { color: inherit; text-decoration: none; padding: 9px 12px; border-radius: 8px; opacity: .82; font-weight: 500; }
.nav a:hover { opacity: 1; background: rgba(255,255,255,.12); }
.nav a.on { opacity: 1; background: rgba(255,255,255,.2); font-weight: 600; }
.who { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 8px 0; border-top: 1px solid rgba(255,255,255,.15); font-size: 13px; }
.who .uname { color: inherit; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who button { background: rgba(255,255,255,.15); border: 0; color: inherit; border-radius: 8px; padding: 6px 10px; cursor: pointer; }
.content { flex: 1; min-width: 0; }
.mtop { display: none; }
.scrim { display: none; }
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; height: auto; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  body.menu-on .sidebar { transform: none; }
  body.menu-on .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0,0,0,.35); }
  .mtop { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 30; background: var(--pri); color: var(--pri-ink);
    padding: calc(8px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left)); }
  .mtop .brand .b-ico { width: 34px; height: 34px; border-radius: 9px; }
  .mtop .brand .b-ico img { width: 28px; height: 28px; }
  .mtop .brand .b-txt { font-size: 11px; }
  .burger { background: transparent; border: 0; padding: 8px 6px; cursor: pointer; display: grid; gap: 4px; }
  .burger span { display: block; width: 22px; height: 2px; background: var(--pri-ink); border-radius: 2px; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

main { max-width: 1280px; margin: 0 auto; padding: 18px 16px 80px; }
h1 { font-size: 22px; margin: 4px 0 14px; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 0 0 8px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.head h1 { margin: 0; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card + .card { margin-top: 14px; }

/* ---------- formularios ---------- */
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--ink-2); min-width: 0; }
.inp, input[type=text], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; background: #fff; font-weight: 400; color: var(--ink); min-height: 38px;
}
textarea { resize: vertical; min-height: 60px; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--pri) 35%, transparent); outline-offset: 0; border-color: var(--pri); }
input[type=number] { text-align: right; }
input[type=color] { width: 48px; height: 36px; border: 1px solid var(--line-2); border-radius: 8px; padding: 2px; background: #fff; }
.grid { display: grid; gap: 12px; }
.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)); }
.span2 { grid-column: span 2; }
@media (max-width: 760px) { .g2, .g3, .g4 { grid-template-columns: minmax(0,1fr); } .span2 { grid-column: auto; } .g4.keep2 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--pri); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line-2); background: #fff; color: var(--ink); border-radius: 8px; padding: 8px 14px; font-weight: 600; cursor: pointer; min-height: 38px; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #f9fafb; }
.btn.pri { background: var(--pri); border-color: var(--pri); color: var(--pri-ink); }
.btn.pri:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); border-color: #fca5a5; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 4px 9px; min-height: 30px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { border: 0; background: transparent; cursor: pointer; border-radius: 6px; padding: 4px 7px; color: var(--ink-3); font-size: 15px; line-height: 1; }
.icon-btn:hover { background: var(--bg); color: var(--ink); }

/* ---------- tablas ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); font-weight: 600; padding: 9px 10px; border-bottom: 1px solid var(--line); background: #fafafa; white-space: nowrap; position: sticky; top: 0; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #f9fafb; }
.tbl .desc { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl td.r, .tbl th.r { text-align: right; }
.folio { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--folio); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.b-ok { background: var(--ok-bg); color: var(--ok); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-bad { background: var(--bad-bg); color: var(--bad); }
.b-n { background: #eef2f7; color: var(--ink-2); }

/* ---------- filtros ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.filters label.f { min-width: 120px; }
.filters .wide { flex: 1 1 220px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; background: #fff; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 7px 11px; cursor: pointer; font-weight: 500; color: var(--ink-2); border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--pri); color: var(--pri-ink); }

/* ---------- editor de cotización ---------- */
.editor { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 16px; align-items: start; }
@media (max-width: 980px) { .editor { grid-template-columns: minmax(0,1fr); } }
.side { position: sticky; top: 16px; }
.foliobox { text-align: center; padding: 14px; border-radius: var(--radius); background: var(--pri-soft); margin-bottom: 12px; }
.foliobox .lbl { font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--ink-2); }
.foliobox .val { font-size: 22px; font-weight: 800; color: var(--folio); font-variant-numeric: tabular-nums; line-height: 1.2; }
.foliobox .val.pending { color: var(--ink-3); font-size: 18px; font-weight: 600; }
.totals { width: 100%; font-size: 14px; }
.totals td { padding: 4px 0; }
.totals td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.totals tr.t td { font-weight: 800; font-size: 18px; border-top: 1px solid var(--line); padding-top: 8px; }
.actions { display: grid; gap: 8px; margin-top: 12px; }

.lines { counter-reset: ln; }
.line { position: relative; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 12px 40px; background: #fff; }
.line:nth-child(even) { background: color-mix(in srgb, var(--banda) 45%, #fff); }
.line + .line { margin-top: 10px; }
.line .n { position: absolute; left: 10px; top: 12px; width: 22px; height: 22px; border-radius: 50%; background: var(--pri); color: var(--pri-ink); font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.line .tools { position: absolute; right: 6px; top: 6px; display: flex; gap: 2px; }
.line .lgrid { display: grid; grid-template-columns: 110px 130px 140px 1fr; gap: 10px; margin-top: 8px; align-items: end; }
.line .imp { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; padding-bottom: 8px; }
@media (max-width: 640px) { .line .lgrid { grid-template-columns: 1fr 1fr; } .line { padding-left: 12px; padding-top: 38px; } }
.line textarea { min-height: 64px; }
.ac { position: relative; }
.ac-list { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; margin-top: 4px; background: #fff; border: 1px solid var(--line-2); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.12); max-height: 320px; overflow: auto; }
.ac-item { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--line); }
.ac-item:last-child { border-bottom: 0; }
.ac-item:hover, .ac-item.on { background: var(--pri-soft); }
.ac-item .d { font-size: 13px; }
.ac-item .m { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.ac-item .p { font-weight: 700; color: var(--ink); }

/* ---------- facturación ---------- */
.fact { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.fact + .fact { margin-top: 12px; }
.fact-h { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.fact-h .who2 { flex: 1; min-width: 200px; }
.fact-b { padding: 4px 0; }
.fl { display: grid; grid-template-columns: 90px 130px 1fr 130px 135px; gap: 10px; padding: 8px 14px; align-items: start; border-bottom: 1px dashed var(--line); }
.fl:last-child { border-bottom: 0; }
.fl .k { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 700; }
.copyable { cursor: copy; border-radius: 6px; padding: 2px 4px; margin: -2px -4px; transition: background .15s; }
.copyable:hover { background: var(--pri-soft); }
.copyable.done { background: var(--ok-bg); }
.leyenda { color: var(--pri); font-weight: 700; }
@media (max-width: 760px) { .fl { grid-template-columns: 1fr 1fr; } .fl .dsc { grid-column: 1 / -1; order: -1; } }
.sticky-bar { position: sticky; bottom: 12px; z-index: 15; margin-top: 14px; background: var(--ink); color: #fff; border-radius: 12px; padding: 10px 14px; display: flex; align-items: center; gap: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.25); }

/* ---------- dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 12px; margin-bottom: 14px; }
@media (max-width: 1000px) { .kpis { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .l { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.kpi .v { font-size: 22px; font-weight: 800; margin-top: 2px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi .s { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.dgrid { display: grid; grid-template-columns: minmax(0,3fr) minmax(0,2fr); gap: 14px; margin-bottom: 14px; }
@media (max-width: 1000px) { .dgrid { grid-template-columns: minmax(0,1fr); } }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis { font-size: 11px; fill: var(--ink-3); }
.chart .grid-l { stroke: var(--line); stroke-width: 1; }
.chart .bar { fill: var(--pri); }
.chart .bar.dim { fill: color-mix(in srgb, var(--pri) 35%, #fff); }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hit:hover + .bar, .chart g.on .bar { filter: brightness(1.25); }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; border-radius: 8px; padding: 7px 10px; font-size: 12px; white-space: nowrap; box-shadow: 0 4px 14px rgba(0,0,0,.2); z-index: 5; transform: translate(-50%, -100%); margin-top: -8px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.hbar { display: grid; grid-template-columns: minmax(0, 170px) 1fr auto; gap: 8px; align-items: center; font-size: 12.5px; padding: 4px 0; }
.hbar .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .tr { height: 14px; background: #f1f3f6; border-radius: 4px; overflow: hidden; }
.hbar .fi { height: 100%; background: var(--pri); border-radius: 0 4px 4px 0; }
.hbar .vl { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 90px; text-align: right; }

/* ---------- panel ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; text-decoration: none; color: var(--ink-2); border-bottom: 2px solid transparent; font-weight: 600; white-space: nowrap; }
.tabs a.on { color: var(--pri); border-bottom-color: var(--pri); }
.prog { height: 8px; background: #eef0f3; border-radius: 99px; overflow: hidden; min-width: 120px; }
.prog > div { height: 100%; background: var(--pri); }
.logo-prev { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.logo-prev img { max-height: 80px; max-width: 260px; border: 1px dashed var(--line-2); border-radius: 8px; padding: 6px; background: #fff; }
.note { background: var(--pri-soft); border-radius: 8px; padding: 10px 12px; color: var(--ink-2); font-size: 13px; }
.note.warn { background: var(--warn-bg); color: var(--warn); }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, var(--pri) 0%, color-mix(in srgb, var(--pri) 60%, #000) 100%); }
.login .card { width: 100%; max-width: 400px; padding: 26px; }
.login .lg { text-align: center; margin-bottom: 18px; }
.login .lg img { max-width: 240px; max-height: 110px; }
.login h1 { font-size: 18px; text-align: center; margin: 6px 0 2px; }
.err { color: var(--bad); font-size: 13px; min-height: 18px; }

/* ---------- modal y avisos ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(17,24,39,.5); z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.wide { max-width: 980px; height: calc(100vh - 32px); display: flex; flex-direction: column; }
.modal-h { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-h h2 { margin: 0; }
.modal-b { padding: 18px; }
.modal.wide .modal-b { flex: 1; padding: 0; }
.modal-f { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.modal iframe { width: 100%; height: 100%; border: 0; display: block; }
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: grid; gap: 8px; max-width: calc(100vw - 32px); }
.toast { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.2); font-weight: 500; animation: tin .2s ease-out; }
.toast.bad { background: var(--bad); }
.toast.ok { background: var(--ok); }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }
.empty { text-align: center; padding: 40px 16px; color: var(--ink-3); }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); gap: 10px; flex-wrap: wrap; }
.calc-out { background: var(--pri-soft); border-radius: 10px; padding: 12px 14px; }
.calc-out .big { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }

input.hex { width: 96px; font-family: var(--mono); font-size: 13px; text-transform: lowercase; min-height: 36px; padding: 6px 8px; }
input.hex.bad { border-color: var(--bad); outline-color: var(--bad); }

.cpy { border: 1px solid var(--line-2); background: #fff; color: var(--ink-2); border-radius: 6px; width: 26px; height: 24px; margin-left: 6px; cursor: pointer; font-size: 13px; line-height: 1; vertical-align: middle; }
.cpy:hover { background: var(--pri-soft); color: var(--pri); border-color: var(--pri); }
.cpy.done, .btn.done { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
.fl .dtxt { white-space: pre-wrap; }
.fact-f { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 14px; border-top: 1px solid var(--line); background: #fafafa; border-radius: 0 0 var(--radius) var(--radius); }
.fact-f input { min-height: 34px; padding: 6px 10px; }
.sticky-bar input { color: var(--ink); }

/* ---------- facturación tipo Excel ---------- */
.xl { background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.xl + .xl { margin-top: 14px; }
.xl-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; background: var(--banda); border-bottom: 1px solid var(--line-2); }
.xl-h .folio { font-size: 16px; }
.xl-meta { font-size: 13px; color: var(--ink-2); }
.xl-t { width: 100%; border-collapse: collapse; font-size: 13px; }
.xl-t th { background: #fafafa; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); font-weight: 600; padding: 6px 8px; border: 1px solid var(--line); text-align: left; white-space: nowrap; }
.xl-t td { padding: 6px 8px; border: 1px solid var(--line); vertical-align: top; }
.xl-t th.r, .xl-t td.r { text-align: right; }
.xl-t th.c, .xl-t td.c { text-align: center; width: 1%; white-space: nowrap; }
.xl-t td.cell { cursor: copy; }
.xl-t td.cell:hover { background: var(--pri-soft); outline: 2px solid var(--pri); outline-offset: -2px; }
.xl-t td.cell.done { background: var(--ok-bg); }
.xl-t td.dtxt { white-space: pre-wrap; min-width: 280px; }
.xl-t tfoot td { border-color: transparent; padding: 4px 8px; }
.xl .fact-f { border-radius: 0; }

.xl-b { display: grid; grid-template-columns: minmax(0, 1fr) 300px; }
.xl-box { border-left: 1px solid var(--line-2); padding: 8px 12px; cursor: copy; background: #fcfcfd; }
.xl-box:hover { background: var(--pri-soft); }
.xl-box.done { background: var(--ok-bg); }
.xl-box pre { margin: 4px 0 0; font: 12.5px/1.45 ui-monospace, Menlo, monospace; white-space: pre-wrap; word-break: break-word; user-select: text; }
@media (max-width: 1100px) { .xl-b { grid-template-columns: 1fr; } .xl-box { border-left: 0; border-top: 1px solid var(--line-2); } }

/* ---------- Ver como ---------- */
.vc-bar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 16px; background: #fff4d6; border-bottom: 1px solid #f0d68a; color: #6b4e00; font-size: 13px; }
@media (max-width: 860px) { .vc-bar { top: 52px; } }

.who .uname { flex: 1; min-width: 0; }
.who .ico { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border-radius: 8px; background: transparent; border: 0; color: inherit; opacity: .8; cursor: pointer; }
.who .ico:hover { opacity: 1; background: rgba(255,255,255,.15); }
.who .ico.on { opacity: 1; background: rgba(255,255,255,.22); }

/* ---------- permisos ---------- */
.perm-t th.c { font-size: 11px; }
.perm-t td { vertical-align: middle; }
.sw { position: relative; display: inline-block; width: 36px; height: 20px; cursor: pointer; }
.sw input { position: absolute; opacity: 0; width: 0; height: 0; }
.sw span { position: absolute; inset: 0; background: #cfd5df; border-radius: 20px; transition: background .15s; }
.sw span::after { content: ''; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.sw input:checked + span { background: var(--pri); }
.sw input:checked + span::after { transform: translateX(16px); }
.sw input:focus-visible + span { outline: 2px solid var(--pri); outline-offset: 2px; }
.perm-g { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.perm-g .check { align-items: flex-start; }
@media (max-width: 600px) { .perm-g { grid-template-columns: 1fr; } }
.actions.ro #save, .actions.ro #cancel { display: none; }

/* ---------- arrastrar y soltar ---------- */
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 28px 16px; border: 2px dashed var(--line-2); border-radius: 12px; background: #fafbfc; color: var(--ink-2); text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover { border-color: var(--pri); }
.drop.over { border-color: var(--pri); background: var(--pri-soft); color: var(--pri); }
.drop svg { color: var(--pri); }
.drop-f { font-weight: 600; color: var(--ink); }

/* ---------- barra compacta del dashboard ---------- */
.dash-h { align-items: center; }
.dash-h #d-per { margin-top: 2px; }
.dbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.dbar select, .dbar input { height: 34px; min-height: 34px; padding: 4px 8px; font-size: 13px; width: auto; }
.dbar #d-pre { font-weight: 600; min-width: 150px; }
.dbar #d-user { max-width: 190px; }
.dbar input[type=number] { width: 96px; }
.dbar .row { gap: 4px; flex-wrap: nowrap; }
.dbar .row select { min-width: 0 !important; }
.seg.sm button { padding: 6px 10px; font-size: 13px; }
@media (max-width: 860px) { .dbar { justify-content: flex-start; width: 100%; } .dbar .row { flex-wrap: wrap; } }

/* ---------- iconos del menú y menú contraído ---------- */
.nav a { display: flex; align-items: center; gap: 10px; }
.ni { display: inline-flex; flex: none; }
.who #salir { display: inline-flex; align-items: center; gap: 6px; }
.who #salir .ni { display: none; }
.colapsar { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 8px 12px; border: 0; border-radius: 8px; background: transparent; color: inherit; opacity: .65; cursor: pointer; font: inherit; font-size: 13px; text-align: left; }
.colapsar:hover { opacity: 1; background: rgba(255,255,255,.12); }
.colapsar + .who { margin-top: 0; }
.sidebar { transition: width .18s ease; }
@media (min-width: 861px) {
  body.side-min .sidebar { width: 68px; padding-left: 10px; padding-right: 10px; }
  body.side-min .sidebar .nt, body.side-min .brand .b-txt, body.side-min .who .uname { display: none; }
  body.side-min .sidebar .brand { padding: 0; justify-content: center; }
  body.side-min .nav a, body.side-min .colapsar { justify-content: center; padding: 10px 0; }
  body.side-min .colapsar .ni { transform: rotate(180deg); }
  body.side-min .who { flex-direction: column; padding: 10px 0 0; gap: 6px; }
  body.side-min .who #salir { padding: 7px; }
  body.side-min .who #salir .ni { display: inline-flex; }
}
@media (max-width: 860px) { .colapsar { display: none; } .colapsar + .who { margin-top: auto; } }

select.sm-sel { height: 30px; min-height: 30px; padding: 2px 6px; font-size: 13px; width: auto; }

/* ---------- caja de plataformas ---------- */
.plats { margin-top: auto; border: 1px solid rgba(255,255,255,.18); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.plats-t { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .6; padding: 0 4px 4px; }
.plat { display: flex; align-items: center; gap: 9px; padding: 6px 6px; border-radius: 7px; color: inherit; text-decoration: none; font-size: 13px; opacity: .85; }
.plat:hover { opacity: 1; background: rgba(255,255,255,.12); }
.plat.on { opacity: 1; background: rgba(255,255,255,.18); font-weight: 600; }
.pl-i { flex: none; width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; font-weight: 800; background: rgba(255,255,255,.2); }
.plat.on .pl-i { background: #fff; color: var(--pri); }
.pl-a { margin-left: auto; font-size: 10px; opacity: .7; }
.plats + .colapsar { margin-top: 6px; }
@media (min-width: 861px) {
  body.side-min .plats { padding: 4px 0; border-color: transparent; align-items: center; }
  body.side-min .plats-t { display: none; }
  body.side-min .plat { padding: 6px; }
}
.plat-t input[type=text] { min-width: 140px; }
.plat-t td:nth-child(2) input { min-width: 280px; }

.pl-us { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; max-width: 320px; }

/* ---------- marca de agua: cuadrícula 3 × 3 ---------- */
.wm-grid { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); aspect-ratio: 4 / 3; border: 2px solid var(--line-2); border-radius: 8px; overflow: hidden; background: #fff; }
.wm-grid button { border: 0; border-right: 1px dashed var(--line-2); border-bottom: 1px dashed var(--line-2); background: transparent; cursor: pointer; display: grid; place-items: center; padding: 4px; }
.wm-grid button:nth-child(3n) { border-right: 0; }
.wm-grid button:nth-child(n+7) { border-bottom: 0; }
.wm-grid button img { width: 60%; max-height: 80%; object-fit: contain; opacity: 0; transition: opacity .12s; }
.wm-grid button:hover img { opacity: .25; }
.wm-grid button.on { background: var(--pri-soft); }
.wm-grid button.on img { opacity: .85; }
