/* ============================================
   GHOSTWRITER CX - EXACT CSS CLONE
   Matching ghostwriter.cx perfectly
   ============================================ */

@import url('https://api.fontshare.com/v2/css?f[]=chillax@500,600,700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Montserrat:wght@600;700;800;900&display=swap');

:root {
  --spacing: 0.25rem;
  --radius: 0.875rem;
  --primary: #10b981;
  --primary-foreground: #022c22;
  --primary-glow: #34d399;
  --purple: #8b5cf6;
  --purple-glow: rgba(139, 92, 246, 0.3);
  --cyan: #06b6d4;
  --cyan-glow: rgba(6, 182, 212, 0.3);
  --amber: #f59e0b;
  --amber-glow: rgba(245, 158, 11, 0.3);
  --background: #080820;
  --foreground: #fafafe;
  --card: #111827;
  --card-foreground: #fafafe;
  --popover: #111827;
  --popover-foreground: #fafafe;
  --secondary: #1f2937;
  --secondary-foreground: #fafafe;
  --muted: #1f2937;
  --muted-foreground: #9ca3af;
  --accent: #10b981;
  --accent-foreground: #022c22;
  --destructive: #ef4444;
  --destructive-foreground: #fafafa;
  --success: #10b981;
  --success-foreground: #022c22;
  --warning: #f59e0b;
  --warning-foreground: #451a03;
  --border: rgba(255,255,255,0.06);
  --input: rgba(255,255,255,0.06);
  --ring: rgba(16,185,129,0.5);
  --text: #fafafe;
  --text-muted: #9ca3af;
  --danger: #ef4444;
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  --radius-2xl: calc(var(--radius) + 8px);
  --radius-3xl: calc(var(--radius) + 12px);
  --radius-full: 9999px;
  --font-display: "Montserrat", "Inter", system-ui, sans-serif;
  --font-sans: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --gradient-aurora: radial-gradient(80% 60% at 20% 20%, rgba(16,185,129,0.3), transparent 60%),
                     radial-gradient(70% 50% at 80% 30%, rgba(139,92,246,0.25), transparent 60%),
                     radial-gradient(60% 50% at 50% 80%, rgba(6,182,212,0.15), transparent 60%);
  --gradient-glass: linear-gradient(135deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.02) 50%, rgba(255,255,255,0.04) 100%);
  --gradient-primary: linear-gradient(135deg, #10b981, #34d399);
  --gradient-text: linear-gradient(180deg, #f7fdf9 0%, #10b981 100%);
  --glass-border: rgba(255,255,255,0.08);
  --shadow-glass: 0 1px 0 0 rgba(255,255,255,0.06) inset, 0 -1px 0 0 rgba(0,0,0,0.3) inset, 0 8px 32px -8px rgba(0,0,0,0.5);
  --shadow-elevated: 0 1px 0 0 rgba(255,255,255,0.06) inset, 0 20px 60px -20px rgba(0,0,0,0.7), 0 8px 24px -8px rgba(16,185,129,0.15);
  --shadow-glow: 0 0 0 1px rgba(16,185,129,0.2), 0 0 40px -10px rgba(16,185,129,0.45);
  --shadow-glow-strong: 0 0 0 1px rgba(16,185,129,0.35), 0 0 60px -10px rgba(16,185,129,0.6), 0 0 120px -20px rgba(16,185,129,0.35);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  background: #080820;
  color: var(--foreground);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  max-width: 100vw;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
input, textarea { font-family: inherit; }

/* ============================================
   OVERFLOW FIXES - GLOBAL
   ============================================ */
.app-layout,
.main-content,
.dashboard-wrap,
.page-content,
.dash-wrap,
.tool-wrap,
.stats-wrap,
.hist-wrap,
.cmp-wrap,
.batch-wrap {
  max-width: 100%;
  overflow-x: hidden;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Ensure no child element causes horizontal scroll */
.dash-card,
.kpi-card,
.glass,
.stat-card,
.detail-card,
.hist-item,
.cmp-panel,
.batch-file {
  overflow: hidden;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Fix inline grids on all pages */
[style*="grid-template-columns"] {
  max-width: 100%;
  overflow: hidden;
}

/* Prevent any container from overflowing viewport */
.glass,
.glass-strong,
.glass-subtle {
  max-width: 100%;
  overflow-x: hidden;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* ============================================
   AURORA BACKGROUND
   ============================================ */
.aurora-bg {
  isolation: isolate;
  position: relative;
  min-height: 100vh;
  max-width: 100vw;
  overflow-x: hidden;
}

.aurora-bg::before {
  content: "";
  background: var(--gradient-aurora);
  z-index: -2;
  pointer-events: none;
  position: absolute;
  inset: 0;
}

.aurora-bg::after {
  content: "";
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,0.04) 1px, transparent 0);
  background-size: 32px 32px;
  position: absolute;
  inset: 0;
  mask-image: radial-gradient(#000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(#000 30%, transparent 75%);
}

/* ============================================
   AURORA RIBBON (Animated Blobs)
   ============================================ */
.aurora-ribbon {
  pointer-events: none;
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: -1;
}

.aurora-ribbon::before,
.aurora-ribbon::after {
  content: "";
  filter: blur(120px);
  opacity: 0.5;
  border-radius: 50%;
  width: 80vw;
  height: 80vw;
  animation: 18s ease-in-out infinite aurora-drift;
  position: absolute;
}

.aurora-ribbon::before {
  background: radial-gradient(circle, rgba(16,185,129,0.6), transparent 70%);
  top: -20%;
  left: -20%;
}

.aurora-ribbon::after {
  background: radial-gradient(circle, rgba(139,92,246,0.4), transparent 70%);
  animation-delay: -9s;
  bottom: -30%;
  right: -20%;
}

@keyframes aurora-drift {
  0%, 100% { transform: translate(0) scale(1); }
  33% { transform: translate(10%, 5%) scale(1.1); }
}

/* ============================================
   GLASS EFFECTS
   ============================================ */
.glass {
  background: var(--gradient-glass);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-glass);
  position: relative;
}

.glass-shine::before {
  content: "";
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255,255,255,0.25), rgba(255,255,255,0.05), transparent 60%, rgba(16,185,129,0.1));
  padding: 1px;
  position: absolute;
  inset: 0;
  mask-image: linear-gradient(#000 0 0), linear-gradient(#000 0 0);
  -webkit-mask-image: linear-gradient(#000 0 0), linear-gradient(#000 0 0);
  mask-position: 0 0, 0 0;
  -webkit-mask-position: 0 0, 0 0;
  mask-size: auto, auto;
  -webkit-mask-size: auto, auto;
  mask-repeat: repeat, repeat;
  -webkit-mask-repeat: repeat, repeat;
  mask-clip: content-box, border-box;
  -webkit-mask-clip: content-box, border-box;
  mask-origin: content-box, border-box;
  -webkit-mask-origin: content-box, border-box;
  mask-composite: exclude;
  -webkit-mask-composite: xor;
}

.glass-strong {
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  backdrop-filter: blur(40px) saturate(200%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-elevated);
  background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.04));
}

.glass-subtle {
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
}

/* ============================================
   GLOW EFFECTS
   ============================================ */
.glow-primary { box-shadow: var(--shadow-glow); }
.glow-primary-strong { box-shadow: var(--shadow-glow-strong); }

/* ============================================
   TEXT GRADIENTS
   ============================================ */
.text-gradient {
  background: var(--gradient-text);
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
}

.text-gradient-primary {
  background: var(--gradient-primary);
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
}

/* ============================================
   GHOST FLOAT ANIMATION
   ============================================ */
.ghost-float {
  animation: 8s ease-in-out infinite ghost-float;
}

@keyframes ghost-float {
  0%, 100% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(-12px) rotate(2deg); }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.font-display { font-family: var(--font-display); }
.font-sans { font-family: var(--font-sans); }
.font-mono { font-family: var(--font-mono); }

.min-h-screen { min-height: 100vh; }
.overflow-x-hidden { overflow-x: hidden; }

/* Header */
header { position: fixed; top: 0; inset-x: 0; z-index: 50; }

/* Auth Pages */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.auth-box-wrapper { width: 100%; max-width: 420px; }

.auth-logo-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 32px;
}

