/* ============================================
   LumeraStack — Global Design System
   Obsidian Editorial — v2
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600;9..40,700&display=swap');

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

/* ============================================
   Light theme overrides  (data-theme="light")
   Sidebar stays dark intentionally.
   ============================================ */
html[data-theme="light"] {
  --page-bg:       #f6f8fa;
  --card-bg:       #ffffff;
  --surface-up:    #eef1f5;
  --surface-hi:    #dde3ea;
  --border:        rgba(31,35,40,0.12);
  --border-focus:  #0969da;
  --text-primary:  #1f2328;
  --text-secondary:#636c76;
  --text-muted:    #6e7781;
  --gold-dim:      rgba(9,105,218,0.10);
  --gold-glow:     rgba(9,105,218,0.16);
  --teal-dim:      rgba(0,180,172,0.10);
  --accent:        #0969da;
  --accent-dark:   #0550ae;
  --accent-light:  rgba(9,105,218,0.10);
  --gold:          #0969da;
  --gold-dim:      rgba(9,105,218,0.10);
  --sidebar-active:#0969da;
  --sidebar-bg:    #f6f8fa;
  --sidebar-text:  #636c76;
  --shadow-xs:  0 1px 2px rgba(31,35,40,0.05);
  --shadow-sm:  0 2px 6px rgba(31,35,40,0.07), 0 1px 2px rgba(31,35,40,0.04);
  --shadow:     0 4px 12px rgba(31,35,40,0.08), 0 2px 4px rgba(31,35,40,0.04);
  --shadow-md:  0 8px 24px rgba(31,35,40,0.09), 0 4px 8px rgba(31,35,40,0.05);
  --shadow-lg:  0 20px 50px rgba(31,35,40,0.11), 0 8px 20px rgba(31,35,40,0.06);
}

/* Input autofill override for light mode */
html[data-theme="light"] input:-webkit-autofill,
html[data-theme="light"] input:-webkit-autofill:hover,
html[data-theme="light"] input:-webkit-autofill:focus {
  -webkit-text-fill-color: #1f2328 !important;
  -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
}

/* Search input placeholder in light mode */
html[data-theme="light"] .search-input::placeholder { color: rgba(31,35,40,0.35); }

