/* NoLag · painel de admin — tema escuro */
:root {
  --bg: #0a0c11;
  --bg-2: #0e1117;
  --surface: #131721;
  --surface-2: #181d29;
  --line: #222838;
  --line-2: #2c3346;
  --text: #e8eaf0;
  --muted: #8a91a6;
  --faint: #5d647a;
  --accent: #3ddc97;
  --accent-2: #2bb47a;
  --accent-soft: rgba(61, 220, 151, .12);
  --danger: #ff5c6c;
  --danger-soft: rgba(255, 92, 108, .12);
  --warn: #f5a623;
  --warn-soft: rgba(245, 166, 35, .12);
  --info: #5aa9ff;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 15px; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.spacer { flex: 1; }
.ico { flex-shrink: 0; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px;
  padding: 20px 14px;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 17px; padding: 4px 8px 16px; }
.brand:hover { text-decoration: none; }
.brand.big { font-size: 26px; padding: 0; justify-content: center; }
.brand-mark {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #1fa8ff); color: #06110c;
  box-shadow: 0 0 24px rgba(61, 220, 151, .35);
}
.brand.big .brand-mark { width: 40px; height: 40px; border-radius: 12px; }
.brand-tag { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); border: 1px solid var(--line-2); border-radius: 6px; padding: 1px 6px; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 500;
}
.nav a:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav-section { margin: 14px 10px 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); }

