:root {
  --bg-base: #0a0d14;
  --bg-surface: #111622;
  --bg-card: #161c2d;
  --bg-card-hover: #1c243a;
  --border-color: #232c42;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --accent-cyan: #00f0ff;
  --accent-cyan-glow: rgba(0, 240, 255, 0.25);
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-amber: #f59e0b;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 12px;
  line-height: 1.4;
  background-color: var(--bg-base);
  color: var(--text-main);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* NAVBAR */
.navbar {
  height: 52px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  flex-shrink: 0;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-logo {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.2), rgba(16, 185, 129, 0.2));
  border: 1px solid var(--accent-cyan);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan-glow);
}

.brand-logo svg {
  width: 18px;
  height: 18px;
}

.brand-text h1 {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #fff;
  line-height: 1.2;
}

.brand-text span {
  font-size: 9px;
  color: var(--accent-cyan);
  letter-spacing: 0.5px;
  font-weight: 600;
  display: block;
}

/* TABS */
.nav-tabs {
  display: flex;
  gap: 4px;
  align-items: center;
}

.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  white-space: nowrap;
}

.tab-btn svg {
  width: 14px;
  height: 14px;
}

.tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  color: #fff;
  background: var(--bg-card);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan-glow);
}

/* WIDGETS */
.header-widgets {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.storage-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.storage-icon {
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
}

.storage-icon svg {
  width: 13px;
  height: 13px;
}

.storage-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 90px;
}

.storage-label {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.1;
}

.progress-bar {
  height: 3px;
  background: #232c42;
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-green));
  transition: width 0.3s;
}

.storage-sub {
  font-size: 8px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.1;
}

.node-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--accent-green);
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-green);
  border-radius: 50%;
}

.status-dot.pulse {
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* MAIN CONTENT */
.main-content {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.tab-pane {
  display: none;
  height: 100%;
  padding: 10px 16px;
  flex-direction: column;
  overflow-y: auto;
}

.tab-pane.active {
  display: flex;
}

/* TOOLBAR */
.pane-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-shrink: 0;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 500;
  font-size: 11px;
}

.grid-selectors {
  display: flex;
  align-items: center;
  gap: 4px;
}

.toolbar-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  margin-right: 2px;
}

.grid-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.grid-btn:hover, .grid-btn.active {
  background: var(--accent-cyan);
  color: #000;
  border-color: var(--accent-cyan);
}

.toolbar-actions {
  display: flex;
  gap: 6px;
}

.btn {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-cyan);
  color: #000;
  font-weight: 600;
}

.btn-primary:hover {
  background: #33f3ff;
  box-shadow: 0 0 10px var(--accent-cyan-glow);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: #3b4763;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 11px;
}

/* ÁREA DE TRABALHO DO MOSAICO & GAVETA RETRÁTIL */
.live-workspace {
  position: relative;
  display: flex;
  flex: 1;
  width: 100%;
  min-height: 520px;
  height: 100%;
  overflow: hidden;
  background: #060910;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

/* GATILHO DA GAVETA (Borda esquerda para hover) */
.drawer-trigger-tab {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-left: none;
  padding: 14px 6px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  cursor: pointer;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transition: all 0.2s ease;
  user-select: none;
}

.drawer-trigger-tab:hover {
  background: var(--accent-cyan);
  color: #000;
  box-shadow: 0 0 12px var(--accent-cyan-glow);
}

/* GAVETA LATERAL RETRÁTIL */
.live-drawer {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 6.5cm;
  min-width: 250px;
  max-width: 270px;
  height: 100%;
  max-height: 100%;
  background: rgba(14, 18, 28, 0.97);
  backdrop-filter: blur(14px);
  border-right: 1px solid var(--border-color);
  box-shadow: 6px 0 25px rgba(0, 0, 0, 0.6);
  z-index: 50;
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.live-drawer.open,
.live-drawer.pinned {
  transform: translateX(0);
}

.drawer-header {
  flex-shrink: 0;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.2);
}

.drawer-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.drawer-title svg {
  color: var(--accent-cyan);
}

.drawer-pin-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.drawer-pin-btn:hover,
.drawer-pin-btn.active {
  color: var(--accent-cyan);
  border-color: rgba(6, 182, 212, 0.3);
  background: rgba(6, 182, 212, 0.1);
}

.drawer-search {
  flex-shrink: 0;
  padding: 10px 14px;
  position: relative;
  display: flex;
  align-items: center;
}

.drawer-search svg {
  position: absolute;
  left: 24px;
  color: var(--text-muted);
  pointer-events: none;
}

.drawer-search input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 7px 12px 7px 32px;
  font-size: 12px;
  color: #fff;
  outline: none;
  transition: border-color 0.2s;
}

