:root {
  --bg: #f4f6f9;
  --card: #fff;
  --text: #1b1f24;
  --muted: #5d6673;
  --line: #e1e5ea;
  --brand: #0b6bcb;
  --red: #d93025;
  --green: #188038;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
[hidden] { display: none !important; }
h1 { margin: 0; font-size: 22px; }
h2 { font-size: 15px; margin: 18px 0 8px; display: flex; align-items: center; gap: 8px; }
a { color: var(--brand); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--red); min-height: 1.2em; font-size: 14px; }

.btn { border: 0; border-radius: 8px; padding: 9px 14px; font-size: 14px; font-weight: 600; cursor: pointer; background: var(--brand); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sec { background: #e8ecf1; color: var(--text); }
.btn-red { background: var(--red); }
.btn-sm { padding: 6px 10px; font-size: 13px; }

.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { background: var(--card); padding: 28px; border-radius: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.08); width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 10px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.login-card input { padding: 9px 10px; border: 1px solid #cfd5dc; border-radius: 8px; font-size: 15px; }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 18px; background: var(--card); border-bottom: 1px solid var(--line); }
.topbar-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.pill { font-size: 12px; padding: 3px 8px; border-radius: 99px; background: #e8ecf1; }
.pill-on { background: #e6f4ea; color: var(--green); }
.pill-off { background: #fce8e6; color: var(--red); }
.badge { background: var(--brand); color: #fff; border-radius: 99px; font-size: 12px; padding: 1px 8px; }

.switch { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; font-weight: 600; }
.switch input { display: none; }
.slider { width: 40px; height: 22px; background: #c4cad2; border-radius: 99px; position: relative; transition: background .2s; }
.slider::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: transform .2s; }
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider::after { transform: translateX(18px); }

.layout { display: grid; grid-template-columns: 340px 1fr; gap: 18px; padding: 18px; }
@media (max-width: 860px) { .layout { grid-template-columns: 1fr; } }
.sidebar, .call { background: var(--card); border-radius: 12px; padding: 4px 16px 16px; border: 1px solid var(--line); min-width: 0; }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.item { border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.item.ringing { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(11,107,203,.15); }
.item-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.item .url { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }

.call-idle { padding: 40px 10px; text-align: center; }
.call-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 14px 0 10px; flex-wrap: wrap; }
.call-head a { overflow-wrap: anywhere; }
.stage { position: relative; background: #111; border-radius: 12px; overflow: hidden; aspect-ratio: 16 / 9; }
#remote { width: 100%; height: 100%; object-fit: contain; display: block; }
#local { position: absolute; right: 12px; bottom: 12px; width: 22%; min-width: 120px; aspect-ratio: 4 / 3; object-fit: cover; border: 2px solid #fff; border-radius: 8px; background: #333; transform: scaleX(-1); }
.placeholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #ddd; }
.controls { display: flex; gap: 10px; margin: 12px 0 6px; flex-wrap: wrap; }
.kicked { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 18px 18px 0; padding: 12px 16px; border-radius: 10px; background: #fff4ce; border: 1px solid #e8d48a; font-size: 14px; }
.team { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.team-item { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.team-item .small { margin-left: auto; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: #c4cad2; }
.dot-available { background: var(--green); }
.dot-call { background: #e8a200; }
.trail-box { margin: 10px 0 0; }
.trail { margin: 6px 0 0; padding-left: 20px; color: var(--muted); }
.trail li { overflow-wrap: anywhere; }

/* Móvil: botones grandes y la llamada arriba del todo cuando está activa */
@media (max-width: 860px) {
  .layout { padding: 10px; gap: 10px; }
  .topbar { padding: 10px; }
  body.in-call .call { order: -1; }
  .stage { aspect-ratio: 3 / 4; max-height: 70vh; }
  #local { width: 32%; min-width: 90px; }
  .controls .btn { flex: 1; padding: 12px; }
  .item .btn { padding: 10px 16px; }
}
