/* ---------- Tema ---------- */
:root {
  color-scheme: light;
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #fafaf9;
  --border: #e7e5e4;
  --border-strong: #d6d3d1;
  --text: #1c1917;
  --text-2: #57534e;
  --text-3: #a8a29e;
  --accent: #f5b800;
  --accent-hover: #e5ab00;
  --accent-strong: #a67c00;
  --accent-ink: #1c1917;
  --accent-soft: #fef6d8;
  --success: #15803d;
  --success-soft: #dcfce7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --console-bg: #1c1917;
  --shadow: 0 1px 2px rgba(28, 25, 23, 0.04);
  --shadow-lg: 0 20px 50px rgba(28, 25, 23, 0.18);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c0c0b;
  --surface: #161615;
  --surface-2: #1c1c1a;
  --border: #2a2927;
  --border-strong: #3a3835;
  --text: #f5f5f4;
  --text-2: #a8a29e;
  --text-3: #78716c;
  --accent: #facc15;
  --accent-hover: #eab308;
  --accent-strong: #facc15;
  --accent-ink: #1c1917;
  --accent-soft: rgba(250, 204, 21, 0.12);
  --success: #4ade80;
  --success-soft: rgba(74, 222, 128, 0.12);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --console-bg: #0a0a09;
  --shadow: none;
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.5);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}

a { color: inherit; }
.mono { font-family: "JetBrains Mono", ui-monospace, Consolas, monospace; }
svg.icon { flex-shrink: 0; display: block; }
[hidden] { display: none !important; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 60px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.brand-name { font-weight: 600; font-size: 14px; letter-spacing: -0.01em; line-height: 1.2; }
.brand-sub { font-size: 12px; color: var(--text-3); line-height: 1.2; }

.nav { padding: 12px; display: flex; flex-direction: column; gap: 2px; }

.nav-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  padding: 8px 10px 6px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text-2);
  text-decoration: none;
  font-weight: 500;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--text); }
.nav a.active svg { color: var(--accent-strong); }

.sidebar-footer {
  margin-top: auto;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-2);
  flex-shrink: 0;
}

.user-meta { flex: 1; min-width: 0; }
.user-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 12px; color: var(--text-3); }

