:root {
  --bg: #f3f5f8; --card: #fff; --text: #2b3443; --muted: #7a8494; --line: #e3e7ee;
  --accent: #1f6fd1; --accent-soft: #e8f1fc; --rx: #7ea6d8; --tx: #f0b93b;
  --bad: #d64545; --bad-soft: #fdecec; --ok: #3aa45b; --warn: #e48a1f;
  --shadow: 0 1px 2px rgba(20, 30, 50, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181f; --card: #1d232c; --text: #e2e6ec; --muted: #8d97a6; --line: #2d3540;
    --accent: #5b9cf0; --accent-soft: #1f2d42; --rx: #5f8fcb; --tx: #d9a632;
    --bad: #ef6b6b; --bad-soft: #3a2224; --shadow: none;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }

/* menú vertical de secciones (FW / BD) + barra superior con los reportes de la sección */
.shell { display: flex; min-height: 100vh; }
.side { width: 196px; flex: none; background: var(--card); border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh; padding: 12px 10px; display: flex; flex-direction: column; gap: 4px; z-index: 6; }
.side .brand { padding: 6px 10px 14px; }
.side .sec { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--text); }
.side .sec:hover { background: var(--bg); text-decoration: none; }
.side .sec svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; color: var(--muted); }
.side .sec b { display: block; font-weight: 600; }
.side .sec small { display: block; font-size: 12px; color: var(--muted); line-height: 1.2; }
.side .sec.active { background: var(--accent-soft); color: var(--accent); }
.side .sec.active svg { color: var(--accent); }
.side .firma { margin-top: auto; padding: 8px 10px 2px; font-size: 11px; color: var(--muted); opacity: .7; letter-spacing: .02em; }
.maincol { flex: 1; min-width: 0; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; padding: 8px 20px; min-height: 54px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.sec-title { font-weight: 600; font-size: 15px; white-space: nowrap; }
.sec-title:empty { display: none; }
.brand { font-weight: 600; font-size: 16px; white-space: nowrap; }
.brand .logo { color: var(--accent); }
nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
nav a { padding: 6px 12px; border-radius: 6px; color: var(--text); white-space: nowrap; }
.range { margin-left: auto; }
.user-menu { margin-left: auto; }
.range + .user-menu { margin-left: 0; }
[hidden] { display: none !important; }
@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .side { width: auto; height: auto; position: static; flex-direction: row; align-items: center; padding: 6px 12px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .side .brand { padding: 0 8px 0 0; }
  .side .brand-text, .side .sec small { display: none; }
  .side .sec { padding: 6px 10px; }
}
nav a:hover { background: var(--bg); text-decoration: none; }
nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
select, input[type=search] { font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; }
input[type=search] { min-width: 260px; }

main { max-width: 1400px; margin: 0 auto; padding: 20px; }
.loading, .empty { padding: 40px; text-align: center; color: var(--muted); }
.error { padding: 16px; background: var(--bad-soft); color: var(--bad); border-radius: 8px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card > h2 { margin: 0; padding: 12px 18px; font-size: 15px; font-weight: 600; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.card > h2 .right { margin-left: auto; font-weight: 400; font-size: 13px; }
.card .body { padding: 16px 18px; }
.grid { display: grid; gap: 18px; }
.grid > *, .net > * { min-width: 0; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.net { display: grid; grid-template-columns: 1fr 300px; }
.net > div:first-child { border-right: 1px dashed var(--line); padding-right: 18px; }
.net > div:last-child { padding-left: 18px; }
@media (max-width: 960px) {
  .cols-2, .net { grid-template-columns: 1fr; }
  .net > div:first-child { border-right: 0; padding-right: 0; }
  .net > div:last-child { padding-left: 0; }
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 10px; }
  main { padding: 12px 16px; }
  input[type=search] { min-width: 0; width: 100%; }
}

.tabs { display: inline-flex; gap: 2px; font-size: 13px; }
.tabs button { font: inherit; background: none; border: 0; color: var(--accent); padding: 2px 8px; cursor: pointer; border-right: 1px solid var(--line); }
.tabs button:last-child { border-right: 0; }
.tabs button.on { color: var(--text); font-weight: 600; cursor: default; }
.subhead { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; font-weight: 600; }

.donut-wrap { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.legend { display: grid; grid-template-columns: repeat(2, minmax(160px, 1fr)); gap: 4px 18px; font-size: 13px; flex: 1; }
.legend .it { display: flex; align-items: center; gap: 6px; min-width: 0; }
.legend .it span.l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend .sw { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.legend a { color: var(--text); }
.legend b { font-weight: 600; }

.stat { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; }
.stat .ic { width: 22px; color: var(--muted); text-align: center; flex: none; }
.stat .k { font-weight: 600; }
.stat .v { font-size: 13px; }
.sep { border-top: 1px dashed var(--line); margin: 12px 0; }

.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: var(--bg); border-radius: 8px; padding: 10px 14px; }
.kpi .n { font-size: 22px; font-weight: 600; }
.kpi .n.bad { color: var(--bad); }
.kpi .l { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }

.big { font-size: 40px; font-weight: 600; line-height: 1; }
.sec { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 960px) { .sec { grid-template-columns: 1fr; } }
.sec ul { list-style: none; padding: 0; margin: 8px 0 0; }
.sec li { padding: 3px 0; display: flex; justify-content: space-between; gap: 8px; }

.chart { width: 100%; position: relative; }
.chart svg { display: block; }
.chart text { font-size: 11px; fill: var(--muted); }
.chart .grid-l { stroke: var(--line); }
.chart .hover-l { stroke: var(--muted); stroke-dasharray: 3 3; }
.chart-legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

.tip { position: fixed; pointer-events: none; background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; font-size: 12px; box-shadow: 0 4px 14px rgba(0,0,0,.12); z-index: 20; white-space: nowrap; }

.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-weight: 600; color: var(--muted); font-size: 12px; user-select: none; position: sticky; top: 0; background: var(--card); }
th.sort { cursor: pointer; }
th.sort:hover { color: var(--text); }
th.asc::after { content: " ▲"; font-size: 9px; }
th.desc::after { content: " ▼"; font-size: 9px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.wrap { white-space: normal; word-break: break-all; min-width: 220px; max-width: 520px; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--accent-soft); }
tr.bad td { color: var(--bad); }
.bar { height: 6px; background: var(--accent-soft); border-radius: 3px; min-width: 60px; }
.bar i { display: block; height: 100%; background: var(--rx); border-radius: 3px; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px; background: var(--bg); color: var(--muted); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.warn { background: #fdebd0; color: #a04000; }
.tag.good { background: #d5f5e3; color: #1e7e34; }
.risk { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px; color: #fff; }
.risk-0, .risk-1 { background: #7aa874; } .risk-2 { background: #b6a33a; } .risk-3 { background: var(--warn); } .risk-4, .risk-5 { background: var(--bad); }

.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar label { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.toolbar .count { margin-left: auto; color: var(--muted); font-size: 13px; }
.btn { font: inherit; background: var(--accent-soft); color: var(--accent); border: 0; border-radius: 6px; padding: 6px 14px; cursor: pointer; }
.btn:hover { filter: brightness(.96); }
.btn-sm { font-size: 12px; padding: 3px 10px; font-weight: 400; vertical-align: middle; }
.icon-btn { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 4px; font-size: 13px; }
.icon-btn:hover { color: var(--accent); }
textarea { width: 100%; font: 12px/1.4 Consolas, monospace; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; resize: vertical; }
input[type=text] { font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; }
.uhead { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.avatar { width: 52px; height: 52px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 20px; font-weight: 600; flex: none; }
.uhead h1 { margin: 0; font-size: 20px; }
.uhead .meta { color: var(--muted); font-size: 13px; display: flex; gap: 16px; flex-wrap: wrap; }
.back { display: inline-block; margin-bottom: 12px; }
.ipinfo { margin-top: 14px; padding: 12px 14px; background: var(--bg); border-radius: 8px; font-size: 13px; display: grid; gap: 4px; }
.ipinfo .k { display: inline-block; width: 130px; color: var(--muted); }
.wrap-any { word-break: break-all; }
/* ---------- roles y formularios ---------- */
.user-menu .admin-only { display: none; }
.role-admin .user-menu .admin-only { display: inline; }
.user-menu .admin-link { color: var(--text); }
.user-menu .admin-link:hover { color: var(--accent); }
.role-lector .admin-only, .role-lector [data-alias], .role-lector [data-del] { display: none !important; }
.tag.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.card > h2 > .btn { font-weight: 400; }
.btn-ghost { background: none; border: 1px solid var(--line); color: var(--text); }
.pform { background: var(--bg); border-radius: 8px; padding: 14px 16px; margin-bottom: 16px; }
.pform h3 { margin: 0 0 10px; font-size: 14px; font-weight: 600; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 16px; }
.pgrid label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); align-content: start; }
.pgrid .pfila { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px 16px; align-items: start; }
.pgrid .pperms label.chk { padding-top: 0; align-items: flex-start; }
.pgrid label.chk { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); padding-top: 18px; }
.pgrid input[type=text], .pgrid input[type=password], .pgrid select { font: inherit; font-size: 14px; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; }
.pgrid input:disabled, .pgrid select:disabled { opacity: .6; }
.user-menu a.who { color: var(--muted); }
.user-menu a.who:hover { color: var(--accent); }

/* ---------- base de datos ---------- */
.mono { font-family: Consolas, "SFMono-Regular", Menlo, monospace; font-size: 12px; }
pre.sql { font: 12px/1.45 Consolas, "SFMono-Regular", Menlo, monospace; background: var(--bg); border-radius: 6px; padding: 10px 12px;
  white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow: auto; margin: 8px 0 0; }
ul.hints { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
ul.hints li { margin: 3px 0; }
.livebox { border: 1px solid var(--line); border-left: 3px solid var(--bad); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; display: grid; gap: 6px; font-size: 13px; }
.sbox { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 12px; }
.sbox h3 { margin: 0 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.chain { display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; }
.cbox { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; flex: 1 1 220px; max-width: 360px; display: grid; gap: 4px; font-size: 13px; }
.cbox:last-child { border-color: var(--bad); }
.carrow { align-self: center; color: var(--muted); font-size: 12px; white-space: nowrap; }
code { font-family: Consolas, monospace; font-size: 12px; background: var(--bg); padding: 1px 5px; border-radius: 4px; }

/* ---------- login ---------- */
.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background:
    radial-gradient(1200px 600px at 10% -10%, var(--accent-soft), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, var(--accent-soft), transparent 60%),
    var(--bg);
}
.login-wrap { width: 100%; max-width: 400px; }
.login-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 32px 30px 28px; box-shadow: 0 10px 40px rgba(20, 30, 50, .10); }
.login-brand { display: flex; gap: 14px; align-items: center; margin-bottom: 26px; }
.login-mark { width: 46px; height: 46px; color: var(--accent); flex: none; }
.login-brand h1 { margin: 0; font-size: 19px; font-weight: 600; }
.login-brand p { margin: 2px 0 0; font-size: 13px; }
.login-card form { display: grid; gap: 6px; }
.login-card label { font-size: 13px; font-weight: 600; margin-top: 8px; }
.login-card input { font: inherit; font-size: 15px; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; width: 100%; transition: border-color .15s, box-shadow .15s; }
.login-card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 6px; display: grid; place-items: center; }
.pw-toggle svg { width: 20px; height: 20px; }
.pw-toggle:hover, .pw-toggle.on { color: var(--accent); }
.login-hint { margin: 2px 0 0; font-size: 12px; color: var(--warn); }
.login-error { margin-top: 10px; padding: 9px 12px; border-radius: 8px; background: var(--bad-soft); color: var(--bad); font-size: 13px; }
.login-btn { margin-top: 18px; font: inherit; font-weight: 600; font-size: 15px; color: #fff; background: var(--accent); border: 0; border-radius: 8px; padding: 11px; cursor: pointer; display: flex; justify-content: center; align-items: center; gap: 10px; transition: filter .15s; }
.login-btn:hover { filter: brightness(1.07); }
.login-btn:disabled { cursor: progress; opacity: .85; }
.login-btn .spinner { display: none; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.login-btn.busy .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.login-foot { text-align: center; font-size: 12px; margin-top: 18px; }
.user-menu { display: flex; align-items: center; gap: 10px; font-size: 13px; white-space: nowrap; }
.user-menu .who { color: var(--muted); }
.user-menu button { font: inherit; background: none; border: 1px solid var(--line); color: var(--text); border-radius: 6px; padding: 5px 10px; cursor: pointer; }
.user-menu button:hover { border-color: var(--accent); color: var(--accent); }
.filter-chip { display: inline-flex; gap: 6px; align-items: center; background: var(--accent-soft); color: var(--accent); padding: 3px 10px; border-radius: 12px; font-size: 12px; }
.filter-chip button { border: 0; background: none; color: inherit; cursor: pointer; font-size: 14px; padding: 0; }

/* ---------- ventas ---------- */
.side .sec.admin-only { display: none; }
.role-admin .side .sec.admin-only { display: flex; }
.kpi .d { font-size: 12px; margin-top: 2px; color: var(--muted); }
.kpi .d.up { color: var(--ok); }
.kpi .d.down { color: var(--bad); }
.kpi .d.inv.up { color: var(--bad); }
.kpi .d.inv.down { color: var(--ok); }
.delta { font-size: 12px; white-space: nowrap; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--bad); }
.vt-dates input[type=date] { font: inherit; font-size: 13px; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; }
.vt-note { font-size: 12px; color: var(--muted); }
/* Ventas: indicadores secundarios y "cómo se calcula" plegados; pestañas en el título de las tarjetas */
.vt-more { margin-top: 12px; }
.vt-more > summary, .vt-how > summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.vt-how > summary { padding: 12px 16px; }
.vt-how > summary h2 { font-size: 14px; border: 0; padding: 0; }
.card h2 .tabs { margin-left: 12px; font-weight: normal; }
.vt-dims { gap: 6px 10px; }
/* reportes BUC: tabla con filas que se abren (como la matriz de Power BI) */
.kpi .n.good { color: var(--ok); }
.bu-wrap { overflow-x: auto; }
.bu-tab { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.bu-tab th { position: sticky; top: 0; background: var(--text); color: var(--card); font-weight: 600; text-align: left;
  padding: 7px 8px; white-space: nowrap; cursor: pointer; }
.bu-tab th.num, .bu-tab td.num { text-align: right; }
.bu-tab td { padding: 5px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.bu-tab tbody tr { cursor: default; }
.bu-tab tbody tr:hover td { background: var(--accent-soft); }
.bu-tab tr.lv0 td { font-weight: 600; }
.bu-tab tr.lv2 td, .bu-tab tr.lv3 td { color: var(--muted); }
.bu-tab tr.lv2 td.num, .bu-tab tr.lv3 td.num { color: var(--text); }
.bu-tab td.good { color: var(--ok); }
.bu-tab td.bad { color: var(--bad); }
.bu-tab tfoot td { background: var(--text); color: var(--card); font-weight: 700; padding: 7px 8px; white-space: nowrap; }
.bu-tg { display: inline-block; width: 16px; color: var(--muted); cursor: pointer; }
.bu-tab tr:has(.bu-tg:not(:empty)) { cursor: pointer; }
/* diseñador de reportes */
.rp-editor { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin: 6px 0 12px;
  padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.rp-editor h3 { font-size: 13px; margin: 0 0 8px; color: var(--muted); font-weight: 600; }
.rp-list { display: flex; flex-direction: column; gap: 4px; }
.rp-item { display: flex; justify-content: space-between; align-items: center; padding: 4px 8px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--bg); font-size: 13px; }
.rp-act button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 4px; font-size: 13px; }
.rp-act button:hover:not(:disabled) { color: var(--accent); }
.rp-act button:disabled { opacity: .3; cursor: default; }
.rp-list select { margin-top: 4px; font: inherit; font-size: 13px; }
/* radar: proyección, alertas y por qué cambió */
.rd-texto { margin-top: 14px; background: var(--accent-soft); border-left: 3px solid var(--accent); border-radius: 6px;
  padding: 8px 14px; font-size: 14px; line-height: 1.45; }
.rd-texto p { margin: 4px 0; }
.rd-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.rd-h3 { font-size: 13px; font-weight: 600; margin: 0 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
/* Mis reportes: preguntas en castellano */
.rp-pregunta { display: flex; gap: 8px; margin-bottom: 12px; }
.rp-pregunta input { flex: 1; min-width: 0; font: inherit; font-size: 14px; padding: 8px 12px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--card); color: var(--text); }
/* FW: incidentes de seguridad */
.inc-chart { display: flex; align-items: flex-end; gap: 2px; height: 120px; border-bottom: 1px solid var(--line); margin: 14px 0 20px; }
.inc-bar { flex: 1; height: 100%; display: flex; flex-direction: column-reverse; position: relative; }
.inc-bar i { display: block; }
.inc-bar b { position: absolute; bottom: -17px; width: 100%; text-align: center; font-weight: normal; font-size: 10px; color: var(--muted); }
.inc-ley { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); }
.inc-ley i, .inc-dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
/* Preguntas (charla) */
.pq-charla { display: flex; flex-direction: column; gap: 10px; }
.pq-q { align-self: flex-end; max-width: 80%; background: var(--accent); color: #fff; border-radius: 12px 12px 2px 12px;
  padding: 8px 14px; font-size: 14px; white-space: pre-wrap; }
.pq-a { align-self: flex-start; max-width: 92%; background: var(--accent-soft); border-radius: 12px 12px 12px 2px;
  padding: 8px 14px; font-size: 14px; line-height: 1.5; }
.pq-a p { margin: 4px 0; } .pq-a ul { margin: 4px 0; padding-left: 20px; }
.pq-err { border-left: 3px solid var(--bad); }
.pq-ejs { display: flex; flex-wrap: wrap; gap: 6px; }
.pq-conss { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.pq-cons { width: 100%; } .pq-cons summary { cursor: pointer; font-size: 13px; }
.pq-cons .bu-wrap { margin-top: 6px; max-height: 360px; overflow: auto; }
/* ficha del cliente (pensada para el celular) */
.fc-buscar { position: relative; }
.fc-buscar input { width: 100%; box-sizing: border-box; font: inherit; font-size: 15px; padding: 9px 12px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--card); color: var(--text); }
.fc-res { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; margin-top: 4px; background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 6px 18px rgba(0, 0, 0, .12); max-height: 360px; overflow: auto; }
.fc-res a, .fc-res div { display: block; padding: 8px 12px; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--line); font-size: 14px; }
.fc-res a:hover { background: var(--accent-soft); }
.fc-lista { margin-top: 10px; }
.fc-item { display: flex; justify-content: space-between; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.fc-item:hover { background: var(--accent-soft); }
.fc-item .muted { font-size: 12px; }
.fc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.fc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.fc-chips span { background: var(--bg); border-radius: 12px; padding: 2px 10px; font-size: 12px; color: var(--muted); }
.fc-cat { margin: 10px 0; }
.fc-cat-t { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 3px; }
.fc-bar { position: relative; height: 10px; background: var(--bg); border-radius: 5px; }
.fc-fill { height: 100%; border-radius: 5px; background: var(--accent); }
.fc-fill.good { background: var(--ok); }
.fc-fill.bad { background: var(--bad); }
.fc-mark { position: absolute; top: -3px; width: 2px; height: 16px; background: var(--text); }
.fc-ul { list-style: none; margin: 0; padding: 0; }
.fc-ul li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.fc-ul li:last-child { border-bottom: 0; }
.fc-ul .muted { font-size: 12px; margin-top: 2px; }
.fc-ul .right { float: right; }
.fc-link { font-size: 12px; margin-left: 6px; }
.fc-tab td:first-child { white-space: normal; }
.fc-tab td, .fc-tab th { padding-left: 6px; padding-right: 6px; }
@media (max-width: 640px) {
  .fc-kpis { grid-template-columns: 1fr 1fr; }
  .fc-kpis .kpi .n { font-size: 18px; }
  .rd-grid { grid-template-columns: 1fr; }
}
