:root {
  /* Mismos colores que Métricas (metricas.automationpro-ai.com, imagen de Real Estate Luxi):
     menú negro, dorado metálico en lo activo, botones dorados y grises cálidos. */
  --bg: #f9f8f5; --surface: #ffffff; --ink: #2a2622; --muted: #766d63; --line: #e1dcd4;
  --navy: #9a7b2e; --gold: #c8a33c; --gold-soft: #f4e9c6; --gold-dark: #7d6325; --black: #0b0b0b;
  --metal: linear-gradient(120deg, #B8943F 0%, #D8BD69 35%, #F6E5A5 55%, #C9AA58 100%);
  --ok: #16a34a; --ok-soft: #dcfce7; --warn: #b45309; --warn-soft: #fef3c7; --bad: #dc2626; --bad-soft: #fee2e2;
  --radius: 14px; --shadow: 0 1px 2px rgba(42,38,34,.05), 0 4px 16px rgba(42,38,34,.04);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--gold-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font: 600 28px/1.2 "Playfair Display", Georgia, serif; margin: 0; }
h2 { font-family: "Playfair Display", Georgia, serif; }
h2 { font-size: 17px; margin: 0 0 10px; }
h3 { font-size: 15px; margin: 18px 0 8px; }
.muted { color: var(--muted); }
small { font-size: 12.5px; }
.right { float: right; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; min-width: 0; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Menú lateral (como Métricas: barra blanca fija, iconos de línea) */
[hidden] { display: none !important; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 256px; background: var(--black); color: #e1dcd4; display: flex; flex-direction: column; padding: 18px 14px; z-index: 20; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; color: #fff; padding: 2px 6px 18px; margin-bottom: 12px; border-bottom: 1px solid rgba(200,163,60,.25); }
.sidebar .brand small { color: #d8bd69; }
.brand:hover { text-decoration: none; }
.brand strong { display: block; font-size: 15px; }
.brand small { display: block; color: var(--muted); font-size: 12px; }
.logo { width: 40px; height: 40px; border-radius: 50%; background: var(--metal); color: #1f1b16; display: grid; place-items: center; font: 700 15px "Playfair Display", Georgia, serif; flex: none; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a, .sidebar .logout { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 12px; color: #e1dcd4; font-size: 14px; font-weight: 500; }
.sidebar nav a:hover { background: var(--metal); color: #1f1b16; font-weight: 600; text-decoration: none; }
.sidebar .logout:hover { background: rgba(255,255,255,.05); color: #fff; text-decoration: none; }
.sidebar nav a.active { background: var(--metal); color: #1f1b16; font-weight: 600; }
.sidebar .logout { border-top: 1px solid rgba(200,163,60,.25); border-radius: 0; padding-top: 14px; }
.sidebar .logout { color: #a39a8e; }
.icon { width: 18px; height: 18px; flex: none; }
.content { margin-left: 256px; min-width: 0; }
.tabbar, .sheet { display: none; }

main { max-width: 1180px; margin: 0 auto; padding: 24px; }
main.wide { max-width: none; padding: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }

/* Tarjetas y KPIs */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.kpi span { color: var(--muted); font-size: 13px; display: block; }
.kpi strong { font: 600 32px/1.1 "Playfair Display", Georgia, serif; display: block; margin: 6px 0 2px; color: var(--ink); }
.kpi.alert { border-color: #f3b4ae; background: var(--bad-soft); }
.kpi.alert strong { color: var(--bad); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2 > *, .kpis > *, .grid3 > * { min-width: 0; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.alert-card { border-color: #f3b4ae; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { border-top: 1px solid var(--line); padding: 10px 0; }
.list li:first-child { border-top: 0; }
.list a { display: block; color: inherit; }
.list a:hover { text-decoration: none; background: #faf8f3; }
.visit-row { display: flex; gap: 14px; align-items: center; }
.when { min-width: 92px; display: flex; flex-direction: column; }
.when strong { font: 600 20px Georgia, serif; color: var(--navy); }
.empty { color: var(--muted); padding: 10px 0; }

/* Formularios */
label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid #cfc8bd; border-radius: 10px; padding: 8px 10px; width: 100%; }
input[type=checkbox] { width: auto; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold-soft); border-color: var(--gold); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; padding: 9px 16px; border-radius: 10px; border: 1px solid #cfc8bd; background: #fff; color: var(--ink); cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f9f8f5; text-decoration: none; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--gold-dark); border-color: var(--gold-dark); }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.filters { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.filters input { flex: 1; min-width: 200px; }
.filters select { width: auto; }

/* Avisos y etiquetas */
.flash { padding: 10px 14px; border-radius: 9px; margin-bottom: 14px; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.error { background: var(--bad-soft); color: var(--bad); }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: #eceae4; color: var(--muted); white-space: nowrap; vertical-align: middle; }
.pill.ok, .pill.confirmada, .pill.realizada { background: var(--ok-soft); color: var(--ok); }
.pill.off, .pill.no_presentado { background: #eceae4; color: #555; }
.pill.warn, .pill.pendiente { background: var(--warn-soft); color: var(--warn); }
.pill.alert, .pill.cancelada { background: var(--bad-soft); color: var(--bad); }
.badge { background: var(--gold); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px; margin-left: 6px; }
.warn-text { color: var(--warn); font-size: 13px; margin-top: 4px; }
.hint { color: var(--muted); font-size: 12px; margin: 4px 16px 10px; }

/* Tablas */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #f9f8f5; }
tr:last-child td { border-bottom: 0; }
.schedule input[type=time] { width: 120px; display: inline-block; }

/* Login */
.login-page { min-height: 100vh; display: grid; place-items: center; background: var(--black); padding: 16px; }
.login-card { background: #fff; padding: 28px; border-radius: 16px; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 6px; }
.login-brand strong { font-size: 17px; font-weight: 700; display: block; }
.login-brand small { color: var(--muted); }

/* Móvil */
@media (max-width: 960px) {
  .sidebar { display: none; }
  .content { margin-left: 0; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .tabbar { display: flex; position: fixed; inset: auto 0 0 0; z-index: 20; background: var(--black); border-top: 1px solid rgba(200,163,60,.25); padding: 4px 4px env(safe-area-inset-bottom); }
  .tabbar a, .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 0 6px; font: inherit; font-size: 11px; color: #cfc8bd; background: none; border: 0; border-radius: 9px; cursor: pointer; }
  .tabbar a:hover { text-decoration: none; }
  .tabbar .active { color: #d8bd69; font-weight: 600; }
  .tabbar .icon { width: 20px; height: 20px; }
  .sheet:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 30; }
  .sheet-backdrop { position: absolute; inset: 0; background: rgba(20,33,61,.4); border: 0; }
  .sheet-panel { position: absolute; inset: auto 0 0 0; background: var(--black); color: #e1dcd4; border-radius: 18px 18px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
  .sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
  .icon-btn { background: none; border: 0; padding: 6px; border-radius: 8px; color: var(--muted); cursor: pointer; }
  .sheet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .sheet-grid a { display: flex; align-items: center; gap: 10px; padding: 12px; border: 0; background: rgba(255,255,255,.05); border-radius: 12px; color: #e1dcd4; font-weight: 500; font-size: 14px; }
  .sheet-grid a.active { background: var(--metal); color: #1f1b16; font-weight: 600; }
  .sheet-grid a:hover { text-decoration: none; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  main { padding: 16px; }
  .kpi strong { font-size: 26px; }
}

.connect-card { border-color: #ead592; background: #fbf7ea; }
.steps { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 12px; }
.steps li { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.steps .btn { align-self: flex-start; }
.paste { display: flex; gap: 8px; width: 100%; flex-wrap: wrap; }
.paste input { flex: 1; min-width: 240px; }
code { background: #f1eee6; padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }


/* ─── Agente de ventas ─────────────────────────────────────────────── */
.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs a { padding: 7px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--muted); }
.tabs a.active { background: var(--metal); color: #1f1b16; border-color: #c8a33c; font-weight: 600; }
.tabs a:hover { text-decoration: none; }
.pill.cita, .pill.interesado, .pill.completada, .pill.activa, .pill.aprobado, .pill.alto { background: var(--ok-soft); color: var(--ok); }
.pill.pendiente, .pill.volver_a_llamar, .pill.sonando, .pill.iniciando, .pill.pausada, .pill.medio, .pill.no_contesta, .pill.llamando { background: var(--warn-soft); color: var(--warn); }
.pill.no_llamar, .pill.fallida, .pill.error, .pill.descartado { background: var(--bad-soft); color: var(--bad); }
.pill.en_curso { background: #e1ecfb; color: #1d4f9a; }
.pill.contactado, .pill.borrador { background: #e6eefb; color: #24467f; }
.pill.dir { background: #f1eee6; color: #6b5a33; }
.row-link { cursor: pointer; }
.row-link:hover td { background: #faf8f3; }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; }
.checklist li { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.checklist .dot { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; flex: none; background: #eceae4; color: var(--muted); }
.checklist .ok .dot { background: var(--ok-soft); color: var(--ok); }
.checklist .ok a { color: var(--muted); }

/* Centralita */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.line { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fff; display: flex; flex-direction: column; gap: 6px; position: relative; }
.line.en_curso { border-color: #9cc0f0; box-shadow: 0 0 0 3px #e1ecfb; }
.line.sonando, .line.iniciando { border-color: #f0d08a; }
.line .who { font-weight: 600; font-size: 15px; }
.line .timer { font: 600 22px/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink); }
.line .acts { display: flex; gap: 6px; margin-top: 4px; }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: #2f80ed; display: inline-block; animation: blink 1.2s infinite; margin-right: 6px; }
@keyframes blink { 50% { opacity: .3; } }
.keypad { display: grid; grid-template-columns: 54px 1fr 190px 1fr 70px; gap: 8px; align-items: center; }
.keypad .key { width: 44px; height: 44px; border-radius: 50%; background: var(--metal); color: #1f1b16; display: grid; place-items: center; font: 700 18px "Playfair Display", Georgia, serif; }
.keypad input, .keypad select { padding: 7px 9px; }
.keypad-head { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.events { list-style: none; margin: 0; padding: 0; font-size: 13px; max-height: 360px; overflow-y: auto; }
.events li { padding: 6px 0; border-top: 1px solid #f0ede5; display: flex; gap: 10px; }
.events li:first-child { border-top: 0; }
.events time { color: var(--muted); font-variant-numeric: tabular-nums; flex: none; width: 44px; }
.events .warn { color: var(--warn); } .events .error { color: var(--bad); }

/* Llamada */
.transcript { display: flex; flex-direction: column; gap: 8px; max-height: 620px; overflow-y: auto; padding: 4px; }
.turn { max-width: 80%; padding: 8px 12px; border-radius: 12px; }
.turn.agent { align-self: flex-start; background: #f2efe9; border-top-left-radius: 4px; }
.turn.user { align-self: flex-end; background: var(--gold-soft); border-top-right-radius: 4px; }
.turn small { display: block; color: var(--muted); font-size: 11px; margin-bottom: 2px; }
audio { width: 100%; }
dl.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; margin: 0; font-size: 14px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }

/* Cerebro */
.know { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 10px; background: #fff; }
.know textarea { min-height: 70px; }
.know .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.know .acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
pre.prompt { white-space: pre-wrap; background: #faf8f3; border: 1px solid var(--line); border-radius: 10px; padding: 14px; font-size: 13px; max-height: 520px; overflow-y: auto; }

/* Voces */
.voices { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.voice { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fff; display: flex; flex-direction: column; gap: 6px; }
.voice.current { border-color: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.voice .tags { display: flex; gap: 4px; flex-wrap: wrap; }
.voice .acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; }
.rank { counter-reset: r; }
.compare td:first-child { font-weight: 600; }
details summary { cursor: pointer; font-weight: 600; }
.secret-note { font-size: 12px; color: var(--muted); }
@media (max-width: 960px) {
  .checklist { grid-template-columns: 1fr; }
  .keypad { grid-template-columns: 44px 1fr; }
  .keypad .wide { grid-column: 1 / -1; }
  .keypad-head { display: none; }
}