/* Table row hover in light mode */
html[data-theme="light"] .admin-table tr:hover td { background: #f0f6fc; }
html[data-theme="light"] .admin-table thead tr th,
html[data-theme="light"] .admin-table th { background: #f6f8fa; }

/* ── Theme toggle button ── */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: calc(100% - 24px);
  margin: 0 12px 8px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  text-align: left;
}
.theme-toggle:hover {
  background: rgba(88,166,255,0.08);
  border-color: rgba(88,166,255,0.25);
  color: var(--accent);
}
.theme-toggle svg { flex-shrink: 0; opacity: 0.7; }
.theme-toggle:hover svg { opacity: 1; }

:root {
  /* Brand palette */
  --gold:          #58a6ff;
  --gold-dark:     #1f6feb;
  --gold-dim:      rgba(88,166,255,0.12);
  --gold-glow:     rgba(88,166,255,0.20);
  --teal:          #39d353;
  --teal-dim:      rgba(57,211,83,0.12);

  /* Semantic */
  --accent:        #58a6ff;
  --accent-dark:   #1f6feb;
  --accent-light:  rgba(88,166,255,0.12);
  --accent-mid:    #79b8ff;
  --success:       #3fb950;
  --success-light: rgba(63,185,80,0.12);
  --danger:        #f85149;
  --danger-light:  rgba(248,81,73,0.12);
  --warn:          #d29922;
  --warn-light:    rgba(210,153,34,0.12);

  /* Surface layers */
  --page-bg:       #0d1117;
  --card-bg:       #161b22;
  --surface-up:    #21262d;
  --surface-hi:    #30363d;

  /* Text */
  --text-primary:  #e6edf3;
  --text-secondary:#8b949e;
  --text-muted:    #6e7681;

  /* Borders */
  --border:        rgba(240,246,252,0.10);
  --border-focus:  #58a6ff;

  /* Sidebar */
  --sidebar-bg:    #010409;
  --sidebar-text:  #8b949e;
  --sidebar-active:#58a6ff;

  /* Radius */
  --radius-xs:     5px;
  --radius-sm:     10px;
  --radius:        14px;
  --radius-lg:     18px;
  --radius-xl:     24px;

  /* Shadows */
  --shadow-xs:     0 1px 2px rgba(0,0,0,0.25);
  --shadow-sm:     0 2px 6px rgba(0,0,0,0.30), 0 1px 2px rgba(0,0,0,0.20);
  --shadow:        0 4px 12px rgba(0,0,0,0.35), 0 2px 4px rgba(0,0,0,0.20);
  --shadow-md:     0 8px 24px rgba(0,0,0,0.40), 0 4px 8px rgba(0,0,0,0.25);
  --shadow-lg:     0 20px 50px rgba(0,0,0,0.55), 0 8px 20px rgba(0,0,0,0.30);
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  background: var(--page-bg);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ========================
   Alerts
======================== */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 20px;
  border: 1px solid;
  line-height: 1.5;
}
.alert-error  { background: var(--danger-light);  border-color: rgba(239,68,68,0.3);  color: #fca5a5; }
.alert-success{ background: var(--success-light); border-color: rgba(16,185,129,0.3); color: #6ee7b7; }

/* ========================
   Buttons
======================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
  line-height: 1;
  letter-spacing: -0.01em;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: #238636;
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(35,134,54,0.30);
}
.btn-primary:hover {
  background: #2ea043;
  box-shadow: 0 4px 16px rgba(35,134,54,0.40);
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  box-shadow: none;
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
  box-shadow: none;
}

.btn-success { background: var(--success); color: #fff; box-shadow: 0 2px 8px rgba(16,185,129,0.30); }
.btn-success:hover { background: #059669; }
.btn-warn    { background: var(--warn); color: #fff; box-shadow: 0 2px 8px rgba(245,158,11,0.30); }
.btn-warn:hover { background: #d97706; }
.btn-danger  { background: var(--danger); color: #fff; box-shadow: 0 2px 8px rgba(239,68,68,0.30); }
.btn-danger:hover { background: #dc2626; }

.btn-sm  { padding: 7px 13px; font-size: 13px; }
.btn-lg  { padding: 13px 26px; font-size: 15px; }
.btn-full { width: 100%; justify-content: center; }

.btn-text-danger {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
  font-weight: 500;
  text-decoration: underline;
}

/* ========================
   Forms
======================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}
.required { color: var(--danger); }
.field-hint  { font-size: 11px; font-weight: 400; color: var(--text-muted); margin-left: 4px; }
.field-note  { font-size: 12px; color: var(--text-muted); }
.char-count  { font-size: 12px; color: var(--text-muted); text-align: right; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="url"],
textarea,
select {
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--surface-up);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  width: 100%;
  line-height: 1.5;
}
input::placeholder, textarea::placeholder { color: #6e7681; }
input:hover:not(:focus):not(:disabled), textarea:hover:not(:focus) { border-color: rgba(240,246,252,0.18); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(88,166,255,0.12);
  background: rgba(88,166,255,0.04);
}
textarea { resize: vertical; min-height: 90px; }
.input-disabled {
  background: var(--page-bg) !important;
  color: var(--text-muted) !important;
  cursor: not-allowed;
  border-style: dashed;
}

/* Input with @ prefix */
.input-prefix {
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: var(--surface-up);
}
.input-prefix:hover { border-color: rgba(240,246,252,0.15); }
.input-prefix:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(212,168,67,0.12);
}
.prefix {
  padding: 11px 12px;
  background: var(--card-bg);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  border-right: 1.5px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.input-prefix input {
  border: none !important;
  box-shadow: none !important;
  border-radius: 0;
  flex: 1;
  background: transparent;
}
.input-prefix input:focus { box-shadow: none !important; }

/* Password toggle */
.input-with-toggle { position: relative; }
.input-with-toggle input {
  padding-right: 44px;
  color: var(--text-primary);
  -webkit-text-fill-color: var(--text-primary);
}
.toggle-pw {
  position: absolute; right: 12px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none; font-size: 16px;
  cursor: pointer; padding: 0; line-height: 1;
  color: var(--text-muted);
  z-index: 1;
}
.toggle-pw:hover { color: var(--text-secondary); }

/* Prevent browser autofill from overriding dark background */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text-primary) !important;
  -webkit-box-shadow: 0 0 0 1000px #21262d inset !important;
  transition: background-color 9999s ease-in-out 0s;
}

/* File input */
.file-input { display: none; }

/* Color picker */
.color-picker-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.color-input { width: 44px !important; height: 44px !important; padding: 3px !important; border-radius: var(--radius-sm) !important; cursor: pointer; }
.color-presets { display: flex; gap: 8px; flex-wrap: wrap; }
.color-swatch {
  width: 28px; height: 28px; border-radius: 7px; cursor: pointer;
  border: 2px solid transparent; transition: transform 0.15s, border-color 0.15s;
  box-shadow: var(--shadow-xs);
}
.color-swatch:hover { transform: scale(1.18); border-color: rgba(0,0,0,0.15); }

/* ========================
   Auth Page — Split Layout
======================== */
.auth-page {
  background: var(--page-bg);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.auth-split {
  display: grid;
  grid-template-columns: 380px 1fr;
  width: 100%;
  max-width: 860px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

/* Left brand panel */
.auth-brand-panel {
  background: var(--page-bg);
  border-right: 1px solid var(--border);
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  overflow: hidden;
}
.auth-brand-panel::before {
  content: '';
  position: absolute;
  bottom: -100px; left: -100px;
  width: 320px; height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212,168,67,0.12) 0%, transparent 70%);
  pointer-events: none;
}

.auth-brand-icon {
  width: 52px; height: 52px;
  background: var(--gold-dim);
  border: 1px solid rgba(212,168,67,0.3);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 28px;
  box-shadow: 0 4px 16px var(--gold-glow);
}

.auth-brand-title {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 12px;
}
.auth-brand-tagline {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 36px;
  font-weight: 300;
}

.auth-brand-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}
.auth-brand-features li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  color: var(--text-muted);
  font-weight: 400;
}
.auth-feat-dot {
  width: 22px; height: 22px; flex-shrink: 0;
  background: var(--gold-dim);
  border: 1px solid rgba(212,168,67,0.25);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.auth-feat-dot svg { color: var(--gold); }

.auth-brand-footer {
  margin-top: auto;
  padding-top: 32px;
  font-size: 12px;
  color: var(--text-dim, rgba(240,246,252,0.30));
}
.auth-brand-enterprise-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  transition: border-color 0.15s, color 0.15s;
}
.auth-brand-enterprise-link:hover {
  border-color: var(--teal);
  color: var(--teal);
}

