/* intervIA — sistema de diseño (tonos azules) */
:root {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --bg: #f3f6fc;
  --surface: #ffffff;
  --surface-2: #f7f9fe;
  --surface-3: #eef3fc;
  --line: #e2e8f4;
  --line-2: #cfd9ec;
  --ink: #0c1830;
  --ink-2: #33425f;
  --muted: #6a7a98;

  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-200: #bfdbfe;
  --blue-300: #93c5fd;
  --blue-400: #60a5fa;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-800: #1e3a8a;
  --sky: #0ea5e9;
  --cyan: #22d3ee;
  --navy-900: #060d1f;
  --navy-800: #0a1630;
  --navy-700: #0f2045;

  --primary: var(--blue-600);
  --primary-hover: var(--blue-700);
  --primary-soft: var(--blue-50);
  --primary-ring: rgba(37, 99, 235, .25);
  --grad: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
  --grad-deep: linear-gradient(160deg, #0a1630 0%, #0f2a5f 55%, #0b3b7a 100%);

  --ok: #059669; --ok-soft: #ecfdf5;
  --warn: #b45309; --warn-soft: #fffbeb;
  --err: #dc2626; --err-soft: #fef2f2;
  --live: #ef4444;

  --r-sm: 8px; --r: 12px; --r-lg: 16px; --r-xl: 22px;
  --shadow-sm: 0 1px 2px rgba(12, 24, 48, .06);
  --shadow: 0 1px 2px rgba(12, 24, 48, .05), 0 10px 30px -14px rgba(37, 99, 235, .25);
  --shadow-lg: 0 24px 60px -20px rgba(10, 22, 48, .45);
  --sidebar-w: 248px;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #050b19;
  --surface: #0b1530;
  --surface-2: #0e1a3a;
  --surface-3: #13224a;
  --line: #1a2a52;
  --line-2: #24386a;
  --ink: #e7eefc;
  --ink-2: #b4c3e3;
  --muted: #7f90b5;
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-soft: rgba(59, 130, 246, .12);
  --ok-soft: rgba(5, 150, 105, .14);
  --warn-soft: rgba(180, 83, 9, .16);
  --err-soft: rgba(220, 38, 38, .14);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -14px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14.5px/1.55 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--blue-200); color: var(--navy-800); }
