/**
 * NEVER MARKET - Dark Theme (CRM Style)
 * Self-contained theme - works without external Bootstrap/Coderthemes
 */

/* ========== CSS Variables ========== */
:root {
  --nm-bg-body: #0f1117;
  --nm-bg-card: #1a1d29;
  --nm-bg-sidebar: #141722;
  --nm-bg-input: #1e2130;
  --nm-border: #2a2e42;
  --nm-text: #e4e6eb;
  --nm-text-muted: #8b8f9e;
  --nm-primary: #6c5ce7;
  --nm-primary-hover: #5b4bd4;
  --nm-success: #00cec9;
  --nm-danger: #ff6b6b;
  --nm-warning: #fdcb6e;
  --nm-info: #74b9ff;
  --nm-radius: 8px;
  --nm-radius-lg: 12px;
  --nm-shadow: 0 4px 24px rgba(0,0,0,.25);
  --nm-sidebar-width: 260px;
}

/* ========== Reset & Base ========== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--nm-text);
  background: var(--nm-bg-body);
  min-height: 100vh;
}

a { color: var(--nm-primary); text-decoration: none; }
a:hover { color: var(--nm-primary-hover); }
img { max-width: 100%; height: auto; }

/* ========== Auth Pages (Login / Register) - Unlock style ========== */
.auth-page-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 0.75rem;
  position: relative;
  overflow: hidden;
  /* Dark blue starry background */
  background: radial-gradient(ellipse 120% 80% at 50% 0%, #1a1d3a 0%, #0f1117 40%, #0a0c12 100%);
}

@media (min-width: 576px) {
  .auth-page-wrapper {
    padding: 2rem 1rem;
  }
}

@media (min-width: 768px) {
  .auth-page-wrapper {
    padding: 2rem 1.5rem;
  }
}

.auth-page-wrapper::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(2px 2px at 20% 30%, rgba(255,255,255,.25), transparent),
    radial-gradient(2px 2px at 40% 70%, rgba(255,255,255,.2), transparent),
    radial-gradient(1px 1px at 50% 50%, rgba(255,255,255,.3), transparent),
    radial-gradient(2px 2px at 80% 10%, rgba(255,255,255,.2), transparent),
    radial-gradient(1px 1px at 90% 60%, rgba(255,255,255,.25), transparent);
  background-size: 200px 200px, 300px 300px, 250px 250px, 280px 280px, 320px 320px;
  pointer-events: none;
  opacity: .9;
}

.auth-page-wrapper::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 60%;
  height: 100%;
  background: radial-gradient(ellipse, rgba(108, 92, 231, .08) 0%, transparent 70%);
  pointer-events: none;
}

.auth-page-content {
  width: 100%;
  max-width: 480px;
  position: relative;
  z-index: 1;
  padding: 0 1rem;
}

@media (min-width: 576px) {
  .auth-page-content {
    max-width: 520px;
    padding: 0 1.25rem;
  }
}

@media (min-width: 768px) {
  .auth-page-content {
    max-width: 560px;
  }
}

.auth-card {
  background: rgba(26, 29, 41, .95);
  border: 1px solid var(--nm-border);
  border-radius: 16px;
  box-shadow: 0 24px 48px rgba(0,0,0,.4), 0 0 0 1px rgba(255,255,255,.03);
  padding: 2rem 1.5rem;
}

@media (min-width: 576px) {
  .auth-card {
    padding: 2.5rem 2.5rem;
  }
}

@media (min-width: 768px) {
  .auth-card {
    padding: 2.75rem 3rem;
  }
}

/* Title only - no image next to NEVER MARKET */
.auth-logo-text {
  display: block;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  margin: 0 0 1.25rem 0;
}

@media (min-width: 576px) {
  .auth-logo-text {
    font-size: 1.65rem;
    margin-bottom: 1.5rem;
  }
}

/* Profile avatar on login card */
.auth-avatar-wrap {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--nm-border);
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
}

.auth-avatar-name {
  display: block;
  margin-top: 0.6rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--nm-text-muted);
}

.auth-card .auth-subtitle {
  color: var(--nm-text-muted);
  text-align: center;
  margin-bottom: 1.75rem;
  font-size: 1rem;
}

