* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  background-color: #05070a;
  color: #f1f5f9;
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

.screen-box {
  width: 100%;
  max-width: 1200px;
  min-height: 100vh;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }

/* Login */
.login-card {
  margin: auto;
  width: 100%;
  max-width: 440px;
  background: rgba(15, 20, 31, 0.75);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 32px 24px;
  text-align: center;
}

.brand-badge {
  display: inline-block;
  background: rgba(16, 185, 129, 0.1);
  color: #10B981;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.title { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.desc { font-size: 13px; color: #94a3b8; margin-bottom: 24px; }

input[type="password"], input[type="text"], select {
  width: 100%;
  background: #080a10;
  border: 1px solid rgba(255,255,255,0.12);
  color: #38bdf8;
  padding: 14px;
  border-radius: 12px;
  font-size: 14px;
  outline: none;
  margin-bottom: 14px;
}

input:focus, select:focus { border-color: #10B981; }

.btn-enter {
  width: 100%;
  background: #10B981;
  color: #05070a;
  font-weight: 800;
  border: none;
  padding: 14px;
  border-radius: 12px;
  font-size: 13px;
  cursor: pointer;
}

.msg-error { color: #f87171; font-size: 12px; margin-bottom: 12px; }

/* Header Admin */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.logo-admin { font-size: 20px; font-weight: 900; display: flex; align-items: center; gap: 8px; }
.version-tag { font-size: 10px; background: rgba(56, 189, 248, 0.1); color: #38bdf8; padding: 2px 6px; border-radius: 6px; }
.sub-admin { font-size: 11px; color: #94a3b8; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }

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

/* Estilos do Master Kill Switch */
.btn-master-active {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-master-paused {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #4ade80;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-action-primary {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #10B981;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.btn-exit {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: #94a3b8;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* Abas de Navegação */
.admin-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.tab-btn {
  background: rgba(15, 20, 31, 0.6);
  border: 1px solid rgba(255,255,255,0.06);
  color: #94a3b8;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.tab-btn.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.3);
  color: #38bdf8;
}

/* Grids Responsivos Fluídos */
.dashboard-body { flex: 1; }
.tab-content { display: block; }
.tab-content.hidden { display: none; }

.grid-fluid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.admin-card {
  background: rgba(15, 20, 31, 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 16px;
}

.card-title { font-size: 14px; font-weight: 700; color: #f8fafc; margin-bottom: 12px; }

.metric-grid, .metric-grid-4 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.metric-grid-4 { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

.metric-item {
  background: rgba(8, 10, 16, 0.6);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}
.m-label { font-size: 10px; color: #64748b; font-weight: 600; display: block; margin-bottom: 2px; }
.m-val { font-size: 14px; font-weight: 800; color: #38bdf8; }

/* Casas Grid */
.houses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.house-card {
  background: rgba(15, 20, 31, 0.75);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.house-card-online {
  border-color: rgba(74, 222, 128, 0.25);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.house-card-resting {
  border-color: rgba(245, 158, 11, 0.3);
}

.house-card-paused {
  border-color: rgba(251, 191, 36, 0.2);
}

.house-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.house-emoji { font-size: 16px; margin-right: 6px; }
.house-name { font-size: 14px; font-weight: 800; color: #f8fafc; }
.house-jogo-label { font-size: 11px; color: #94a3b8; display: block; margin-top: 2px; font-weight: 500; }
.house-status-badge { font-size: 10px; font-weight: 800; padding: 4px 8px; border-radius: 6px; text-transform: uppercase; letter-spacing: 0.5px; }

.house-voo-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 8px 12px;
  border-radius: 10px;
  margin: 10px 0;
}

.house-voo-valor { display: flex; align-items: baseline; gap: 8px; }
.mult-destaque { font-family: monospace; }
.tele-sem-dados { font-size: 12px; color: #64748b; font-style: italic; }

.watchdog-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  padding: 6px 10px;
  margin-bottom: 10px;
}
.wd-label { color: #94a3b8; font-weight: 600; font-size: 10px; text-transform: uppercase; }
.wd-status { font-weight: 700; font-size: 11px; }

.house-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.stat-item {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
}
.stat-val { font-size: 13px; font-weight: 800; color: #f8fafc; font-family: monospace; }
.stat-label { font-size: 9px; color: #64748b; text-transform: uppercase; font-weight: 600; margin-top: 2px; }

.house-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding-top: 12px;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}

.house-footer-info {
  font-size: 10px;
  color: #64748b;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Licenças */
.section-title { font-size: 14px; font-weight: 700; color: #94a3b8; margin-bottom: 12px; }
.licenses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
}

.license-card {
  background: rgba(15, 20, 31, 0.7);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 14px;
}
.license-card.suspensa { border-color: rgba(239, 68, 68, 0.3); background: rgba(20, 11, 15, 0.7); }

.lic-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.lic-rotulo { font-size: 13px; font-weight: 700; color: #f8fafc; }
.lic-chave { font-size: 11px; font-family: monospace; color: #38bdf8; letter-spacing: 0.5px; }

.lic-footer { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid rgba(255,255,255,0.04); padding-top: 10px; gap: 8px; }
.lic-tipo { font-size: 10px; font-weight: 700; color: #10B981; background: rgba(16, 185, 129, 0.08); padding: 2px 6px; border-radius: 4px; }
.lic-actions-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.btn-kill {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.btn-activate {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #4ade80;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.btn-delete-lic {
  background: rgba(127, 29, 29, 0.25);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fca5a5;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.btn-delete-lic:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: rgba(15, 23, 42, 0.5);
  border-color: rgba(148, 163, 184, 0.25);
  color: #94a3b8;
}

.btn-action-start {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #4ade80;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-action-start:hover { background: rgba(34, 197, 94, 0.25); }

.btn-action-pause {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-action-pause:hover { background: rgba(245, 158, 11, 0.25); }

.btn-action-restart {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-action-restart:hover { background: rgba(56, 189, 248, 0.25); }

/* Timer Box nos Cards de Casas */
.timer-box {
  background: rgba(8, 10, 16, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 8px 10px;
  margin: 10px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.timer-label { font-size: 11px; color: #94a3b8; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.timer-val { font-size: 12px; font-weight: 800; font-family: monospace; }
.timer-val.next { color: #38bdf8; }
.timer-val.resting { color: #f59e0b; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.house-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 6px;
  margin-top: 10px;
}
.btn-house-sm {
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}
.btn-house-sm.start { background: rgba(34, 197, 94, 0.12); color: #4ade80; border-color: rgba(34, 197, 94, 0.25); }
.btn-house-sm.pause { background: rgba(245, 158, 11, 0.12); color: #fbbf24; border-color: rgba(245, 158, 11, 0.25); }
.btn-house-sm.restart { background: rgba(56, 189, 248, 0.12); color: #38bdf8; border-color: rgba(56, 189, 248, 0.25); }
.btn-house-sm:hover { filter: brightness(1.2); }

.status-paused { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.status-resting { background: rgba(168, 85, 247, 0.15); color: #c084fc; }

.gen-form-advanced {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.gen-row-top {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
}
.gen-row-top input, .gen-row-top select {
  margin-bottom: 0;
}

.chips-section {
  background: rgba(8, 10, 16, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 12px;
}

.chips-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 6px;
}

.chips-title {
  font-size: 12px;
  font-weight: 700;
  color: #f1f5f9;
}

.chips-sub {
  font-size: 11px;
  font-weight: 600;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  padding: 2px 8px;
  border-radius: 6px;
}

.chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-select {
  background: rgba(15, 20, 31, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chip-select:hover {
  background: rgba(30, 41, 59, 0.9);
  color: #f1f5f9;
  border-color: rgba(255, 255, 255, 0.2);
}

.chip-select.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: #38bdf8;
  color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
}

.chip-select[data-value="*"].active {
  background: rgba(16, 185, 129, 0.15);
  border-color: #10B981;
  color: #4ade80;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.25);
}

.broadcast-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-generate-submit {
  width: 100%;
  padding: 14px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.lic-tag-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 4px;
  margin-top: 4px;
}
.lic-tag-app { background: rgba(56, 189, 248, 0.12); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.25); }
.lic-tag-casas { background: rgba(168, 85, 247, 0.12); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.25); }
.lic-tag-plan { background: rgba(16, 185, 129, 0.12); color: #10B981; border: 1px solid rgba(16, 185, 129, 0.25); }

.logs-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.btn-log-ctrl {
  background: rgba(15, 20, 31, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.btn-log-ctrl.danger {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.3);
  background: rgba(127, 29, 29, 0.2);
}

.terminal-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #05070a;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  min-height: 280px;
  max-height: 62vh;
  overflow-y: auto;
  padding: 10px 12px 16px;
  margin: 0 -4px;
}

.terminal-empty {
  color: #64748b;
  font-size: 12px;
  padding: 24px 8px;
  text-align: center;
}

.log-line {
  display: grid;
  grid-template-columns: 72px 22px 92px 1fr;
  gap: 8px;
  align-items: start;
  font-size: 11px;
  line-height: 1.45;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: #cbd5e1;
}
.log-ts { color: #64748b; }
.log-cat { font-weight: 800; letter-spacing: 0.3px; color: #94a3b8; }
.log-msg { color: #e2e8f0; word-break: break-word; }
.log-line.log-seguranca .log-cat,
.log-line.log-erro .log-cat { color: #f87171; }
.log-line.log-licenca .log-cat { color: #38bdf8; }
.log-line.log-broadcast .log-cat { color: #c084fc; }
.log-line.log-sistema .log-cat { color: #4ade80; }
.log-line.log-watchdog .log-cat,
.log-line.log-robo .log-cat { color: #fbbf24; }

/* Estilos da Lixeira (Soft Delete) */
.badge-lixeira {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

.license-card.lixeira {
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(30, 20, 10, 0.7);
  opacity: 0.85;
}

.license-card.lixeira:hover {
  opacity: 1;
  border-color: rgba(245, 158, 11, 0.5);
}

.sessao-detalhe {
  font-size: 11px;
  color: #94a3b8;
  margin: 8px 0;
}

/* Estilos do Histórico de Auditoria */
.audit-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #05070a;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  min-height: 200px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 12px;
}

.audit-line {
  display: grid;
  grid-template-columns: 120px 60px 70px 1fr;
  gap: 8px;
  align-items: start;
  font-size: 11px;
  line-height: 1.4;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: #cbd5e1;
}

.audit-line:last-child {
  border-bottom: none;
}

.audit-ts {
  color: #64748b;
  font-size: 10px;
  white-space: nowrap;
}

.audit-ator {
  color: #10B981;
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.audit-acao {
  font-weight: 800;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.1);
  color: #38bdf8;
  white-space: nowrap;
}

.audit-msg {
  color: #e2e8f0;
  word-break: break-word;
  font-size: 11px;
}

/* Cores específicas por tipo de ação de auditoria */
.audit-line.audit-criar .audit-acao {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.audit-line.audit-lixeira .audit-acao {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.audit-line.audit-restaurar .audit-acao {
  background: rgba(16, 185, 129, 0.15);
  color: #10B981;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.audit-line.audit-purgar .audit-acao {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.audit-line.audit-suspender .audit-acao,
.audit-line.audit-reativar .audit-acao {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.25);
}

.audit-line.audit-bloqueio .audit-acao {
  background: rgba(127, 29, 29, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(248, 113, 113, 0.35);
}

.audit-line.audit-info .audit-acao {
  background: rgba(100, 116, 139, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

@media (max-width: 640px) {
  .gen-row-top { grid-template-columns: 1fr; }
  .log-line { grid-template-columns: 64px 18px 1fr; }
  .log-cat { display: none; }
  
  .audit-line {
    grid-template-columns: 80px 50px 1fr;
    gap: 6px;
  }
  .audit-ator {
    display: none;
  }
}