.icon-btn {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  padding: 0;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.icon-btn:focus-visible, .btn:focus-visible, .nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 60px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .crumb { color: var(--text-3); font-size: 13px; }
.topbar .crumb-sep { color: var(--border-strong); }
.topbar h1 { font-size: 13px; font-weight: 600; margin: 0; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.menu-btn { display: none; }

.content { padding: 28px; max-width: 1200px; width: 100%; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.page-head h2 { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.page-tools { display: flex; align-items: center; gap: 10px; }
.updated { font-size: 12px; color: var(--text-3); white-space: nowrap; }

/* ---------- Painéis ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
}
.panel-title { font-size: 13px; font-weight: 600; }
.panel-meta { font-size: 12px; color: var(--text-3); }
.panel-foot { padding: 11px 18px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); background: var(--surface-2); }
.link { font-size: 12.5px; color: var(--text-2); text-decoration: none; font-weight: 500; }
.link:hover { color: var(--text); text-decoration: underline; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.kpi { padding: 16px 18px; }
.kpi-label { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.kpi-label svg { color: var(--text-3); }
.kpi-value { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin-top: 10px; font-variant-numeric: tabular-nums; line-height: 1.2; min-height: 29px; }
.kpi-hint { font-size: 12px; color: var(--text-3); margin-top: 2px; min-height: 18px; }

.address-panel { margin-bottom: 16px; }
.address-grid { display: grid; grid-template-columns: 1fr 1fr; }
.address-item {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "label btn" "value btn" "hint btn";
  align-items: center;
  column-gap: 12px;
  padding: 14px 18px;
}
.address-item + .address-item { border-left: 1px solid var(--border); }
.address-label { grid-area: label; font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.address-value { grid-area: value; font-size: 18px; font-weight: 600; margin-top: 4px; }
.address-hint { grid-area: hint; font-size: 12px; color: var(--text-3); margin-top: 2px; }
.address-hint b { color: var(--text); }
.address-item .btn { grid-area: btn; }
@media (max-width: 700px) {
  .address-grid { grid-template-columns: 1fr; }
  .address-item + .address-item { border-left: none; border-top: 1px solid var(--border); }
}

.grid-2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; margin-bottom: 16px; }
.grid-2.single { grid-template-columns: 1fr; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0;
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.online { color: var(--success); background: var(--success-soft); }
.status.offline { color: var(--danger); background: var(--danger-soft); }

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 18px;
  border-top: 1px solid var(--border);
}
.row:first-child { border-top: none; }

.player-head {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  image-rendering: pixelated;
  background: var(--surface-2);
  flex-shrink: 0;
}
.player-name { font-weight: 500; }
.player-tag { margin-left: auto; font-size: 12px; color: var(--text-3); }

.control-text { flex: 1; min-width: 0; }
.control-title { font-weight: 600; font-size: 13.5px; }
.control-desc { font-size: 12.5px; color: var(--text-2); }

.activity-time { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 12px; color: var(--text-3); width: 62px; flex-shrink: 0; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--text-3); }
.activity-dot.join { background: var(--success); }
.activity-dot.leave { background: var(--border-strong); }
.activity-dot.adv { background: var(--accent); }
.activity-dot.server { background: var(--text-2); }
.activity-text b { font-weight: 600; }

.empty { padding: 32px 18px; text-align: center; color: var(--text-3); font-size: 13px; }

.skeleton {
  display: inline-block;
  height: 14px;
  width: 90px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--border) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
  vertical-align: middle;
}
.skeleton.lg { height: 24px; width: 110px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Botões e inputs ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border-radius: 7px;
  font: inherit;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 600; }
.btn-danger-solid:hover { filter: brightness(1.08); background: var(--danger); }
.btn-block { width: 100%; height: 40px; font-size: 14px; }
.spin { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.input {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  width: 100%;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.input::placeholder { color: var(--text-3); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-lg { height: 40px; font-size: 14px; }

.search { position: relative; width: 260px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search .input { padding-left: 34px; }

.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); cursor: pointer; user-select: none; white-space: nowrap; }
.switch input {
  appearance: none;
  -webkit-appearance: none;
  width: 30px;
  height: 18px;
  border-radius: 999px;
  background: var(--border-strong);
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
  margin: 0;
  flex-shrink: 0;
}
.switch input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(12px); }
.switch input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Tabela (plugins) ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.table td { padding: 11px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .num { width: 1%; white-space: nowrap; }

.plugin-cell { display: flex; align-items: center; gap: 12px; }
.plugin-icon {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.plugin-name { font-weight: 600; }
.version {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 5px;
  white-space: nowrap;
}
.upd { font-size: 12.5px; white-space: nowrap; text-decoration: none; }
.upd.new { font-weight: 600; color: var(--accent-strong); background: var(--accent-soft); padding: 2px 9px; border-radius: 999px; }
.upd.new::before { content: "↑ "; }
.upd.new:hover { text-decoration: underline; }
.upd.muted { color: var(--text-3); }
a.upd.muted:hover { color: var(--text-2); text-decoration: underline; }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--success); }

/* ---------- Console ---------- */
.console {
  background: var(--console-bg);
  height: calc(100vh - 330px);
  min-height: 340px;
  overflow: auto;
  padding: 12px 0;
  font-family: "JetBrains Mono", ui-monospace, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.7;
  color: #d6d3d1;
}
.console-line { padding: 0 18px; white-space: pre-wrap; word-break: break-word; }
.console-line:hover { background: rgba(255, 255, 255, 0.04); }
.c-time { color: #78716c; }
.c-thread { color: #57534e; }
.console-line.c-warn .c-msg { color: #facc15; }
.console-line.c-error .c-msg { color: #f87171; }

.console-form { display: flex; align-items: center; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.console-prompt { position: relative; flex: 1; }
.console-prompt span {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  color: var(--accent-strong);
  font-weight: 600;
  pointer-events: none;
}
.console-prompt .input { padding-left: 28px; font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 13px; }

/* ---------- Automações ---------- */
.stack { display: flex; flex-direction: column; gap: 16px; }

.auto-head { display: flex; align-items: flex-start; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.auto-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.auto-title { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.auto-desc { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.auto-side { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.auto-next { font-size: 12px; color: var(--text-3); white-space: nowrap; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-3);
}
.badge.on { background: var(--accent-soft); border-color: transparent; color: var(--accent-strong); }
.badge.busy { background: var(--surface-2); color: var(--text-2); }

.setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 18px; border-top: 1px solid var(--border); }
.setting:first-child { border-top: none; }
.setting-label { font-weight: 500; }
.setting-desc { font-size: 12.5px; color: var(--text-2); }
.setting .input { width: 150px; flex-shrink: 0; }

select.input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 32px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a8a29e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.input:disabled { opacity: 0.6; cursor: not-allowed; }

.note { font-size: 12.5px; color: var(--text-2); background: var(--accent-soft); border-radius: 7px; padding: 9px 12px; margin: 0 18px 14px; }

.auto-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 12.5px;
  color: var(--text-2);
}
.result-err { color: var(--danger); }
.auto-foot span svg.icon { display: inline-block; vertical-align: -2px; margin-right: 4px; }

.save-bar {
  position: sticky;
  bottom: 16px;
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--text);
  color: var(--bg);
  border-radius: 10px;
  padding: 10px 10px 10px 16px;
  box-shadow: var(--shadow-lg);
  animation: slideup 0.18s ease-out;
}
.save-bar span { flex: 1; font-weight: 500; font-size: 13px; }
.save-bar .btn:not(.btn-primary) { background: transparent; color: var(--bg); border-color: rgba(255, 255, 255, 0.25); }
html[data-theme="dark"] .save-bar .btn:not(.btn-primary) { border-color: rgba(0, 0, 0, 0.25); }

@media (max-width: 560px) {
  .auto-head { flex-wrap: wrap; }
  .auto-side { margin-left: 50px; align-items: flex-start; flex-direction: row; }
  .setting { flex-direction: column; align-items: stretch; gap: 8px; }
  .setting .input { width: 100%; }
  .auto-foot { flex-direction: column; align-items: stretch; }
}

/* ---------- Automações: lista recolhida ---------- */
.auto-item + .auto-item { border-top: 1px solid var(--border); }
.auto-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; }
.auto-row:hover { background: var(--surface-2); }
.auto-list .auto-icon { width: 30px; height: 30px; border-radius: 7px; }
.auto-text { flex: 1; min-width: 0; }
.auto-name { font-weight: 600; font-size: 13.5px; }
.auto-sum { font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.auto-sum.on { color: var(--text-2); }
.chev svg, .chev-static svg { transition: transform 0.15s; }
.auto-item.open .chev svg { transform: rotate(180deg); }
.auto-body { border-top: 1px solid var(--border); background: var(--surface-2); }
.auto-body .setting { padding: 10px 16px 10px 58px; }
.auto-body .auto-foot { padding-left: 58px; background: transparent; }
.auto-body .setting + .auto-foot, .auto-body .note + .auto-foot { border-top: 1px solid var(--border); }
.auto-body > .auto-foot:first-child { border-top: none; }
.auto-body .note { margin: 0 16px 10px 58px; }
.setting-wide { flex-direction: column; align-items: stretch; gap: 6px; }
.setting-wide .input { width: 100%; }
.muted-inline { font-weight: 400; color: var(--text-3); font-size: 12.5px; }

.backups-box { margin-top: 16px; }
.backups-box summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 13px 16px; cursor: pointer; }
.backups-box summary::-webkit-details-marker { display: none; }
.backups-box summary:hover { background: var(--surface-2); }
.backups-box .chev-static { margin-left: auto; color: var(--text-2); display: grid; place-items: center; width: 32px; }
.backups-box[open] .chev-static svg { transform: rotate(180deg); }
.backups-box .table { border-top: 1px solid var(--border); }

@media (max-width: 560px) {
  .auto-body .setting, .auto-body .auto-foot { padding-left: 16px; }
  .auto-body .note { margin-left: 16px; }
}

/* ---------- Relatórios ---------- */
:root { --chart-bar: #b38600; --chart-grid: #efeeec; }
html[data-theme="dark"] { --chart-bar: #b38600; --chart-grid: #232321; }

.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; padding: 2px; background: var(--surface); }
.segmented button {
  border: none;
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--accent-soft); color: var(--text); font-weight: 600; }

.chart { padding: 16px 18px 12px; position: relative; }
.chart-plot { position: relative; height: 180px; margin-left: 44px; }
.chart-grid { position: absolute; inset: 0; pointer-events: none; }
.chart-grid div { position: absolute; left: 0; right: 0; border-top: 1px solid var(--chart-grid); }
.chart-grid span {
  position: absolute;
  right: calc(100% + 8px);
  top: -8px;
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.chart-bars { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 2px; }
.bar-col { flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; cursor: default; outline: none; min-width: 0; }
.bar { width: 100%; max-width: 36px; background: var(--chart-bar); border-radius: 4px 4px 0 0; min-height: 0; transition: opacity 0.12s; }
.bar.zero { background: transparent; }
.chart-bars:hover .bar, .chart-bars:focus-within .bar { opacity: 0.45; }
.bar-col:hover .bar, .bar-col:focus .bar { opacity: 1; }
.bar-col:focus-visible .bar { outline: 2px solid var(--text); outline-offset: 2px; }
.chart-x { display: flex; gap: 2px; margin-left: 44px; margin-top: 6px; }
.chart-x span { flex: 1; text-align: center; font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; min-width: 0; font-variant-numeric: tabular-nums; }
.chart-baseline { position: absolute; left: 0; right: 0; bottom: 0; border-top: 1px solid var(--border-strong); }

.chart-tip {
  position: absolute;
  pointer-events: none;
  background: var(--text);
  color: var(--bg);
  font-size: 12px;
  padding: 6px 9px;
  border-radius: 6px;
  white-space: nowrap;
  transform: translate(-50%, calc(-100% - 8px));
  box-shadow: var(--shadow-lg);
  z-index: 5;
}
.chart-tip b { font-weight: 600; }

.chart-data summary { cursor: pointer; font-size: 12px; color: var(--text-2); padding: 0 18px 12px; }
.chart-data .table td, .chart-data .table th { padding: 7px 18px; font-size: 12.5px; }

.new-tag { display: inline-block; font-size: 11px; font-weight: 600; color: var(--accent-strong); background: var(--accent-soft); border-radius: 999px; padding: 0 7px; margin-left: 8px; }
.rank { color: var(--text-3); font-variant-numeric: tabular-nums; width: 1%; }

/* ---------- Arquivos (explorador) ---------- */
.nav a + .nav-label { margin-top: 10px; }

.fx-bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.fx-crumbs { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; flex-wrap: wrap; font-size: 13px; }
.fx-crumbs button, .fx-crumbs span.cur {
  border: none;
  background: none;
  font: inherit;
  color: var(--text-2);
  padding: 4px 7px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fx-crumbs button:hover { background: var(--surface-2); color: var(--text); }
.fx-crumbs span.cur { color: var(--text); font-weight: 600; cursor: default; }
.fx-crumbs .sep { color: var(--border-strong); padding: 0 1px; }
.fx-actions { display: flex; align-items: center; gap: 8px; }
.fx-actions .btn { height: 32px; padding: 0 12px; }

.fx-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 8px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--accent-soft);
  font-size: 13px;
  flex-wrap: wrap;
}
.fx-strip b { font-weight: 600; }
.fx-strip .grow { flex: 1; }
.fx-strip .btn { height: 30px; padding: 0 11px; font-size: 12.5px; }

.fx-table td { padding-top: 8px; padding-bottom: 8px; }
.fx-table .check { width: 1%; padding-right: 0; }
.fx-table input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent-strong); cursor: pointer; margin: 0; display: block; }
.fx-table tr.sel td { background: var(--accent-soft); }
.fx-table tr.cut .fx-name { opacity: 0.5; }
.fx-table .muted { color: var(--text-2); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.fx-table th button { border: none; background: none; font: inherit; color: inherit; padding: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.fx-table th button:hover { color: var(--text); }
.fx-table th button svg { transition: transform 0.12s; }
.fx-table th button.desc svg { transform: rotate(180deg); }
.fx-table .act { width: 1%; padding-left: 0; padding-right: 10px; }

.fx-name {
  display: flex;
  align-items: center;
  gap: 10px;
  border: none;
  background: none;
  font: inherit;
  color: var(--text);
  padding: 0;
  cursor: pointer;
  text-align: left;
  max-width: 100%;
  min-width: 0;
}
.fx-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.fx-name:hover span { text-decoration: underline; text-underline-offset: 2px; }
.fx-name:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.fx-ico { width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; flex-shrink: 0; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.fx-ico.dir { background: var(--accent-soft); color: var(--accent-strong); border-color: transparent; }
.fx-cell { max-width: 0; width: 100%; }

.fx-drop {
  position: absolute;
  inset: 8px;
  border: 2px dashed var(--accent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  display: grid;
  place-items: center;
  font-weight: 600;
  color: var(--text);
  z-index: 4;
  pointer-events: none;
}
.fx-browser { position: relative; }

/* Transferências (envios e downloads) */
.fx-transfers { margin-bottom: 16px; }
.fx-tr { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 13px; }
.fx-tr:first-child { border-top: none; }
.fx-tr-main { flex: 1; min-width: 0; }
.fx-tr-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fx-tr-state { font-size: 12px; color: var(--text-3); }
.fx-tr-state.err { color: var(--danger); }
.fx-tr-state.ok { color: var(--success); }
.progress { height: 4px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; margin-top: 5px; }
.progress div { height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }

/* Editor */
.fx-editor-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.fx-editor-path { flex: 1; min-width: 0; font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-editor-path b { color: var(--text); font-weight: 600; }
.fx-dirty { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-left: 8px; vertical-align: 1px; }
.fx-editor-head .btn { height: 32px; padding: 0 12px; }
.fx-textarea {
  display: block;
  width: 100%;
  height: calc(100vh - 290px);
  min-height: 320px;
  border: none;
  resize: vertical;
  padding: 14px 18px;
  background: var(--surface);
  color: var(--text);
  font-family: "JetBrains Mono", ui-monospace, Consolas, monospace;
  font-size: 13px;
  line-height: 1.65;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
}
.fx-textarea:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent-soft); }

/* Menu suspenso ("...") */
.menu {
  position: fixed;
  z-index: 90;
  min-width: 190px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  box-shadow: var(--shadow-lg);
  padding: 5px;
  animation: pop 0.1s ease-out;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  border: none;
  background: none;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
}
.menu-item svg { color: var(--text-2); }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); outline: none; }
.menu-item.danger, .menu-item.danger svg { color: var(--danger); }
.menu-item.danger:hover { background: var(--danger-soft); }
.menu-sep { height: 1px; background: var(--border); margin: 5px 2px; }

.modal-input { margin-top: 12px; }
.modal-body p + .modal-input { margin-top: 12px; }
.modal.modal-lg { max-width: 640px; }
.modal-scroll { max-height: min(60vh, 520px); overflow: auto; border-top: 1px solid var(--border); }
.trash-row { display: flex; align-items: center; gap: 12px; padding: 10px 22px; border-top: 1px solid var(--border); }
.trash-row:first-child { border-top: none; }
.trash-main { flex: 1; min-width: 0; }
.trash-path { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trash-meta { font-size: 12px; color: var(--text-3); }
.trash-row .btn { height: 30px; padding: 0 11px; font-size: 12.5px; }

@media (max-width: 560px) {
  .fx-actions .btn .lbl { display: none; }
  .fx-actions .btn { padding: 0 9px; }
  .fx-textarea { height: calc(100vh - 260px); font-size: 12.5px; padding: 12px; }
  .trash-row { padding: 10px 16px; }
}

/* ---------- Histórico ---------- */
.hist-filters { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.hist-filters select.input { width: 170px; height: 32px; }
.hist-day { font-size: 12px; font-weight: 600; color: var(--text-2); padding: 9px 18px 7px; background: var(--surface-2); border-bottom: 1px solid var(--border); text-transform: capitalize; }
.hist-row { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--border); }
.hist-row:last-child { border-bottom: none; }
.hist-time { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 12px; color: var(--text-3); width: 44px; flex-shrink: 0; }
.hist-row .avatar { width: 28px; height: 28px; font-size: 11px; }
.hist-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.hist-text b { font-weight: 600; }
.hist-row.fail .hist-text { color: var(--danger); }
.hist-cat { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.hist-ip { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 11.5px; color: var(--text-3); white-space: nowrap; width: 120px; text-align: right; }
.hist-more { display: flex; justify-content: center; padding: 12px; border-top: 1px solid var(--border); }
@media (max-width: 700px) { .hist-ip, .hist-cat { display: none; } }

/* ---------- Jogadores ---------- */
.modal-fields { margin-top: 14px; }
.modal-fields .field:last-child { margin-bottom: 0; }
.pl-filters { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.pl-filters .grow { flex: 1; }
.pl-filters .btn { height: 32px; padding: 0 12px; }
.pl-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pl-head { width: 30px; height: 30px; border-radius: 6px; image-rendering: pixelated; flex-shrink: 0; background: var(--surface-2); }
.pl-letter { width: 30px; height: 30px; border-radius: 6px; flex-shrink: 0; background: var(--accent-soft); color: var(--accent-strong); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.pl-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 2px; }
.pl-tag { font-size: 11px; font-weight: 600; padding: 0 7px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); line-height: 18px; }
.pl-tag.online { background: var(--success-soft); color: var(--success); border-color: transparent; }
.pl-tag.op { background: var(--accent-soft); color: var(--accent-strong); border-color: transparent; }
.pl-tag.ban { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.pl-tag.mute { color: var(--danger); }
.pl-main { min-width: 0; }

/* ---------- Desempenho (gráficos de linha) ---------- */
.perf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.perf-grid .panel-head { flex-direction: column; align-items: flex-start; gap: 1px; }
.lc { position: relative; padding: 12px 14px 8px 6px; }
.lc svg { display: block; width: 100%; overflow: visible; }
.lc .grid-line { stroke: var(--chart-grid); stroke-width: 1; }
.lc .axis-text { fill: var(--text-3); font-size: 11px; font-family: inherit; font-variant-numeric: tabular-nums; }
.lc .ref-line { stroke: var(--danger); stroke-width: 1; stroke-dasharray: 4 4; opacity: 0.7; }
.lc .ref-text { fill: var(--danger); font-size: 11px; font-family: inherit; }
.lc .series { fill: none; stroke: var(--chart-bar); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.lc .area { fill: var(--chart-bar); opacity: 0.1; }
.lc .cross { stroke: var(--text-3); stroke-width: 1; }
.lc .dot { fill: var(--chart-bar); stroke: var(--surface); stroke-width: 2; }
.lc .hit { fill: transparent; cursor: crosshair; outline: none; }
.lc .hit:focus-visible { stroke: var(--accent); stroke-width: 2; }
.lc-empty { height: 170px; display: grid; place-items: center; color: var(--text-3); font-size: 13px; text-align: center; padding: 0 20px; }
.perf-note { font-size: 12.5px; color: var(--text-2); margin: -4px 0 16px; }
.kpi-value.warn { color: var(--danger); }
@media (max-width: 900px) { .perf-grid { grid-template-columns: 1fr; } }

/* ---------- Modal e toast ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12, 10, 9, 0.45);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 16px;
  animation: fade 0.12s ease-out;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: pop 0.14s ease-out;
}
.modal-body { padding: 20px 22px; }
.modal-body h3 { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
.modal-body p { margin: 0; color: var(--text-2); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 22px; border-top: 1px solid var(--border); background: var(--surface-2); }

.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast {
  background: var(--text);
  color: var(--bg);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  max-width: 360px;
  animation: slideup 0.18s ease-out;
}
.toast.error { background: var(--danger); color: #fff; }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(0.97); } }
@keyframes slideup { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: flex; flex-direction: column; }
.auth-top { display: flex; justify-content: space-between; align-items: center; padding: 18px 28px; }
.brand-inline { display: flex; align-items: center; gap: 10px; }
.auth-main { flex: 1; display: grid; place-items: center; padding: 24px 16px 64px; }
.auth-box { width: 100%; max-width: 360px; }
.auth-box h1 { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 6px; }
.auth-box .lead { color: var(--text-2); margin: 0 0 28px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.form-error { background: var(--danger-soft); color: var(--danger); font-size: 13px; padding: 9px 12px; border-radius: 7px; margin-bottom: 16px; }
.auth-foot { padding: 20px 28px; font-size: 12px; color: var(--text-3); text-align: center; }

/* ---------- Identidade Patriarcado ---------- */
.pixel-font { font-family: "Pixelify Sans", "Inter", sans-serif; letter-spacing: 0.01em; }
.brand-name.pixel-font { font-size: 16px; font-weight: 700; }
.brand-mark.pixel { background: none; width: auto; height: auto; border-radius: 0; }
.brand-mark.pixel svg, .hero-block svg, .creeper svg { display: block; image-rendering: pixelated; }

/* ---------- Login com cena em pixel art ---------- */
.login-page { background: var(--surface); }
.login-split { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(380px, 1fr); min-height: 100vh; }

.scene {
  --sky-top: #ffefb0;
  --sky-bottom: #fffbeb;
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, var(--sky-top), var(--sky-bottom) 70%);
  border-right: 1px solid var(--border);
  min-height: 420px;
}
html[data-theme="dark"] .scene { --sky-top: #0a0e22; --sky-bottom: #1b2246; }

/* Sol quadrado (dia) / lua (noite), como no jogo */
.sky-body {
  position: absolute;
  top: 56px;
  right: 72px;
  width: 64px;
  height: 64px;
  background: #fff7c2;
  box-shadow: inset 0 0 0 12px #ffd23f, 0 0 0 12px rgba(255, 210, 63, 0.18);
}
html[data-theme="dark"] .sky-body {
  width: 48px;
  height: 48px;
  background: #eceff7;
  box-shadow: inset 0 0 0 8px #cfd4e3, 0 0 0 10px rgba(236, 239, 247, 0.06);
}
html[data-theme="dark"] .sky-body::after {
  content: "";
  position: absolute;
  left: 12px;
  top: 14px;
  width: 8px;
  height: 8px;
  background: #b9bfd1;
  box-shadow: 14px 10px 0 #b9bfd1;
}

.cloud {
  position: absolute;
  left: 0;
  height: 16px;
  background: #ffffff;
  box-shadow: 0 6px 0 rgba(166, 124, 0, 0.08);
  animation: drift linear infinite;
}
.cloud::before { content: ""; position: absolute; left: 24px; right: 32px; top: -16px; height: 16px; background: inherit; }
.c1 { top: 104px; width: 144px; animation-duration: 80s; animation-delay: -20s; }
.c2 { top: 176px; width: 96px; animation-duration: 110s; animation-delay: -70s; }
.c3 { top: 56px; width: 112px; animation-duration: 140s; animation-delay: -110s; }
html[data-theme="dark"] .cloud { background: rgba(255, 255, 255, 0.07); box-shadow: none; }
@keyframes drift { from { transform: translateX(-220px); } to { transform: translateX(62vw); } }

.stars { position: absolute; inset: 0; display: none; }
html[data-theme="dark"] .stars { display: block; }
.stars i { position: absolute; width: 3px; height: 3px; background: #fff; opacity: 0.7; animation: twinkle 3s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: 0.15; } }

.scene-center {
  position: absolute;
  top: 22%;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  padding: 0 24px;
}
.hero-block { animation: bob 3.2s ease-in-out infinite; filter: drop-shadow(0 10px 0 rgba(88, 60, 0, 0.12)); }
@keyframes bob { 50% { transform: translateY(-8px); } }
.hero-title { font-size: 56px; font-weight: 700; line-height: 1; color: #3b2a06; text-shadow: 4px 4px 0 rgba(245, 184, 0, 0.35); }
.hero-sub { font-size: 14px; font-weight: 500; color: #6b5418; }
html[data-theme="dark"] .hero-title { color: #fff6d6; text-shadow: 4px 4px 0 rgba(0, 0, 0, 0.45); }
html[data-theme="dark"] .hero-sub { color: #c3c7de; }

/* Terreno: fileira de grama em cima, terra embaixo (blocos de 48px) */
.terrain {
  position: absolute;
  bottom: 0;
  background-image: var(--grass), var(--dirt);
  background-size: 48px 48px, 48px 48px;
  background-repeat: repeat-x, repeat;
  background-position: 0 0, 0 48px;
  image-rendering: pixelated;
}
.ground { left: 0; right: 0; height: 96px; z-index: 1; }
.hill-left { left: 0; width: 192px; height: 144px; z-index: 2; }
.hill-right { right: 0; width: 240px; height: 192px; z-index: 2; }
.creeper { position: absolute; bottom: 100%; left: 120px; }
html[data-theme="dark"] .terrain { filter: brightness(0.55) saturate(0.9); }

.login-side { display: flex; flex-direction: column; background: var(--surface); min-width: 0; }
.login-top { display: flex; justify-content: space-between; align-items: center; padding: 18px 28px; }
.login-top .brand-inline { visibility: hidden; }
.login-main { flex: 1; display: grid; place-items: center; padding: 24px 28px 48px; }

@media (max-width: 900px) {
  .login-split { grid-template-columns: 1fr; }
  .scene { min-height: 260px; height: 260px; border-right: none; border-bottom: 1px solid var(--border); }
  .scene-center { top: 26px; gap: 8px; }
  .hero-block svg { width: 52px; height: 52px; }
  .hero-title { font-size: 38px; }
  .hero-sub { font-size: 13px; }
  .sky-body { top: 24px; right: 24px; transform: scale(0.7); transform-origin: top right; }
  .ground { height: 48px; background-position: 0 0, 0 48px; }
  .hill-left { width: 96px; height: 96px; }
  .hill-right { width: 144px; height: 96px; }
  .creeper { left: 70px; transform: scale(0.6); transform-origin: bottom center; }
  .login-top { position: absolute; top: 0; right: 0; left: 0; z-index: 5; }
  .login-side { position: static; }
  .login-main { padding-top: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  .cloud, .hero-block, .stars i, .skeleton, .spin { animation: none; }
}

/* ---------- Responsivo ---------- */
.sidebar-scrim { display: none; }

@media (max-width: 1040px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 60; transform: translateX(-100%); transition: transform 0.2s ease-out; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .sidebar-scrim.show { display: block; position: fixed; inset: 0; background: rgba(12, 10, 9, 0.4); z-index: 50; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 0 16px; }
  .content { padding: 20px 16px; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-tools { flex-wrap: wrap; }
  .search { width: 100%; }
  .console { height: calc(100vh - 380px); }
}

/* Celular: filtros quebram linha e tabela larga rola de lado dentro do painel
   (o .panel tem overflow:hidden, então sem isso as colunas da direita sumiam). */
@media (max-width: 700px) {
  .segmented { flex-wrap: wrap; max-width: 100%; }
  .panel:has(.table), .table-scroll { overflow-x: auto; }
}

@media (max-width: 560px) {
  .kpis { gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 20px; }
  .table .col-hide { display: none; }
  .row { flex-wrap: wrap; }
  .auth-top { padding: 16px; }
}
