/* ==========================================================================
   MINIMAX DESIGN SYSTEM — CORE STYLESHEET
   AI model showcase aesthetic: white-dominant canvas, product-card color pops,
   pill geometry, brand-purple glow shadows, multi-font hierarchy
   ========================================================================== */

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

:root {
  /* ---- Brand Blue Scale ---- */
  --brand-6: #1456f0;
  --brand-5: #1a68ff;
  --brand-4: #2d7bff;
  --brand-3: #17437d;
  --brand-sky: #3daeff;
  --primary-200: #bfdbfe;
  --primary-300: #93c5fd;
  --primary-400: #60a5fa;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;

  /* ---- Brand Accent ---- */
  --brand-pink: #ea5ec1;
  --brand-pink-soft: #fce4f6;

  /* ---- Text ---- */
  --text-00: #222222;
  --text-dark: #18181b;
  --text-charcoal: #181e25;
  --text-04: #45515e;
  --text-muted: #8e8e93;
  --text-light: #5f5f5f;
  --text-on-dark: rgba(255, 255, 255, 0.82);

  /* ---- Surface / Background ---- */
  --bg-white: #ffffff;
  --bg-light: #f8f9fb;
  --bg-gray: #f0f0f0;
  --bg-dark: #181e25;
  --bg-dark-card: #1f2730;
  --bg-glass: hsla(0, 0%, 100%, 0.4);

  /* ---- Border ---- */
  --border-light: #f2f3f5;
  --border-gray: #e5e7eb;
  --border-blue: rgba(59, 130, 246, 0.25);

  /* ---- Semantic ---- */
  --success-bg: #e8ffea;
  --success-text: #15803d;
  --success-border: #86efac;
  --error-bg: #fef2f2;
  --error-text: #b91c1c;
  --error-border: #fca5a5;
  --warn-bg: #fffbeb;
  --warn-text: #b45309;
  --warn-border: #fcd34d;
  --info-bg: #eff6ff;
  --info-text: #1e40af;
  --info-border: #93c5fd;

  /* ---- Fonts ---- */
  --font-ui: 'DM Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-display: 'Outfit', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-mid: 'Poppins', 'Helvetica Neue', sans-serif;
  --font-mono: 'Roboto Mono', 'Courier New', monospace;

  /* ---- Radius ---- */
  --r-xs: 4px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-2xl: 24px;
  --r-pill: 9999px;

  /* ---- Shadows (brand purple-tint) ---- */
  --shadow-subtle: 0px 1px 3px rgba(0, 0, 0, 0.06), 0px 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-card: 0px 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-ambient: 0 0 22px rgba(0, 0, 0, 0.06);
  --shadow-brand-glow: 0 0 20px rgba(44, 30, 116, 0.12);
  --shadow-brand-offset: 6px 4px 18px rgba(44, 30, 116, 0.10);
  --shadow-elevated: 0 12px 24px -6px rgba(36, 36, 36, 0.10);
  --shadow-input-focus: 0 0 0 3px rgba(59, 130, 246, 0.18);

  /* ---- Motion ---- */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 0.15s;
  --dur-normal: 0.25s;
  --dur-slow: 0.4s;
}

