:root {
  --accent: #5BB8D4;
  --accent-hover: #3fa0be;
  --accent-subtle: rgba(91,184,212,0.12);
  --bg: #111318;
  --bg-card: #1c1f26;
  --bg-surface: #22262f;
  --bg-input: #1a1d24;
  --border: rgba(255,255,255,0.07);
  --text: #d0d4de;
  --text-muted: #6b7280;
  --text-dim: #9ca3af;
}

* { box-sizing: border-box; }

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: 0.875rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
}

/* ── Navbar ─────────────────────── */
#topnav {
  background-color: #0d0f14 !important;
  border-bottom: 1px solid var(--border) !important;
  padding: 0 1.5rem;
  height: 52px;
  display: flex;
  align-items: center;
}
#topnav .navbar-inner {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 2rem;
}
#topnav .brand {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  text-decoration: none;
  letter-spacing: -0.2px;
}
#topnav .brand span { color: var(--accent); }
#topnav .nav-links {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex: 1;
}
#topnav .nav-links a {
  color: var(--text-dim);
  font-size: 0.82rem;
  padding: 0.3rem 0.65rem;
  border-radius: 5px;
  transition: color 0.15s, background 0.15s;
  text-decoration: none;
}
#topnav .nav-links a:hover {
  color: #fff;
  background: rgba(255,255,255,0.06);
}
#topnav .nav-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}
#topnav .nav-right a {
  color: var(--text-dim);
  font-size: 0.82rem;
  padding: 0.3rem 0.65rem;
  border-radius: 5px;
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}
#topnav .nav-right a:hover { color: #fff; background: rgba(255,255,255,0.06); }
#topnav .nav-right .logout {
  color: #f87171;
}
#topnav .nav-right .logout:hover { background: rgba(248,113,113,0.1); color: #f87171; }

/* ── Sub-navs ───────────────────── */
.subnav {
  background-color: #0d0f14;
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: 34px;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-size: 0.78rem;
}
.subnav-label {
  font-weight: 700;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent);
  opacity: 0.8;
}
.subnav a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}
.subnav a:hover { color: var(--text); }

/* ── Page wrap ──────────────────── */
.page-wrap {
  display: flex;
  flex: 1;
}

/* ── Sidebar ────────────────────── */
#sidebar {
  width: 210px;
  min-width: 210px;
  background-color: #0d0f14;
  border-right: 1px solid var(--border);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.sidebar-section-title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
}
.status-badge::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.status-badge.online { color: #4ade80; }
.status-badge.online::before { background: #4ade80; box-shadow: 0 0 6px #4ade80; }
.status-badge.offline { color: #f87171; }
.status-badge.offline::before { background: #f87171; }
.online-count { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }

/* Login form */
.sidebar-form label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}
.sidebar-form input {
  display: block;
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-size: 0.82rem;
  padding: 0.35rem 0.6rem;
  margin-bottom: 0.6rem;
  outline: none;
  transition: border-color 0.15s;
}
.sidebar-form input:focus { border-color: var(--accent); }
.sidebar-form button {
  width: 100%;
  background: var(--accent);
  border: none;
  border-radius: 5px;
  color: #0d0f14;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.4rem;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 0.25rem;
}
.sidebar-form button:hover { background: var(--accent-hover); }

/* ── Main content ───────────────── */
#main-content {
  flex: 1;
  padding: 1.75rem 2rem;
  min-width: 0;
}
.page-title {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.page-title::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 1rem;
  background: var(--accent);
  border-radius: 2px;
}

/* ── Alerts ─────────────────────── */
.alert {
  padding: 0.65rem 0.9rem;
  border-radius: 6px;
  font-size: 0.83rem;
  margin-bottom: 1.2rem;
  border: 1px solid;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}
.alert-success  { background: rgba(74,222,128,0.06);  border-color: rgba(74,222,128,0.2);  color: #86efac; }
.alert-warning  { background: rgba(251,191,36,0.06);  border-color: rgba(251,191,36,0.2);  color: #fcd34d; }
.alert-danger   { background: rgba(248,113,113,0.06); border-color: rgba(248,113,113,0.2); color: #fca5a5; }
.alert-info     { background: var(--accent-subtle);   border-color: rgba(91,184,212,0.3);  color: var(--accent); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ── Cards ──────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border) !important;
  border-radius: 8px;
}
.card-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border) !important;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dim);
  padding: 0.6rem 1rem;
  border-radius: 8px 8px 0 0 !important;
}

/* ── Tables ─────────────────────── */
.table {
  --bs-table-bg: transparent;
  --bs-table-hover-bg: rgba(255,255,255,0.03);
  --bs-table-border-color: var(--border);
  color: var(--text);
  font-size: 0.83rem;
  margin: 0;
}
.table-wrap {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.table thead th {
  background: var(--bg-surface);
  color: var(--text-muted);
  border-color: var(--border) !important;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 0.55rem 0.9rem;
  white-space: nowrap;
}
.table td {
  border-color: var(--border) !important;
  padding: 0.5rem 0.9rem;
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }

/* ── Links ──────────────────────── */
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ── Badges / pills ─────────────── */
.admin-badge {
  display: inline-block;
  background: var(--accent-subtle);
  color: var(--accent);
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  vertical-align: middle;
  margin-left: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid rgba(91,184,212,0.25);
}

/* ── Pagination ─────────────────── */
.pagination-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem;
  margin: 0.8rem 0;
  font-size: 0.8rem;
}
.pagination-bar a {
  color: var(--text-dim);
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: all 0.15s;
}
.pagination-bar a:hover {
  color: #fff;
  background: var(--bg-surface);
  border-color: rgba(255,255,255,0.12);
}
.pagination-bar .current {
  font-weight: 700;
  color: var(--accent);
  padding: 0.2rem 0.55rem;
}
.showing { font-size: 0.76rem; color: var(--text-muted); margin: 0.3rem 0; display: block; }

/* ── Forms ──────────────────────── */
.form-control, .form-select {
  background-color: var(--bg-input) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  border-radius: 5px;
  font-size: 0.83rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(91,184,212,0.12) !important;
}
.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #0d0f14;
  font-weight: 700;
  border-radius: 5px;
}
.btn-accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #0d0f14; }
.btn-sm { font-size: 0.78rem; padding: 0.3rem 0.65rem; }