[hidden] { display: none !important; }
/* Tamaño por defecto de los iconos en línea (cualquier regla con clase lo sobrescribe). */
:where(svg) { width: 1.15em; height: 1.15em; vertical-align: -.2em; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ------------------------------------------------------------ Marca */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; letter-spacing: -.02em; color: inherit; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--grad); display: grid; place-items: center; box-shadow: 0 6px 16px -6px rgba(14, 165, 233, .7); }
.brand-mark svg { width: 18px; height: 18px; }
.brand b { background: linear-gradient(135deg, #60a5fa, #22d3ee); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand.on-light b { background: var(--grad); -webkit-background-clip: text; background-clip: text; }

/* ------------------------------------------------------------ Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s, transform .05s; text-decoration: none !important; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 16px -8px rgba(37, 99, 235, .8); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-grad { background: var(--grad); color: #fff; box-shadow: 0 8px 20px -10px rgba(14, 165, 233, .9); }
.btn-grad:hover { filter: brightness(1.06); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-outline { background: var(--surface); border-color: var(--line-2); color: var(--ink); }
.btn-outline:hover { border-color: var(--blue-300); background: var(--surface-2); }
.btn-dark { background: var(--navy-800); color: #fff; }
.btn-dark:hover { background: var(--navy-700); }
[data-theme="dark"] .btn-dark { background: var(--blue-600); }
.btn-danger { background: var(--err); color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--err); }
.btn-danger-ghost:hover { background: var(--err-soft); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn-icon { width: 36px; padding: 0; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ------------------------------------------------------------ Formularios */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .hint, .hint { font-size: 12.5px; color: var(--muted); }
.input, .select, .textarea { width: 100%; border: 1px solid var(--line-2); background: var(--surface); border-radius: 10px; padding: 9px 12px; outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236a7a98' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 34px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.seg { display: inline-flex; padding: 3px; background: var(--surface-3); border-radius: 11px; gap: 2px; width: 100%; }
.seg button { flex: 1; border: 0; background: transparent; padding: 7px 10px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.seg button svg { width: 15px; height: 15px; }
.seg button.on { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line-2); border-radius: 22px; transition: .2s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::before { transform: translateX(16px); }
.opt-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.opt-row:last-child { border-bottom: 0; }
.opt-row .opt-ico { width: 32px; height: 32px; border-radius: 9px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; flex: none; }
.opt-row .opt-ico svg { width: 16px; height: 16px; }
.opt-row .opt-text { flex: 1; min-width: 0; }
.opt-row .opt-text b { display: block; font-size: 13.5px; }
.opt-row .opt-text small { color: var(--muted); font-size: 12.5px; }
.opt-row .select { width: auto; min-width: 170px; }
.checklist { border: 1px solid var(--line-2); border-radius: 10px; max-height: 160px; overflow: auto; padding: 4px; }
.checklist label { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 7px; cursor: pointer; font-size: 13.5px; }
.checklist label:hover { background: var(--surface-3); }
.checklist .empty { padding: 8px; color: var(--muted); font-size: 13px; }

/* ------------------------------------------------------------ Layout de la app */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { background: var(--grad-deep); color: #c9d6f5; display: flex; flex-direction: column; padding: 18px 14px; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { color: #fff; padding: 4px 8px 18px; }
.nav-sec { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #7f95c9; margin: 14px 10px 6px; font-weight: 700; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: #c9d6f5; font-weight: 500; font-size: 14px; text-decoration: none; }
.nav a svg { width: 18px; height: 18px; opacity: .85; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a.on { background: rgba(96, 165, 250, .16); color: #fff; box-shadow: inset 0 0 0 1px rgba(147, 197, 253, .16); }
.nav a .badge-live { margin-left: auto; }
.sidebar .spacer { flex: 1; }
.side-card { background: rgba(255, 255, 255, .06); border: 1px solid rgba(147, 197, 253, .14); border-radius: 14px; padding: 12px; font-size: 13px; margin-bottom: 10px; }
.side-card b { color: #fff; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; }
.side-user:hover { background: rgba(255, 255, 255, .05); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.side-user .who { min-width: 0; flex: 1; line-height: 1.25; }
.side-user .who b { display: block; color: #fff; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user .who small { color: #8ea3d4; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.side-user button { background: none; border: 0; color: #8ea3d4; cursor: pointer; padding: 6px; border-radius: 8px; }
.side-user button:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.side-user button svg { width: 17px; height: 17px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 22px 32px 6px; }
.topbar h1 { font-size: 22px; letter-spacing: -.02em; margin: 0; }
.topbar p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.topbar .grow { flex: 1; min-width: 0; }
.content { padding: 16px 32px 48px; max-width: 1240px; width: 100%; }
.mobile-bar { display: none; }

/* ------------------------------------------------------------ Tarjetas y tablas */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card h3 { margin: 0 0 4px; font-size: 15.5px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.tabs { display: inline-flex; gap: 4px; border-bottom: 1px solid var(--line); width: 100%; margin-bottom: 16px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 14px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tabs button.on { color: var(--primary); border-bottom-color: var(--primary); }
.tabs button svg { width: 16px; height: 16px; }
.pills { display: inline-flex; gap: 4px; background: var(--surface-3); padding: 3px; border-radius: 10px; }
.pills button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; }
.pills button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.search { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.search .input { padding-left: 34px; }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.table th:first-child { border-top-left-radius: var(--r-lg); }
.table th:last-child { border-top-right-radius: var(--r-lg); }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { cursor: pointer; transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table .actions { text-align: right; white-space: nowrap; }
.cell-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-main b { display: block; font-size: 14px; }
.cell-main small { color: var(--muted); font-size: 12.5px; }
.logo-box { width: 36px; height: 36px; border-radius: 10px; background: var(--surface-3); border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; flex: none; font-weight: 700; color: var(--primary); font-size: 13px; }
.logo-box img { width: 22px; height: 22px; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; }
.chip-blue { background: var(--primary-soft); color: var(--primary); }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-live { background: var(--err-soft); color: var(--live); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip-live .dot { animation: pulse 1.4s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

.empty-state { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty-state .ico { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; }
.empty-state .ico svg { width: 26px; height: 26px; }
.empty-state h3 { color: var(--ink); margin: 0 0 4px; font-size: 16px; }
.empty-state p { margin: 0 0 16px; }

.banner { position: relative; overflow: hidden; border-radius: var(--r-xl); background: var(--grad-deep); color: #dbe6ff; padding: 26px 28px; display: grid; grid-template-columns: 1fr 1.25fr; gap: 24px; align-items: center; margin-bottom: 22px; }
.banner::after { content: ""; position: absolute; inset: auto -10% -60% 40%; height: 120%; background: radial-gradient(closest-side, rgba(14, 165, 233, .35), transparent); pointer-events: none; }
.banner .eyebrow { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #93c5fd; font-weight: 700; }
.banner h2 { color: #fff; margin: 6px 0 8px; font-size: 22px; letter-spacing: -.02em; }
.banner p { margin: 0 0 16px; color: #b9c9ee; font-size: 14px; }
.banner .close { position: absolute; top: 12px; right: 12px; z-index: 2; background: rgba(255,255,255,.1); border: 0; color: #fff; width: 28px; height: 28px; border-radius: 50%; cursor: pointer; }
.banner .ov-demo { position: relative; z-index: 1; pointer-events: none; }

/* ------------------------------------------------------------ Markdown */
.md { line-height: 1.6; overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 .7em; }
.md h1, .md h2, .md h3, .md h4 { margin: 1.1em 0 .45em; line-height: 1.3; letter-spacing: -.01em; }
.md h1 { font-size: 1.3em; } .md h2 { font-size: 1.15em; } .md h3 { font-size: 1.05em; } .md h4 { font-size: 1em; }
.md ul, .md ol { margin: 0 0 .7em; padding-left: 1.3em; }
.md li { margin: .2em 0; }
.md strong { font-weight: 700; }
.md code { font-family: var(--mono); font-size: .88em; background: var(--surface-3); padding: .1em .35em; border-radius: 5px; }
.md pre { position: relative; background: #0a1430; color: #dbe7ff; border-radius: 10px; padding: 14px; overflow: auto; margin: 0 0 .8em; }
.md pre code { background: none; padding: 0; color: inherit; font-size: 13px; }
.md pre .copy { position: absolute; top: 8px; right: 8px; background: rgba(255,255,255,.1); color: #dbe7ff; border: 0; border-radius: 6px; font-size: 11px; padding: 3px 8px; cursor: pointer; }
.md blockquote { margin: 0 0 .7em; padding: .2em 1em; border-left: 3px solid var(--blue-300); color: var(--ink-2); }
.md table { border-collapse: collapse; margin: 0 0 .8em; font-size: .95em; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.md th { background: var(--surface-2); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 1em 0; }
.cursor::after { content: "▍"; animation: blink 1s steps(2) infinite; color: var(--primary); margin-left: 1px; }
@keyframes blink { 50% { opacity: 0; } }

/* ------------------------------------------------------------ Modales y avisos */
.modal-back { position: fixed; inset: 0; background: rgba(6, 13, 31, .55); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .15s; }
.modal { background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); width: 100%; max-width: 520px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; animation: pop .18s cubic-bezier(.2, .9, .3, 1.2); }
.modal.wide { max-width: 820px; }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 22px 6px; flex: none; }
.modal-head h2 { margin: 0; font-size: 18px; letter-spacing: -.01em; }
.modal-head p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.modal-head .x { margin-left: auto; background: none; border: 0; cursor: pointer; color: var(--muted); padding: 4px; border-radius: 8px; }
.modal-head .x:hover { background: var(--surface-3); }
.modal-head .x svg { width: 18px; height: 18px; }
.modal-body { padding: 12px 22px; overflow: auto; flex: 1 1 auto; min-height: 0; }
.modal-foot { padding: 14px 22px 20px; display: flex; gap: 10px; justify-content: flex-end; align-items: center; flex: none; border-top: 1px solid var(--line); background: var(--surface); }
.modal-foot .left { margin-right: auto; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

.modal { overflow: hidden; }
/* Altura fija: así el contenido hace scroll y el pie con los botones siempre queda visible. */
.wizard { display: grid; grid-template-columns: 220px 1fr; grid-template-rows: minmax(0, 1fr); height: min(680px, calc(100vh - 32px)); }
.wizard-side { background: var(--surface-2); border-right: 1px solid var(--line); padding: 22px 18px; border-radius: var(--r-xl) 0 0 var(--r-xl); display: flex; flex-direction: column; }
.wizard-side h2 { margin: 0 0 4px; font-size: 18px; }
.wizard-side p { margin: 0 0 22px; color: var(--muted); font-size: 13px; }
.steps { display: flex; flex-direction: column; gap: 0; }
.step { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 13.5px; color: var(--muted); position: relative; padding: 6px 0; }
.step i { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; font-style: normal; font-size: 12px; background: var(--surface); }
.step.on { color: var(--ink); }
.step.on i { background: var(--primary); border-color: var(--primary); color: #fff; }
.step.done i { background: var(--primary-soft); border-color: var(--blue-300); color: var(--primary); }
.step-line { width: 1.5px; height: 18px; background: var(--line-2); margin-left: 11px; }
.wizard-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.wizard-main .modal-body { flex: 1; padding-top: 22px; min-height: 0; overflow: auto; }

.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 80; }
.toast { background: var(--navy-800); color: #fff; padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 13.5px; max-width: 380px; animation: pop .2s; display: flex; gap: 10px; align-items: flex-start; }
.toast.err { background: #7f1d1d; }
.toast.ok { background: #064e3b; }

.menu { position: fixed; z-index: 60; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 5px; min-width: 190px; animation: fade .1s; }
.menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; font-size: 13.5px; text-align: left; }
.menu button:hover { background: var(--surface-3); }
.menu button svg { width: 16px; height: 16px; color: var(--muted); }
.menu button.danger { color: var(--err); }
.menu button.danger svg { color: var(--err); }

.spinner { width: 18px; height: 18px; border: 2px solid var(--line-2); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-page { display: grid; place-items: center; min-height: 50vh; }
.skeleton { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ------------------------------------------------------------ Autenticación */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { background: var(--grad-deep); color: #dbe6ff; padding: 44px; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.auth-art::before { content: ""; position: absolute; width: 620px; height: 620px; border-radius: 50%; background: radial-gradient(closest-side, rgba(14, 165, 233, .35), transparent); right: -240px; bottom: -240px; }
.auth-art .brand { color: #fff; font-size: 22px; }
.auth-art h2 { font-size: 34px; line-height: 1.15; letter-spacing: -.03em; color: #fff; margin: auto 0 14px; max-width: 460px; position: relative; }
.auth-art p { color: #a9bce6; max-width: 440px; margin: 0 0 26px; position: relative; }
.auth-art .ov-demo { position: relative; max-width: 560px; }
.auth-form { display: grid; place-items: center; padding: 32px 20px; background: var(--surface); }
.auth-form form { width: 100%; max-width: 380px; }
.auth-form h1 { font-size: 26px; letter-spacing: -.02em; margin: 0 0 4px; }
.auth-form .sub { color: var(--muted); margin: 0 0 24px; }
.auth-form .alt { text-align: center; margin-top: 18px; color: var(--muted); font-size: 14px; }
.form-error { background: var(--err-soft); color: var(--err); border-radius: 10px; padding: 9px 12px; font-size: 13.5px; margin-bottom: 12px; }

/* ------------------------------------------------------------ Detalle de sesión */
.detail-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.detail-head .logo-box { width: 52px; height: 52px; border-radius: 14px; font-size: 18px; }
.detail-head .logo-box img { width: 30px; height: 30px; }
.detail-head h1 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.detail-head .meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; color: var(--muted); font-size: 13px; align-items: center; }
.detail-head .grow { flex: 1; min-width: 220px; }
.transcript-list { display: flex; flex-direction: column; gap: 10px; }
.tline { display: grid; grid-template-columns: 54px 1fr; gap: 10px; font-size: 14px; }
.tline .t { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; padding-top: 2px; }
.tline .who { font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; margin-right: 6px; }
.tline.them .who { color: var(--sky); }
.tline.me .who { color: var(--blue-700); }
[data-theme="dark"] .tline.me .who { color: var(--blue-300); }
.answer-card { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; background: var(--surface); }
.answer-card + .answer-card { margin-top: 10px; }
.answer-card .q { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; display: flex; gap: 8px; align-items: center; }
.answer-card .q b { color: var(--ink-2); font-weight: 600; }
.ask-box { display: flex; gap: 8px; margin-bottom: 14px; }

/* ------------------------------------------------------------ Vista en vivo (navegador) */
.live { height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.live-head { display: flex; align-items: center; gap: 12px; padding: 12px 18px; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.live-head .title { min-width: 0; }
.live-head .title b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 360px; }
.live-head .title small { color: var(--muted); font-size: 12.5px; }
.live-head .grow { flex: 1; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 15px; }
.metric { display: inline-flex; flex-direction: column; align-items: center; padding: 3px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); min-width: 64px; }
.metric b { font-size: 14px; font-variant-numeric: tabular-nums; }
.metric small { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.live-body { flex: 1; display: grid; grid-template-columns: minmax(300px, 2fr) 3fr; min-height: 0; }
.live-col { display: flex; flex-direction: column; min-height: 0; }
.live-col + .live-col { border-left: 1px solid var(--line); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 12px 18px; font-weight: 700; font-size: 13px; color: var(--ink-2); border-bottom: 1px solid var(--line); background: var(--surface-2); }
.col-head .grow { flex: 1; }
.scroll { flex: 1; overflow: auto; padding: 16px 18px; }
.bubble { max-width: 92%; padding: 9px 13px; border-radius: 14px; margin-bottom: 8px; font-size: 14px; line-height: 1.5; }
.bubble small { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; opacity: .75; }
.bubble.them { background: var(--surface); border: 1px solid var(--line); border-top-left-radius: 4px; }
.bubble.them small { color: var(--sky); }
.bubble.me { background: var(--primary-soft); margin-left: auto; border-top-right-radius: 4px; }
.bubble.me small { color: var(--primary); }
.bubble.partial { opacity: .65; font-style: italic; }
.sources { display: flex; gap: 8px; padding: 10px 18px; border-top: 1px solid var(--line); background: var(--surface); align-items: center; flex-wrap: wrap; }
.src { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.src svg { width: 15px; height: 15px; }
.src.on { border-color: var(--blue-300); color: var(--primary); }
.src.off { color: var(--muted); text-decoration: line-through; }
.meter { width: 44px; height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--grad); transition: width .08s; }
.composer { border-top: 1px solid var(--line); padding: 12px 18px; background: var(--surface); display: flex; flex-direction: column; gap: 10px; }
.composer .actions-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.composer form { display: flex; gap: 8px; }
.kbd { display: inline-flex; align-items: center; gap: 2px; font-family: var(--font); font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 6px; background: rgba(12, 24, 48, .07); color: inherit; opacity: .85; letter-spacing: .02em; }
.btn-primary .kbd, .btn-grad .kbd, .btn-dark .kbd { background: rgba(255, 255, 255, .18); }
.prestart { max-width: 560px; margin: 6vh auto; padding: 0 16px; }
.prestart .card { padding: 26px; }
.prestart h2 { margin: 0 0 6px; letter-spacing: -.02em; }
.prestart ol { padding-left: 18px; color: var(--ink-2); }
.prestart li { margin: 6px 0; }
.attach-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--primary-soft); color: var(--primary); border-radius: 999px; padding: 3px 4px 3px 10px; font-size: 12.5px; font-weight: 600; }
.attach-chip button { border: 0; background: none; color: inherit; cursor: pointer; width: 20px; height: 20px; border-radius: 50%; }

/* ------------------------------------------------------------ Ventana flotante (escritorio / PiP) */
.ov {
  --ov-bg: rgba(14, 22, 44, .78);
  --ov-bg-2: rgba(22, 33, 64, .72);
  --ov-line: rgba(147, 197, 253, .14);
  --ov-pill: rgba(255, 255, 255, .09);
  --ov-pill-hover: rgba(255, 255, 255, .16);
  --ov-kbd: rgba(255, 255, 255, .12);
  --ov-ink: #f1f5ff;
  --ov-muted: #9fb0d6;
  --ov-accent: #38bdf8;
  font-family: var(--font);
  color: var(--ov-ink);
  display: flex; flex-direction: column; gap: 6px;
  font-size: 14px;
  user-select: none;
}
.ov-bar, .ov-panel { background: var(--ov-bg); border: 1px solid var(--ov-line); backdrop-filter: blur(22px) saturate(1.3); -webkit-backdrop-filter: blur(22px) saturate(1.3); box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .65); }
.ov-bar { display: flex; align-items: center; gap: 6px; padding: 6px; border-radius: 16px; }
.ov-panel { border-radius: 16px; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.ov-spacer { flex: 1; }
.ov button { font-family: inherit; color: inherit; border: 0; cursor: pointer; }
.ov-ico { width: 32px; height: 32px; border-radius: 10px; background: transparent; display: grid; place-items: center; color: var(--ov-ink); }
.ov-ico svg { width: 18px; height: 18px; }
.ov-ico:hover { background: var(--ov-pill); }
.ov-ico.off { color: #fca5a5; }
.ov-ico.active { color: var(--ov-accent); }
.ov-levels { display: inline-flex; align-items: center; gap: 2px; height: 18px; width: 32px; justify-content: center; }
.ov-levels i { width: 3px; border-radius: 3px; background: var(--ov-accent); height: 4px; transition: height .08s; }
.ov-pill { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 6px 0 13px; border-radius: 999px; background: var(--ov-pill); font-weight: 600; font-size: 14px; white-space: nowrap; transition: background .12s; }
.ov-pill:hover { background: var(--ov-pill-hover); }
.ov-pill.sm { height: 30px; font-size: 13.5px; }
.ov-pill.primary { background: linear-gradient(135deg, rgba(37, 99, 235, .9), rgba(14, 165, 233, .9)); }
.ov-pill.primary:hover { filter: brightness(1.1); }
.ov-pill.busy { opacity: .7; }
.ov .kbd { background: var(--ov-kbd); color: #dbe6ff; border-radius: 999px; padding: 3px 8px; font-size: 11.5px; gap: 3px; opacity: 1; }
.ov-time { font-variant-numeric: tabular-nums; font-weight: 600; padding: 0 8px; color: var(--ov-ink); }
.ov-sq { width: 32px; height: 32px; border-radius: 9px; background: #fff; color: #0c1830 !important; display: grid; place-items: center; }
.ov-sq svg { width: 17px; height: 17px; }
.ov-sq:hover { background: #dbeafe; }
.ov-drag { -webkit-app-region: drag; cursor: move; }
.ov-chip { height: 30px; padding: 0 6px; border-radius: 999px; background: var(--ov-pill); display: inline-flex; align-items: center; }
.ov-chip:hover { background: var(--ov-pill-hover); }
.ov-chip[disabled] { opacity: .4; cursor: default; }
.ov-count { font-size: 12px; color: var(--ov-muted); font-variant-numeric: tabular-nums; padding: 0 4px; }
.ov-x { width: 30px; height: 30px; border-radius: 50%; background: var(--ov-pill); display: grid; place-items: center; }
.ov-x:hover { background: var(--ov-pill-hover); }
.ov-x svg { width: 16px; height: 16px; }
.ov-row { display: flex; align-items: center; gap: 6px; }
.ov-input { display: flex; align-items: center; gap: 8px; background: var(--ov-bg-2); border: 1px solid var(--ov-line); border-radius: 12px; padding: 4px 6px 4px 14px; }
.ov-input input { flex: 1; background: transparent; border: 0; outline: none; color: var(--ov-ink); font-size: 15px; padding: 8px 0; user-select: text; }
.ov-input input::placeholder { color: var(--ov-muted); }
.ov-input button { background: transparent; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--ov-ink); }
.ov-input button:hover { background: var(--ov-pill); }
.ov-input button svg { width: 17px; height: 17px; }
.ov-answer { padding: 4px 8px 6px; font-size: 15px; line-height: 1.55; max-height: 46vh; overflow: auto; user-select: text; }
.ov-answer .md code { background: rgba(255, 255, 255, .1); }
.ov-answer .md pre { background: rgba(3, 8, 22, .7); }
.ov-answer .md th, .ov-answer .md td { border-color: var(--ov-line); }
.ov-answer .md th { background: rgba(255,255,255,.06); }
.ov-answer .q { font-size: 12.5px; color: var(--ov-muted); margin-bottom: 6px; }
.ov-answer .err { color: #fca5a5; }
.ov-answer .cursor::after { color: var(--ov-accent); }
.ov-live { font-size: 12.5px; color: var(--ov-muted); padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-live b { color: #7dd3fc; font-weight: 600; }
.ov-attach { display: flex; gap: 6px; padding: 0 4px; flex-wrap: wrap; }
.ov-attach span { display: inline-flex; align-items: center; gap: 6px; background: rgba(56, 189, 248, .14); color: #bae6fd; border-radius: 999px; padding: 3px 4px 3px 10px; font-size: 12px; font-weight: 600; }
.ov-attach button { width: 18px; height: 18px; border-radius: 50%; background: rgba(255,255,255,.12); display: grid; place-items: center; }
.ov-attach svg { width: 11px; height: 11px; }
.ov-start { display: flex; align-items: center; gap: 10px; padding: 6px 8px; flex-wrap: wrap; }
.ov-start p { margin: 0; color: var(--ov-muted); font-size: 13.5px; flex: 1; min-width: 200px; }
.ov-menu { position: absolute; right: 8px; top: 48px; background: rgba(12, 20, 42, .96); border: 1px solid var(--ov-line); border-radius: 12px; padding: 6px; min-width: 230px; z-index: 5; box-shadow: 0 16px 40px -12px rgba(0,0,0,.7); }
.ov-menu label, .ov-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; background: none; font-size: 13.5px; cursor: pointer; text-align: left; }
.ov-menu label:hover, .ov-menu button:hover { background: rgba(255, 255, 255, .07); }
.ov-menu .grow { flex: 1; }
.ov-menu input[type=range] { width: 90px; accent-color: var(--ov-accent); }
.ov-menu hr { border: 0; border-top: 1px solid var(--ov-line); margin: 4px 0; }
.ov-menu .danger { color: #fca5a5; }
.ov-wrap { position: relative; }
.ov-lang { padding: 0 12px; gap: 6px; font-size: 13px; letter-spacing: .03em; }
.ov-lang svg { width: 15px; height: 15px; opacity: .85; }
.ov-menu-title { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ov-muted); padding: 6px 10px 2px; font-weight: 700; }
.ov-langs { display: flex; gap: 6px; padding: 6px 8px 8px; }
.ov-langs button { flex: 1; height: 30px; border-radius: 999px; background: var(--ov-pill); font-weight: 700; font-size: 12.5px; }
.ov-langs button:hover { background: var(--ov-pill-hover); }
.ov-langs button.on { background: linear-gradient(135deg, #2563eb, #0ea5e9); }
.ov-menu select { background: rgba(255,255,255,.08); color: var(--ov-ink); border: 1px solid var(--ov-line); border-radius: 8px; padding: 4px 6px; font: inherit; font-size: 12.5px; max-width: 130px; }
.ov-menu select option { color: #0c1830; }
.lang-switch { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.ov.collapsed .ov-panel { display: none; }
.ov .md strong { color: #fff; }
.ov-empty { color: var(--ov-muted); font-size: 14px; padding: 6px 8px; }

/* Ventana flotante en modo escritorio (Electron) o Picture-in-Picture */
body.overlay-mode { background: transparent !important; overflow: hidden; }
body.overlay-mode .ov-host { padding: 6px; }
body.pip-mode { background: #0b1530; margin: 0; }
body.pip-mode .ov-host { padding: 6px; }
body.pip-mode .ov-drag { display: none; }

.ov .kbd, .kbd { white-space: nowrap; }
.ov-pill, .ov-chip, .ov-sq, .ov-ico, .ov-x { flex: none; }
.ov-bar, .ov-row { min-width: 0; }

/* Vista previa estática de la ventana flotante (marketing / banner) */
.ov-demo { overflow: hidden; border-radius: 16px; }
.ov-demo .ov { pointer-events: none; min-width: 640px; }
.auth-art .ov-demo, .banner .ov-demo { zoom: .82; }
.ov-demo .ov-answer { max-height: none; }

/* ------------------------------------------------------------ Responsive */
@media (max-width: 980px) {
  .live-body { grid-template-columns: 1fr; grid-template-rows: 40% 60%; }
  .live-col + .live-col { border-left: 0; border-top: 1px solid var(--line); }
  .banner { grid-template-columns: 1fr; }
  .banner .ov-demo { display: none; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .mobile-bar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--navy-800); color: #fff; position: sticky; top: 0; z-index: 30; }
  .mobile-bar button { background: none; border: 0; color: #fff; padding: 4px; }
  .mobile-bar svg { width: 22px; height: 22px; }
  .topbar { padding: 18px 16px 4px; flex-wrap: wrap; }
  .content { padding: 12px 16px 40px; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .wizard { grid-template-columns: 1fr; }
  .opt-row { flex-wrap: wrap; }
  .opt-row .opt-text { flex: 1 1 calc(100% - 44px); }
  .opt-row .select { width: 100%; min-width: 0; }
  .wizard-side { display: none; }
  .row2 { grid-template-columns: 1fr; }
  .table .hide-sm { display: none; }
  .table td, .table th { padding: 11px 10px; }
  .live-head .metrics { display: none; }
}