/* Spacing between form fields - clearer, not cramped */
.auth-field {
  margin-bottom: 1.25rem;
}

@media (min-width: 576px) {
  .auth-field {
    margin-bottom: 1.5rem;
  }
}

/* Auth form controls - larger labels and inputs */
.auth-card .form-label {
  display: block;
  font-weight: 500;
  color: var(--nm-text);
  margin-bottom: 0.5rem;
  font-size: 1rem;
  line-height: 1.4;
}

@media (min-width: 576px) {
  .auth-card .form-label {
    margin-bottom: 0.6rem;
    font-size: 1.05rem;
  }
}

.auth-card .form-control {
  width: 100%;
  min-height: 48px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--nm-text);
  background: var(--nm-bg-input);
  border: 1px solid var(--nm-border);
  border-radius: 10px;
  transition: border-color .2s;
}

@media (min-width: 576px) {
  .auth-card .form-control {
    min-height: 52px;
    padding: 0.85rem 1.15rem;
    font-size: 1.05rem;
    border-radius: var(--nm-radius);
  }
}

.auth-card .form-control::placeholder {
  color: var(--nm-text-muted);
}

.auth-card .form-control:focus {
  outline: none;
  border-color: var(--nm-primary);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, .2);
}

.auth-card .form-text {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--nm-text-muted);
}

/* Auth alerts */
.auth-card .alert {
  padding: 0.75rem 1rem;
  border-radius: var(--nm-radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.auth-card .alert-danger {
  background: rgba(255, 107, 107, .15);
  border: 1px solid var(--nm-danger);
  color: #ff8787;
}

.auth-card .alert-success {
  background: rgba(0, 206, 201, .15);
  border: 1px solid var(--nm-success);
  color: #55efc4;
}

/* Captcha - same spacing and larger inputs */
.auth-card .mb-3 {
  margin-bottom: 1.25rem !important;
}

@media (min-width: 576px) {
  .auth-card .mb-3 {
    margin-bottom: 1.5rem !important;
  }
}

.auth-card .input-group {
  display: flex;
  margin-bottom: 0.5rem;
}

.auth-card .input-group-text {
  min-height: 48px;
  padding: 0.75rem 1rem;
  background: var(--nm-primary);
  color: #fff;
  border: 1px solid var(--nm-primary);
  border-right: 0;
  border-radius: 10px 0 0 10px;
  font-weight: 600;
  font-size: 1rem;
}

@media (min-width: 576px) {
  .auth-card .input-group-text {
    min-height: 52px;
    padding: 0.85rem 1.15rem;
    font-size: 1.05rem;
    border-radius: var(--nm-radius) 0 0 var(--nm-radius);
  }
}

.auth-card .input-group .form-control {
  border-radius: 0 10px 10px 0;
  min-height: 48px;
}

@media (min-width: 576px) {
  .auth-card .input-group .form-control {
    border-radius: 0 var(--nm-radius) var(--nm-radius) 0;
    min-height: 52px;
  }
}

/* Auth buttons */
.auth-card .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 500;
  border: none;
  border-radius: var(--nm-radius);
  cursor: pointer;
  transition: background .2s, transform .05s;
}

.auth-card .btn:active { transform: scale(0.98); }

/* Unlock-style primary button (solid purple) - larger tap target */
.auth-card .btn-primary,
.auth-card .btn-unlock {
  width: 100%;
  min-height: 52px;
  padding: 0.85rem 1.25rem;
  background: var(--nm-primary);
  color: #fff;
  margin-top: 1rem;
  font-weight: 500;
  border-radius: 10px;
  font-size: 1.05rem;
}

@media (min-width: 576px) {
  .auth-card .btn-primary,
  .auth-card .btn-unlock {
    min-height: 56px;
    margin-top: 1.25rem;
    font-size: 1.1rem;
  }
}

.auth-card .btn-primary:hover,
.auth-card .btn-unlock:hover {
  background: var(--nm-primary-hover);
  color: #fff;
}

.auth-card .auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--nm-border);
  color: var(--nm-text-muted);
  font-size: 1rem;
  line-height: 1.5;
}

