/* ==========================================================
   TestverQA Playground — Elegant Theme
   ========================================================== */

:root {
  /* Brand */
  --brand-50:  #eef2ff;
  --brand-100: #e0e7ff;
  --brand-200: #c7d2fe;
  --brand-300: #a5b4fc;
  --brand-400: #818cf8;
  --brand-500: #6366f1;
  --brand-600: #4f46e5;
  --brand-700: #4338ca;
  --brand-800: #3730a3;
  --brand-900: #312e81;

  --accent: #14b8a6;
  --accent-light: #5eead4;

  /* Neutrals */
  --gray-50:  #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  /* Semantic */
  --success: #10b981;
  --warning: #f59e0b;
  --danger:  #ef4444;
  --info:    #3b82f6;

  /* Layout */
  --bg:           #f7f8fc;
  --surface:      #ffffff;
  --surface-2:    #fbfbfd;
  --border:       #e6e8ef;
  --text:         #1a1d29;
  --text-muted:   #64748b;
  --text-soft:    #94a3b8;

  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
  --shadow:    0 4px 6px -1px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 20px 25px -5px rgba(15, 23, 42, 0.10), 0 8px 10px -6px rgba(15, 23, 42, 0.05);
  --shadow-xl: 0 25px 50px -12px rgba(15, 23, 42, 0.18);

  --radius-sm: 6px;
  --radius:    10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --gradient-brand: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
  --gradient-cool:  linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
  --gradient-warm:  linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  --gradient-mint:  linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
  --gradient-soft:  linear-gradient(135deg, #eef2ff 0%, #fdf4ff 100%);

  --header-h: 68px;
  --sidebar-w: 280px;
}

/* Dark theme */
[data-theme="dark"] {
  --bg:         #0b1020;
  --surface:    #131a2e;
  --surface-2:  #0f1628;
  --border:     #233056;
  --text:       #e6eaf3;
  --text-muted: #94a3b8;
  --text-soft:  #64748b;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow:    0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
}

/* ==========================================================
   Base
   ========================================================== */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--brand-600); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--brand-700); }

h1, h2, h3, h4, h5 {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 .6rem 0;
}

h1 { font-size: 2.1rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.05rem; }

code {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .875em;
  background: var(--gray-100);
  color: var(--brand-700);
  padding: 2px 6px;
  border-radius: 4px;
}
[data-theme="dark"] code { background: rgba(99,102,241,.15); color: var(--brand-300); }

::selection { background: var(--brand-200); color: var(--brand-900); }

/* ==========================================================
   Top header
   ========================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(1.5) blur(12px);
  -webkit-backdrop-filter: saturate(1.5) blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
}

[data-theme="dark"] .app-header {
  background: rgba(19, 26, 46, 0.85);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -.02em;
  color: var(--text);
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.app-brand:hover { color: var(--text); }

.app-brand .logo {
  height: 32px;
  width: auto;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.app-brand .brand-text {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -.02em;
  color: var(--text);
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.app-brand .brand-text .text-soft {
  -webkit-text-fill-color: var(--text-soft);
  background: none;
}
.app-brand.lg .brand-text { font-size: 1.4rem; }
.app-brand .logo img {
  height: 100%;
  width: auto;
  max-height: 32px;
  object-fit: contain;
  display: block;
}
/* Larger variant used on auth side panel + 404 etc. */
.app-brand.lg .logo { height: 44px; }
.app-brand.lg .logo img { max-height: 44px; }
/* Show light logo by default; dark logo only in dark theme */
.app-brand .logo .logo-dark { display: none; }
[data-theme="dark"] .app-brand .logo .logo-light { display: none; }
[data-theme="dark"] .app-brand .logo .logo-dark { display: block; }

.header-spacer { flex: 1; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all .15s ease;
}
.icon-btn:hover {
  color: var(--brand-600);
  border-color: var(--brand-300);
  background: var(--brand-50);
  transform: translateY(-1px);
}

.search-box {
  position: relative;
  width: 320px;
  max-width: 100%;
}
.search-box input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 10px;
  height: 38px;
  padding: 0 14px 0 38px;
  color: var(--text);
  font-size: .92rem;
  outline: none;
  transition: all .15s;
}
.search-box input:focus {
  border-color: var(--brand-400);
  box-shadow: 0 0 0 4px rgba(99,102,241,.12);
  background: var(--surface);
}
.search-box svg {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-soft);
}