.auth-box {
  border-radius: var(--radius-3xl);
  padding: 32px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: rgba(255,255,255,0.04);
  border-radius: var(--radius-xl);
  padding: 4px;
  margin-bottom: 28px;
}

.auth-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-foreground);
  transition: all 0.2s;
}

.auth-tab:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.auth-tab.active { color: var(--text); background: rgba(255,255,255,0.08); }

.auth-error {
  background: rgba(251,44,54,0.1);
  border: 1px solid rgba(251,44,54,0.25);
  color: var(--destructive);
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-size: 0.8rem;
  margin-bottom: 16px;
}

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted-foreground);
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.3);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input::placeholder { color: rgba(255,255,255,0.25); }
.form-group input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(16,185,129,0.15); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-xl);
  font-weight: 600;
  font-size: 0.875rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: var(--shadow-glow-strong);
}

.btn-primary:hover { transform: scale(1.03); }

.btn-primary svg { width: 16px; height: 16px; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover { background: rgba(255,255,255,0.05); color: var(--text); }

/* ============================================
   APP LAYOUT (Dashboard)
   ============================================ */
.app-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  max-width: 100%;
  overflow: hidden;
  min-height: 100vh;
}

@media (min-width: 1024px) {
  .app-layout { grid-template-columns: 240px 1fr; }
}

