/* Tema Talos AI: los colores de la empresa (rojo sobre blanco, franja oscura arriba, etiquetas en monoespaciada). */
:root {
  --bg: #f3f4f6; --panel: #ffffff; --ink: #1a1a1a; --muted: #6b6f76; --line: #e2e4e8; --line-strong: #c9ccd2;
  --brand: #c2410c; --brand-dark: #9a3412; --brand-ink: #ffffff; --brand-soft: #fdf0e7;
  --strip: #1f1f1f; --strip-ink: #d9d9d9;
  --ok: #1b7f3b; --ok-bg: #e6f4ea; --bad: #b42318; --bad-bg: #fdecea;
  --warn: #9a5b00; --warn-bg: #fff4e0; --radius: 12px;
  --mono: ui-monospace, "Cascadia Mono", "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
}
/* Modo oscuro (botón ◐ en la barra): fondo negro, tarjetas gris carbón, el mismo rojo. */
:root[data-theme="dark"] {
  --bg: #000000; --panel: #141416; --ink: #ededed; --muted: #9b9fa7; --line: #262729; --line-strong: #3a3b3f;
  --brand: #ea580c; --brand-dark: #c2410c; --brand-ink: #ffffff; --brand-soft: #2a1a10;
  --strip: #000000; --strip-ink: #b9bcc2;
  --ok: #4ade80; --ok-bg: #0f2a1a; --bad: #f87171; --bad-bg: #2f1616;
  --warn: #fbbf24; --warn-bg: #2d2208;
}
:root[data-theme="dark"] .strip { border-bottom: 1px solid var(--line); }
:root[data-theme="dark"] .top { box-shadow: none; }
:root[data-theme="dark"] .card { box-shadow: none; }
:root[data-theme="dark"] .msg.user { background: #26272b; }
:root[data-theme="dark"] .tramo, :root[data-theme="dark"] .balance { background: #0c0c0d; }
:root[data-theme="dark"] input, :root[data-theme="dark"] select, :root[data-theme="dark"] textarea { background: #0c0c0d; }
:root[data-theme="dark"] .donut .ring, :root[data-theme="dark"] .hist .stack, :root[data-theme="dark"] .answers .abar, :root[data-theme="dark"] .bar { background: #222326; }
:root[data-theme="dark"] .consumo { background: linear-gradient(100deg, #2a1a10, var(--panel) 60%); }
.who .theme { width: 30px; height: 30px; padding: 0; border-radius: 50%; font-size: 15px; line-height: 1; border-color: var(--line-strong); color: var(--muted); background: transparent; }
.who .theme:hover { color: var(--brand); border-color: var(--brand); background: transparent; }

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 12px; }
/* Etiquetas al estilo de la empresa: monoespaciada, mayúsculas y espaciadas. */
.mono, label, th, .kpi .l, .consumo .l, .balance .bl, .balance-now .bl, .step-l, .nav a, .who, .strip {
  font-family: var(--mono); text-transform: uppercase; letter-spacing: .08em;
}
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; text-align: right; }

/* Franja oscura superior (como el portal de la empresa) + barra blanca de navegación con subrayado rojo. */
.strip { background: var(--strip); color: var(--strip-ink); font-size: 12px; }
.strip .in { max-width: 1480px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 18px; min-height: 30px; }
.strip a { color: var(--strip-ink); padding: 6px 0; border-bottom: 2px solid transparent; }
.strip a.on, .strip a:hover { color: #fff; border-bottom-color: var(--brand); text-decoration: none; }
.strip .sp { flex: 1; }
.top { background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; box-shadow: 0 1px 0 var(--line); }
.top .in { max-width: 1480px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 22px; min-height: 58px; flex-wrap: wrap; }
.brand { font-weight: 800; color: var(--ink); font-size: 19px; letter-spacing: -.01em; white-space: nowrap; }
.brand b { color: var(--brand); font-weight: 800; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.nav a { white-space: nowrap; padding: 19px 8px 17px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; color: var(--ink); border-bottom: 3px solid transparent; }
.nav a:hover { color: var(--brand); text-decoration: none; }
.nav a.on { border-bottom-color: var(--brand); color: var(--ink); }
.who { display: flex; align-items: center; gap: 12px; font-size: 11px; color: var(--muted); margin-left: auto; }
.who a { color: var(--muted); }
.who form { margin: 0; }
.as-tenant { background: var(--brand-soft); color: var(--brand-dark); padding: 7px 16px; font-size: 13px; text-align: center; border-bottom: 1px solid color-mix(in srgb, var(--brand) 25%, transparent); }

main { max-width: 1180px; margin: 0 auto; padding: 22px 16px 60px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.kpi .v { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: 13px; }
.kpi .s { font-size: 13px; color: var(--muted); }

.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; word-break: break-word; border: 1px solid transparent; }
.flash.ok { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.flash.error { background: var(--bad-bg); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; color: var(--muted); font-weight: 600; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.scroll { overflow-x: auto; }

label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 5px; font-weight: 600; }
label:has(input[type=checkbox]), label:has(input[type=radio]) { font-family: inherit; text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--ink); }
input, select, textarea { width: 100%; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel); color: var(--ink); font: inherit; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
input[type=checkbox] { width: auto; }
textarea { min-height: 120px; resize: vertical; }
.field { margin-bottom: 12px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1; min-width: 130px; }
.row > .fit { flex: 0 0 auto; min-width: 0; }
/* Botones tipo píldora: el principal en rojo, el secundario con borde rojo sobre blanco. */
button, .btn { display: inline-block; padding: 8px 18px; border-radius: 99px; border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink); font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; line-height: 1.4; }
button:hover, .btn:hover { text-decoration: none; background: var(--brand-dark); border-color: var(--brand-dark); }
button.ghost, .btn.ghost { background: var(--panel); color: var(--brand); border-color: var(--brand); font-weight: 600; }
button.ghost:hover, .btn.ghost:hover { background: var(--brand-soft); color: var(--brand-dark); }
button.danger { background: var(--panel); color: var(--bad); border-color: var(--bad); }
button.danger:hover { background: var(--bad-bg); }
button.sm, .btn.sm { padding: 4px 12px; font-size: 12.5px; }

.tag { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 10.5px; font-weight: 700; font-family: var(--mono); text-transform: uppercase; letter-spacing: .06em; background: var(--bg); color: var(--muted); white-space: nowrap; border: 1px solid var(--line); }
.tag.ok { border-color: color-mix(in srgb, var(--ok) 35%, transparent); } .tag.bad { border-color: color-mix(in srgb, var(--bad) 35%, transparent); } .tag.warn { border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }

.bar { height: 8px; background: var(--bg); border-radius: 99px; overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; background: var(--brand); }
.bar i.ok { background: var(--ok); } .bar i.bad { background: var(--bad); } .bar i.warn { background: var(--warn); }

.tramo { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; background: var(--bg); }
.nivel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-top: 10px; }
.nivel h4 { margin: 0 0 8px; font-size: 14px; }
.opcion { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 8px; }
.opcion > div { flex: 1; min-width: 120px; }
.opcion .fit { flex: 0 0 auto; min-width: 0; }
.preview { font-size: 13px; color: var(--muted); margin-top: 6px; }

.chat { display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 78%; padding: 8px 12px; border-radius: 12px; }
.msg.assistant { background: var(--bg); align-self: flex-start; }
.msg.user { background: var(--strip); color: #fff; align-self: flex-end; }
.msg .t { font-size: 11px; opacity: .7; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
pre { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow-x: auto; }
.login { max-width: 380px; margin: 10vh auto 0; padding: 28px; }
.login h1 { font-size: 30px; margin-bottom: 2px; }
.login h1 b { color: var(--brand); }
.login button { width: 100%; margin-top: 6px; }

/* ---------- tablero ---------- */
.card { box-shadow: 0 1px 2px rgba(0, 0, 0, .03); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.head.tight { margin-bottom: 12px; align-items: center; }
.head.tight h2 { margin: 0; }
.kpi { position: relative; overflow: hidden; padding-left: 20px; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent, var(--brand)); }
.kpi .l { font-size: 11px; font-weight: 600; }
.kpi .v { font-size: 30px; line-height: 1.2; margin: 4px 0 2px; }
.kpi .v small { font-size: 15px; font-weight: 600; color: var(--accent, var(--muted)); margin-left: 4px; }
.accent-blue { --accent: var(--brand); } .accent-green { --accent: #10b981; } .accent-amber { --accent: #f59e0b; } .accent-violet { --accent: #8b5cf6; } .accent-rose { --accent: #f43f5e; }

.consumo { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; color: var(--ink); background: linear-gradient(100deg, color-mix(in srgb, var(--brand) 9%, var(--panel)), var(--panel) 60%); }
.consumo:hover { text-decoration: none; border-color: var(--brand); }
.consumo .l { font-size: 11px; font-weight: 600; color: var(--muted); }
.consumo .v { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.consumo .s { flex: 1; color: var(--muted); font-size: 14px; min-width: 220px; }
.consumo .go { color: var(--brand); font-weight: 600; }

.donut-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.donut { position: relative; width: 190px; height: 190px; }
.donut svg { width: 100%; height: 100%; transform: rotate(0deg); }
.donut .ring { fill: none; stroke: var(--bg); stroke-width: 5.5; }
.donut .seg { fill: none; stroke-width: 5.5; cursor: pointer; transition: stroke-width .15s ease, opacity .15s ease; }
.donut-wrap.hovering .seg { opacity: .35; }
.donut-wrap.hovering .seg.on { opacity: 1; stroke-width: 7.5; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; pointer-events: none; padding: 0 38px; }
.donut-center .dv { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.donut-center .dl { font-size: 11.5px; color: var(--muted); line-height: 1.25; }
.legend { list-style: none; margin: 0; padding: 0; width: 100%; }
.legend li { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 8px; font-size: 13.5px; cursor: default; }
.legend li.on { background: var(--bg); }
.legend .dot { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }
.legend .ll { flex: 1; }
.legend .lv { font-variant-numeric: tabular-nums; color: var(--muted); }
.legend .lp { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 48px; text-align: right; }
.codes { margin: 12px 0 0; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { font-size: 12.5px; font-weight: 600; padding: 3px 10px; border-radius: 99px; color: #fff; }
.c-bad { background: #f43f5e; } .c-ok { background: #10b981; } .c-sys { background: #94a3b8; }
.hist { display: grid; grid-template-columns: repeat(8, 1fr); gap: 10px; height: 230px; align-items: end; margin-top: 8px; }
.hist .col { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; min-width: 0; }
.hist .n { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 14px; margin-bottom: 4px; text-align: center; }
.hist .n span { display: block; font-weight: 500; font-size: 11.5px; color: var(--muted); }
.hist .stack { width: 100%; max-width: 64px; min-height: 3px; border-radius: 8px 8px 3px 3px; overflow: hidden; display: flex; flex-direction: column; background: var(--bg); transition: filter .15s; }
.hist .col:hover .stack { filter: brightness(1.08); }
.hist .stack i { display: block; min-height: 0; }
.hist .x { font-size: 12px; color: var(--muted); margin-top: 6px; white-space: nowrap; }

.bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; }
.bars .b { flex: 1; background: var(--brand); border-radius: 4px 4px 0 0; min-height: 2px; opacity: .85; }
.bars .b:hover { opacity: 1; }
.quality { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; cursor: pointer; display: block; color: var(--ink); margin: 0; }
.quality:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 25%, transparent); }
.quality input { width: auto; margin-right: 6px; }
.quality .p { font-weight: 700; margin-top: 4px; }
.pos { color: var(--ok); font-weight: 600; } .neg { color: var(--bad); font-weight: 600; }
tfoot td { font-weight: 700; border-top: 2px solid var(--line); }

/* ---------- nuevo bot y voces ---------- */
.pick { display: flex; flex-direction: column; gap: 8px; color: var(--ink); min-height: 150px; transition: border-color .15s, transform .15s; }
a.pick:hover { text-decoration: none; border-color: var(--brand); transform: translateY(-2px); }
.pick-t { font-size: 18px; font-weight: 700; }
.pick-go { margin-top: auto; color: var(--brand); font-weight: 600; }
.pick.soon { opacity: .6; border-style: dashed; box-shadow: none; }
.step-l { font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; }
.seg button.on { background: var(--brand); color: var(--brand-ink); }
.seg a { padding: 7px 14px; color: var(--ink); font-weight: 600; font-size: 13px; }
.seg a + a { border-left: 1px solid var(--line); }
.seg a:hover { text-decoration: none; background: var(--bg); }
.seg a.on { background: var(--brand); color: var(--brand-ink); }
.voices { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; max-height: 340px; overflow-y: auto; padding: 2px; }
.voice { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin: 0; cursor: pointer; color: var(--ink); }
.voice:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 25%, transparent); }
.voice input { width: auto; flex: 0 0 auto; }
.voice .vi { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.25; }
.voice .play { flex: 0 0 auto; width: 32px; height: 32px; padding: 0; border-radius: 50%; font-size: 12px; background: transparent; color: var(--brand); border-color: var(--line); }
.voice .play:hover { border-color: var(--brand); }

/* Tablero del administrador: saldos de proveedores y barras apiladas venta/costo */
.balance { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: var(--bg); display: flex; flex-direction: column; gap: 4px; }
.balance.warn { border-color: var(--warn); background: var(--warn-bg); }
.balance.off { opacity: .8; }
.balance .bl { font-size: 11px; font-weight: 600; color: var(--muted); }
.balance .bv { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.balance .bv small { font-size: 13px; font-weight: 600; color: var(--muted); }
.balance .bv.bad { color: var(--bad); font-size: 18px; }
.balance .bs { font-size: 12px; color: var(--muted); word-break: break-word; }
.balance .bar { margin: 4px 0; }
.balance a.small { margin-top: auto; padding-top: 6px; }
.bars.stack .b { position: relative; overflow: hidden; }
.bars.stack .b i { position: absolute; left: 0; right: 0; bottom: 0; background: #f43f5e; opacity: .85; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 99px; vertical-align: middle; margin-right: 4px; }

/* Saldo prepago del cliente */
.who .saldo { font-weight: 700; font-variant-numeric: tabular-nums; margin-right: 4px; color: var(--ink); }
.balance-now { display: flex; align-items: center; gap: 10px; }
.balance-now .bl { font-size: 11px; font-weight: 600; color: var(--muted); }
.balance-now .bv { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.flash.warn { background: var(--warn-bg); color: var(--warn); }

.opcion-row { align-items: center; margin-bottom: 8px; }
.answers .arow { display: grid; grid-template-columns: minmax(120px, 1fr) 3fr auto; gap: 10px; align-items: center; padding: 6px 0; }
.answers .abar { height: 14px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.answers .abar i { display: block; height: 100%; background: var(--brand); }
.answers .an { font-variant-numeric: tabular-nums; white-space: nowrap; }
