/* ============================================
   Stripi-Inspired Design System for Xide
   (file kept as google-style.css for compat)
   See DESIGN.md for the full token spec.

   Note: Inter is intentionally NOT @import-ed here.
   @import is a sequential blocking request that stalls
   first paint. Pages can choose to <link> Inter in their
   own <head>; otherwise the system stack below renders
   instantly and looks correct in the Stripi spec.
   ============================================ */

/* ==================== CSS Variables ==================== */
:root {
  /* ---- Stripi brand palette (canonical names) ---- */
  --stripi-primary: #533afd;
  --stripi-primary-deep: #4434d4;
  --stripi-primary-press: #2e2b8c;
  --stripi-primary-soft: #665efd;
  --stripi-primary-subdued: #b9b9f9;
  --stripi-primary-bg: #eeebff;
  --stripi-brand-dark-900: #1c1e54;
  --stripi-ink: #0d253d;
  --stripi-ink-secondary: #273951;
  --stripi-ink-mute: #64748d;
  --stripi-ink-mute-2: #61718a;
  --stripi-on-primary: #ffffff;
  --stripi-canvas: #ffffff;
  --stripi-canvas-soft: #f6f9fc;
  --stripi-canvas-cream: #f5e9d4;
  --stripi-hairline: #e3e8ee;
  --stripi-hairline-input: #a8c3de;
  --stripi-ruby: #ea2261;
  --stripi-magenta: #f96bee;
  --stripi-lemon: #9b6829;
  --stripi-shadow-blue: 0, 55, 112;

  /* ---- Brand-aliased "g-*" tokens (every page reads these) ---- */
  --g-blue: var(--stripi-primary);
  --g-blue-hover: var(--stripi-primary-deep);
  --g-blue-dark: var(--stripi-primary-press);
  --g-blue-light: var(--stripi-primary-bg);

  --g-green: #1f9d55;
  --g-green-light: #e3f7ec;

  --g-red: var(--stripi-ruby);
  --g-red-light: #fde6ee;

  --g-yellow: #b87b07;
  --g-yellow-light: #fbf2db;

  /* ---- Semantic text/surface tokens ---- */
  --text-primary: var(--stripi-ink);
  --text-secondary: var(--stripi-ink-mute);
  --text-disabled: #a4afc1;
  --text-link: var(--stripi-primary);
  --text-on-primary: var(--stripi-on-primary);
  --text-color: var(--text-primary);   /* alias */
  --text-muted: var(--text-secondary); /* alias */

  --bg-primary: var(--stripi-canvas);
  --bg-secondary: var(--stripi-canvas-soft);
  --bg-tertiary: #eef3f8;
  --bg-hover: rgba(83, 58, 253, 0.06);
  --bg-active: rgba(83, 58, 253, 0.10);
  --bg-color: var(--bg-primary);       /* alias */
  --surface: var(--bg-secondary);      /* alias */
  --card-bg: var(--bg-primary);        /* alias */

  --border-light: var(--stripi-hairline);
  --border-medium: var(--stripi-hairline-input);
  --border-focus: var(--stripi-primary);
  --border-color: var(--border-light); /* alias */

  --primary-color: var(--stripi-primary); /* alias */

  /* ---- Shadows ---- */
  --shadow-sm: 0 1px 3px rgba(var(--stripi-shadow-blue), 0.08);
  --shadow-md: 0 1px 3px rgba(var(--stripi-shadow-blue), 0.08), 0 8px 24px rgba(var(--stripi-shadow-blue), 0.06);
  --shadow-lg: 0 8px 32px rgba(var(--stripi-shadow-blue), 0.10), 0 2px 8px rgba(var(--stripi-shadow-blue), 0.04);
  --shadow-xl: 0 16px 48px rgba(var(--stripi-shadow-blue), 0.12), 0 4px 12px rgba(var(--stripi-shadow-blue), 0.06);
  --shadow-card: var(--shadow-sm);

  /* ---- Spacing (8px base, with sub-tokens) ---- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* ---- Border radii (Stripi uses pill for buttons, lg for cards) ---- */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* ---- Typography ---- */
  --font-family: 'Inter', 'Sohne', -apple-system, BlinkMacSystemFont, 'Segoe UI Variable Display', 'Segoe UI', 'SF Pro Display', system-ui, Roboto, sans-serif;
  --font-mono: 'SF Mono', Consolas, 'Courier New', monospace;

  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 15px;
  --text-md: 16px;
  --text-lg: 18px;
  --text-xl: 22px;
  --text-2xl: 28px;
  --text-3xl: 36px;
  --text-4xl: 48px;
  --text-5xl: 56px;

  --font-light: 300;
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  --leading-tight: 1.15;
  --leading-normal: 1.4;
  --leading-relaxed: 1.6;

  /* ---- Motion ---- */
  --transition-fast: 0.12s ease;
  --transition-normal: 0.2s ease;
  --transition-slow: 0.32s ease;

  /* ---- z-index ---- */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal-backdrop: 400;
  --z-modal: 500;
  --z-toast: 550;
  --z-tooltip: 600;
}

