@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* NexSkin Unified Design System — single source of truth */
:root {
  color-scheme: dark;
  --bg-main: #0B0D10;
  --bg-surface: #13171C;
  --bg-card: #191F25;
  --accent: #B7F36B;
  --accent-hover: #B7F36B;
  --text-main: #F4F6F8;
  --text-muted: #98A1AC;
  --border: #2A313A;
  --radius-card: 16px;
  --radius-btn: 12px;
  --font-main: 'Inter', sans-serif;
  --content-width: 1200px;
  --page-gutter: clamp(16px, 3.5vw, 32px);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --shadow-card: 0 16px 40px rgba(0,0,0,.18);
  --transition: 180ms ease;
}

*, *::before, *::after { box-sizing: border-box; }
html {
  min-height: 100%;
  background: var(--bg-main);
  color-scheme: dark;
  scroll-behavior: smooth;
  scrollbar-color: #39434E var(--bg-main);
}
body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg-main) !important;
  background-image: none !important;
  color: var(--text-main) !important;
  font: 400 15px/1.65 var(--font-main) !important;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body, body * { font-family: var(--font-main); }
img, svg, video, canvas { max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; }
button, input[type="button"], input[type="submit"], input[type="reset"] { cursor: pointer; }
a { color: var(--accent); text-decoration: none; transition: color var(--transition), opacity var(--transition); }
a:visited { color: var(--accent); }
a:hover { color: var(--accent); opacity: .82; }
p { margin: 0 0 1rem; color: var(--text-muted); }
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 .65em;
  color: var(--text-main) !important;
  font-weight: 700;
  letter-spacing: -.035em;
  line-height: 1.2;
}
h1 { font-size: clamp(2rem, 4.4vw, 3.5rem); }
h2 { font-size: clamp(1.55rem, 3vw, 2.35rem); }
h3 { font-size: 1.15rem; letter-spacing: -.02em; }
p, li, label, small, td, th, dt, dd, legend { color: var(--text-main); }
small, .hint, .muted, .subtitle, .section-subtitle { color: var(--text-muted); }
ul, ol { padding-inline-start: 1.35rem; }
::selection { background: var(--accent); color: var(--bg-main); }
:focus-visible { outline: 2px solid var(--accent) !important; outline-offset: 3px; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--space-5) 0; }

/* Shared page frame and navigation */
.container, .page-container, main {
  width: min(100% - (var(--page-gutter) * 2), var(--content-width));
  margin-inline: auto;
}
.navbar, .topbar-nav {
  position: relative;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  width: 100%;
  padding: 16px var(--page-gutter);
  background: rgba(11,13,16,.96) !important;
  color: var(--text-main);
  border: 0;
  border-bottom: 1px solid var(--border) !important;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--accent) !important;
  font-size: 22px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -.045em;
}
.nav-links, .nav-links-auth {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}
.nav-links > a, .nav-links-auth > a, .nav-login-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-btn);
  background: transparent !important;
  color: var(--text-muted) !important;
  font-weight: 600;
}
.nav-links > a:hover, .nav-links-auth > a:hover, .nav-login-link:hover {
  background: var(--bg-card) !important;
  color: var(--text-main) !important;
  border-color: var(--border);
  opacity: 1;
}
.nav-links > a.btn-primary, .nav-links-auth > a.btn-primary {
  background: var(--accent) !important;
  color: var(--bg-main) !important;
  border-color: var(--accent) !important;
}
.nav-user, .user-info { color: var(--text-main); }

