:root {
  --bg: #F5F6F8;
  --surface: #FFFFFF;
  --surface-2: #F9FAFB;
  --border: #E4E7EC;
  --border-2: #F2F4F7;
  --input: #D0D5DD;
  --text: #101828;
  --text-2: #344054;
  --text-3: #475467;
  --muted: #5B6474;
  --faint: #98A2B3;

  --side: #0B1726;
  --side-2: #132235;
  --side-3: #24384F;
  --side-line: #1B2B3F;
  --side-text: #C3CAD6;

  /* Colores de marca Sentrica (sentrica.cl) */
  --primary: #0284C7;
  --primary-hover: #0369A1;
  --primary-ink: #075985;
  --primary-soft: #E0F2FE;
  --primary-softer: #F0F9FF;
  --primary-line: #BAE6FD;
  --brand-accent: #189CD8;
  --link: #0369A1;

  --ok: #067647;
  --ok-bg: #DCFAE6;
  --ok-soft: #F2FBF5;
  --ok-line: #CDEFD9;
  --ok-solid: #079455;
  --ok-bar: #17B26A;

  --warn: #93370D;
  --warn-ink: #7A2E0E;
  --warn-bg: #FEF0C7;
  --warn-soft: #FFF8EB;
  --warn-line: #F8DDA8;
  --warn-solid: #B54708;
  --warn-bar: #F79009;

  --danger: #B42318;
  --danger-ink: #912018;
  --danger-bg: #FEE4E2;
  --danger-soft: #FEF3F2;
  --danger-bar: #D92D20;

  --gray-bg: #F2F4F7;
  --gray-solid: #475467;

  --icon: #667085;
  --seg-bg: #EAECF0;
  --danger-line: #FECDCA;
  --danger-solid: #D92D20;
  --info-ink: #1F2A5C;
  --surface-foot: #FCFCFD;
  --disabled: #667085;
  --overlay: rgba(15, 23, 41, .5);

  --r-lg: 16px;
  --r: 14px;
  --r-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 20px 48px rgba(16, 24, 40, .18);

  --font-title: Poppins, Montserrat, Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.5 var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--primary-ink); }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; font-family: var(--font-title); }