/* ==================== Dark mode ==================== */
[data-theme="dark"] {
  /* Brighter text for high contrast on dark surfaces. */
  --text-primary: #f4f7ff;
  --text-secondary: #b4c0d6;
  --text-disabled: #6e7a92;
  --text-link: #a195ff;
  --text-color: var(--text-primary);
  --text-muted: var(--text-secondary);

  --bg-primary: #0d1126;
  --bg-secondary: #181d36;
  --bg-tertiary: #232a48;
  --bg-hover: rgba(161, 149, 255, 0.12);
  --bg-active: rgba(161, 149, 255, 0.20);
  --bg-color: var(--bg-primary);
  --surface: var(--bg-secondary);
  --card-bg: var(--bg-secondary);

  --border-light: #2a3454;
  --border-medium: #3a4870;
  --border-color: var(--border-light);

  --g-blue: #a195ff;
  --g-blue-hover: #beb6ff;
  --g-blue-dark: #8478f0;
  --g-blue-light: rgba(161, 149, 255, 0.18);

  --g-green: #4ade80;
  --g-green-light: rgba(74, 222, 128, 0.18);

  --g-red: #ff7a9b;
  --g-red-light: rgba(255, 122, 155, 0.18);

  --g-yellow: #ffd166;
  --g-yellow-light: rgba(255, 209, 102, 0.18);

  --primary-color: var(--g-blue);

  --stripi-canvas-cream: #2a2418;
  --stripi-hairline: #2a3454;
  --stripi-hairline-input: #3a4870;
  --stripi-ink: #f4f7ff;
  --stripi-ink-secondary: #c8d2e6;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.5), 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6), 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.65), 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-card: var(--shadow-sm);
}

/* In dark mode, weight 300 reads too thin on small body text. Bump body to 400. */
[data-theme="dark"] body { font-weight: var(--font-normal); }
[data-theme="dark"] .g-input,
[data-theme="dark"] .g-select,
[data-theme="dark"] .g-textarea,
[data-theme="dark"] p { font-weight: var(--font-normal); }

/* Tables: data-dense surfaces need readable weight in BOTH modes.
   Weight 300 makes 13px / 14px numerics blur on light surfaces too. */
.g-table td,
.g-table th,
.data-table td,
.data-table th,
.data-table.compact td,
.data-table.compact th,
.stocks-table td,
.stocks-table th,
.sim-detail-table td,
.sim-detail-table th,
.stock-list-table td,
.stock-list-table th,
table.compact td,
table.compact th {
  font-weight: var(--font-normal);
}

/* Heads: keep slight emphasis */
.g-table th,
.data-table th,
.data-table.compact th,
.stocks-table th,
.sim-detail-table th,
.stock-list-table th {
  font-weight: var(--font-medium);
}

/* Symbol links and money cells get extra weight to read at 13/14px */
.g-stock-symbol,
.symbol-link,
a.symbol-link,
.g-stock-price {
  font-weight: var(--font-semibold);
}

/* Numeric value cells (gain/loss, change %, ROI, market cap) */
.g-table .g-value-positive,
.g-table .g-value-negative,
.data-table .change.positive,
.data-table .change.negative,
.stocks-table .g-value-positive,
.stocks-table .g-value-negative {
  font-weight: var(--font-medium);
}

/* ==================== Reset & Base ==================== */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color-scheme: light;
}
html[data-theme="dark"] { color-scheme: dark; }

body {
  margin: 0;
  font-family: var(--font-family);
  font-weight: var(--font-light);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  font-feature-settings: "ss01", "cv11";
  letter-spacing: -0.01em;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: var(--font-light);
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: var(--leading-tight);
}

h1 { font-size: var(--text-4xl); letter-spacing: -0.04em; }
h2 { font-size: var(--text-3xl); letter-spacing: -0.03em; }
h3 { font-size: var(--text-2xl); letter-spacing: -0.025em; }
h4 { font-size: var(--text-xl); letter-spacing: -0.02em; }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-md); }

p { margin: 0 0 var(--space-4) 0; color: var(--text-primary); }

a {
  color: var(--text-link);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--stripi-primary-deep); text-decoration: underline; }

[data-theme="dark"] a:hover { color: #a195ff; }

img { max-width: 100%; height: auto; display: block; }

button { font-family: inherit; cursor: pointer; }

input, select, textarea, button {
  font-family: inherit;
  font-size: inherit;
}

::selection { background: var(--stripi-primary-subdued); color: var(--stripi-ink); }
[data-theme="dark"] ::selection { background: rgba(138, 125, 255, 0.4); color: #fff; }

/* ==================== Utility text colors ==================== */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--g-green); }
.text-danger { color: var(--g-red); }
.text-warning { color: var(--g-yellow); }
.text-info { color: var(--g-blue); }

/* ==================== Layout ==================== */
.g-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-6);
  width: 100%;
}
.g-container-sm  { max-width: 640px; }
.g-container-md  { max-width: 768px; }
.g-container-lg  { max-width: 1024px; }
.g-container-xl  { max-width: 1280px; }
.g-container-full{ max-width: 100%; }

.g-page {
  min-height: 100vh;
  background-color: var(--bg-primary);
  display: flex;
  flex-direction: column;
}

.g-main { flex: 1; }

/* ==================== Header ==================== */
.g-header {
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  backdrop-filter: saturate(180%) blur(12px);
}

.g-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--space-3) var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
}

.g-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  color: var(--text-primary);
  font-weight: var(--font-medium);
}
.g-logo:hover { text-decoration: none; }

