:root {
  --border: #d8dde3;
  --bg: #f7f8fa;
  --text: #1c1f24;
  --muted: #6b7280;
  --accent: #1f6feb;
  --success-bg: #eaf7ee;
  --success-border: #34a853;
  --error-bg: #fdecea;
  --error-border: #d93025;
  --warn-bg: #fff4e5;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

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

.brand { font-weight: 600; }

.topbar nav a {
  margin-left: 16px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.topbar nav a:hover { text-decoration: underline; }

.container {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 24px;
}

/* Paginas com tabela de muitas colunas (ex.: Alarmes) usam mais da largura
   da tela em vez de ficar espremidas no mesmo limite das telas de formulario. */
.container-wide {
  max-width: none;
}

h1 { font-size: 1.4rem; margin-bottom: 4px; }
.hint { color: var(--muted); margin-top: 0; font-size: 0.9rem; }

.upload-form {
  display: flex;
  gap: 12px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-top: 16px;
}

button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  cursor: pointer;
  font-weight: 500;
}
button:hover { opacity: 0.9; }

.alert {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
}
.alert-success { background: var(--success-bg); border-color: var(--success-border); }
.alert-error { background: var(--error-bg); border-color: var(--error-border); }
.alert-warn { background: var(--warn-bg); border-color: #e0a34a; }
.alert pre { white-space: pre-wrap; }

.table-wrap {
  overflow-x: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 16px;
}

table { border-collapse: collapse; width: 100%; font-size: 0.85rem; }
th, td { padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
th { background: #fafbfc; position: sticky; top: 0; }
tbody tr:hover { background: #f2f6ff; }

/* Coluna de acao (ex.: botao "Baixar video") sempre visivel, mesmo se a
   tabela for mais larga que a tela e precisar rolar pros lados. */
.col-acao {
  position: sticky;
  right: 0;
  background: #fff;
  box-shadow: -6px 0 6px -6px rgba(0,0,0,0.15);
}
tbody tr:hover .col-acao { background: #f2f6ff; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  background: #eef1f5;
  font-size: 0.8rem;
}
.badge-warn { background: var(--warn-bg); border: 1px solid #e0a34a; }
.badge-muted { background: #eef1f5; color: var(--muted); }
.badge-alta { background: var(--error-bg); border: 1px solid var(--error-border); color: #a30f0f; }
.badge-media { background: var(--warn-bg); border: 1px solid #e0a34a; color: #8a5a10; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.login-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 32px;
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-card h1 { font-size: 1.2rem; margin: 0; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; font-weight: 500; }
.login-card input {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.login-card button { margin-top: 8px; }

.cliente-card {
  margin-top: 20px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
}
.cliente-card-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.cliente-card-header strong { font-size: 1.05rem; }

.player-video {
  width: 100%;
  max-width: 960px;
  background: #000;
  border-radius: 8px;
  display: block;
}

.velocidade-controles {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  max-width: 960px;
}
.velocidade-controles button {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-weight: 500;
}
.velocidade-controles button:hover { background: #f2f6ff; }
.velocidade-controles button.vel-ativa {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-link {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 6px;
  background: #e9f5ec;
  color: #1a7a3c;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.8rem;
}
.btn-link:hover { opacity: 0.85; }