/* ==========================================================================
   Reset & Baseline
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-ui);
  background-color: var(--bg-white);
  color: var(--text-00);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

:focus-visible {
  outline: 2.5px solid var(--primary-500);
  outline-offset: 2px;
}

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

/* ==========================================================================
   Typography
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--text-dark);
  line-height: 1.25;
}

.t-display {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text-dark);
}

.t-section {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.5vw, 1.875rem);
  font-weight: 600;
  line-height: 1.3;
}

.t-card-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.35;
}

.t-sub {
  font-family: var(--font-mid);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.5;
}

.t-body {
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.55;
}

.t-body-sm {
  font-size: 0.8125rem;
  line-height: 1.5;
}

.t-label {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.t-mono {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
}

.t-muted { color: var(--text-04); }
.t-subtle { color: var(--text-muted); }

/* ==========================================================================
   Buttons — Pill geometry
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1;
  padding: 11px 22px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--dur-normal) var(--ease-out);
  white-space: nowrap;
  user-select: none;
}

.btn-primary {
  background: var(--text-charcoal);
  color: #ffffff;
  border-color: var(--text-charcoal);
}
.btn-primary:hover {
  background: #2a323c;
  box-shadow: var(--shadow-elevated);
  transform: translateY(-1px);
}
.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-subtle);
}

.btn-brand {
  background: var(--primary-600);
  color: #ffffff;
  border-color: var(--primary-600);
}
.btn-brand:hover {
  background: var(--primary-700);
  box-shadow: var(--shadow-brand-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-gray);
  color: #333333;
  border-color: transparent;
}
.btn-secondary:hover {
  background: #e6e6e6;
}

.btn-outline {
  background: #ffffff;
  color: var(--text-dark);
  border: 1.5px solid var(--border-gray);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.btn-outline:hover {
  background: var(--bg-light);
  border-color: var(--primary-400);
  color: var(--primary-600);
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.06);
}
.btn-outline:active {
  transform: translateY(0);
}

.btn-ghost {
  background: transparent;
  color: var(--text-04);
  border: 1px solid var(--border-gray);
}
.btn-ghost:hover {
  background: var(--bg-light);
  color: var(--text-dark);
  border-color: var(--text-dark);
}

.btn-danger {
  background: var(--error-bg);
  color: var(--error-text);
  border-color: var(--error-border);
}
.btn-danger:hover {
  background: #fee2e2;
}

.btn-pill {
  border-radius: var(--r-pill);
}

.btn-sm {
  padding: 7px 14px;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 0.9375rem;
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ==========================================================================
   Cards
   ========================================================================== */
.card {
  background: var(--bg-white);
  border: 1px solid var(--border-gray);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: transform var(--dur-normal) var(--ease-out),
              box-shadow var(--dur-normal) var(--ease-out);
}

.card-interactive:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-elevated);
}

.card-pad { padding: 24px; }
.card-pad-sm { padding: 16px; }

.card-glow {
  box-shadow: var(--shadow-brand-glow);
}
.card-glow:hover {
  box-shadow: var(--shadow-brand-offset);
  transform: translateY(-4px);
}

/* Product showcase card with gradient background */
.card-product {
  border-radius: var(--r-2xl);
  border: none;
  color: #ffffff;
  position: relative;
  overflow: hidden;
}