.g-logo-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--stripi-primary) 0%, var(--stripi-primary-soft) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-bold);
  font-size: 16px;
  letter-spacing: -0.02em;
  box-shadow: 0 2px 8px rgba(83, 58, 253, 0.32);
}

.g-logo-text {
  font-size: var(--text-md);
  font-weight: var(--font-medium);
  letter-spacing: -0.02em;
}
.g-logo-text span { color: var(--stripi-primary); font-weight: var(--font-semibold); }

.g-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.g-nav-link {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  transition: all var(--transition-fast);
}
.g-nav-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  text-decoration: none;
}
.g-nav-link.active {
  background: var(--bg-active);
  color: var(--stripi-primary);
}
.g-nav-link i { font-size: 13px; }

.g-user-menu { position: relative; }

.g-user-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: transparent;
  border: 1px solid var(--border-light);
  padding: 4px 12px 4px 4px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.g-user-btn:hover { background: var(--bg-hover); border-color: var(--border-medium); }

.g-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--stripi-primary) 0%, var(--stripi-primary-soft) 100%);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-semibold);
  font-size: 12px;
}

.g-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-2);
  display: none;
  z-index: var(--z-dropdown);
  animation: dropdownIn 0.18s ease;
}
.g-dropdown.show { display: block; }

@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.g-dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
  text-decoration: none;
  transition: background var(--transition-fast);
}
.g-dropdown-item:hover { background: var(--bg-hover); text-decoration: none; }
.g-dropdown-item i { width: 16px; color: var(--text-secondary); font-size: 13px; }

.g-dropdown-divider {
  height: 1px;
  background: var(--border-light);
  margin: var(--space-2) 0;
}

.g-theme-toggle {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}
.g-theme-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.g-mobile-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

/* ==================== Buttons ==================== */
.g-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-primary);
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  letter-spacing: -0.01em;
  min-height: 36px;
}
.g-btn:hover { text-decoration: none; }
.g-btn:focus-visible { outline: 2px solid var(--stripi-primary); outline-offset: 2px; }
.g-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.g-btn-primary {
  background: var(--stripi-primary);
  color: var(--stripi-on-primary);
}
.g-btn-primary:hover { background: var(--stripi-primary-deep); color: #fff; }
.g-btn-primary:active { background: var(--stripi-primary-press); }

.g-btn-secondary {
  background: var(--bg-primary);
  color: var(--stripi-primary);
  border: 1px solid var(--border-light);
}
.g-btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--stripi-primary-soft);
  color: var(--stripi-primary-deep);
}

.g-btn-text {
  background: transparent;
  color: var(--text-primary);
  padding: 8px 12px;
}
.g-btn-text:hover { background: var(--bg-hover); color: var(--stripi-primary); }

.g-btn-danger { background: var(--stripi-ruby); color: #fff; }
.g-btn-danger:hover { background: #c91a52; color: #fff; }

.g-btn-success { background: var(--g-green); color: #fff; }
.g-btn-success:hover { filter: brightness(0.92); color: #fff; }

.g-btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-full);
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
}
.g-btn-icon:hover {
  background: var(--bg-hover);
  color: var(--stripi-primary);
  border-color: var(--stripi-primary-soft);
}

.g-btn-sm  { padding: 6px 12px; font-size: var(--text-sm); min-height: 30px; }
.g-btn-lg  { padding: 12px 24px; font-size: var(--text-md); min-height: 44px; }
.g-btn-block { width: 100%; }

/* ==================== Forms ==================== */
.g-form-group { margin-bottom: var(--space-4); }

.g-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
  letter-spacing: -0.01em;
}

.g-input, .g-select, .g-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--stripi-hairline-input);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: var(--text-base);
  font-weight: var(--font-light);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  letter-spacing: -0.01em;
}

/* Make every <select> on the site theme-aware. Native option lists use
   color-scheme to inherit dark UI in dark mode; explicit color/bg covers
   the closed-state text and Firefox's option list. */
select {
  background: var(--bg-primary);
  color: var(--text-primary);
}
select option {
  background: var(--bg-primary);
  color: var(--text-primary);
}
[data-theme="dark"] select option {
  background: #181d36;
  color: #f4f7ff;
}
.g-input:focus, .g-select:focus, .g-textarea:focus {
  outline: none;
  border-color: var(--stripi-primary);
  box-shadow: 0 0 0 3px rgba(83, 58, 253, 0.15);
}
.g-input::placeholder, .g-textarea::placeholder { color: var(--text-disabled); }
.g-textarea { min-height: 96px; resize: vertical; }

.g-input-error { border-color: var(--g-red); }
.g-input-error:focus { box-shadow: 0 0 0 3px rgba(234, 34, 97, 0.15); }

.g-helper-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-2);
}
.g-error-text {
  font-size: var(--text-sm);
  color: var(--g-red);
  margin-top: var(--space-2);
}

.g-checkbox, .g-radio {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  cursor: pointer;
}
.g-checkbox input, .g-radio input {
  width: 16px; height: 16px; accent-color: var(--stripi-primary);
}

.g-search { position: relative; }
.g-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
}
.g-search .g-input { padding-left: 40px; }