/* Right form panel */
.auth-form-panel {
  background: var(--card-bg);
  padding: 48px 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Fallback single-panel container */
.auth-container {
  width: 100%;
  max-width: 480px;
}
.auth-card {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  padding: 44px 40px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  border-top: 3px solid var(--gold);
}

.auth-logo { margin-bottom: 32px; }
.logo-icon {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, #238636, #1a7f37);
  border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
  box-shadow: 0 4px 16px var(--gold-glow);
}
.logo-icon svg { display: block; }
.logo-text {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 22px; font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.logo-sub {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 5px;
  font-weight: 300;
}

.auth-form-title {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 26px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.auth-form-sub {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 28px;
  font-weight: 300;
}

.auth-form { display: flex; flex-direction: column; gap: 18px; }
.auth-link {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-muted);
}
.auth-link a {
  color: var(--gold);
  font-weight: 600;
  text-decoration: none;
}
.auth-link a:hover { opacity: 0.75; }

/* Divider */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0;
  font-size: 12px;
  color: var(--text-muted);
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Mobile: single column auth */
@media (max-width: 700px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-brand-panel { display: none; }
  .auth-form-panel { padding: 40px 28px; border-radius: var(--radius-xl); }
  .auth-split { border-radius: var(--radius-xl); }
}

/* ========================
   Dashboard Layout
======================== */
.dashboard-page {
  background: var(--page-bg);
  min-height: 100vh;
  display: flex;
}

/* Sidebar */
.sidebar {
  width: 248px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  padding: 0 0 24px;
  transition: transform 0.3s ease;
  box-shadow: 4px 0 32px rgba(0,0,0,0.4);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 22px 20px 20px;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.01em;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.sidebar-logo em { font-style: italic; color: var(--gold); }
.sidebar-logo svg { flex-shrink: 0; }

.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(240,246,252,0.22);
  padding: 8px 20px 4px;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 12px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
  position: relative;
}
.nav-item svg { flex-shrink: 0; opacity: 0.7; transition: opacity 0.15s; }
.nav-item:hover {
  background: rgba(240,246,252,0.08);
  color: var(--text-primary);
}
.nav-item:hover svg { opacity: 1; }
.nav-item.active {
  background: var(--gold-dim);
  color: var(--gold);
  font-weight: 600;
}
.nav-item.active svg { opacity: 1; color: var(--gold); }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%; transform: translateY(-50%);
  height: 20px; width: 3px;
  background: var(--gold);
  border-radius: 0 3px 3px 0;
}
.nav-icon { font-size: 16px; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 16px;
  margin: 0 12px;
  border-radius: var(--radius-sm);
  background: rgba(240,246,252,0.05);
  border: 1px solid var(--border);
  margin-bottom: 10px;
}
.sidebar-avatar {
  width: 36px; height: 36px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid rgba(212,168,67,0.25);
}
.sidebar-avatar-placeholder {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: rgba(212,168,67,0.12);
  color: var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
  border: 2px solid rgba(212,168,67,0.2);
}
.sidebar-user-info { min-width: 0; }
.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-plan {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: 99px;
  display: inline-block;
  margin-top: 3px;
  text-transform: uppercase;
}
.plan-free { background: rgba(240,246,252,0.09); color: rgba(240,246,252,0.55); }
.plan-pro  { background: linear-gradient(135deg, #238636, #1a7f37); color: #fff; }

.sidebar-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: calc(100% - 24px);
  margin: 0 12px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.sidebar-logout:hover {
  background: rgba(239,68,68,0.10);
  border-color: rgba(239,68,68,0.25);
  color: #fca5a5;
}

/* Mobile header */
.mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  z-index: 50;
  align-items: center;
  gap: 10px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.4);
}
.mobile-logo-text {
  font-family: 'DM Sans', system-ui, sans-serif;
  color: var(--text-primary); font-weight: 600; font-size: 18px; flex: 1;
}
.mobile-menu-btn { background: none; border: none; color: var(--text-primary); font-size: 22px; cursor: pointer; }

/* Main content */
.dashboard-main {
  margin-left: 248px;
  flex: 1;
  min-width: 0;          /* prevent flex overflow */
  padding: 36px 40px;
  min-height: 100vh;
}

.dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.page-title   { font-family: 'DM Sans', system-ui, sans-serif; font-size: 28px; font-weight: 600; color: var(--text-primary); letter-spacing: -0.02em; }
.page-sub     { font-size: 14px; color: var(--text-secondary); margin-top: 4px; font-weight: 300; }
.profile-link { color: var(--gold); text-decoration: none; font-weight: 500; }
.profile-link:hover { opacity: 0.75; }

.dashboard-stats { display: flex; gap: 10px; }
.stat-pill {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  min-width: 80px;
}
.stat-val { display: block; font-family: 'DM Sans', system-ui, sans-serif; font-size: 26px; font-weight: 600; color: var(--text-primary); letter-spacing: -0.02em; }
.stat-lbl { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-muted); margin-top: 2px; font-weight: 600; }