.drawer-search input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan-glow);
}

.drawer-group-header {
  flex-shrink: 0;
  padding: 6px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.group-badge {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 10px;
}

.camera-drag-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 8px 30px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 240, 255, 0.35) rgba(0, 0, 0, 0.25);
}

.camera-drag-item {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  min-height: 32px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: grab;
  user-select: none;
  transition: all 0.18s ease;
}

.camera-drag-item.selected {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.12);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.15);
}

/* Câmeras que já foram selecionadas e estão no Mosaico (Cinza / Em Uso) */
.camera-drag-item.in-mosaic {
  background: rgba(51, 65, 85, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.3);
  opacity: 0.82;
}

.camera-drag-item.in-mosaic .camera-item-name {
  color: #94a3b8 !important;
}

.camera-drag-item.in-mosaic .camera-item-meta {
  color: #64748b !important;
}

.camera-drag-item.in-mosaic:hover {
  background: rgba(51, 65, 85, 0.65);
  border-color: rgba(148, 163, 184, 0.5);
  opacity: 1;
}

.mosaic-active-tag {
  font-size: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.camera-item-btn.in-mosaic-btn {
  background: rgba(148, 163, 184, 0.15) !important;
  border-color: rgba(148, 163, 184, 0.35) !important;
  color: #94a3b8 !important;
}

.camera-item-btn.in-mosaic-btn:hover {
  background: rgba(148, 163, 184, 0.3) !important;
  color: #fff !important;
}

.camera-drag-item:active {
  cursor: grabbing;
}

.camera-drag-item:hover {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.06);
  transform: translateX(2px);
}

.camera-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.drag-handle-dots {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1;
  letter-spacing: -2px;
  opacity: 0.5;
}

.camera-item-details {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.camera-item-name {
  font-size: 11px;
  font-weight: 500;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.camera-item-meta {
  font-size: 9px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.camera-item-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 4px;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.camera-item-btn:hover {
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.15);
}

.drawer-hint {
  flex-shrink: 0;
  padding: 10px 14px;
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.25);
  border-top: 1px solid var(--border-color);
  line-height: 1.4;
}

.drawer-hint svg {
  flex-shrink: 0;
  color: var(--accent-cyan);
}

/* MENU DE LAYOUTS (Estilo Screenshot Plenus Cloud) */
.layout-menu-wrapper {
  position: relative;
  display: inline-block;
}

.layout-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(20, 25, 38, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.layout-trigger-btn:hover {
  background: rgba(30, 38, 56, 0.95);
  border-color: var(--accent-cyan);
  color: #fff;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.15);
}

.layout-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 1000;
  min-width: 210px;
  background: #171d2b;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.05);
  flex-direction: column;
  gap: 2px;
  animation: fadeInDown 0.15s ease forwards;
}

.layout-dropdown-menu.show {
  display: flex;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.layout-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #c5cedb;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}

.layout-menu-item svg {
  flex-shrink: 0;
  color: #8f9bb3;
  transition: color 0.15s ease;
}

.layout-menu-item:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
}

.layout-menu-item:hover svg {
  color: var(--accent-cyan);
}

.layout-menu-item.active {
  background: rgba(0, 240, 255, 0.12);
  border-color: rgba(0, 240, 255, 0.3);
  color: var(--accent-cyan);
  font-weight: 600;
}

.layout-menu-item.active svg {
  color: var(--accent-cyan);
}

.layout-menu-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 4px 0;
}

/* MOSAIC CONTAINER & SLOTS */
.mosaic-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 8px;
  overflow: hidden;
  height: 100%;
  min-height: 0;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.camera-grid {
  display: grid;
  gap: 8px;
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
  box-sizing: border-box;
}

/* Grades Pré-definidas com altura e largura proporcionais */
.camera-grid.layout-1x1 {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}