/* ==================== Cards ==================== */
.g-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: box-shadow var(--transition-normal), transform var(--transition-normal);
}
.g-card-flat { box-shadow: none; border: 1px solid var(--border-light); }
.g-card-header {
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-light);
  margin-bottom: var(--space-4);
}
.g-card-title {
  font-size: var(--text-xl);
  font-weight: var(--font-light);
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.02em;
}
.g-card-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: var(--space-1) 0 0;
}
.g-card-body { padding: 0; }
.g-card-footer {
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-light);
  margin-top: var(--space-4);
}
.g-card-clickable { cursor: pointer; }
.g-card-clickable:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--stripi-primary-soft);
}

/* ==================== Tables ==================== */
.g-table-container {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: auto;
  background: var(--bg-primary);
}

.g-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  font-feature-settings: "tnum", "ss01";
  letter-spacing: -0.02em;
}

.g-table th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: var(--font-medium);
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.g-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: middle;
  font-feature-settings: "tnum", "ss01";
}

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

.g-table-compact th,
.g-table-compact td { padding: 6px 12px; }

.g-table-striped tbody tr:nth-child(even) { background: var(--bg-secondary); }

/* ==================== Badges ==================== */
.g-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: var(--font-medium);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.2;
}
.g-badge-primary { background: var(--stripi-primary-subdued); color: var(--stripi-primary-deep); }
.g-badge-success { background: var(--g-green-light); color: var(--g-green); }
.g-badge-danger  { background: var(--g-red-light); color: var(--g-red); }
.g-badge-warning { background: var(--g-yellow-light); color: var(--g-yellow); }
.g-badge-error   { background: var(--g-red-light); color: var(--g-red); }
.g-badge-neutral { background: var(--bg-tertiary); color: var(--text-secondary); }

[data-theme="dark"] .g-badge-primary { background: rgba(138, 125, 255, 0.18); color: #a195ff; }

/* ==================== Alerts ==================== */
.g-alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  margin-bottom: var(--space-4);
  font-size: var(--text-sm);
}
.g-alert i { font-size: 18px; margin-top: 2px; }
.g-alert-icon { font-size: 18px; flex-shrink: 0; margin-top: 2px; }
.g-alert-content { flex: 1; }
.g-alert-title { font-weight: var(--font-medium); margin-bottom: 2px; }

.g-alert-info    { background: var(--stripi-primary-subdued); color: var(--stripi-primary-deep); border-color: rgba(83, 58, 253, 0.2); }
.g-alert-success { background: var(--g-green-light); color: var(--g-green); border-color: rgba(31, 157, 85, 0.2); }
.g-alert-warning { background: var(--g-yellow-light); color: var(--g-yellow); border-color: rgba(184, 123, 7, 0.2); }
.g-alert-danger,
.g-alert-error   { background: var(--g-red-light); color: var(--g-red); border-color: rgba(234, 34, 97, 0.2); }

/* ==================== Modals ==================== */
.g-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(13, 37, 61, 0.55);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal-backdrop);
  animation: fadeIn 0.2s ease;
}
.g-modal-backdrop.show { display: flex; }

.g-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  max-width: 480px;
  width: calc(100% - 32px);
  z-index: var(--z-modal);
  animation: modalIn 0.22s ease;
  overflow: hidden;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn {
  from { opacity: 0; transform: translate(-50%, -48%) scale(0.96); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.g-modal-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.g-modal-title {
  font-size: var(--text-xl);
  font-weight: var(--font-light);
  margin: 0;
  letter-spacing: -0.02em;
}
.g-modal-close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.g-modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.g-modal-body { padding: var(--space-5) var(--space-6); }
.g-modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
}
.g-modal-content {
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
}

/* ==================== Hero (gradient mesh) ==================== */
.g-hero {
  position: relative;
  padding: var(--space-16) var(--space-6);
  text-align: center;
  background:
    radial-gradient(ellipse 80% 60% at 15% 25%, rgba(245, 233, 212, 0.85) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 35% 30%, rgba(155, 104, 41, 0.18) 0%, transparent 55%),
    radial-gradient(ellipse 70% 60% at 55% 35%, rgba(249, 107, 238, 0.32) 0%, transparent 60%),
    radial-gradient(ellipse 80% 70% at 75% 30%, rgba(83, 58, 253, 0.30) 0%, transparent 60%),
    radial-gradient(ellipse 70% 60% at 95% 25%, rgba(234, 34, 97, 0.32) 0%, transparent 60%),
    linear-gradient(180deg, #fbeede 0%, #f0d4f4 25%, #d0c5fe 50%, #ffffff 100%);
  overflow: hidden;
}

[data-theme="dark"] .g-hero {
  background:
    radial-gradient(ellipse 80% 60% at 15% 25%, rgba(155, 104, 41, 0.30) 0%, transparent 60%),
    radial-gradient(ellipse 70% 60% at 50% 35%, rgba(83, 58, 253, 0.40) 0%, transparent 60%),
    radial-gradient(ellipse 70% 60% at 90% 30%, rgba(234, 34, 97, 0.35) 0%, transparent 60%),
    linear-gradient(180deg, #1a1a3a 0%, #181b34 50%, #0e1224 100%);
}

.g-hero h1 {
  font-size: var(--text-5xl);
  font-weight: var(--font-light);
  letter-spacing: -0.045em;
  line-height: 1.03;
  color: var(--stripi-ink);
  max-width: 880px;
  margin: 0 auto var(--space-5);
}
[data-theme="dark"] .g-hero h1 { color: #fff; }

.g-hero p {
  font-size: var(--text-lg);
  color: var(--stripi-ink-secondary);
  max-width: 640px;
  margin: 0 auto var(--space-6);
  line-height: var(--leading-relaxed);
  font-weight: var(--font-light);
}
[data-theme="dark"] .g-hero p { color: rgba(232, 238, 247, 0.8); }

.g-hero-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  flex-wrap: wrap;
}

.g-hero .g-btn-primary { background: var(--stripi-primary); color: #fff; }
.g-hero .g-btn-primary:hover { background: var(--stripi-primary-deep); }
.g-hero .g-btn-secondary {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
  color: var(--stripi-primary-deep);
}
.g-hero .g-btn-secondary:hover { background: #fff; }
[data-theme="dark"] .g-hero .g-btn-secondary {
  background: rgba(28, 30, 84, 0.65);
  border-color: rgba(255, 255, 255, 0.16);
  color: #fff;
}

/* ==================== Stats ==================== */
.g-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
}
.g-stat-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}
.g-stat-label {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-2);
}
.g-stat-value {
  font-size: var(--text-2xl);
  font-weight: var(--font-light);
  color: var(--text-primary);
  letter-spacing: -0.025em;
  margin-bottom: var(--space-1);
  font-feature-settings: "tnum", "ss01";
}
.g-stat-change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}
.g-stat-change.positive { color: var(--g-green); }
.g-stat-change.negative { color: var(--g-red); }

/* ==================== Footer ==================== */
.g-footer {
  background: var(--bg-primary);
  border-top: 1px solid var(--border-light);
  margin-top: auto;
}
.g-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-12) var(--space-6) var(--space-8);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-8);
}
.g-footer-section h4 {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 var(--space-4);
}
.g-footer-links { list-style: none; padding: 0; margin: 0; }
.g-footer-links li { margin-bottom: var(--space-3); }
.g-footer-links a {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  text-decoration: none;
  transition: color var(--transition-fast);
}
.g-footer-links a:hover { color: var(--stripi-primary); }