/* User menu (dropdown) */
.user-menu {
  position: relative;
}
.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 3px 12px 3px 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
  color: var(--text);
}
.user-pill:hover {
  border-color: var(--brand-300);
  background: var(--brand-50);
}
[data-theme="dark"] .user-pill:hover { background: rgba(99,102,241,.12); }
.user-menu.open .user-pill {
  border-color: var(--brand-400);
  background: var(--brand-50);
}
[data-theme="dark"] .user-menu.open .user-pill { background: rgba(99,102,241,.15); }
.user-pill img {
  width: 30px; height: 30px;
  border-radius: 50%;
  object-fit: cover;
}
.user-pill .name {
  font-weight: 600;
  font-size: .9rem;
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-pill .chev {
  color: var(--text-soft);
  transition: transform .2s;
}
.user-menu.open .user-pill .chev { transform: rotate(180deg); color: var(--brand-600); }

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-xl);
  padding: 6px;
  z-index: 1050;
  animation: rise .18s ease;
}
.user-dropdown[hidden] { display: none; }

.user-dropdown-head {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  background: var(--surface-2);
  margin-bottom: 4px;
}
.user-dropdown-head img {
  width: 44px; height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--surface);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.user-dropdown-head .meta { min-width: 0; }
.user-dropdown-head .full {
  font-weight: 700;
  font-size: .95rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-dropdown-head .email {
  font-size: .8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 4px;
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  font-weight: 500;
  font-size: .9rem;
  text-decoration: none;
  transition: background .12s, color .12s;
}
.user-dropdown-item:hover {
  background: var(--brand-50);
  color: var(--brand-700);
}
[data-theme="dark"] .user-dropdown-item:hover { background: rgba(99,102,241,.15); color: var(--brand-300); }
.user-dropdown-item svg {
  width: 16px; height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.user-dropdown-item:hover svg { color: var(--brand-600); }
[data-theme="dark"] .user-dropdown-item:hover svg { color: var(--brand-400); }

.user-dropdown-item.danger { color: var(--danger); }
.user-dropdown-item.danger svg { color: var(--danger); }
.user-dropdown-item.danger:hover {
  background: rgba(239,68,68,.08);
  color: var(--danger);
}
.user-dropdown-item.danger:hover svg { color: var(--danger); }

/* ==========================================================
   Layout: sidebar + content
   ========================================================== */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - var(--header-h));
}

.app-sidebar {
  border-right: 1px solid var(--border);
  background: var(--surface);
  padding: 18px 14px;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
}

.app-sidebar h6 {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-soft);
  margin: 18px 12px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: .92rem;
  margin: 2px 0;
  transition: all .12s;
  cursor: pointer;
  position: relative;
}
.nav-item:hover {
  background: var(--gray-100);
  color: var(--text);
}
[data-theme="dark"] .nav-item:hover { background: rgba(99,102,241,.12); }

.nav-item.active {
  background: var(--brand-50);
  color: var(--brand-700);
  font-weight: 600;
}
[data-theme="dark"] .nav-item.active {
  background: rgba(99,102,241,.18);
  color: var(--brand-300);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: -14px; top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--brand-600);
}

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.nav-badge {
  margin-left: auto;
  font-size: .7rem;
  background: var(--brand-100);
  color: var(--brand-700);
  padding: 1px 8px;
  border-radius: 999px;
  font-weight: 700;
}

.app-content {
  padding: 32px 40px 60px;
  max-width: 1400px;
  width: 100%;
}

/* ==========================================================
   Page header
   ========================================================== */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}
.page-header .eyebrow {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--brand-600);
  margin-bottom: 8px;
}
.page-header p { color: var(--text-muted); margin: 4px 0 0; max-width: 720px; }

/* ==========================================================
   Cards
   ========================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: all .2s ease;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-elevated { box-shadow: var(--shadow-md); }
.card-flush { padding: 0; overflow: hidden; }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.card-body { padding: 22px; }

.card-title {
  font-weight: 700;
  font-size: 1.05rem;
  margin: 0;
}
.card-subtitle {
  color: var(--text-muted);
  font-size: .88rem;
  margin: 2px 0 0;
}

/* Hero card with gradient */
.hero-card {
  background: var(--gradient-brand);
  color: white;
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
}
.hero-card::before, .hero-card::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: .35;
}
.hero-card::before {
  width: 280px; height: 280px;
  background: #06b6d4;
  top: -100px; right: -80px;
}
.hero-card::after {
  width: 220px; height: 220px;
  background: #f59e0b;
  bottom: -90px; left: 30%;
}
.hero-card > * { position: relative; z-index: 1; }
.hero-card h1 { color: white; font-size: 2.2rem; }
.hero-card p { color: rgba(255,255,255,.92); }