.camera-grid.layout-2x2 {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

.camera-grid.layout-2x3 {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

.camera-grid.layout-3x3 {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
}

.camera-grid.layout-4x4 {
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
}

.camera-grid.layout-1x4x4 {
  grid-template-columns: 3fr 1fr;
  grid-template-rows: repeat(4, 1fr);
}

.camera-grid.layout-1x4x4 > :first-child {
  grid-column: 1 / 2;
  grid-row: 1 / 5;
}

/* SLOTS VAZIOS (Dropzone idêntico ao comercial) */
.empty-slot {
  background: rgba(14, 18, 28, 0.45);
  border: 1.5px dashed rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-md);
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.empty-slot:hover {
  border-color: rgba(6, 182, 212, 0.6);
  background: rgba(6, 182, 212, 0.04);
}

.empty-slot.slot-dragover {
  border-color: var(--accent-cyan);
  border-style: solid;
  background: rgba(6, 182, 212, 0.14);
  box-shadow: 0 0 20px var(--accent-cyan-glow);
  transform: scale(0.995);
}

.empty-slot-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  text-align: center;
  padding: 12px;
  pointer-events: none;
}

.empty-slot-icon {
  color: rgba(255, 255, 255, 0.25);
  transition: transform 0.2s, color 0.2s;
}

.empty-slot:hover .empty-slot-icon {
  color: var(--accent-cyan);
  transform: scale(1.08);
}

.empty-slot-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.empty-slot:hover .empty-slot-title {
  color: #fff;
}

.empty-slot-hint {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
}

/* TELA DE VÍDEO OCUPADA */
.cam-tile {
  background: #000;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
}

.cam-tile:hover {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.15);
}

.close-slot-btn {
  background: rgba(10, 13, 20, 0.8) !important;
  color: #f87171 !important;
  border: 1px solid rgba(239, 68, 68, 0.3) !important;
  font-size: 12px !important;
  padding: 2px 7px !important;
  pointer-events: auto !important;
}

.close-slot-btn:hover {
  background: #ef4444 !important;
  color: #fff !important;
  border-color: #ef4444 !important;
}

.cam-video-container {
  width: 100%;
  height: 100%;
  position: relative;
  background: #000;
}

.cam-video-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* OVERLAYS NA CÂMERA */
.cam-top-bar {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  z-index: 10;
}

.cam-name-badge {
  background: rgba(10, 13, 20, 0.75);
  backdrop-filter: blur(4px);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.cam-ecam-badge {
  background: rgba(16, 185, 129, 0.85);
  backdrop-filter: blur(4px);
  color: #fff;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.cam-bottom-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(10, 13, 20, 0.95), transparent);
  padding: 14px 10px 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 10;
}

.cam-tile:hover .cam-bottom-bar {
  opacity: 1;
}

.cam-actions-left, .cam-actions-right {
  display: flex;
  gap: 6px;
}

.tile-action-btn {
  background: rgba(22, 28, 45, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
}

.tile-action-btn:hover {
  background: var(--accent-cyan);
  color: #000;
  border-color: var(--accent-cyan);
}

.tile-action-btn.rec-active {
  background: rgba(239, 68, 68, 0.25);
  border-color: var(--accent-red);
  color: #ff6b6b;
}

.tile-action-btn.ia-active {
  background: rgba(16, 185, 129, 0.25);
  border-color: var(--accent-green);
  color: #34d399;
}

/* ABA PLAYBACK */
.playback-layout {
  display: flex;
  gap: 18px;
  flex: 1;
  height: 100%;
  overflow: hidden;
}

.playback-sidebar {
  width: 320px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex-shrink: 0;
  overflow-y: auto;
}

.playback-sidebar h3 {
  font-size: 14px;
  font-weight: 700;
  margin: 0;
}

.sidebar-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-cyan);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  color: var(--text-muted);
}

.form-control {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
}

.form-control:focus {
  border-color: var(--accent-cyan);
}

/* Playback Time Filter & Export Enhancements */
.playback-filter-card,
.playback-export-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.playback-export-card {
  border-color: rgba(0, 212, 255, 0.35);
  background: linear-gradient(180deg, rgba(0, 212, 255, 0.06) 0%, rgba(10, 15, 29, 0.5) 100%);
}

.filter-card-header,
.export-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-cyan);
}