.g-footer-bottom {
  border-top: 1px solid var(--border-light);
  padding: var(--space-5) var(--space-6);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  max-width: 1200px;
  margin: 0 auto;
}
.g-footer-copyright {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0;
}
.g-footer-social { display: flex; gap: var(--space-2); }
.g-footer-social a {
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.g-footer-social a:hover { background: var(--stripi-primary); color: #fff; }

/* ==================== Auth ==================== */
.g-auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background:
    radial-gradient(ellipse 60% 40% at 20% 10%, rgba(245, 233, 212, 0.6) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 5%, rgba(83, 58, 253, 0.16) 0%, transparent 65%),
    radial-gradient(ellipse 50% 40% at 95% 20%, rgba(234, 34, 97, 0.18) 0%, transparent 65%),
    var(--bg-secondary);
}
[data-theme="dark"] .g-auth-container {
  background:
    radial-gradient(ellipse 60% 40% at 20% 10%, rgba(155, 104, 41, 0.20) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 5%, rgba(83, 58, 253, 0.30) 0%, transparent 65%),
    radial-gradient(ellipse 50% 40% at 95% 20%, rgba(234, 34, 97, 0.18) 0%, transparent 65%),
    var(--bg-primary);
}

.g-auth-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: var(--space-8);
  max-width: 420px;
  width: 100%;
}

.g-auth-header { text-align: center; margin-bottom: var(--space-6); }
.g-auth-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}
.g-auth-header-row .g-auth-logo { margin: 0; }
.g-auth-header-row .g-theme-toggle { flex-shrink: 0; }

.g-auth-logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0 auto var(--space-4);
  text-decoration: none;
  color: var(--text-primary);
}
.g-auth-logo:hover { text-decoration: none; }

.g-auth-title {
  font-size: var(--text-2xl);
  font-weight: var(--font-light);
  color: var(--text-primary);
  letter-spacing: -0.025em;
  margin: 0 0 var(--space-1);
}
.g-auth-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0;
}

.g-auth-form .g-btn-primary { margin-top: var(--space-2); }

.g-auth-footer {
  text-align: center;
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border-light);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}
.g-auth-footer a { color: var(--stripi-primary); font-weight: var(--font-medium); }

.g-auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-5) 0;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.g-auth-divider::before,
.g-auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-light);
}

/* ==================== Features grid ==================== */
.g-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-5);
}
.g-feature-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  transition: all var(--transition-normal);
}
.g-feature-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  border-color: var(--stripi-primary-soft);
}
.g-feature-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--stripi-primary-bg);
  color: var(--stripi-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: var(--space-4);
}
.g-feature-card h3 {
  font-size: var(--text-xl);
  font-weight: var(--font-light);
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin: 0 0 var(--space-2);
}
.g-feature-card p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
  margin: 0 0 var(--space-4);
}
.g-feature-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--stripi-primary);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  text-decoration: none;
  transition: gap var(--transition-fast);
}
.g-feature-link:hover { gap: var(--space-3); text-decoration: none; }