/* Form cards */
.form-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}
.form-card:hover { box-shadow: var(--shadow); }

.form-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.2px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.form-section-title::before {
  content: '';
  display: block;
  width: 3px; height: 16px;
  background: var(--gold);
  border-radius: 99px;
  flex-shrink: 0;
}

.dashboard-form { display: flex; flex-direction: column; gap: 16px; }
.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 4px;
}

/* Avatar upload */
/* Cover photo upload */
.cover-upload-area {
  position: relative;
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface-up);
  border: 1.5px dashed var(--border);
  cursor: pointer;
  min-height: 100px;
}
.cover-preview {
  width: 100%; height: auto;
  max-height: 160px;
  display: block;
  object-fit: cover;
}
.cover-preview-empty {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px; color: var(--text-muted); font-size: 13px; font-weight: 500;
}
.cover-upload-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0);
  display: flex; align-items: center; justify-content: center;
  gap: 10px;
  opacity: 0; transition: opacity 0.2s, background 0.2s;
}
.cover-upload-area:hover .cover-upload-overlay {
  opacity: 1; background: rgba(0,0,0,0.35);
}
.cover-upload-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: 10px;
  background: rgba(255,255,255,0.92); color: #111827;
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: none; transition: background 0.15s;
}
.cover-upload-btn:hover { background: rgba(255,255,255,0.98); }
.cover-remove-btn {
  display: inline-flex; align-items: center;
  padding: 9px 16px; border-radius: 10px;
  background: rgba(239,68,68,0.82); color: #fff;
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: none; transition: background 0.15s;
}
.cover-remove-btn:hover { background: rgba(239,68,68,1); }