h1 { font-size: 28px; line-height: 36px; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 17px; line-height: 24px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
b, strong { font-weight: 600; }
svg { flex: none; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.hidden { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 12px; color: var(--text-3); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.danger-text { color: var(--danger); }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }

/* ---------- estructura ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; width: 248px; flex: none;
  background: var(--side); padding: 24px 16px; display: flex; flex-direction: column; gap: 24px; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; color: #FFFFFF; }
.brand:hover { color: #FFFFFF; }
.logo { width: 36px; height: 36px; border-radius: 10px; background: var(--primary); color: #FFFFFF; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text b { font-size: 16px; font-weight: 700; }
.brand-text small { color: var(--faint); font-size: 12px; }
.brand-logo { height: 34px; width: auto; display: block; }
.brand-sub { padding-left: 12px; border-left: 1px solid rgba(255, 255, 255, .22); color: var(--side-text); font-family: var(--font-title); font-size: 15px; font-weight: 500; line-height: 22px; }
.login-mobile-brand .brand-sub { border-left-color: var(--border); color: var(--text-3); }

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 12px; border-radius: var(--r-sm);
  color: var(--side-text); font-size: 14px; font-weight: 500;
}
.nav-link:hover { background: rgba(255, 255, 255, .06); color: #FFFFFF; }
.nav-link.active { background: rgba(255, 255, 255, .09); color: #FFFFFF; font-weight: 600; }
.nav-link .lbl { flex: 1; }
.nav-badge { background: var(--warn-bar); color: #1A1203; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 0 7px; line-height: 18px; }
.side-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.help-link { border: 1px solid var(--side-line); }
.operator { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--side-2); }
.avatar { width: 36px; height: 36px; border-radius: 999px; background: var(--side-3); color: #FFFFFF; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; flex: none; text-transform: uppercase; }
.op-field { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.op-field span { color: var(--faint); font-size: 12px; }
.op-field .op-name { color: #FFFFFF; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu { display: block; }
.avatar.sm { width: 40px; height: 40px; background: var(--primary-soft); color: var(--primary-ink); font-size: 13px; }
.line-gen { display: flex; gap: 8px; }
.line-gen input { font-family: var(--mono); font-size: 14px; }
.user-menu summary.operator { cursor: pointer; color: var(--side-text); }
.user-menu summary.operator:hover, .user-menu[open] summary.operator { background: var(--side-3); }
.user-menu summary.operator > svg { transform: rotate(-90deg); }
.user-menu .menu-list { min-width: 0; }
.menu-list .menu-head { padding: 8px 12px 6px; display: flex; flex-direction: column; font-size: 13px; color: var(--muted); }
.menu-list .menu-head b { color: var(--text); font-size: 14px; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#banner { width: 100%; max-width: 1200px; margin: 0 auto; padding: 24px 40px 0; }
main { width: 100%; max-width: 1200px; margin: 0 auto; padding: 28px 40px 56px; display: flex; flex-direction: column; gap: 24px; }
main:focus { outline: 0; }
.mobile-top, .bottom-nav, .backdrop { display: none; }

/* ---------- botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 16px;
  border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #FFFFFF; }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.primary:disabled { background: var(--disabled); border-color: var(--disabled); opacity: 1; }
.btn.danger { color: var(--danger); }
.btn.danger-solid { background: var(--danger-solid); border-color: var(--danger-solid); color: #FFFFFF; }
.btn.danger-solid:hover { background: var(--danger-ink); }
.btn.warn { background: var(--warn-solid); border-color: var(--warn-solid); color: #FFFFFF; }
.btn.warn:hover { background: var(--warn-ink); color: #FFFFFF; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--gray-bg); }
.btn.ghost-warn { border-color: transparent; background: transparent; color: var(--warn-ink); }
.btn.ghost-warn:hover { background: var(--warn-bg); color: var(--warn-ink); }
.btn.sm { height: 36px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.icon { width: 44px; padding: 0; }
.btn.sm.icon { width: 36px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: var(--r-sm); border: 0; background: transparent; color: var(--text-3);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.icon-btn:hover { background: var(--gray-bg); color: var(--text); }
.icon-btn.on-dark { color: var(--side-text); }
.icon-btn.on-dark:hover { background: rgba(255, 255, 255, .08); color: #FFFFFF; }

/* ---------- campos ---------- */
input, select, textarea {
  font: inherit; font-size: 15px; color: var(--text); background: var(--surface);
  border: 1px solid var(--input); border-radius: var(--r-sm); padding: 0 14px; height: 44px; width: 100%;
}
textarea { height: auto; padding: 10px 14px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary); }
input[type=checkbox], input[type=radio] { width: auto; height: auto; accent-color: var(--primary); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .field-label { font-size: 14px; font-weight: 600; color: var(--text); }
.field > span small, .field-label small { font-weight: 400; color: var(--muted); font-size: 13px; }
.hint, .field > .hint { font-size: 13px; font-weight: 400; color: var(--muted); }
.row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

.search {
  display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; flex: 1 1 280px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); color: var(--icon);
}
.search:focus-within { outline: 2px solid var(--primary); outline-offset: -1px; }
.search input { border: 0; outline: 0; height: 40px; padding: 0; background: transparent; min-width: 0; }
.search input:focus { outline: 0; }

/* ---------- cabecera de página ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.ph-text { flex: 1 1 260px; display: flex; flex-direction: column; gap: 4px; }
.eyebrow { font-size: 13px; color: var(--muted); font-weight: 500; }
.ph-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.toolbar select { width: auto; min-width: 180px; }
.toolbar .field-inline { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.toolbar .field-inline input { width: auto; }

.seg { display: flex; gap: 4px; padding: 4px; background: var(--seg-bg); border-radius: 12px; flex-wrap: wrap; }
.seg button, .seg a {
  height: 36px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: var(--text-2);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.seg button:hover, .seg a:hover { color: var(--text); }
.seg [aria-pressed=true], .seg [aria-current=page] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(16, 24, 40, .08); }
.seg .count { color: var(--muted); font-weight: 500; }

/* ---------- tarjetas ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.card.flush { padding: 0; gap: 0; overflow: hidden; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.card-head h2 { flex: 1; }
.card-head a { font-size: 14px; font-weight: 500; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 24px; }

.alert { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 16px 20px; border-radius: var(--r); border: 1px solid; }
.alert.warn { background: var(--warn-soft); border-color: var(--warn-line); }
.alert.warn .alert-icon { background: var(--warn-bg); color: var(--warn-solid); }
.alert.danger { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger-ink); }
.alert.info { background: var(--primary-softer); border-color: var(--primary-line); }
.alert.info .alert-icon { background: var(--primary-soft); color: var(--primary); }
.alert-icon { width: 40px; height: 40px; border-radius: var(--r-sm); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.alert-text { flex: 1 1 300px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.alert.warn .alert-text b { color: var(--warn-ink); }
.alert.warn .alert-text span { color: var(--warn); font-size: 14px; }
.alert.info .alert-text b { color: var(--info-ink); }
.alert.info .alert-text span { color: var(--text-2); font-size: 14px; }
.alert-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.callout { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-sm); font-size: 14px; line-height: 20px; }
.callout svg { margin-top: 1px; }
.callout.warn { background: var(--warn-soft); color: var(--warn-ink); }
.callout.danger { background: var(--danger-soft); color: var(--danger-ink); }
.callout.info { background: var(--primary-softer); color: var(--info-ink); }

/* acciones rápidas */
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.quick-card {
  display: flex; align-items: center; gap: 16px; padding: 20px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); font: inherit; color: var(--text); text-align: left; cursor: pointer;
}
.quick-card:hover { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.qi { width: 48px; height: 48px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.qt { display: flex; flex-direction: column; gap: 2px; }
.qt b { font-size: 16px; }
.qt small { font-size: 13px; color: var(--muted); }

/* recorrido de equipos */
.pipeline { display: flex; flex-wrap: wrap; align-items: stretch; gap: 12px; }
.pipe-arrow { display: flex; align-items: center; color: var(--faint); }
.stage { flex: 1 1 200px; display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; border-radius: 12px; border: 1px solid; color: var(--text); }
.stage:hover { color: var(--text); filter: brightness(.985); }
.stage-label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.stage-label .n { width: 22px; height: 22px; border-radius: 999px; color: #FFFFFF; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
.stage-count { font-size: 36px; line-height: 40px; font-weight: 700; letter-spacing: -0.02em; }
.stage-sub { font-size: 13px; color: var(--muted); }
.s-armado { background: var(--primary-softer); border-color: var(--primary-line); }
.s-armado .stage-label { color: var(--primary-ink); } .s-armado .n { background: var(--primary); }
.s-listo { background: var(--ok-soft); border-color: var(--ok-line); }
.s-listo .stage-label { color: var(--ok); } .s-listo .n { background: var(--ok-solid); }
.s-entregado { background: var(--surface-2); border-color: var(--border); }
.s-entregado .stage-label { color: var(--text-2); } .s-entregado .n { background: var(--gray-solid); }

/* listas con filas */
.rows { display: flex; flex-direction: column; }
.row-item { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 14px 0; border-top: 1px solid var(--border-2); }
.row-item:first-child { border-top: 0; padding-top: 0; }
.ri-main { flex: 1 1 200px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ri-title { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.cap-box { width: 64px; height: 56px; border-radius: 12px; background: var(--gray-bg); display: flex; flex-direction: column; align-items: center; justify-content: center; flex: none; }
.cap-box b { font-size: 22px; line-height: 26px; font-weight: 700; }
.cap-box small { font-size: 11px; color: var(--muted); }
.cap-box.zero { background: var(--danger-soft); } .cap-box.zero b { color: var(--danger); }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 16px; text-align: center; color: var(--muted); font-size: 14px; }
.empty-state svg { color: var(--ok-solid); }
.empty-state b { color: var(--text); font-size: 15px; }
.footnote { font-size: 13px; }
.footnote a { display: inline-flex; align-items: center; gap: 6px; }

/* barras de stock */
.bar { height: 6px; border-radius: 999px; background: var(--gray-bg); overflow: hidden; min-width: 80px; }
.bar > span { display: block; height: 100%; border-radius: 999px; }
.bar-ok { background: var(--ok-bar); }
.bar-bajo { background: var(--warn-bar); }
.bar-agotado { background: var(--danger-bar); }
.stock-cell { display: flex; flex-direction: column; gap: 6px; min-width: 120px; }
.stock-cell b { font-size: 15px; }

/* etiquetas */
.pill { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 20px; white-space: nowrap; }
.pill.ok, .pill.listo, .pill.ingreso { background: var(--ok-bg); color: var(--ok); }
.pill.bajo, .pill.ajuste { background: var(--warn-bg); color: var(--warn); }
.pill.agotado, .pill.salida, .pill.falta { background: var(--danger-bg); color: var(--danger); }
.pill.armado, .pill.consumo, .pill.info { background: var(--primary-soft); color: var(--primary-ink); }
.pill.entregado, .pill.devolucion, .pill.gray { background: var(--gray-bg); color: var(--text-2); }
.pill.desarmado { background: var(--gray-bg); color: var(--muted); text-decoration: line-through; }
.pos { color: var(--ok); font-weight: 600; }
.neg { color: var(--danger); font-weight: 600; }

/* tablas */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-size: 12px; font-weight: 600; padding: 12px; background: var(--surface-2); white-space: nowrap; }
td { padding: 14px 12px; border-top: 1px solid var(--border-2); vertical-align: middle; }
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }
.card:not(.flush) th { background: transparent; padding-top: 0; }
.card:not(.flush) th:first-child, .card:not(.flush) td:first-child { padding-left: 0; }
.card:not(.flush) th:last-child, .card:not(.flush) td:last-child { padding-right: 0; }
td.acts { text-align: right; white-space: nowrap; }
td.acts > * { margin-left: 2px; vertical-align: middle; }
td.acts { width: 1%; }
.cell-part { display: flex; align-items: center; gap: 12px; min-width: 180px; }
.cell-part > div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.table-foot { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border-2); font-size: 13px; color: var(--muted); }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }

