/* Consola de The Builder — tokens de vellarin.ai */
:root { --bg: #FAFAF7; --card: #fff; --navy: #0B1437; --accent: #1E40AF; --accent-2: #1E3A8A; --ink: #0A0F2A; --ink-2: #4A4F63; --ink-3: #6E7387; --line: rgba(10, 15, 42, .13); --ok: #0F766E; --warn: #B45309; --err: #B91C1C; --r: 12px;
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; --mono: ui-monospace, SFMono-Regular, Menlo, monospace; }
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
button, a.btn, tr[data-href], .tile, summary { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1 { font-size: 1.5rem; letter-spacing: -.02em; } h2 { font-size: 1.05rem; margin: 0 0 10px; } h3 { font-size: .95rem; margin: 18px 0 8px; }
.muted { color: var(--ink-3); font-size: 14px; } .mono { font-family: var(--mono); font-size: 13px; } .warn { color: var(--warn); }
small { display: block; color: var(--ink-3); font-size: 12.5px; font-weight: 400; }
code { font-family: var(--mono); font-size: 13px; background: #EEF0F6; padding: 1px 5px; border-radius: 4px; }

.shell { display: grid; min-height: 100vh; grid-template-columns: 1fr; }
@media (min-width: 900px) { .shell { grid-template-columns: 232px 1fr; } }
.side { background: var(--navy); color: #fff; padding: 18px 14px; display: flex; flex-direction: column; gap: 16px; }
.side__brand { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: #fff; font-weight: 700; font-size: 18px; padding: 4px 8px; }
.side__brand img { height: 11px; align-self: flex-start; }
.side__co { padding: 10px 8px; border-top: 1px solid rgba(255,255,255,.15); border-bottom: 1px solid rgba(255,255,255,.15); display: grid; gap: 4px; font-size: 14px; }
.side__co span { font-size: 12px; } .side__co .on { color: #5EEAD4; } .side__co .off { color: #FCD34D; }
.side__nav { display: flex; gap: 2px; flex-wrap: wrap; }
@media (min-width: 900px) { .side__nav { flex-direction: column; } .side { position: sticky; top: 0; height: 100vh; } .side__me { margin-top: auto; } }
.side__nav a { color: #C7CDE0; text-decoration: none; padding: 9px 10px; border-radius: 8px; font-size: 14.5px; }
.side__nav a:hover { background: rgba(255,255,255,.08); color: #fff; } .side__nav a.is-on { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; }
.side__me { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 13px; color: #C7CDE0; padding: 0 8px; }
.side__me a { color: #fff; } .side__me button { background: none; border: 0; color: #fff; text-decoration: underline; font-size: 13px; }
.main { padding: 22px 18px 60px; min-width: 0; max-width: 1180px; width: 100%; }
@media (min-width: 900px) { .main { padding: 30px 36px 80px; } }
.main__h { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.main__a, .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row { margin-top: 14px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin-bottom: 14px; }
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 9px 16px; border-radius: 9px; background: var(--accent); border: 1px solid var(--accent); color: #fff; font-weight: 600; font-size: 14px; text-decoration: none; }
.btn:hover { background: var(--accent-2); } .btn:disabled { opacity: .55; cursor: default; }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--ink-3); } .btn--ghost:hover { background: #F0F1EC; }
.btn--danger { background: transparent; color: var(--err); border-color: var(--err); } .btn--danger:hover { background: #FEF2F2; }
.link { background: none; border: 0; color: var(--accent); text-decoration: underline; font-size: 13.5px; padding: 2px 0; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; margin-bottom: 12px; background: #fff; }
.seg button { border: 0; background: transparent; padding: 8px 14px; font-size: 13.5px; } .seg button.is-on { background: var(--navy); color: #fff; }
.flash { padding: 11px 14px; border-radius: 9px; margin-bottom: 14px; font-size: 14px; border-left: 4px solid var(--ok); background: #ECFDF5; }
.flash--err { border-color: var(--err); background: #FEF2F2; } .flash--warn { border-color: var(--warn); background: #FFFBEB; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #E5E7EB; color: #374151; white-space: nowrap; }
.pill--new { background: #DBEAFE; color: #1E3A8A; } .pill--reviewing, .pill--approved { background: #FEF3C7; color: #92400E; } .pill--quoted, .pill--published { background: #D1FAE5; color: #065F46; }

.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); margin-bottom: 14px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; text-decoration: none; color: var(--ink); display: grid; gap: 4px; }
div.tile { cursor: default; } .tile b { font-size: 1.9rem; letter-spacing: -.03em; line-height: 1.1; } .tile span { color: var(--ink-2); font-size: 13.5px; }
.scroll { overflow-x: auto; }
.t { width: 100%; border-collapse: collapse; font-size: 14px; }
.t th, .t td { text-align: left; padding: 10px 10px; border-top: 1px solid var(--line); vertical-align: top; }
.t thead th { border-top: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 600; white-space: nowrap; }
.t tr[data-href]:hover td { background: #F6F7F2; } .t td a { text-decoration: none; color: var(--ink); } .t td a:hover { text-decoration: underline; }
.acts { white-space: nowrap; text-align: right; }

.cols { display: grid; gap: 14px; } @media (min-width: 1000px) { .cols { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); align-items: start; } }
.dl > div { display: grid; grid-template-columns: 110px 1fr; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 14px; } .dl dt { color: var(--ink-3); }
.lines { list-style: none; } .lines li { display: flex; justify-content: space-between; gap: 14px; padding: 10px 0; border-top: 1px solid var(--line); } .qty { font-weight: 700; white-space: nowrap; }
.checks { list-style: none; display: grid; gap: 6px; font-size: 14px; } .checks small { display: inline; } .checks .ok { color: var(--ok); } .checks .miss { color: var(--warn); }

.form h2 { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); } .form h2:first-of-type, .form fieldset > h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
fieldset { border: 0; min-width: 0; }
.grid { display: grid; gap: 12px 16px; grid-template-columns: 1fr; margin: 8px 0; align-items: start; } @media (min-width: 720px) { .grid { grid-template-columns: 1fr 1fr; } }
.f { display: grid; gap: 5px; margin-bottom: 4px; } .f > span { font-size: 13px; color: var(--ink-2); font-weight: 600; }
input, select, textarea { border: 1px solid var(--ink-3); border-radius: 8px; padding: 8px 10px; background: #fff; width: 100%; min-width: 0; }
input[type="checkbox"] { width: auto; } input[type="color"] { padding: 2px; height: 38px; width: 70px; }
textarea { font-family: var(--mono); font-size: 13px; }
textarea[name="staff_notes"], textarea[name="dealer_notes"] { font-family: var(--font); font-size: 14px; }
.chk { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; margin: 4px 14px 4px 0; }
.opts { display: grid; gap: 8px; } .optrow { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; } .optrow b { width: 110px; font-size: 13.5px; }
.lvl { display: grid; grid-template-columns: 110px 1fr 1fr auto; gap: 8px; margin-bottom: 8px; align-items: center; }
@media (max-width: 640px) { .lvl { grid-template-columns: 1fr 1fr; } }
.form__err { color: var(--err); font-size: 14px; margin: 10px 0; }
.statusrow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.pre { background: var(--navy); color: #DCE3F7; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; padding: 14px; border-radius: 9px; overflow-x: auto; white-space: pre; margin: 10px 0; }
.bullets { padding-left: 20px; display: grid; gap: 4px; margin: 8px 0 14px; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 150px; overflow-x: auto; padding-top: 6px; }
.bar { flex: 1 0 18px; max-width: 36px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.bar i { display: block; width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; } .bar span { font-size: 10px; color: var(--ink-3); font-family: var(--mono); }
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; } .login__f { width: 100%; max-width: 400px; display: grid; gap: 10px; }
.skeleton { height: 54px; border-radius: var(--r); margin-bottom: 12px; background: linear-gradient(90deg, #ECEDE8 25%, #F6F7F2 50%, #ECEDE8 75%); background-size: 200% 100%; animation: sk 1.2s infinite linear; width: 100%; min-width: 240px; }
@keyframes sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

.fin { grid-template-columns: 1fr 80px 1fr auto; }

/* Builder: formulario y vista previa en vivo lado a lado */
.bcols { display: grid; gap: 14px; }
.bprev iframe { display: block; width: 100%; height: 560px; border: 1px solid var(--line); border-radius: 9px; background: #F3F4F1; margin-bottom: 8px; }
@media (min-width: 1180px) {
  .main:has(.bcols) { max-width: 1480px; }
  .bcols { grid-template-columns: minmax(0, 1fr) minmax(380px, 460px); align-items: start; }
  .bprev { position: sticky; top: 16px; order: 2; }
  .bprev iframe { height: calc(100vh - 150px); min-height: 420px; }
}
@media (max-width: 1179px) { .bprev { order: -1; } }
.own3d { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); display: grid; gap: 6px; font-size: 14px; }
.own3d__box { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.upl { position: relative; overflow: hidden; cursor: pointer; } .upl input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.upl.is-busy { opacity: .6; pointer-events: none; }
.logo { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 6px; }
.logo img { height: 44px; max-width: 180px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; padding: 4px; background: #fff; }

/* Verificación de elegibilidad en la solicitud */
.pill--verify { background: #FEE2E2; color: #991B1B; }
.verify { display: grid; gap: 10px; justify-items: start; } .verify p { margin: 0; }

/* IA: etiqueta, resumen de la solicitud y propuesta de configuración leída de un documento */
.aitag { display: inline-block; vertical-align: middle; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; padding: 2px 6px; border-radius: 5px; background: var(--navy); color: #fff; }
.aibox h3 { margin-top: 12px; } .aibox .row { margin: 10px 0; align-items: center; flex-wrap: wrap; }
.aibox .bullets { padding-left: 20px; display: grid; gap: 4px; margin: 8px 0 12px; font-size: 14px; }
#aireply { font-family: var(--font); font-size: 14px; line-height: 1.5; }
.btn--sm { padding: 7px 11px; font-size: 13.5px; white-space: nowrap; }
form[data-form="aisetup"] { margin-bottom: 14px; } #aiout:not(:empty) { margin-bottom: 14px; }
.stack { display: grid; gap: 14px; min-width: 0; }

/* Cuentas y seguridad: ingreso en dos pasos y registro de actividad */
.login__f .link { padding: 0; }
.twostep { display: grid; gap: 16px; align-items: center; margin: 12px 0; } @media (min-width: 720px) { .twostep { grid-template-columns: 200px 1fr; } }
.qr { width: 200px; max-width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px; } .qr svg { display: block; width: 100%; height: auto; }
.key { font-size: 16px; letter-spacing: .04em; word-break: break-all; margin: 4px 0; }
ol.bullets { padding-left: 22px; }

/* Builder: catálogo propio (modelos, grupos, valores propios y reglas de compatibilidad) */
.mdl > summary { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 15px; list-style-position: outside; }
.mdl > summary small { display: inline; } .mdl[open] > summary { margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.grps { display: grid; gap: 10px; }
.grp { border: 1px solid var(--line); border-radius: 9px; padding: 8px 12px 10px; display: grid; gap: 6px; }
.grp > .link { justify-self: start; } .grp__h { margin: 0; } .grp__h small { display: inline; }
.vrow { display: grid; grid-template-columns: minmax(0, 1fr) 150px 84px; gap: 6px 8px; align-items: center; font-size: 14px; }
.vrow .chk { margin: 0; } .vrow input:not([type="checkbox"]) { padding: 5px 8px; font-size: 13.5px; }
.vrow--own { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 130px minmax(0, 190px) 84px auto; background: #F6F7F2; border-radius: 8px; padding: 6px 8px; }
.vrow--own small { grid-column: 1 / -1; }
@media (max-width: 760px) { .vrow, .vrow--own { grid-template-columns: 1fr 1fr; } }
.rules { display: grid; gap: 6px; margin-bottom: 6px; }
.rule { display: grid; grid-template-columns: minmax(0, 1fr) 190px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
@media (max-width: 760px) { .rule { grid-template-columns: 1fr; } }
[data-newmodel] { margin-top: 0; align-items: center; } [data-newmodel] select { width: auto; flex: 1 1 220px; }
.link.warn { color: var(--err); }

/* Bandeja: búsqueda, páginas y CSV */
.searchbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; } .searchbar input { flex: 1 1 280px; width: auto; } .searchbar select { width: auto; }
.pager { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; } .pager .muted { margin-right: auto; }
.prewrap { white-space: pre-wrap; } .dl dd small { margin-top: 2px; }

/* Ajustes: distribuidores con territorio */
.drow { grid-template-columns: 96px minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) auto; }
@media (max-width: 900px) { .drow { grid-template-columns: 1fr 1fr; padding-bottom: 8px; border-bottom: 1px solid var(--line); } }

/* Actividad por opción */
.sech { margin: 22px 0 6px; font-size: 1.05rem; }
.optstats { display: grid; gap: 4px 28px; } @media (min-width: 900px) { .optstats { grid-template-columns: 1fr 1fr; } } .optstats h3 { margin: 12px 0 6px; }
.optbar { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(60px, 1fr) auto; gap: 10px; align-items: center; font-size: 13.5px; padding: 3px 0; }
.optbar small { display: inline; } .optbar i { display: block; height: 8px; border-radius: 4px; background: #E7E9E2; overflow: hidden; } .optbar i b { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.optbar em { font-style: normal; color: var(--ink-3); font-size: 12.5px; white-space: nowrap; }
/* Teléfono: las filas de solicitudes (bandeja y portada) pasan a tarjetas, así el estado no queda fuera de pantalla. */
@media (max-width: 700px) {
  .t:has(tr[data-href]) thead { display: none; }
  .t:has(tr[data-href]), .t:has(tr[data-href]) tbody { display: block; }
  .t tr[data-href] { display: block; padding: 10px 0; border-top: 1px solid var(--line); }
  .t tr[data-href] td { display: block; border: 0; padding: 2px 10px; }
  .t tr[data-href] td:first-child { color: var(--ink-3); font-size: 13px; }
}
/* Editor del Builder: rótulo corto sobre cada campo de una fila de valores (el texto de ejemplo desaparece al escribir). */
.vf { display: grid; gap: 2px; margin: 0; min-width: 0; } .vf > span { display: none; font-size: 11.5px; color: var(--ink-3); }
.vf--on > span { display: block; } @media (max-width: 760px) { .vf > span { display: block; } }
.vrow--own { align-items: end; }
.vrow--own { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.vrow--own .link { justify-self: start; }