.selected-range-display {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.selected-range-time {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.selected-range-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
}

.status-indicator {
  font-size: 11px;
  font-weight: 600;
}

.status-indicator.available {
  color: #00e676;
}

.status-indicator.empty {
  color: #ff5252;
}

.status-indicator.loading {
  color: var(--accent-cyan);
}

.time-range-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.time-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.time-field label {
  font-size: 11px;
  color: var(--text-muted);
}

.time-field input[type="time"] {
  width: 100%;
  padding: 6px 8px;
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
  text-align: center;
  color-scheme: dark;
}

.time-sep {
  font-size: 11px;
  color: var(--text-muted);
  align-self: flex-end;
  padding-bottom: 8px;
}

.quick-time-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.btn-time-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  padding: 5px 2px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.btn-time-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-time-chip.active {
  background: rgba(0, 212, 255, 0.2);
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
  font-weight: 600;
}

.filter-actions {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}

.filter-actions .btn {
  flex: 1;
  justify-content: center;
}

.btn-ghost {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  transition: all 0.15s;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.export-status-msg {
  font-size: 11px;
  padding: 7px 10px;
  border-radius: 4px;
  text-align: center;
  line-height: 1.3;
}

.export-status-msg.loading {
  background: rgba(0, 212, 255, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 212, 255, 0.3);
}

.export-status-msg.success {
  background: rgba(0, 230, 118, 0.12);
  color: #00e676;
  border: 1px solid rgba(0, 230, 118, 0.3);
}

.export-status-msg.error {
  background: rgba(255, 82, 82, 0.12);
  color: #ff5252;
  border: 1px solid rgba(255, 82, 82, 0.3);
}

.file-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
}

.playback-file-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 120px;
}

.file-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.file-item:hover, .file-item.active {
  background: var(--bg-card-hover);
  border-color: var(--accent-cyan);
}

.file-item-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.file-item-time {
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  display: flex;
  align-items: center;
  gap: 5px;
}

.file-item-time svg {
  color: var(--accent-cyan);
  flex-shrink: 0;
}

.file-item-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
}