/* ==================== Stock-specific values ==================== */
.g-positive, .g-value-positive, .text-positive { color: var(--g-green) !important; font-feature-settings: "tnum", "ss01"; }
.g-negative, .g-value-negative, .text-negative { color: var(--g-red) !important;   font-feature-settings: "tnum", "ss01"; }
.g-value-neutral { color: var(--text-secondary); font-feature-settings: "tnum", "ss01"; }

.g-positive-bg { background: var(--g-green-light); color: var(--g-green); padding: 2px 8px; border-radius: var(--radius-xs); }
.g-negative-bg { background: var(--g-red-light); color: var(--g-red); padding: 2px 8px; border-radius: var(--radius-xs); }

.g-stock-symbol {
  font-weight: var(--font-semibold);
  color: var(--stripi-primary);
  font-feature-settings: "tnum", "ss01";
  letter-spacing: 0;
}
.g-stock-price { font-weight: var(--font-medium); font-feature-settings: "tnum", "ss01"; }
.g-stock-change { font-size: var(--text-sm); font-feature-settings: "tnum", "ss01"; }

.g-action-buy   { background: var(--g-green-light); color: var(--g-green); padding: 2px 10px; border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: var(--font-semibold); text-transform: uppercase; letter-spacing: 0.06em; }
.g-action-sell  { background: var(--g-red-light); color: var(--g-red); padding: 2px 10px; border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: var(--font-semibold); text-transform: uppercase; letter-spacing: 0.06em; }
.g-action-hold  { background: var(--g-yellow-light); color: var(--g-yellow); padding: 2px 10px; border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: var(--font-semibold); text-transform: uppercase; letter-spacing: 0.06em; }

.g-link {
  color: var(--stripi-primary);
  font-weight: var(--font-medium);
  text-decoration: none;
}
.g-link:hover { color: var(--stripi-primary-deep); text-decoration: underline; }

.g-flag-icon {
  width: 18px;
  height: auto;
  vertical-align: middle;
  border-radius: 2px;
}

.g-table-actions {
  display: inline-flex;
  gap: var(--space-1);
}

/* Risk star/warning glyph styling (xfunctions.php) */
.risk_star {
  color: var(--g-yellow);
  font-size: 14px;
  letter-spacing: -2px;
}

/* ==================== Charts ==================== */
.g-chart-container {
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}
.g-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
}
.g-chart-period-btns {
  display: inline-flex;
  gap: 2px;
  background: var(--bg-secondary);
  padding: 2px;
  border-radius: var(--radius-full);
}
.g-chart-period-btn {
  padding: 6px 14px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.g-chart-period-btn:hover { color: var(--text-primary); }
.g-chart-period-btn.active {
  background: var(--bg-primary);
  color: var(--stripi-primary);
  box-shadow: var(--shadow-sm);
}

/* ==================== Page header ==================== */
.g-page-header { margin-bottom: var(--space-6); }
.g-page-header h1 {
  font-size: var(--text-3xl);
  font-weight: var(--font-light);
  letter-spacing: -0.03em;
  margin: 0 0 var(--space-2);
}
.g-page-header p {
  font-size: var(--text-md);
  color: var(--text-secondary);
  margin: 0;
}
.g-page-title {
  font-size: var(--text-2xl);
  font-weight: var(--font-light);
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin: 0 0 var(--space-1);
}
.g-page-subtitle {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin: 0;
}

/* ==================== Skeleton / Spinner ==================== */
.g-skeleton {
  background: linear-gradient(90deg, var(--bg-secondary) 0%, var(--bg-tertiary) 50%, var(--bg-secondary) 100%);
  background-size: 200% 100%;
  animation: skeleton 1.4s infinite;
  border-radius: var(--radius-md);
}
@keyframes skeleton {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

.g-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-light);
  border-top-color: var(--stripi-primary);
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== Utilities ==================== */
.g-flex { display: flex; }
.g-flex-col { flex-direction: column; }
.g-items-center { align-items: center; }
.g-justify-center { justify-content: center; }
.g-justify-between { justify-content: space-between; }
.g-gap-2 { gap: var(--space-2); }
.g-gap-4 { gap: var(--space-4); }
.g-gap-6 { gap: var(--space-6); }

.g-mt-4 { margin-top: var(--space-4); }
.g-mt-6 { margin-top: var(--space-6); }
.g-mt-8 { margin-top: var(--space-8); }
.g-mb-4 { margin-bottom: var(--space-4); }
.g-mb-6 { margin-bottom: var(--space-6); }
.g-mb-8 { margin-bottom: var(--space-8); }

.g-p-4 { padding: var(--space-4); }
.g-p-6 { padding: var(--space-6); }
.g-p-8 { padding: var(--space-8); }

.g-text-center { text-align: center; }
.g-text-right { text-align: right; }
.g-text-sm { font-size: var(--text-sm); }
.g-text-lg { font-size: var(--text-lg); }
.g-font-medium { font-weight: var(--font-medium); }
.g-font-bold { font-weight: var(--font-bold); }

.g-hidden { display: none; }
.g-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==================== Sidebar layout ==================== */
.g-layout-sidebar {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: var(--space-6);
  align-items: start;
}

.g-sidebar {
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  position: sticky;
  top: 80px;
}

.g-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.g-sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  text-decoration: none;
  transition: all var(--transition-fast);
}
.g-sidebar-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  text-decoration: none;
}
.g-sidebar-link.active {
  background: var(--stripi-primary-bg);
  color: var(--stripi-primary);
}
[data-theme="dark"] .g-sidebar-link.active {
  background: rgba(138, 125, 255, 0.16);
  color: #a195ff;
}
.g-sidebar-link i { width: 18px; text-align: center; font-size: 13px; }