.card-product.grad-blue    { background: linear-gradient(135deg, #1456f0 0%, #3daeff 100%); }
.card-product.grad-purple  { background: linear-gradient(135deg, #6c3ce4 0%, #b96cf5 100%); }
.card-product.grad-pink    { background: linear-gradient(135deg, #ea5ec1 0%, #f8a4d8 100%); }
.card-product.grad-orange  { background: linear-gradient(135deg, #f59e0b 0%, #fb923c 100%); }
.card-product.grad-teal    { background: linear-gradient(135deg, #0d9488 0%, #5eead4 100%); }
.card-product.grad-dark    { background: linear-gradient(135deg, #181e25 0%, #334155 100%); }

/* ==========================================================================
   Badges
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  white-space: nowrap;
  line-height: 1.5;
}

.badge-neutral {
  background: var(--bg-gray);
  color: var(--text-04);
}

.badge-success {
  background: var(--success-bg);
  color: var(--success-text);
}

.badge-error {
  background: var(--error-bg);
  color: var(--error-text);
}

.badge-warn {
  background: var(--warn-bg);
  color: var(--warn-text);
}

.badge-info {
  background: var(--info-bg);
  color: var(--info-text);
}

.badge-brand {
  background: #eef2ff;
  color: var(--primary-700);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.dot-ok      { background: #22c55e; }
.dot-err     { background: #ef4444; }
.dot-warn    { background: #f59e0b; }
.dot-off     { background: var(--text-muted); }

/* ==========================================================================
   Tabs & Segmented Controls
   ========================================================================== */
.tabs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  padding: 6px;
  border-radius: var(--r-lg);
  border: 1px solid #e2e8f0;
  max-width: 100%;
  overflow-x: auto;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  font-family: var(--font-ui);
  font-size: 0.84rem;
  font-weight: 500;
  color: #64748b;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--dur-normal) var(--ease-out);
  user-select: none;
}

.tab-btn svg {
  stroke: #94a3b8;
  transition: all var(--dur-fast) ease;
}

.tab-btn:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.6);
}

.tab-btn:hover svg {
  stroke: #475569;
}

.tab-btn.active {
  background: #ffffff;
  color: var(--primary-600);
  font-weight: 600;
  border-color: rgba(37, 99, 235, 0.12);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.03);
}

.tab-btn.active svg {
  stroke: var(--primary-600);
}

/* ==========================================================================
   Forms
   ========================================================================== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 5px;
}

.form-hint,
.form-label .form-hint,
.form-label small {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  background: var(--bg-white);
  border: 1.5px solid var(--border-gray);
  border-radius: var(--r-sm);
  font-size: 0.875rem;
  color: var(--text-00);
  transition: all var(--dur-fast) var(--ease-out);
}

.input:hover {
  border-color: #c4c9cf;
}

.input:focus {
  border-color: var(--primary-500);
  outline: none;
  box-shadow: var(--shadow-input-focus);
}

.input-icon-l { padding-left: 44px; }
.input-icon-r { padding-right: 44px; }

.icon-start {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  display: flex;
  pointer-events: none;
}

.icon-end {
  position: absolute;
  right: 6px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-xs);
  z-index: 10;
  transition: color var(--dur-fast);
}
.icon-end svg {
  pointer-events: none;
}
.icon-end:hover { color: var(--text-dark); }

/* Custom Checkbox */
.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.8125rem;
  color: var(--text-04);
  user-select: none;
}
.checkbox input { position: absolute; opacity: 0; pointer-events: none; }
.checkbox-mark {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border-gray);
  border-radius: var(--r-xs);
  background: var(--bg-white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--dur-fast);
  flex-shrink: 0;
}
.checkbox input:checked ~ .checkbox-mark {
  background: var(--primary-600);
  border-color: var(--primary-600);
}
.checkbox input:checked ~ .checkbox-mark::after {
  content: '';
  width: 5px; height: 9px;
  border: solid white; border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-top: -2px;
}

/* Toggle */
.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--border-gray);
  border-radius: var(--r-pill);
  transition: .25s;
  cursor: pointer;
}
.toggle-track:before {
  content: "";
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: .25s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle input:checked + .toggle-track {
  background: var(--primary-600);
}
.toggle input:checked + .toggle-track:before {
  transform: translateX(20px);
}

/* ==========================================================================
   Alert / Note callout
   ========================================================================== */
.alert {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--r-md);
  font-size: 0.8125rem;
  line-height: 1.5;
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1), transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), padding 0.35s cubic-bezier(0.4, 0, 0.2, 1), margin 0.35s cubic-bezier(0.4, 0, 0.2, 1), border-width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  max-height: 140px;
}

.alert.alert-hiding {
  opacity: 0 !important;
  transform: translateY(-8px) scale(0.98) !important;
  max-height: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  margin-bottom: 0 !important;
  margin-top: 0 !important;
  border-width: 0 !important;
}

.alert-close-btn {
  background: none;
  border: none;
  padding: 4px;
  margin: -4px -6px -4px auto;
  border-radius: var(--r-xs);
  cursor: pointer;
  color: inherit;
  opacity: 0.65;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s, background-color 0.15s;
}

.alert-close-btn:hover {
  opacity: 1;
  background-color: rgba(0, 0, 0, 0.06);
}

.alert-error {
  background: var(--error-bg);
  color: var(--error-text);
  border: 1px solid var(--error-border);
}

.alert-info {
  background: var(--info-bg);
  color: var(--info-text);
  border: 1px solid var(--info-border);
}

.alert-warn {
  background: var(--warn-bg);
  color: var(--warn-text);
  border: 1px solid var(--warn-border);
}

.alert-success {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid var(--success-border);
}

/* ==========================================================================
   Top Navigation Bar
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-light);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-dark);
  text-decoration: none;
}

.logo-mark {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--brand-6) 0%, var(--brand-sky) 100%);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.875rem;
}

.brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border-light);
  border-radius: var(--r-pill);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-04);
  cursor: pointer;
  transition: all var(--dur-fast);
}
.brand-pill:hover {
  background: rgba(0, 0, 0, 0.07);
  color: var(--text-dark);
}

.user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 14px 4px 4px;
  background: var(--bg-white);
  border: 1px solid var(--border-gray);
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: all var(--dur-fast);
}
.user-btn:hover {
  box-shadow: var(--shadow-subtle);
  border-color: var(--primary-500);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-6) 0%, var(--brand-pink) 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

/* ==========================================================================
   Shell — Sidebar + Main
   ========================================================================== */
.shell {
  display: flex;
  min-height: calc(100vh - 64px);
}

.sidebar {
  width: 250px;
  flex: 0 0 250px;
  background: var(--bg-light);
  border-right: 1px solid var(--border-light);
  padding: 24px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
  transition: transform var(--dur-normal) var(--ease-out);
}

.nav-group {
  margin-bottom: 28px;
}

.nav-heading {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 14px 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: var(--r-sm);
  color: var(--text-04);
  font-weight: 500;
  font-size: 0.875rem;
  transition: all var(--dur-fast);
  margin-bottom: 2px;
}
.nav-link:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-dark);
}