/* Buttons — keep the shared .btn family as the only button system */
.btn, button, input[type="submit"], input[type="button"], input[type="reset"], a.button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn) !important;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  transition: background-color var(--transition), border-color var(--transition), color var(--transition), transform var(--transition);
}
.btn:hover, button:hover, input[type="submit"]:hover, input[type="button"]:hover, a.button:hover, .button:hover {
  transform: translateY(-1px);
}
.btn-primary, button[type="submit"], input[type="submit"], a.button, .button {
  background: var(--accent) !important;
  color: var(--bg-main) !important;
  border-color: var(--accent) !important;
}
.btn-primary:hover, button[type="submit"]:hover, input[type="submit"]:hover, a.button:hover, .button:hover {
  background: var(--accent) !important;
  color: var(--bg-main) !important;
  border-color: var(--accent) !important;
  opacity: .9;
}
.btn-outline, .btn-secondary, .btn-danger, .btn-admin, .btn-delete {
  background: transparent !important;
  color: var(--text-main) !important;
  border-color: var(--border) !important;
}
.btn-outline:hover, .btn-secondary:hover, .btn-admin:hover {
  background: var(--bg-surface) !important;
  border-color: var(--accent) !important;
  color: var(--accent) !important;
}
.btn-danger, .btn-delete { border-color: var(--border) !important; color: var(--text-main) !important; }
.btn-danger:hover, .btn-delete:hover { background: var(--bg-surface) !important; border-color: var(--border) !important; }
button:disabled, .btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* Landing page */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, .9fr);
  align-items: center;
  gap: clamp(28px, 5vw, 64px);
  width: min(100% - (var(--page-gutter) * 2), var(--content-width));
  min-height: min(760px, 82vh);
  margin-inline: auto;
  padding-block: clamp(48px, 8vw, 96px);
}
.hero-content h1 { max-width: 760px; margin-bottom: 22px; font-size: clamp(2.8rem, 6vw, 5.5rem); line-height: .99; letter-spacing: -.065em; }
.hero-content h1 span { color: var(--accent) !important; }
.hero-content p { max-width: 580px; margin-bottom: 28px; font-size: clamp(1rem, 1.4vw, 1.15rem); color: var(--text-muted); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-visual { position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; }
.hero-visual::before { content: ""; position: absolute; width: 65%; aspect-ratio: 1; border-radius: 50%; background: var(--accent); filter: blur(110px); opacity: .09; pointer-events: none; }
.hero-canvas-wrapper { position: relative; width: 100%; max-width: 420px; height: min(500px, 62vw); min-height: 300px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--bg-card); }
.section {
  width: min(100% - (var(--page-gutter) * 2), var(--content-width));
  margin-inline: auto;
  padding-block: clamp(44px, 7vw, 80px);
}
.section-title { margin-bottom: 12px; text-align: center; font-size: clamp(1.8rem, 3.5vw, 2.7rem); }
.section-subtitle { max-width: 680px; margin: 0 auto 36px; text-align: center; font-size: 1rem; }
.cards-grid, .servers-grid, .grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
  gap: 16px;
}
.card, .panel, .auth-card, .settings-card, .stat-card, .server-card,
.dashboard-card, .login-card, .form-card, .table-container,
.modal-content, .content-card, .info-card, .widget, .stat, .box-card,
.skin-card, .info-box, .warning-box, .msg {
  min-width: 0;
  background: var(--bg-card) !important;
  color: var(--text-main) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-card) !important;
  box-shadow: none;
}
.card, .panel, .settings-card, .stat-card, .server-card, .dashboard-card,
.login-card, .form-card, .content-card, .info-card, .widget, .skin-card {
  padding: clamp(18px, 2.6vw, 28px);
}
.card:hover, .server-card:hover, .skin-card:hover {
  border-color: var(--border) !important;
}
.card-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 18px;
  border-radius: 14px;
  background: rgba(183,243,107,.1);
  color: var(--accent);
  font-size: 22px;
}
.card h1, .card h2, .card h3, .panel h1, .panel h2, .panel h3 { color: var(--text-main) !important; }
.card p, .panel p, .server-card p, .info-card p { color: var(--text-muted); }

/* Page headers and common content */
.page-title, .page-header { margin: 0 auto 28px; }
.page-title h1, .page-header h1 { margin-bottom: 8px; font-size: clamp(1.8rem, 4vw, 2.8rem); }
.page-title p, .page-header p { max-width: 760px; color: var(--text-muted); }
.toc { padding: 18px 22px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--bg-surface); }
.info-box, .warning-box { padding: 16px 18px; margin-block: 16px; }
.warning-box { border-color: var(--border) !important; }
.empty { padding: 36px 20px; text-align: center; color: var(--text-muted); }
.msg { padding: 12px 16px; margin-block: 14px; }
.msg-error, .auth-error { padding: 12px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-surface); color: var(--text-muted) !important; }
.badge, .role-badge, .server-status, .active, .online {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
}
.online, .active { border-color: rgba(183,243,107,.35); background: rgba(183,243,107,.08); color: var(--accent) !important; }
.server-ip { color: var(--text-muted); overflow-wrap: anywhere; }

/* Forms and authentication */
form { min-width: 0; }
.form-group { margin: 0 0 18px; }
label, legend { display: block; margin-bottom: 7px; color: var(--text-muted); font-size: 13px; font-weight: 650; }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
select, textarea {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  padding: 11px 13px;
  border: 1px solid var(--border) !important;
  border-radius: 12px !important;
  background: var(--bg-surface) !important;
  color: var(--text-main) !important;
  box-shadow: none;
}
textarea { min-height: 110px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
input[type="file"] { max-width: 100%; color: var(--text-muted); }
input::placeholder, textarea::placeholder { color: var(--text-muted) !important; opacity: 1; }
input:focus, select:focus, textarea:focus { border-color: var(--accent) !important; outline: 2px solid rgba(183,243,107,.12); outline-offset: 0; }
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 28px 16px;
  background:
    radial-gradient(ellipse at 15% 10%, rgba(183,243,107,.07), transparent 36%),
    radial-gradient(ellipse at 90% 90%, rgba(183,243,107,.045), transparent 38%),
    var(--bg-main) !important;
}
.auth-page .auth-card {
  width: min(100%, 440px);
  margin: 0 auto;
  padding: clamp(24px, 5vw, 36px);
  background: var(--bg-card) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-card) !important;
  box-shadow: var(--shadow-card);
}
.auth-card h1 { margin-bottom: 8px; text-align: center; font-size: clamp(24px, 4vw, 30px); }
.auth-card > p, .auth-card .subtitle { margin: 0 0 24px; color: var(--text-muted); text-align: center; }
.auth-card label { margin: 14px 0 7px; color: var(--text-muted) !important; }
.auth-card input { width: 100%; }
.auth-card button[type="submit"], .auth-card .btn { width: 100%; margin-top: 8px; }
.auth-bottom, .auth-footer { margin-top: 22px; text-align: center; color: var(--text-muted); font-size: 14px; }
.auth-bottom a, .auth-footer a { color: var(--accent) !important; font-weight: 650; }
.provider-badge { display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin-bottom: 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-surface); color: var(--text-muted); }
.provider-badge .dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--accent); }
.notice-banner { width: min(100% - 32px, 1100px); margin: 0 auto 20px; padding: 12px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-surface); color: var(--text-muted); }