.g-main-content { min-width: 0; }

/* Search container variants */
.g-search-container { position: relative; }
.g-search-input {
  width: 100%;
  padding: 10px 12px 10px 40px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: var(--text-base);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.g-search-input:focus {
  outline: none;
  border-color: var(--stripi-primary);
  box-shadow: 0 0 0 3px rgba(83, 58, 253, 0.15);
}

.g-search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 360px;
  overflow-y: auto;
  z-index: var(--z-dropdown);
  display: none;
}
.g-search-dropdown.show { display: block; }

/* ==================== Toasts ==================== */
#toastContainer {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}

.g-toast {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--stripi-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 280px;
  max-width: 420px;
  font-size: var(--text-sm);
  pointer-events: auto;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.g-toast.show { opacity: 1; transform: translateX(0); }
.g-toast.success { border-left-color: var(--g-green); }
.g-toast.success i { color: var(--g-green); }
.g-toast.warning { border-left-color: var(--g-yellow); }
.g-toast.warning i { color: var(--g-yellow); }
.g-toast.error   { border-left-color: var(--g-red); }
.g-toast.error i { color: var(--g-red); }
.g-toast.info i  { color: var(--stripi-primary); }
.g-toast i { font-size: 16px; flex-shrink: 0; }

.g-toast-message { flex: 1; line-height: var(--leading-normal); }
.g-toast-close, .toast-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.g-toast-close:hover, .toast-close:hover { color: var(--text-primary); background: var(--bg-hover); }

/* ==================== Pricing cards ==================== */
.g-pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-5);
}
.g-pricing-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
}
.g-pricing-card.featured {
  background: var(--stripi-brand-dark-900);
  color: #fff;
  border-color: var(--stripi-brand-dark-900);
}
.g-pricing-card.featured .g-pricing-name,
.g-pricing-card.featured .g-pricing-price { color: #fff; }
.g-pricing-card.featured .g-pricing-feature i { color: var(--stripi-primary-soft); }

.g-pricing-name {
  font-size: var(--text-xl);
  font-weight: var(--font-light);
  margin: 0 0 var(--space-2);
  letter-spacing: -0.02em;
}
.g-pricing-price {
  font-size: var(--text-3xl);
  font-weight: var(--font-light);
  letter-spacing: -0.03em;
  margin-bottom: var(--space-2);
  font-feature-settings: "tnum", "ss01";
}
.g-pricing-period { font-size: var(--text-sm); color: var(--text-secondary); }
.g-pricing-features { list-style: none; padding: 0; margin: var(--space-5) 0; }
.g-pricing-feature {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  font-size: var(--text-sm);
}
.g-pricing-feature i { color: var(--g-green); }

/* ==================== Cream card (Stripi accent) ==================== */
.g-card-cream {
  background: var(--stripi-canvas-cream);
  border: 1px solid rgba(155, 104, 41, 0.18);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  color: var(--stripi-ink);
}
[data-theme="dark"] .g-card-cream {
  background: rgba(155, 104, 41, 0.16);
  border-color: rgba(155, 104, 41, 0.30);
  color: var(--text-primary);
}

/* ==================== Pill tag (Stripi micro-cap label) ==================== */
.g-pill-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--stripi-primary-bg);
  color: var(--stripi-primary-deep);
  font-size: 10px;
  font-weight: var(--font-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
[data-theme="dark"] .g-pill-tag {
  background: rgba(138, 125, 255, 0.16);
  color: #a195ff;
}

/* ==================== Section helpers ==================== */
.g-section { padding: var(--space-16) var(--space-6); }
.g-section-tight { padding: var(--space-12) var(--space-6); }
.g-section-soft { background: var(--bg-secondary); }
.g-section-cream { background: var(--stripi-canvas-cream); }
[data-theme="dark"] .g-section-cream { background: rgba(155, 104, 41, 0.10); }

/* ==================== Legacy class shims ====================
   Old PHP pages use lab_*, div_*, span_* classes from the original
   Xide CSS. These shims keep them readable in the new theme.
   ============================================================ */
.div_display_frame_userterm,
.div_sub_question {
  max-width: 880px;
  margin: var(--space-12) auto;
  padding: var(--space-8);
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
}
.div_display_frame_userterm b { font-weight: var(--font-semibold); }
.div_display_frame_userterm a { color: var(--stripi-primary); }

.div_home_footer {
  margin-top: var(--space-8);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border-light);
  text-align: center;
}
.lab_home_footer_links { font-size: var(--text-sm); color: var(--text-secondary); }
.span_home_footer_links { margin: 0 var(--space-3); }
.span_home_footer_links a, .lab_home_footer_links a { color: var(--text-secondary); }

.lab_form_header {
  display: block;
  font-size: var(--text-2xl);
  font-weight: var(--font-light);
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}
.lab_logup_complete_msg {
  display: block;
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

.span_confirm_button,
.span_cancel_button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  cursor: pointer;
  margin: 0 var(--space-2);
}
.span_confirm_button {
  background: var(--stripi-primary);
  color: #fff;
}
.span_confirm_button:hover { background: var(--stripi-primary-deep); }
.span_cancel_button {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}
.span_cancel_button:hover { background: var(--bg-hover); }