.nav-link.active {
  background: var(--bg-white);
  color: var(--primary-600);
  font-weight: 600;
  box-shadow: var(--shadow-subtle);
  border: 1px solid var(--border-light);
}

.nav-link .nav-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  background: var(--primary-200);
  color: var(--primary-700);
  padding: 1px 7px;
  border-radius: var(--r-pill);
  font-weight: 600;
}

.main-content {
  flex: 1;
  padding: 30px 32px 80px;
  max-width: 1440px;
  width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

/* ==========================================================================
   Stats Grid
   ========================================================================== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow-subtle);
  transition: transform var(--dur-normal), box-shadow var(--dur-normal);
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-num {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text-dark);
  margin-bottom: 4px;
}

.stat-lbl {
  font-size: 0.8125rem;
  color: var(--text-04);
  font-weight: 500;
}

.stat-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--font-mono);
  margin-top: 8px;
}
.stat-trend.up { color: var(--success-text); }
.stat-trend.down { color: var(--error-text); }

/* ==========================================================================
   Discovery Grid (Product Showcase Cards)
   ========================================================================== */
.discovery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin-bottom: 36px;
}

.discovery-card {
  border-radius: var(--r-2xl);
  padding: 28px 24px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--dur-normal) var(--ease-spring),
              box-shadow var(--dur-normal);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 220px;
}
.discovery-card:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: var(--shadow-brand-offset);
}

.discovery-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 20%, rgba(255,255,255,0.12) 0%, transparent 60%);
  pointer-events: none;
}

.discovery-card .disc-badge {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 4px 12px;
  border-radius: var(--r-pill);
  font-size: 0.72rem;
  font-weight: 600;
  margin-bottom: 16px;
  backdrop-filter: blur(4px);
}

.discovery-card h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: #ffffff;
}

.discovery-card p {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.45;
  margin-bottom: auto;
}

.disc-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.disc-pool {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
}

.disc-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(4px);
  color: #ffffff;
  border: none;
  padding: 7px 16px;
  border-radius: var(--r-pill);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur-fast);
}
.disc-action:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* ==========================================================================
   Data Table
   ========================================================================== */
.table-wrap {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.table-toolbar {
  padding: 18px 24px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--border-light);
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.8125rem;
}

.table th {
  background: var(--bg-light);
  padding: 11px 20px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.table td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-04);
  vertical-align: middle;
}

.table tbody tr {
  transition: background var(--dur-fast);
}
.table tbody tr:hover {
  background: var(--bg-light);
}
.table tbody tr:last-child td {
  border-bottom: none;
}