.auth-card .auth-footer a {
  color: var(--nm-info);
  font-weight: 500;
}

.auth-card .auth-footer a:hover {
  color: var(--nm-primary);
  text-decoration: underline;
}

/* Sidebar avatar */
.sidebar-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--nm-border);
  flex-shrink: 0;
}

/* Profile page avatar */
.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--nm-border);
}

/* Password toggle - enough room so placeholder text is visible */
.auth-pass-wrap {
  position: relative;
}

.auth-pass-wrap .form-control {
  padding-right: 3rem;
}

.auth-pass-toggle {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--nm-text-muted);
  cursor: pointer;
  padding: 0.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.auth-pass-toggle:hover {
  color: var(--nm-text);
}

.auth-pass-toggle .pass-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.auth-pass-toggle .pass-icon svg {
  display: block;
  vertical-align: middle;
}

/* Button inline SVG icons (Sign In / Sign Up) */
.btn-icon-svg {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}

.btn-icon-svg svg {
  display: block;
}

/* Loader spin for inline SVG */
svg.spin {
  animation: nm-spin 0.8s linear infinite;
}
@keyframes nm-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ========== Layout (Dashboard) ========== */
#layout-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar - ensure it sits on top and receives clicks */
.sidebar {
  width: var(--nm-sidebar-width);
  flex-shrink: 0;
  background: var(--nm-bg-sidebar);
  border-right: 1px solid var(--nm-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1050;
  pointer-events: auto;
  isolation: isolate;
}

.sidebar-brand {
  padding: 1.25rem;
  border-bottom: 1px solid var(--nm-border);
}

.sidebar-brand a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--nm-text);
  font-weight: 700;
  font-size: 1.1rem;
}

.sidebar-brand a:hover { color: var(--nm-primary); }

.sidebar-brand-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--nm-primary), var(--nm-primary-hover));
  border-radius: var(--nm-radius);
  color: #fff;
  flex-shrink: 0;
}

.sidebar-brand-icon svg {
  display: block;
  width: 22px;
  height: 22px;
}

.sidebar-user {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--nm-border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-user-info {
  min-width: 0;
}

.sidebar-user-name {
  display: block;
  font-weight: 600;
  color: var(--nm-text);
}

.sidebar-user-role {
  font-size: 0.8rem;
  color: var(--nm-text-muted);
}

.sidebar-menu-list {
  list-style: none;
  margin: 0;
  padding: 0.75rem 0;
  overflow-y: auto;
  flex: 1;
}

.sidebar-menu-item {
  display: block;
  margin: 0;
  padding: 0;
}

/* Full-area clickable: link is block, full width, comfortable padding */
.sidebar-menu-link {
  display: flex !important;
  align-items: center;
  gap: 0.75rem;
  width: 100% !important;
  min-height: 44px;
  padding: 0.75rem 1.25rem;
  color: var(--nm-text-muted);
  font-size: 0.9rem;
  text-decoration: none !important;
  transition: color .15s, background .15s;
  border: none;
  cursor: pointer !important;
  box-sizing: border-box;
  position: relative;
  z-index: 1;
  pointer-events: auto !important;
  -webkit-tap-highlight-color: rgba(108, 92, 231, .2);
}

.sidebar-menu-link:hover {
  color: var(--nm-primary);
  background: rgba(108, 92, 231, .1);
}

.sidebar-menu-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  color: inherit;
}

.sidebar-menu-icon svg {
  display: block;
  width: 20px;
  height: 20px;
}

.sidebar-menu-text {
  flex: 1;
  text-align: left;
}

.sidebar-menu-link--danger {
  color: var(--nm-text-muted);
}

.sidebar-menu-link--danger:hover {
  color: #fff !important;
  background: rgba(255, 107, 107, .25) !important;
}

.sidebar-menu-divider {
  height: 1px;
  background: var(--nm-border);
  margin: 0.5rem 1rem;
  list-style: none;
}

/* Main content - stay behind sidebar so sidebar links are clickable */
.main-content {
  flex: 1;
  margin-left: var(--nm-sidebar-width);
  min-height: 100vh;
  background: var(--nm-bg-body);
  position: relative;
  z-index: 1;
}