.sidebar {
  display: none;
}

@media (min-width: 1024px) {
  .sidebar {
    display: block;
    position: sticky;
    top: 16px;
    align-self: start;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(16,185,129,0.3) transparent;
  }
  .sidebar::-webkit-scrollbar { width: 4px; }
  .sidebar::-webkit-scrollbar-track { background: transparent; }
  .sidebar::-webkit-scrollbar-thumb { background: rgba(16,185,129,0.3); border-radius: 4px; }
}

.mobile-header { display: block; }
@media (min-width: 1024px) { .mobile-header { display: none; } }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.875rem;
  color: var(--muted-foreground);
  transition: all 0.2s;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
}

.sidebar-nav a:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.sidebar-nav a.active { background: rgba(16,185,129,0.15); color: var(--text); border-color: rgba(16,185,129,0.3); }
.sidebar-nav a.active svg { stroke: var(--primary); }
.sidebar-nav svg { width: 15px; height: 15px; flex-shrink: 0; }

.user-card { display: flex; align-items: center; gap: 12px; }
.user-avatar {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(16,185,129,0.4), rgba(16,185,129,0.1));
  border: 1px solid rgba(16,185,129,0.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 700; color: var(--primary);
}

.stat-box {
  border-radius: 12px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  padding: 8px;
  text-align: center;
}

.stat-box-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted-foreground);
}

.stat-box-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  margin-top: 2px;
}

.bonus-card {
  border-radius: 16px;
  padding: 12px;
  transition: all 0.2s;
  display: block;
  text-decoration: none;
  margin-bottom: 16px;
}

.bonus-card.ready { box-shadow: 0 0 60px rgba(16,185,129,0.15); }
.bonus-card:hover { background: rgba(255,255,255,0.05); }

.bonus-progress {
  height: 6px;
  border-radius: 3px;
  background: rgba(0,0,0,0.4);
  overflow: hidden;
}

.bonus-progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 1s;
}

.bonus-progress-fill.ready { background: linear-gradient(90deg, var(--primary), rgba(16,185,129,0.5)); }
.bonus-progress-fill.waiting { background: rgba(16,185,129,0.4); }

.mobile-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(7,10,8,0.8);
  backdrop-filter: blur(4px);
  display: none;
}