.table-pagination {
  padding: 14px 24px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Login Page
   ========================================================================== */
.login-wrapper {
  min-height: 100vh;
  display: flex;
}

.login-panel-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px 32px;
  position: relative;
}

.login-panel-right {
  flex: 0 0 50%;
  background: linear-gradient(135deg, var(--brand-6) 0%, #6c3ce4 50%, var(--brand-pink) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
  color: #ffffff;
  position: relative;
  overflow: hidden;
}

.login-panel-right::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 70%, rgba(255,255,255,0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(61, 174, 255, 0.15) 0%, transparent 40%);
  pointer-events: none;
}

.login-panel-right::after {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: rgba(234, 94, 193, 0.12);
  top: -100px;
  right: -150px;
  filter: blur(80px);
  pointer-events: none;
}

.login-branding {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 420px;
}

.login-branding .logo-mark-lg {
  width: 64px;
  height: 64px;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  font-size: 1.5rem;
  font-weight: 800;
  font-family: var(--font-display);
}

.login-branding h2 {
  font-size: 2rem;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 14px;
  line-height: 1.2;
}

.login-branding p {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.55;
}

.login-stat-pills {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 36px;
  position: relative;
  z-index: 1;
}

.login-stat-pill {
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--r-pill);
  padding: 8px 18px;
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}

.login-card {
  width: 100%;
  max-width: 420px;
}

.login-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 36px;
}

/* ==========================================================================
   Toast
   ========================================================================== */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 300px;
  max-width: 420px;
  background: var(--bg-white);
  border: 1px solid var(--border-gray);
  box-shadow: var(--shadow-elevated);
  border-radius: var(--r-md);
  padding: 14px 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: toastIn 0.35s var(--ease-out) forwards;
}

@keyframes toastIn {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ==========================================================================
   Mobile Menu
   ========================================================================== */
.mobile-toggle {
  display: none;
  background: var(--bg-white);
  border: 1px solid var(--border-gray);
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(2px);
  z-index: 95;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1024px) {
  .mobile-toggle { display: flex; }

  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    height: 100vh;
    z-index: 99;
    transform: translateX(-100%);
    box-shadow: 4px 0 20px rgba(0,0,0,0.08);
    background: var(--bg-white);
  }
  .sidebar.open { transform: translateX(0); }
  .overlay.active { display: block; }

  .main-content {
    padding: 28px 20px 80px;
  }

  .topbar {
    padding: 0 16px;
  }

  /* Login split → stack */
  .login-panel-right {
    display: none;
  }
  .login-panel-left {
    padding: 32px 20px;
  }
}

@media (max-width: 640px) {
  .topbar { height: 56px; }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .discovery-grid {
    grid-template-columns: 1fr;
  }

  .stat-num { font-size: 1.6rem; }
  .stat-card { padding: 14px; }

  .brand-pill .bp-label { display: none; }
}

@media (max-width: 480px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   CUSTOM DROPDOWN & COLLAPSIBLE FILTER PANEL (Matching Reference Layout)
   ========================================================================== */
.filter-card {
  background: var(--bg-white);
  border: 1px solid var(--border-gray);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-subtle);
  margin-bottom: 20px;
  overflow: visible;
  transition: all var(--dur-normal) var(--ease-out);
}

.filter-header {
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  user-select: none;
  background: #ffffff;
  border-top-left-radius: var(--r-md);
  border-top-right-radius: var(--r-md);
  transition: background 0.15s ease;
}

.filter-header:hover {
  background: #f8fafc;
}

.filter-card.is-collapsed .filter-header {
  border-bottom-color: transparent;
  border-radius: var(--r-md);
}

.filter-body {
  padding: 18px 20px 20px;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease, padding 0.3s ease;
  max-height: 800px;
  opacity: 1;
  overflow: visible;
}

.filter-body.collapsed {
  max-height: 0 !important;
  opacity: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  overflow: hidden !important;
  pointer-events: none;
}

.filter-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-04);
  font-size: 0.8125rem;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s ease;
}