.page-content {
  padding: 1.5rem;
}

.container-fluid {
  max-width: 1400px;
  margin: 0 auto;
}

/* Purchases: slightly wider so address column is less cramped */
body.page-purchases .container-fluid {
  max-width: 1560px;
}

/* ========== Cards ========== */
.card {
  background: var(--nm-bg-card);
  border: 1px solid var(--nm-border);
  border-radius: var(--nm-radius-lg);
  box-shadow: var(--nm-shadow);
  margin-bottom: 1.5rem;
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--nm-border);
  font-weight: 600;
  color: var(--nm-text);
}

.card-body {
  padding: 1.25rem;
}

/* ========== Tables ========== */
.table-responsive {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  color: var(--nm-text);
}

.table thead th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--nm-text-muted);
  background: rgba(0,0,0,.2);
  border-bottom: 1px solid var(--nm-border);
}

.table tbody td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--nm-border);
}

.table tbody tr:hover {
  background: rgba(255,255,255,.02);
}

.table-hover tbody tr:hover {
  background: rgba(108, 92, 231, .06);
}

/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  border-radius: var(--nm-radius);
  cursor: pointer;
  transition: background .2s, opacity .2s;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--nm-primary), var(--nm-primary-hover));
  color: #fff;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--nm-primary-hover), #4a3bb8);
  color: #fff;
}

.btn-success {
  background: var(--nm-success);
  color: #1a1d29;
}

.btn-success:hover {
  background: #00b4b0;
  color: #1a1d29;
}

.btn-danger {
  background: var(--nm-danger);
  color: #fff;
}

.btn-light {
  background: var(--nm-bg-input);
  color: var(--nm-text);
  border: 1px solid var(--nm-border);
}

.btn-light:hover {
  background: var(--nm-border);
  color: var(--nm-text);
}

.btn-secondary {
  background: var(--nm-bg-input);
  color: var(--nm-text-muted);
  border: 1px solid var(--nm-border);
}

/* ========== Forms (general) ========== */
.form-label {
  font-weight: 500;
  color: var(--nm-text);
  margin-bottom: 0.4rem;
  font-size: 0.875rem;
}

.form-control {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  color: var(--nm-text);
  background: var(--nm-bg-input);
  border: 1px solid var(--nm-border);
  border-radius: var(--nm-radius);
}

.form-control:focus {
  outline: none;
  border-color: var(--nm-primary);
}

.form-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  color: var(--nm-text);
  background: var(--nm-bg-input);
  border: 1px solid var(--nm-border);
  border-radius: var(--nm-radius);
  cursor: pointer;
}

/* ========== Alerts ========== */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--nm-radius);
  margin-bottom: 1rem;
}

.alert-success {
  background: rgba(0, 206, 201, .15);
  border: 1px solid var(--nm-success);
  color: #55efc4;
}

.alert-danger {
  background: rgba(255, 107, 107, .15);
  border: 1px solid var(--nm-danger);
  color: #ff8787;
}

.alert-warning {
  background: rgba(253, 203, 110, .15);
  border: 1px solid var(--nm-warning);
  color: #fdcb6e;
}

.alert-info {
  background: rgba(116, 185, 255, .1);
  border: 1px solid var(--nm-info);
  color: #74b9ff;
}

.alert-dismissible {
  position: relative;
  padding-right: 2.5rem;
}

.btn-close {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: inherit;
  opacity: .7;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
}

.btn-close:hover { opacity: 1; }

/* ========== Badges ========== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 4px;
}

.badge.bg-success { background: var(--nm-success) !important; color: #0f1117; }
.badge.bg-danger { background: var(--nm-danger) !important; color: #fff; }
.badge.bg-info { background: var(--nm-info) !important; color: #0f1117; }
.badge.bg-warning { background: var(--nm-warning) !important; color: #0f1117; }

/* ========== Page title ========== */
.page-title-box {
  margin-bottom: 1.5rem;
}

.page-title-box h4 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--nm-text);
}