.me { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line-2); font-weight: 600; }
.me-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.me-text strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text span { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.content { padding: 28px 32px 48px; max-width: 1280px; width: 100%; display: flex; flex-direction: column; gap: 20px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-head p { margin-top: 4px; }
.live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: 4px; vertical-align: middle; animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(61, 220, 151, .6); } 100% { box-shadow: 0 0 0 8px rgba(61, 220, 151, 0); } }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: var(--surface-2); color: var(--text);
  font: 600 13.5px var(--font); cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { text-decoration: none; background: var(--line); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: #06110c; }
.btn.primary:hover { background: #55e6a7; }
.btn.ghost { background: transparent; border-color: var(--line-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.danger:hover { background: rgba(255, 92, 108, .2); }
.btn.danger.ghost { background: transparent; border-color: transparent; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.block { width: 100%; height: 42px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px;
  border-radius: var(--radius-sm); border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }

/* ---------- Cards / KPIs ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi {
  display: flex; flex-direction: column; gap: 6px; padding: 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.kpi.accent { background: linear-gradient(160deg, rgba(61, 220, 151, .14), var(--surface) 60%); border-color: rgba(61, 220, 151, .3); }
.kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.kpi-value { font-size: 30px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 16px; color: var(--faint); font-weight: 600; }
.kpi-foot { font-size: 12px; color: var(--faint); }

.relay-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; padding: 16px; }
.relay-tile { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2); display: flex; flex-direction: column; gap: 8px; }
.relay-tile.disabled { opacity: .5; }
.relay-top { display: flex; align-items: center; gap: 8px; }
.relay-top strong { flex: 1; }
.relay-host { color: var(--muted); }
.relay-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.relay-stats div { display: flex; flex-direction: column; }
.relay-stats span { font-weight: 600; font-variant-numeric: tabular-nums; font-size: 13px; }
.relay-stats small { color: var(--faint); font-size: 11px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); }
.relay-tile.on .status-dot { background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.relay-tile.off .status-dot { background: var(--danger); }
.relay-tile.starting .status-dot { background: var(--warn); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .3; } }

/* ---------- Tabelas ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--faint); padding: 10px 18px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 12px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: rgba(255, 255, 255, .015); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; width: 1%; }
.row-muted td { opacity: .55; }
.cell-main { font-weight: 500; display: flex; align-items: center; gap: 6px; }
.cell-sub { font-size: 12px; color: var(--muted); }

/* ---------- Tags ---------- */
.tag {
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line-2);
}
.tag.ok { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.tag.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.tag.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tag.info { background: rgba(90, 169, 255, .12); color: var(--info); border-color: transparent; }
.tag.accent { background: rgba(90, 169, 255, .12); color: var(--info); border-color: transparent; }
.tag.live { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.tag.live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-right: 5px; }
.game-pill { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; }
.game-pill::before { content: ""; width: 8px; height: 8px; border-radius: 3px; background: var(--c, var(--accent)); }

/* ---------- Jogos ---------- */
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.game-card {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 18px; min-height: 150px; text-align: left; cursor: pointer;
  border-radius: var(--radius); border: 1px solid var(--line); color: var(--text); font: inherit;
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--c) 28%, transparent), transparent 60%),
    var(--surface);
  transition: border-color .15s, transform .15s;
}
.game-card:hover { border-color: color-mix(in srgb, var(--c) 60%, var(--line)); transform: translateY(-2px); }
.game-card.disabled { opacity: .5; }
.game-card .tag { position: absolute; top: 14px; right: 14px; }
.game-badge {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; margin-bottom: auto;
  background: color-mix(in srgb, var(--c) 22%, var(--bg)); color: var(--c); font-weight: 800; letter-spacing: .02em;
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
}
.game-name { font-weight: 600; font-size: 15px; }
.game-meta { font-size: 12px; color: var(--muted); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Planos ---------- */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.plan-card { display: flex; flex-direction: column; gap: 10px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.plan-card.disabled { opacity: .55; }
.plan-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.plan-price { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.plan-card ul { margin: 0 0 6px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 13px; }
.plan-card ul li::before { content: "✓"; color: var(--accent); margin-right: 8px; }
.plan-card .btn { align-self: flex-start; }
.note { font-size: 13px; }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.search {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 240px; max-width: 420px;
  height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--muted);
}
.search input { flex: 1; border: 0; background: transparent; color: var(--text); font: inherit; outline: none; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.segmented button { border: 0; background: transparent; color: var(--muted); font: 500 13px var(--font); padding: 6px 12px; border-radius: 6px; cursor: pointer; }
.segmented button.on { background: var(--surface-2); color: var(--text); }

/* ---------- Formulários ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.form-grid .field { margin-bottom: 0; }
.field > span { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text); font: inherit; outline: none;
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field input[type=color] { height: 38px; padding: 4px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.checks { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 8px; }
.quick-actions { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 14px; }

.alert { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13.5px; border: 1px solid; }
.alert.danger { background: var(--danger-soft); border-color: rgba(255, 92, 108, .35); color: #ffb3bb; }
.alert.ok { background: var(--accent-soft); border-color: rgba(61, 220, 151, .35); color: #b9f5d8; }
.alert.warn { background: var(--warn-soft); border-color: rgba(245, 166, 35, .35); color: #ffd28a; }
.alert a { color: inherit; text-decoration: underline; }
.modal-body .alert { margin-top: 12px; }

.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding: 12px 14px; border: 1px dashed var(--line-2); border-radius: var(--radius-sm); }
.danger-zone p { font-size: 12.5px; }

.code {
  margin: 10px 0 14px; padding: 14px; border-radius: var(--radius-sm); background: #07090d; border: 1px solid var(--line);
  font: 12.5px/1.6 var(--mono); color: #b9f5d8; white-space: pre-wrap; word-break: break-all; user-select: all;
}

.subsection { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.subsection-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.mini-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.mini-list li { display: flex; align-items: center; gap: 10px; }

/* ---------- Regiões ---------- */
.region-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.region-card { display: flex; flex-direction: column; gap: 12px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.region-card.disabled { opacity: .55; }
.region-top { display: flex; align-items: center; gap: 10px; }
.region-top h3 { flex: 1; display: flex; align-items: center; gap: 8px; }
.region-code { font: 600 11px var(--mono); color: var(--muted); padding: 2px 6px; border: 1px solid var(--line-2); border-radius: 6px; }
.region-mode { font-size: 12.5px; color: var(--muted); }
.region-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 10px 0; border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); }
.region-stats div { display: flex; flex-direction: column; }
.region-stats span { font-weight: 600; font-size: 18px; font-variant-numeric: tabular-nums; }
.region-stats small { color: var(--faint); font-size: 11px; }
.region-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.form-section { margin: 16px 0 10px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.hint { font-size: 12px; color: var(--faint); margin-top: -4px; }
.form-grid + .hint { margin-top: 6px; }
.form-grid.three { grid-template-columns: 1fr 1fr 1fr; }
.events { list-style: none; margin: 0; padding: 6px 0; }
.events li { display: grid; grid-template-columns: 110px 70px 1fr; gap: 12px; padding: 8px 18px; font-size: 13px; border-bottom: 1px solid var(--line); }
.events li:last-child { border-bottom: 0; }
.events time { color: var(--faint); font: 12px var(--mono); }
.lvl { font: 600 11px var(--mono); text-transform: uppercase; }
.lvl.ok { color: var(--accent); } .lvl.info { color: var(--info); } .lvl.warn { color: var(--warn); } .lvl.error { color: var(--danger); }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; }
.checklist .dot { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; flex-shrink: 0; margin-top: 1px; }
.checklist .dot.ok { background: var(--accent-soft); color: var(--accent); }
.checklist .dot.no { background: var(--danger-soft); color: var(--danger); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.card-body { padding: 16px 18px; }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(4, 6, 10, .7); backdrop-filter: blur(3px); z-index: 50; animation: fade .15s; }
.modal {
  position: fixed; z-index: 51; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(620px, calc(100vw - 32px)); max-height: calc(100vh - 48px); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: var(--shadow);
  animation: pop .16s ease-out;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -48%) scale(.98); } }

/* ---------- Vazio ---------- */
.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 48px 20px; text-align: center; }
.empty.small { padding: 28px 20px; color: var(--muted); }

/* ---------- Login ---------- */
.login-wrap { position: relative; min-height: 100vh; display: grid; place-items: center; padding: 16px; overflow: hidden; }
.login-glow {
  position: absolute; width: 700px; height: 700px; border-radius: 50%; top: -260px; right: -200px;
  background: radial-gradient(circle, rgba(61, 220, 151, .16), transparent 60%); pointer-events: none;
}
.login-card {
  position: relative; width: min(380px, 100%); display: flex; flex-direction: column; gap: 4px;
  padding: 32px 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
}
.login-card > .muted { text-align: center; margin: 8px 0 18px; }
.login-card .alert { margin-bottom: 12px; }
.login-card .btn { margin-top: 6px; }

#blazor-error-ui { display: none; position: fixed; bottom: 16px; right: 16px; z-index: 100; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--danger); color: #fff; }
#blazor-error-ui a { color: #fff; text-decoration: underline; margin-left: 8px; }

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 820px) {
  .form-grid.three { grid-template-columns: 1fr 1fr; }
  .events li { grid-template-columns: 90px 1fr; }
  .events li .lvl { display: none; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px 16px; }
  .brand { padding: 0 8px 0 0; }
  .nav { flex-direction: row; flex-wrap: wrap; flex: 1 1 100%; order: 3; }
  .nav-section { display: none; }
  .me { margin-left: auto; padding: 6px; border: 0; background: transparent; }
  .me-text { display: none; }
  .content { padding: 20px 16px 40px; }
  .page-head { flex-direction: column; align-items: stretch; }
  .form-grid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
}