/* Stat card */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  transition: all .2s;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-200);
}
.stat-card .label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.stat-card .value {
  font-size: 1.85rem;
  font-weight: 800;
  margin-top: 4px;
  letter-spacing: -.02em;
}
.stat-card .delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .8rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  margin-top: 8px;
}
.stat-card .delta.up { color: var(--success); background: rgba(16,185,129,.1); }
.stat-card .delta.down { color: var(--danger); background: rgba(239,68,68,.1); }
.stat-card .icon-circle {
  position: absolute;
  top: 18px; right: 18px;
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: white;
}
.stat-card.brand .icon-circle { background: var(--gradient-brand); }
.stat-card.cool  .icon-circle { background: var(--gradient-cool); }
.stat-card.mint  .icon-circle { background: var(--gradient-mint); }
.stat-card.warm  .icon-circle { background: var(--gradient-warm); }

/* Module tile (used on home) */
.module-tile {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
  text-decoration: none;
  color: var(--text);
  position: relative;
  overflow: hidden;
  transition: all .2s;
  height: 100%;
}
.module-tile:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--brand-300);
  color: var(--text);
}
.module-tile .badge-tag {
  position: absolute;
  top: 16px; right: 16px;
  font-size: .68rem;
  background: var(--gray-100);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}
.module-tile .badge-tag.simple  { background: rgba(16,185,129,.12);  color: var(--success); }
.module-tile .badge-tag.medium  { background: rgba(245,158,11,.14);  color: var(--warning); }
.module-tile .badge-tag.complex { background: rgba(239,68,68,.12);   color: var(--danger);  }

.module-tile .tile-icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--gradient-brand);
  color: white;
  margin-bottom: 14px;
  box-shadow: 0 8px 16px -8px rgba(99,102,241,.5);
}
.module-tile h3 {
  font-size: 1.05rem;
  margin: 0 0 4px;
}
.module-tile p {
  color: var(--text-muted);
  font-size: .88rem;
  margin: 0;
  flex: 1;
}
.module-tile .tile-foot {
  margin-top: 16px;
  font-size: .78rem;
  font-weight: 600;
  color: var(--brand-600);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ==========================================================
   Buttons
   ========================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 600;
  font-size: .92rem;
  padding: 9px 18px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  font-family: inherit;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(99,102,241,.25);
}

.btn-primary {
  background: var(--gradient-brand);
  color: white;
  box-shadow: 0 4px 12px -4px rgba(99,102,241,.5);
}
.btn-primary:hover { transform: translateY(-1px); color: white; box-shadow: 0 8px 18px -6px rgba(99,102,241,.6); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--brand-300); color: var(--brand-700); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; color: white; }
.btn-danger  { background: var(--danger);  color: white; }
.btn-danger:hover { background: #dc2626; color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-info    { background: var(--info);    color: white; }

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--gray-100); color: var(--text); }

.btn-sm { padding: 6px 12px; font-size: .82rem; border-radius: 8px; }
.btn-lg { padding: 12px 24px; font-size: 1rem; border-radius: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ==========================================================
   Forms
   ========================================================== */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.form-label .required { color: var(--danger); }

.form-control {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: .94rem;
  font-family: inherit;
  transition: all .15s;
  outline: none;
}
textarea.form-control {
  height: auto;
  padding: 12px 14px;
  resize: vertical;
  min-height: 100px;
}
.form-control:focus {
  border-color: var(--brand-400);
  box-shadow: 0 0 0 4px rgba(99,102,241,.12);
}
.form-control:disabled { background: var(--gray-100); cursor: not-allowed; }
.form-control[readonly] { background: var(--gray-50); }
.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 4px rgba(239,68,68,.12); }
.form-control.is-valid { border-color: var(--success); }

.form-text { font-size: .8rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: .8rem; color: var(--danger); margin-top: 4px; display: block; }

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='%2364748b'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

.form-check {
  display: flex; align-items: center; gap: 10px;
  margin: 6px 0;
}
.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 18px; height: 18px;
  accent-color: var(--brand-600);
  cursor: pointer;
}
.form-check label { cursor: pointer; }

/* Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 44px; height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; cursor: pointer;
  inset: 0;
  background: var(--gray-300);
  border-radius: 999px;
  transition: .2s;
}
.switch .slider::before {
  content: ''; position: absolute;
  left: 3px; bottom: 3px;
  width: 18px; height: 18px;
  background: white;
  border-radius: 50%;
  transition: .2s;
  box-shadow: var(--shadow-sm);
}
.switch input:checked + .slider { background: var(--brand-600); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* ==========================================================
   Tables
   ========================================================== */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .92rem;
}
.table th, .table td {
  padding: 13px 18px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.table thead th {
  background: var(--surface-2);
  color: var(--text-muted);
  font-weight: 600;
  font-size: .78rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--gray-50); }