/* ========== Dashboard ========== */
.dashboard-page-title {
  color: #fff !important;
  font-size: 1.4rem !important;
  font-weight: 700 !important;
  letter-spacing: -0.02em;
  text-shadow: 0 1px 2px rgba(0,0,0,.2);
}

.dashboard-cards-row {
  margin-bottom: 1.5rem;
}

.dashboard-stat-card {
  min-height: 120px;
  border-radius: var(--nm-radius-lg);
  transition: box-shadow .2s, transform .02s;
}

.dashboard-stat-card:hover {
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
}

.dashboard-stat-label {
  margin: 0 0 0.35rem 0;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: rgba(255,255,255,.75);
}

.dashboard-stat-value {
  margin: 0 0 0.5rem 0;
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  text-shadow: 0 1px 2px rgba(0,0,0,.15);
}

.dashboard-stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dashboard-stat-icon svg {
  display: block;
}

.dashboard-stat-icon--info {
  background: rgba(116, 185, 255, .2);
  color: var(--nm-info);
}

.dashboard-stat-icon--success {
  background: rgba(0, 206, 201, .2);
  color: var(--nm-success);
}

.dashboard-stat-icon--warning {
  background: rgba(253, 203, 110, .2);
  color: var(--nm-warning);
}

.dashboard-stat-icon--danger {
  background: rgba(255, 107, 107, .2);
  color: var(--nm-danger);
}

.dashboard-stat-icon--primary {
  background: rgba(108, 92, 231, .25);
  color: var(--nm-primary);
}

.badge-pill {
  display: inline-block;
  padding: 0.3rem 0.65rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  border-radius: 20px;
}