.filter-toggle-btn:hover {
  background: #f1f5f9;
  color: var(--text-dark);
}

.filter-toggle-icon {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.filter-toggle-icon.rotated {
  transform: rotate(-180deg);
}

/* Grid Layout for Filter Form */
.filter-form-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  width: 100%;
}

@media (max-width: 1024px) {
  .filter-form-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .filter-form-grid {
    grid-template-columns: 1fr;
  }
}

.filter-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #475569;
}

.filter-field-label svg {
  color: #64748b;
  flex-shrink: 0;
}

/* Custom Dropdown Component */
.custom-dropdown {
  position: relative;
  width: 100%;
  user-select: none;
}

.custom-dropdown-btn {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  background: var(--bg-white);
  border: 1px solid var(--border-gray);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  color: var(--text-dark);
  cursor: pointer;
  transition: all var(--dur-fast) ease;
  outline: none;
  white-space: nowrap;
}

.custom-dropdown-btn:hover {
  border-color: var(--primary-400);
  background: #fafbfc;
}

.custom-dropdown.active .custom-dropdown-btn {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(3, 105, 161, 0.12);
  background: #ffffff;
}

.custom-dropdown-content-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.custom-dropdown-prefix {
  font-weight: 600;
  color: #64748b;
  font-size: 0.875rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.custom-dropdown-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  font-weight: 500;
  color: var(--text-dark);
}

.custom-dropdown-chevron {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.custom-dropdown.active .custom-dropdown-chevron {
  transform: rotate(180deg);
  color: var(--brand-6);
}

.custom-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  min-width: 220px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  z-index: 1000;
  display: none;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.custom-dropdown.active .custom-dropdown-menu {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.custom-dropdown-search-wrap {
  padding: 8px;
  border-bottom: 1px solid var(--border-light);
  background: #fcfdfe;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
}

.custom-dropdown-search-input {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  font-size: 0.75rem;
  border: 1px solid var(--border-gray);
  border-radius: 6px;
  outline: none;
  background: #ffffff;
  font-family: var(--font-ui);
}

.custom-dropdown-search-input:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 2px rgba(3, 105, 161, 0.1);
}

.custom-dropdown-list {
  max-height: 220px;
  overflow-y: auto;
  padding: 5px;
  list-style: none;
  margin: 0;
}

.custom-dropdown-list::-webkit-scrollbar {
  width: 5px;
}
.custom-dropdown-list::-webkit-scrollbar-track {
  background: transparent;
}
.custom-dropdown-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.custom-dropdown-item {
  padding: 8px 12px;
  font-size: 0.8125rem;
  color: #334155;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: background 0.15s ease, color 0.15s ease;
}

.custom-dropdown-item:hover {
  background: #f8fafc;
  color: #0284c7;
}

.custom-dropdown-item.selected {
  background: #eff6ff;
  color: #0284c7;
  font-weight: 600;
}

.custom-dropdown-item-badge {
  font-size: 0.7rem;
  background: #f1f5f9;
  color: #64748b;
  padding: 1px 7px;
  border-radius: 10px;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.custom-dropdown-item.selected .custom-dropdown-item-badge {
  background: #bae6fd;
  color: #0369a1;
}

/* Action Buttons Matching Reference */
.filter-actions-row {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-filter-reset {
  background: #ffffff;
  color: #475569 !important;
  font-weight: 500;
  font-size: 0.8125rem;
  padding: 0 16px;
  height: 38px;
  border-radius: var(--r-sm);
  border: 1px solid #d1d5db;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  text-decoration: none;
}

.btn-filter-reset:hover {
  background: #f8fafc;
  color: #0f172a !important;
  border-color: #cbd5e1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.btn-filter-reset:active {
  transform: translateY(0);
}

.btn-filter-submit {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff !important;
  font-weight: 600;
  font-size: 0.8125rem;
  padding: 0 20px;
  height: 38px;
  border-radius: var(--r-sm);
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.32);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.btn-filter-submit:hover {
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(2, 132, 199, 0.42);
}

.btn-filter-submit:active {
  transform: translateY(0);
}


