:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #e3e6ea;
  --text: #16191d;
  --muted: #667085;
  --accent: #0b5cff;
  --accent-hover: #0847c7;
  --ok: #0f7b4f;
  --ok-bg: #e6f5ee;
  --warn: #8a5a00;
  --warn-bg: #fdf3e0;
  --err: #b42318;
  --err-bg: #fdeceb;
  --live: #c2262e;
  --live-bg: #fdecec;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101317;
    --surface: #181c22;
    --border: #2a3038;
    --text: #e8eaed;
    --muted: #98a2b3;
    --accent: #4d87ff;
    --accent-hover: #6a9bff;
    --ok: #5fd39b;
    --ok-bg: #102a20;
    --warn: #e3b341;
    --warn-bg: #2b2313;
    --err: #ff8a80;
    --err-bg: #2c1614;
    --live: #ff7a7a;
    --live-bg: #2c1618;
  }
}

* { box-sizing: border-box; }

/* Regras como .auth-form{display:block} e .view{display:grid} tem a mesma
   especificidade que o [hidden] do navegador e venceriam por serem do autor.
   Sem este !important, tudo aparece na tela ao mesmo tempo. */
[hidden] { display: none !important; }

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 17px; font-weight: 600; margin: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--live); }
.env { color: var(--muted); font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.card h2 { font-size: 15px; margin: 0 0 16px; font-weight: 600; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-head h2 { margin: 0; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field span { font-size: 13px; color: var(--muted); }

input, select {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }

button {
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
}

button:hover:not(:disabled) { background: var(--accent-hover); }
button:disabled { opacity: 0.55; cursor: not-allowed; }

button.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 6px 12px;
  font-size: 13px;
}

button.ghost:hover:not(:disabled) { background: var(--bg); color: var(--text); }

.feedback { min-height: 20px; margin: 12px 0 0; font-size: 13px; }
.feedback.ok { color: var(--ok); }
.feedback.err { color: var(--err); }

.list { display: grid; gap: 10px; }
.empty { color: var(--muted); font-size: 14px; margin: 0; }

.item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 16px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.item .url {
  font-size: 14px;
  font-weight: 500;
  word-break: break-all;
  margin: 0 0 4px;
}

.item .meta {
  font-size: 12px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  margin: 0;
}

.item .actions { display: flex; gap: 8px; align-items: center; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge.starting, .badge.joining, .badge.uploading, .badge.stopping { background: var(--warn-bg); color: var(--warn); }
.badge.recording { background: var(--live-bg); color: var(--live); }
.badge.completed { background: var(--ok-bg); color: var(--ok); }
.badge.failed { background: var(--err-bg); color: var(--err); }

.key-area { display: flex; align-items: center; gap: 12px; }

.keybar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  max-width: 900px;
  margin: 16px auto -4px;
  padding: 12px 16px;
  background: var(--warn-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.keybar label { font-size: 13px; color: var(--warn); font-weight: 600; }
.keybar input { flex: 1; min-width: 220px; background: var(--surface); }

@media (max-width: 600px) {
  .keybar { margin: 16px 16px -4px; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 10px; }
}

/* ---------------------------------------------------------------- login */

.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.auth-brand { display: flex; align-items: center; gap: 10px; }
.auth-brand h1 { font-size: 19px; margin: 0; font-weight: 600; }
.auth-sub { color: var(--muted); font-size: 13px; margin: 6px 0 20px; }
.auth-form { display: block; }
.auth-form button[type="submit"] { width: 100%; margin-top: 4px; }
.auth-hint { font-size: 13px; color: var(--muted); margin: 0 0 16px; }
.field small { font-size: 12px; color: var(--muted); }

button.link {
  background: none;
  color: var(--accent);
  padding: 8px 0 0;
  font-size: 13px;
  width: 100%;
}
button.link:hover:not(:disabled) { background: none; text-decoration: underline; }

/* ----------------------------------------------------------------- abas */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.tab {
  background: none;
  color: var(--muted);
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 500;
}

.tab:hover:not(.active) { background: none; color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); background: none; }

.main-tabs {
  background: var(--surface);
  margin-bottom: 0;
  padding: 0 24px;
  overflow-x: auto;
}

/* -------------------------------------------------------------- diversos */

.hint { font-size: 13px; color: var(--muted); margin: -8px 0 16px; }

.feedback.banner { margin: 0 0 4px; }
.feedback.banner:empty { display: none; }

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin-bottom: 14px;
}
.checkbox input { width: auto; }

.view { display: grid; gap: 20px; }
.card .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.badge:empty { display: none; }

button.sso {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  font-weight: 500;
  margin-bottom: 18px;
}
button.sso:hover:not(:disabled) { background: var(--bg); }

.ou { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; }
.ou::before, .ou::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.ou span { font-size: 12px; color: var(--muted); }