.file-item-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.btn-file-download {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: 4px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

.btn-file-download:hover {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
  color: #000;
}

.empty-hint {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 15px;
}

.playback-player-panel {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.player-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.player-title-box {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.player-meta-badge {
  background: rgba(0, 212, 255, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 212, 255, 0.3);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
}

.export-action-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-wrapper {
  flex: 1;
  background: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  position: relative;
  min-height: 480px;
}

.player-wrapper video {
  width: 100%;
  height: 100%;
}

.player-empty-placeholder {
  width: 100%;
  height: 100%;
  min-height: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 30px;
  background: radial-gradient(circle at center, rgba(14, 165, 233, 0.05) 0%, rgba(10, 15, 29, 0.96) 100%);
}

.player-empty-placeholder svg {
  color: var(--accent-cyan);
  opacity: 0.6;
  margin-bottom: 6px;
}

.player-empty-placeholder p {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  margin: 0;
}

.player-empty-placeholder span {
  font-size: 13px;
  max-width: 440px;
  line-height: 1.5;
  color: var(--text-muted);
}

.player-empty-placeholder strong {
  color: var(--accent-cyan);
}

.player-quick-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  gap: 10px;
  flex-wrap: wrap;
}

.quick-ctrl-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-ctrl {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.btn-ctrl:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}

.btn-stop {
  color: #ff5252 !important;
  border-color: rgba(255, 82, 82, 0.35) !important;
  background: rgba(255, 82, 82, 0.08) !important;
}

.btn-stop:hover {
  background: rgba(255, 82, 82, 0.2) !important;
  border-color: #ff5252 !important;
  color: #fff !important;
}

.quick-ctrl-speed {
  display: flex;
  align-items: center;
  gap: 6px;
}

.speed-label {
  font-size: 11px;
  color: var(--text-muted);
}

.btn-speed {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-speed:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.btn-speed.active {
  background: var(--accent-cyan);
  color: #000;
  border-color: var(--accent-cyan);
  font-weight: 700;
}

/* ABA CÂMERAS & TABELA */
.pane-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th, .data-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge {
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
}

.badge-online { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.badge-offline { background: rgba(239, 68, 68, 0.2); color: #f87171; }

/* ABA e-Cam IFRAME */
.ecam-embed-container {
  width: 100%;
  height: 100%;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.ecam-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* MODAL */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}

.modal.show { display: flex; }

.modal-dialog {
  width: 100%;
  max-width: 500px;
  margin: auto;
}

.modal-dialog.modal-lg {
  max-width: 660px;
}

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 80vh;
  overflow-y: auto;
}

.form-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding-bottom: 6px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
  margin-top: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-row .flex-2 {
  grid-column: span 1;
}

@media (max-width: 580px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

.password-toggle-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-toggle-wrapper .form-control {
  padding-right: 38px;
}

.eye-btn {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

.eye-btn:hover {
  color: var(--accent-cyan);
}

.advanced-toggle-bar {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  accent-color: var(--accent-cyan);
  width: 15px;
  height: 15px;
}

.btn-test {
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan);
  font-weight: 600;
}

.btn-test:hover {
  background: rgba(6, 182, 212, 0.25);
  box-shadow: 0 0 10px var(--accent-cyan-glow);
}

.probe-result-box {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.5;
  transition: all 0.2s ease;
}

.probe-result-box.loading {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid #3b82f6;
  color: #60a5fa;
}

.probe-result-box.success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid #10b981;
  color: #34d399;
}

.probe-result-box.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid #ef4444;
  color: #f87171;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.footer-left {
  display: flex;
  align-items: center;
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* RESPONSIVIDADE COMPLETA DO SISTEMA */
@media (max-width: 1024px) {
  .navbar {
    height: auto;
    padding: 10px 16px;
    flex-wrap: wrap;
    gap: 10px;
  }
  .header-widgets {
    gap: 10px;
  }
  .node-badge {
    display: none;
  }
  .storage-sub {
    display: none;
  }
}

@media (max-width: 768px) {
  body {
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
  }

  .navbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 14px;
  }

  .brand {
    justify-content: center;
  }

  .nav-tabs {
    justify-content: center;
    overflow-x: auto;
    padding-bottom: 2px;
    flex-wrap: wrap;
  }

  .header-widgets {
    justify-content: center;
    width: 100%;
  }

  .storage-badge {
    flex: 1;
    justify-content: center;
  }

  .pane-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    height: auto;
    padding: 10px 12px;
  }

  .toolbar-left, .toolbar-actions {
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    gap: 8px;
  }

  .live-workspace {
    height: calc(100vh - 180px);
    min-height: 480px;
  }

  .live-drawer {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 150;
    max-width: 85vw;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.8);
  }

  .playback-layout {
    flex-direction: column;
    height: auto;
  }

  .playback-sidebar {
    width: 100%;
    max-height: 300px;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }

  .playback-stage {
    min-height: 360px;
  }

  .modal-dialog {
    max-width: 95vw !important;
    margin: 10px auto;
  }

  .modal-body {
    padding: 14px;
    max-height: 75vh;
  }

  .form-row {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  .modal-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .footer-left, .footer-right {
    width: 100%;
    justify-content: stretch;
  }

  .footer-left .btn, .footer-right .btn {
    flex: 1;
    text-align: center;
    justify-content: center;
  }

  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ==================== PASTAS DE ZONAS NA GAVETA LATERAL ==================== */
.drawer-zone-group {
  margin-bottom: 6px;
  border-radius: var(--radius-sm);
  background: rgba(17, 22, 34, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
  transition: all 0.22s ease;
  position: relative;
  flex-shrink: 0;
}

.drawer-zone-group.expanded {
  flex-shrink: 0;
  border-color: var(--accent-cyan);
  background: rgba(13, 18, 28, 0.98);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8), 0 0 12px rgba(0, 240, 255, 0.3);
  z-index: 10;
}

.drawer-zone-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: rgba(22, 28, 45, 0.7);
  cursor: pointer;
  user-select: none;
  transition: background 0.18s ease;
}

.drawer-zone-header:hover {
  background: rgba(35, 44, 66, 0.8);
}

.drawer-zone-group.expanded .drawer-zone-header {
  background: rgba(0, 240, 255, 0.1);
  border-bottom: 1px solid rgba(0, 240, 255, 0.2);
}

.drawer-zone-header-left {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.drawer-zone-arrow {
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.drawer-zone-group.expanded .drawer-zone-arrow {
  transform: rotate(90deg);
  color: var(--accent-cyan);
}

.drawer-zone-name {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-zone-group.expanded .drawer-zone-name {
  color: var(--accent-cyan);
}

.drawer-zone-count {
  font-size: 9.5px;
  background: rgba(0, 240, 255, 0.15);
  color: var(--accent-cyan);
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 600;
}

.drawer-zone-items {
  display: none;
  flex-direction: column;
  gap: 3px;
  padding: 6px 4px 6px 6px;
  background: rgba(10, 13, 20, 0.7);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #00f0ff rgba(0, 0, 0, 0.5);
}

.drawer-zone-group.expanded .drawer-zone-items {
  display: flex;
  height: 290px; /* ~7cm na régua física do usuário, comportando todas as 7 câmeras */
  min-height: 290px;
  max-height: 290px;
}

/* Scrollbars modernos para lista geral e dentro de cada zona */
.camera-drag-list::-webkit-scrollbar,
.drawer-zone-items::-webkit-scrollbar {
  width: 7px;
}

.camera-drag-list::-webkit-scrollbar-track,
.drawer-zone-items::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.45);
  border-radius: 4px;
}

.camera-drag-list::-webkit-scrollbar-thumb,
.drawer-zone-items::-webkit-scrollbar-thumb {
  background: #00f0ff;
  border-radius: 4px;
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.7);
}

.camera-drag-list::-webkit-scrollbar-thumb:hover,
.drawer-zone-items::-webkit-scrollbar-thumb:hover {
  background: #ffffff;
  box-shadow: 0 0 10px #ffffff;
}

/* ==================== MATRIZ DE PERMISSÕES DE USUÁRIOS ==================== */
.permission-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
  padding: 8px;
  background: rgba(10, 13, 20, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.permission-check-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
}

.permission-check-card:hover {
  border-color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.05);
}

.permission-check-card input[type="checkbox"] {
  accent-color: var(--accent-cyan);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.permission-check-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.permission-check-meta {
  font-size: 10px;
  color: var(--text-muted);
  margin-left: auto;
}

/* ==================== PERFIL DO USUÁRIO & BOTÃO SAIR ==================== */
.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background: rgba(22, 28, 45, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-left: 6px;
  flex-shrink: 0;
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-cyan), #3b82f6);
  color: #0a0d14;
  font-weight: 800;
  font-size: 11.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 8px var(--accent-cyan-glow);
  flex-shrink: 0;
}

.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.user-meta-name {
  font-size: 11.5px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}

.user-meta-role {
  font-size: 9px;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ff6b6b;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: 4px;
  flex-shrink: 0;
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
  color: #fff;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
  transform: translateY(-1px);
}

.logout-btn:active {
  transform: translateY(0);
}

/* ==================== TELA DE LOGIN OBRIGATÓRIA (OVERLAY) ==================== */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: radial-gradient(circle at 50% 30%, #161c2d 0%, #0a0d14 85%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(12px);
  animation: fadeIn 0.25s ease-out;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: rgba(17, 22, 34, 0.95);
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: 0 0 40px rgba(0, 240, 255, 0.12), 0 20px 40px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 20px;
}

.login-logo {
  width: 58px;
  height: 58px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.2), rgba(16, 185, 129, 0.2));
  border: 1px solid var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
  box-shadow: 0 0 20px var(--accent-cyan-glow);
  margin-bottom: 14px;
}

