:root {
  --primary: #0891b2;
  --primary-dark: #0e7490;
  --bg: #0f172a;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --danger: #dc2626;
  --ok: #059669;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, #134e5e 0%, var(--bg) 55%);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
}
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0,0,0,.35);
  padding: 32px 28px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}
.brand .logo {
  width: 40px; height: 40px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  display: grid; place-items: center;
  color: #fff; font-size: 20px;
}
.brand h1 { font-size: 17px; margin: 0; letter-spacing: .01em; }
.brand small { color: var(--muted); font-size: 12px; }
h2.title { font-size: 19px; margin: 4px 0 4px; }
p.sub { color: var(--muted); font-size: 13px; margin: 0 0 20px; }
label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 6px; }
input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  transition: border .15s, box-shadow .15s;
}
input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(8,145,178,.15); }
button.primary {
  width: 100%;
  margin-top: 20px;
  padding: 12px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
button.primary:disabled { opacity: .6; cursor: default; }
.link-row { text-align: center; margin-top: 14px; }
.link-row a { font-size: 13px; color: var(--primary); text-decoration: none; cursor: pointer; }
.msg { margin-top: 14px; font-size: 13px; padding: 10px 12px; border-radius: 9px; display: none; }
.msg.err { display: block; background: #fef2f2; color: var(--danger); }
.msg.ok { display: block; background: #ecfdf5; color: var(--ok); }
/* dashboard / mosaico */
.dash { max-width: 1280px; margin: 0 auto; padding: 24px 20px; color: #e2e8f0; }
.dash-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 12px; flex-wrap: wrap; }
.dash-top h1 { font-size: 20px; margin: 0; }
.dash-top .hi { color: #94a3b8; font-size: 13px; margin-right: 8px; }
.dash button { background: rgba(255,255,255,.08); color: #e2e8f0; border: 1px solid rgba(255,255,255,.15); padding: 8px 14px; border-radius: 9px; cursor: pointer; font-size: 13px; margin-left: 6px; }
.dash button:hover { background: rgba(255,255,255,.14); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 16px; }
.loading, .empty { grid-column: 1/-1; text-align: center; color: #94a3b8; padding: 48px 0; }
.empty button { margin: 14px auto 0; }

.cam { background: #0b1220; border: 1px solid rgba(255,255,255,.1); border-radius: 14px; overflow: hidden; }
.cam-video { position: relative; aspect-ratio: 16/9; background: #000; }
.cam-video video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-offline { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: #475569; }
.cam-offline span { font-size: 34px; filter: grayscale(1); opacity: .6; }
.cam-offline small { font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.cam-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; gap: 10px; }
.cam-bar > div:first-child { min-width: 0; }
.cam-bar strong, .cam-bar small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cam-bar strong { font-size: 14px; }
.cam-bar small { font-size: 12px; color: #94a3b8; }
.cam-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.cam-actions .icon { background: transparent; border: 0; color: #64748b; cursor: pointer; font-size: 14px; margin: 0; padding: 4px; }
.cam-actions .icon:hover { color: #f87171; background: transparent; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #475569; display: inline-block; }
.dot.on { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.2); }
.dot.off { background: #64748b; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(2,6,23,.7); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal { background: #fff; color: var(--ink); width: 100%; max-width: 400px; border-radius: 14px; padding: 24px; max-height: calc(100vh - 32px); overflow-y: auto; }
.modal h3 { margin: 0 0 12px; }
.modal .hint { display: block; color: var(--muted); font-size: 12px; margin-top: 6px; }
.modal .hint code { background: #f1f5f9; padding: 1px 5px; border-radius: 4px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.modal-actions button { background: #f1f5f9; color: var(--ink); border: 1px solid var(--border); padding: 9px 14px; border-radius: 9px; cursor: pointer; font-size: 14px; }

/* mobile pequeno */
@media (max-width: 600px) {
  .dash { padding: 16px 12px; }
  .dash-top h1 { font-size: 18px; }
  .grid { gap: 12px; }
  .auth-card { padding: 26px 20px; }
  .modal-bg { padding: 10px; align-items: flex-start; padding-top: 16px; }
  .modal { padding: 20px; max-height: calc(100vh - 20px); }
}