.badge-balance { background: rgba(116, 185, 255, .3); color: #74b9ff; }
.badge-cards { background: rgba(0, 206, 201, .3); color: #00cec9; }
.badge-purchases { background: rgba(253, 203, 110, .3); color: #fdcb6e; }
.badge-sold { background: rgba(255, 107, 107, .3); color: #ff6b6b; }
.badge-users { background: rgba(108, 92, 231, .3); color: #a29bfe; }

.quick-actions-card .card-header {
  font-weight: 600;
  color: #fff;
}

.quick-actions-title {
  color: #fff !important;
  font-weight: 700;
}

.quick-action-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  font-weight: 600;
}

.quick-action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.quick-action-icon svg {
  display: block;
  flex-shrink: 0;
}

.btn-warning {
  background: var(--nm-warning);
  color: #0f1117;
}

.btn-warning:hover {
  background: #f5c842;
  color: #0f1117;
}

.btn-info {
  background: var(--nm-info);
  color: #0f1117;
}

.btn-info:hover {
  background: #5da8f5;
  color: #0f1117;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.85rem;
  color: var(--nm-text-muted);
}

.breadcrumb-item a { color: var(--nm-text-muted); }
.breadcrumb-item a:hover { color: var(--nm-primary); }
.breadcrumb-item.active { color: var(--nm-text); }

/* ========== Back to top ========== */
#back-to-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--nm-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: var(--nm-shadow);
  z-index: 99;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s, visibility .2s;
}

#back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

#back-to-top:hover {
  background: var(--nm-primary-hover);
  color: #fff;
}

/* ========== Modals ========== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 1040;
}

/* Only block clicks when modal is shown - avoid overriding Bootstrap's display: none */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal.show {
  display: flex;
}

.modal-dialog {
  background: var(--nm-bg-card);
  border: 1px solid var(--nm-border);
  border-radius: var(--nm-radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--nm-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header.bg-primary {
  background: linear-gradient(135deg, var(--nm-primary), var(--nm-primary-hover)) !important;
  color: #fff;
  border: none;
}

.modal-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-body {
  padding: 1.25rem;
}

/* ========== Progress bar ========== */
.progress {
  height: 8px;
  background: var(--nm-bg-input);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--nm-primary), var(--nm-success));
  border-radius: 4px;
  transition: width .3s;
}

/* ========== Utilities ========== */
.text-primary { color: var(--nm-primary) !important; }
.text-success { color: var(--nm-success) !important; }
.text-danger { color: var(--nm-danger) !important; }
.text-warning { color: var(--nm-warning) !important; }
.text-muted { color: var(--nm-text-muted) !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.me-1 { margin-right: 0.25rem !important; }
.me-2 { margin-right: 0.5rem !important; }
.me-3 { margin-right: 1rem !important; }

.d-flex { display: flex !important; }
.flex-column { flex-direction: column !important; }
.align-items-center { align-items: center !important; }
.justify-content-center { justify-content: center !important; }
.w-100 { width: 100% !important; }

.text-center { text-align: center !important; }
.border-bottom { border-bottom: 1px solid var(--nm-border); }
.rounded { border-radius: var(--nm-radius); }

/* RemixIcon fallback - use unicode or icon font if needed */
[class^="ri-"]::before,
[class*=" ri-"]::before {
  font-family: 'Remix Icon', 'Segoe UI', sans-serif;
  font-style: normal;
  speak: none;
}

/* Row / Col grid */
.row {
  display: flex;
  flex-wrap: wrap;
  margin: -0.5rem;
}

.row > [class*="col-"] {
  padding: 0.5rem;
}

.col-6 { flex: 0 0 50%; max-width: 50%; }
.col-12 { flex: 0 0 100%; max-width: 100%; }
.col-md-3 { flex: 0 0 25%; max-width: 25%; }
.col-md-6 { flex: 0 0 50%; max-width: 50%; }
.col-md-12 { flex: 0 0 100%; max-width: 100%; }
.col-xl-3 { flex: 0 0 25%; max-width: 25%; }

@media (min-width: 768px) {
  .col-md-2 { flex: 0 0 16.666%; max-width: 16.666%; }
  .col-md-3 { flex: 0 0 25%; max-width: 25%; }
  .col-md-6 { flex: 0 0 50%; max-width: 50%; }
  .col-md-12 { flex: 0 0 100%; max-width: 100%; }
}

@media (min-width: 1200px) {
  .col-xl-3 { flex: 0 0 20%; max-width: 20%; }
}

.row.g-3 { margin: -0.75rem; }
.row.g-3 > [class*="col-"] { padding: 0.75rem; }

.flex-grow-1 { flex-grow: 1 !important; }
.overflow-hidden { overflow: hidden !important; }
.mb-sm-0 { margin-bottom: 0 !important; }
.m-0 { margin: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }

@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
}

/* ========== Bootstrap 5 Dark Overrides ========== */
body .card {
  background-color: var(--nm-bg-card);
  border-color: var(--nm-border);
}

body .form-control,
body .form-select {
  background-color: var(--nm-bg-input);
  border-color: var(--nm-border);
  color: var(--nm-text);
}

body .form-control:focus,
body .form-select:focus {
  background-color: var(--nm-bg-input);
  border-color: var(--nm-primary);
  color: var(--nm-text);
}

body .form-control::placeholder {
  color: var(--nm-text-muted);
}

body .dropdown-menu {
  background: var(--nm-bg-card);
  border: 1px solid var(--nm-border);
}

body .dropdown-item {
  color: var(--nm-text);
}

body .dropdown-item:hover {
  background: rgba(108, 92, 231, .2);
  color: var(--nm-primary);
}

body .modal-content {
  background: var(--nm-bg-card);
  border-color: var(--nm-border);
}

body .table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--nm-text);
  --bs-table-border-color: var(--nm-border);
}

body .pagination .page-link {
  background: var(--nm-bg-input);
  border-color: var(--nm-border);
  color: var(--nm-text);
}

body .pagination .page-link:hover {
  background: var(--nm-border);
  color: var(--nm-primary);
}

body .pagination .page-item.active .page-link {
  background: var(--nm-primary);
  border-color: var(--nm-primary);
}

/* Admin panel: avatar and subtle backgrounds (SVG icons already inline) */
.avatar-sm { width: 3rem; height: 3rem; flex-shrink: 0; }
.avatar-title { display: inline-flex; align-items: center; justify-content: center; width: 100%; height: 100%; border-radius: var(--nm-radius); font-size: 1.25rem; }
.bg-primary-subtle { background: rgba(108, 92, 231, .2) !important; }
.bg-success-subtle { background: rgba(0, 206, 201, .2) !important; }
.d-inline-flex { display: inline-flex !important; }