.login-brand h2 {
  font-size: 19px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.5px;
}

.login-brand span {
  font-size: 10px;
  color: var(--accent-cyan);
  letter-spacing: 1.5px;
  font-weight: 600;
  margin-top: 2px;
}

.login-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 240, 255, 0.3), transparent);
  margin-bottom: 18px;
}

.login-instruction {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 22px;
  line-height: 1.4;
}

.input-icon-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
}

.form-control.with-icon {
  padding-left: 38px;
}

.form-control.with-eye {
  padding-right: 40px;
}

.input-icon-wrapper .eye-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.18s;
}

.input-icon-wrapper .eye-btn:hover {
  color: var(--accent-cyan);
}

.btn-block {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 0 20px var(--accent-cyan-glow);
}

.login-error-box {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #ff6b6b;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  margin-bottom: 16px;
  text-align: center;
  animation: shake 0.3s ease;
}

.login-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* ==================== MODO TELA CHEIA (FULLSCREEN) ==================== */
/* 1. Mosaico Inteiro em Tela Cheia */
.live-workspace:fullscreen,
.live-workspace:-webkit-full-screen,
.live-workspace.pseudo-fullscreen {
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  background: #000 !important;
  padding: 0 !important;
  margin: 0 !important;
  position: fixed !important;
  inset: 0 !important;
  z-index: 9000 !important;
}