.avatar-upload-area {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.avatar-preview-wrap { flex-shrink: 0; position: relative; }
.avatar-preview {
  width: 92px; height: 92px;
  border-radius: 18px;
  object-fit: cover;
  border: 2px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.avatar-preview-placeholder {
  width: 92px; height: 92px;
  border-radius: 18px;
  background: linear-gradient(135deg, #238636, #1a7f37);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
  font-weight: 700;
  box-shadow: 0 4px 16px var(--gold-glow);
}
.avatar-upload-info { display: flex; flex-direction: column; gap: 8px; }
.upload-hint { font-size: 12px; color: var(--text-muted); }
.social-label-icon { margin-right: 4px; }

/* ========================
   Admin Page
======================== */
.admin-page { background: var(--page-bg); min-height: 100vh; }
.admin-header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(0,0,0,0.3);
}
.admin-header-left { display: flex; align-items: center; gap: 12px; }
.admin-title { font-family: 'DM Sans', system-ui, sans-serif; color: var(--text-primary); font-size: 18px; font-weight: 600; letter-spacing: -0.02em; }
.admin-header-right { display: flex; align-items: center; gap: 16px; }
.admin-name { color: var(--text-muted); font-size: 14px; }
.back-btn { color: var(--text-muted); text-decoration: none; font-size: 14px; font-weight: 500; transition: color 0.15s; }
.back-btn:hover { color: var(--gold); }

.admin-container { max-width: 1200px; margin: 0 auto; padding: 32px; }

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  border-left: 3px solid var(--gold);
  transition: box-shadow 0.2s, transform 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-card-warn    { border-left-color: var(--warn); }
.stat-card-gold    { border-left-color: var(--gold); }
.stat-card-blue    { border-left-color: var(--teal); }
.stat-icon { font-size: 26px; }
.stat-num  { font-family: 'DM Sans', system-ui, sans-serif; font-size: 28px; font-weight: 600; color: var(--text-primary); letter-spacing: -0.02em; }
.stat-label{ font-size: 12px; color: var(--text-secondary); font-weight: 500; }

/* Table toolbar */
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.search-form { display: flex; gap: 8px; flex: 1; max-width: 400px; }
.search-input {
  flex: 1;
  padding: 9px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--surface-up);
  color: var(--text-primary);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input::placeholder { color: rgba(240,246,252,0.22); }
.search-input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212,168,67,0.12); }
.filter-tabs {
  display: flex; gap: 3px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
}
.filter-tab {
  padding: 6px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}
.filter-tab:hover { background: var(--surface-up); color: var(--text-primary); }
.filter-tab.active { background: var(--gold-dim); color: var(--gold); font-weight: 600; }