/* ── Detail tables ──────────────── */
#character th, #account th, #guild th, #report th {
  width: 28%;
  background: var(--bg-surface);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
}

/* ── Misc ───────────────────────── */
.error-page { display: flex; align-items: center; justify-content: center; min-height: 200px; font-size: 1.3rem; font-weight: 600; color: #f87171; }
.unban-form .form-control { display: inline-block; width: auto; }
.chat-log-table { font-family: 'Courier New', monospace; font-size: 0.76rem; }
.chat-log-table td { padding: 2px 6px !important; }
.search-card { max-width: 460px; margin-bottom: 1.5rem; }
.jumppage { font-size: 0.8rem; margin-bottom: 0.5rem; }
.jumppage input[type="text"] {
  width: 3rem; display: inline; padding: 0.15rem 0.35rem;
  background: var(--bg-surface); border: 1px solid var(--border);
  color: var(--text); border-radius: 4px;
}

/* ── Login button (navbar) ──────── */
.btn-nav-login {
  background: var(--accent);
  border: none;
  border-radius: 5px;
  color: #0d0f14;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.3rem 0.9rem;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-nav-login:hover { background: var(--accent-hover); }

/* ── Login modal ────────────────── */
.login-modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.login-modal-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.login-modal-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
}
.login-modal-body { padding: 1.25rem 1.1rem; }
.login-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
  font-weight: 500;
}
.login-input {
  display: block;
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-size: 0.85rem;
  padding: 0.45rem 0.7rem;
  outline: none;
  transition: border-color 0.15s;
}
.login-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(91,184,212,0.12); }
.login-submit {
  width: 100%;
  background: var(--accent);
  border: none;
  border-radius: 5px;
  color: #0d0f14;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.5rem;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 0.25rem;
}
.login-submit:hover { background: var(--accent-hover); }

/* ── Discord sidebar link ───────── */
.sidebar-discord {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.discord-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #7289da;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s;
}
.discord-link:hover { color: #a0b0f0; }
.discord-icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
  flex-shrink: 0;
}

/* ── Admin gif in tables ────────── */
.admin-icon {
  width: 14px;
  height: 14px;
  margin-right: 4px;
  vertical-align: middle;
}

/* ── Sidebar stats ──────────────── */
.sidebar-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
}
.sidebar-stat:last-child { border-bottom: none; }
.sidebar-stat span { color: var(--text-muted); }
.sidebar-stat strong { color: var(--text); font-weight: 600; }

/* ── News ───────────────────────── */
.news-post-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.news-post-header {
  background: var(--bg-surface);
  padding: 0.6rem 1rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 1px solid var(--border);
}
.news-post-form form { padding: 1rem; }
.news-post-form .form-control {
  font-size: 0.83rem;
  resize: vertical;
}

.news-list { display: flex; flex-direction: column; gap: 1rem; }
.news-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.news-card-header {
  background: var(--bg-surface);
  padding: 0.65rem 1rem;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}
.news-title {
  font-weight: 600;
  font-size: 0.92rem;
  color: #fff;
}
.news-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.news-body {
  padding: 0.9rem 1rem;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.6;
  white-space: pre-wrap;
}
.news-delete-form { padding: 0 1rem 0.75rem; }
.btn-delete {
  background: rgba(248,113,113,0.1);
  border: 1px solid rgba(248,113,113,0.25);
  color: #f87171;
  font-size: 0.73rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-delete:hover { background: rgba(248,113,113,0.2); }
.news-empty {
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 2rem 0;
  text-align: center;
}

/* ── Footer ─────────────────────── */
#footer {
  background: #0d0f14;
  border-top: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  font-size: 0.76rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}
#footer a { color: var(--text-muted); }
#footer a:hover { color: var(--text); }

@media (max-width: 768px) {
  .page-wrap { flex-direction: column; }
  #sidebar { width: 100%; min-width: 0; border-right: none; border-bottom: 1px solid var(--border); }
  #topnav .nav-links { display: none; }
}