/* fotos */
.thumb {
  width: 44px; height: 44px; border-radius: var(--r-sm); background: var(--gray-bg); color: var(--faint); border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center; flex: none; overflow: hidden; padding: 0; cursor: pointer;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
span.thumb { cursor: default; border-style: dashed; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.photo { position: relative; margin: 0; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--gray-bg); border: 1px solid var(--border); }
.photo a, .photo img { display: block; width: 100%; height: 100%; }
.photo img { object-fit: cover; }
.photo-del {
  position: absolute; top: 6px; right: 6px; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 999px; border: 0; cursor: pointer;
  background: rgba(16, 24, 40, .72); color: #FFFFFF; display: inline-flex; align-items: center; justify-content: center; font: inherit; font-size: 12px; font-weight: 600;
}
.photo-del.confirm { background: var(--danger); }
.photo-add {
  aspect-ratio: 1; border-radius: 12px; border: 1.5px dashed var(--input); background: var(--surface-2); color: var(--primary);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.photo-add:hover, .photo-add:focus-within { border-color: var(--primary); background: var(--primary-softer); }
.photo-add.busy { opacity: .6; pointer-events: none; }

/* menú de acciones */
.menu { position: relative; display: inline-block; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 200px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; text-align: left;
}
.menu-list button, .menu-list a {
  display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border: 0; background: transparent; border-radius: 8px;
  font: inherit; font-size: 14px; color: var(--text); cursor: pointer; text-align: left; white-space: nowrap;
}
.menu-list button:hover, .menu-list a:hover { background: var(--gray-bg); color: var(--text); }
.menu-list .danger { color: var(--danger); }
.menu-list hr { border: 0; border-top: 1px solid var(--border-2); margin: 4px 0; }

/* modelos */
.model-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; }
.model-card .mc-head { display: flex; gap: 14px; align-items: flex-start; }
.model-card .mc-head > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bom { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.bom li { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.bom .q { font-weight: 700; min-width: 32px; color: var(--text-2); }
.bom .s { margin-left: auto; font-size: 13px; color: var(--muted); white-space: nowrap; }
.counts { display: flex; gap: 8px; flex-wrap: wrap; }
.mc-foot { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; border-top: 1px solid var(--border-2); padding-top: 16px; }
.mc-foot .spacer { flex: 1; }

/* consejo */
.tip { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 14px 16px 14px 18px; background: var(--primary-softer); border: 1px solid var(--primary-line); border-radius: var(--r); }
.tip .alert-icon { width: 36px; height: 36px; background: var(--primary-soft); color: var(--primary); }
.tip-text { flex: 1 1 360px; display: flex; flex-direction: column; gap: 2px; font-size: 14px; line-height: 20px; }
.tip-text b { color: var(--info-ink); }
.tip-text span { color: var(--text-2); }
.tip > a { font-size: 14px; font-weight: 600; }

/* ---------- modal ---------- */
dialog {
  border: 0; border-radius: 18px; padding: 0; width: min(680px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
dialog.wide { width: min(860px, calc(100vw - 32px)); }
dialog::backdrop { background: var(--overlay); }
dialog form { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.modal-head { display: flex; align-items: flex-start; gap: 14px; padding: 24px 24px 18px 28px; border-bottom: 1px solid var(--border-2); }
.modal-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.modal-icon.danger { background: var(--danger-bg); color: var(--danger); }
.modal-titles { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; padding-top: 2px; }
.modal-titles h2 { font-size: 20px; line-height: 28px; font-weight: 700; }
.modal-titles p { font-size: 14px; color: var(--muted); }
.modal-body { flex: 1; overflow-y: auto; padding: 22px 28px; display: flex; flex-direction: column; gap: 18px; }
.modal-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 16px 28px; border-top: 1px solid var(--border-2); background: var(--surface-foot); }
.modal-foot .spacer { flex: 1; }
.modal-foot a { font-size: 14px; font-weight: 500; }

.lines { display: flex; flex-direction: column; gap: 8px; }
.grupos { display: flex; flex-direction: column; gap: 12px; }
.grupos:empty { display: none; }
.grupo { border: 1px solid var(--border); border-radius: var(--r-sm); padding: 12px; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.grupo-head { display: grid; grid-template-columns: minmax(0, 1fr) auto 44px; gap: 10px; align-items: center; }
.grupo-head input[name=g_nombre] { font-weight: 600; }
.opciones { display: flex; flex-direction: column; gap: 12px; }
.opcion { border-left: 3px solid var(--border); padding-left: 12px; display: flex; flex-direction: column; gap: 8px; }
.opcion-head { display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 8px; align-items: center; }
.grupo-head .icon-btn, .opcion-head .icon-btn { width: 44px; height: 44px; }
.opciones-armar { display: flex; flex-direction: column; gap: 16px; }
.opciones-armar:empty { display: none; }
.mc-img, .eq-img { display: block; margin: -4px 0 0; border-radius: 12px; overflow: hidden; background: var(--gray-bg); border: 1px solid var(--border); aspect-ratio: 16 / 9; }
.mc-img img, .eq-img img { display: block; width: 100%; height: 100%; object-fit: contain; }
.eq-img { max-width: 420px; }
.choice-img { width: 52px; height: 52px; flex: none; border-radius: 10px; object-fit: cover; border: 1px solid var(--border); background: var(--gray-bg); }
.model-img-edit { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.model-photo { width: 160px; aspect-ratio: 4 / 3; flex: none; }
.model-photo img { object-fit: contain; }
.model-img-acts { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.model-img-acts label.btn { cursor: pointer; }
.mc-opc { display: flex; flex-direction: column; gap: 8px; border-top: 1px dashed var(--border); padding-top: 12px; }
.mc-opc-head { display: flex; gap: 8px; align-items: baseline; font-size: 13px; font-weight: 600; color: var(--text-2); }
.mc-opc-head small { font-weight: 400; color: var(--muted); }
@media (max-width: 560px) { .grupo-head { grid-template-columns: minmax(0, 1fr) 44px; } .grupo-head .check { grid-row: 2; } }
.line { display: grid; grid-template-columns: minmax(0, 1fr) 110px 44px; gap: 8px; align-items: center; }
.line .icon-btn { width: 44px; height: 44px; }

.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.choice {
  position: relative; display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer;
}
.choice:hover { border-color: var(--input); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); background: var(--primary-softer); }
.choice:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.choice .cap-box { width: 52px; height: 52px; background: var(--surface); border: 1px solid var(--border); }
.choice .cap-box b { font-size: 20px; line-height: 22px; }
.choice .cap-box small { font-size: 10px; }
.choice-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.choice-text b { font-size: 15px; }
.choice-text small { font-size: 13px; color: var(--muted); }

.stepper { display: flex; align-items: center; height: 44px; border: 1px solid var(--input); border-radius: var(--r-sm); overflow: hidden; }
.stepper button { width: 48px; height: 44px; border: 0; background: var(--surface-2); font: inherit; font-size: 20px; color: var(--text-2); cursor: pointer; }
.stepper button:hover { background: var(--gray-bg); }
.stepper input { border: 0; height: 42px; text-align: center; font-size: 17px; font-weight: 700; border-radius: 0; -moz-appearance: textfield; }
.stepper input:focus { outline: 0; }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }

.preview-table { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.preview-table td, .preview-table th { padding: 10px 12px; }
.preview-table th:first-child, .preview-table td:first-child { padding-left: 16px; }

dl.info { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; font-size: 14px; }
dl.info dt { color: var(--muted); }
dl.info dd { margin: 0; }

.dropzone {
  display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 12px; border: 1.5px dashed var(--input);
  background: var(--surface-2); cursor: pointer; color: var(--text-2); font-size: 14px;
}
.dropzone:hover, .dropzone:focus-within { border-color: var(--primary); background: var(--primary-softer); }
.dropzone .qi { width: 44px; height: 44px; }
.dropzone > span { display: flex; flex-direction: column; }
.dropzone small { color: var(--muted); font-size: 13px; }

/* ---------- avisos flotantes ---------- */
#toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 1000; width: min(420px, calc(100vw - 32px)); }
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 14px; line-height: 20px;
  background: var(--side); color: #FFFFFF; box-shadow: var(--shadow-lg); animation: toast-in .18s ease-out;
}
.toast svg { margin-top: 1px; color: var(--ok-bar); }
.toast.warn { background: var(--warn-soft); color: var(--warn-ink); border: 1px solid var(--warn-line); }
.toast.warn svg { color: var(--warn-solid); }
.toast.error { background: var(--danger-soft); color: var(--danger-ink); border: 1px solid var(--danger-line); }
.toast.error svg { color: var(--danger); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- ayuda ---------- */
.hero { background: var(--side); border-radius: 20px; padding: 40px; display: flex; flex-direction: column; gap: 20px; }
.hero .kicker { font-size: 13px; font-weight: 600; color: #8EA8FF; letter-spacing: .04em; text-transform: uppercase; }
.hero h1 { color: #FFFFFF; font-size: 32px; line-height: 40px; }
.hero p { color: var(--side-text); font-size: 16px; line-height: 24px; max-width: 640px; }
.hero .search { max-width: 640px; height: 52px; border: 0; flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chips .lbl { font-size: 13px; color: var(--faint); }
.chip { height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--side-3); background: var(--side-2); color: #E4E7EC; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
.chip:hover { background: var(--side-3); }
.section-head { display: flex; flex-direction: column; gap: 4px; }
.section-head h2 { font-size: 20px; font-weight: 700; }
.section-head p { color: var(--muted); font-size: 15px; }
.flow { display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; }
.flow-step { flex: 1 1 160px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.flow-step .fs-head { display: flex; align-items: center; gap: 10px; }
.flow-step .n { width: 28px; height: 28px; border-radius: 999px; color: #FFFFFF; font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; background: var(--primary); }
.flow-step p { font-size: 14px; line-height: 20px; color: var(--text-3); }
.flow-step small { font-size: 12px; color: var(--muted); margin-top: auto; }
.steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.steps li { display: flex; gap: 14px; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); }
.steps .n { width: 28px; height: 28px; border-radius: 999px; border: 2px solid var(--primary); color: var(--primary); font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.steps li > div { display: flex; flex-direction: column; gap: 2px; font-size: 14px; color: var(--text-3); line-height: 20px; }
.steps li b { font-size: 15px; color: var(--text); }
.first-steps { display: flex; flex-direction: row; flex-wrap: wrap; gap: 24px; }
.first-steps .pill { align-self: flex-start; }
.first-steps > div { flex: 1 1 260px; display: flex; flex-direction: column; gap: 6px; }
.first-steps > ol { flex: 2 1 460px; }
.guides { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.guide-tabs { flex: 1 1 260px; display: flex; flex-direction: column; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 8px; }
.guide-tab {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 14px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--text-2); font: inherit; font-size: 14px; font-weight: 600; text-align: left; cursor: pointer;
}
.guide-tab:hover { background: var(--surface-2); }
.guide-tab .gdot { width: 8px; height: 8px; border-radius: 999px; background: var(--input); flex: none; }
.guide-tab[aria-selected=true] { background: var(--primary-soft); color: var(--primary-ink); }
.guide-tab[aria-selected=true] .gdot { background: var(--primary); }
.guide-panel { flex: 999 1 480px; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.guide-panel h3 { font-size: 22px; line-height: 30px; font-weight: 700; }
.guide-panel .intro { font-size: 15px; line-height: 22px; color: var(--text-3); }
.guide-steps { margin: 0; padding: 0; list-style: none; }
.guide-steps li { display: flex; gap: 16px; padding: 14px 0; border-top: 1px solid var(--border-2); font-size: 15px; line-height: 24px; }
.guide-steps .n { width: 28px; height: 28px; border-radius: 8px; background: var(--primary-soft); color: var(--primary-ink); font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.glossary { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.glossary > div { display: flex; gap: 14px; align-items: baseline; }
.glossary dt { flex: 0 0 150px; }
.glossary dd { margin: 0; font-size: 14px; line-height: 20px; color: var(--text-3); }
.faq { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.faq details + details { border-top: 1px solid var(--border-2); }
.faq summary { display: flex; align-items: center; gap: 16px; min-height: 56px; padding: 0 24px; font-weight: 600; cursor: pointer; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary:hover { background: var(--surface-2); }
.faq summary::after { content: "+"; margin-left: auto; font-size: 20px; color: var(--muted); }
.faq details[open] summary::after { content: "−"; }
.faq details p { padding: 0 24px 20px; color: var(--text-3); line-height: 24px; max-width: 820px; }

/* ---------- ingreso ---------- */
.login-body { background: var(--surface); }
.login { display: flex; min-height: 100vh; }
.login-side {
  flex: 0 0 44%; max-width: 560px; background: var(--side); color: var(--side-text);
  padding: 40px 48px; display: flex; flex-direction: column; gap: 48px;
  background-image: radial-gradient(circle at 85% 15%, rgba(2, 132, 199, .38), transparent 45%), radial-gradient(circle at 10% 95%, rgba(24, 156, 216, .14), transparent 40%);
}
.login-side .brand { padding: 0; }
.login-pitch { margin: auto 0; display: flex; flex-direction: column; gap: 28px; }
.login-pitch h2 { color: #FFFFFF; font-size: 34px; line-height: 42px; font-weight: 700; letter-spacing: -0.02em; max-width: 420px; }
.login-pitch ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.login-pitch li { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 22px; }
.login-pitch li svg { color: var(--brand-accent); margin-top: 1px; }
.login-foot { color: var(--faint); font-size: 13px; }
.login-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.login-card { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 32px; }
.login-mobile-brand { display: none; color: var(--text); padding: 0; }
.login-mobile-brand .brand-text small { color: var(--muted); }
.login-form { display: flex; flex-direction: column; gap: 20px; }
.login-head { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.login-head p { color: var(--muted); }
.login-note { font-size: 13px; color: var(--muted); text-align: center; }
.login-note code, .login-steps code { font-family: var(--mono); font-size: 12px; background: var(--gray-bg); padding: 1px 5px; border-radius: 5px; }
.login-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; color: var(--text-2); }
.btn.lg { height: 48px; font-size: 15px; width: 100%; }
.pass { position: relative; display: flex; }
.pass input { padding-right: 48px; }
.pass .icon-btn { position: absolute; right: 2px; top: 2px; }
.pass .icon-btn[aria-pressed="true"] { color: var(--primary); }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); cursor: pointer; }
.check input { width: 18px; height: 18px; flex: none; }
.caps { color: var(--warn); }
@media (max-width: 860px) {
  .login-side { display: none; }
  .login-main { align-items: flex-start; padding: 32px 16px; }
  .login-mobile-brand { display: flex; }
}

/* ---------- modo oscuro ----------
   Sigue al sistema, salvo que la persona elija Claro u Oscuro (data-theme en <html>). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  color-scheme: dark;
  --bg: #0A111D;
  --surface: #111A29;
  --surface-2: #152033;
  --border: #233149;
  --border-2: #1B273C;
  --input: #34445F;
  --text: #E7ECF3;
  --text-2: #C9D2DF;
  --text-3: #AAB4C4;
  --muted: #8E9AAE;
  --faint: #6F7C91;

  --side: #060C16;
  --side-2: #0E1828;
  --side-3: #1D2E45;
  --side-line: #162336;
  --side-text: #B4C0D2;

  --primary: #0284C7;
  --primary-hover: #0369A1;
  --primary-ink: #7DD3FC;
  --primary-soft: #0C2A41;
  --primary-softer: #0B1F31;
  --primary-line: #12486A;
  --link: #38BDF8;

  --ok: #5FD99A;
  --ok-bg: #0D3322;
  --ok-soft: #0B2219;
  --ok-line: #165A39;

  --warn: #FDB022;
  --warn-ink: #FEC84B;
  --warn-bg: #3A2A0B;
  --warn-soft: #251C0B;
  --warn-line: #5C4210;

  --danger: #F97066;
  --danger-ink: #FDA29B;
  --danger-bg: #3E1714;
  --danger-soft: #29120F;
  --danger-line: #5E2520;

  --gray-bg: #1B2537;
  --gray-solid: #64748B;

  --icon: #8E9AAE;
  --seg-bg: #0A111D;
  --info-ink: #BAE6FD;
  --surface-foot: #0E1726;
  --disabled: #3A4A63;
  --overlay: rgba(0, 0, 0, .62);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, .55);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0A111D;
  --surface: #111A29;
  --surface-2: #152033;
  --border: #233149;
  --border-2: #1B273C;
  --input: #34445F;
  --text: #E7ECF3;
  --text-2: #C9D2DF;
  --text-3: #AAB4C4;
  --muted: #8E9AAE;
  --faint: #6F7C91;

  --side: #060C16;
  --side-2: #0E1828;
  --side-3: #1D2E45;
  --side-line: #162336;
  --side-text: #B4C0D2;

  --primary: #0284C7;
  --primary-hover: #0369A1;
  --primary-ink: #7DD3FC;
  --primary-soft: #0C2A41;
  --primary-softer: #0B1F31;
  --primary-line: #12486A;
  --link: #38BDF8;

  --ok: #5FD99A;
  --ok-bg: #0D3322;
  --ok-soft: #0B2219;
  --ok-line: #165A39;

  --warn: #FDB022;
  --warn-ink: #FEC84B;
  --warn-bg: #3A2A0B;
  --warn-soft: #251C0B;
  --warn-line: #5C4210;

  --danger: #F97066;
  --danger-ink: #FDA29B;
  --danger-bg: #3E1714;
  --danger-soft: #29120F;
  --danger-line: #5E2520;

  --gray-bg: #1B2537;
  --gray-solid: #64748B;

  --icon: #8E9AAE;
  --seg-bg: #0A111D;
  --info-ink: #BAE6FD;
  --surface-foot: #0E1726;
  --disabled: #3A4A63;
  --overlay: rgba(0, 0, 0, .62);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, .55);
}
:root[data-theme="light"] { color-scheme: light; }

/* Ajustes puntuales en oscuro */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-claro { display: none; }
  :root:not([data-theme="light"]) .logo-oscuro { display: block; }
  :root:not([data-theme="light"]) .hero, :root:not([data-theme="light"]) .toast { border: 1px solid var(--border); }
  :root:not([data-theme="light"]) .seg [aria-pressed=true], :root:not([data-theme="light"]) .seg [aria-current=page] { background: var(--surface-2); }
}
:root[data-theme="dark"] .logo-claro { display: none; }
:root[data-theme="dark"] .logo-oscuro { display: block; }
:root[data-theme="dark"] .hero, :root[data-theme="dark"] .toast { border: 1px solid var(--border); }
:root[data-theme="dark"] .seg [aria-pressed=true], :root[data-theme="dark"] .seg [aria-current=page] { background: var(--surface-2); }
.logo-oscuro { display: none; }

/* selector de tema en el menú de cuenta */
.menu-theme { display: flex; flex-direction: column; gap: 6px; padding: 6px 12px 8px; }
.menu-theme > span { font-size: 12px; color: var(--muted); font-weight: 600; }
.menu-theme .seg { flex-wrap: nowrap; }
.menu-theme .seg { padding: 3px; gap: 2px; }
.menu-theme .seg button { flex: 1; min-width: 0; height: 30px; padding: 0 4px; font-size: 12px; justify-content: center; }
.menu-theme .seg button[data-tema][aria-pressed=true] { background: var(--primary); color: #FFFFFF; box-shadow: none; }

/* ---------- celular ---------- */
@media (max-width: 860px) {
  .sidebar {
    position: fixed; z-index: 60; left: 0; top: 0; bottom: 0; height: auto; width: min(300px, 86vw);
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; }
  .backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: var(--overlay); }
  .backdrop[hidden] { display: none; }
  .mobile-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; background: var(--side); position: sticky; top: 0; z-index: 30; }
  .mobile-top .brand { padding: 0; font-size: 17px; }
  .mobile-top .brand-logo { height: 28px; }
  .mobile-top .brand-sub { font-size: 14px; padding-left: 10px; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--surface); border-top: 1px solid var(--border); padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
  }
  .bottom-nav a, .bottom-nav button {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 52px;
    color: var(--muted); font: inherit; font-size: 11px; font-weight: 500; background: transparent; border: 0; cursor: pointer;
  }
  .bottom-nav .active { color: var(--primary); font-weight: 600; }
  .bottom-nav .dot { position: absolute; top: 6px; left: calc(50% + 8px); width: 9px; height: 9px; border-radius: 999px; background: var(--warn-bar); border: 2px solid var(--surface); }
  #banner { padding: 16px 16px 0; }
  main { padding: 16px 16px 104px; gap: 16px; }
  h1 { font-size: 24px; line-height: 32px; }
  .card { padding: 18px; }
  .grid2 { grid-template-columns: 1fr; }
  .alert { padding: 14px; }
  .alert-actions { width: 100%; }
  .alert-actions .btn { flex: 1; }
  .page-head .ph-actions { width: 100%; }
  .page-head .ph-actions .btn.primary { flex: 1; }
  .hero { padding: 24px; }
  .hero h1 { font-size: 26px; line-height: 32px; }
  .guide-panel { padding: 20px; }
  .modal-head { padding: 18px 16px 14px 20px; }
  .modal-body { padding: 18px 20px; }
  .modal-foot { padding: 14px 20px; }
  .modal-foot #modalHelp { width: 100%; }
  .row2 { grid-template-columns: 1fr; }
  #toasts { right: 16px; bottom: 88px; }
  .glossary dt { flex-basis: 120px; }
}
.login-side .brand-logo { height: 40px; }
