:root {
  /* Light theme to match the Elefair master admin (api.elefair.app) */
  --bg: #f5f5f8; --panel: #ffffff; --panel-2: #f3f3f7; --line: #e7e7ee;
  --ink: #1b1b2b; --ink-soft: #5c5c70; --ink-faint: #9a9aae;
  --accent: #5b5bd6; --accent-deep: #4a4ac2; --accent-soft: #eeeefb;
  --ok: #1f9d57; --warn: #c6881f; --danger: #d6554b;
  --stage: #0e1116; --radius: 12px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "Consolas", monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--ink-faint); }
.err { color: var(--danger); min-height: 18px; margin: 4px 0; font-size: 13px; }
.spacer { flex: 1; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 9px; padding: 9px 14px; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent-deep); }
.btn.small { padding: 6px 11px; font-size: 12.5px; }
.btn.ghost { background: transparent; border-color: rgba(255,255,255,.4); color: #fff; }
.btn.ghost:hover { border-color: #fff; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.wide { width: 100%; }

/* login */
.login { height: 100%; display: grid; place-items: center; padding: 20px; }
.login-box { width: 330px; display: flex; flex-direction: column; gap: 10px; text-align: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 32px 28px;
  box-shadow: 0 10px 30px rgba(27,27,43,.06); }
.logo-lg { width: 54px; height: 54px; border-radius: 14px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-family: var(--mono); font-weight: 700; font-size: 24px; margin: 0 auto; }
.login-box h1 { margin: 6px 0 0; font-size: 20px; }
.login-box .muted { margin: 0 0 8px; font-size: 13px; }
.login-box input { padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); }

/* console */
.console { height: 100%; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; background: var(--accent); color: #fff; padding: 11px 18px; }
.logo { width: 30px; height: 30px; border-radius: 8px; background: rgba(255,255,255,.18); display: grid; place-items: center; font-family: var(--mono); font-weight: 700; }
.brand-name { font-weight: 600; font-size: 15px; }
.brand-sub { font-size: 11px; color: #d7d7f7; }
.conn-state { font-size: 12px; color: #e3e3fb; }

.work { flex: 1; display: grid; grid-template-columns: 300px 1fr; min-height: 0; }
.side { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.side-head { padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.side-head h2 { margin: 0 0 2px; font-size: 13px; }
.side-head p { margin: 0; font-size: 11.5px; color: var(--ink-faint); }
.list { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.list:empty::before { content: "No customers online yet."; color: var(--ink-faint); font-size: 12.5px; padding: 10px; display: block; }
.cust { display: flex; align-items: center; gap: 10px; padding: 10px 11px; border: 1px solid transparent;
  border-radius: 10px; cursor: pointer; background: transparent; width: 100%; text-align: left; color: inherit; }
.cust:hover { background: var(--panel-2); }
.cust.active { background: var(--accent-soft); border-color: var(--accent); }
.cust.off { opacity: .5; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot.on { background: var(--ok); } .dot.offl { background: var(--ink-faint); }
.cust .info { min-width: 0; flex: 1; }
.cust .nm { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cust .id { font-family: var(--mono); font-size: 11.5px; color: var(--ink-soft); letter-spacing: .5px; }

.connect { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.connect label { font-size: 11px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .5px; }
.connect-row { display: flex; gap: 8px; }
.connect input { flex: 1; min-width: 0; font-family: var(--mono); padding: 10px 11px; border: 1px solid var(--line);
  border-radius: 9px; background: var(--bg); color: var(--ink); }
.connect input#idin { font-size: 15px; letter-spacing: 2px; }
.passin { max-width: 110px; }

.stage-wrap { display: flex; flex-direction: column; min-height: 0; }
.stage-bar { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--panel); }
.who { font-weight: 600; font-size: 14px; }
.meta { font-size: 12px; color: var(--ink-soft); font-family: var(--mono); }
.ctl-group { display: flex; gap: 8px; align-items: center; }
.toggle { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-soft); cursor: pointer; user-select: none; }
.switch { width: 34px; height: 19px; border-radius: 10px; background: var(--line); position: relative; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.toggle.on .switch { background: var(--accent); }
.toggle.on .switch::after { transform: translateX(15px); }
.toggle.on { color: var(--ink); }

.stage { flex: 1; margin: 18px; border-radius: var(--radius); overflow: hidden; background: var(--stage);
  position: relative; display: grid; place-items: center; border: 1px solid var(--line); }
#video { width: 100%; height: 100%; object-fit: contain; display: block; background: var(--stage); }
.ring { position: absolute; inset: 0; border: 2px solid var(--warn); border-radius: var(--radius); pointer-events: none; opacity: 0; transition: opacity .15s; }
.stage.controlling .ring { opacity: 1; }
.ctl-flag { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); background: var(--warn);
  color: #241802; font-size: 11.5px; font-weight: 600; padding: 4px 12px; border-radius: 999px; opacity: 0; transition: opacity .15s; }
.stage.controlling .ctl-flag { opacity: 1; }
.stat { position: absolute; bottom: 12px; right: 14px; font-family: var(--mono); font-size: 11px; color: #cfd8e3;
  background: rgba(0,0,0,.45); padding: 3px 8px; border-radius: 6px; }
.empty { text-align: center; color: #a9b4c0; max-width: 420px; padding: 20px; }
.empty h3 { color: #e4e9ef; margin: 0 0 8px; font-size: 17px; }
.empty p { margin: 0; font-size: 13px; line-height: 1.6; }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 10px 18px; border-radius: 9px; font-size: 13.5px; z-index: 20; box-shadow: 0 6px 20px rgba(0,0,0,.2); }

@media (max-width: 760px) {
  .work { grid-template-columns: 1fr; }
  .side { border-right: 0; border-bottom: 1px solid var(--line); max-height: 44vh; }
  .stage { margin: 12px; }
}