.mobile-overlay.open { display: block; }

.mobile-menu {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: 85%; max-width: 320px; z-index: 201;
  overflow-y: auto; padding: 16px;
  background: var(--background);
  border-right: 1px solid var(--border);
  transform: translateX(-100%);
  transition: transform 0.3s;
}

.mobile-menu.open { transform: translateX(0); }

/* ============================================
   TOOL PAGE
   ============================================ */
.tool-area textarea {
  width: 100%;
  min-height: 200px;
  padding: 16px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.3);
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.7;
  resize: vertical;
  outline: none;
  font-family: var(--font-sans);
}

.tool-area textarea::placeholder { color: rgba(255,255,255,0.2); }
.tool-area textarea:focus { border-color: var(--primary); }

.output-text {
  width: 100%;
  min-height: 200px;
  padding: 16px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.3);
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  overflow-y: auto;
  overflow-x: hidden;
}

.output-text.empty {
  color: rgba(255,255,255,0.2);
  font-style: italic;
}

/* Range Slider */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 0 12px rgba(16,185,129,0.5);
  border: 2px solid var(--primary-foreground);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 0 12px rgba(16,185,129,0.5);
  border: 2px solid var(--primary-foreground);
}

/* Layer toggles */
.layer-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--muted-foreground);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.layer-toggle.active {
  border-color: rgba(16,185,129,0.4);
  background: rgba(16,185,129,0.1);
  color: var(--primary);
}

.layer-toggle:hover { background: rgba(255,255,255,0.06); }

/* Stats bar */
.stats-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-xl);
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--muted-foreground);
}

.stat-pill strong { color: var(--text); }

/* ============================================
   ICON CONSISTENCY
   ============================================ */
.sidebar-nav svg,
.mobile-menu svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

header svg,
.section-header svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.kpi-icon svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

/* Inline SVG alignment */
svg {
  vertical-align: middle;
  display: inline-block;
  flex-shrink: 0;
}

/* ============================================
   RESPONSIVE TABLE WRAPPER
   ============================================ */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-responsive table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ping { 75%, 100% { transform: scale(2); opacity: 0; } }
@keyframes pulse { 50% { opacity: 0.5; } }

@keyframes shimmer {
  0%, 100% { transform: translate(-100%); }
  50% { transform: translate(100%); }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 rgba(16,185,129,0.4); }
  50% { box-shadow: 0 0 0 12px rgba(16,185,129,0); }
}

/* ============================================
   DASHBOARD RESPONSIVE INLINE STYLES OVERRIDE
   These ensure inline-styled elements respect breakpoints
   ============================================ */
.dash-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.dash-grid-3col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* ============================================
   TABLET (640px - 1024px)
   ============================================ */
