:root {
  --primary: #0099FF;
  --primary-hover: #0080dd;
  --sidebar-bg: #0f0f1a;
  --sidebar-color: rgba(255,255,255,0.85);
  --sidebar-hover: rgba(255,255,255,0.04);
  --sidebar-selected: rgba(0, 153, 255, 0.1);
  --sidebar-selected-bar: #0099FF;
  --navbar-bg: #0f0f1a;
  --navbar-border: rgba(255,255,255,0.06);
  --content-bg: #141420;
  --surface-bg: #1a1a2e;
  --surface-border: rgba(255,255,255,0.06);
  --surface-hover: rgba(255,255,255,0.03);
  --text-primary: #ffffff;
  --text-secondary: rgba(255,255,255,0.7);
  --text-muted: rgba(255,255,255,0.35);
  --danger: #f04747;
  --success: #43b581;
  --warning: #faa61a;
  --table-head-bg: rgba(0,0,0,0.2);
  --table-row-hover: rgba(255,255,255,0.02);
  --font-default: 'Onest', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --navbar-height: 56px;
  --sidebar-width: 240px;
  --sidebar-collapsed: 0px;
  --radius: 6px;
  --radius-sm: 4px;
}

@font-face {
  font-display: swap;
  font-family: Onest;
  font-style: normal;
  font-weight: 400;
  src: url(https://dashboard.sapph.xyz/fonts/onest-v2-latin-regular.woff2) format("woff2");
}
@font-face {
  font-display: swap;
  font-family: Onest;
  font-style: normal;
  font-weight: 500;
  src: url(https://dashboard.sapph.xyz/fonts/onest-v2-latin-500.woff2) format("woff2");
}
@font-face {
  font-display: swap;
  font-family: Onest;
  font-style: normal;
  font-weight: 600;
  src: url(https://dashboard.sapph.xyz/fonts/onest-v2-latin-600.woff2) format("woff2");
}
@font-face {
  font-display: swap;
  font-family: Onest;
  font-style: normal;
  font-weight: 700;
  src: url(https://dashboard.sapph.xyz/fonts/onest-v2-latin-700.woff2) format("woff2");
}

* { margin: 0; -webkit-tap-highlight-color: transparent; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: var(--font-default);
  background: var(--content-bg);
  color: var(--text-primary);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* ===== NAVBAR ===== */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--navbar-height);
  background: var(--navbar-bg);
  border-bottom: 1px solid var(--navbar-border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  z-index: 100;
  gap: 12px;
}
.navbar .burger {
  width: 28px;
  height: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 4px;
  transition: background .15s;
  flex-shrink: 0;
}
.navbar .burger:hover { background: var(--sidebar-hover); }
.navbar .burger .line {
  width: 18px;
  height: 2px;
  border-radius: 1px;
  background: var(--text-secondary);
  transition: transform .2s, opacity .2s;
}
.navbar .branding {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
  margin-right: 8px;
  flex-shrink: 0;
}
.navbar .branding .logo {
  width: 28px;
  height: 28px;
  background: var(--primary);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}
.navbar .server-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s;
  max-width: 280px;
}
.navbar .server-selector:hover { background: var(--sidebar-hover); }
.navbar .server-selector .icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
  overflow: hidden;
}
.navbar .server-selector .icon img { width: 100%; height: 100%; object-fit: cover; }
.navbar .server-selector .name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.navbar .server-selector .arrow {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform .2s;
  margin-left: auto;
  flex-shrink: 0;
}
.navbar .spacer { flex: 1; }
.navbar .user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s;
  position: relative;
}
.navbar .user:hover { background: var(--sidebar-hover); }
.navbar .user .avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
  flex-shrink: 0;
}
.navbar .user .avatar img { width: 100%; height: 100%; object-fit: cover; }
.navbar .user .username {
  font-size: 14px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 120px;
}
.navbar .user .arrow {
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ===== DROPDOWNS ===== */
.dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  background: var(--surface-bg);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  z-index: 700;
  min-width: 200px;
  max-height: 320px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.dropdown.open { display: block; }
.dropdown .option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background .1s;
}
.dropdown .option:hover { background: var(--sidebar-hover); }
.dropdown .option .opt-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
  overflow: hidden;
}
.dropdown .option .opt-icon img { width: 100%; height: 100%; object-fit: cover; }
.dropdown .option .opt-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.server-dropdown { left: 0; }
.user-dropdown { right: 0; min-width: 140px; }

/* ===== LAYOUT ===== */
.layout {
  display: flex;
  margin-top: var(--navbar-height);
  height: calc(100vh - var(--navbar-height));
  overflow: hidden;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--navbar-border);
  overflow-y: auto;
  overflow-x: hidden;
  transition: width .25s ease, min-width .25s ease;
  display: flex;
  flex-direction: column;
}
.sidebar.closed {
  width: var(--sidebar-collapsed);
  min-width: var(--sidebar-collapsed);
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 8px 0;
}
.sidebar .intro-line {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px 8px 12px;
  border-bottom: 1px solid var(--navbar-border);
  margin-bottom: 4px;
}
.sidebar .intro-line .home-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--sidebar-hover);
  cursor: pointer;
  font-size: 16px;
  transition: background .15s;
  color: var(--text-secondary);
  border: none;
}
.sidebar .intro-line .home-btn:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.sidebar .intro-line .reload-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .15s, color .15s;
  background: none;
  border: none;
  font-family: inherit;
}
.sidebar .intro-line .reload-btn:hover { background: var(--sidebar-hover); color: var(--text-secondary); }
.sidebar .label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  padding: 12px 16px 6px 16px;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background .12s, color .12s;
  border: none;
  background: none;
  text-decoration: none;
  position: relative;
  white-space: nowrap;
}
.sidebar-item:hover { background: var(--sidebar-hover); color: var(--text-primary); text-decoration: none; }
.sidebar-item.selected {
  background: var(--sidebar-selected);
  color: var(--text-primary);
}
.sidebar-item .bar {
  position: absolute;
  right: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  border-radius: 3px 0 0 3px;
  background: var(--sidebar-selected-bar);
  display: none;
}
.sidebar-item.selected .bar { display: block; }
.sidebar-item .icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  opacity: .7;
}
.sidebar-item:hover .icon { opacity: 1; }
.sidebar-item .error-count {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* ===== MAIN CONTENT ===== */
.content {
  flex: 1;
  overflow-y: auto;
  background: var(--content-bg);
}
.content-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px;
}

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}
.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}
.page-header .icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  opacity: .6;
}

