:root {
  color-scheme: dark;
  --bg: #17181b;
  --panel: #202226;
  --line: #34373d;
  --text: #e8eaed;
  --muted: #9aa0a6;
  --blue: #1a73e8;
  --red: #d93025;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

.layout { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }

aside {
  border-right: 1px solid var(--line);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; padding: 0 8px; }
.brand-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 3px #d9302533; }

nav { display: flex; flex-direction: column; gap: 4px; }
.nav {
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
}
.nav:hover { background: var(--panel); color: var(--text); }
.nav.active { background: var(--panel); color: var(--text); font-weight: 600; }
.badge {
  float: right;
  background: #3c4043;
  color: var(--text);
  border-radius: 10px;
  padding: 0 8px;
  font-size: 12px;
}
.side-foot { margin-top: auto; color: var(--muted); font-size: 12px; padding: 0 8px; }

kbd {
  padding: 1px 7px;
  font: 12px ui-monospace, monospace;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 5px;
}

main { padding: 32px 40px 60px; max-width: 760px; }
h2 { margin: 0 0 6px; font-size: 20px; }
.sub { color: var(--muted); margin: 0 0 20px; }

button { font: inherit; color: var(--text); cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }

/* ---------- cartão de status ---------- */

.status {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
  text-align: center;
}
.status-top { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: .02em; }
.status-dot { width: 12px; height: 12px; border-radius: 50%; background: #5f6368; }
.timer { font-size: 56px; font-weight: 300; font-variant-numeric: tabular-nums; margin: 10px 0 0; color: var(--muted); }
.size { color: var(--muted); min-height: 21px; font-size: 13px; }

.big {
  margin-top: 18px;
  min-width: 260px;
  padding: 15px 26px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: var(--red);
  border: 0;
  border-radius: 10px;
}
.big:hover:not(:disabled) { filter: brightness(1.1); }
.status-hint { margin: 14px 0 0; color: var(--muted); font-size: 13px; min-height: 20px; }

.status.recording { border-color: var(--red); background: #2a1c1c; }
.status.recording .status-top { color: #f28b82; }
.status.recording .status-dot { background: var(--red); animation: pulse 1.1s infinite; }
.status.recording .timer { color: var(--text); }
.status.recording .big { background: #3c4043; }

.status.countdown .status-dot { background: #f9ab00; }
.status.countdown .timer { color: #f9ab00; font-size: 84px; }
.status.countdown .big { background: #3c4043; }

.status.saving .status-dot { background: var(--blue); animation: pulse 1.1s infinite; }

@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(1.35); } }

.alert {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #3b1f1d;
  border: 1px solid #7a2e29;
  color: #f6b3ae;
}
.toast {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #1b2b3f;
  border: 1px solid #2c4a73;
  color: #aecbfa;
}

.steps { margin: 24px 0 0; padding-left: 20px; color: var(--muted); }
.steps li { margin-bottom: 8px; }
.steps strong { color: var(--text); }

.alt { margin-top: 20px; color: var(--muted); font-size: 12px; }
.link { background: none; border: 0; padding: 0; color: #8ab4f8; text-decoration: underline; font-size: 12px; }

/* ---------- lista de gravações ---------- */

.item {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
}
.meta { flex: 1; min-width: 0; }
.meta strong { display: block; }
.meta span { color: var(--muted); font-size: 12px; }
.actions { display: flex; gap: 8px; }
.actions button {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 12px;
}
.actions button:hover:not(:disabled) { border-color: #5a5f68; }
.actions .edit { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; }
.actions .del { color: #f28b82; }
.empty { color: var(--muted); padding: 30px 0; }

/* ---------- configurações ---------- */

.field { margin-bottom: 20px; }
.field > label { display: block; margin-bottom: 6px; font-weight: 600; }
.field select {
  min-width: 280px;
  padding: 8px 10px;
  font: inherit;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.field.check { display: flex; align-items: center; gap: 10px; }
.field.check label { margin: 0; font-weight: 400; }
.row { display: flex; align-items: center; gap: 12px; }
.row button { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; }

/* ---------- celular como webcam ---------- */

.badge.on { background: #1e6b36; color: #a8dab5; padding: 0 6px; }
.phone-line { margin: 14px 0 0; color: var(--muted); font-size: 13px; text-align: center; }
.phone-line .link { margin-left: 6px; }
h3 { margin: 26px 0 10px; font-size: 16px; }
.hint { color: var(--muted); font-size: 12px; margin: 6px 0 0; }
.row.wrap { flex-wrap: wrap; justify-content: center; }

.phone-grid { display: grid; grid-template-columns: 240px 1fr; gap: 24px; align-items: start; margin-bottom: 20px; }
.qr-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
}
.qr {
  width: 208px; height: 208px; margin: 0 auto 12px;
  background: #fff; border-radius: 8px; padding: 6px;
  display: grid; place-items: center;
  color: #333; font-size: 12px;
}
.qr svg { width: 100%; height: 100%; display: block; }
.pstatus { font-weight: 600; font-size: 13px; }
.pstatus.wait { color: #fdd663; }
.pstatus.ok { color: #81c995; }
.pstatus.err { color: #f28b82; }
.pinfo { color: var(--muted); font-size: 12px; min-height: 18px; margin: 4px 0 10px; }
.qr-card button, .bubble-controls select {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; font: inherit; color: var(--text);
}
.phone-grid .steps { margin: 0; }

.field input[type="url"] {
  width: 100%; max-width: 560px; padding: 8px 10px; font: inherit; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
}

.stage {
  position: relative;
  width: 100%;
  max-width: 640px;
  aspect-ratio: 16 / 9;
  background: repeating-conic-gradient(#25272c 0% 25%, #202226 0% 50%) 0 0 / 28px 28px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}
.stage > video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: none; background: #000; }
.stage.live > video { display: block; }
.stage-label {
  position: absolute; left: 10px; top: 8px; font-size: 12px; color: var(--muted);
  background: #0008; padding: 2px 8px; border-radius: 6px; pointer-events: none;
}
.stage.live .stage-label { display: none; }

.bubble {
  position: absolute;
  background: #0b0b0d;
  cursor: grab;
  box-shadow: 0 4px 14px #0008;
  outline: none;
  touch-action: none;
}
.bubble.circle { border-radius: 50%; }
.bubble.square, .bubble.wide { border-radius: 12%; }
.bubble.wide { border-radius: 8px; }
.bubble.border { box-shadow: 0 0 0 2px #ffffffe6, 0 4px 14px #0008; }
.bubble.dragging { cursor: grabbing; }
.bubble:focus-visible { outline: 2px solid #8ab4f8; outline-offset: 3px; }
.bubble .clip { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; display: grid; place-items: center; }
.bubble .ph { font-size: var(--ph-size, 32px); opacity: .55; }
.bubble.has-video .ph { display: none; }
.bubble video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; pointer-events: none; }
.bubble.has-video video { display: block; }
.bubble.mirror video { transform: scaleX(-1); }
.handle {
  position: absolute;
  right: -7px; bottom: -7px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #8ab4f8;
  border: 2px solid #17181b;
  cursor: nwse-resize;
  touch-action: none;
}
.bubble.circle .handle { right: 5%; bottom: 5%; }

.bubble-controls { display: flex; flex-wrap: wrap; gap: 18px; margin: 16px 0 14px; align-items: end; }
.bubble-controls label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.bubble-controls input[type="range"] { width: 220px; }

@media (max-width: 720px) {
  .phone-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .layout { grid-template-columns: 1fr; }
  aside { border-right: 0; border-bottom: 1px solid var(--line); padding: 14px; }
  nav { flex-direction: row; flex-wrap: wrap; }
  .side-foot { display: none; }
  main { padding: 22px 16px 50px; }
}



/* prévia ao vivo (tela + câmera) */
.live { position: relative; margin: 12px 0; background: #000; border: 1px solid var(--line, #34373d); border-radius: 10px; overflow: hidden; max-width: 560px; }
.live canvas { display: block; width: 100%; height: auto; max-height: 315px; object-fit: contain; background: #000; }
.live-tag { position: absolute; left: 8px; top: 8px; font-size: 11px; padding: 2px 8px; border-radius: 10px; background: rgba(0,0,0,.65); color: #fff; }
.live.rec .live-tag { background: #d93025; }

/* câmera flutuante */
.float-btn { background: #1f3a5f; color: #e8f0fe; border: 1px solid #3b5f8f; border-radius: 8px; padding: 7px 14px; font-size: 13px; cursor: pointer; }
.float-btn:hover { background: #27497a; }
.float-btn.on { background: #5f1f1f; border-color: #8f3b3b; }
.float-btn:disabled { opacity: .5; cursor: default; }

/* editar vídeo / IA */
.drop-box { border: 2px dashed var(--line); border-radius: 12px; padding: 30px 20px; text-align: center; margin-bottom: 16px; }
.drop-box .big { margin: 8px auto 0; }
.muted { color: var(--muted); }
body.dragover .drop-box, .drop-box.over { border-color: #8ab4f8; background: rgba(138,180,248,.08); }
body.dragover::after { content: 'Solte o vídeo para editar'; position: fixed; inset: 10px; display: grid; place-items: center; font-size: 22px; color: #fff; background: rgba(26,115,232,.25); border: 3px dashed #8ab4f8; border-radius: 14px; z-index: 50; pointer-events: none; }
.ai-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; background: var(--panel); }
.ai-card h3 { margin: 0 0 4px; font-size: 15px; display: flex; align-items: center; gap: 10px; }
.ai-card a { color: #8ab4f8; }
.ai-card .row { margin-top: 10px; flex-wrap: wrap; }
.ai-card input[type=password] { flex: 1; min-width: 220px; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
.ai-state { font-size: 11px; font-weight: 400; padding: 2px 8px; border-radius: 10px; background: #3c4043; color: #bdc1c6; }
.ai-state.on { background: #1e8e3e; color: #fff; }
.danger-link { color: #f28b82 !important; }
.alert.info { background: rgba(138,180,248,.08); border-color: #3b5f8f; color: var(--text); }
.alert.info ul { margin: 6px 0 0; padding-left: 18px; }
.alert.info li { margin: 3px 0; }
