/* Sosmatic Comercial — estilo bento */
@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url('/static/fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 500; font-display: swap; src: url('/static/fonts/inter-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap; src: url('/static/fonts/inter-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 700; font-display: swap; src: url('/static/fonts/inter-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter Tight'; font-weight: 600; font-display: swap; src: url('/static/fonts/inter-tight-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter Tight'; font-weight: 700; font-display: swap; src: url('/static/fonts/inter-tight-latin-700-normal.woff2') format('woff2'); }

:root {
  --bg: #FFFFFF; --tile: #F4F4F6; --card: #FFFFFF; --ink: #121316; --ink2: #3B3D47; --muted: #5F6170; --line: #E2E2E8; --line2: #D4D5DC;
  --brand: #008EE2; --link: #006BAD;
  --sumgrey: #7DD9CF; --complemento: #BDEDE7; --caller: #9CC9FA; --summy: #9FE3B5; --sosmotor: #F9A99E; --pbx: #F8E27A; --medida: #C3B1FA;
  --ok-bg: #DDF5E3; --ok: #1F6B38; --warn-bg: #FFEFD1; --warn: #7A4100; --info-bg: #E4EEFF; --info: #1D4F9A; --bad-bg: #FDE1DE; --bad: #A12A20; --mut-bg: #EBEBEF;
  --dark: #121316; --dark2: #1E2026; --dark3: #2C2F37; --dark-muted: #B7B9C2;
  --r: 24px; --r2: 16px;
  --display: 'Inter Tight', 'Inter', system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 Inter, system-ui, -apple-system, 'Segoe UI', sans-serif; }
a { color: var(--link); } a:hover { color: #004E7F; }
h1, h2, h3 { margin: 0; }
p { margin: 0; }
code, .mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 12.5px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

.shell { max-width: 1320px; margin: 0 auto; padding: 0 28px 56px; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 18px 0 22px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand-mark { display: flex; align-items: flex-end; gap: 3px; height: 24px; }
.brand-mark span { width: 6px; border-radius: 3px; background: var(--brand); }
.brand-name { font: 700 19px/1 var(--display); letter-spacing: -0.3px; }
.brand-name small { color: var(--muted); font-weight: 500; font-size: 19px; }
/* Dos empresas: marca de la empresa activa, selector y etiquetas */
.brand-wrap { display: flex; align-items: center; gap: 8px; flex: none; }
.co-marks { display: inline-flex; }
.co-marks img { display: block; border-radius: 50%; box-shadow: 0 0 0 2px var(--bg, #fff); }
.co-marks img + img { margin-left: -8px; }
.cosw { position: relative; }
.cosw summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px; border-radius: 999px; background: var(--tile); font-size: 12.5px; font-weight: 600; color: var(--ink2); }
.cosw summary::-webkit-details-marker { display: none; }
.cosw summary:hover { background: #E9E9EE; }
.cosw[open] summary { background: var(--ink); color: #fff; }
.cosw-menu { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; min-width: 200px; display: flex; flex-direction: column; gap: 2px; padding: 6px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 32px rgba(18, 19, 22, .14); }
.cosw-menu button { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px; border: 0; border-radius: 10px; background: none; font: inherit; font-size: 14px; font-weight: 600; color: var(--ink); text-align: left; cursor: pointer; }
.cosw-menu button:hover { background: var(--tile); }
.cosw-menu button.on { background: var(--tile); box-shadow: inset 3px 0 0 var(--ink); }
.co-both { display: inline-flex; }
.co-both img + img { margin-left: -5px; }
.co-logo { display: inline-flex; align-items: center; gap: calc(var(--s) * .32); }
.co-logo img { display: block; border-radius: 50%; }
.co-logo .co-name { font: 700 calc(var(--s) * .7)/1 var(--display); letter-spacing: -0.3px; }
.co-badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px 2px 3px; border-radius: 999px; background: color-mix(in srgb, var(--co, #C9CAD2) 18%, #fff); font-size: 12px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.co-badge img { border-radius: 50%; }
.co-badge.both { padding-left: 8px; background: var(--tile); color: var(--ink2); }
.co-tile { border-top: 4px solid var(--co); text-decoration: none; color: inherit; }
body[data-co] .topbar { border-top: 3px solid var(--co, transparent); }
body[data-co="todas"] .topbar { border-image: linear-gradient(90deg, #358DDE 0 50%, #A3E635 50% 100%) 1; border-top: 3px solid; }
.nav { flex: 1 1 auto; min-width: 0; display: flex; gap: 2px; overflow-x: auto; padding: 4px; border-radius: 999px; background: var(--tile); scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { flex: none; display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px; font-size: 13.5px; border-radius: 999px; color: var(--ink2); font-weight: 600; text-decoration: none; }
.nav a:hover { background: #E9E9EE; color: var(--ink); }
.nav a.on { background: var(--ink); color: #fff; }
.me { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 20px; background: var(--caller); color: var(--ink); font-weight: 700; font-size: 13px; text-decoration: none; }
.role { display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border-radius: 999px; background: var(--tile); color: var(--ink2); font-size: 13px; font-weight: 600; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-head .kicker { font-size: 13px; color: var(--muted); }
.page-head h1, .h1 { font: 700 34px/1.1 var(--display); letter-spacing: -0.8px; }
.crumb a { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.bento { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.s2 { grid-column: span 2; } .s3 { grid-column: span 3; } .s4 { grid-column: span 4; } .s5 { grid-column: span 5; } .s6 { grid-column: span 6; }
.s7 { grid-column: span 7; } .s8 { grid-column: span 8; } .s9 { grid-column: span 9; } .s12 { grid-column: span 12; }
.r2 { grid-row: span 2; }

.tile { background: var(--tile); border-radius: var(--r); padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.tile.dark { background: var(--dark); color: #fff; }
.tile.dark .muted, .tile.dark .desc { color: var(--dark-muted); }
.tile.blue { background: var(--caller); } .tile.green { background: var(--summy); } .tile.coral { background: var(--sosmotor); } .tile.teal { background: var(--sumgrey); }
a.tile { color: var(--ink); text-decoration: none; } a.tile:hover { background: #EDEDF1; }
.tile-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.tile-head .t { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.ico { flex: none; width: 34px; height: 34px; border-radius: 17px; background: #fff; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.ico svg { width: 16px; height: 16px; }
.tile h2 { font-size: 15px; font-weight: 600; }
.tile .desc { font-size: 12.5px; color: var(--muted); }
.big { font: 700 44px/1.05 var(--display); letter-spacing: -1.2px; }
.mid { font: 700 24px/1.1 var(--display); letter-spacing: -0.4px; }
.num { font: 700 18px/1.1 var(--display); }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .tiny { font-size: 11.5px; }
.card { background: var(--card); border-radius: var(--r2); padding: 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.card.row { flex-direction: row; align-items: center; gap: 12px; }
.card.sel { outline: 2px solid var(--ink); }
.cards { display: flex; flex-direction: column; gap: 8px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.mt-auto { margin-top: auto; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 999px; border: 0; background: #fff; color: var(--ink); font: 600 14px/1 Inter, sans-serif; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #ECECF0; color: var(--ink); }
.btn.primary { background: var(--ink); color: #fff; } .btn.primary:hover { background: #2A2C33; color: #fff; }
.btn.soft { background: var(--tile); } .btn.soft:hover { background: #E9E9EE; }
.btn.danger { background: transparent; color: var(--bad); } .btn.danger:hover { background: var(--bad-bg); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.tile.dark .btn { background: #fff; } .tile.dark .btn.soft { background: var(--dark3); color: #fff; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: #fff; font-size: 12px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.chip.dot::before { content: ''; width: 8px; height: 8px; border-radius: 4px; background: var(--c, var(--line2)); }
a.chip { text-decoration: none; border: 1px solid var(--line); }
a.chip:hover { border-color: var(--line2); }
a.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.pp { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; color: var(--ink); background: var(--c, var(--line)); }
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.info { background: var(--info-bg); color: var(--info); } .badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.mut { background: var(--mut-bg); color: var(--ink2); }
.note { padding: 9px 12px; border-radius: 12px; font-size: 12.5px; }
.note.ok { background: var(--ok-bg); color: var(--ok); } .note.warn { background: var(--warn-bg); color: var(--warn); }
.note.info { background: var(--info-bg); color: var(--info); } .note.bad { background: var(--bad-bg); color: var(--bad); }
.dotc { display: inline-block; width: 12px; height: 12px; border-radius: 6px; background: var(--c); flex: none; }
.flash { margin-bottom: 16px; }

label.lbl, .lbl { display: block; font-size: 12px; font-weight: 600; color: var(--ink2); margin-bottom: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=date], input[type=url], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 14px; border-radius: 14px; border: 1px solid transparent; background: #fff; color: var(--ink); font: inherit; font-size: 14px; }
textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
textarea.code { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); }
.tile.dark input { background: var(--dark2); color: #fff; }
.field { display: flex; flex-direction: column; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
input[type=checkbox].switch { appearance: none; width: 44px; height: 26px; border-radius: 13px; background: var(--line2); position: relative; cursor: pointer; flex: none; margin: 0; }
input[type=checkbox].switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 10px; background: #fff; transition: left .15s; }
input[type=checkbox].switch:checked { background: var(--ink); }
input[type=checkbox].switch:checked::after { left: 21px; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--ink); }

.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.tgl { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 2px solid var(--line2); background: #fff; color: var(--ink); font: 600 13px Inter, sans-serif; cursor: pointer; }
.tgl.on { border-color: var(--c, var(--ink)); background: var(--c, var(--ink)); color: var(--on-c, #fff); }
.tgl.on[style*="--c"] { color: var(--ink); }
.tgl:not(.on):hover { border-color: var(--ink2); }

.steps { display: flex; gap: 4px; } .steps span { flex: 1; height: 10px; border-radius: 5px; background: var(--line2); } .steps span.on { background: var(--ink); }
.bar { position: relative; height: 12px; border-radius: 6px; background: var(--dark3); } .bar > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; }
.bar > b { position: absolute; top: -4px; width: 2px; height: 20px; background: #fff; }
.ring { width: 112px; height: 112px; border-radius: 56px; display: flex; align-items: center; justify-content: center; }
.ring > div { width: 84px; height: 84px; border-radius: 42px; background: var(--tile); display: flex; align-items: center; justify-content: center; font: 700 24px var(--display); }

.list { display: flex; flex-direction: column; gap: 6px; }
.li { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 12px; border-radius: 14px; background: #fff; min-height: 48px; color: var(--ink); text-decoration: none; }
a.li:hover { background: #FAFAFB; }
.li .main { display: flex; flex-direction: column; min-width: 0; }
.li .main strong { font-weight: 600; font-size: 13.5px; }
.li .main span { font-size: 12px; color: var(--muted); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 600; }
details.acc { background: #fff; border-radius: 14px; } details.acc > summary { list-style: none; cursor: pointer; padding: 12px 14px; font-weight: 600; font-size: 13.5px; display: flex; justify-content: space-between; gap: 8px; }
details.acc > summary::after { content: '+'; } details.acc[open] > summary::after { content: '−'; }
details.acc > div { padding: 0 14px 14px; font-size: 13px; color: var(--ink2); }
.scatter { display: flex; flex-wrap: wrap; justify-content: center; align-content: center; gap: 8px; padding: 8px 0; }
.scatter > * { padding: 9px 16px; border-radius: 999px; font-weight: 700; background: var(--c); color: var(--ink); text-decoration: none; }
.scatter > *:nth-child(3n) { transform: rotate(-5deg); } .scatter > *:nth-child(3n+1) { transform: rotate(4deg); } .scatter > *:nth-child(3n+2) { transform: rotate(-2deg); }
button.scatter-btn { border: 2px solid transparent; font: 600 14px Inter, sans-serif; cursor: pointer; min-height: 44px; }
button.scatter-btn.on { border-color: var(--ink); }
.empty { border: 2px dashed var(--line2); border-radius: 16px; padding: 18px; text-align: center; color: var(--muted); font-size: 13px; }
.formula { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--ink2); overflow-wrap: anywhere; }
.watermark { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%) rotate(-24deg); font: 700 96px var(--display); color: rgba(162, 63, 28, 0.08); pointer-events: none; white-space: nowrap; }
.paper { position: relative; overflow: hidden; background: #fff; border-radius: 16px; padding: 36px 40px; font-family: Georgia, 'Times New Roman', serif; font-size: 14px; line-height: 1.6; }
.scroll-x { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; border-radius: 14px; overflow: hidden; }
.tbl th, .tbl td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { font-size: 12px; color: var(--muted); font-weight: 600; }
.tbl input, .tbl select { min-height: 36px; padding: 6px 10px; border-radius: 10px; background: var(--tile); }

.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth .tile { width: 100%; max-width: 420px; }

@media (max-width: 860px) {
  .shell { padding: 0 16px 40px; }
  .bento { grid-template-columns: minmax(0, 1fr); }
  .bento > * { grid-column: auto !important; grid-row: auto !important; }
  .grid2, .grid3, .grid4, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .page-head h1, .h1 { font-size: 28px; }
}

/* ===================== Base común v2 ===================== */
.skip { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 999px; }
.skip:focus { left: 16px; }
.shell.wide { max-width: 1560px; }
.page-head .lead { color: var(--muted); max-width: 760px; font-size: 14px; }
.bento.dense { grid-auto-flow: row dense; }
.tile.dashed { background: transparent; border: 2px dashed var(--line2); }
.tile.hero { padding: 28px; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.flash { transition: opacity .4s, max-height .4s; } .flash.fade { opacity: 0; max-height: 0; padding: 0; margin: 0; overflow: hidden; }
.bar.light { background: var(--line); height: 8px; } .bar.light > i { border-radius: 4px; }
.filter { max-width: 360px; }
a.tgl { display: inline-flex; align-items: center; text-decoration: none; }

/* Barra superior: buscador y tareas */
.topsearch { display: flex; align-items: center; gap: 6px; background: var(--tile); border-radius: 999px; padding: 0 6px 0 14px; color: var(--muted); }
.topsearch input { border: 0; background: transparent; min-height: 40px; width: 150px; padding: 0 6px; }
.topsearch input:focus { width: 220px; }
.taskbtn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: 999px; background: var(--tile); color: var(--ink2); text-decoration: none; font-weight: 700; font-size: 13px; }
.taskbtn.has { background: var(--pbx); color: var(--ink); }
.searchbar { display: flex; align-items: center; gap: 6px; background: #fff; border-radius: 999px; padding: 6px 6px 6px 18px; flex-wrap: nowrap; }
.searchbar input { border: 0; min-height: 44px; padding: 0 8px; background: transparent; }

/* Pestañas */
.tabs { display: flex; flex-direction: column; gap: 14px; }
.tabbar { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: #fff; overflow-x: auto; scrollbar-width: none; align-self: flex-start; max-width: 100%; }
.tabbar::-webkit-scrollbar { display: none; }
.tabbar button { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--ink2); font: 600 13px Inter, sans-serif; cursor: pointer; }
.tabbar button:hover { background: var(--tile); }
.tabbar button.on { background: var(--ink); color: #fff; }
.tabn { display: inline-flex; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; align-items: center; justify-content: center; background: var(--tile); color: var(--ink); font-size: 11px; }
.tabbar button.on .tabn { background: var(--dark3); color: #fff; }

/* Diálogos */
dialog.dlg { border: 0; border-radius: var(--r); padding: 22px; width: min(560px, calc(100vw - 32px)); background: var(--tile); color: var(--ink); box-shadow: 0 24px 80px rgba(18, 19, 22, .25); }
dialog.dlg.wide { width: min(880px, calc(100vw - 32px)); }
dialog.dlg::backdrop { background: rgba(18, 19, 22, .35); }

/* Tareas */
.task { align-items: flex-start; }
.task .main a { color: var(--ink); text-decoration: none; } .task .main a:hover { text-decoration: underline; }
.task.done .main strong { text-decoration: line-through; color: var(--muted); }
.task-check { flex: none; }
.tick { width: 28px; height: 28px; border-radius: 14px; border: 2px solid var(--line2); background: #fff; color: transparent; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.tick:hover { border-color: var(--ok); color: var(--ok); }
.tick.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.av { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--caller); color: var(--ink); font-weight: 700; flex: none; }
.stat { display: flex; flex-direction: column; gap: 2px; } .stat-v { font: 700 28px/1.1 var(--display); letter-spacing: -.5px; } .stat-l { font-size: 12px; color: var(--muted); font-weight: 600; }

/* Permisos */
.perm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.perm { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 12px; background: var(--tile); cursor: pointer; }
.perm .main { display: flex; flex-direction: column; } .perm .main strong { font-size: 13px; font-weight: 600; } .perm .main span { font-size: 12px; color: var(--muted); }

/* ===== Formularios estructurados (sin JSON) ===== */
.sx { min-width: 0; }
.sx-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; align-items: start; }
.sx-f { display: flex; flex-direction: column; min-width: 0; }
.sx-f[hidden] { display: none; }
.sx-f .lbl .req { color: var(--bad); }
.sx-num { display: flex; align-items: center; background: #fff; border-radius: 14px; border: 1px solid transparent; }
.sx-num:focus-within { border-color: var(--ink); }
.sx-num input { border: 0 !important; background: transparent !important; text-align: right; font-variant-numeric: tabular-nums; }
.sx-num .unit { padding: 0 12px 0 2px; color: var(--muted); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.sx-bool { justify-content: flex-end; min-height: 44px; }
.sx-color { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.sx-color input[type=color] { width: 44px; height: 44px; border: 0; border-radius: 12px; padding: 0; background: none; cursor: pointer; }
.sx-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.sx-pill { cursor: pointer; position: relative; } .sx-pill input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sx-pill span { display: inline-flex; align-items: center; min-height: 34px; padding: 0 12px; border-radius: 999px; border: 2px solid var(--line2); background: #fff; font-weight: 600; font-size: 12.5px; }
.sx-pill input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.sx-pill input:focus-visible + span { outline: 3px solid var(--brand); outline-offset: 2px; }
.sx-group.boxed { background: rgba(255, 255, 255, .55); border-radius: 16px; padding: 12px; gap: 8px; }
.sx-gt { font-weight: 700; font-size: 12.5px; }
.sx-info p { padding-top: 22px; }

.sx-list { gap: 8px; }
.sx-list-head { display: flex; align-items: center; gap: 8px; } .sx-list-head .lbl { margin: 0; }
.sx-count { display: inline-flex; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; align-items: center; justify-content: center; background: #fff; font-size: 11.5px; font-weight: 700; }
.sx-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sx-item { background: #fff; border-radius: 16px; }
.sx-item.sx-new { animation: sxin .5s ease; }
@keyframes sxin { from { box-shadow: 0 0 0 3px var(--brand); } to { box-shadow: 0 0 0 0 transparent; } }
.sx-item.sx-dragging { opacity: .4; }
.sx-drag { flex: none; width: 22px; display: inline-flex; align-items: center; justify-content: center; color: var(--line2); cursor: grab; font-weight: 700; letter-spacing: -2px; user-select: none; }
.sx-item:hover .sx-drag { color: var(--muted); }
.sx-tools { flex: none; display: inline-flex; gap: 2px; }
.sx-ib { width: 30px; height: 30px; border-radius: 15px; border: 0; background: transparent; color: var(--muted); font: 700 15px/1 Inter, sans-serif; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.sx-ib:hover { background: var(--tile); color: var(--ink); }
.sx-ib.del:hover { background: var(--bad-bg); color: var(--bad); }
.sx-scalar { display: flex; align-items: center; gap: 6px; padding: 4px 6px; }
.sx-scalar input { flex: 1; min-width: 0; background: var(--tile); min-height: 38px; }
.sx-row { display: flex; align-items: center; gap: 6px; padding: 6px; }
.sx-row > .sx-grid { flex: 1; gap: 6px; }
.sx-row input:not([type=checkbox]):not([type=color]), .sx-row select, .sx-row textarea, .sx-row .sx-num { background: var(--tile); min-height: 38px; }
.sx-row textarea { min-height: 38px; }
.sx-row .sx-bool { min-height: 38px; justify-content: center; }
.sx-rows-head { display: flex; gap: 6px; padding: 0 6px; } .sx-rows-head .sx-grid { flex: 1; gap: 6px; } .sx-rows-head .lbl { margin: 0; font-size: 11.5px; }
.sx-drag-sp { width: 22px; flex: none; } .sx-tools-sp { width: 96px; flex: none; }
.sx-card { padding: 4px 6px; }
.sx-card-bar { display: flex; align-items: center; gap: 6px; }
.sx-card-title { flex: 1; min-width: 0; text-align: left; border: 0; background: transparent; padding: 8px 4px; font: 600 14px Inter, sans-serif; color: var(--ink); cursor: pointer; display: flex; align-items: center; gap: 8px; }
.sx-card-title::before { content: '▾'; color: var(--muted); font-size: 12px; transition: transform .15s; }
.sx-card.closed .sx-card-title::before { transform: rotate(-90deg); }
.sx-card-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sx-card-body { padding: 6px 8px 12px 34px; }
.sx-card.closed .sx-card-body { display: none; }
.sx-card-body input:not([type=checkbox]):not([type=color]), .sx-card-body select, .sx-card-body textarea, .sx-card-body .sx-num, .sx-card-body .md-ed { background: var(--tile); }
.sx-card-body .sx-num input { background: transparent; }
.sx-card-body .md-ed textarea, .sx-card-body .md-ed .md-area { background: var(--tile) !important; }
.sx-card-body .sx-group.boxed { background: var(--tile); }
.sx-card-body .sx-group.boxed input:not([type=checkbox]):not([type=color]), .sx-card-body .sx-group.boxed select, .sx-card-body .sx-group.boxed textarea, .sx-card-body .sx-group.boxed .sx-num { background: #fff; }
.sx-card-body .sx-item { background: var(--tile); }
.sx-card-body .sx-item input:not([type=checkbox]):not([type=color]), .sx-card-body .sx-item select, .sx-card-body .sx-item .sx-num { background: #fff; }
.sx-add { align-self: flex-start; min-height: 38px; padding: 0 14px; border-radius: 999px; border: 2px dashed var(--line2); background: transparent; color: var(--ink2); font: 600 13px Inter, sans-serif; cursor: pointer; }
.sx-add:hover { border-color: var(--ink); color: var(--ink); background: #fff; }
.sx-add[disabled] { opacity: .4; cursor: not-allowed; }
.sx-empty { padding: 4px 2px; }
.sx-gridf .scroll-x { background: #fff; border-radius: 14px; padding: 6px; }
.sx-table { border-collapse: separate; border-spacing: 4px; }
.sx-table th { font-weight: 600; }
.sx-table input { min-height: 36px; padding: 6px 10px; border-radius: 10px; background: var(--tile); min-width: 90px; }
.sx-table input[data-sx-col] { font-weight: 700; }
.sx-col { display: flex; align-items: center; gap: 2px; }
.sx-tcol { width: 34px; }

/* ===== Texto con formato ===== */
.md-ed { display: flex; flex-direction: column; background: #fff; border-radius: 14px; border: 1px solid transparent; }
.md-ed:focus-within { border-color: var(--ink); }
.md-bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); align-items: center; }
.md-bar button { min-height: 30px; padding: 0 10px; border-radius: 8px; border: 0; background: transparent; color: var(--ink2); font: 600 12px Inter, sans-serif; cursor: pointer; }
.md-bar button:hover { background: rgba(0, 0, 0, .05); }
.md-bar select { width: auto; min-height: 30px; padding: 2px 8px; border-radius: 8px; font-size: 12px; background: rgba(0, 0, 0, .05); }
.md-tabs { margin-left: auto; display: inline-flex; gap: 2px; background: rgba(0, 0, 0, .05); border-radius: 999px; padding: 2px; }
.md-tabs button { border-radius: 999px; } .md-tabs button.on { background: var(--ink); color: #fff; }
.md-area { border: 0 !important; border-radius: 0 0 14px 14px !important; background: transparent; min-height: 160px; }
.md-area:focus { border: 0; }
.md-prev { padding: 14px 16px; min-height: 160px; }
.md { font-size: 14px; line-height: 1.6; color: var(--ink); overflow-wrap: anywhere; }
.md > * + * { margin-top: .6em; }
.md h1, .md h2, .md h3, .md h4 { font-family: var(--display); letter-spacing: -.3px; line-height: 1.2; margin-top: 1.1em; }
.md h1 { font-size: 26px; } .md h2 { font-size: 20px; } .md h3 { font-size: 16px; } .md h4 { font-size: 14px; }
.md > :first-child { margin-top: 0; }
.md ul, .md ol { padding-left: 22px; margin-bottom: 0; } .md li + li { margin-top: 4px; }
.md p { margin: 0; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 1.2em 0; }
.md code { background: var(--tile); padding: 1px 6px; border-radius: 6px; }
.md .md-note { background: var(--info-bg); color: var(--ink); border-radius: 14px; padding: 12px 14px; }
.md .md-table { overflow-x: auto; } .md table { border-collapse: collapse; width: 100%; font-size: 13px; }
.md th, .md td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; } .md th { color: var(--muted); font-size: 12px; }
.md mark.ph { background: var(--pbx); color: var(--ink); border-radius: 6px; padding: 0 5px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.paper-doc { background: #fff; border-radius: 16px; padding: 28px; }

@media (max-width: 860px) {
  .sx-grid > * { grid-column: span 12 !important; }
  .sx-row { flex-wrap: wrap; } .sx-rows-head { display: none; } .sx-row .lbl.sr { position: static; width: auto; height: auto; clip: auto; white-space: normal; }
  .perm-grid { grid-template-columns: minmax(0, 1fr); }
  .topsearch { display: none; }
}

@media print {
  .topbar, .no-print { display: none !important; }
  body { font-size: 12px; }
  .shell { max-width: none; padding: 0; }
  .tile { background: #fff; border: 1px solid #ddd; break-inside: avoid; }
  .tile.dark { background: #fff; color: #000; }
  a { color: inherit; text-decoration: none; }
}
@media print { .tabbar, .sx-add, .sx-tools, .md-bar, dialog { display: none !important; } [data-panel][hidden] { display: block !important; } }
.sx textarea:not(.md-area) { min-height: 44px; }
.topbar .me { flex: none; }
.iconbtn { width: 40px; height: 40px; border-radius: 20px; border: 0; background: var(--tile); color: var(--ink2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.iconbtn:hover { background: #E9E9EE; color: var(--ink); }
@media (max-width: 1180px) { .topsearch { display: none; } }
@media (max-width: 860px) {
  .sx-row > .sx-drag { order: 1; } .sx-row > .sx-tools { order: 2; margin-left: auto; } .sx-row > .sx-grid { order: 3; flex: 1 1 100%; }
  .sx-card-body { padding-left: 8px; }
}
/* Buscador de la barra: icono que se despliega al pulsarlo (o con la tecla /) */
.topsearch { padding: 0; width: 40px; min-height: 40px; justify-content: center; transition: width .15s; cursor: text; }
.topsearch label { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; cursor: pointer; flex: none; }
.topsearch input { width: 0; padding: 0; transition: width .15s; }
.topsearch:focus-within { width: 260px; justify-content: flex-start; }
.topsearch:focus-within input { width: 200px; padding: 0 6px; }
@media (max-width: 1180px) { .topsearch { display: flex; } }
/* Móvil: marca y acciones arriba, menú debajo en una fila deslizable; el buscador sigue a mano. */
@media (max-width: 860px) {
  .topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 12px 0 14px; }
  .topbar .brand-wrap { min-width: 0; }
  .topbar .brand-name small { display: none; }
  .topbar .nav { grid-column: 1 / -1; grid-row: 2; }
  .topbar .me { grid-column: 2; grid-row: 1; gap: 6px; }
  .topsearch { display: flex; }
  .topsearch:focus-within { width: 190px; }
  .topsearch:focus-within input { width: 140px; }
  .cosw-menu { left: auto; right: 0; }
  .kb { grid-auto-columns: 82vw; }
  .vsw a { padding: 0 9px; }
}
@media (max-width: 520px) {
  .topbar .brand-name { display: none; }
  .topbar .me { gap: 4px; }
  .cosw summary { padding: 0 8px; }
  .topbar .iconbtn, .topsearch label { width: 36px; height: 36px; }
  .topsearch { width: 36px; min-height: 36px; }
}

/* ---- Selector de vista y tablas de datos */
.vsw { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--tile); }
.vsw a { display: inline-flex; align-items: center; gap: 5px; min-height: 32px; padding: 0 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--ink2); text-decoration: none; }
.vsw a.on { background: var(--ink); color: #fff; }
.dt-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.dt-count { margin-left: auto; }
.dt-cols { position: relative; }
.dt-cols summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; border-radius: 999px; background: var(--tile); font-size: 12.5px; font-weight: 600; }
.dt-cols summary::-webkit-details-marker { display: none; }
.dt-colmenu { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; display: flex; flex-direction: column; gap: 2px; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 28px rgba(18,19,22,.12); min-width: 200px; }
.dt-colmenu label { display: flex; align-items: center; gap: 8px; padding: 4px 6px; font-size: 13px; }
.dt-off { display: none; }
.dt-tbl th[data-sort] { cursor: pointer; user-select: none; white-space: nowrap; }
.dt-tbl th[data-sort]::after { content: ' ↕'; color: var(--line2); }
.dt-tbl th[aria-sort="ascending"]::after { content: ' ↑'; color: var(--ink); }
.dt-tbl th[aria-sort="descending"]::after { content: ' ↓'; color: var(--ink); }
.dt-tbl td.num, .dt-tbl th.num { text-align: right; white-space: nowrap; }
.dt-tbl tbody tr:hover td { background: #FAFAFC; }

/* ---- catalogo.css ---- */
/* ===== Catálogo y precios ===== */

/* Marca del producto (círculo de color con la inicial) */
.cat-mark { flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--c); color: var(--ink); font: 700 16px/1 var(--display); box-shadow: inset 0 0 0 1px rgba(18, 19, 22, .06); }
.cat-link, .cat-name a { color: var(--ink); text-decoration: none; }
.cat-link:hover, .cat-name a:hover { text-decoration: underline; }
.tile .cat-name { font: 700 19px/1.15 var(--display); letter-spacing: -.3px; }
.tile .cat-heroname { font: 700 30px/1.05 var(--display); letter-spacing: -.7px; }
.tile-head .stack > .pp, .cat-hero .stack > .pp { align-self: flex-start; }
.cat-filter { background: var(--tile); min-width: 260px; }
.cat-legend { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 10px; align-items: start; }
.cat-legend .pp { white-space: nowrap; }
/* Listas de textos dentro de los formularios del catálogo (puntos de venta) */

/* Listas con marca */
.cat-ticks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.cat-ticks li { display: flex; gap: 8px; align-items: flex-start; }
.cat-ticks li svg { flex: none; margin-top: 2px; color: var(--ok); }

/* Precio «desde» */
.cat-price { display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 4px 6px; }
.cat-price strong { font: 700 17px/1.1 var(--display); }
.cat-price.big strong { font-size: 30px; letter-spacing: -.6px; }
.tile.dark .cat-price .muted { color: var(--dark-muted); }

/* Catálogo */
.cat-intro .md { font-size: 15px; max-width: 760px; }
.cat-fam { display: flex; flex-direction: column; gap: 2px; padding: 14px 4px 0; border-top: 0; }
.cat-fam h2 { display: flex; align-items: center; gap: 10px; font: 700 22px/1.1 var(--display); letter-spacing: -.4px; }
.cat-fam h2::before { content: ''; width: 14px; height: 14px; border-radius: 7px; background: var(--c); }
.cat-fam p { color: var(--muted); font-size: 13px; max-width: 820px; padding-left: 24px; }
.cat-tile { border-top: 6px solid var(--c); }
.cat-tile.retired, .cat-model.retired { opacity: .72; }
.cat-hero { background: linear-gradient(135deg, color-mix(in srgb, var(--c) 34%, var(--tile)) 0%, var(--tile) 55%); }
.cat-hero-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 24px; }
.cat-modgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.cat-modchip { color: var(--ink); text-decoration: none; min-height: 110px; gap: 6px; }
a.cat-modchip:hover { box-shadow: 0 0 0 2px var(--ink); }
.cat-pp { text-decoration: none; }
.cat-pp:hover { box-shadow: 0 0 0 2px var(--ink); }
.cat-hometile .scatter { padding: 4px 0 0; }

/* Ficha del producto */
.cat-what { border-left: 8px solid var(--c); }
.cat-pricebox .cat-price strong { color: #fff; }
.cat-draftbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.cat-mod { position: relative; }
.cat-mod.retired { opacity: .66; background: repeating-linear-gradient(135deg, var(--tile), var(--tile) 12px, #EFEFF2 12px, #EFEFF2 24px); }
.cat-mod.hi { box-shadow: 0 0 0 3px var(--brand); }
.cat-modname { font: 700 18px/1.2 var(--display); letter-spacing: -.3px; }
.cat-modactions { gap: 6px; }
.cat-modactions form { display: inline-flex; }
.chip.warnchip { background: var(--warn-bg); color: var(--warn); }
.cat-add { justify-content: center; }

/* Calculadora de la ficha */
.cat-calc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 380px); gap: 16px; align-items: start; }
.cat-calc-inputs { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.cat-calc .tgl.on, .pe .tgl.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.cat-calc .tgl[disabled], .pe .tgl[disabled] { cursor: default; opacity: .85; }
.cat-calc-res { position: sticky; top: 12px; }
.cat-pendlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.cat-pendlist .li { align-items: flex-start; }
.cat-calc-res { background: var(--dark); color: #fff; border-radius: var(--r2); padding: 18px; display: flex; flex-direction: column; gap: 8px; transition: opacity .15s; }
.cat-calc-res.busy { opacity: .75; }
.cat-calc-cost { border-top: 1px solid var(--dark3); margin-top: 6px; padding-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.cat-calc-cost summary { cursor: pointer; color: var(--dark-muted); }

/* Ficha imprimible para clientes */
.cat-ficha { background: #fff; border-radius: var(--r); padding: 36px 40px; max-width: 920px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; border-top: 10px solid var(--c); }
.cat-ficha-head { display: flex; gap: 18px; align-items: center; }
.cat-ficha-pitch { font-size: 16px; line-height: 1.55; }
.cat-ficha-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.cat-ficha-block h3 { font: 700 15px/1.2 var(--display); margin-bottom: 8px; }
.cat-ficha-block p { font-size: 13.5px; line-height: 1.55; }
.cat-ficha-mods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cat-ficha-mod { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; break-inside: avoid; }

/* Lista de precios */
.cat-model { border-top: 6px solid var(--line2); }
.cat-steps { list-style: none; counter-reset: paso; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.cat-steps li { counter-increment: paso; background: #fff; border-radius: var(--r2); padding: 14px; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.cat-steps li::before { content: counter(paso); width: 26px; height: 26px; border-radius: 13px; background: var(--ink); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; }
.cat-steps li span { color: var(--muted); }
.li.cat-cur { box-shadow: 0 0 0 2px var(--ink); }
.cat-change .main span { white-space: normal; overflow-wrap: anywhere; }

/* ===== Editor de precios ===== */
.pe-root { min-height: 300px; }
.pe-bar { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 12px; margin: 0 -4px 12px; border-radius: 999px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(6px); box-shadow: 0 1px 0 var(--line), 0 8px 24px rgba(18, 19, 22, .06); }
.pe-bar.dirty { box-shadow: 0 0 0 2px var(--warn-bg), 0 8px 24px rgba(18, 19, 22, .08); }
.pe-badgebtn { border: 0; cursor: pointer; font-family: inherit; }
.pe-status.ok { color: var(--ok); } .pe-status.bad, .pe-status.conflict { color: var(--bad); } .pe-status.saving { color: var(--muted); }
.pe-errors ul { margin: 6px 0 0; padding-left: 18px; }
.btn.disabled { opacity: .5; pointer-events: none; }
.pe-section { gap: 16px; }
.pe-group { display: flex; flex-direction: column; gap: 10px; }
.pe-gtitle { font: 700 15px/1.2 var(--display); display: flex; align-items: center; gap: 8px; }
.pe-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.pe-cards.wide { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }
.pe-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pe-row > input[type=text], .pe-row > .pe-title { flex: 1; min-width: 0; }
.pe input[type=text], .pe input:not([type]), .pe select, .pe textarea, .pe .sx-num { background: var(--tile); min-height: 38px; }
.pe .sx-num input { background: transparent; min-height: 36px; }
.pe textarea { min-height: 38px; }
.pe input.pe-title { font-weight: 700; background: transparent; padding-left: 6px; }
.pe input.pe-title:hover, .pe input.pe-title:focus { background: var(--tile); }
.pe-value { flex: 1 1 140px; } .pe-value input { font: 700 18px var(--display); }
.pe input.pe-unit { flex: 0 1 130px; min-width: 80px; font-size: 12.5px; }
.pe input.pe-source { font-size: 12px; min-height: 34px; }
.pe-param { border-left: 5px solid var(--ok); }
.pe-param.st-pending { border-left-color: #E8A33A; background: #FFFBF3; }
.pe-param.st-estimate { border-left-color: var(--info); }
.pe-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; justify-content: space-between; font-size: 11.5px; }
.pe input.pe-groupsel { min-height: 30px; max-width: 150px; font-size: 12px; padding: 4px 10px; }
.pe-key { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; font: 12px ui-monospace, Consolas, monospace; color: var(--muted); }
.pe-key.editing input { min-height: 32px; max-width: 200px; }
.pe-link { border: 0; background: none; padding: 0; color: var(--link); font: 600 12px Inter, sans-serif; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.pe-err { color: var(--bad); font-size: 12px; font-weight: 600; }
.pe-num.bad { box-shadow: 0 0 0 2px var(--bad-bg); }
.pe-pills { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.pe-pill { min-height: 30px; padding: 0 10px; border-radius: 999px; border: 2px solid var(--line); background: #fff; color: var(--ink2); font: 600 12px Inter, sans-serif; cursor: pointer; }
.pe-pill:hover:not([disabled]) { border-color: var(--ink2); }
.pe-pill.on { background: var(--c); border-color: var(--c); color: var(--ink); }
.pe-pill.on:not([style]) { background: var(--ink); border-color: var(--ink); color: #fff; }
.pe-pill[disabled] { cursor: default; }
.pe-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.pe-margin { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.pe-margin select { max-width: 360px; }
.pe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; align-items: end; }
.pe-grid .field .lbl { display: flex; gap: 6px; align-items: center; }

/* Fórmulas */
.pe-formula { position: relative; display: flex; flex-direction: column; gap: 4px; }
.pe-formula-row { display: flex; gap: 6px; align-items: flex-start; }
.pe-formula textarea { flex: 1; font-size: 13px; line-height: 1.45; }
.pe-formula.bad textarea { box-shadow: 0 0 0 2px var(--bad-bg); border-color: var(--bad); }
.pe-formula-foot { min-height: 16px; }
.pe-picker-btn { flex: none; }
.pe-picker { position: absolute; right: 0; top: 100%; z-index: 30; width: min(460px, 92vw); max-height: 380px; display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 16px; background: #fff; box-shadow: 0 18px 50px rgba(18, 19, 22, .22); }
.pe-picker-list { overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.pe-picker-g { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--muted); margin: 4px 0; }
.pe-picker-it { width: 100%; display: flex; gap: 8px; align-items: baseline; text-align: left; border: 0; background: transparent; border-radius: 10px; padding: 6px 8px; cursor: pointer; font: 12.5px Inter, sans-serif; color: var(--ink); }
.pe-picker-it:hover:not([disabled]) { background: var(--tile); }
.pe-picker-it[disabled] { opacity: .45; cursor: not-allowed; }
.pe-picker-it code { flex: none; font-weight: 700; }
.pe-picker-it span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pe-concept.off, .pe-module.off { opacity: .65; }
.pe-module.hi { box-shadow: 0 0 0 3px var(--brand); }
.pe-price { background: var(--tile); gap: 8px; }
.pe-price select, .pe-price input[type=text], .pe-price .sx-num { background: #fff; }
.pe-bullets { display: flex; flex-direction: column; gap: 6px; }
.pe .pe-optval { flex: 0 0 110px; }
.pe-idx { flex: none; width: 26px; height: 26px; border-radius: 13px; background: var(--tile); display: inline-flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 700; }
.pe-val { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.pe-grid-table input { min-width: 96px; }
.pe-test.ok { border-left: 5px solid var(--ok); } .pe-test.bad { border-left: 5px solid var(--bad); }
.pe-result { gap: 12px; }
.pe-result .note { color: var(--ink); }
.pe-breakdown { display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--dark3); padding-top: 10px; max-height: 340px; overflow: auto; }
.pe .sx-ib[disabled] { opacity: .3; cursor: not-allowed; background: none; }
.pe textarea.pe-title { flex: 1; min-width: 0; min-height: 36px; resize: none; field-sizing: content; font-weight: 700; font-family: inherit; line-height: 1.3; background: transparent; padding: 7px 8px; overflow: hidden; }
.pe textarea.pe-title:hover, .pe textarea.pe-title:focus { background: var(--tile); }
.pe-formula textarea { field-sizing: content; max-height: 220px; }
.pe-grid > .field:has(.pe-pills) { grid-column: 1 / -1; }

@media (max-width: 860px) {
  .cat-hero-grid, .cat-calc, .cat-ficha-grid, .cat-ficha-mods { grid-template-columns: minmax(0, 1fr); }
  .cat-calc-res { position: static; }
  .cat-steps { grid-template-columns: minmax(0, 1fr); }
  .pe-cards.wide { grid-template-columns: minmax(0, 1fr); }
  .pe-bar { border-radius: 20px; position: static; }
  .cat-ficha { padding: 22px; }
}

@media print {
  .cat-ficha { border: 0; padding: 0; max-width: none; }
  .cat-ficha-mod { border-color: #ccc; }
}

/* Ficha: marca de la empresa, preguntas frecuentes */
.cat-ficha-brand { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 12px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.cat-ficha-faq { margin: 0; }
.cat-ficha-faq dt { font-weight: 700; margin-top: 10px; }
.cat-ficha-faq dd { margin: 2px 0 0; }
.cat-faq { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 8px; }
.cat-faq details { background: var(--tile); border-radius: 14px; padding: 10px 14px; }
.cat-faq summary { cursor: pointer; font-weight: 600; }
.cat-faq details p { margin-top: 6px; }

/* ¿Qué producto encaja? */
.cat-fit fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.cat-fit-opt { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--tile); cursor: pointer; }
.cat-fit-opt > span { display: flex; flex-direction: column; }
.cat-fit-opt input { margin-top: 3px; }
.cat-rec { border-left: 6px solid var(--c, var(--line2)); }
.cat-rec.alternativa { opacity: .85; }

/* Infraestructura */
.inf-bar { height: 10px; border-radius: 999px; background: var(--tile); overflow: hidden; }
.inf-bar span { display: block; height: 100%; border-radius: 999px; background: var(--ink); }
.tbl tr.on td { background: var(--info-bg); font-weight: 600; }

/* Editor de precios: explicación en palabras y tabla de costes */
.pe-explain { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 12px; background: var(--tile); }
.pe-explain ul { margin: 2px 0 0; padding-left: 18px; }
.cost-tbl .cost-val { width: 120px; text-align: right; min-height: 34px; padding: 4px 8px; }
.cost-tbl .cost-note { display: block; margin-top: 4px; min-height: 30px; padding: 2px 8px; font-size: 12px; width: 100%; }
.cost-tbl input, .cost-tbl select { min-height: 34px; padding: 4px 8px; }
.cost-tbl tr.st-pending td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.cost-tbl tr.st-estimate td:first-child { box-shadow: inset 3px 0 0 var(--line2); }
.cost-tbl { table-layout: fixed; }
.cost-tbl th:nth-child(1) { width: 30%; } .cost-tbl th:nth-child(2) { width: 13%; } .cost-tbl th:nth-child(3) { width: 12%; }
.cost-tbl th:nth-child(4) { width: 12%; } .cost-tbl th:nth-child(5) { width: 15%; } .cost-tbl th:nth-child(6) { width: 9%; } .cost-tbl th:nth-child(7) { width: 9%; }
.cost-tbl input:not(.cost-val), .cost-tbl select { width: 100%; }

/* ---- comercial.css ---- */
/* Área Comercial: clientes, embudo, propuestas y configurador (sobre los estilos bento comunes). */

/* ---- Piezas comunes ---- */
.cm-mark { flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--c, var(--caller)); color: var(--ink); font: 700 15px var(--display); }
.cm-sel select { min-height: 40px; padding: 6px 12px; border-radius: 999px; width: auto; max-width: 240px; font-weight: 600; font-size: 13px; }
.cm-filters { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px; }
.cm-q { flex: 1 1 260px; display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 999px; padding: 0 14px; color: var(--muted); }
.cm-q input { border: 0 !important; background: transparent; min-height: 40px; padding: 0; }
.tile.cm-warn { background: var(--warn-bg); }
a.tile.cm-warn:hover { background: #FFE6B8; }
.cm-sug { text-decoration: none; cursor: pointer; padding: 6px 12px; font-size: 12px; }
.cm-sug:hover { filter: brightness(.95); color: var(--ink); }
.cm-new { outline: 3px solid var(--brand); outline-offset: 1px; }
.cm-fs { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.cm-check { cursor: pointer; min-height: 60px; }
.cm-check:has(input:checked) { outline: 2px solid var(--ink); }
.cm-prodcard { border-left: 6px solid var(--c, var(--line2)); align-items: flex-start; }

/* ---- Clientes ---- */
.cm-client { gap: 12px; }
.cm-next { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: #fff; margin-top: auto; color: var(--ink2); }
.cm-next.warn { background: var(--warn-bg); color: var(--warn); }
.cm-head { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 24px; }
.cm-step.warn { background: var(--warn-bg); }
.cm-contact { border-top: 6px solid var(--c, var(--line2)); }
.cm-contact a { color: var(--ink); }
.cm-newtile { align-items: flex-start; justify-content: center; min-height: 180px; color: var(--ink2) !important; }

/* ---- Cronología ---- */
.cm-tl { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cm-tl-day { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin: 8px 0 2px 4px; }
.cm-tl-day:first-child { margin-top: 0; }
.cm-tl-it { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 14px; background: #fff; }
.cm-tl-it.auto { background: transparent; border: 1px dashed var(--line2); padding: 8px 12px; }
.cm-tl-it .main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cm-tl-it .main strong { font-size: 13.5px; font-weight: 600; }
.cm-tl-it .main a { color: var(--ink); text-decoration: none; } .cm-tl-it .main a:hover { text-decoration: underline; }
.cm-tl-text { font-size: 12.5px; color: var(--ink2); white-space: pre-line; overflow-wrap: anywhere; }
.cm-tl-ico { flex: none; width: 28px; height: 28px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; background: var(--c, var(--tile)); color: var(--ink); }

/* ---- Embudo ---- */
.cm-funnel { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.cm-phase { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 18px; background: #fff; color: var(--ink); text-decoration: none; border-top: 8px solid var(--c, var(--line2)); }
.cm-phase:hover { background: #FAFAFB; color: var(--ink); }
.cm-phase.on { outline: 2px solid var(--ink); }
.cm-phase-top { display: flex; justify-content: space-between; gap: 6px; align-items: baseline; }
.cm-prop { border-top: 6px solid var(--c, transparent); }
.cm-bar { display: flex; flex-direction: column; gap: 4px; color: var(--ink); text-decoration: none; }
.cm-bar:hover strong { text-decoration: underline; }
.cm-quick .pp { font-size: 12px; }

/* ---- Fases de una propuesta ---- */
.cm-stages-tile { gap: 12px; }
.cm-stages { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.cm-stage { flex: 1 1 120px; }
.cm-stage form { margin: 0; }
.cm-stage-btn { width: 100%; min-height: 48px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 0; padding: 6px 14px; border: 2px solid var(--line2); border-radius: 14px; background: #fff; color: var(--ink); font: 600 13px Inter, sans-serif; cursor: pointer; text-align: left; }
.cm-stage-btn .tiny { color: var(--muted); font-weight: 500; }
.cm-stage-btn:not([disabled]):hover { border-color: var(--c, var(--ink)); }
.cm-stage-btn[disabled] { cursor: default; opacity: .65; }
.cm-stage.on .cm-stage-btn { background: var(--c, var(--ink)); border-color: var(--c, var(--ink)); opacity: 1; box-shadow: inset 0 0 0 2px var(--ink); }
.cm-stage.on .cm-stage-btn .tiny { color: var(--ink2); }
.cm-stage.lost .cm-stage-btn { border-style: dashed; }
.cm-appr.warn { background: var(--warn-bg); } .cm-appr.bad { background: var(--bad-bg); } .cm-appr.info { background: var(--info-bg); }

/* ---- Configurador ---- */
.cfg { display: flex; flex-direction: column; gap: 16px; }
.cfg-bar { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; }
.cfg-bar > .note { flex-basis: 100%; }
.cfg-how summary { cursor: pointer; font-weight: 600; font-size: 13.5px; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
.cfg-how summary::before { content: '?'; display: inline-flex; width: 22px; height: 22px; border-radius: 11px; align-items: center; justify-content: center; background: #fff; font-size: 12px; }
.cfg-how ol { margin: 8px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 3px; }
.cfg-verform input { min-height: 36px; padding: 6px 12px; width: 260px; max-width: 46vw; border-radius: 999px; font-size: 13px; }
.cfg-line { border-top: 8px solid var(--c, var(--line2)); gap: 12px; scroll-margin-top: 16px; }
.cfg-line-head { display: flex; align-items: flex-start; gap: 10px; }
.cfg-line-head h3 { font: 700 20px/1.15 var(--display); letter-spacing: -.3px; }
.cfg-dot { flex: none; width: 14px; height: 14px; border-radius: 7px; background: var(--c, var(--line2)); margin-top: 6px; }
.cfg-sec { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.cfg-sec-t { font-weight: 700; font-size: 13px; }
.cfg-mods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.cfg-mod { display: flex; gap: 10px; align-items: flex-start; text-align: left; padding: 10px 12px; border-radius: 14px; border: 2px solid transparent; background: #fff; color: var(--ink); font: inherit; cursor: pointer; min-height: 56px; }
.cfg-mod:not([disabled]):hover { border-color: var(--line2); }
.cfg-mod.on { border-color: var(--ink); }
.cfg-mod[disabled] { cursor: default; }
.cfg-mod strong { font-size: 13.5px; font-weight: 600; }
.cfg-tick { flex: none; width: 24px; height: 24px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; background: var(--tile); color: var(--muted); }
.cfg-mod.on .cfg-tick { background: var(--c, var(--ink)); color: var(--ink); }
.cfg-desc { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cfg-mod-price { flex: none; font-size: 12px; font-weight: 700; white-space: nowrap; padding-top: 3px; }
.cfg-inputs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; align-items: start; }
.cfg-in { display: flex; flex-direction: column; min-width: 0; }
.cfg-in .hint { line-height: 1.35; }
.cfg-switch { display: flex; gap: 10px; align-items: center; min-height: 44px; cursor: pointer; }
.cfg-line-foot { display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--line); padding-top: 10px; }
.cfg-add { gap: 12px; }
.cfg-add-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.cfg-prod { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; padding: 12px; border-radius: 16px; border: 2px solid transparent; background: #fff; color: var(--ink); font: inherit; cursor: pointer; border-top: 6px solid var(--c, var(--line2)); }
.cfg-prod:hover { border-color: var(--ink); border-top-color: var(--c, var(--ink)); }
.cfg-prod.dashed { background: transparent; border: 2px dashed var(--line2); }
.cfg-total { position: sticky; top: 12px; align-self: start; }
.cfg-rows { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--dark3); border-bottom: 1px solid var(--dark3); padding: 10px 0; }
.cfg-disc { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 18px; background: var(--dark2); }
.cfg-discv { display: flex; align-items: center; justify-content: center; gap: 4px; font: 700 22px var(--display); }
.cfg-discv input { width: 90px; min-height: 44px; text-align: center; font: 700 22px var(--display); background: var(--dark3) !important; color: #fff !important; border-radius: 12px; padding: 4px; }
.cfg-appr { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 16px; color: var(--ink); }
.cfg-appr.ok { background: var(--summy); } .cfg-appr.warn { background: var(--pbx); } .cfg-appr.bad { background: var(--sosmotor); } .cfg-appr.info { background: var(--caller); }
.cfg-appr a { color: var(--ink); font-weight: 700; }
.cfg-appr textarea { min-height: 60px; background: #fff; color: var(--ink); }

/* ---- Documento de la propuesta ---- */
.cm-doc { font-family: Inter, system-ui, sans-serif; max-width: 900px; margin: 0 auto; }
.cm-doc-head { border-top: 5px solid var(--co, var(--line2)); padding-top: 18px; }
.cm-doc-logo { display: block; height: 58px; width: auto; margin: -8px 0 0 -14px; }
.cm-doc-h { font: 700 15px var(--display); margin: 26px 0 8px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.cm-doc-line { border-left: 6px solid var(--c, var(--line2)); padding: 10px 0 10px 16px; margin-bottom: 14px; break-inside: avoid; }
.cm-doc-mods { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cm-doc-mods li { display: flex; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); padding-top: 6px; }
.cm-doc-total { border-top: 2px solid var(--ink); margin-top: 18px; padding-top: 14px; display: flex; flex-direction: column; gap: 6px; break-inside: avoid; }

@media (max-width: 1100px) {
  .cfg-inputs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cfg-mods { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .cfg-inputs { grid-template-columns: minmax(0, 1fr); }
  .cfg-total { position: static; }
  .cfg-verform { flex-wrap: wrap !important; }
  .cfg-verform input { width: 100%; max-width: none; }
  .cm-sel select { max-width: none; }
}
@media print {
  .cm-doc { max-width: none; padding: 0; }
}
.cm-contact .pp, .cm-contact .badge { align-self: flex-start; }
.tile.dark .stat-l, .tile.dark .tiny.muted { color: var(--dark-muted); }
.cfg-cross { display: flex; flex-direction: column; gap: 4px; }

/* ---- Vistas: kanban del embudo */
.kb { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.kb-col { background: var(--tile); border-radius: 18px; padding: 10px; min-height: 160px; border-top: 4px solid var(--c, var(--line2)); transition: background .15s; }
.kb-col.closed { opacity: .85; }
.kb-col.over { background: #E6F1FB; outline: 2px dashed var(--brand); outline-offset: -4px; }
.kb-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 2px 4px 10px; }
.kb-head strong { font-size: 14px; }
.kb-head .tiny { flex-basis: 100%; }
.kb-dot { width: 10px; height: 10px; border-radius: 5px; background: var(--c, var(--line2)); }
.kb-list { display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.kb-card { background: #fff; border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 1px 2px rgba(18,19,22,.06); cursor: grab; }
.kb-card.dragging { opacity: .5; cursor: grabbing; }
.kb-card[hidden] { display: none; }
.kb-link { display: flex; flex-direction: column; gap: 2px; color: var(--ink); text-decoration: none; }
.kb-link:hover strong { text-decoration: underline; }
.kb-drop { margin: 4px; }
.kb-toast { position: fixed; right: 16px; bottom: 16px; z-index: 50; max-width: 420px; }

/* ---- legal.css ---- */
/* Legal y cumplimiento (prefijo lg-) */

/* Qué es cada cosa */
.lg-tile-explain { padding: 16px; }
.lg-explain { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.lg-ex { background: #fff; border-radius: var(--r2); padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.lg-ex strong { font: 700 15px/1.2 var(--display); }
.lg-ex .small { color: var(--ink2); }
.lg-ex-ico { width: 36px; height: 36px; border-radius: 18px; background: var(--c); display: inline-flex; align-items: center; justify-content: center; color: var(--ink); }

/* Subencargados */
.lg-subgrid { align-items: stretch; }
.lg-subcard { color: var(--ink); text-decoration: none; min-height: 132px; }
.lg-subcard:hover { box-shadow: 0 0 0 2px var(--line2); }
.lg-subcard[hidden] { display: none; }
.lg-avatar { flex: none; width: 36px; height: 36px; border-radius: 18px; background: var(--mut-bg); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; text-transform: capitalize; }
.lg-dots { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.lg-kv dd { font-weight: 500; overflow-wrap: anywhere; }
.lg-kv dt { white-space: nowrap; }
.lg-stat { text-decoration: none; color: var(--ink); gap: 2px; }
.lg-stat:hover { box-shadow: 0 0 0 2px var(--line2); }

/* Tipo de cambio */
.lg-kind-pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; color: var(--ink); background: var(--mut-bg); flex: none; }
.lg-kind-pill.k-alta { background: var(--summy); } .lg-kind-pill.k-baja { background: var(--sosmotor); }
.lg-kind-pill.k-sustitucion { background: var(--caller); } .lg-kind-pill.k-cambio { background: var(--pbx); }
.lg-kinds { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; border: 0; margin: 0; }
.lg-kind { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: var(--r2); background: #fff; border: 2px solid transparent; cursor: pointer; min-height: 120px; }
.lg-kind input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.lg-kind-t { font: 700 18px/1.1 var(--display); }
.lg-kind::before { content: ''; width: 28px; height: 6px; border-radius: 3px; background: var(--mut-bg); }
.lg-kind.k-alta::before { background: var(--summy); } .lg-kind.k-baja::before { background: var(--sosmotor); }
.lg-kind.k-sustitucion::before { background: var(--caller); } .lg-kind.k-cambio::before { background: var(--pbx); }
.lg-kind:has(input:checked) { border-color: var(--ink); }
.lg-kind:has(input:focus-visible) { outline: 3px solid var(--brand); outline-offset: 2px; }
.lg-actions { gap: 10px; }
.tile.lg-actions { flex-direction: row; align-items: center; }

/* Asistente: pasos */
.lg-steps ol { list-style: none; margin: 0; padding: 4px; display: flex; gap: 4px; background: var(--tile); border-radius: 999px; overflow-x: auto; scrollbar-width: none; }
.lg-steps ol::-webkit-scrollbar { display: none; }
.lg-steps li { flex: 1 1 0; min-width: max-content; }
.lg-steps a, .lg-steps li > span { display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 14px; border-radius: 999px; color: var(--ink2); text-decoration: none; font-weight: 600; font-size: 13px; }
.lg-steps a:hover { background: #E9E9EE; color: var(--ink); }
.lg-steps .n { flex: none; width: 24px; height: 24px; border-radius: 12px; background: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.lg-steps li.done .n { background: var(--ok); color: #fff; }
.lg-steps li.on a, .lg-steps li.on > span { background: var(--ink); color: #fff; }
.lg-steps li.on .n { background: var(--dark3); color: #fff; }
.lg-steps li > span { color: var(--muted); }
.lg-col { gap: 16px; min-width: 0; }
.lg-errors { margin: 0; padding-left: 18px; color: var(--bad); font-size: 13px; display: flex; flex-direction: column; gap: 4px; }

/* Asistente: productos y módulos */
.lg-prods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.lg-prod { border: 2px solid transparent; border-radius: var(--r2); background: #fff; padding: 12px; margin: 0; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.lg-prod:has(.lg-prod-head input:checked) { border-color: var(--c, var(--ink)); }
.lg-prod-head { display: flex; align-items: center; gap: 8px; cursor: pointer; flex-wrap: wrap; }
.lg-prod-head strong { font-size: 14px; }
.lg-prod-body { display: flex; flex-direction: column; gap: 8px; padding-left: 26px; }
.lg-prod:not(:has(.lg-prod-head input:checked)) .lg-prod-body { display: none; }
.lg-radio { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; }
.lg-radio label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.lg-radio input { width: 16px; height: 16px; accent-color: var(--ink); }
.lg-prod-body:not(:has(input[value=modulos]:checked)) .lg-mods { display: none; }
.lg-prod-body input[type=text] { background: var(--tile); }

/* Subidas */
.lg-upload { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: 8px; align-items: end; background: rgba(255, 255, 255, .55); border-radius: var(--r2); padding: 10px; }
.lg-upload input[type=file] { font-size: 12.5px; min-height: 44px; padding: 10px; background: #fff; border-radius: 14px; width: 100%; }
form.tile .lg-upload { grid-template-columns: 2fr 1fr; }

/* Clientes afectados y avisos */
.lg-ccrow { flex-wrap: wrap; align-items: flex-start; scroll-margin-top: 16px; }
.lg-ccrow:target { box-shadow: 0 0 0 2px var(--brand); }
.lg-ccrow > .main { flex: 1 1 260px; }
.lg-ccrow form { display: inline-flex; }
.lg-obj { display: block; margin-top: 4px; padding: 6px 10px; border-radius: 10px; background: var(--bad-bg); color: var(--ink) !important; font-size: 12px; }
.lg-mail { background: #fff; border-radius: var(--r2); padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.lg-mail .md { font-size: 13px; }

/* Historial */
.lg-timeline { list-style: none; margin: 0; padding: 0 0 0 4px; display: flex; flex-direction: column; gap: 0; }
.lg-timeline li { display: grid; grid-template-columns: 86px 1fr; gap: 12px; position: relative; padding: 0 0 12px 14px; border-left: 2px solid var(--line2); }
.lg-timeline li::before { content: ''; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 6px; background: var(--line2); border: 2px solid var(--tile); }
.lg-timeline li.t-alta::before { background: var(--ok); } .lg-timeline li.t-baja::before { background: var(--bad); }
.lg-timeline li.t-cambio::before { background: var(--info); } .lg-timeline li.t-correccion::before { background: var(--muted); }
.lg-timeline .d { font-size: 12px; font-weight: 700; color: var(--ink2); font-variant-numeric: tabular-nums; }
.lg-timeline .b { display: flex; flex-direction: column; gap: 2px; font-size: 13px; min-width: 0; }

/* Fases de un contrato */
.lg-phases { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.lg-phases li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: #fff; font-size: 13px; font-weight: 600; color: var(--muted); }
.lg-phases .n { flex: none; width: 22px; height: 22px; border-radius: 11px; background: var(--line); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; }
.lg-phases li.done { color: var(--ink); } .lg-phases li.done .n { background: var(--ok); color: #fff; }
.lg-phases li.on { background: var(--ink); color: #fff; } .lg-phases li.on .n { background: var(--dark3); color: #fff; }

/* Documento (vista previa e impresión) */
.lg-preview { max-height: 760px; overflow: auto; border-radius: 16px; }
.lg-paper { padding: 40px 48px; }
.lg-paper.compact { padding: 28px 32px; }
.lg-paper .lg-doc-title { font: 700 24px/1.2 Georgia, 'Times New Roman', serif; margin-bottom: 4px; }
.lg-paper .lg-doc-sub { color: var(--muted); font: 12.5px Inter, sans-serif; margin-bottom: 20px; }
.lg-draft-note { color: var(--bad); font: 700 11.5px Inter, sans-serif; text-align: right; margin-bottom: 8px; }
.lg-doc-sec { margin-top: 18px; break-inside: auto; }
.lg-doc-sec > h2 { font: 700 16px/1.3 Georgia, 'Times New Roman', serif; margin-bottom: 8px; break-after: avoid; }
.lg-doc-md { font-family: Georgia, 'Times New Roman', serif; font-size: 14px; text-align: justify; }
.lg-doc-md > * + * { margin-top: .55em; }
.lg-doc-note { font-style: italic; font-size: 13px; margin-top: 8px; }
.lg-doc-tbl { width: 100%; border-collapse: collapse; font: 12px/1.4 Inter, sans-serif; margin: 6px 0 10px; background: #fff; }
.lg-doc-tbl th, .lg-doc-tbl td { border: 1px solid var(--line2); padding: 6px 8px; text-align: left; vertical-align: top; }
.lg-doc-tbl th { background: #EDEDF1; font-weight: 700; }
.lg-kitdoc { display: flex; flex-direction: column; gap: 10px; }
.lg-kitdoc .card { border: 1px solid var(--line); }
.lg-ph { display: flex; flex-direction: column; gap: 4px; max-height: 360px; overflow: auto; }
.lg-ph code { font-size: 11.5px; background: #fff; padding: 1px 6px; border-radius: 6px; }

@media (max-width: 1100px) {
  .lg-explain, .lg-kinds { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lg-upload { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .lg-explain, .lg-kinds, .lg-prods, .lg-phases { grid-template-columns: minmax(0, 1fr); }
  .lg-upload { grid-template-columns: minmax(0, 1fr); }
  .lg-timeline li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .lg-paper { padding: 24px 18px; }
}
@media print {
  .lg-preview { max-height: none; overflow: visible; }
  .lg-paper { padding: 0; }
  .lg-doc-sec { break-inside: auto; }
}

/* Ajustes de lectura */
.md.lg-doc-md > * + *, .lg-mail .md > * + *, .lg-kitdoc .md > * + * { margin-top: .6em; }
.lg-subcard > .badge { align-self: flex-start; }
.lg-who { background: var(--mut-bg); font-size: 11.5px; white-space: nowrap; }
.lg-upload.three { grid-template-columns: minmax(0, 1fr) minmax(140px, auto) auto; }
.lg-upload { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lg-upload > .btn { justify-self: start; }
.lg-more { margin-top: 4px; }
.lg-more > summary { cursor: pointer; font-weight: 600; font-size: 13px; padding: 8px 2px; color: var(--ink2); }
.lg-more[open] > summary { margin-bottom: 8px; }
@media (max-width: 860px) { .lg-upload, .lg-upload.three, form.tile .lg-upload { grid-template-columns: minmax(0, 1fr); } }

/* Cuestionario de seguridad */
.lg-q { margin: 12px 0 0; }
.lg-q dt { font-weight: 700; margin-top: 14px; }
.lg-q dd { margin: 4px 0 0; }

/* ---- saber.css ---- */
/* ===== Guía y documentos ===== */
/* «hidden» tiene que ganar a los display:flex de .tile, .card y .li (filtros instantáneos). */
[data-docs] [hidden], [data-docs-empty][hidden], [data-group][hidden], #guia [hidden], #glosario [hidden], #preguntas [hidden], .sb-filters [hidden] { display: none !important; }
.sb-md td, .sb-md th, .sb-paper td, .sb-paper th, .sb-print td, .sb-print th { overflow-wrap: break-word; }
.sb-start h2.mid { font-size: 26px; color: inherit; }
.clamp1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.clamp3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sb-col { gap: 16px; min-width: 0; }
.bento > .sb-col { align-self: start; }

/* Progreso */
.prog { height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; }
.prog > i { display: block; height: 100%; border-radius: 5px; background: var(--ink); transition: width .3s; }
.tile.dark .prog { background: var(--dark3); } .tile.dark .prog > i { background: var(--sumgrey); }
.tile.teal .prog, .tile.green .prog { background: rgba(255, 255, 255, .6); }

/* Marca de lectura */
.sb-rd { flex: none; width: 22px; height: 22px; border-radius: 11px; border: 2px solid var(--line2); background: #fff; display: inline-flex; align-items: center; justify-content: center; color: #fff; font: 700 12px/1 Inter, sans-serif; }
.sb-rd.on { background: var(--ok); border-color: var(--ok); }
.sb-rd.upd { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }

/* Portada de la guía: «Empieza aquí» */
.sb-start .kicker { color: var(--dark-muted); }
.tile.green.sb-start .kicker { color: var(--ink2); }
.sb-path { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px; }
.sb-path a { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: var(--dark2); color: #fff; text-decoration: none; font-weight: 600; font-size: 13px; min-height: 44px; }
.sb-path a:hover { background: var(--dark3); color: #fff; }
.sb-path .n { color: var(--dark-muted); font-size: 11.5px; }
.sb-path .t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-path .sb-rd { background: transparent; border-color: var(--dark3); }
.sb-path .sb-rd.on { background: var(--ok); border-color: var(--ok); }
.tile.green .sb-path a { background: rgba(255, 255, 255, .7); color: var(--ink); }
.tile.green .sb-path .n { color: var(--muted); }
.sb-searchtile { padding: 10px; }
.sb-searchtile input { background: #fff; }
.sb-sections { gap: 16px; }
.sb-page { align-items: flex-start; }
.sb-page .sb-rd { margin-top: 1px; }

/* Página de la guía */
.sb-article { background: #fff; border: 1px solid var(--line); padding: 32px 36px; box-shadow: inset 0 6px 0 var(--c, var(--line2)); }
.sb-md { font-size: 15px; line-height: 1.7; max-width: 76ch; }
.sb-md h2 { font-size: 22px; margin-top: 1.4em; }
.sb-md h3 { font-size: 17px; }
.sb-md table { font-size: 13.5px; }
.sb-md .md-note { font-size: 14.5px; }
.sb-readbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 16px; }
.sb-toc.on { outline: 2px solid var(--ink); }
.sb-toc .main strong { font-weight: 600; }

/* Glosario */
.sb-letters { display: flex; flex-wrap: wrap; gap: 4px; }
.sb-letters a { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; min-height: 32px; border-radius: 10px; background: #fff; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 13px; }
.sb-letters a:hover { background: var(--ink); color: #fff; }
.sb-letter { font: 700 20px/1 var(--display); padding-top: 6px; scroll-margin-top: 16px; }
.sb-term { scroll-margin-top: 16px; }
.sb-term > strong { font: 700 15px/1.2 var(--display); }
.sb-term:target { outline: 3px solid var(--brand); }
.sb-prod { box-shadow: inset 4px 0 0 var(--c, var(--line2)); color: var(--ink); text-decoration: none; }
.sb-prod:hover { background: #FAFAFB; }
details.acc:target { outline: 3px solid var(--brand); }

/* Biblioteca */
.sb-filters { gap: 12px; }
.sb-filters select, .sb-filters input[type=search] { min-height: 40px; }
.sb-facets { gap: 6px; }
.sb-facets .sx-pill span { gap: 6px; }
.sb-facets .dotc { width: 10px; height: 10px; }
.js-docs [data-nojs] { display: none; }
.sb-doc { position: relative; color: var(--ink); text-decoration: none; box-shadow: inset 0 4px 0 var(--c, var(--line2)); padding-top: 16px; min-height: 168px; }
.sb-doc:hover { background: #FAFAFB; }
.sb-doc:focus-visible { outline: 3px solid var(--brand); }
.sb-doc-t { font-size: 14px; font-weight: 700; line-height: 1.3; }
.sb-when { color: var(--ink2); }
.sb-doc-meta { margin-top: auto; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 11.5px; color: var(--muted); }
.sb-when-tile { box-shadow: inset 0 5px 0 var(--c, var(--line2)); }
.sb-when-big { font: 600 18px/1.4 var(--display); letter-spacing: -.2px; max-width: 70ch; }
.sb-summary { cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: 8px; list-style: none; }
.sb-summary::-webkit-details-marker { display: none; }
.sb-paper { max-height: 720px; overflow: auto; border: 1px solid var(--line); }
.sb-paper h3 { font: 700 16px/1.3 var(--display); margin: 1em 0 .4em; }
.sb-paper p + p { margin-top: .5em; }
.sb-pre { white-space: pre-wrap; background: #fff; border-radius: 14px; padding: 16px; max-height: 600px; overflow: auto; font-size: 12.5px; margin: 0; }
.sb-img { max-width: 100%; border-radius: 14px; background: #fff; }
.sb-pdf { display: flex; gap: 14px; align-items: flex-start; background: #fff; border-radius: 14px; padding: 18px; }
.sb-sheet td { white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.sb-home .big { font-size: 40px; }

/* Documento redactado listo para imprimir */
.sb-print { max-width: 820px; margin: 0 auto; }
.sb-print-head { display: flex; justify-content: space-between; gap: 12px; font: 600 11px Inter, sans-serif; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 22px; text-transform: uppercase; letter-spacing: .4px; }
.sb-print-title { font: 700 30px/1.15 var(--display); letter-spacing: -.5px; margin-bottom: 18px; }
.sb-print .md h2 { font-size: 19px; }

@media (max-width: 860px) {
  .sb-article { padding: 22px 18px; }
  .sb-path { grid-template-columns: minmax(0, 1fr); }
  .sb-filters select { width: 100% !important; }
}
@media print {
  .sb-print { max-width: none; box-shadow: none; padding: 0; }
  .sb-print mark.ph { background: none; border: 1px dashed #999; }
}
.sb-pdf-frame { width: 100%; height: 70vh; min-height: 420px; border: 0; border-radius: 16px; background: #fff; }
