/* eCom OFG · hoja de estilos del portal (sistema de diseño común de los portales OFG) */
:root {
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;

  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --text: #0f172a;
  --text-2: #475569;
  --text-3: #64748b;

  --brand: #0b3a66;
  --brand-2: #0f4c85;
  --accent: #1d6fd8;
  --accent-hover: #175dbb;
  --accent-soft: #e8f1fd;

  --side-bg: #0b1a2c;
  --side-bg-2: #10243b;
  --side-text: #b9c6d8;
  --side-text-strong: #ffffff;
  --side-accent: #4ba3ff;

  --ok: #15803d;      --ok-bg: #e7f6ec;      --ok-border: #bfe5cb;
  --info: #1d4ed8;    --info-bg: #e9f0fe;    --info-border: #c7d7fb;
  --warn: #b45309;    --warn-bg: #fdf3e2;    --warn-border: #f5d9a8;
  --danger: #b91c1c;  --danger-bg: #fdeceb;  --danger-border: #f6c7c4;
  --reject: #9f1239;  --reject-bg: #fde9ef;  --reject-border: #f7c4d3;
  --muted: #475569;   --muted-bg: #eef1f5;   --muted-border: #d9dfe7;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, .12), 0 2px 6px rgba(15, 23, 42, .06);
  --side-w: 252px;

  /* Gráficos */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --grid: #e6eaf0;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; color: var(--text); }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
.svg-icon { flex: none; vertical-align: -3px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: linear-gradient(180deg, var(--side-bg) 0%, var(--side-bg-2) 100%);
  color: var(--side-text); display: flex; flex-direction: column; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 20px 20px 18px; color: #fff; }
.brand:hover { text-decoration: none; color: #fff; }
.brand-mark { width: 38px; height: 38px; flex: none; }
.brand-name { font-weight: 700; font-size: 18px; letter-spacing: .2px; }
.brand-sub { font-size: 11px; color: var(--side-text); letter-spacing: .4px; text-transform: uppercase; }
.nav { padding: 6px 12px 16px; flex: 1; }
.nav-section { font-size: 10.5px; font-weight: 600; letter-spacing: .9px; text-transform: uppercase; color: #7f93ad; padding: 16px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px;
  color: var(--side-text); font-weight: 500; position: relative; margin: 1px 0;
}
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(75, 163, 255, .14); color: #fff; }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--side-accent); }
.nav .count { margin-left: auto; background: rgba(255,255,255,.12); color: #fff; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 10px; }
.nav .count.alert { background: #dc2626; }
.side-foot { padding: 14px 20px; border-top: 1px solid rgba(255, 255, 255, .07); font-size: 12px; color: #7f93ad; }
.side-foot strong { color: var(--side-text); font-weight: 600; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
  height: 60px; padding: 0 28px; background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(160%) blur(8px); border-bottom: 1px solid var(--border);
}
.topbar .crumbs { display: flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 13px; min-width: 0; }
.topbar .crumbs a { color: var(--text-3); }
.topbar .crumbs strong { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.menu-toggle { display: none; background: none; border: 0; padding: 6px; color: var(--text); cursor: pointer; }
.mode-pill { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: 999px; border: 1px solid; background: none; cursor: pointer; font-family: inherit; }
.mode-pill i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.mode-pill.on { color: var(--ok); border-color: var(--ok-border); background: var(--ok-bg); }
.mode-pill.on i { background: var(--ok); box-shadow: 0 0 0 3px rgba(21, 128, 61, .18); }
.mode-pill.off { color: var(--text-2); border-color: var(--border-strong); background: var(--surface-2); }
.mode-pill.off i { background: #94a3b8; }
.bell { position: relative; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; color: var(--text-2); }
.bell:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.bell.has { color: var(--accent); }
.bell .bell-n { position: absolute; top: -1px; right: -5px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: #dc2626; color: #fff; font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center; border: 2px solid var(--surface); box-sizing: content-box; }
.btn-icon { display: inline-grid; place-items: center; width: 26px; height: 26px; padding: 0; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text-3); cursor: pointer; vertical-align: middle; }
.btn-icon:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.cell-flex { display: flex; align-items: flex-start; gap: 8px; justify-content: space-between; }
.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 10px; background: none; border: 1px solid transparent; border-radius: 8px; padding: 4px 8px 4px 4px; cursor: pointer; font-family: inherit; color: var(--text); }
.user-btn:hover { background: var(--surface-3); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--brand-2), var(--accent)); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; text-transform: uppercase; }
.user-btn .who { text-align: left; line-height: 1.2; }
.user-btn .who small { display: block; color: var(--text-3); font-size: 11px; }
.dropdown { position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; display: none; }
.dropdown.open { display: block; }
.dropdown a, .dropdown button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.dropdown a:hover, .dropdown button:hover { background: var(--surface-3); text-decoration: none; }

.content { padding: 26px 28px 48px; max-width: 1600px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 700; letter-spacing: -.2px; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.footer { margin-top: auto; padding: 14px 28px; color: var(--text-3); font-size: 12px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.card-head .sub { color: var(--text-3); font-size: 12.5px; font-weight: 400; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main-side { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; }
.stack > * + * { margin-top: 18px; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); overflow: hidden; display: block; color: inherit; }
a.kpi:hover { text-decoration: none; border-color: var(--border-strong); box-shadow: var(--shadow-lg); }
.kpi .label { font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .5px; display: flex; align-items: center; gap: 7px; }
.kpi .value { font-size: 28px; font-weight: 700; letter-spacing: -.5px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .hint { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.kpi .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.kpi.accent-info { border-top: 3px solid var(--info); }
.kpi.accent-ok { border-top: 3px solid var(--ok); }
.kpi.accent-danger { border-top: 3px solid var(--danger); }
.kpi.accent-reject { border-top: 3px solid var(--reject); }
.kpi.accent-warn { border-top: 3px solid var(--warn); }
.kpi.accent-brand { border-top: 3px solid var(--brand-2); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 8px; font-size: 12px; font-weight: 600; border-radius: 999px; border: 1px solid; white-space: nowrap; line-height: 1.6; }
.badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-border); }
.badge-info { color: var(--info); background: var(--info-bg); border-color: var(--info-border); }
.badge-warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-border); }
.badge-danger { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-border); }
.badge-reject { color: var(--reject); background: var(--reject-bg); border-color: var(--reject-border); }
.badge-muted { color: var(--muted); background: var(--muted-bg); border-color: var(--muted-border); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; font-size: 11px; font-weight: 600; border-radius: 4px; background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; font: 600 13px/1.2 var(--font); border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, box-shadow .12s; text-decoration: none; }
.btn:hover { background: var(--surface-3); text-decoration: none; color: var(--text); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(29, 111, 216, .3); outline-offset: 1px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(29, 111, 216, .3); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-success { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-success:hover { background: #116932; color: #fff; }
.btn-danger { background: var(--surface); border-color: var(--danger-border); color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); color: var(--danger); }
.btn-danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger.solid:hover { filter: brightness(.92); background: var(--danger); color: #fff; }
.btn-ghost { border-color: transparent; background: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 6px; }
.btn-xs { padding: 3px 8px; font-size: 12px; border-radius: 5px; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; }

/* ---------- Forms ---------- */
label { font-weight: 600; font-size: 12.5px; color: var(--text-2); display: block; margin-bottom: 5px; }
.field { margin-bottom: 14px; }
.field small, .help { display: block; color: var(--text-3); font-size: 12px; margin-top: 4px; font-weight: 400; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=search], input[type=date], input[type=url], select, textarea {
  width: 100%; padding: 8px 11px; font: 14px/1.4 var(--font); color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 7px; transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(29, 111, 216, .15); outline: none; }
textarea { min-height: 90px; resize: vertical; }
textarea.code-input { font-family: var(--mono); font-size: 12.5px; min-height: 110px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-section { font-size: 12px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .6px; margin: 8px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border); grid-column: 1 / -1; }
input[type=file] { width: 100%; padding: 8px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); font: inherit; font-size: 13px; color: var(--text-2); }
input[type=file]::file-selector-button { margin-right: 10px; padding: 6px 12px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); font: inherit; font-weight: 600; color: var(--text); cursor: pointer; }
.opt-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.opt-card { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border); border-radius: 8px; padding: 12px; cursor: pointer; background: var(--surface); font-size: 14px; }
.opt-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.opt-card input { margin-top: 3px; accent-color: var(--accent); }
.opt-card small { display: block; color: var(--text-3); font-size: 12px; font-weight: 400; margin-top: 2px; }
.progress { height: 8px; border-radius: 4px; background: rgba(0, 0, 0, .08); overflow: hidden; max-width: 520px; }
.progress span { display: block; height: 100%; background: var(--warn); border-radius: 4px; transition: width .3s; }
.diff-old { color: var(--text-3); text-decoration: line-through; }
.card-danger { border-color: var(--danger-border); box-shadow: inset 0 3px 0 var(--danger); }
.zona-avanzada { margin-top: 28px; border-top: 1px dashed var(--border-strong); padding-top: 10px; font-size: 12.5px; color: var(--text-3); }
.zona-avanzada summary { cursor: pointer; width: max-content; }
.zona-avanzada .inner { margin-top: 10px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 500; color: var(--text); font-size: 14px; cursor: pointer; margin-bottom: 12px; }
.check input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.check small { display: block; color: var(--text-3); font-size: 12px; font-weight: 400; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; color: var(--text); font-size: 14px; margin: 0; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 38px; height: 22px; border-radius: 999px; background: #cbd5e1; position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + .track { background: var(--ok); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 3px solid rgba(29, 111, 216, .3); }
.input-group { display: flex; }
.input-group input { border-radius: 7px 0 0 7px; }
.input-group .btn { border-radius: 0 7px 7px 0; border-left: 0; }

/* Filtros */
.filters { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; box-shadow: var(--shadow); }
.filters-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px 12px; align-items: end; }
.filters-grid .search { grid-column: span 2; }
.filters label { font-size: 11.5px; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-3); }
.filters input, .filters select { padding: 7px 10px; font-size: 13px; }
.filters select { padding-right: 28px; }
.filters-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.active-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.active-filters a { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; background: var(--accent-soft); color: var(--accent); border: 1px solid #cfe0fa; border-radius: 999px; padding: 2px 6px 2px 10px; }
.active-filters a:hover { text-decoration: none; background: #dbe8fc; }
.tabs-estado { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.tabs-estado a { padding: 8px 12px; color: var(--text-2); font-weight: 600; font-size: 13px; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 6px; align-items: center; }
.tabs-estado a:hover { color: var(--text); text-decoration: none; }
.tabs-estado a.active { color: var(--accent); border-bottom-color: var(--accent); }
.tabs-estado .n { font-size: 11px; background: var(--surface-3); color: var(--text-2); border-radius: 10px; padding: 0 7px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.table th { position: sticky; top: 0; background: var(--surface-2); color: var(--text-3); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .45px; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; z-index: 1; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #f8fbff; }
.table tr.selected td { background: #eef5ff; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .nowrap { white-space: nowrap; }
.table .muted, .muted { color: var(--text-3); }
.table .w-check { width: 34px; }
.table .truncate { max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .truncate.truncate-sm { max-width: 180px; }
.table a.row-link { font-weight: 600; color: var(--text); }
.table a.row-link:hover { color: var(--accent); }
.table .sub { display: block; color: var(--text-3); font-size: 12px; }
.table input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--accent); }
.table tfoot td { background: var(--surface-2); font-weight: 700; border-top: 1px solid var(--border); border-bottom: 0; }
.err-text { color: var(--danger); font-size: 12.5px; }
.table-compact td, .table-compact th { padding: 7px 10px; }

/* Paginación */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-2); }
.pager .pages { display: flex; gap: 4px; }
.pager .pages a, .pager .pages span { min-width: 32px; height: 32px; padding: 0 8px; display: inline-grid; place-items: center; border-radius: 6px; border: 1px solid var(--border); color: var(--text); background: var(--surface); font-weight: 600; font-size: 13px; }
.pager .pages a:hover { background: var(--surface-3); text-decoration: none; }
.pager .pages .current { background: var(--accent); border-color: var(--accent); color: #fff; }
.pager .pages .gap { border: 0; background: none; }
.pager select { width: auto; padding: 4px 26px 4px 8px; font-size: 13px; }

/* Barra de acciones masivas */
.bulkbar { position: sticky; bottom: 16px; z-index: 20; display: none; align-items: center; gap: 12px; margin: 14px auto 0; width: fit-content; max-width: 100%; padding: 10px 12px 10px 18px; background: #0f1f33; color: #fff; border-radius: 12px; box-shadow: var(--shadow-lg); flex-wrap: wrap; }
.bulkbar.show { display: flex; }
.bulkbar select { width: auto; background-color: #1b2f48; color: #fff; border-color: #2c4566; }

/* ---------- Detail ---------- */
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0; }
.kv > div { padding: 12px 18px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); min-width: 0; }
.kv dt { font-size: 11.5px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .45px; margin-bottom: 3px; }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.kv dd .sub { color: var(--text-3); font-size: 12px; font-weight: 400; }
.hero { display: flex; gap: 22px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 20px 22px; }
.hero .code { font-family: var(--mono); font-size: 22px; font-weight: 700; letter-spacing: -.3px; color: var(--text); }
.hero .meta { color: var(--text-2); margin-top: 4px; display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; }
.hero .meta span { display: inline-flex; gap: 6px; align-items: center; }
.amount { text-align: right; }
.amount .big { font-size: 26px; font-weight: 700; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.amount .lbl { font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.ico-ok { color: var(--ok); }
.ico-ko { color: var(--danger); }
.ico-warn { color: var(--warn); }
.ico-info { color: var(--info); }


.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 18px 16px 44px; }
.timeline li::before { content: ""; position: absolute; left: 25px; top: 22px; bottom: 0; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline .tl-dot { position: absolute; left: 16px; top: 2px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--border-strong); }
.timeline .tl-dot.ok { border-color: var(--ok); color: var(--ok); }
.timeline .tl-dot.ko { border-color: var(--danger); color: var(--danger); }
.timeline .tl-dot.info { border-color: var(--info); color: var(--info); }
.timeline .tl-dot.warn { border-color: var(--warn); color: var(--warn); }
.timeline .tl-dot.muted { border-color: var(--border-strong); color: var(--muted); }
.timeline .tl-title { font-weight: 600; font-size: 13px; }
.timeline .tl-meta { font-size: 12px; color: var(--text-3); }
.timeline .tl-msg { font-size: 12.5px; color: var(--text-2); margin-top: 2px; overflow-wrap: anywhere; }

/* Alerts */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 9px; border: 1px solid; margin-bottom: 14px; font-size: 13.5px; }
.alert .svg-icon { margin-top: 1px; }
.alert .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.alert strong { font-weight: 650; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }
.alert-ok { background: var(--ok-bg); border-color: var(--ok-border); color: #14532d; }
.alert-error { background: var(--danger-bg); border-color: var(--danger-border); color: #7f1d1d; }
.alert-info { background: var(--info-bg); border-color: var(--info-border); color: #1e3a8a; }
.alert-warn { background: var(--warn-bg); border-color: var(--warn-border); color: #78350f; }
.alert .close { background: none; border: 0; cursor: pointer; color: inherit; opacity: .6; padding: 0; }
.alert .close:hover { opacity: 1; }
.flash-stack { position: fixed; top: 72px; right: 24px; z-index: 100; width: min(440px, calc(100vw - 32px)); }
.flash-stack .alert { box-shadow: var(--shadow-lg); animation: slidein .25s ease-out; }
@keyframes slidein { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Code */
pre.code { margin: 0; background: #0d1b2a; color: #d7e3f4; padding: 16px 18px; border-radius: 9px; overflow: auto; max-height: 520px; font-size: 12.5px; line-height: 1.55; }
.code-wrap { position: relative; }
pre.code.code-inline { padding: 10px 96px 10px 12px; white-space: pre-wrap; word-break: break-all; font-size: 12px; }
.code-wrap .copy { position: absolute; top: 8px; right: 8px; background: rgba(255,255,255,.08); color: #d7e3f4; border: 1px solid rgba(255,255,255,.15); }
.code-wrap .copy:hover { background: rgba(255,255,255,.16); color: #fff; }
.secret-box { display: flex; align-items: center; gap: 10px; background: #0d1b2a; color: #9fe3b4; padding: 12px 14px; border-radius: 8px; font-family: var(--mono); font-size: 14px; overflow-wrap: anywhere; }
.secret-box code { flex: 1; font-size: 14px; }
.secret-box .btn { flex: none; }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); padding: 0 12px; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 12px 12px 10px; font: 600 13px var(--font); color: var(--text-2); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.tabs .n { font-size: 11px; background: var(--surface-3); color: var(--text-2); border-radius: 10px; padding: 0 6px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Empty */
.empty { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty .svg-icon { color: #a5b4c8; margin-bottom: 10px; }
.empty h3 { color: var(--text-2); font-size: 15px; margin-bottom: 4px; }

/* Modal */
dialog.modal { border: 0; padding: 0; border-radius: 12px; width: min(560px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); color: var(--text); }
dialog.modal.wide { width: min(820px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(10, 20, 35, .45); backdrop-filter: blur(2px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 18px 20px; max-height: 70vh; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }

/* Autocompletar */
.ac { position: relative; }
.ac-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 60; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-lg); max-height: 280px; overflow-y: auto; display: none; }
.ac-list.open { display: block; }
.ac-item { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--surface-3); }
.ac-item:last-child { border-bottom: 0; }
.ac-item:hover, .ac-item.hl { background: var(--accent-soft); }
.ac-item .t { font-weight: 600; font-size: 13px; }
.ac-item .s { font-size: 12px; color: var(--text-3); }
.ac-item .id { float: right; font-family: var(--mono); font-size: 11.5px; color: var(--text-3); }
.ac-empty { padding: 10px 12px; color: var(--text-3); font-size: 13px; }
.ac-selected { margin-top: 6px; font-size: 12.5px; color: var(--ok); display: flex; gap: 6px; align-items: center; }

/* Gráfico de columnas */
.chart { position: relative; padding: 8px 4px 0 40px; }
.chart-plot { position: relative; height: 210px; border-bottom: 1px solid var(--border-strong); }
.chart-grid { position: absolute; inset: 0; }
.chart-grid .gl { position: absolute; left: 0; right: 0; border-top: 1px solid var(--grid); }
.chart-grid .gl span { position: absolute; left: -40px; width: 32px; text-align: right; top: -8px; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.chart-cols { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: space-around; }
.chart-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; cursor: default; position: relative; }
.chart-col:hover { background: rgba(29, 111, 216, .05); }
.chart-col .seg { width: min(24px, 60%); }
.chart-col .seg + .seg { margin-bottom: 2px; }
.chart-col .seg:first-child { border-radius: 4px 4px 0 0; }
.chart-col .seg.s1 { background: var(--series-1); }
.chart-col .seg.s2 { background: var(--series-2); }
.chart-x { display: flex; justify-content: space-around; padding-top: 6px; }
.chart-x span { flex: 1; text-align: center; font-size: 11px; color: var(--text-3); }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.tooltip { position: fixed; z-index: 200; pointer-events: none; background: #0f1f33; color: #fff; padding: 8px 11px; border-radius: 8px; font-size: 12.5px; box-shadow: var(--shadow-lg); display: none; min-width: 140px; }
.tooltip .tt-title { font-weight: 700; margin-bottom: 4px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tooltip .tt-row i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 6px; }

/* Barra de progreso de estados */
.statusbar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--surface-3); gap: 2px; }
.statusbar span { display: block; min-width: 3px; }
.sb-ok { background: var(--ok); } .sb-info { background: var(--info); } .sb-danger { background: var(--danger); }
.sb-reject { background: var(--reject); } .sb-muted { background: #94a3b8; } .sb-warn { background: var(--warn); }
.statuslist { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.statuslist li { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.statuslist li a { color: var(--text); display: inline-flex; align-items: center; gap: 8px; }
.statuslist li i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.statuslist li b { font-variant-numeric: tabular-nums; }

/* Login */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--surface); }
.login-art { position: relative; overflow: hidden; background: radial-gradient(1200px 600px at 10% 10%, #1b5fa8 0%, transparent 60%), linear-gradient(160deg, #0a1a2e 0%, #0d2a4c 55%, #0f4c85 100%); color: #fff; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; }
.login-art::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px); background-size: 42px 42px; mask-image: linear-gradient(180deg, rgba(0,0,0,.9), transparent 85%); }
.login-art > * { position: relative; z-index: 1; }
.login-art h2 { color: #fff; font-size: 34px; line-height: 1.15; font-weight: 700; letter-spacing: -.6px; max-width: 460px; }
.login-art p { color: #b9cde6; max-width: 440px; font-size: 15px; }
.login-form-wrap { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 34px 32px; }
.login-card h1 { font-size: 22px; margin-bottom: 4px; }
.login-card p.lead { color: var(--text-2); margin: 0 0 22px; }
.login-card .btn { width: 100%; padding: 11px; font-size: 14px; }
.login-card input { padding: 10px 12px; }

/* Utilidades */
.flex { display: flex; } .items-center { align-items: center; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.justify-between { justify-content: space-between; } .wrap { flex-wrap: wrap; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; } .mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; }
.text-right { text-align: right; } .text-center { text-align: center; } .small { font-size: 12.5px; } .strong { font-weight: 650; }
.text-ok { color: var(--ok); } .text-danger { color: var(--danger); } .text-warn { color: var(--warn); }
.nowrap { white-space: nowrap; } .w-100 { width: 100%; } .hidden { display: none !important; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.desc-list { margin: 0; padding-left: 18px; color: var(--text-2); } .desc-list li { margin: 4px 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .grid-main-side { grid-template-columns: minmax(0, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: var(--side-w); transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(10, 20, 35, .4); z-index: 35; }
  .menu-toggle { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .content { padding: 18px 16px 40px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .login-page { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .user-btn .who { display: none; }
  .filters-grid .search { grid-column: span 1; }
}
@media (max-width: 640px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .statuslist { grid-template-columns: 1fr; }
  .mode-pill span { display: none; }
  .footer { padding: 14px 16px; }
}
@media print {
  .sidebar, .topbar, .filters, .bulkbar, .actions, .btn { display: none !important; }
  .app { display: block; }
}

/* ==========================================================================
   eCom OFG · componentes propios del portal comercial
   ========================================================================== */
:root {
  --seed: #6d28d9;    --seed-bg: #f3efff;    --seed-border: #ddd3fb;
  --brand-bg: #e6eef7; --brand-border: #c3d4e8;
  --series-3: #15803d;
  --series-4: #6d28d9;
}
.badge-seed { color: var(--seed); background: var(--seed-bg); border-color: var(--seed-border); }
.badge-brand { color: var(--brand-2); background: var(--brand-bg); border-color: var(--brand-border); }
.kpi.accent-seed { border-top: 3px solid var(--seed); }
.kpi.accent-muted { border-top: 3px solid #94a3b8; }
.kpi .value.sm { font-size: 22px; }
.kpi .foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--text-3); }
.kpi .go { position: absolute; right: 12px; top: 12px; color: #a5b4c8; }
a.kpi:hover .go { color: var(--accent); }
.delta { font-weight: 700; font-size: 12px; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--danger); }
.delta.flat { color: var(--text-3); }
.brand-mark { border-radius: 10px; }

/* Cartera comercial: 5 bloques sin duplicar importes */
.portfolio { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 18px; }
.portfolio a { display: block; padding: 14px 16px 14px; color: inherit; border-right: 1px solid var(--border); position: relative; }
.portfolio a:last-child { border-right: 0; }
.portfolio a:hover { background: var(--surface-2); text-decoration: none; }
.portfolio a::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; }
.portfolio .t-seed::before { background: var(--seed); } .portfolio .t-info::before { background: var(--info); }
.portfolio .t-ok::before { background: var(--ok); } .portfolio .t-brand::before { background: var(--brand-2); }
.portfolio .t-muted::before { background: #94a3b8; }
.portfolio .p-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-3); }
.portfolio .p-amount { font-size: 22px; font-weight: 700; letter-spacing: -.4px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.portfolio .p-sub { font-size: 12.5px; color: var(--text-2); }
.portfolio .p-help { font-size: 11.5px; color: var(--text-3); margin-top: 6px; line-height: 1.35; }

/* Barras horizontales */
.hbars { list-style: none; margin: 0; padding: 0; }
.hbars li { display: grid; grid-template-columns: minmax(110px, 34%) minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 0; font-size: 13px; }
.hbars .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.hbars .lbl a { color: var(--text); }
.hbars .bar { height: 10px; background: var(--surface-3); border-radius: 999px; overflow: hidden; position: relative; }
.hbars .bar span { display: block; height: 100%; border-radius: 999px; background: var(--series-1); }
.hbars .bar span.b2 { background: var(--series-3); position: absolute; top: 0; left: 0; opacity: .85; }
.hbars .val { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; text-align: right; min-width: 80px; }
.hbars .val small { display: block; font-weight: 400; color: var(--text-3); font-size: 11.5px; }

/* Embudo por madurez */
.funnel { display: grid; gap: 8px; }
.funnel .step { display: grid; grid-template-columns: 120px minmax(0, 1fr) 150px; gap: 12px; align-items: center; }
.funnel .name { font-weight: 650; font-size: 13px; display: flex; flex-direction: column; }
.funnel .name small { font-weight: 400; color: var(--text-3); font-size: 11.5px; }
.funnel .track { height: 28px; background: var(--surface-3); border-radius: 6px; overflow: hidden; }
.funnel .fill { height: 100%; display: flex; align-items: center; padding: 0 10px; color: #fff; font-size: 12px; font-weight: 700; min-width: 34px; border-radius: 6px; }
.funnel .f-SEMILLA { background: var(--seed); } .funnel .f-DESARROLLO { background: var(--info); }
.funnel .f-CONVERSION { background: var(--warn); } .funnel .f-CIERRE { background: var(--ok); }
.funnel .amt { text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 650; }
.funnel .amt small { display: block; font-weight: 400; color: var(--text-3); font-size: 11.5px; }

/* Stepper de madurez */
.stepper { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.stepper label { position: relative; display: block; margin: 0; padding: 12px 12px 12px 46px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; font-weight: 600; color: var(--text); font-size: 13.5px; }
.stepper label small { display: block; font-weight: 400; color: var(--text-3); font-size: 11.5px; line-height: 1.35; margin-top: 2px; }
.stepper input { position: absolute; opacity: 0; pointer-events: none; }
.stepper .n { position: absolute; left: 12px; top: 12px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--surface-3); color: var(--text-2); }
.stepper label:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.stepper label:has(input:checked) .n { background: var(--accent); color: #fff; }
.stepper label.done .n { background: var(--ok); color: #fff; }
.stepper label:has(input:focus-visible) { outline: 3px solid rgba(29, 111, 216, .3); }
.mat-track { display: flex; gap: 3px; align-items: center; }
.mat-track i { width: 14px; height: 5px; border-radius: 3px; background: var(--border-strong); display: inline-block; }
.mat-track.m1 i:nth-child(-n+1), .mat-track.m2 i:nth-child(-n+2), .mat-track.m3 i:nth-child(-n+3), .mat-track.m4 i:nth-child(-n+4) { background: var(--accent); }
.mat-track.m1 i:nth-child(1) { background: var(--seed); }

/* Formularios por bloques */
label.req::after, .req-mark::after { content: " *"; color: var(--danger); }
.field.is-missing input, .field.is-missing select, .field.is-missing textarea, .field.is-missing .ac input { border-color: var(--danger); background: #fffafa; }
.form-section-card + .form-section-card { margin-top: 16px; }
.section-hint { font-size: 12.5px; color: var(--text-3); font-weight: 400; }
.items-table input, .items-table select { padding: 6px 8px; font-size: 13px; }
.items-table td { padding: 6px 6px; }
.items-table .w-num { width: 110px; }
.items-table .w-sm { width: 90px; }
.items-table .line-total { font-weight: 650; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.econ-panel { list-style: none; margin: 0; padding: 0; }
.econ-panel li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--border); font-size: 13px; }
.econ-panel li:last-child { border-bottom: 0; }
.econ-panel li strong { font-variant-numeric: tabular-nums; font-size: 14px; }
.econ-panel li.main strong { font-size: 18px; color: var(--accent); }
.econ-panel li small { display: block; color: var(--text-3); font-size: 11.5px; }
.sticky-side { position: sticky; top: 76px; }
.form-actions { position: sticky; bottom: 0; z-index: 15; display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; padding: 12px 16px; margin-top: 18px; background: rgba(255,255,255,.95); backdrop-filter: blur(6px); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.form-actions .grow { flex: 1; font-size: 12.5px; color: var(--text-3); }

/* Listado */
.flag { display: inline-flex; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; padding: 1px 6px; border-radius: 4px; border: 1px solid; white-space: nowrap; }
.flag-borrador { color: var(--text-2); background: var(--surface-3); border-color: var(--border-strong); border-style: dashed; }
.flag-desactualizada { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-border); }
.flag-apoyo { color: var(--reject); background: var(--reject-bg); border-color: var(--reject-border); }
.flag-economico { color: var(--info); background: var(--info-bg); border-color: var(--info-border); }
.flag-pendiente { color: var(--seed); background: var(--seed-bg); border-color: var(--seed-border); }
.date-state { font-size: 11.5px; font-weight: 600; }
.date-state.vencido { color: var(--danger); }
.date-state.proximo { color: var(--warn); }
.table .cell-step { max-width: 260px; }
.table .cell-step .txt { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.table th a { color: inherit; display: inline-flex; gap: 4px; align-items: center; }
.table th a:hover { color: var(--accent); text-decoration: none; }
.table th.sorted { color: var(--accent); }
.qe-only { display: none; }
.quick-on .qe-only { display: block; }
.quick-on .qe-hide { display: none; }
.qe-field { padding: 5px 8px !important; font-size: 12.5px !important; min-width: 120px; }
textarea.qe-field { min-height: 52px; }
td.saving { opacity: .55; }
td.saved { animation: savedflash 1.2s ease-out; }
td.save-error { box-shadow: inset 0 0 0 2px var(--danger); }
@keyframes savedflash { 0% { background: var(--ok-bg); } 100% { background: transparent; } }
.toolbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .left, .toolbar .right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filters details > summary { cursor: pointer; font-weight: 600; font-size: 12.5px; color: var(--accent); list-style: none; display: inline-flex; gap: 6px; align-items: center; margin-top: 10px; }
.filters details > summary::-webkit-details-marker { display: none; }
.filters details[open] > summary { margin-bottom: 10px; }
.bulkbar label { color: #c8d6ea; font-size: 11px; margin: 0; }
.bulkbar .bulk-fields { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.bulkbar input, .bulkbar select { width: auto; min-width: 140px; padding: 6px 9px; font-size: 13px; background-color: #1b2f48; color: #fff; border-color: #2c4566; }

/* Fichas */
.sheet-hero { display: flex; gap: 18px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; padding: 18px 22px; }
.sheet-hero h1 { font-size: 22px; letter-spacing: -.3px; }
.sheet-hero .meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--text-2); font-size: 13px; margin-top: 6px; }
.sheet-hero .meta span { display: inline-flex; gap: 6px; align-items: center; }
.sheet-hero .badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.mini-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 1px solid var(--border); }
.mini-kpis a, .mini-kpis div { padding: 12px 18px; border-right: 1px solid var(--border); color: inherit; }
.mini-kpis > :last-child { border-right: 0; }
.mini-kpis a:hover { background: var(--surface-2); text-decoration: none; }
.mini-kpis .l { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .45px; }
.mini-kpis .v { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mini-kpis .s { font-size: 12px; color: var(--text-3); }
.contact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.contact { border: 1px solid var(--border); border-radius: 9px; padding: 12px 14px; background: var(--surface); position: relative; }
.contact .nm { font-weight: 650; }
.contact .ps { color: var(--text-3); font-size: 12.5px; }
.contact .ln { font-size: 12.5px; margin-top: 6px; display: flex; flex-direction: column; gap: 2px; }
.contact .del { position: absolute; right: 8px; top: 8px; }
.note-type { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; padding: 1px 6px; border-radius: 4px; background: var(--surface-3); color: var(--text-2); }
.note-type.t-Reunión { background: var(--info-bg); color: var(--info); }
.note-type.t-Acuerdo { background: var(--ok-bg); color: var(--ok); }
.note-type.t-Necesidad, .note-type.t-Posible-RFQ { background: var(--seed-bg); color: var(--seed); }
.note-type.t-Competencia { background: var(--reject-bg); color: var(--reject); }
.note-type.t-Seguimiento { background: var(--warn-bg); color: var(--warn); }
.prose { white-space: pre-line; overflow-wrap: anywhere; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { padding: 10px 18px; border-bottom: 1px solid var(--border); }
.list-plain li:last-child { border-bottom: 0; }
.list-plain .row { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.section-label { font-size: 11.5px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .5px; margin: 0 0 8px; }

/* Mis oportunidades */
.work-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.work-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 11px 18px; border-bottom: 1px solid var(--border); align-items: center; }
.work-item:last-child { border-bottom: 0; }
.work-item .t { font-weight: 600; color: var(--text); }
.work-item .s { font-size: 12.5px; color: var(--text-3); }
.work-item .r { text-align: right; font-size: 12.5px; white-space: nowrap; }
.count-pill { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 10px; font-size: 11.5px; font-weight: 700; background: var(--surface-3); color: var(--text-2); }
.count-pill.danger { background: var(--danger-bg); color: var(--danger); }
.count-pill.warn { background: var(--warn-bg); color: var(--warn); }

/* Gráfico de columnas apiladas (evolución) */
.chart-col .seg.s3 { background: var(--series-3); }
.chart-col .seg.s4 { background: var(--series-4); }

/* Avisos de cálculo */
.calc-note { font-size: 12px; color: var(--text-3); padding: 10px 18px; background: var(--surface-2); border-top: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); }

/* Login eCom */
.login-points { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 12px; }
.login-points li { display: flex; gap: 12px; align-items: flex-start; color: #cfe0f4; font-size: 14px; }
.login-points li .svg-icon { color: #6fb6ff; margin-top: 2px; }
.login-points li strong { color: #fff; display: block; font-size: 14px; }
.captcha-q { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--text); background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: 7px; padding: 8px 11px; margin-bottom: 6px; }

@media (max-width: 1200px) {
  .portfolio { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .portfolio a { border-bottom: 1px solid var(--border); }
  .mini-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .work-grid { grid-template-columns: minmax(0, 1fr); }
  .stepper { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .funnel .step { grid-template-columns: 90px minmax(0, 1fr) 110px; }
  .sticky-side { position: static; }
}
@media (max-width: 640px) {
  .portfolio, .mini-kpis { grid-template-columns: minmax(0, 1fr); }
  .portfolio a, .mini-kpis > * { border-right: 0; }
  .stepper { grid-template-columns: minmax(0, 1fr); }
  .hbars li { grid-template-columns: minmax(0, 1fr) auto; }
  .hbars .bar { grid-column: 1 / -1; grid-row: 2; }
}

/* Importador */
.unresolved-field { border: 2px solid var(--danger) !important; background: #fff1f1 !important; }
.resolved-field { border: 2px solid var(--ok) !important; background: #f1fff5 !important; }
.kpis.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .kpis.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .kpis.cols-4 { grid-template-columns: minmax(0, 1fr); } }
.items-table { table-layout: fixed; min-width: 640px; }
.items-table th { padding: 8px 6px; font-size: 10.5px; }
.items-table th:nth-child(1) { width: 17%; } .items-table th:nth-child(2) { width: 19%; }
.items-table th:nth-child(3) { width: 9%; }  .items-table th:nth-child(4) { width: 11%; }
.items-table th:nth-child(5) { width: 13%; } .items-table th:nth-child(6) { width: 8%; }
.items-table th:nth-child(7) { width: 8%; }  .items-table th:nth-child(8) { width: 12%; }
.items-table th:nth-child(9) { width: 36px; }
.items-table td { padding: 6px 4px; }
.items-table input, .items-table select { padding: 6px 6px; min-width: 0; }
.items-table select { padding-right: 22px; background-position: right 6px center; }
.items-table .line-total { font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.items-table tfoot td { font-size: 12.5px; }
.grid > .card + .card, .work-grid > .card + .card, .grid > * + .card { margin-top: 0; }

/* eCom IA */
.ai-chat { display: flex; flex-direction: column; min-height: calc(100vh - 230px); }
.ai-messages { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 16px; max-height: calc(100vh - 300px); }
.ai-msg { display: flex; gap: 10px; align-items: flex-start; }
.ai-user { flex-direction: row-reverse; }
.ai-avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; background: linear-gradient(135deg, #4ba3ff, #1d6fd8); color: #fff; }
.ai-user .ai-avatar { background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 700; }
.ai-bubble { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; max-width: min(860px, 100%); min-width: 0; font-size: 14px; }
.ai-user .ai-bubble { background: var(--accent); border-color: var(--accent); color: #fff; max-width: 70%; }
.ai-bubble p { margin: 0 0 8px; line-height: 1.55; }
.ai-bubble p:last-child { margin-bottom: 0; }
.ai-interp { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.ai-interp span { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); }
.ai-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 10px 0; }
.ai-kpis div { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.ai-kpis .l { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--text-3); }
.ai-kpis .v { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ai-kpis .h { font-size: 11.5px; color: var(--text-3); }
.ai-block { margin-top: 10px; }
.ai-block .section-label { margin-bottom: 4px; }
.ai-block .table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.ai-block .table td, .ai-block .table th { padding: 6px 9px; font-size: 12.5px; }
.ai-block .hbars li { padding: 3px 0; }
.ai-finding { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.ai-finding:last-child { border-bottom: 0; }
.ai-finding .t { font-weight: 650; }
.ai-finding .d { font-size: 12.5px; color: var(--text-2); }
.ai-finding .a { font-size: 12.5px; margin-top: 2px; }
.ai-note { font-size: 12px; color: var(--text-3); margin-top: 8px; }
.ai-links, .ai-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.ai-chip { font: 500 12.5px var(--font); padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); cursor: pointer; }
.ai-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.ai-foot { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-top: 10px; font-size: 11.5px; color: var(--text-3); }
.ai-foot button { background: none; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; padding: 2px 7px; color: var(--text-3); }
.ai-foot button.on { border-color: var(--accent); color: var(--accent); }
.ai-input { display: flex; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); align-items: flex-end; }
.ai-input textarea { min-height: 42px; max-height: 160px; resize: none; }
.ai-typing span { display: inline-block; width: 6px; height: 6px; margin: 0 2px; border-radius: 50%; background: var(--text-3); animation: aiblink 1s infinite; }
.ai-typing span:nth-child(2) { animation-delay: .2s; } .ai-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes aiblink { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
.topbar-ask { position: relative; width: min(340px, 34vw); }
.topbar-ask input { padding: 7px 10px 7px 32px; font-size: 13px; background: var(--surface-2); border-radius: 999px; }
.topbar-ask .svg-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--accent); }
@media (max-width: 960px) { .topbar-ask { display: none; } .ai-user .ai-bubble { max-width: 85%; } }