.lab_popup_msg_content {
  display: block;
  font-size: var(--text-base);
  color: var(--text-primary);
  padding: var(--space-4);
}
.lab_popup_msg_content p { margin: var(--space-2) 0; }

.span_search_item_selected {
  background: var(--stripi-primary-bg);
  color: var(--stripi-primary-deep);
}

.span_msgbox_close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.span_msgbox_close:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ==================== Sim adjacent-row grouping (shared) ==================== */
/* Used by both sim.php (.sim-detail-table) and mysim_content.php (.stocks-table
   inside .sim-period-container). Each file adds its own row-hide CSS scoped to
   its own table class so the grouping JS only ever hides simulation trade rows. */

.sim-group-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.sim-group-btn:hover {
  background: var(--bg-hover);
  border-color: var(--stripi-primary-soft);
  color: var(--stripi-primary);
}
.sim-group-btn[data-grouped="1"] {
  background: var(--stripi-primary-bg);
  border-color: var(--stripi-primary-soft);
  color: var(--stripi-primary-deep);
}
[data-theme="dark"] .sim-group-btn[data-grouped="1"] {
  background: rgba(161, 149, 255, 0.18);
  color: #beb6ff;
}

tr.sim-group-summary {
  background: var(--stripi-primary-bg);
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast);
  border-left: 3px solid var(--stripi-primary);
}
[data-theme="dark"] tr.sim-group-summary { background: rgba(161, 149, 255, 0.10); }
tr.sim-group-summary:hover { background: var(--stripi-primary-subdued); }
[data-theme="dark"] tr.sim-group-summary:hover { background: rgba(161, 149, 255, 0.18); }
tr.sim-group-summary td { font-weight: var(--font-medium); }

.sim-group-expand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  margin-right: 8px;
  padding: 0;
  border: 1px solid var(--stripi-primary-soft);
  border-radius: var(--radius-full);
  background: var(--bg-primary);
  color: var(--stripi-primary);
  cursor: pointer;
  font-size: 10px;
  line-height: 1;
  transition: all var(--transition-fast);
  vertical-align: middle;
  flex-shrink: 0;
}
.sim-group-expand i { font-size: 10px; line-height: 1; display: block; }
tr.sim-group-summary:hover .sim-group-expand {
  background: var(--stripi-primary);
  color: #fff;
  transform: rotate(90deg);
}
.sim-group-expand-demo {
  margin: 0 4px;
  cursor: default;
  width: 20px; height: 20px;
  pointer-events: none;
}
.sim-group-dates { vertical-align: middle; }

.sim-group-count {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--stripi-primary);
  color: #fff;
  font-size: 11px;
  font-weight: var(--font-semibold);
  letter-spacing: -0.01em;
}

.sim-group-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: var(--space-3) 0;
  padding: 10px 14px;
  background: var(--stripi-primary-bg);
  border: 1px solid var(--stripi-primary-soft);
  border-radius: var(--radius-md);
  color: var(--stripi-primary-deep);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
}
[data-theme="dark"] .sim-group-hint {
  background: rgba(161, 149, 255, 0.10);
  border-color: rgba(161, 149, 255, 0.30);
  color: #beb6ff;
}
.sim-group-hint i { font-size: 14px; }
.sim-group-hint button {
  margin-left: auto;
  padding: 4px 10px;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.sim-group-hint button:hover {
  background: var(--stripi-primary);
  color: #fff;
  border-color: var(--stripi-primary);
}

/* ==================== Responsive ==================== */
@media (max-width: 1024px) {
  .g-layout-sidebar { grid-template-columns: 1fr; }
  .g-sidebar { position: static; }
}

@media (max-width: 768px) {
  h1 { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-2xl); }
  .g-hero { padding: var(--space-12) var(--space-4); }
  .g-hero h1 { font-size: var(--text-3xl); letter-spacing: -0.025em; }
  .g-hero p  { font-size: var(--text-md); }
  .g-header-inner { padding: var(--space-3) var(--space-4); }

  .g-mobile-menu-btn { display: inline-flex; }
  .g-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    padding: var(--space-3) var(--space-4);
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-2);
    box-shadow: var(--shadow-md);
  }
  .g-nav.show { display: flex; }
  .g-nav-link { padding: var(--space-3); justify-content: flex-start; }

  .g-footer-inner { padding: var(--space-8) var(--space-4) var(--space-5); gap: var(--space-5); }
  .g-footer-bottom { padding: var(--space-4); }

  .g-card { padding: var(--space-5); }
  .g-feature-card { padding: var(--space-5); }
  .g-auth-card { padding: var(--space-6); }

  #toastContainer { top: auto; bottom: 16px; right: 16px; left: 16px; }
  .g-toast { min-width: 0; max-width: 100%; }
}

@media (max-width: 480px) {
  .g-hero h1 { font-size: var(--text-2xl); }
  .g-stats { grid-template-columns: 1fr; }
}

/* ==================== Print ==================== */
@media print {
  .g-header, .g-footer, .g-mobile-menu-btn, .g-theme-toggle { display: none !important; }
  body { background: #fff; color: #000; }
}