@media (max-width: 1024px) and (min-width: 641px) {
  .sidebar { display: none !important; }
  .mobile-header { display: block !important; }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .charts-2col,
  .dash-2col {
    grid-template-columns: 1fr !important;
  }

  .dash-grid-2col {
    grid-template-columns: 1fr !important;
  }

  .dash-grid-3col {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ============================================
   MOBILE (< 640px)
   ============================================ */
@media (max-width: 640px) {
  html {
    font-size: 14px;
  }

  body {
    font-size: 0.85rem;
    line-height: 1.5;
  }

  h1 {
    font-size: 1.25rem !important;
  }

  h2 {
    font-size: 1.1rem !important;
  }

  h3 {
    font-size: 0.95rem !important;
  }

  .auth-box {
    padding: 20px 14px;
  }

  .auth-box-wrapper {
    max-width: 100%;
  }

  /* Glass morphism - reduce blur for performance */
  .glass,
  .glass-strong,
  .glass-subtle {
    -webkit-backdrop-filter: blur(12px) saturate(150%);
    backdrop-filter: blur(12px) saturate(150%);
    border-radius: 12px;
  }

  /* Sidebar hidden on mobile */
  .sidebar { display: none !important; }
  .mobile-header { display: block !important; }

  /* KPI grid */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }

  .kpi-card {
    padding: 12px !important;
    gap: 10px !important;
  }

  .kpi-icon {
    width: 36px !important;
    height: 36px !important;
    border-radius: 10px !important;
  }

  .kpi-icon svg {
    width: 18px !important;
    height: 18px !important;
  }

  .kpi-label {
    font-size: 0.6rem !important;
  }

  .kpi-value {
    font-size: 1.15rem !important;
  }

  /* HOY section */
  .hoy-grid,
  .dash-grid-3col {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  /* Charts 2-col */
  .charts-2col,
  .dash-2col,
  .dash-grid-2col {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  /* Dashboard containers */
  .dash-card {
    padding: 14px !important;
    border-radius: 12px !important;
  }

  /* App layout */
  .app-layout {
    gap: 12px;
  }

  /* Buttons */
  .btn {
    padding: 8px 14px;
    font-size: 0.8rem;
  }

  /* Auth page buttons */
  .auth-box .btn-primary {
    padding: 12px 16px !important;
    font-size: 0.85rem !important;
  }

  /* Tables */
  .table-responsive {
    margin: 0 -14px;
    padding: 0 14px;
  }

  /* Form inputs */
  .form-group input {
    padding: 10px 12px;
    font-size: 0.85rem;
  }

  /* Output text */
  .output-text {
    padding: 12px;
    font-size: 0.82rem;
  }

  /* Utility: word-wrap on all containers */
  div, span, p, td, th {
    overflow-wrap: break-word;
    word-wrap: break-word;
  }

  /* Prevent any inline-style overflow */
  [style*="display:grid"] {
    gap: 12px;
  }

  [style*="grid-template-columns: repeat(4"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  [style*="grid-template-columns: repeat(3"] {
    grid-template-columns: 1fr !important;
  }

  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  [style*="grid-template-columns:repeat(4"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  [style*="grid-template-columns:repeat(3"] {
    grid-template-columns: 1fr !important;
  }

  [style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* ============================================
   EXTRA SMALL (< 400px)
   ============================================ */
@media (max-width: 400px) {
  html {
    font-size: 13px;
  }

  .kpi-grid {
    grid-template-columns: 1fr !important;
  }

  .kpi-card {
    padding: 10px !important;
  }

  .auth-box {
    padding: 16px 12px;
    border-radius: 16px;
  }

  .btn {
    padding: 8px 12px;
    font-size: 0.75rem;
  }
}

/* ============================================
   ROLE BADGES — Neon colors with particles
   ============================================ */
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border-radius: 50px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  position: relative;
  overflow: hidden;
}

.role-badge::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50px;
  background: inherit;
  filter: blur(8px);
  opacity: 0;
  transition: opacity 0.3s;
  z-index: -1;
}
.role-badge:hover::before { opacity: 0.6; }

.role-badge-canvas {
  position: absolute;
  inset: 0;
  border-radius: 50px;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.role-badge-text { position: relative; z-index: 1; }
.role-badge-icon { position: relative; z-index: 1; font-size: 0.75rem; }

.role-badge.role-admin {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 50%, #ff0040 100%);
  color: #fff;
  border: 1px solid rgba(239,68,68,0.5);
  box-shadow: 0 0 20px rgba(239,68,68,0.4), inset 0 1px 0 rgba(255,255,255,0.15);
  text-shadow: 0 0 8px rgba(239,68,68,0.5);
}

.role-badge.role-moderator {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 50%, #fbbf24 100%);
  color: #1f1f1f;
  border: 1px solid rgba(245,158,11,0.5);
  box-shadow: 0 0 20px rgba(245,158,11,0.3), inset 0 1px 0 rgba(255,255,255,0.3);
}

.role-badge.role-user {
  background: linear-gradient(135deg, #10b981 0%, #059669 50%, #34d399 100%);
  color: #fff;
  border: 1px solid rgba(16,185,129,0.4);
  box-shadow: 0 0 16px rgba(16,185,129,0.3);
}