[data-theme="dark"] .table tbody tr:hover { background: rgba(99,102,241,.06); }
.table tbody tr:last-child td { border-bottom: none; }
.table.compact th, .table.compact td { padding: 9px 14px; }

.table-toolbar {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  font-size: .88rem;
}
.page-btn {
  min-width: 36px; height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  transition: all .12s;
}
.page-btn:hover {
  border-color: var(--brand-300);
  color: var(--brand-700);
  background: var(--brand-50);
}
.page-btn.active {
  background: var(--brand-600);
  color: white;
  border-color: var(--brand-600);
  box-shadow: 0 4px 10px -4px rgba(99,102,241,.5);
}
.page-btn.active:hover { background: var(--brand-700); color: white; }
.page-btn.disabled,
.page-btn:disabled {
  opacity: .35;
  cursor: not-allowed;
  pointer-events: none;
}
.page-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  color: var(--text-soft);
  font-weight: 700;
  user-select: none;
}

/* Shop pagination: single rounded card with summary on the right */
.shop-pagination {
  border: 1px solid var(--border);
  border-top: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 12px 18px;
  position: relative;
}
.shop-pagination .page-summary {
  margin-left: 14px;
  color: var(--text-muted);
  font-size: .85rem;
  white-space: nowrap;
}
@media (max-width: 600px) {
  .shop-pagination .page-summary {
    width: 100%;
    margin: 8px 0 0;
    text-align: center;
  }
}

/* ==========================================================
   Badges, chips, alerts
   ========================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  background: var(--gray-100);
  color: var(--gray-700);
}
.badge-success { background: rgba(16,185,129,.12); color: var(--success); }
.badge-warning { background: rgba(245,158,11,.14); color: var(--warning); }
.badge-danger  { background: rgba(239,68,68,.12);  color: var(--danger);  }
.badge-info    { background: rgba(59,130,246,.12); color: var(--info);    }
.badge-brand   { background: var(--brand-100);     color: var(--brand-700); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--gray-100);
  color: var(--gray-700);
  font-size: .8rem;
  font-weight: 500;
}

.alert {
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}
.alert-info    { background: rgba(59,130,246,.08); border-color: rgba(59,130,246,.25); color: var(--info); }
.alert-success { background: rgba(16,185,129,.08); border-color: rgba(16,185,129,.25); color: var(--success); }
.alert-warning { background: rgba(245,158,11,.08); border-color: rgba(245,158,11,.25); color: var(--warning); }
.alert-danger  { background: rgba(239,68,68,.08);  border-color: rgba(239,68,68,.25);  color: var(--danger); }
.alert b, .alert strong { color: inherit; }

/* ==========================================================
   Modals
   ========================================================== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1050;
  animation: fade .18s ease;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 520px;
  max-width: 92vw;
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow-xl);
  animation: rise .22s cubic-bezier(.4,.0,.2,1);
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-body  { padding: 22px 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
@keyframes fade { from { opacity:0 } to { opacity:1 } }
@keyframes rise { from { opacity:0; transform:translateY(20px) scale(.98) } to { opacity:1; transform:none } }

/* Toast */
.toast-stack {
  position: fixed;
  top: 86px; right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1100;
}
.toast {
  min-width: 280px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--info);
  border-radius: 10px;
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  display: flex; gap: 10px; align-items: center;
  animation: rise .2s ease;
}
.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

/* ==========================================================
   Utility
   ========================================================== */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); }
@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-gap-1 { gap: 8px; }
.flex-gap-2 { gap: 14px; }
.flex-gap-3 { gap: 22px; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 14px; }
.gap-3 { gap: 22px; }

