:root {
  --bg: #0e1116;
  --panel: #161b23;
  --panel-2: #1d232d;
  --line: #262e3a;
  --txt: #e6eaf0;
  --txt-dim: #97a1b0;
  --accent: #4f8cff;
  --accent-soft: #4f8cff22;
  --orbi: #34d399;
  --lead: #60a5fa;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--txt);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

button, input, select { font: inherit; color: inherit; }

/* ---------- Login ---------- */
.login-body { display: grid; place-items: center; min-height: 100vh; }

.login-card {
  width: min(380px, 92vw);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 36px 30px 24px;
  text-align: center;
}

.logo { font-size: 34px; color: var(--accent); line-height: 1; }
.login-card h1 { margin: 10px 0 2px; font-size: 24px; font-weight: 600; }
.login-card h1 span { color: var(--txt-dim); font-weight: 400; }
.login-card .sub { margin: 0 0 26px; color: var(--txt-dim); font-size: 13px; }

.pwd-form { display: flex; gap: 8px; }
.pwd-form input {
  flex: 1; padding: 11px 12px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--panel-2);
}
.pwd-form input:focus { outline: none; border-color: var(--accent); }
.pwd-form button {
  padding: 11px 16px; border-radius: var(--radius); border: 0;
  background: var(--accent); color: #fff; font-weight: 600; cursor: pointer;
}

.error {
  background: #f8717122; border: 1px solid #f8717155; color: #fca5a5;
  padding: 9px 12px; border-radius: var(--radius); font-size: 13px; margin: 0 0 16px;
}
.foot { margin: 22px 0 0; color: #5b6675; font-size: 11px; }

/* ---------- App ---------- */
.top {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.top h1 { margin: 0; font-size: 16px; font-weight: 600; }
.top h1 b { color: var(--accent); }
.top .spacer { flex: 1; }
.top .who { color: var(--txt-dim); font-size: 12px; }
.top a.logout { color: var(--txt-dim); font-size: 12px; text-decoration: none; }
.top a.logout:hover { color: var(--txt); }

.layout {
  display: grid; grid-template-columns: 360px 1fr; gap: 18px;
  padding: 18px 20px; max-width: 1400px; margin: 0 auto;
  align-items: start;
}
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px;
}
.card h2 {
  margin: 0 0 14px; font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; color: var(--txt-dim);
}

.field { margin-bottom: 11px; }
.field label { display: block; font-size: 12px; color: var(--txt-dim); margin-bottom: 4px; }
.field input, .field select {
  width: 100%; padding: 9px 10px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--panel-2);
}
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); }
.field .hint { font-size: 11px; color: #6b7686; margin-top: 3px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

details.adv { margin-top: 6px; }
details.adv summary {
  cursor: pointer; font-size: 12px; color: var(--txt-dim);
  padding: 7px 0; user-select: none;
}
details.adv summary:hover { color: var(--txt); }

.check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; margin: 10px 0; }
.check input { margin-top: 3px; accent-color: var(--accent); }
.check span small { display: block; color: #6b7686; font-size: 11px; }

.actions { display: flex; gap: 10px; margin-top: 14px; }
.btn {
  flex: 1; padding: 12px; border-radius: var(--radius); border: 0;
  font-weight: 600; cursor: pointer; background: var(--panel-2); color: var(--txt);
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-call { background: var(--orbi); color: #06281c; }
.btn-hang { background: var(--danger); color: #3b0a0a; }
.btn:not(:disabled):hover { filter: brightness(1.08); }

/* ---------- Panel de llamada ---------- */
.call-head {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line);
}
.status { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #4b5563; flex: none; }
.dot.live { background: var(--orbi); box-shadow: 0 0 0 4px #34d39933; animation: pulse 1.6s infinite; }
.dot.wait { background: var(--warn); }
.dot.err  { background: var(--danger); }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px #34d39911; } }

.timer { font-variant-numeric: tabular-nums; color: var(--txt-dim); font-size: 13px; }
.badge {
  font-size: 11px; padding: 3px 8px; border-radius: 20px;
  background: var(--accent-soft); color: #93b8ff; border: 1px solid #4f8cff44;
}
.badge.sim { background: #fbbf2422; color: #fcd34d; border-color: #fbbf2444; }

.meter { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--txt-dim); }
.meter .bar { width: 90px; height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; }
.meter .fill { height: 100%; width: 0; background: var(--orbi); transition: width .08s linear; }

.transcript {
  min-height: 420px; max-height: 62vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px; padding-right: 4px;
}
.msg { max-width: 78%; padding: 9px 13px; border-radius: 14px; font-size: 14px; }
.msg .lbl { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; opacity: .65; display: block; margin-bottom: 2px; }
.msg.orbi { align-self: flex-start; background: #34d39918; border: 1px solid #34d39933; }
.msg.orbi .lbl { color: var(--orbi); }
.msg.lead { align-self: flex-end; background: #60a5fa18; border: 1px solid #60a5fa33; }
.msg.lead .lbl { color: var(--lead); }
.msg.partial { opacity: .62; }
.msg.sys {
  align-self: center; max-width: 90%; background: transparent; border: 1px dashed var(--line);
  color: var(--txt-dim); font-size: 12px; text-align: center;
}
.msg.sys.bad { border-color: #f8717155; color: #fca5a5; }

.empty { color: #5b6675; font-size: 13px; text-align: center; padding: 60px 20px; }
.transcript-tools { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.tool-btn {
  padding: 7px 12px; font-size: 12px; border-radius: 8px;
  border: 1px solid var(--line); background: transparent; color: var(--txt-dim); cursor: pointer;
}
.tool-btn:hover { color: var(--txt); border-color: var(--txt-dim); }