/* Data tables and stats */
table {
  width: 100%;
  border-collapse: collapse;
  border-color: var(--border) !important;
  color: var(--text-main);
}
.table-container { max-width: 100%; overflow-x: auto; }
thead, th { background: var(--bg-surface) !important; color: var(--text-main) !important; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--border) !important; text-align: left; vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
td { color: var(--text-muted); }
tbody tr { background: var(--bg-card) !important; }
tbody tr:hover { background: var(--bg-card) !important; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; }
.stat-num { color: var(--accent) !important; font-size: clamp(1.6rem, 3vw, 2.25rem); font-weight: 800; line-height: 1.1; }
.stat-label { margin-top: 6px; color: var(--text-muted) !important; font-size: 13px; }

/* Dialogs, feedback, and status states */
.modal-content { width: min(100%, 620px); padding: 24px; }
[hidden], .hidden { display: none !important; }
.success, .success-message { color: var(--accent) !important; }
.error, .error-message { color: var(--text-muted) !important; }
code, pre { font-family: ui-monospace, SFMono-Regular, Consolas, monospace !important; }
code { padding: 2px 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-surface); color: var(--accent); overflow-wrap: anywhere; }
pre { max-width: 100%; overflow: auto; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-surface); color: var(--text-main); }
.fade-in { animation: ns-fade-in .35s ease both; }
@keyframes ns-fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Override legacy inline palettes without touching page logic */
[style*="background: #fff"], [style*="background:#fff"],
[style*="background: #ffffff"], [style*="background:#ffffff"],
[style*="background-color: #fff"], [style*="background-color:#fff"],
[style*="background: white"], [style*="background:white"],
[style*="background-color: white"], [style*="background-color:white"],
[style*="background: #f0f"], [style*="background-color: #f0f"],
[style*="background: #f5"], [style*="background-color: #f5"],
[style*="background: #eaf"], [style*="background-color: #eaf"] {
  background-color: var(--bg-card) !important;
  color: var(--text-main) !important;
  border-color: var(--border) !important;
}
[style*="color: #333"], [style*="color:#333"],
[style*="color: #444"], [style*="color:#444"],
[style*="color: #555"], [style*="color:#555"],
[style*="color: #666"], [style*="color:#666"],
[style*="color: black"], [style*="color:black"],
[style*="color: #000"], [style*="color:#000"],
[style*="color: #1a"], [style*="color:#1a"],
[style*="color: #1976d2"], [style*="color:#1976d2"],
[style*="color: #4FC3F7"], [style*="color:#4FC3F7"] {
  color: var(--text-main) !important;
}
[style*="border-radius: 20px"], [style*="border-radius:20px"],
[style*="border-radius: 18px"], [style*="border-radius:18px"] {
  border-radius: var(--radius-card) !important;
}
button[style*="background"], a[style*="background"] {
  border-radius: var(--radius-btn) !important;
}
body { background-image: none !important; }

/* Responsive */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; min-height: auto; text-align: center; }
  .hero-content p { margin-inline: auto; }
  .hero-actions { justify-content: center; }
  .hero-visual { order: -1; }
  .hero-canvas-wrapper { max-width: 340px; height: 360px; }
  .nav-links-desktop { display: none; }
}
@media (max-width: 640px) {
  :root { --page-gutter: 16px; }
  .navbar, .topbar-nav { gap: 12px; padding-block: 12px; }
  .nav-links { gap: 4px; }
  .nav-links > a, .nav-links-auth > a { min-height: 36px; padding: 7px 9px; font-size: 13px; }
  .hero { padding-block: 42px; gap: 28px; }
  .hero-content h1 { font-size: clamp(2.4rem, 12vw, 3.5rem); }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .hero-actions .btn { width: 100%; }
  .hero-canvas-wrapper { height: 300px; min-height: 260px; }
  .section { padding-block: 42px; }
  .card, .panel, .settings-card, .stat-card, .server-card, .dashboard-card,
  .login-card, .form-card, .content-card, .info-card, .widget, .skin-card { padding: 18px; }
  .auth-page .auth-card { padding: 24px 20px; }
  table { display: block; max-width: 100%; overflow-x: auto; white-space: nowrap; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