.text-muted { color: var(--text-muted); }
.text-soft { color: var(--text-soft); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-brand { color: var(--brand-600); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

.fw-700 { font-weight: 700; }
.fw-600 { font-weight: 600; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 14px; }
.mt-3 { margin-top: 22px; }
.mt-4 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 14px; }
.mb-3 { margin-bottom: 22px; }
.mb-4 { margin-bottom: 32px; }
.p-0 { padding: 0 !important; }

.divider {
  height: 1px;
  background: var(--border);
  margin: 22px 0;
}

/* Spinner */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--brand-600);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.spinner.sm { width: 18px; height: 18px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: 6px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Login / blank pages */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg);
}
@media (max-width: 900px) { .auth-wrap { grid-template-columns: 1fr; } }
.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
}
.auth-side {
  background: var(--gradient-brand);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  color: white;
}
.auth-side::before, .auth-side::after {
  content: ''; position: absolute;
  border-radius: 50%; filter: blur(60px); opacity: .35;
}
.auth-side::before { width: 320px; height: 320px; background:#06b6d4; top:-100px; left:-80px;}
.auth-side::after { width: 280px; height: 280px; background:#f59e0b; bottom:-80px; right:-60px;}
.auth-side > div { position: relative; z-index: 1; max-width: 380px; }
.auth-side h2 { color: white; font-size: 2rem; }
.auth-side p { color: rgba(255,255,255,.92); }
@media (max-width: 900px) { .auth-side { display: none; } }

/* ==========================================================
   Component-specific tweaks
   ========================================================== */
.kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: .78rem;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface);
  color: var(--text-muted);
}

.tab-list {
  display: flex;
  border-bottom: 1px solid var(--border);
  gap: 2px;
  margin-bottom: 22px;
  overflow-x: auto;
}
.tab-item {
  padding: 12px 18px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 600;
  font-size: .9rem;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all .15s;
}
.tab-item:hover { color: var(--text); }
.tab-item.active { color: var(--brand-600); border-bottom-color: var(--brand-600); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* Accordion */
.accordion-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  overflow: hidden;
  background: var(--surface);
}
.accordion-trigger {
  width: 100%;
  text-align: left;
  padding: 16px 18px;
  border: none;
  background: none;
  font-weight: 600;
  font-size: .95rem;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.accordion-trigger:hover { background: var(--surface-2); }
.accordion-content {
  padding: 0 18px;
  max-height: 0;
  overflow: hidden;
  transition: all .25s ease;
  color: var(--text-muted);
}
.accordion-item.open .accordion-content { padding: 0 18px 18px; max-height: 600px; }
.accordion-trigger .chev { transition: transform .25s; }
.accordion-item.open .accordion-trigger .chev { transform: rotate(180deg); }

/* Progress */
.progress {
  height: 8px;
  background: var(--gray-100);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: var(--gradient-brand);
  width: 0;
  transition: width .3s ease;
  border-radius: 999px;
}

/* Tooltip — defaults to ABOVE the element */
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 10px;
  background: var(--gray-900);
  color: white;
  font-size: .76rem;
  font-weight: 500;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 1100;
  pointer-events: none;
  box-shadow: var(--shadow-md);
}
[data-tip]:hover::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--gray-900);
  z-index: 1100;
  pointer-events: none;
}
/* Header tooltips: position BELOW (since the header is at the top of the page) */
.app-header [data-tip]:hover::after {
  bottom: auto;
  top: calc(100% + 8px);
}
.app-header [data-tip]:hover::before {
  bottom: auto;
  top: calc(100% + 2px);
  border-top-color: transparent;
  border-bottom-color: var(--gray-900);
}

/* Footer */
.app-footer {
  padding: 22px 40px;
  text-align: center;
  color: var(--text-soft);
  font-size: .85rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.app-footer .footer-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}
.app-footer .footer-sep { color: var(--gray-300); }
.app-footer .footer-credit {
  font-size: .82rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.app-footer .footer-credit span[aria-hidden] { color: #ec4899; }
.app-footer .footer-brand-link {
  font-weight: 700;
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  position: relative;
  padding: 0 2px;
  transition: opacity .15s;
}
.app-footer .footer-brand-link:hover { opacity: .8; }
.app-footer .footer-brand-link::after {
  content: '';
  position: absolute;
  left: 2px; right: 2px; bottom: -2px;
  height: 2px;
  background: var(--gradient-brand);
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .25s ease;
}
.app-footer .footer-brand-link:hover::after { transform: scaleX(1); }

/* Shop layout: stack filters above grid on narrow screens */
.shop-layout { grid-template-columns: 260px minmax(0, 1fr); }
@media (max-width: 1100px) {
  .shop-layout { grid-template-columns: 1fr; }
}

/* Hide scrollbars on sidebar nicely */
.app-sidebar::-webkit-scrollbar { width: 6px; }
.app-sidebar::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 999px; }
.app-sidebar::-webkit-scrollbar-track { background: transparent; }

/* Responsive sidebar toggle */
@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    z-index: 900;
    transform: translateX(-100%);
    transition: transform .25s;
    width: var(--sidebar-w);
    box-shadow: var(--shadow-xl);
  }
  .app-sidebar.open { transform: none; }
  .app-content { padding: 20px; }
}