.live-workspace:fullscreen .mosaic-container,
.live-workspace:-webkit-full-screen .mosaic-container,
.live-workspace.pseudo-fullscreen .mosaic-container {
  padding: 4px;
  height: 100vh;
}

.live-workspace:fullscreen .camera-grid,
.live-workspace:-webkit-full-screen .camera-grid,
.live-workspace.pseudo-fullscreen .camera-grid {
  gap: 4px;
  height: 100%;
}

.live-workspace:fullscreen .cam-tile,
.live-workspace:-webkit-full-screen .cam-tile,
.live-workspace.pseudo-fullscreen .cam-tile {
  border-radius: var(--radius-sm);
}

/* Botão Flutuante Sair da Tela Cheia */
.fullscreen-exit-float-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 9999;
  background: rgba(14, 18, 28, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(0, 240, 255, 0.4);
  color: #fff;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 600;
  display: none;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
  transition: all 0.2s ease;
  opacity: 0.85;
}

.fullscreen-exit-float-btn:hover {
  background: rgba(239, 68, 68, 0.9);
  border-color: #ef4444;
  opacity: 1;
  transform: translateY(-1px);
}

.live-workspace:fullscreen .fullscreen-exit-float-btn,
.live-workspace:-webkit-full-screen .fullscreen-exit-float-btn,
.live-workspace.pseudo-fullscreen .fullscreen-exit-float-btn {
  display: flex;
}

/* 2. Câmera Individual em Tela Cheia */
.cam-tile:fullscreen,
.cam-tile:-webkit-full-screen,
.cam-tile.tile-maximized {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  border-radius: 0 !important;
  border: none !important;
  background: #000 !important;
  z-index: 99999 !important;
}

.cam-tile:fullscreen video,
.cam-tile:-webkit-full-screen video,
.cam-tile.tile-maximized video {
  object-fit: contain !important;
  width: 100vw !important;
  height: 100vh !important;
  background: #000;
}

.fullscreen-slot-btn {
  background: rgba(0, 240, 255, 0.15);
  border-color: rgba(0, 240, 255, 0.3);
  color: var(--accent-cyan);
}

.fullscreen-slot-btn:hover {
  background: var(--accent-cyan) !important;
  color: #000 !important;
}

/* Quality Badge (SD / HD) */
.quality-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s ease;
}
.quality-badge:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}
.quality-badge.quality-hd {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.5);
  color: #34d399;
}
.quality-badge.quality-hd:hover {
  background: rgba(16, 185, 129, 0.35);
}

/* Modal de Credenciais Geradas */
.credentials-card {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.credential-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.credential-label {
  font-size: 0.82rem;
  color: #94a3b8;
  font-weight: 500;
}
.credential-value {
  font-size: 0.88rem;
  color: #f8fafc;
}
.temp-pwd-box {
  display: flex;
  align-items: center;
  gap: 8px;
}
.temp-pwd-code {
  background: #0f172a;
  border: 1px solid rgba(0, 240, 255, 0.3);
  color: var(--accent-cyan);
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

/* Alerta de Primeiro Acesso */
.first-access-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  color: #fde68a;
}
.first-access-alert strong {
  display: block;
  font-size: 0.9rem;
  color: #fbbf24;
  margin-bottom: 2px;
}

/* ==================== PAGINAÇÃO DE TABELAS ==================== */
.table-pagination-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  border-top: 1px solid var(--border-color);
  background: rgba(14, 20, 34, 0.45);
  font-size: 0.82rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 12px;
}

.table-pagination-container .pagination-info strong {
  color: #fff;
  font-weight: 600;
}

.table-pagination-container .pagination-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-page {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.btn-page:hover:not(:disabled) {
  background: rgba(0, 240, 255, 0.15);
  border-color: rgba(0, 240, 255, 0.4);
  color: var(--accent-cyan);
}

.btn-page:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.page-numbers {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-page-num {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  min-width: 32px;
  height: 30px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-page-num:hover:not(.active) {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.btn-page-num.active {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
  color: #000;
  font-weight: 700;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
}
