:root {
  --red: #ff0000;
  --red-dark: #d40000;
  --pink: #fdecec;
  --pink-2: #fbdada;
  --ink: #1d1d1f;
  --muted: #6b6b70;
  --line: #e4e4e7;
  --bg: #f6f6f7;
  --card: #ffffff;
  --green: #16833a;
  --green-bg: #e8f5ec;
  --amber-bg: #fff6e0;
  --amber: #8a5a00;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}
h1, h3, h4 { margin: 0; }
button, input, select { font: inherit; }

/* header */
.top {
  background: var(--card); border-bottom: 1px solid var(--line);
  padding: 16px clamp(16px, 4vw, 40px);
  display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between;
}
.brand { display: flex; gap: 16px; align-items: center; }
.logo {
  font-family: Anton, Impact, sans-serif; font-style: italic; color: var(--red);
  font-size: 40px; letter-spacing: 1px; line-height: 1; transform: skewX(-8deg);
}
.brand h1 { font-family: Anton, Impact, sans-serif; font-weight: 400; font-size: 24px; letter-spacing: .5px; text-transform: uppercase; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.badge { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 99px; background: var(--amber-bg); color: var(--amber); font-weight: 600; font-size: 12px; }
.source { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.source-info { font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #bbb; flex: none; }
.dot.ok { background: #22a352; } .dot.user { background: var(--red); } .dot.err { background: #e09b00; }
.source-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.field { font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
select, input[type=text] { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: #fff; color: var(--ink); }
.btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 8px;
  padding: 7px 12px; cursor: pointer; font-weight: 600; font-size: 13px; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: #c9c9ce; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-dark); }
.btn.ghost { background: transparent; }

/* alerts */
.alerts { padding: 0 clamp(16px, 4vw, 40px); }
.alert { margin-top: 12px; padding: 10px 14px; border-radius: 8px; font-size: 13px; background: var(--amber-bg); color: var(--amber); border: 1px solid #f3dfae; }
.alert.err { background: #fde8e8; color: #9b1111; border-color: #f5c2c2; }
.alert.ok { background: var(--green-bg); color: var(--green); border-color: #c6e6d0; }
.alert ul { margin: 4px 0 0; padding-left: 18px; }

/* tabs */
.tabs { display: flex; gap: 4px; padding: 16px clamp(16px, 4vw, 40px) 0; overflow-x: auto; }
.tabs button {
  border: 0; background: transparent; padding: 10px 14px; border-radius: 8px 8px 0 0; cursor: pointer;
  color: var(--muted); font-weight: 600; white-space: nowrap; border-bottom: 3px solid transparent;
}
.tabs button b { color: var(--red); margin-right: 4px; }
.tabs button.active { color: var(--ink); border-bottom-color: var(--red); background: var(--card); }
main { padding: 16px clamp(16px, 4vw, 40px) 32px; max-width: 1280px; }
.tab { display: none; } .tab.active { display: block; }

/* cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.card .lbl { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; font-weight: 600; }
.card .val { font-size: 26px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.delta { font-size: 13px; font-weight: 600; }
.delta.up { color: var(--green); } .delta.down { color: var(--red); } .delta.flat { color: var(--muted); }

/* window chrome (mockup look) */
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 16px; margin-bottom: 16px; }
.win { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(0,0,0,.04); overflow: hidden; min-width: 0; }
.win-bar { background: #efefef; padding: 10px 14px; display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--line); }
.win-bar i { width: 10px; height: 10px; border-radius: 50%; background: #c8c8c8; }
.win-bar span { margin-left: 8px; font-weight: 600; color: #555; font-size: 14px; }
.win-body { padding: 16px; }
.win-body h3 { font-size: 16px; margin-bottom: 10px; }
.win-body h4 { font-size: 14px; margin: 16px 0 8px; }
.note { color: var(--muted); font-size: 12px; margin: 10px 0 0; }

/* tables */
.table-wrap { overflow-x: auto; }
.t { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.t th { background: var(--red); color: #fff; font-weight: 600; padding: 8px 10px; text-align: left; font-size: 13px; white-space: nowrap; }
.t td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.t td.n, .t th.n { text-align: right; }
.t tr.total td { background: var(--pink); font-weight: 700; }
.t.small td { font-size: 13px; }
.bad { color: var(--red); font-weight: 600; }
.good { color: var(--green); font-weight: 600; }

/* bars */
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 96px 1fr 52px; gap: 10px; align-items: center; font-size: 13px; }
.bar-track { background: #f1f1f2; border-radius: 6px; height: 18px; position: relative; }
.bar-fill { background: var(--red); height: 100%; border-radius: 6px; }
.bar-fill.ok { background: #444; }
.bar-goal { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--green); }
.bar-legend { font-size: 12px; color: var(--muted); }
.meter { margin-bottom: 12px; }
.meter .bar-track { height: 12px; }

/* briefing */
.mail { max-width: 820px; }
.mail-head { color: var(--muted); font-size: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.mail-head b { color: var(--ink); }
.mail-to { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.mail-to input { flex: 1 1 220px; min-width: 0; }
.ai-foot a { color: var(--red, #ff0000); font-weight: 600; }
.briefing { outline: none; font-size: 16px; padding: 4px 2px; border-radius: 6px; }
.briefing:focus { box-shadow: 0 0 0 2px var(--pink-2); }
.briefing h3 { color: var(--red); font-size: 20px; margin: 16px 0 6px; }
.briefing p { margin: 6px 0; }
.briefing ul { margin: 6px 0; padding-left: 22px; }
.briefing li { margin: 4px 0; }
.ai-foot { margin-top: 16px; background: var(--green-bg); color: var(--green); padding: 10px 14px; border-radius: 8px; font-weight: 600; font-size: 13px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; align-items: center; }
.row-actions input { flex: 1 1 220px; }

/* chat */
.chat { max-width: 820px; display: flex; flex-direction: column; }
.chat-body { min-height: 380px; max-height: 60vh; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; background: #fafafa; }
.msg { max-width: 78%; padding: 10px 14px; border-radius: 12px; white-space: pre-line; }
.msg.user { align-self: flex-end; background: var(--pink); }
.msg.bot { align-self: flex-start; background: #fff; border: 1px solid var(--line); }
.msg.pending { color: var(--muted); font-style: italic; }
.msg .src { display: block; margin-top: 6px; color: var(--muted); font-style: italic; font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 16px 0; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 5px 10px; font-size: 12px; cursor: pointer; }
.chip:hover { border-color: var(--red); color: var(--red); }
.chat-input { display: flex; gap: 8px; padding: 12px 16px 16px; }
.chat-input input { flex: 1; border: 1px solid var(--line); border-radius: 99px; padding: 10px 16px; }
.chat-input button { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--red); color: #fff; cursor: pointer; font-size: 16px; display: grid; place-items: center; }

.foot { color: var(--muted); font-size: 12px; padding: 0 clamp(16px, 4vw, 40px) 24px; }

/* cuentas */
.user-box { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.user-box #userEmail { color: var(--ink); font-weight: 600; }
.role { padding: 1px 8px; border-radius: 99px; background: #f1f1f2; font-size: 12px; font-weight: 600; }
.role.admin { background: var(--pink); color: var(--red-dark); }
.sub-toggle { display: flex; gap: 4px; align-items: center; cursor: pointer; white-space: nowrap; }
.sub-toggle input { accent-color: var(--red); }
.gate { padding: 48px 16px; display: grid; place-items: start center; }
.gate-card { width: min(100%, 420px); }
.gate-field { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; font-size: 13px; font-weight: 600; color: var(--muted); }
.gate-field input { border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; font-weight: 400; color: var(--ink); }
.gate-msg { min-height: 20px; margin: 12px 0 0; font-size: 13px; }
.gate-msg.err { color: #9b1111; } .gate-msg.ok { color: var(--green); }
body.locked .source-info, body.locked .source-actions, body.locked .tabs, body.locked main { display: none; }
[hidden] { display: none !important; }

body.dragging::after {
  content: "Suelta tu Excel para cargarlo"; position: fixed; inset: 0; display: grid; place-items: center;
  background: rgba(255,0,0,.08); border: 3px dashed var(--red); color: var(--red); font-weight: 700; font-size: 22px; z-index: 10;
}

@media (max-width: 720px) {
  .source { align-items: stretch; width: 100%; }
  .source-actions { justify-content: flex-start; }
  .logo { font-size: 32px; }
  .brand h1 { font-size: 20px; }
  .msg { max-width: 92%; }
  .bar-row { grid-template-columns: 80px 1fr 46px; }
}

/* ---------- modo celular (botón «Modo celular» o pantallas pequeñas; clase .mobile en <html>) ---------- */
.tabs button i, .tabs button .ts { display: none; font-style: normal; }
.mode-btn { order: 3; }
html.mobile body { max-width: 520px; margin: 0 auto; font-size: 16px; padding-bottom: calc(72px + env(safe-area-inset-bottom)); box-shadow: 0 0 0 1px var(--line); min-height: 100vh; }
html.mobile .top { padding: 12px 16px; gap: 10px; }
html.mobile .top { flex-wrap: wrap; }
html.mobile .brand { gap: 10px; flex: 1 1 0; min-width: 0; }
html.mobile .sub { font-size: 0; }  /* en celular solo se deja la etiqueta MVP */
html.mobile .sub .badge { font-size: 11px; margin: 2px 0 0; }
html.mobile .logo { font-size: 28px; }
html.mobile .brand h1 { font-size: 17px; }
html.mobile .mode-btn { order: 1; flex: none; min-height: 36px; padding: 4px 10px; font-size: 12px; }
html.mobile .source { order: 2; }
html.mobile #logoutBtn { min-height: 32px; padding: 4px 10px; margin-left: auto; }
html.mobile .source { width: 100%; align-items: stretch; }
html.mobile .user-box { flex-wrap: wrap; row-gap: 6px; }
html.mobile .user-box #userEmail { flex: 1 1 100%; overflow: hidden; text-overflow: ellipsis; }
html.mobile .source-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
html.mobile .source-actions .field { flex-direction: column; align-items: stretch; gap: 2px; }
html.mobile .source-actions .btn { text-align: center; }
html.mobile .source-actions a.btn, html.mobile #reloadBtn { display: none; }  /* opciones de escritorio */
html.mobile select, html.mobile input[type=text], html.mobile input[type=email], html.mobile input[type=password] { font-size: 16px; min-height: 44px; }  /* 16 px evita el zoom automático en iPhone */
html.mobile .btn { min-height: 44px; padding: 10px 14px; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; }
html.mobile .alerts { padding: 0 16px; }

/* pestañas como barra inferior de app */
html.mobile .tabs {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 520px; z-index: 20;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); gap: 0; background: var(--card);
  border-top: 1px solid var(--line); box-shadow: 0 -2px 10px rgba(0,0,0,.06); overflow: visible;
}
html.mobile .tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 10px; border-bottom: 0; font-size: 12px; }
html.mobile .tabs button b, html.mobile .tabs button .tl { display: none; }
html.mobile .tabs button i { display: block; line-height: 0; }
html.mobile .tabs button .ts { display: block; }
html.mobile .tabs button.active { background: var(--pink); color: var(--red-dark); }
html.mobile body.locked .tabs, html.mobile body.locked .source-actions { display: none; }

html.mobile main { padding: 12px 12px 16px; }
html.mobile .cards { grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
html.mobile .card { padding: 10px 12px; }
html.mobile .card .lbl { font-size: 11px; }
html.mobile .card .val { font-size: 21px; }
html.mobile .grid2 { grid-template-columns: 1fr; gap: 12px; margin-bottom: 12px; }
html.mobile .win-bar { padding: 8px 12px; }
html.mobile .win-bar i { display: none; }
html.mobile .win-bar span { margin-left: 0; font-size: 13px; }
html.mobile .win-body { padding: 12px; }
html.mobile .table-wrap { margin: 0 -12px; padding: 0 12px; -webkit-overflow-scrolling: touch; }
html.mobile .t th, html.mobile .t td { padding: 7px 8px; font-size: 13px; }
html.mobile .bar-row { grid-template-columns: 78px 1fr 46px; gap: 8px; }

/* briefing */
html.mobile .mail-to input { flex-basis: 100%; }
html.mobile .mail-to .btn { flex: 1 1 100%; }
html.mobile .briefing { font-size: 15px; }
html.mobile .briefing h3 { font-size: 18px; }
html.mobile .row-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
html.mobile .row-actions input, html.mobile .row-actions .field { grid-column: 1 / -1; }
html.mobile .row-actions .btn { white-space: normal; line-height: 1.2; }

/* asistente: ocupa la pantalla y deja la caja de texto a mano */
html.mobile .chat { border-radius: 0; margin: -12px -12px 0; border-left: 0; border-right: 0; }
html.mobile .chat { overflow: visible; }
html.mobile .chat-body { min-height: 0; height: 52vh; height: 52dvh; max-height: none; padding: 12px; }
html.mobile .msg { max-width: 90%; }
html.mobile .chips { flex-wrap: nowrap; overflow-x: auto; padding: 8px 12px 0; scrollbar-width: none; }
html.mobile .chip { flex: none; padding: 8px 12px; font-size: 13px; }
html.mobile .chat-input { padding: 10px 12px 12px; position: sticky; bottom: calc(66px + env(safe-area-inset-bottom)); background: var(--card); z-index: 5; }
html.mobile .source-info { font-size: 12px; }
html.mobile .chat-input input { font-size: 16px; }
html.mobile .chat-input button { width: 44px; height: 44px; flex: none; }

html.mobile .gate { padding: 24px 12px; }
html.mobile .foot { padding: 0 16px 16px; }

/* agente de datos */
.agent-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr)); align-items: start; }
.agent-grid .chat { max-width: none; }
.agent-grid .chat-body { min-height: 420px; }
.draft-head { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 10px; }
.draft-head input { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: #fff; color: var(--ink); }
.draft-head input[type=number] { width: 90px; }
.t.draft td { padding: 4px; }
.t.draft input { width: 100%; min-width: 84px; border: 1px solid var(--line); border-radius: 6px; padding: 5px 6px; background: #fff; color: var(--ink); font-variant-numeric: tabular-nums; }
.t.draft input.n { text-align: right; }
.t.draft .del { padding: 2px 8px; color: var(--muted); }
#draftAddWeek { margin-bottom: 4px; }
.draft-checks { margin-top: 10px; font-size: 13px; }
.draft-checks ul { margin: 0; padding-left: 18px; }
.draft-checks li { margin: 3px 0; }
.draft-checks .miss { color: var(--muted); }
.draft-checks .warn { color: var(--amber); }
.draft-checks p { margin: 6px 0 0; }
html.mobile .tabs button { font-size: 11px; }
html.mobile .agent-grid .chat { margin: -12px -12px 0; }
html.mobile .agent-grid .chat-body { height: 46vh; height: 46dvh; min-height: 0; }
html.mobile .draft-head .field { flex: 1 1 40%; }
html.mobile .draft-head input { width: 100%; font-size: 16px; min-height: 44px; }
html.mobile .t.draft input { font-size: 16px; }

/* solicitudes de carga de datos */
#reqWin { margin-top: 16px; }
.req { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.req.pendiente { border-left: 4px solid #e09b00; }
.req.aprobada { border-left: 4px solid var(--green); }
.req.rechazada { border-left: 4px solid var(--red); }
.req-head { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.req-head b { color: var(--ink); }
.req-state { margin-left: auto; padding: 1px 8px; border-radius: 99px; background: #f1f1f2; font-weight: 600; font-size: 12px; }
.req.pendiente .req-state { background: var(--amber-bg); color: var(--amber); }
.req.aprobada .req-state { background: var(--green-bg); color: var(--green); }
.req.rechazada .req-state { background: #fde8e8; color: #9b1111; }
.req-note { font-size: 13px; margin-top: 4px; }
.req .table-wrap { margin-top: 8px; }
.tabs button .count { display: inline-block; min-width: 18px; margin-left: 4px; padding: 0 5px; border-radius: 99px; background: var(--red); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
html.mobile .tabs button { position: relative; }
html.mobile .tabs button .count { position: absolute; top: 2px; right: 50%; margin-right: -22px; }

/* menú de inicio */
.start-menu { padding: 32px 24px 48px; max-width: 1100px; margin: 0 auto; }
.start-menu[hidden] { display: none; }
.start-menu h2 { margin: 0; font-size: 24px; }
.start-menu > .note { margin: 6px 0 20px; font-size: 14px; }
.start-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.start-card { display: flex; flex-direction: column; padding: 20px; }
.start-card h3 { margin: 12px 0 8px; font-size: 17px; line-height: 1.3; }
.start-card p { margin: 0 0 16px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.start-ico { color: var(--red); line-height: 0; }
.start-actions { margin-top: auto; display: flex; flex-wrap: wrap; gap: 8px; }
.start-actions .btn { flex: 1 1 auto; text-align: center; }
body.inicio .source-info, body.inicio .source-actions, body.inicio .tabs, body.inicio main { display: none; }
body.inicio .alerts > :not(.err) { display: none; }
html.mobile body.inicio .source-actions, html.mobile body.inicio .tabs { display: none; }
html.mobile .start-menu { padding: 20px 16px 32px; }
html.mobile .start-menu h2 { font-size: 21px; }
html.mobile .start-grid { grid-template-columns: 1fr; gap: 12px; }
html.mobile .start-card { padding: 16px; }
@media (max-width: 860px) { .start-grid { grid-template-columns: 1fr; } }

/* agente de datos: una tabla por semana */
.week-card { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-bottom: 12px; }
.week-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.week-head h4 { margin: 0; font-size: 15px; }
.week-card .add-row { margin-top: 8px; }
.chat-input textarea { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 16px; padding: 10px 16px; font: inherit; line-height: 1.4; resize: vertical; max-height: 240px; }
html.mobile .chat-input textarea { font-size: 16px; resize: none; }
html.mobile .week-card { padding: 10px; }

/* verificación contra bots en el acceso */
.captcha { margin-top: 12px; min-height: 65px; }
.captcha-modal { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .45); display: grid; place-items: center; padding: 16px; }
.captcha-modal[hidden] { display: none; }
.captcha-card { width: min(100%, 420px); }
.captcha-card p { margin: 0 0 8px; font-size: 14px; }

/* ---------- tutorial guiado ---------- */
.link-btn { background: none; border: 0; padding: 0; margin-left: 4px; color: var(--red); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; }
.tour { position: fixed; inset: 0; z-index: 60; }
.tour[hidden] { display: none; }
.tour-luz { position: fixed; border-radius: 12px; box-shadow: 0 0 0 3px var(--red), 0 0 0 9999px rgba(0, 0, 0, .55); transition: left .25s, top .25s, width .25s, height .25s; pointer-events: none; }
.tour-luz.vacio { left: 50% !important; top: 50% !important; width: 0 !important; height: 0 !important; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .55); }
.tour-card { position: fixed; width: min(380px, calc(100vw - 32px)); box-shadow: 0 12px 32px rgba(0, 0, 0, .25); }
.tour-card.centro { left: 50% !important; top: 50% !important; transform: translate(-50%, -50%); }
.tour-card h3 { margin: 2px 0 6px; font-size: 18px; }
.tour-card p { margin: 0; font-size: 14px; line-height: 1.5; }
.tour-paso { color: var(--red) !important; font-size: 12px !important; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.tour-puntos { display: flex; gap: 6px; margin: 14px 0 12px; }
.tour-puntos i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.tour-puntos i.on { background: var(--red); width: 18px; border-radius: 4px; }
.tour-acciones { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.tour-nav { display: flex; gap: 8px; margin-left: auto; }
.tour-acciones .btn[disabled] { opacity: .4; cursor: default; }
.tour-acciones .btn[hidden] { display: none; }
html.mobile .tour-card:not(.centro) { left: 16px !important; right: 16px; top: auto !important; bottom: 16px; width: auto; }
html.mobile .tour-card.arriba:not(.centro) { top: 16px !important; bottom: auto; }
@media (max-width: 599px) { .tour-card:not(.centro) { left: 16px !important; right: 16px; top: auto !important; bottom: 16px; width: auto; } .tour-card.arriba:not(.centro) { top: 16px !important; bottom: auto; } }
@media (prefers-reduced-motion: reduce) { .tour-luz { transition: none; } }

/* ---------- video tutorial ---------- */
.video-modal { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, .6); display: grid; place-items: center; padding: 16px; }
.video-card { width: min(960px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 16px 40px rgba(0, 0, 0, .35); }
.video-card .win-bar { position: relative; }
.video-cerrar { margin-left: auto; background: none; border: 0; font-size: 22px; line-height: 1; cursor: pointer; color: #555; padding: 0 4px; }
.video-cerrar:hover { color: var(--red); }
.video-oferta { margin: 0 0 12px; font-size: 15px; }
.video-marco { position: relative; background: #000; border-radius: 8px; overflow: hidden; aspect-ratio: 16 / 9; }
.video-marco video { width: 100%; height: 100%; display: block; }
.video-play { position: absolute; inset: 0; margin: auto; width: 76px; height: 76px; border-radius: 50%; border: 0; background: var(--red); color: #fff; cursor: pointer; display: grid; place-items: center; box-shadow: 0 6px 18px rgba(0, 0, 0, .35); }
.video-play:hover { background: var(--red-dark); }
.video-card .row-actions { margin-top: 12px; }
html.mobile .video-play { width: 60px; height: 60px; }

/* ---------- escuchar respuestas (voz de Gemini) ---------- */
.voz-btn { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 99px; background: #fff; color: var(--ink); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.voz-btn:hover { border-color: var(--red); color: var(--red); }
.voz-btn[data-estado="sonando"] { background: var(--pink); border-color: var(--red); color: var(--red-dark); }
.msg .voz-btn { display: flex; width: fit-content; }

/* ---------- dictado por voz ---------- */
.chat-input .mic-btn { background: #fff; color: var(--red); border: 2px solid var(--red); font-size: 18px; flex: 0 0 auto; }
.chat-input .mic-btn:hover { background: var(--pink); }
.mic-btn[data-estado="grabando"], #briefMic[data-estado="grabando"] { background: var(--red) !important; color: #fff !important; border-color: var(--red); animation: grabando 1.2s ease-in-out infinite; }
.mic-btn[data-estado="procesando"] { opacity: .6; cursor: progress; }
.mic-btn[hidden] { display: none !important; }
@keyframes grabando { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 0, 0, .45); } 50% { box-shadow: 0 0 0 8px rgba(255, 0, 0, 0); } }
@media (prefers-reduced-motion: reduce) { .mic-btn[data-estado="grabando"], #briefMic[data-estado="grabando"] { animation: none; } }

/* ---------- alertas automáticas ---------- */
.alertas-ia { padding: 14px 18px; margin-bottom: 14px; border-left: 6px solid var(--red); }
.alertas-cab { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.alertas-cab .note { margin: 0; flex: 1 1 320px; }
.alertas-cab .voz-btn { margin-top: 0; }
.alertas-lista { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.alerta-ia { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 10px; background: #fafafa; font-size: 14px; }
.alerta-ia.alta { background: #fdecec; } .alerta-ia.media { background: #fff4e5; } .alerta-ia.baja { background: #fffbe6; }
.alerta-ia > div { flex: 1; }
.alerta-ia span { color: var(--muted); }
.alerta-ico { font-size: 16px; line-height: 1.4; }
.alertas-ok { margin: 8px 0 0; color: var(--green); font-weight: 600; font-size: 14px; }
.alert-btn .count { display: inline-block; min-width: 18px; margin-left: 4px; padding: 0 6px; border-radius: 99px; background: var(--red); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.alert-btn .count.ok { background: var(--green); }
.toast-alerta { position: fixed; right: 20px; bottom: 20px; z-index: 40; width: min(380px, calc(100vw - 32px)); padding: 16px 18px; border-left: 6px solid var(--red); box-shadow: 0 12px 30px rgba(0,0,0,.2); }
.toast-alerta[hidden] { display: none; }
.toast-alerta p { margin: 6px 0 10px; font-size: 14px; color: var(--muted); }
html.mobile .toast-alerta { bottom: 84px; right: 16px; }

/* ---------- impacto del piloto ---------- */
.imp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.imp-card .val { font-size: 30px; }
.imp-meta { font-size: 13px; margin: 6px 0 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.imp-chip { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; }
.imp-chip.ok { background: var(--green-bg); color: var(--green); }
.imp-chip.prog { background: #fff4e5; color: #b26a00; }
.imp-chip.nada { background: #f0f0f2; color: var(--muted); }
.imp-chip.info { background: var(--pink); color: var(--red-dark); }
.imp-card .note { margin-top: 2px; }
.imp-barras { display: flex; align-items: flex-end; gap: 8px; height: 180px; padding-top: 8px; }
.imp-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.imp-pila { width: 100%; max-width: 46px; min-height: 2px; display: flex; flex-direction: column; border-radius: 6px 6px 0 0; overflow: hidden; background: #f0f0f2; }
.imp-p { background: var(--red); } .imp-b { background: #1d1d1f; }
.imp-ley { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; }
.imp-sup { display: grid; gap: 10px; }
.imp-sup label { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 14px; }
.imp-sup input { width: 90px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font: inherit; }
