/* ============================================================
   FLOTA MINERA JUJUY · Sistema de Gestión de Flota
   Diseño industrial robusto — Impulsys
   ============================================================ */

:root{
  --bg:        #0d0f13;
  --bg-2:      #12151b;
  --panel:     #171b22;
  --panel-2:   #1d222b;
  --steel:     #2a313c;
  --steel-2:   #353e4b;
  --line:      #232a34;

  --orange:    #ff6a18;
  --orange-2:  #ff8a3d;
  --amber:     #ffc21a;
  --green:     #3ddc84;
  --red:       #ff4d4d;
  --blue:      #4aa8ff;

  --text:      #eef1f5;
  --muted:     #9aa6b5;
  --muted-2:   #6b7787;

  --radius:    10px;
  --radius-sm: 7px;
  --shadow:    0 10px 30px rgba(0,0,0,.45);
  --shadow-sm: 0 4px 14px rgba(0,0,0,.35);

  --font:      'Inter', 'Segoe UI', system-ui, sans-serif;
  --mono:      'JetBrains Mono', 'Consolas', monospace;
}

*{ box-sizing:border-box; margin:0; padding:0; }
html,body{ height:100%; }
body{
  font-family:var(--font);
  background:var(--bg);
  color:var(--text);
  -webkit-font-smoothing:antialiased;
  line-height:1.45;
}
a{ color:inherit; text-decoration:none; }
::selection{ background:var(--orange); color:#000; }

/* scrollbar */
::-webkit-scrollbar{ width:10px; height:10px; }
::-webkit-scrollbar-track{ background:var(--bg-2); }
::-webkit-scrollbar-thumb{ background:var(--steel); border-radius:6px; }
::-webkit-scrollbar-thumb:hover{ background:var(--steel-2); }

/* ============ LAYOUT APP ============ */
.app{ display:grid; grid-template-columns:248px 1fr; min-height:100vh; }

.sidebar{
  background:linear-gradient(180deg,#12151b,#0f1218);
  border-right:1px solid var(--line);
  display:flex; flex-direction:column;
  position:sticky; top:0; height:100vh;
}
.brand{
  display:flex; align-items:center; gap:12px;
  padding:20px 18px; border-bottom:1px solid var(--line);
}
.brand .logo{
  width:42px; height:42px; border-radius:9px;
  background:linear-gradient(135deg,var(--orange),#c14400);
  display:grid; place-items:center; font-size:22px;
  box-shadow:0 4px 14px rgba(255,106,24,.35);
  flex:none;
}
.brand .t1{ font-weight:800; font-size:15px; letter-spacing:.4px; line-height:1.1; }
.brand .t2{ font-size:11px; color:var(--muted); letter-spacing:1.5px; text-transform:uppercase; }

.nav{ padding:14px 12px; overflow-y:auto; flex:1; }
.nav .group{ font-size:10.5px; letter-spacing:1.4px; text-transform:uppercase; color:var(--muted-2); margin:16px 10px 8px; }
.nav a{
  display:flex; align-items:center; gap:12px;
  padding:10px 12px; border-radius:var(--radius-sm);
  color:var(--muted); font-size:14px; font-weight:500;
  margin-bottom:3px; transition:.15s; position:relative;
}
.nav a .ico{ width:20px; text-align:center; font-size:16px; flex:none; }
.nav a:hover{ background:var(--panel); color:var(--text); }
.nav a.active{ background:var(--panel-2); color:#fff; }
.nav a.active::before{
  content:""; position:absolute; left:-12px; top:8px; bottom:8px; width:3px;
  background:var(--orange); border-radius:0 3px 3px 0;
}
.nav a .badge{ margin-left:auto; }

.side-user{
  padding:14px 16px; border-top:1px solid var(--line);
  display:flex; align-items:center; gap:11px;
}
.avatar{
  width:38px; height:38px; border-radius:9px; flex:none;
  background:linear-gradient(135deg,var(--steel-2),var(--steel));
  display:grid; place-items:center; font-weight:700; font-size:14px;
}
.side-user .nm{ font-size:13.5px; font-weight:600; }
.side-user .rl{ font-size:11px; color:var(--muted); }

/* ============ MAIN ============ */
.main{ display:flex; flex-direction:column; min-width:0; }
.topbar{
  display:flex; align-items:center; gap:18px;
  padding:16px 28px; border-bottom:1px solid var(--line);
  background:var(--bg-2); position:sticky; top:0; z-index:20;
}
.topbar h1{ font-size:19px; font-weight:700; letter-spacing:.2px; }
.topbar .sub{ font-size:12.5px; color:var(--muted); margin-top:1px; }
.topbar .spacer{ flex:1; }
.search{
  display:flex; align-items:center; gap:9px; background:var(--panel);
  border:1px solid var(--line); border-radius:8px; padding:8px 13px;
  color:var(--muted); font-size:13px; min-width:230px;
}
.search input{ background:none; border:none; outline:none; color:var(--text); font-size:13px; width:100%; font-family:var(--font); }
.icon-btn{
  width:38px; height:38px; border-radius:8px; border:1px solid var(--line);
  background:var(--panel); color:var(--muted); display:grid; place-items:center;
  cursor:pointer; font-size:16px; position:relative; transition:.15s;
}
.icon-btn:hover{ color:var(--text); border-color:var(--steel); }
.icon-btn .dot{ position:absolute; top:7px; right:8px; width:8px; height:8px; border-radius:50%; background:var(--orange); border:2px solid var(--bg-2); }

/* role switcher (demo) */
.role-switch{ display:flex; align-items:center; gap:6px; background:var(--panel); border:1px solid var(--line); border-radius:9px; padding:5px 8px; }
.role-switch .rs-lab{ font-size:11.5px; color:var(--muted-2); margin-right:3px; letter-spacing:.3px; }
.role-switch .rs-btn{ width:32px; height:32px; border-radius:7px; border:1px solid transparent; background:transparent; cursor:pointer; font-size:15px; transition:.15s; }
.role-switch .rs-btn:hover{ background:var(--panel-2); }
.role-switch .rs-btn.active{ background:rgba(255,106,24,.14); border-color:var(--orange); }

.content{ padding:24px 28px 60px; flex:1; }

/* ============ COMPONENTS ============ */
.card{
  background:var(--panel); border:1px solid var(--line);
  border-radius:var(--radius); box-shadow:var(--shadow-sm);
}
.card .card-h{
  display:flex; align-items:center; gap:12px;
  padding:16px 18px; border-bottom:1px solid var(--line);
}
.card .card-h h3{ font-size:15px; font-weight:700; }
.card .card-h .spacer{ flex:1; }
.card .card-b{ padding:18px; }

.grid{ display:grid; gap:18px; }
.g-2{ grid-template-columns:repeat(2,1fr); }
.g-3{ grid-template-columns:repeat(3,1fr); }
.g-4{ grid-template-columns:repeat(4,1fr); }
@media(max-width:1100px){ .g-4{ grid-template-columns:repeat(2,1fr); } .g-3{ grid-template-columns:1fr; } }

/* KPI cards */
.kpi{
  background:linear-gradient(160deg,var(--panel),var(--bg-2));
  border:1px solid var(--line); border-radius:var(--radius);
  padding:18px 18px 16px; position:relative; overflow:hidden;
}
.kpi::after{
  content:""; position:absolute; right:-20px; top:-20px;
  width:90px; height:90px; border-radius:50%;
  background:radial-gradient(circle, rgba(255,106,24,.12), transparent 70%);
}
.kpi .k-ico{ font-size:20px; width:40px; height:40px; border-radius:9px; display:grid; place-items:center; background:var(--panel-2); margin-bottom:13px; }
.kpi .k-val{ font-size:27px; font-weight:800; letter-spacing:-.5px; }
.kpi .k-lab{ font-size:12.5px; color:var(--muted); margin-top:2px; }
.kpi .k-trend{ font-size:11.5px; margin-top:9px; display:inline-flex; align-items:center; gap:5px; font-weight:600; }
.up{ color:var(--green); } .down{ color:var(--red); }

/* pills / badges */
.pill{ display:inline-flex; align-items:center; gap:6px; font-size:11.5px; font-weight:600; padding:4px 10px; border-radius:30px; white-space:nowrap; }
.pill .d{ width:7px; height:7px; border-radius:50%; }
.pill-green{ background:rgba(61,220,132,.13); color:var(--green); } .pill-green .d{ background:var(--green); }
.pill-orange{ background:rgba(255,106,24,.14); color:var(--orange-2); } .pill-orange .d{ background:var(--orange); }
.pill-amber{ background:rgba(255,194,26,.14); color:var(--amber); } .pill-amber .d{ background:var(--amber); }
.pill-red{ background:rgba(255,77,77,.14); color:var(--red); } .pill-red .d{ background:var(--red); }
.pill-blue{ background:rgba(74,168,255,.14); color:var(--blue); } .pill-blue .d{ background:var(--blue); }
.pill-grey{ background:var(--panel-2); color:var(--muted); } .pill-grey .d{ background:var(--muted-2); }

/* buttons */
.btn{
  display:inline-flex; align-items:center; gap:8px; cursor:pointer;
  font-family:var(--font); font-size:13.5px; font-weight:600;
  padding:9px 16px; border-radius:8px; border:1px solid var(--line);
  background:var(--panel-2); color:var(--text); transition:.15s;
}
.btn{ transition:transform .12s ease, filter .15s ease, border-color .15s ease, box-shadow .15s ease; }
.btn:hover{ border-color:var(--steel-2); transform:translateY(-1px); }
.btn:active{ transform:translateY(1px) scale(.98); }
.btn-primary{ background:linear-gradient(135deg,var(--orange),#d8500a); border:none; color:#fff; box-shadow:0 4px 14px rgba(255,106,24,.3); }
.btn-primary:hover{ filter:brightness(1.08); box-shadow:0 7px 20px rgba(255,106,24,.42); }
.btn-sm{ padding:6px 12px; font-size:12.5px; }
.btn-ghost{ background:transparent; }

/* tables */
.table{ width:100%; border-collapse:collapse; font-size:13.5px; }
.table th{
  text-align:left; font-size:11px; letter-spacing:.6px; text-transform:uppercase;
  color:var(--muted-2); font-weight:700; padding:11px 14px; border-bottom:1px solid var(--line);
}
.table td{ padding:13px 14px; border-bottom:1px solid var(--line); color:var(--text); }
.table tbody tr{ transition:.12s; }
.table tbody tr:hover{ background:var(--panel-2); }
.table tbody tr:last-child td{ border-bottom:none; }
.table .u-code{ font-family:var(--mono); font-weight:600; color:var(--orange-2); }
.t-num{ text-align:right; font-variant-numeric:tabular-nums; font-family:var(--mono); }
.t-muted{ color:var(--muted); }

/* progress / bars */
.bar{ height:7px; border-radius:6px; background:var(--steel); overflow:hidden; }
.bar > span{ display:block; height:100%; border-radius:6px; }
.bar.green>span{ background:var(--green); }
.bar.amber>span{ background:var(--amber); }
.bar.red>span{ background:var(--red); }
.bar.orange>span{ background:var(--orange); }

/* mini list */
.list-row{ display:flex; align-items:center; gap:13px; padding:12px 0; border-bottom:1px solid var(--line); }
.list-row:last-child{ border-bottom:none; }
.list-row .li-ico{ width:38px; height:38px; border-radius:9px; display:grid; place-items:center; background:var(--panel-2); font-size:16px; flex:none; }
.list-row .li-main{ flex:1; min-width:0; }
.list-row .li-t{ font-size:13.5px; font-weight:600; }
.list-row .li-s{ font-size:12px; color:var(--muted); }

/* section title */
.sec-title{ display:flex; align-items:center; gap:10px; margin:6px 0 16px; }
.sec-title h2{ font-size:16px; font-weight:700; }
.sec-title .line{ flex:1; height:1px; background:var(--line); }

.muted{ color:var(--muted); }
.mono{ font-family:var(--mono); }
.right{ text-align:right; }
.center{ text-align:center; }
.mb0{margin-bottom:0}
.flex{ display:flex; align-items:center; gap:10px; }
.wrap{ flex-wrap:wrap; }

/* tag chips for ADAS/DSM */
.evt{ display:inline-flex; align-items:center; gap:7px; padding:7px 11px; border-radius:8px; background:var(--panel-2); font-size:12.5px; border:1px solid var(--line); }
.evt .e-ic{ font-size:15px; }

/* simple bar chart */
.chart{ display:flex; align-items:flex-end; gap:10px; height:160px; padding-top:10px; }
.chart .col{ flex:1; display:flex; flex-direction:column; align-items:center; gap:8px; height:100%; justify-content:flex-end; }
.chart .col .bv{ width:100%; max-width:34px; border-radius:6px 6px 0 0; background:linear-gradient(180deg,var(--orange),#a83b00); transition:.3s; }
.chart .col .bv.alt{ background:linear-gradient(180deg,var(--steel-2),var(--steel)); }
.chart .col .cl{ font-size:11px; color:var(--muted); }

/* donut (conic) */
.donut{ width:150px; height:150px; border-radius:50%; display:grid; place-items:center; }
.donut .hole{ width:96px; height:96px; border-radius:50%; background:var(--panel); display:grid; place-items:center; text-align:center; }

hr.sep{ border:none; border-top:1px solid var(--line); margin:18px 0; }

/* ============ TABLAS CON SCROLL (mobile) ============ */
.table-wrap{ width:100%; }

/* botón menú: oculto en desktop */
.menu-btn{ display:none; }
.nav-backdrop{ display:none; }

/* ============ RESPONSIVE / MOBILE ============ */
@media(max-width:860px){
  /* una sola columna; el sidebar pasa a ser un cajón lateral */
  .app{ grid-template-columns:1fr; }

  .sidebar{
    position:fixed; top:0; left:0; z-index:2000;
    width:268px; max-width:84vw; height:100vh; height:100dvh;
    transform:translateX(-100%);
    transition:transform .25s ease;
    box-shadow:0 0 50px rgba(0,0,0,.6);
  }
  .app.nav-open .sidebar{ transform:none; }

  .nav-backdrop{
    display:block; position:fixed; inset:0; z-index:1999;
    background:rgba(0,0,0,.55);
    opacity:0; pointer-events:none; transition:opacity .25s;
  }
  .app.nav-open .nav-backdrop{ opacity:1; pointer-events:auto; }

  /* topbar compacta + hamburguesa */
  .menu-btn{ display:grid; flex:none; }
  .topbar{ gap:10px; padding:11px 14px; }
  .topbar h1{ font-size:16px; }
  .topbar .sub{ display:none; }
  .topbar .spacer{ display:none; }
  .search{ display:none; }
  .role-switch .rs-lab{ display:none; }
  .role-switch{ padding:4px 5px; gap:3px; margin-left:auto; }
  .role-switch .rs-btn{ width:30px; height:30px; font-size:14px; }

  /* contenido */
  .content{ padding:16px 14px 48px; }

  /* los grids de 2 columnas (definidos inline) apilan a una sola */
  .content .grid[style*="grid-template-columns"]{ grid-template-columns:1fr !important; }
  .content .grid{ gap:14px; }
  .calc-grid{ grid-template-columns:1fr 1fr !important; }

  /* tablas: scroll horizontal en lugar de desbordar */
  .table-wrap{ overflow-x:auto; -webkit-overflow-scrolling:touch; }
  .table{ min-width:560px; }

  /* tipografías un toque más chicas */
  .kpi .k-val{ font-size:24px; }
}

@media(max-width:560px){
  .calc-grid{ grid-template-columns:1fr !important; }
  .content{ padding:14px 12px 44px; }
}

/* ============ MODAL DEMO / MOCKUP ============ */
/* mientras el modal está abierto, los mapas Leaflet quedan por debajo sí o sí */
body.demo-open .leaflet-pane,
body.demo-open .leaflet-top,
body.demo-open .leaflet-bottom,
body.demo-open .leaflet-control{ z-index:0 !important; }
body.demo-open .leaflet-container{ z-index:0 !important; }

.demo-ovl{
  position:fixed; inset:0; z-index:100000;
  display:none; align-items:center; justify-content:center; padding:20px;
  background:rgba(6,8,11,.72); backdrop-filter:blur(5px);
}
.demo-ovl.show{ display:flex; animation:demoFade .18s ease; }
@keyframes demoFade{ from{ opacity:0 } to{ opacity:1 } }

.demo-modal{
  width:100%; max-width:430px;
  background:var(--panel); border:1px solid var(--line);
  border-radius:20px; overflow:hidden;
  box-shadow:0 30px 90px rgba(0,0,0,.65);
  animation:demoPop .26s cubic-bezier(.2,.9,.3,1.25);
}
@keyframes demoPop{ from{ transform:translateY(16px) scale(.96); opacity:0 } to{ transform:none; opacity:1 } }

.demo-hero{
  position:relative; text-align:center;
  padding:30px 22px 24px;
  background:linear-gradient(135deg, var(--orange) 0%, #c14400 100%);
}
.demo-hero img{ height:34px; width:auto; display:inline-block; filter:drop-shadow(0 3px 8px rgba(0,0,0,.35)); }
.demo-pill{
  display:inline-flex; align-items:center; gap:7px; margin-top:14px;
  background:rgba(0,0,0,.28); color:#fff;
  font-size:11px; font-weight:800; letter-spacing:1.6px; text-transform:uppercase;
  padding:7px 15px; border-radius:30px; border:1px solid rgba(255,255,255,.25);
}
.demo-pill .d{ width:7px; height:7px; border-radius:50%; background:#fff; box-shadow:0 0 0 3px rgba(255,255,255,.25); }

.demo-body{ padding:24px 24px 26px; text-align:center; }
.demo-body h2{ font-size:21px; font-weight:800; margin-bottom:9px; color:var(--text); }
.demo-body p{ font-size:14px; line-height:1.6; color:var(--muted); margin-bottom:18px; }
.demo-body p b{ color:var(--text); }

.demo-brand{
  display:flex; align-items:center; justify-content:center; gap:9px;
  background:var(--panel-2); border:1px solid var(--line);
  border-radius:12px; padding:14px; margin-bottom:14px;
}
.demo-brand .mark{
  width:26px; height:26px; border-radius:7px; flex:none;
  display:grid; place-items:center; font-size:15px;
  background:linear-gradient(135deg,var(--orange),#c14400); color:#fff;
}
.demo-brand .wm{ font-size:16px; font-weight:800; letter-spacing:.3px; color:var(--text); }
.demo-brand .wm span{ color:var(--orange-2); }

.demo-wa{
  display:flex; align-items:center; justify-content:center; gap:11px;
  width:100%; padding:15px; border:none; border-radius:13px;
  background:linear-gradient(135deg,#25D366,#1da851);
  color:#fff; font-family:var(--font); font-size:15.5px; font-weight:800;
  cursor:pointer; text-decoration:none;
  box-shadow:0 8px 24px rgba(37,211,102,.35); transition:filter .15s, transform .12s;
}
.demo-wa:hover{ filter:brightness(1.06); transform:translateY(-1px); }
.demo-wa svg{ width:24px; height:24px; flex:none; }
.demo-wa + .demo-wa{ margin-top:10px; }
.demo-wa .wa-txt{ display:flex; flex-direction:column; line-height:1.15; text-align:left; }
.demo-wa .wa-txt b{ font-size:14.5px; font-weight:800; }
.demo-wa .wa-txt small{ font-size:12px; font-weight:600; opacity:.9; font-family:var(--mono); }

.demo-contact{ font-size:12.5px; color:var(--muted); margin:14px 0 16px; }
.demo-contact b{ color:var(--text); font-weight:700; }

.demo-close{
  width:100%; padding:13px; border-radius:12px;
  background:transparent; border:1px solid var(--line);
  color:var(--muted); font-family:var(--font); font-size:14px; font-weight:600;
  cursor:pointer; transition:.15s;
}
.demo-close:hover{ border-color:var(--orange); color:var(--text); background:var(--panel-2); }

/* ============ MICRO-INTERACCIONES (todo se siente "vivo") ============ */
/* botones de ícono y filtros */
.icon-btn{ transition:transform .12s ease, color .15s, border-color .15s, background .15s; }
.icon-btn:hover{ transform:translateY(-1px); }
.icon-btn:active{ transform:translateY(1px) scale(.95); }

.fbtn{ transition:transform .12s ease, border-color .15s, color .15s, background .15s; }
.fbtn:hover{ transform:translateY(-1px); border-color:var(--steel-2); color:var(--text); }
.fbtn:active{ transform:translateY(0) scale(.97); }

.role-switch .rs-btn:hover{ background:var(--panel); }
.role-switch .rs-btn:active{ transform:scale(.92); }

/* KPIs: se elevan al pasar (sin parecer botón) */
.kpi{ transition:transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.kpi:hover{ transform:translateY(-3px); border-color:var(--steel); box-shadow:0 10px 26px rgba(0,0,0,.28); }

/* tarjetas clickeables (reportes, eventos, etc.) */
.evt[style*="cursor:pointer"]:hover,
.truck-item:hover,
.list-row[onclick]:hover{ background:var(--panel-2); transform:translateX(2px); }
.evt[style*="cursor:pointer"]{ transition:transform .14s ease, background .14s ease, border-color .14s ease; }
.evt[style*="cursor:pointer"]:hover{ border-color:var(--orange); }

/* filas de tabla: solo las clickeables se desplazan */
.table tbody tr{ transition:background .12s ease, transform .12s ease; }
.table tbody tr[onclick]:hover{ transform:translateX(3px); }

/* selects y buscador: que se sientan interactivos */
select{ cursor:pointer; transition:border-color .15s, background .15s; }
select:hover{ border-color:var(--steel-2); }
.search{ transition:border-color .15s, background .15s; }
.search:hover{ border-color:var(--steel-2); background:var(--panel-2); }

/* feedback general al apretar cualquier control */
button:active{ transform:scale(.98); }

/* ============ ASISTENTE IA ============ */
.ia-quick{ display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:18px; }
.qa-card{
  display:flex; flex-direction:column; gap:6px; text-align:left;
  background:var(--panel); border:1px solid var(--line); border-radius:13px;
  padding:15px 16px; cursor:pointer; color:var(--text);
  transition:transform .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.qa-card:hover{ transform:translateY(-3px); border-color:var(--orange); box-shadow:0 10px 26px rgba(0,0,0,.3); }
.qa-card .qa-ico{ font-size:22px; }
.qa-card .qa-t{ font-size:13.5px; font-weight:700; }
.qa-card .qa-d{ font-size:11.5px; color:var(--muted); line-height:1.4; }

.ia-chat{ display:flex; flex-direction:column; height:calc(100vh - 270px); min-height:440px; }
.ia-head{ display:flex; align-items:center; gap:11px; padding:14px 18px; border-bottom:1px solid var(--line); }
.ia-head .bot-av{ width:38px; height:38px; border-radius:10px; display:grid; place-items:center; font-size:19px;
  background:linear-gradient(135deg,var(--orange),#c14400); box-shadow:0 4px 14px rgba(255,106,24,.35); }
.ia-head .h-t{ font-size:14.5px; font-weight:700; }
.ia-head .h-s{ font-size:11.5px; color:var(--green); display:flex; align-items:center; gap:5px; }
.ia-head .h-s .dot{ width:7px; height:7px; border-radius:50%; background:var(--green); box-shadow:0 0 0 3px rgba(61,220,132,.18); }

.ia-msgs{ flex:1; overflow-y:auto; padding:20px 18px; display:flex; flex-direction:column; gap:16px; }
.msg{ display:flex; gap:11px; max-width:88%; animation:msgIn .25s ease; }
@keyframes msgIn{ from{ opacity:0; transform:translateY(8px) } to{ opacity:1; transform:none } }
.msg .av{ width:32px; height:32px; border-radius:9px; flex:none; display:grid; place-items:center; font-size:16px; }
.msg.bot .av{ background:linear-gradient(135deg,var(--orange),#c14400); }
.msg .bubble{ background:var(--panel-2); border:1px solid var(--line); border-radius:13px; padding:13px 15px; font-size:13.5px; line-height:1.55; }
.msg.bot .bubble{ border-top-left-radius:4px; }
.msg.user{ align-self:flex-end; flex-direction:row-reverse; }
.msg.user .av{ background:var(--panel-2); }
.msg.user .bubble{ background:rgba(255,106,24,.12); border-color:rgba(255,106,24,.3); border-top-right-radius:4px; }
.msg .bubble h4{ font-size:13.5px; font-weight:800; margin-bottom:8px; color:var(--text); }
.msg .bubble .ia-row{ display:flex; justify-content:space-between; gap:14px; padding:6px 0; border-bottom:1px solid var(--line); }
.msg .bubble .ia-row:last-child{ border-bottom:none; }
.msg .bubble .ia-row b{ font-family:var(--mono); white-space:nowrap; }
.msg .bubble .ia-tot{ display:flex; justify-content:space-between; margin-top:10px; padding-top:10px; border-top:1px solid var(--line); font-weight:800; }
.msg .bubble .ia-tot b{ color:var(--orange-2); font-size:16px; font-family:var(--mono); }
.msg .bubble .pill{ margin:2px 4px 2px 0; }
.msg .bubble .note{ font-size:11.5px; color:var(--muted-2); margin-top:9px; }

.ia-typing{ display:flex; gap:4px; padding:4px 2px; }
.ia-typing span{ width:7px; height:7px; border-radius:50%; background:var(--muted); animation:iaBlink 1.2s infinite; }
.ia-typing span:nth-child(2){ animation-delay:.2s; } .ia-typing span:nth-child(3){ animation-delay:.4s; }
@keyframes iaBlink{ 0%,60%,100%{ opacity:.25; transform:translateY(0) } 30%{ opacity:1; transform:translateY(-3px) } }

.ia-chips{ display:flex; gap:8px; flex-wrap:wrap; padding:0 18px 12px; }
.ia-chip{ font-size:12px; font-weight:600; padding:7px 13px; border-radius:30px; border:1px solid var(--line);
  background:var(--panel-2); color:var(--muted); cursor:pointer; transition:.14s; }
.ia-chip:hover{ border-color:var(--orange); color:var(--text); transform:translateY(-1px); }

.ia-input{ display:flex; gap:10px; padding:14px 18px; border-top:1px solid var(--line); align-items:center; }
.ia-input input{ flex:1; background:var(--panel-2); border:1px solid var(--line); border-radius:10px;
  padding:12px 14px; color:var(--text); font-family:var(--font); font-size:14px; outline:none; transition:.15s; }
.ia-input input:focus{ border-color:var(--orange); box-shadow:0 0 0 3px rgba(255,106,24,.12); }
.ia-send{ width:44px; height:44px; flex:none; border:none; border-radius:11px; cursor:pointer; font-size:18px; color:#fff;
  background:linear-gradient(135deg,var(--orange),#d8500a); box-shadow:0 4px 14px rgba(255,106,24,.3); transition:.14s; }
.ia-send:hover{ filter:brightness(1.08); transform:translateY(-1px); }

.ia-price{ display:flex; align-items:center; gap:8px; font-size:12px; color:var(--muted); }
.ia-price input{ width:90px; background:var(--panel-2); border:1px solid var(--line); border-radius:8px;
  padding:7px 10px; color:var(--text); font-family:var(--mono); font-size:13px; outline:none; }
.ia-price input:focus{ border-color:var(--orange); }

@media(max-width:860px){
  .ia-quick{ grid-template-columns:1fr 1fr; }
  .ia-chat{ height:auto; min-height:520px; }
  .msg{ max-width:96%; }
}

/* ===== Botón ⚙️ config de IA ===== */
.ia-cfg-btn{
  flex:none; width:34px; height:34px; border-radius:9px; cursor:pointer;
  background:var(--panel-2); border:1px solid var(--line); color:var(--muted);
  font-size:15px; transition:.15s;
}
.ia-cfg-btn:hover{ color:var(--text); border-color:var(--orange); transform:translateY(-1px); }

/* ===== Modal de configuración de IA ===== */
.iacfg-ovl{
  position:fixed; inset:0; z-index:100000; display:none;
  align-items:center; justify-content:center; padding:20px;
  background:rgba(6,8,11,.72); backdrop-filter:blur(5px);
}
.iacfg-ovl.show{ display:flex; animation:demoFade .18s ease; }
.iacfg-modal{
  width:100%; max-width:480px; max-height:90vh; overflow-y:auto;
  background:var(--panel); border:1px solid var(--line); border-radius:18px;
  box-shadow:0 30px 90px rgba(0,0,0,.65); animation:demoPop .26s cubic-bezier(.2,.9,.3,1.25);
}
.iacfg-head{
  display:flex; align-items:center; gap:12px; padding:20px 22px;
  background:linear-gradient(135deg,var(--orange),#c14400);
}
.iacfg-head .ic{ font-size:24px; }
.iacfg-head h3{ font-size:17px; font-weight:800; color:#fff; }
.iacfg-head p{ font-size:12px; color:rgba(255,255,255,.85); margin-top:1px; }
.iacfg-body{ padding:20px 22px 22px; }

.iacfg-note{
  background:var(--panel-2); border:1px solid var(--line); border-left:3px solid var(--green);
  border-radius:10px; padding:13px 15px; margin-bottom:16px; font-size:12.5px; line-height:1.6; color:var(--muted);
}
.iacfg-note b{ color:var(--text); }
.iacfg-note.warn{ border-left-color:var(--amber); }

.iacfg-label{ font-size:12.5px; font-weight:700; color:var(--text); display:block; margin:14px 0 7px; }
.iacfg-field{
  width:100%; background:var(--panel-2); border:1px solid var(--line); border-radius:9px;
  padding:11px 13px; color:var(--text); font-family:var(--font); font-size:13.5px; outline:none; transition:.15s;
}
.iacfg-field:focus{ border-color:var(--orange); box-shadow:0 0 0 3px rgba(255,106,24,.12); }
.iacfg-field.mono{ font-family:var(--mono); font-size:12.5px; }

.iacfg-models{ display:grid; gap:8px; }
.iacfg-model{
  display:flex; align-items:center; gap:11px; cursor:pointer;
  background:var(--panel-2); border:1px solid var(--line); border-radius:10px; padding:11px 13px; transition:.14s;
}
.iacfg-model:hover{ border-color:var(--steel-2); }
.iacfg-model.active{ border-color:var(--orange); background:rgba(255,106,24,.07); }
.iacfg-model .rb{ width:16px; height:16px; border-radius:50%; border:2px solid var(--muted-2); flex:none; position:relative; }
.iacfg-model.active .rb{ border-color:var(--orange); }
.iacfg-model.active .rb::after{ content:""; position:absolute; inset:3px; border-radius:50%; background:var(--orange); }
.iacfg-model .mt{ font-size:13px; font-weight:700; }
.iacfg-model .md{ font-size:11px; color:var(--muted); }
.iacfg-model .mc{ margin-left:auto; text-align:right; font-size:11px; color:var(--orange-2); font-weight:700; white-space:nowrap; }

.iacfg-actions{ display:flex; gap:10px; margin-top:20px; }
.iacfg-actions .btn{ flex:1; justify-content:center; }

/* pestañas de proveedor de IA */
.iacfg-tabs{ display:grid; grid-template-columns:repeat(3,1fr); gap:8px; margin-bottom:4px; }
.iacfg-tab{
  display:flex; flex-direction:column; align-items:center; gap:5px; cursor:pointer;
  background:var(--panel-2); border:1px solid var(--line); border-radius:11px; padding:12px 8px; transition:.14s;
}
.iacfg-tab:hover{ border-color:var(--steel-2); transform:translateY(-1px); }
.iacfg-tab.active{ border-color:var(--orange); background:rgba(255,106,24,.08); }
.iacfg-tab .pi{ font-size:22px; }
.iacfg-tab .pn{ font-size:11.5px; font-weight:700; color:var(--text); text-align:center; line-height:1.2; }

/* ============================================================
   MODO DÍA (tema claro) — se activa con [data-theme="light"]
   ============================================================ */
:root[data-theme="light"]{
  --bg:        #eef1f5;
  --bg-2:      #ffffff;
  --panel:     #ffffff;
  --panel-2:   #f3f5f9;
  --steel:     #d7dde6;
  --steel-2:   #c2cad6;
  --line:      #e3e8ef;
  --text:      #1b2433;
  --muted:     #5d6776;
  --muted-2:   #8b95a4;
  --shadow:    0 10px 30px rgba(20,30,50,.12);
  --shadow-sm: 0 4px 14px rgba(20,30,50,.10);
}
/* sidebar y detalles que tenían colores oscuros fijos */
[data-theme="light"] .sidebar{ background:linear-gradient(180deg,#ffffff,#f4f6f9); }
[data-theme="light"] .nav a.active{ background:var(--panel-2); color:#111827; }
[data-theme="light"] .topbar{ background:#ffffff; }
[data-theme="light"] .icon-btn .dot{ border-color:#fff; }
[data-theme="light"] ::selection{ background:var(--orange); color:#fff; }
/* sombras más suaves en claro */
[data-theme="light"] .kpi:hover,
[data-theme="light"] .qa-card:hover{ box-shadow:0 10px 26px rgba(20,30,50,.12); }
/* scrollbar claro */
[data-theme="light"] ::-webkit-scrollbar-thumb{ background:#c2cad6; }
[data-theme="light"] ::-webkit-scrollbar-track{ background:#eef1f5; }

/* ===== Botones con texto en la topbar (Ver manual / Modo día) ===== */
.tb-btn{
  display:flex; align-items:center; gap:7px; flex:none; height:38px; padding:0 13px;
  border-radius:8px; border:1px solid var(--line); background:var(--panel); color:var(--muted);
  cursor:pointer; font-family:var(--font); font-size:13px; font-weight:600; transition:.15s;
}
.tb-btn:hover{ color:var(--text); border-color:var(--orange); transform:translateY(-1px); }
.tb-btn .lbl{ white-space:nowrap; }
@media(max-width:980px){ .tb-btn .lbl{ display:none; } .tb-btn{ padding:0; width:38px; justify-content:center; } }

/* toggle de tema en el login */
.login-theme{ position:absolute; top:18px; right:22px; z-index:3; }

/* grupo "Ver manual / Modo día" + leyenda, junto al título */
.tb-tools{ display:flex; flex-direction:column; gap:6px; margin-left:22px; }
.tb-tools-row{ display:flex; gap:10px; }
.tb-tools-cap{ font-size:11px; font-weight:800; letter-spacing:.4px; color:var(--green); }
@media(max-width:980px){ .tb-tools{ margin-left:10px; } .tb-tools-cap{ display:none; } }

/* ============================================================
   MANUAL / GUÍA tipo libro (pasa páginas con efecto)
   ============================================================ */
.man-ovl{
  position:fixed; inset:0; z-index:100002; display:none;
  flex-direction:column; align-items:center; justify-content:center; gap:16px; padding:18px;
  background:rgba(6,8,11,.85); backdrop-filter:blur(8px);
}
.man-ovl.show{ display:flex; animation:demoFade .2s ease; }
.man-x{
  position:absolute; top:18px; right:20px; width:40px; height:40px; border-radius:10px;
  border:1px solid rgba(255,255,255,.2); background:rgba(0,0,0,.35); color:#fff;
  font-size:18px; cursor:pointer; transition:.15s; z-index:2;
}
.man-x:hover{ background:var(--orange); border-color:var(--orange); }

.book{ width:min(600px,94vw); height:min(468px,74vh); perspective:1900px; }
.bk-page{
  width:100%; height:100%; position:relative; transform-origin:left center;
  transition:transform .36s ease; transform-style:preserve-3d;
  backface-visibility:hidden; -webkit-backface-visibility:hidden;
}
.bk-card{
  position:absolute; inset:0; overflow:hidden; display:flex; flex-direction:column;
  background:linear-gradient(150deg,var(--panel),var(--panel-2));
  border:1px solid var(--line); border-left:5px solid var(--orange);
  border-radius:6px 16px 16px 6px; box-shadow:0 30px 70px rgba(0,0,0,.55);
}
.bk-inner{ flex:1; overflow-y:auto; padding:30px 34px; }
.bk-ico{ font-size:46px; line-height:1; }
.bk-tag{ color:var(--orange-2); font-weight:800; font-size:11.5px; text-transform:uppercase; letter-spacing:1.5px; margin-top:14px; }
.bk-h{ font-size:25px; font-weight:800; margin:5px 0 2px; line-height:1.15; }
.bk-sub{ font-size:14px; color:var(--muted); line-height:1.55; }
.bk-list{ margin-top:18px; display:grid; gap:12px; }
.bk-li{ display:flex; gap:11px; align-items:flex-start; font-size:14px; color:var(--text); line-height:1.45; }
.bk-li .ck{ color:var(--green); font-weight:900; flex:none; }
.bk-ben{ margin-top:20px; background:rgba(255,106,24,.08); border:1px solid rgba(255,106,24,.28); border-radius:11px; padding:13px 15px; font-size:13.5px; line-height:1.5; }
.bk-ben b{ color:var(--orange-2); }

/* portada y cierre */
.bk-cover{ height:100%; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; gap:6px; }
.bk-cover .bk-ico{ font-size:64px; }
.bk-cover .hint{ margin-top:18px; font-size:12.5px; color:var(--muted-2); }
.bk-final{ height:100%; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; gap:8px; }
.bk-final .bk-wa{ display:inline-flex; align-items:center; gap:9px; margin-top:18px; padding:13px 22px; border-radius:12px;
  background:linear-gradient(135deg,#25D366,#1da851); color:#fff; font-weight:800; font-size:14.5px; text-decoration:none;
  box-shadow:0 8px 22px rgba(37,211,102,.35); }
.bk-final .bk-wa svg{ width:22px; height:22px; }
.bk-final .bk-start{ margin-top:10px; background:none; border:none; color:var(--muted); font-size:13px; cursor:pointer; text-decoration:underline; }

/* navegación */
.man-nav{ display:flex; align-items:center; gap:18px; }
.man-arrow{ width:48px; height:48px; border-radius:50%; border:1px solid rgba(255,255,255,.22);
  background:rgba(255,255,255,.08); color:#fff; font-size:20px; cursor:pointer; transition:.15s; }
.man-arrow:hover:not(:disabled){ background:var(--orange); border-color:var(--orange); transform:scale(1.06); }
.man-arrow:disabled{ opacity:.28; cursor:default; }
.man-dots{ display:flex; gap:7px; align-items:center; }
.man-dot{ width:8px; height:8px; border-radius:50%; background:rgba(255,255,255,.3); transition:.2s; cursor:pointer; }
.man-dot.on{ background:var(--orange); width:24px; border-radius:5px; }