/* ===== GUILD PICKER ===== */
.guild-picker {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--navbar-height) - 48px);
  row-gap: 24px;
  padding: 24px;
}
.guild-picker h1 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}
.guild-picker .sub {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.guild-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  width: 100%;
  max-width: 860px;
}
.guild-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface-bg);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 12px 16px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.guild-card:hover { background: var(--surface-hover); border-color: rgba(255,255,255,0.12); text-decoration: none; }
.guild-card .g-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
  overflow: hidden;
}
.guild-card .g-icon img { width: 100%; height: 100%; object-fit: cover; }
.guild-card .g-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== STATS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface-bg);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 16px;
}
.stat-card .stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}
.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}

/* ===== SETTINGS PATH TILES ===== */
.path {
  background: var(--surface-bg);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  margin-bottom: 6px;
  transition: border-color .15s;
}
.path:hover { border-color: rgba(255,255,255,0.1); }
.path .top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  min-height: 56px;
}
.path .text {
  flex: 1;
  min-width: 0;
}
.path .name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.path .description {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}
.path .right-side {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.path .right-side .arrow {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 12px;
  transition: transform .2s;
}
.path.open .right-side .arrow { transform: rotate(90deg); }
.path .content {
  display: none;
  padding: 0 18px 14px 18px;
  border-top: 1px solid var(--surface-border);
  margin-top: 0;
  padding-top: 14px;
}
.path.open .content { display: block; }
.path.clickable { cursor: pointer; }

/* ===== TOGGLE SWITCH ===== */
.toggle {
  width: 42px;
  height: 22px;
  border-radius: 11px;
  background: rgba(255,255,255,0.12);
  position: relative;
  cursor: pointer;
  transition: background .2s;
  flex-shrink: 0;
}
.toggle.on { background: var(--primary); }
.toggle .circle {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.toggle.on .circle { transform: translateX(20px); }

/* ===== SECTION LABEL ===== */
.section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  padding: 20px 4px 8px 4px;
}

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-muted);
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--surface-border);
  white-space: nowrap;
  background: var(--table-head-bg);
}
tbody td {
  font-size: 13px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--surface-border);
  color: var(--text-secondary);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--table-row-hover); }

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge.open { background: rgba(67, 181, 129, 0.15); color: var(--success); }
.badge.closed { background: rgba(255,255,255,0.06); color: var(--text-muted); }
.badge.warn, .badge.warning { background: rgba(250, 166, 26, 0.15); color: var(--warning); }
.badge.mute { background: rgba(169, 122, 240, 0.15); color: #a97af0; }
.badge.kick, .badge.ban { background: rgba(240, 71, 71, 0.15); color: var(--danger); }
.badge.timeout { background: rgba(250, 166, 26, 0.15); color: var(--warning); }

/* ===== FORMS ===== */
.form-group { margin-bottom: 12px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}
input, select, textarea {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 13px;
  width: 100%;
  font-family: var(--font-default);
  outline: none;
  transition: border .2s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
}
textarea { resize: vertical; min-height: 80px; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: opacity .15s;
  font-family: var(--font-default);
  white-space: nowrap;
  color: #fff;
}
.btn:hover { opacity: .8; color: #fff; text-decoration: none; }
.btn-primary { background: var(--primary); }
.btn-danger { background: var(--danger); }
.btn-success { background: var(--success); }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ===== EMPTY STATE ===== */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty .empty-icon { font-size: 32px; margin-bottom: 10px; opacity: .3; }
.empty p { font-size: 14px; }

/* ===== CALLOUT ===== */
.callout {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 12px 16px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  line-height: 1.6;
}

/* ===== LOGIN PAGE ===== */
body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #0f0f1a;
}
.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
}
.login-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  row-gap: 22px;
  background: var(--surface-bg);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 48px 52px;
  max-width: 400px;
  width: 100%;
}
.login-card .branding {
  display: flex;
  align-items: center;
  gap: 10px;
}
.login-card .branding .logo {
  width: 44px;
  height: 44px;
  background: var(--primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}
.login-card .branding .name {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}
.login-card h1 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
}
.login-card p {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
}
.btn-discord {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #5865F2;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: opacity .2s;
  font-family: inherit;
}
.btn-discord:hover { opacity: .85; color: #fff; }
.btn-discord svg { width: 20px; height: 20px; }
.login-card .footer-text {
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .navbar .branding .name { display: none; }
  .navbar .server-selector .name { max-width: 100px; }
  .navbar .user .username { display: none; }
  .content-inner { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .login-card { padding: 32px 24px; }
}
