/* Onelink CloudCam — tema escuro com vermelho Onelink */
:root {
  --bg: #0f1114;
  --panel: #181b20;
  --panel-2: #1f232a;
  --line: #2b3039;
  --text: #e7e9ec;
  --muted: #8b929c;
  --accent: #c62f39;
  --accent-hover: #d93b46;
  --accent-text: #ff6b74;
  --ok: #2fb36a;
  --warn: #e0a72a;
  --danger: #e04545;
  --radius: 8px;
  --header-h: 54px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h2 { font-size: 18px; margin: 0; }
h3 { font-size: 16px; margin: 0; }
h4 { font-size: 13px; margin: 18px 0 8px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.grow { flex: 1 1 auto; }
.ok-text { color: var(--ok); }
.err-text { color: var(--danger); }

/* ---------- cabeçalho ---------- */
#top {
  position: sticky; top: 0; z-index: 20; height: var(--header-h);
  display: flex; align-items: center; gap: 18px; padding: 0 16px;
  background: #121418; border-bottom: 2px solid var(--accent);
}
#top:empty { display: none; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 700; letter-spacing: .02em; }
.brand:hover { text-decoration: none; }
.brand img { height: 30px; width: auto; }
.brand span { font-size: 15px; }
#top nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1 1 auto; }
#top nav a {
  color: var(--muted); padding: 7px 12px; border-radius: 6px; white-space: nowrap; font-weight: 500;
}
#top nav a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
#top nav a.active { color: #fff; background: var(--accent); }
.user { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
body.bare #top { display: none; }

#main { padding: 14px 16px 40px; max-width: 1800px; margin: 0 auto; }

/* ---------- botões e campos ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 6px 14px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; user-select: none;
}
.btn:hover:not(:disabled) { border-color: #444b57; background: #262b33; text-decoration: none; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.small { min-height: 30px; padding: 4px 10px; font-size: 13px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: #ff8c8c; }
.btn.danger:hover:not(:disabled) { background: #3a1d20; border-color: var(--danger); }
.btn.block { width: 100%; }
.icon-btn { background: none; border: 0; color: var(--muted); font-size: 18px; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.icon-btn:hover { color: var(--text); background: var(--panel-2); }
.link-btn { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 4px; }
.link-btn:hover { color: var(--text); }

input, select, textarea {
  font: inherit; color: var(--text); background: #11141a; border: 1px solid var(--line);
  border-radius: 6px; padding: 7px 10px; min-height: 34px; max-width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(198, 47, 57, .25); }
textarea { width: 100%; resize: vertical; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
input[type=checkbox] { min-height: 0; width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
input[type=date] { color-scheme: dark; }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; flex: 1 1 200px; min-width: 0; }
.field > input, .field > select, .field > textarea { width: 100%; }
.field-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.hint { color: var(--muted); font-size: 12px; }
.row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-start; }
.checks { display: flex; flex-direction: column; gap: 8px; padding-top: 20px; flex: 1 1 200px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.toolbar.tight { margin-bottom: 8px; }
.toolbar input[type=search] { flex: 0 1 240px; }

.chip {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; white-space: nowrap;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
}
.chip.ok { color: #7fe0a8; border-color: #245c3d; background: #13271c; }
.chip.warn { color: #f3cd72; border-color: #5e4a1c; background: #2a2210; }
.chip.err { color: #ff9a9a; border-color: #5d2427; background: #2a1416; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }

/* ---------- avisos ---------- */
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); }
.toast {
  background: var(--panel-2); border: 1px solid var(--line); border-left: 4px solid var(--ok);
  padding: 10px 14px; border-radius: 6px; box-shadow: 0 6px 24px rgba(0,0,0,.4);
  transition: opacity .3s, transform .3s; max-width: 420px;
}
.toast.err { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---------- janelas ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.6);
  display: flex; align-items: flex-start; justify-content: center; padding: 5vh 12px; overflow-y: auto;
}
.modal {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; width: 100%; max-width: 480px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5); display: flex; flex-direction: column; max-height: 90vh;
}
.modal.wide { max-width: 820px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 16px; overflow-y: auto; }
.modal-body p { margin: 0 0 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
details.section { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 14px; background: #14171c; }
details.section summary { cursor: pointer; font-weight: 600; margin-bottom: 4px; }
details.section[open] summary { margin-bottom: 12px; }
.test-box { border: 1px dashed var(--line); border-radius: var(--radius); padding: 10px; }

.checklist-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; background: #14171c; }
.checklist { max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; }
.check-row { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-bottom: 1px solid #22262d; cursor: pointer; }
.check-row:last-child { border-bottom: 0; }
.check-row:hover { background: #1b1f25; }
.check-row.off { opacity: .55; }

/* ---------- login ---------- */
.page-login { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px !important; }
.login-card {
  width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--accent);
  border-radius: 10px; padding: 28px 24px; box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.login-logo { display: block; max-width: 180px; max-height: 96px; margin: 0 auto 6px; }
.login-card h1 { text-align: center; font-size: 18px; margin: 0 0 22px; color: var(--muted); font-weight: 500; letter-spacing: .1em; text-transform: uppercase; }
.login-err { color: var(--danger); min-height: 20px; margin-bottom: 10px; font-size: 13px; }

/* ---------- ao vivo ---------- */
.pager { display: flex; align-items: center; gap: 6px; }
.grid { display: grid; gap: 6px; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); }
.tile {
  position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 6px; overflow: hidden;
  cursor: pointer; border: 1px solid #1d2128;
}
.tile:hover { border-color: var(--accent); }
.tile video, .cam-wrap video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.tile-name {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 8px 5px; font-size: 12px; font-weight: 600;
  background: linear-gradient(transparent, rgba(0,0,0,.75)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  pointer-events: none;
}
.tile-name small { font-weight: 400; color: #c4c8ce; }
.tile-status {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 13px; pointer-events: none; text-align: center; padding: 8px;
}
.cam-bar strong { font-size: 16px; }
.cam-wrap { position: relative; background: #000; border-radius: 6px; overflow: hidden; height: calc(100vh - var(--header-h) - 90px); min-height: 240px; }
body.bare .cam-wrap { height: calc(100vh - 70px); }
.cam-wrap:fullscreen { height: 100vh; border-radius: 0; }

/* ---------- gravações ---------- */
.cam-select { min-width: 200px; }
.pb-player { position: relative; background: #000; border-radius: 6px; overflow: hidden; aspect-ratio: 16 / 9; max-height: calc(100vh - 330px); width: 100%; }
.pb-player video { width: 100%; height: 100%; object-fit: contain; display: block; }
.pb-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); background: rgba(0,0,0,.4); pointer-events: none; }
.pb-time {
  position: absolute; top: 8px; right: 8px; padding: 3px 8px; border-radius: 4px; font-variant-numeric: tabular-nums;
  background: rgba(0,0,0,.65); font-size: 13px; font-weight: 600; pointer-events: none;
}
.pb-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 10px 0; }
.pb-controls select { min-width: 70px; }
.tl-bar { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }
.timeline { position: relative; height: 64px; user-select: none; touch-action: none; margin-bottom: 10px; }
.tl-axis { position: absolute; left: 0; right: 0; top: 0; height: 18px; font-size: 11px; color: var(--muted); }
.tl-axis span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.tl-axis span::after { content: ""; position: absolute; left: 50%; top: 16px; height: 5px; border-left: 1px solid #3a404a; }
.tl-track {
  position: absolute; left: 0; right: 0; top: 22px; bottom: 0; background: #14171c; border: 1px solid var(--line);
  border-radius: 6px; overflow: hidden; cursor: pointer;
}
.tl-rec { position: absolute; top: 0; bottom: 0; background: #2a5a8a; opacity: .85; pointer-events: none; }
.tl-ev { position: absolute; top: 0; height: 9px; background: var(--accent); border-radius: 0 0 2px 2px; cursor: pointer; min-width: 3px; }
.tl-ev.audio { background: var(--warn); top: auto; bottom: 0; height: 9px; border-radius: 2px 2px 0 0; }
.tl-head { position: absolute; top: 18px; bottom: 0; width: 2px; margin-left: -1px; background: #fff; pointer-events: none; box-shadow: 0 0 4px rgba(0,0,0,.8); }
.tl-head::before { content: ""; position: absolute; top: -2px; left: -5px; border: 6px solid transparent; border-top-color: #fff; }
.tl-hover {
  position: absolute; top: -22px; transform: translateX(-50%); font-size: 11px; background: #000; padding: 1px 6px;
  border-radius: 3px; pointer-events: none; white-space: nowrap;
}
.tl-preview {
  position: absolute; bottom: calc(100% + 26px); transform: translateX(-50%); width: 240px; background: #000; border: 2px solid var(--accent);
  border-radius: 6px; overflow: hidden; pointer-events: none; z-index: 5; box-shadow: 0 8px 30px rgba(0,0,0,.6);
}
.tl-preview img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #111; }
.tl-preview div { text-align: center; font-size: 12px; font-weight: 600; padding: 3px; font-variant-numeric: tabular-nums; }
.blocks-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.blocks { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 4px; }
.block {
  padding: 6px 4px; border-radius: 5px; border: 1px solid var(--line); background: #14171c; color: var(--muted);
  font: inherit; font-size: 12px; cursor: pointer; font-variant-numeric: tabular-nums;
}
.block.has { color: var(--text); background: #1a2633; border-color: #2a4561; }
.block.has:hover { border-color: #4a7bab; }
.block.cur { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.block:disabled { cursor: default; opacity: .5; }
.block small { color: var(--accent-text); }

/* ---------- eventos ---------- */
.ev-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-bottom: 14px; }
.ev-card {
  display: flex; flex-direction: column; text-align: left; padding: 0; overflow: hidden; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); font: inherit;
}
.ev-card:hover { border-color: var(--accent); }
.ev-card.audio { border-color: #5e4a1c; }
.ev-img { position: relative; aspect-ratio: 16 / 9; background: #000; }
.ev-img { overflow: hidden; }
.ev-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.noimg { height: 100%; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 22px; }
.badge {
  position: absolute; left: 6px; top: 6px; padding: 2px 7px; border-radius: 4px; font-size: 11px; font-weight: 700;
  background: rgba(0,0,0,.7);
}
.badge.audio { background: var(--warn); color: #1b1300; }
.badge.live { left: auto; right: 6px; background: var(--accent); }
.ev-info { display: flex; justify-content: space-between; gap: 6px; padding: 7px 9px; font-size: 12px; }
.ev-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-info span { color: var(--muted); white-space: nowrap; }
.ev-big { width: 100%; border-radius: 6px; display: block; background: #000; }
.ev-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 6px 16px; margin: 12px 0; }
.ev-audio { width: 100%; }

/* ---------- administração ---------- */
.status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.stat-title { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.stat-value { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.bar { height: 6px; background: #262a31; border-radius: 3px; overflow: hidden; margin: 6px 0; }
.bar div { height: 100%; background: var(--accent); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: 12px; color: var(--muted); font-weight: 600; background: #14171c; white-space: nowrap; }
.table tbody tr:hover { background: #1a1d23; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.off td { opacity: .55; }
.table td.actions { white-space: nowrap; text-align: right; }
.table td.actions .btn + .btn { margin-left: 4px; }

/* ---------- celular ---------- */
@media (max-width: 760px) {
  #top { gap: 8px; padding: 0 10px; }
  .brand span { display: none; }
  .user .link-btn { display: none; }
  #main { padding: 10px 8px 30px; }
  .grid { grid-template-columns: repeat(min(var(--cols, 2), 2), minmax(0, 1fr)) !important; gap: 4px; }
  .toolbar input[type=search] { flex: 1 1 100%; }
  .pb-player { max-height: none; }
  .cam-select { min-width: 0; flex: 1 1 100%; }
  .modal-back { padding: 0; }
  .modal { max-height: 100vh; border-radius: 0; min-height: 100vh; }
  .ev-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .tl-preview { width: 180px; }
}

/* ---------- reconhecimento facial ---------- */
.accent { color: var(--accent-text); }
.nowrap { white-space: nowrap; }
.btn.ok { color: #7fe0a8; }
.btn.ok:hover:not(:disabled) { background: #13271c; border-color: var(--ok); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tab {
  background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); font: inherit; font-weight: 600;
  padding: 8px 14px; cursor: pointer; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.wl-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }
.wl-side { display: flex; flex-direction: column; gap: 6px; position: sticky; top: calc(var(--header-h) + 10px); }
.wl-item {
  display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 10px 12px; cursor: pointer; font: inherit;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text);
}
.wl-item:hover { border-color: #444b57; }
.wl-item.active { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.wl-item.off { opacity: .6; }
.wl-item small { font-size: 12px; }
.person-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.person-card {
  display: flex; flex-direction: column; text-align: left; padding: 0; overflow: hidden; cursor: pointer; font: inherit;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text);
}
.person-card:hover { border-color: var(--accent); }
.person-card.off { opacity: .55; }
.person-img { aspect-ratio: 1; background: #0b0d10; }
.person-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.person-img .noimg { font-size: 40px; }
.person-info { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; }
.person-info small { font-size: 12px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-bottom: 8px; }
.photo { position: relative; background: #0b0d10; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; display: flex; flex-direction: column; align-items: center; gap: 4px; padding-bottom: 6px; }
.photo img, .photo .noimg { width: 100%; aspect-ratio: 1; object-fit: cover; display: flex; }
.photo .chip { font-size: 11px; max-width: 96%; overflow: hidden; text-overflow: ellipsis; }
.photo-del { position: absolute; top: 2px; right: 2px; background: rgba(0,0,0,.6); font-size: 14px; padding: 2px 6px; }
.face-compare { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.face-compare figure { margin: 0; text-align: center; }
.face-compare img, .face-compare .noimg { width: 170px; height: 170px; object-fit: cover; border-radius: 8px; border: 2px solid var(--line); background: #0b0d10; display: flex; }
.face-compare figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; }
.sim-big { display: flex; flex-direction: column; align-items: center; }
.sim-big strong { font-size: 30px; color: var(--accent-text); }
.sim-big span { font-size: 12px; color: var(--muted); }
.review-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-top: 12px; background: #14171c; }
.review-box h4 { margin-top: 0; }
.review-box textarea { margin: 8px 0; font-family: inherit; }
.ev-card.face { border-color: #2a4561; }
.ev-img img.contain { object-fit: contain; background: #0b0d10; }
.badge.face { background: #2a5a8a; color: #fff; }
.badge.sim { left: auto; right: 6px; background: rgba(0,0,0,.75); }
.badge.rev { top: auto; bottom: 6px; }
.badge.rev.confirmado { background: var(--ok); color: #04150b; }
.badge.rev.falso_positivo { background: #555; }
@media (max-width: 760px) {
  .wl-layout { grid-template-columns: 1fr; }
  .wl-side { position: static; }
  .person-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .face-compare img, .face-compare .noimg { width: 120px; height: 120px; }
}

.btn.off { opacity: .6; }

/* ---------- cadastro de clientes ---------- */
.modal-body h4.first { margin-top: 0; }
.svc-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.svc-checks .check {
  align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #14171c;
  flex-wrap: wrap;
}
.svc-checks .check:has(input:checked) { border-color: var(--accent); background: #24161a; }
.svc-checks .check small { flex-basis: 100%; padding-left: 24px; font-size: 12px; }
.svc-checks .check input { margin-top: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip.svc { color: #ffb3b8; border-color: #5d2427; background: #24161a; }
input.invalid { border-color: var(--danger); }
.field-err { color: var(--danger); font-size: 12px; }
.toolbar input.wide { flex: 1 1 380px; max-width: 520px; }

/* ---------- central de alarmes ---------- */
.btn.danger-solid { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger-solid:hover:not(:disabled) { background: var(--accent-hover); }
.btn.primary-ok { background: #1f7a4a; border-color: #1f7a4a; color: #fff; }
.btn.primary-ok:hover:not(:disabled) { background: #26905a; }
.alarm-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 12px; margin-bottom: 18px; }
.alarm-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.alarm-card.selected { border-color: #4a5568; box-shadow: inset 0 3px 0 var(--accent); cursor: default; }
.alarm-cards .alarm-card:not(.selected) { cursor: pointer; }
.alarm-card.trig { border-color: var(--danger); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px rgba(224, 69, 69, .35); } }
.alarm-head { display: flex; align-items: flex-start; gap: 10px; }
.alarm-head h3 { font-size: 17px; }
.parts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.part { border-radius: 8px; padding: 10px 12px; border: 1px solid var(--line); background: #14171c; }
.part.armed { border-color: #245c3d; background: #13271c; }
.part.trig { border-color: var(--danger); background: #3a1416; }
.part-state { font-size: 18px; font-weight: 700; }
.part.armed .part-state { color: #7fe0a8; }
.part.trig .part-state { color: #ff8c8c; }
.part-btns { margin-top: 8px; }
.zones { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; }
.alarm-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.pin-input { font-size: 22px; letter-spacing: .4em; text-align: center; }
.cmd-msg { min-height: 20px; font-size: 14px; }
.cmd-msg.ok { color: #7fe0a8; } .cmd-msg.err { color: #ff8c8c; } .cmd-msg.wait { color: var(--warn); }
.hist { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 10px; }
.hist-day { padding: 6px 12px; background: #14171c; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.hist-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 12px; border-top: 1px solid #22262d; background: var(--panel); }
.hist-icon { width: 22px; text-align: center; }
.hist-time { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 64px; }
.hist-row.perigo { background: #2a1416; } .hist-row.perigo strong { color: #ff9a9a; }
.hist-row.aviso strong { color: #f3cd72; }
.hist-row.ok strong { color: #7fe0a8; }
.hist-row.suave { opacity: .75; }
.notice { border: 1px solid #5e4a1c; background: #2a2210; border-radius: var(--radius); padding: 10px 12px; margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
@media (max-width: 760px) {
  .alarm-cards { grid-template-columns: 1fr; }
  .alarm-foot .btn { flex: 1 1 auto; }
}

/* ---------- streams (MediaMTX) ---------- */
.stream-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 12px; }
.stream-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.stream-name { word-break: break-all; }
table.kv { width: 100%; border-collapse: collapse; font-size: 13px; }
table.kv td { padding: 4px 0; border-bottom: 1px solid #22262d; vertical-align: top; }
table.kv tr:last-child td { border-bottom: 0; }
table.kv td:first-child { color: var(--muted); width: 40%; }
table.kv .chip { margin: 0 4px 2px 0; }
.err-box { border-color: var(--danger); background: #2a1416; }
.modal.wide-live { max-width: 1100px; }
.cam-wrap.modal-live { height: auto; aspect-ratio: 16 / 9; min-height: 0; }
@media (max-width: 760px) { .stream-grid { grid-template-columns: 1fr; } }
.alarm-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }

/* ---------- rodapé da empresa (Ao vivo) ---------- */
footer.company {
  display: flex; flex-wrap: wrap; align-items: center; gap: 24px; margin-top: 28px; padding: 20px;
  background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: 10px;
}
.company-logo { background: #fff; border-radius: 8px; padding: 14px 18px; flex: 0 1 340px; }
.company-logo img { display: block; width: 100%; height: auto; }
.company-info { flex: 1 1 260px; display: flex; flex-wrap: wrap; gap: 14px 32px; align-items: flex-start; }
.company-info h3 { flex-basis: 100%; margin: 0; font-size: 15px; text-transform: uppercase; letter-spacing: .05em; color: var(--accent-text); }
.company-item { display: flex; flex-direction: column; gap: 2px; }
.company-item a.plain { color: var(--text); }
.company-item a.plain:hover { color: var(--accent-text); text-decoration: none; }
@media (max-width: 760px) {
  footer.company { padding: 14px; gap: 16px; }
  .company-logo { flex-basis: 100%; }
}