/* Admin table */
.table-wrap {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th {
  padding: 11px 16px;
  background: var(--surface-up);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: rgba(240,246,252,0.32);
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.admin-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-primary);
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: rgba(240,246,252,0.04); }
.table-empty { text-align: center; color: var(--text-muted); padding: 48px !important; font-size: 14px; }
.td-email  { color: var(--text-secondary); font-size: 13px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-num    { text-align: right; font-weight: 600; }
.td-date   { color: var(--text-secondary); font-size: 13px; white-space: nowrap; }

.user-cell { display: flex; align-items: center; gap: 10px; }
.table-avatar {
  width: 34px; height: 34px;
  border-radius: 9px;
  object-fit: cover; flex-shrink: 0;
}
.table-avatar-placeholder {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #238636, #1a7f37);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; flex-shrink: 0;
}
.user-cell-name     { font-weight: 600; font-size: 14px; }
.user-cell-username { font-size: 12px; color: var(--text-secondary); text-decoration: none; }
.user-cell-username:hover { color: var(--accent); }

.status-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.status-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-active   { background: rgba(16,185,129,0.12); color: #34d399; }
.status-inactive { background: rgba(239,68,68,0.12);  color: #f87171; }

.plan-select {
  padding: 4px 8px; border-radius: 6px;
  font-size: 12px; font-weight: 700;
  border: 1px solid var(--border); cursor: pointer;
  background: var(--surface-up); color: var(--text-primary);
}
.plan-select.plan-free { background: var(--surface-up); color: var(--text-muted); }
.plan-select.plan-pro  { background: var(--gold-dim); color: var(--gold); border-color: rgba(88,166,255,0.3); }

.table-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* Badges */
.badge-card   { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11px; font-weight: 700; background: rgba(16,185,129,0.12); color: #34d399; }
.badge-nocard { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11px; font-weight: 700; background: var(--surface-up); color: var(--text-muted); }

/* Pagination */
.pagination { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }
.page-btn {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 14px; font-weight: 500;
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text-primary);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.page-btn:hover  { border-color: var(--gold); color: var(--gold); background: var(--gold-dim); }
.page-btn.active { background: var(--gold-dim); color: var(--gold); border-color: rgba(212,168,67,0.4); font-weight: 700; }
.table-count { text-align: center; font-size: 13px; color: var(--text-muted); }

/* User detail */
.user-detail-header {
  display: flex; align-items: center; gap: 20px;
  margin-bottom: 28px; padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.user-detail-avatar { width: 80px; height: 80px; border-radius: 18px; object-fit: cover; flex-shrink: 0; box-shadow: var(--shadow-sm); }
.user-detail-avatar-placeholder {
  width: 80px; height: 80px; border-radius: 18px;
  background: linear-gradient(135deg, #238636, #1a7f37);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 700; flex-shrink: 0;
  box-shadow: 0 4px 16px var(--gold-glow);
}
.text-secondary { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }
.plan-badge-sm {
  display: inline-block; padding: 2px 10px; border-radius: 99px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.3px; margin-left: 6px;
}
.plan-badge-sm.plan-free { background: var(--surface-up); color: var(--text-muted); }
.plan-badge-sm.plan-pro  { background: var(--gold-dim); color: var(--gold); }

.detail-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0;
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; margin-bottom: 20px;
}
.detail-item {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 3px;
}
.detail-item:nth-child(even)  { border-right: none; }
.detail-item span   { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.6px; font-weight: 600; }
.detail-item strong { font-size: 14px; font-weight: 500; word-break: break-all; }
.detail-bio {
  padding: 16px; border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 20px;
}
.detail-bio span { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.6px; display: block; margin-bottom: 8px; font-weight: 600; }
.detail-bio p { font-size: 14px; color: var(--text-primary); line-height: 1.6; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ========================
   Responsive
======================== */
@media (max-width: 900px) {
  .dashboard-main { padding: 28px 24px; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .mobile-header { display: flex; }
  .dashboard-main { margin-left: 0; padding: 80px 16px 32px; max-width: 100%; }
  .form-row { grid-template-columns: 1fr; }
  .dashboard-header { flex-direction: column; }
  .admin-container { padding: 20px 16px; }
  .admin-header { padding: 12px 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .table-toolbar { flex-direction: column; align-items: stretch; }
  .filter-tabs { flex-wrap: wrap; }
  .auth-card { padding: 32px 24px; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-item { border-right: none; }
  .form-card { padding: 22px 20px; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .form-actions { flex-direction: column; }
  .dashboard-stats { flex-wrap: wrap; }
  .stat-pill { min-width: calc(50% - 5px); }
  .table-actions { flex-wrap: wrap; }
  .btn { font-size: 13px; padding: 9px 14px; }
  .auth-card { padding: 28px 18px; }
  .admin-container { padding: 16px 12px; }
  .detail-grid { grid-template-columns: 1fr; }
}

/* Ensure all tables scroll on mobile */
.table-wrap { -webkit-overflow-scrolling: touch; }

/* Touch-friendly tap targets */
@media (max-width: 768px) {
  .nav-item { padding: 12px 14px; min-height: 44px; }
  .btn { min-height: 40px; }
  input, textarea, select { font-size: 16px; } /* prevent iOS zoom */
  .filter-tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .filter-tab { white-space: nowrap; }
  .pagination { gap: 4px; }
  .page-btn { padding: 8px 10px; font-size: 13px; }
  .dashboard-header { gap: 12px; }
  .page-title { font-size: 20px; }
  .form-card { padding: 18px 16px; }
}
