/* ============================================================
   Google Material Design 3 — Material You Dynamic Color System
   ELF Guard — ARM64 Executable Hardening Service
   Light + Dark dual mode, full MD3 component library
   ============================================================ */

/* ── MD3 Design Tokens: Light Theme (default) ──────────── */
:root {
  /* Source Color (seed): #5B6AF0 */
  --md-source: 233 85% 65%;

  /* Primary */
  --md-sys-color-primary: #4958D9;
  --md-sys-color-on-primary: #FFFFFF;
  --md-sys-color-primary-container: #DEE0FF;
  --md-sys-color-on-primary-container: #001259;
  /* Secondary */
  --md-sys-color-secondary: #5A5D72;
  --md-sys-color-on-secondary: #FFFFFF;
  --md-sys-color-secondary-container: #DFE1F9;
  --md-sys-color-on-secondary-container: #171A2C;
  /* Tertiary */
  --md-sys-color-tertiary: #745471;
  --md-sys-color-on-tertiary: #FFFFFF;
  --md-sys-color-tertiary-container: #FFD7F1;
  --md-sys-color-on-tertiary-container: #2B122B;
  /* Error */
  --md-sys-color-error: #BA1A1A;
  --md-sys-color-on-error: #FFFFFF;
  --md-sys-color-error-container: #FFDAD6;
  --md-sys-color-on-error-container: #410002;
  /* Success */
  --md-sys-color-success: #1B6D2F;
  --md-sys-color-on-success: #FFFFFF;
  --md-sys-color-success-container: #A7F5B6;
  --md-sys-color-on-success-container: #002106;
  /* Warning */
  --md-sys-color-warning: #8C5800;
  --md-sys-color-on-warning: #FFFFFF;
  --md-sys-color-warning-container: #FFDEA6;
  --md-sys-color-on-warning-container: #2D1800;
  /* Surface */
  --md-sys-color-surface: #FBF8FF;
  --md-sys-color-on-surface: #1B1B21;
  --md-sys-color-surface-variant: #E3E1EC;
  --md-sys-color-on-surface-variant: #46464F;
  --md-sys-color-surface-container-lowest: #FFFFFF;
  --md-sys-color-surface-container-low: #F5F2FF;
  --md-sys-color-surface-container: #EFEDF8;
  --md-sys-color-surface-container-high: #E9E7F2;
  --md-sys-color-surface-container-highest: #E3E1EC;
  /* Inverse */
  --md-sys-color-inverse-surface: #303036;
  --md-sys-color-inverse-on-surface: #F2F0F9;
  --md-sys-color-inverse-primary: #BDC3FF;
  /* Outline */
  --md-sys-color-outline: #767680;
  --md-sys-color-outline-variant: #C6C5D0;
  /* Scrim */
  --md-sys-color-scrim: #000000;

  /* Elevation — diffuse shadows (no hard edges) */
  --md-sys-elevation-0: none;
  --md-sys-elevation-1: 0px 1px 3px 0px rgba(0,0,0,0.08), 0px 1px 2px 0px rgba(0,0,0,0.06);
  --md-sys-elevation-2: 0px 2px 6px 0px rgba(0,0,0,0.08), 0px 1px 4px 0px rgba(0,0,0,0.06);
  --md-sys-elevation-3: 0px 4px 12px 0px rgba(0,0,0,0.10), 0px 2px 6px 0px rgba(0,0,0,0.06);
  --md-sys-elevation-4: 0px 8px 24px 0px rgba(0,0,0,0.12), 0px 4px 8px 0px rgba(0,0,0,0.06);
  --md-sys-elevation-5: 0px 12px 32px 0px rgba(0,0,0,0.14), 0px 6px 12px 0px rgba(0,0,0,0.06);

  /* Shape — no sharp corners, 12-28dp */
  --md-sys-shape-corner-none: 0px;
  --md-sys-shape-corner-xs: 8px;
  --md-sys-shape-corner-sm: 12px;
  --md-sys-shape-corner-md: 16px;
  --md-sys-shape-corner-lg: 20px;
  --md-sys-shape-corner-xl: 24px;
  --md-sys-shape-corner-2xl: 28px;
  --md-sys-shape-corner-full: 9999px;

  /* Motion */
  --md-sys-motion-short: 200ms;
  --md-sys-motion-medium: 350ms;
  --md-sys-motion-long: 500ms;
  --md-sys-motion-easing-standard: cubic-bezier(0.2, 0.0, 0, 1.0);
  --md-sys-motion-easing-emphasized: cubic-bezier(0.05, 0.7, 0.1, 1.0);
  --md-sys-motion-easing-decelerate: cubic-bezier(0.0, 0.0, 0.2, 1.0);
  --md-sys-motion-easing-accelerate: cubic-bezier(0.3, 0.0, 1.0, 1.0);

  /* Typography — MD3 Type Scale */
  --md-sys-typescale-display-large: 400 57px/64px 'Google Sans', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --md-sys-typescale-display-medium: 400 45px/52px 'Google Sans', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --md-sys-typescale-display-small: 400 36px/44px 'Google Sans', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --md-sys-typescale-headline-large: 400 32px/40px 'Google Sans', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --md-sys-typescale-headline-medium: 400 28px/36px 'Google Sans', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --md-sys-typescale-headline-small: 400 24px/32px 'Google Sans', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --md-sys-typescale-title-large: 400 22px/28px 'Google Sans', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --md-sys-typescale-title-medium: 500 16px/24px 'Google Sans', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --md-sys-typescale-title-small: 500 14px/20px 'Google Sans', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --md-sys-typescale-body-large: 400 16px/24px 'Roboto', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --md-sys-typescale-body-medium: 400 14px/20px 'Roboto', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --md-sys-typescale-body-small: 400 12px/16px 'Roboto', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --md-sys-typescale-label-large: 500 14px/20px 'Roboto', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --md-sys-typescale-label-medium: 500 12px/16px 'Roboto', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --md-sys-typescale-label-small: 500 11px/16px 'Roboto', 'PingFang SC', 'Microsoft YaHei', sans-serif;

  /* Spacing — 8dp grid */
  --md-sp-1: 8px;
  --md-sp-2: 16px;
  --md-sp-3: 24px;
  --md-sp-4: 32px;
  --md-sp-5: 40px;
  --md-sp-6: 48px;
  --md-sp-8: 64px;
  --md-sp-10: 80px;
}

/* ── Dark Theme ────────────────────────────────────────── */
[data-theme="dark"], .dark-theme {
  --md-source: 233 85% 65%;

  --md-sys-color-primary: #BDC3FF;
  --md-sys-color-on-primary: #001F7A;
  --md-sys-color-primary-container: #2E39A6;
  --md-sys-color-on-primary-container: #DEE0FF;
  --md-sys-color-secondary: #C3C5DD;
  --md-sys-color-on-secondary: #2C3042;
  --md-sys-color-secondary-container: #424659;
  --md-sys-color-on-secondary-container: #DFE1F9;
  --md-sys-color-tertiary: #E3BAD6;
  --md-sys-color-on-tertiary: #432741;
  --md-sys-color-tertiary-container: #5C3D58;
  --md-sys-color-on-tertiary-container: #FFD7F1;
  --md-sys-color-error: #FFB4AB;
  --md-sys-color-on-error: #690005;
  --md-sys-color-error-container: #93000A;
  --md-sys-color-on-error-container: #FFDAD6;
  --md-sys-color-success: #7BDD8A;
  --md-sys-color-on-success: #003910;
  --md-sys-color-success-container: #00531B;
  --md-sys-color-on-success-container: #A7F5B6;
  --md-sys-color-warning: #F5C04A;
  --md-sys-color-on-warning: #3F2E00;
  --md-sys-color-warning-container: #5C4400;
  --md-sys-color-on-warning-container: #FFDEA6;
  --md-sys-color-surface: #131318;
  --md-sys-color-on-surface: #E3E1E9;
  --md-sys-color-surface-variant: #46464F;
  --md-sys-color-on-surface-variant: #C6C5D0;
  --md-sys-color-surface-container-lowest: #0E0E13;
  --md-sys-color-surface-container-low: #1B1B21;
  --md-sys-color-surface-container: #1F1F25;
  --md-sys-color-surface-container-high: #292A30;
  --md-sys-color-surface-container-highest: #34353B;
  --md-sys-color-inverse-surface: #E3E1E9;
  --md-sys-color-inverse-on-surface: #303036;
  --md-sys-color-inverse-primary: #4958D9;
  --md-sys-color-outline: #90909A;
  --md-sys-color-outline-variant: #46464F;
  --md-sys-color-scrim: #000000;

  --md-sys-elevation-1: 0px 1px 3px 0px rgba(0,0,0,0.40), 0px 1px 2px 0px rgba(0,0,0,0.30);
  --md-sys-elevation-2: 0px 2px 6px 0px rgba(0,0,0,0.40), 0px 1px 4px 0px rgba(0,0,0,0.30);
  --md-sys-elevation-3: 0px 4px 12px 0px rgba(0,0,0,0.45), 0px 2px 6px 0px rgba(0,0,0,0.30);
  --md-sys-elevation-4: 0px 8px 24px 0px rgba(0,0,0,0.50), 0px 4px 8px 0px rgba(0,0,0,0.30);
  --md-sys-elevation-5: 0px 12px 32px 0px rgba(0,0,0,0.55), 0px 6px 12px 0px rgba(0,0,0,0.30);
}

/* ── Reset & Base ──────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}
body {
  font: var(--md-sys-typescale-body-medium);
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: var(--md-sys-color-primary); text-decoration: none; transition: color var(--md-sys-motion-short) var(--md-sys-motion-easing-standard); }
a:hover { opacity: 0.8; }
img { max-width: 100%; display: block; }
::selection { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }

/* ── MD3 Typography Classes ────────────────────────────── */
.md3-display-large { font: var(--md-sys-typescale-display-large); }
.md3-display-medium { font: var(--md-sys-typescale-display-medium); }
.md3-display-small { font: var(--md-sys-typescale-display-small); }
.md3-headline-large { font: var(--md-sys-typescale-headline-large); }
.md3-headline-medium { font: var(--md-sys-typescale-headline-medium); }
.md3-headline-small { font: var(--md-sys-typescale-headline-small); }
.md3-title-large { font: var(--md-sys-typescale-title-large); }
.md3-title-medium { font: var(--md-sys-typescale-title-medium); }
.md3-title-small { font: var(--md-sys-typescale-title-small); }
.md3-body-large { font: var(--md-sys-typescale-body-large); }
.md3-body-medium { font: var(--md-sys-typescale-body-medium); }
.md3-body-small { font: var(--md-sys-typescale-body-small); }
.md3-label-large { font: var(--md-sys-typescale-label-large); }
.md3-label-medium { font: var(--md-sys-typescale-label-medium); }
.md3-label-small { font: var(--md-sys-typescale-label-small); }

/* ── MD3 Buttons ───────────────────────────────────────── */
.md3-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; height: 40px; padding: 0 24px; border: none;
  border-radius: var(--md-sys-shape-corner-full); font: var(--md-sys-typescale-label-large);
  cursor: pointer; user-select: none; overflow: hidden; outline: none;
  transition: all var(--md-sys-motion-short) var(--md-sys-motion-easing-standard);
  white-space: nowrap; -webkit-tap-highlight-color: transparent;
}
.md3-btn:disabled { opacity: 0.38; cursor: not-allowed; pointer-events: none; }
.md3-btn .md3-btn-icon { font-size: 18px; width: 18px; height: 18px; flex-shrink: 0; }
.md3-btn:focus-visible { outline: 2px solid var(--md-sys-color-primary); outline-offset: 2px; }

/* Filled */
.md3-btn-filled {
  background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary);
  box-shadow: var(--md-sys-elevation-1);
}
.md3-btn-filled:hover { box-shadow: var(--md-sys-elevation-2); filter: brightness(1.08); }
.md3-btn-filled:active { box-shadow: var(--md-sys-elevation-0); }
.md3-btn-filled:disabled { box-shadow: none; }

/* Filled Tonal */
.md3-btn-filled-tonal {
  background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container);
}
.md3-btn-filled-tonal:hover { box-shadow: var(--md-sys-elevation-1); filter: brightness(1.05); }
.md3-btn-filled-tonal:active { box-shadow: none; }

/* Outlined */
.md3-btn-outlined {
  background: transparent; color: var(--md-sys-color-primary);
  border: 1px solid var(--md-sys-color-outline);
}
.md3-btn-outlined:hover { background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); border-color: var(--md-sys-color-primary); }
.md3-btn-outlined:active { filter: brightness(0.9); }

/* Text */
.md3-btn-text {
  background: transparent; color: var(--md-sys-color-primary); padding: 0 12px;
}
.md3-btn-text:hover { background: color-mix(in srgb, var(--md-sys-color-primary) 8%, transparent); }
.md3-btn-text:active { background: color-mix(in srgb, var(--md-sys-color-primary) 12%, transparent); }

/* Elevated */
.md3-btn-elevated {
  background: var(--md-sys-color-surface-container-low); color: var(--md-sys-color-primary);
  box-shadow: var(--md-sys-elevation-1);
}
.md3-btn-elevated:hover { box-shadow: var(--md-sys-elevation-2); }
.md3-btn-elevated:active { box-shadow: var(--md-sys-elevation-0); }

/* Danger */
.md3-btn-danger {
  background: var(--md-sys-color-error); color: var(--md-sys-color-on-error);
}
.md3-btn-danger:hover { box-shadow: var(--md-sys-elevation-1); filter: brightness(1.1); }

/* FAB */
.md3-fab {
  position: fixed; bottom: var(--md-sp-3); right: var(--md-sp-3);
  width: 56px; height: 56px; border-radius: var(--md-sys-shape-corner-md);
  background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container);
  box-shadow: var(--md-sys-elevation-3); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--md-sys-motion-short) var(--md-sys-motion-easing-standard);
  z-index: 90; overflow: hidden;
}
.md3-fab:hover { box-shadow: var(--md-sys-elevation-4); filter: brightness(1.05); }
.md3-fab:active { box-shadow: var(--md-sys-elevation-2); }
.md3-fab--extended {
  width: auto; height: 56px; padding: 0 24px; border-radius: var(--md-sys-shape-corner-md);
  gap: 12px; font: var(--md-sys-typescale-label-large);
}
.md3-fab svg { width: 24px; height: 24px; }

/* ── MD3 Cards ─────────────────────────────────────────── */
.md3-card {
  background: var(--md-sys-color-surface-container);
  border-radius: var(--md-sys-shape-corner-md);
  box-shadow: var(--md-sys-elevation-1);
  overflow: hidden;
  transition: box-shadow var(--md-sys-motion-short) var(--md-sys-motion-easing-standard);
}
.md3-card:hover { box-shadow: var(--md-sys-elevation-2); }
.md3-card-elevated { box-shadow: var(--md-sys-elevation-3); }
.md3-card-filled {
  background: var(--md-sys-color-surface-container-highest); box-shadow: none;
}
.md3-card-outlined {
  background: transparent; border: 1px solid var(--md-sys-color-outline-variant); box-shadow: none;
}

/* ── MD3 Text Fields (Outlined style) ──────────────────── */
.md3-text-field {
  position: relative; display: flex; flex-direction: column; gap: 4px;
}
.md3-text-field__input {
  width: 100%; height: 56px; padding: 24px 16px 8px;
  background: transparent; border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-xs);
  color: var(--md-sys-color-on-surface);
  font: var(--md-sys-typescale-body-large); outline: none;
  transition: border-color var(--md-sys-motion-short) var(--md-sys-motion-easing-standard);
}
.md3-text-field__input:hover { border-color: var(--md-sys-color-on-surface-variant); }
.md3-text-field__input:focus {
  border-color: var(--md-sys-color-primary); border-width: 2px; padding: 23px 15px 7px;
}
.md3-text-field__label {
  position: absolute; left: 16px; top: 16px;
  color: var(--md-sys-color-on-surface-variant);
  font: var(--md-sys-typescale-body-large); pointer-events: none;
  transition: all var(--md-sys-motion-short) var(--md-sys-motion-easing-standard);
  transform-origin: left top;
}
.md3-text-field__input:focus + .md3-text-field__label,
.md3-text-field__input:not(:placeholder-shown) + .md3-text-field__label {
  transform: translateY(-10px) scale(0.75); color: var(--md-sys-color-primary);
}
.md3-text-field__input:not(:focus):not(:placeholder-shown) + .md3-text-field__label {
  color: var(--md-sys-color-on-surface-variant);
}
.md3-text-field__supporting {
  font: var(--md-sys-typescale-body-small); color: var(--md-sys-color-on-surface-variant);
  padding: 0 16px; min-height: 20px;
}
.md3-text-field__supporting--error { color: var(--md-sys-color-error); }
.md3-text-field--error .md3-text-field__input { border-color: var(--md-sys-color-error); }

/* Filled Text Field variant */
.md3-text-field--filled .md3-text-field__input {
  background: var(--md-sys-color-surface-container-highest); border: none;
  border-bottom: 1px solid var(--md-sys-color-on-surface-variant);
  border-radius: var(--md-sys-shape-corner-xs) var(--md-sys-shape-corner-xs) 0 0;
}
.md3-text-field--filled .md3-text-field__input:focus {
  border-bottom: 2px solid var(--md-sys-color-primary); padding: 24px 16px 8px;
}

/* ── MD3 Input (simple) ────────────────────────────────── */
.md3-input {
  width: 100%; height: 48px; padding: 0 16px;
  background: var(--md-sys-color-surface-container-highest);
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-xs);
  color: var(--md-sys-color-on-surface); font: var(--md-sys-typescale-body-large);
  outline: none; transition: border-color var(--md-sys-motion-short);
}
.md3-input:hover { border-color: var(--md-sys-color-on-surface-variant); }
.md3-input:focus { border-color: var(--md-sys-color-primary); border-width: 2px; padding: 0 15px; }

/* ── MD3 Checkbox & Radio ──────────────────────────────── */
.md3-checkbox, .md3-radio {
  display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none;
  font: var(--md-sys-typescale-body-medium);
}
.md3-checkbox input, .md3-radio input {
  width: 18px; height: 18px; accent-color: var(--md-sys-color-primary); cursor: pointer;
}

/* ── MD3 Switch ────────────────────────────────────────── */
.md3-switch {
  display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none;
}
.md3-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.md3-switch__track {
  position: relative; width: 52px; height: 32px; flex-shrink: 0;
  background: var(--md-sys-color-surface-container-highest);
  border: 2px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-full);
  transition: all var(--md-sys-motion-short) var(--md-sys-motion-easing-standard);
}
.md3-switch__track::after {
  content: ''; position: absolute; top: 4px; left: 4px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--md-sys-color-outline);
  transition: all var(--md-sys-motion-short) var(--md-sys-motion-easing-standard);
}
.md3-switch input:checked + .md3-switch__track {
  background: var(--md-sys-color-primary); border-color: var(--md-sys-color-primary);
}
.md3-switch input:checked + .md3-switch__track::after {
  transform: translateX(20px); background: var(--md-sys-color-on-primary);
  width: 24px; height: 24px; top: 2px; left: 2px;
}

/* ── MD3 Slider ────────────────────────────────────────── */
.md3-slider {
  -webkit-appearance: none; width: 100%; height: 4px;
  background: var(--md-sys-color-surface-container-highest); border-radius: 2px; outline: none;
}
.md3-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%;
  background: var(--md-sys-color-primary); cursor: pointer; border: none;
  box-shadow: var(--md-sys-elevation-1);
}
.md3-slider:focus::-webkit-slider-thumb { box-shadow: 0 0 0 4px color-mix(in srgb, var(--md-sys-color-primary) 30%, transparent); }

/* ── MD3 Chip ──────────────────────────────────────────── */
.md3-chip {
  display: inline-flex; align-items: center; height: 32px; padding: 0 16px;
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-xs);
  font: var(--md-sys-typescale-label-large); color: var(--md-sys-color-on-surface-variant);
  background: transparent; cursor: pointer; gap: 8px;
  transition: all var(--md-sys-motion-short);
}
.md3-chip:hover { background: color-mix(in srgb, var(--md-sys-color-primary) 8%, transparent); }
.md3-chip--selected {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container); border-color: transparent;
}

/* ── MD3 Dialog (Modal) ────────────────────────────────── */
.md3-dialog-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: var(--md-sp-3);
  animation: md3-fade-in var(--md-sys-motion-short) var(--md-sys-motion-easing-decelerate);
}
.md3-dialog {
  background: var(--md-sys-color-surface-container-high);
  border-radius: var(--md-sys-shape-corner-xl);
  padding: var(--md-sp-3); min-width: 320px; max-width: 560px; width: 100%;
  box-shadow: var(--md-sys-elevation-5);
  animation: md3-scale-in var(--md-sys-motion-medium) var(--md-sys-motion-easing-emphasized);
}
.md3-dialog__title { font: var(--md-sys-typescale-headline-small); margin-bottom: var(--md-sp-2); }
.md3-dialog__content { font: var(--md-sys-typescale-body-medium); color: var(--md-sys-color-on-surface-variant); margin-bottom: var(--md-sp-3); }
.md3-dialog__actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ── MD3 Snackbar (Toast) ──────────────────────────────── */
.md3-snackbar-container {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 9999; display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.md3-snackbar {
  display: flex; align-items: center; padding: 14px 16px;
  background: var(--md-sys-color-inverse-surface); color: var(--md-sys-color-inverse-on-surface);
  border-radius: var(--md-sys-shape-corner-xs); box-shadow: var(--md-sys-elevation-3);
  font: var(--md-sys-typescale-body-medium); min-width: 288px; max-width: 480px;
  animation: md3-snackbar-in var(--md-sys-motion-medium) var(--md-sys-motion-easing-emphasized);
}
.md3-snackbar--error { background: var(--md-sys-color-error); color: var(--md-sys-color-on-error); }
.md3-snackbar--success { background: var(--md-sys-color-success); color: var(--md-sys-color-on-success); }
.md3-snackbar--warning { background: var(--md-sys-color-warning-container); color: var(--md-sys-color-on-warning-container); }
.md3-snackbar__action {
  margin-left: auto; padding-left: 16px; color: inherit; opacity: 0.9;
  font: var(--md-sys-typescale-label-large); cursor: pointer; background: none; border: none;
}

/* ── MD3 Divider ───────────────────────────────────────── */
.md3-divider { height: 1px; background: var(--md-sys-color-outline-variant); margin: 8px 0; }

/* ── MD3 Navigation Rail (Desktop sidebar) ─────────────── */
.md3-nav-rail {
  display: flex; flex-direction: column; gap: 4px; padding: 12px;
  background: var(--md-sys-color-surface-container);
  width: 80px; height: 100vh; position: fixed; left: 0; top: 0; z-index: 100;
  overflow-y: auto;
}
.md3-nav-rail__item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 4px; border-radius: var(--md-sys-shape-corner-full);
  cursor: pointer; width: 100%; text-align: center;
  font: var(--md-sys-typescale-label-medium); color: var(--md-sys-color-on-surface-variant);
  background: none; border: none; transition: all var(--md-sys-motion-short);
  outline: none;
}
.md3-nav-rail__item:hover { background: color-mix(in srgb, var(--md-sys-color-primary) 8%, transparent); color: var(--md-sys-color-on-surface); }
.md3-nav-rail__item--active {
  background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container);
}
.md3-nav-rail__icon { width: 24px; height: 24px; flex-shrink: 0; }
.md3-nav-rail__label { font: var(--md-sys-typescale-label-small); }

/* ── MD3 Bottom Navigation (Mobile) ────────────────────── */
.md3-bottom-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: var(--md-sys-color-surface-container);
  border-top: 1px solid var(--md-sys-color-outline-variant);
  height: 72px; padding: 0 8px;
  justify-content: space-around; align-items: center;
}
.md3-bottom-nav__item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; padding: 8px 12px; min-width: 64px; height: 64px;
  border: none; background: none; cursor: pointer;
  font: var(--md-sys-typescale-label-medium); color: var(--md-sys-color-on-surface-variant);
  border-radius: var(--md-sys-shape-corner-md);
  transition: all var(--md-sys-motion-short);
}
.md3-bottom-nav__item:hover { color: var(--md-sys-color-on-surface); }
.md3-bottom-nav__item--active { color: var(--md-sys-color-primary); }
.md3-bottom-nav__icon { width: 24px; height: 24px; }
.md3-bottom-nav__badge {
  position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px;
  padding: 0 4px; border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-error); color: var(--md-sys-color-on-error);
  font: var(--md-sys-typescale-label-small); font-size: 10px;
  display: flex; align-items: center; justify-content: center;
}

/* ── MD3 Navigation Drawer (Mobile) ────────────────────── */
.md3-drawer-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 200; opacity: 0;
  pointer-events: none; transition: opacity var(--md-sys-motion-medium) var(--md-sys-motion-easing-emphasized);
}
.md3-drawer-overlay--open { opacity: 1; pointer-events: all; }
.md3-drawer {
  position: fixed; top: 0; left: 0; bottom: 0; width: 320px; z-index: 201;
  background: var(--md-sys-color-surface-container);
  box-shadow: var(--md-sys-elevation-4);
  transform: translateX(-100%);
  transition: transform var(--md-sys-motion-medium) var(--md-sys-motion-easing-emphasized);
  display: flex; flex-direction: column;
}
.md3-drawer--open { transform: translateX(0); }
.md3-drawer__header {
  padding: var(--md-sp-3); border-bottom: 1px solid var(--md-sys-color-outline-variant);
}
.md3-drawer__body { flex: 1; overflow-y: auto; padding: 8px 0; }
.md3-drawer__item {
  display: flex; align-items: center; gap: 16px; padding: 14px 24px;
  font: var(--md-sys-typescale-body-large); color: var(--md-sys-color-on-surface);
  cursor: pointer; background: none; border: none; width: 100%; text-align: left;
  transition: background var(--md-sys-motion-short);
}
.md3-drawer__item:hover { background: color-mix(in srgb, var(--md-sys-color-primary) 8%, transparent); }
.md3-drawer__item--active { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.md3-drawer__item svg { width: 24px; height: 24px; flex-shrink: 0; }

/* ── MD3 Top App Bar ───────────────────────────────────── */
.md3-top-bar {
  display: flex; align-items: center; height: 64px; padding: 0 16px;
  background: var(--md-sys-color-surface);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  position: sticky; top: 0; z-index: 50; gap: 12px;
}
.md3-top-bar__title { font: var(--md-sys-typescale-title-large); flex: 1; }
.md3-top-bar__icon {
  width: 40px; height: 40px; border-radius: 50%; border: none; background: none;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--md-sys-color-on-surface);
  transition: background var(--md-sys-motion-short);
}
.md3-top-bar__icon:hover { background: color-mix(in srgb, var(--md-sys-color-primary) 8%, transparent); }

/* ── MD3 Progress Indicator ────────────────────────────── */
.md3-progress-linear {
  width: 100%; height: 4px; background: var(--md-sys-color-surface-container-highest);
  border-radius: 2px; overflow: hidden;
}
.md3-progress-linear__bar {
  height: 100%; background: var(--md-sys-color-primary); border-radius: 2px;
  animation: md3-progress-indeterminate 1.5s var(--md-sys-motion-easing-standard) infinite;
}
.md3-progress-circular {
  width: 40px; height: 40px; border: 4px solid var(--md-sys-color-surface-container-highest);
  border-top-color: var(--md-sys-color-primary); border-radius: 50%;
  animation: md3-spin 1s linear infinite;
}
@keyframes md3-progress-indeterminate {
  0% { width: 0%; margin-left: 0; }
  50% { width: 60%; margin-left: 20%; }
  100% { width: 0%; margin-left: 100%; }
}
@keyframes md3-spin { to { transform: rotate(360deg); } }

/* ── MD3 Badge ─────────────────────────────────────────── */
.md3-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-error); color: var(--md-sys-color-on-error);
  font: var(--md-sys-typescale-label-small); font-size: 10px;
}

/* ── MD3 Tooltip ───────────────────────────────────────── */
.md3-tooltip {
  position: absolute; padding: 4px 8px; background: var(--md-sys-color-inverse-surface);
  color: var(--md-sys-color-inverse-on-surface); white-space: nowrap;
  border-radius: var(--md-sys-shape-corner-xs); font: var(--md-sys-typescale-body-small);
  pointer-events: none; z-index: 1000; opacity: 0;
  transition: opacity var(--md-sys-motion-short);
}

/* ── MD3 Ripple ────────────────────────────────────────── */
.md3-ripple {
  position: relative; overflow: hidden;
}
.md3-ripple-effect {
  position: absolute; border-radius: 50%; pointer-events: none;
  background: rgba(0,0,0,0.12); transform: scale(0); animation: md3-ripple-anim 600ms ease-out forwards;
}
[data-theme="dark"] .md3-ripple-effect, .dark-theme .md3-ripple-effect {
  background: rgba(255,255,255,0.12);
}
@keyframes md3-ripple-anim {
  to { transform: scale(4); opacity: 0; }
}

/* ── MD3 Menu ──────────────────────────────────────────── */
.md3-menu {
  position: absolute; min-width: 140px;
  background: var(--md-sys-color-surface-container);
  border-radius: var(--md-sys-shape-corner-xs); box-shadow: var(--md-sys-elevation-3);
  padding: 8px 0; z-index: 200;
  animation: md3-scale-in var(--md-sys-motion-short) var(--md-sys-motion-easing-decelerate);
  transform-origin: top left;
}
.md3-menu__item {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  font: var(--md-sys-typescale-body-medium); color: var(--md-sys-color-on-surface);
  cursor: pointer; background: none; border: none; width: 100%; text-align: left;
  transition: background var(--md-sys-motion-short);
}
.md3-menu__item:hover { background: color-mix(in srgb, var(--md-sys-color-primary) 8%, transparent); }
.md3-menu__item--danger { color: var(--md-sys-color-error); }

/* ── MD3 Tabs ──────────────────────────────────────────── */
.md3-tabs {
  display: flex; gap: 0; border-bottom: 1px solid var(--md-sys-color-outline-variant);
}
.md3-tab {
  flex: 1; position: relative; height: 48px; display: flex; align-items: center;
  justify-content: center; font: var(--md-sys-typescale-title-small);
  color: var(--md-sys-color-on-surface-variant); cursor: pointer;
  background: none; border: none; transition: color var(--md-sys-motion-short);
}
.md3-tab:hover { color: var(--md-sys-color-on-surface); }
.md3-tab--active { color: var(--md-sys-color-primary); }
.md3-tab--active::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
  background: var(--md-sys-color-primary); border-radius: 3px 3px 0 0;
  animation: md3-tab-indicator var(--md-sys-motion-medium) var(--md-sys-motion-easing-emphasized);
}
@keyframes md3-tab-indicator { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ── MD3 Data Table ────────────────────────────────────── */
.md3-table {
  width: 100%; border-collapse: collapse; font: var(--md-sys-typescale-body-medium);
}
.md3-table th {
  text-align: left; padding: 12px 16px; font: var(--md-sys-typescale-label-large);
  color: var(--md-sys-color-on-surface-variant);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface-container-low);
}
.md3-table td { padding: 12px 16px; border-bottom: 1px solid var(--md-sys-color-outline-variant); }
.md3-table tr:hover td { background: color-mix(in srgb, var(--md-sys-color-primary) 4%, transparent); }

/* ── MD3 Search Bar ────────────────────────────────────── */
.md3-search {
  position: relative; display: flex; align-items: center;
}
.md3-search__icon {
  position: absolute; left: 12px; color: var(--md-sys-color-on-surface-variant); pointer-events: none;
}
.md3-search__input {
  width: 100%; height: 48px; padding: 0 16px 0 44px;
  background: var(--md-sys-color-surface-container-high); border: none;
  border-radius: var(--md-sys-shape-corner-full); color: var(--md-sys-color-on-surface);
  font: var(--md-sys-typescale-body-large); outline: none;
}
.md3-search__input:focus { background: var(--md-sys-color-surface-container-highest); }

/* ── MD3 Select ────────────────────────────────────────── */
.md3-select {
  position: relative;
}
.md3-select select {
  width: 100%; height: 48px; padding: 0 40px 0 16px;
  background: var(--md-sys-color-surface-container-highest);
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-xs); color: var(--md-sys-color-on-surface);
  font: var(--md-sys-typescale-body-large); outline: none; appearance: none; cursor: pointer;
}
.md3-select select:focus { border-color: var(--md-sys-color-primary); }
.md3-select::after {
  content: '▾'; position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  color: var(--md-sys-color-on-surface-variant); pointer-events: none;
}

/* ── MD3 Avatar ────────────────────────────────────────── */
.md3-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  display: flex; align-items: center; justify-content: center;
  font: var(--md-sys-typescale-title-medium);
}

/* ── Layout ────────────────────────────────────────────── */
.md3-layout { display: flex; min-height: 100vh; }
.md3-layout__nav { width: 80px; flex-shrink: 0; }
.md3-layout__content { flex: 1; min-width: 0; padding: var(--md-sp-4) var(--md-sp-5); margin-left: 80px; }
.md3-container { max-width: 1200px; margin: 0 auto; }
.md3-page-title { font: var(--md-sys-typescale-headline-medium); margin-bottom: var(--md-sp-3); }

/* ── Grid (8dp based) ──────────────────────────────────── */
.md3-grid { display: grid; gap: var(--md-sp-2); }
.md3-grid-2 { grid-template-columns: repeat(2, 1fr); }
.md3-grid-3 { grid-template-columns: repeat(3, 1fr); }
.md3-grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ── Spacing (8dp multiples) ───────────────────────────── */
.md3-mt-1 { margin-top: 8px; }
.md3-mt-2 { margin-top: 16px; }
.md3-mt-3 { margin-top: 24px; }
.md3-mt-4 { margin-top: 32px; }
.md3-mt-6 { margin-top: 48px; }
.md3-mb-1 { margin-bottom: 8px; }
.md3-mb-2 { margin-bottom: 16px; }
.md3-mb-3 { margin-bottom: 24px; }
.md3-mb-4 { margin-bottom: 32px; }
.md3-mb-6 { margin-bottom: 48px; }
.md3-p-2 { padding: 16px; }
.md3-p-3 { padding: 24px; }
.md3-p-4 { padding: 32px; }
.md3-gap-1 { gap: 8px; }
.md3-gap-2 { gap: 16px; }
.md3-gap-3 { gap: 24px; }
.md3-gap-4 { gap: 32px; }

/* ── Flex helpers ──────────────────────────────────────── */
.md3-flex { display: flex; }
.md3-flex-col { flex-direction: column; }
.md3-items-center { align-items: center; }
.md3-items-start { align-items: flex-start; }
.md3-justify-between { justify-content: space-between; }
.md3-justify-center { justify-content: center; }
.md3-justify-end { justify-content: flex-end; }
.md3-flex-1 { flex: 1; }
.md3-flex-wrap { flex-wrap: wrap; }

/* ── Text helpers ──────────────────────────────────────── */
.md3-text-center { text-align: center; }
.md3-text-right { text-align: right; }
.md3-text-secondary { color: var(--md-sys-color-on-surface-variant); }
.md3-text-primary { color: var(--md-sys-color-primary); }
.md3-text-error { color: var(--md-sys-color-error); }
.md3-text-success { color: var(--md-sys-color-success); }
.md3-text-warning { color: var(--md-sys-color-warning); }
.md3-mono { font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace; }
.md3-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Animations ────────────────────────────────────────── */
@keyframes md3-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes md3-scale-in { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }
@keyframes md3-slide-up { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
@keyframes md3-snackbar-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes md3-pulse { 0%,100% { opacity: 0.6; } 50% { opacity: 1; } }
.md3-animate-in { animation: md3-slide-up var(--md-sys-motion-medium) var(--md-sys-motion-easing-decelerate) both; }
.md3-animate-in:nth-child(2) { animation-delay: 50ms; }
.md3-animate-in:nth-child(3) { animation-delay: 100ms; }
.md3-animate-in:nth-child(4) { animation-delay: 150ms; }
.md3-animate-in:nth-child(5) { animation-delay: 200ms; }

/* ── Hidden ────────────────────────────────────────────── */
.md3-hidden { display: none !important; }

/* ── Page-specific: Auth Pages ─────────────────────────── */
.auth-page {
  display: flex; min-height: 100vh; align-items: center; justify-content: center;
  padding: var(--md-sp-3);
}
.auth-card {
  width: 100%; max-width: 440px; padding: var(--md-sp-5);
  background: var(--md-sys-color-surface-container);
  border-radius: var(--md-sys-shape-corner-2xl);
  box-shadow: var(--md-sys-elevation-3);
}
.auth-card__logo {
  display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: var(--md-sp-4);
}
.auth-card__logo svg { width: 40px; height: 40px; }
.auth-card__logo span { font: var(--md-sys-typescale-headline-small); }
.auth-card__title {
  font: var(--md-sys-typescale-headline-medium); margin-bottom: 8px; text-align: center;
}
.auth-card__subtitle {
  font: var(--md-sys-typescale-body-medium); color: var(--md-sys-color-on-surface-variant);
  text-align: center; margin-bottom: var(--md-sp-4);
}
.auth-card__footer {
  margin-top: var(--md-sp-3); text-align: center;
  font: var(--md-sys-typescale-body-medium); color: var(--md-sys-color-on-surface-variant);
}
.auth-card__error {
  padding: 12px; background: var(--md-sys-color-error-container);
  color: var(--md-sys-color-on-error-container);
  border-radius: var(--md-sys-shape-corner-xs); margin-bottom: var(--md-sp-2);
  font: var(--md-sys-typescale-body-medium); display: none;
}
.auth-back {
  position: absolute; top: var(--md-sp-3); left: var(--md-sp-3);
}

/* ── Page-specific: Dashboard ──────────────────────────── */
.dashboard-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--md-sp-2); margin-bottom: var(--md-sp-3);
}
.stat-card {
  padding: 20px 24px; background: var(--md-sys-color-surface-container);
  border-radius: var(--md-sys-shape-corner-md); box-shadow: var(--md-sys-elevation-1);
}
.stat-card__label {
  font: var(--md-sys-typescale-label-medium); color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px;
}
.stat-card__value { font: var(--md-sys-typescale-headline-medium); }
.stat-card__value--primary { color: var(--md-sys-color-primary); }
.stat-card__value--success { color: var(--md-sys-color-success); }
.stat-card__value--warning { color: var(--md-sys-color-warning); }

/* ── Hero Section ──────────────────────────────────────── */
.hero {
  padding: var(--md-sp-10) var(--md-sp-3); text-align: center; max-width: 800px; margin: 0 auto;
}
.hero__title {
  font: var(--md-sys-typescale-display-medium); margin-bottom: var(--md-sp-2);
  background: linear-gradient(135deg, var(--md-sys-color-primary), var(--md-sys-color-tertiary));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.hero__subtitle {
  font: var(--md-sys-typescale-body-large); color: var(--md-sys-color-on-surface-variant);
  max-width: 560px; margin: 0 auto var(--md-sp-4); line-height: 1.7;
}
.hero__actions { display: flex; gap: var(--md-sp-2); justify-content: center; flex-wrap: wrap; }

/* ── Features ──────────────────────────────────────────── */
.features {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--md-sp-3); padding: var(--md-sp-6) var(--md-sp-3); max-width: 1100px; margin: 0 auto;
}
.feature-card {
  padding: var(--md-sp-4); background: var(--md-sys-color-surface-container);
  border-radius: var(--md-sys-shape-corner-lg); box-shadow: var(--md-sys-elevation-1);
  transition: all var(--md-sys-motion-short) var(--md-sys-motion-easing-standard);
}
.feature-card:hover { box-shadow: var(--md-sys-elevation-3); transform: translateY(-2px); }
.feature-card__icon {
  width: 48px; height: 48px; border-radius: var(--md-sys-shape-corner-md);
  background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container);
  display: flex; align-items: center; justify-content: center; margin-bottom: var(--md-sp-2);
}
.feature-card__title { font: var(--md-sys-typescale-title-medium); margin-bottom: 8px; }
.feature-card__desc { font: var(--md-sys-typescale-body-medium); color: var(--md-sys-color-on-surface-variant); line-height: 1.6; }

/* ── Pricing ───────────────────────────────────────────── */
.pricing-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--md-sp-3); padding: var(--md-sp-6) var(--md-sp-3); max-width: 1100px; margin: 0 auto;
}
.pricing-card {
  padding: var(--md-sp-4); background: var(--md-sys-color-surface-container);
  border-radius: var(--md-sys-shape-corner-lg); box-shadow: var(--md-sys-elevation-1);
  border: 2px solid transparent; transition: all var(--md-sys-motion-short);
  text-align: center; position: relative;
}
.pricing-card:hover { box-shadow: var(--md-sys-elevation-3); transform: translateY(-2px); }
.pricing-card--featured { border-color: var(--md-sys-color-primary); background: var(--md-sys-color-surface-container-high); }
.pricing-card__name { font: var(--md-sys-typescale-title-medium); margin-bottom: 4px; }
.pricing-card__price { font: var(--md-sys-typescale-display-small); margin: var(--md-sp-2) 0; }
.pricing-card__price span { font: var(--md-sys-typescale-body-large); color: var(--md-sys-color-on-surface-variant); }
.pricing-card__desc { font: var(--md-sys-typescale-body-medium); color: var(--md-sys-color-on-surface-variant); margin-bottom: var(--md-sp-3); }
.pricing-card__badge {
  position: absolute; top: 12px; right: 12px; padding: 4px 12px;
  background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary);
  border-radius: var(--md-sys-shape-corner-full); font: var(--md-sys-typescale-label-small);
}

/* ── Upload Area ───────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-lg); padding: var(--md-sp-6) var(--md-sp-3);
  text-align: center; cursor: pointer;
  transition: all var(--md-sys-motion-short) var(--md-sys-motion-easing-standard);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--md-sys-color-primary);
  background: color-mix(in srgb, var(--md-sys-color-primary) 6%, transparent);
}
.upload-zone__icon { color: var(--md-sys-color-on-surface-variant); margin-bottom: 12px; }
.upload-zone__text { font: var(--md-sys-typescale-body-large); color: var(--md-sys-color-on-surface-variant); }
.upload-zone__text span { color: var(--md-sys-color-primary); font-weight: 500; }
.upload-zone__hint { font: var(--md-sys-typescale-body-small); color: var(--md-sys-color-on-surface-variant); margin-top: 8px; opacity: 0.6; }

/* ── File Info ─────────────────────────────────────────── */
.file-info {
  padding: var(--md-sp-2); background: var(--md-sys-color-surface-container-low);
  border-radius: var(--md-sys-shape-corner-md); border: 1px solid var(--md-sys-color-outline-variant);
}
.file-info__header { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font: var(--md-sys-typescale-title-small); }
.file-info__size { font: var(--md-sys-typescale-body-small); color: var(--md-sys-color-on-surface-variant); margin-left: auto; }
.file-info__details { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; font: var(--md-sys-typescale-body-small); }
.file-info__item { display: flex; gap: 6px; }
.file-info__label { color: var(--md-sys-color-on-surface-variant); }

/* ── VM Function Selection ─────────────────────────────── */
.vm-section {
  padding: 20px; background: var(--md-sys-color-surface-container-low);
  border-radius: var(--md-sys-shape-corner-md); border: 1px solid var(--md-sys-color-outline-variant);
}
.vm-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.vm-title { font: var(--md-sys-typescale-title-small); }
.vm-desc { font: var(--md-sys-typescale-body-small); color: var(--md-sys-color-on-surface-variant); margin-bottom: 12px; }
.vm-list { display: flex; flex-direction: column; gap: 4px; max-height: 320px; overflow-y: auto; }
.vm-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: var(--md-sys-shape-corner-xs); cursor: pointer;
  border: 1px solid transparent; transition: background var(--md-sys-motion-short);
}
.vm-item:hover { background: color-mix(in srgb, var(--md-sys-color-primary) 8%, transparent); }
.vm-item--main { background: color-mix(in srgb, var(--md-sys-color-primary) 6%, transparent); border-color: color-mix(in srgb, var(--md-sys-color-primary) 20%, transparent); }
.vm-checkbox { width: 16px; height: 16px; accent-color: var(--md-sys-color-primary); cursor: pointer; flex-shrink: 0; }
.vm-func-name { font: 600 14px 'SF Mono', 'Fira Code', monospace; min-width: 80px; }
.vm-func-addr { font: 12px 'SF Mono', 'Fira Code', monospace; color: var(--md-sys-color-primary); }
.vm-func-size { font: var(--md-sys-typescale-body-small); color: var(--md-sys-color-on-surface-variant); margin-left: auto; white-space: nowrap; }

/* ── Result Section ────────────────────────────────────── */
.result-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
.result-item {
  padding: 14px; background: var(--md-sys-color-surface-container-low);
  border-radius: var(--md-sys-shape-corner-xs); border: 1px solid var(--md-sys-color-outline-variant);
}
.result-item .rlabel {
  font: var(--md-sys-typescale-label-small); color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px;
}
.result-item .rvalue { font: 13px 'SF Mono', 'Fira Code', monospace; word-break: break-all; }
.result-item--success { border-color: var(--md-sys-color-success); background: color-mix(in srgb, var(--md-sys-color-success) 8%, transparent); }

/* ── No Credits Banner ─────────────────────────────────── */
.no-credits-banner {
  padding: var(--md-sp-2); margin-bottom: var(--md-sp-2);
  background: var(--md-sys-color-error-container); color: var(--md-sys-color-on-error-container);
  border-radius: var(--md-sys-shape-corner-md);
  display: flex; align-items: center; justify-content: space-between;
}

/* ── Badge Status ──────────────────────────────────────── */
.badge {
  display: inline-flex; padding: 2px 10px; border-radius: var(--md-sys-shape-corner-xs);
  font: var(--md-sys-typescale-label-small);
}
.badge--paid, .badge--active { background: var(--md-sys-color-success-container); color: var(--md-sys-color-on-success-container); }
.badge--pending { background: var(--md-sys-color-warning-container); color: var(--md-sys-color-on-warning-container); }
.badge--cancelled, .badge--banned { background: var(--md-sys-color-error-container); color: var(--md-sys-color-on-error-container); }
.badge--admin { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }

/* ── Table Order ───────────────────────────────────────── */
.order-table { width: 100%; border-collapse: collapse; }
.order-table th {
  text-align: left; padding: 12px 16px; font: var(--md-sys-typescale-label-large);
  color: var(--md-sys-color-on-surface-variant); border-bottom: 1px solid var(--md-sys-color-outline-variant);
}
.order-table td { padding: 12px 16px; border-bottom: 1px solid var(--md-sys-color-outline-variant); font: var(--md-sys-typescale-body-medium); }

/* ── Section Title ─────────────────────────────────────── */
.section-title { text-align: center; font: var(--md-sys-typescale-headline-large); margin-bottom: 8px; }
.section-subtitle {
  text-align: center; font: var(--md-sys-typescale-body-large);
  color: var(--md-sys-color-on-surface-variant); margin-bottom: var(--md-sp-6);
  max-width: 600px; margin-left: auto; margin-right: auto;
}

/* ── CTA Section ───────────────────────────────────────── */
.cta-section {
  text-align: center; padding: var(--md-sp-10) var(--md-sp-3);
  background: var(--md-sys-color-surface-container);
  border-radius: var(--md-sys-shape-corner-lg); margin: var(--md-sp-6) auto; max-width: 800px;
}

/* ── Footer ────────────────────────────────────────────── */
.footer {
  text-align: center; padding: var(--md-sp-4) var(--md-sp-3);
  color: var(--md-sys-color-on-surface-variant); font: var(--md-sys-typescale-body-small);
  border-top: 1px solid var(--md-sys-color-outline-variant); margin-top: var(--md-sp-8);
}

/* ── User Menu ─────────────────────────────────────────── */
.user-menu { position: relative; }
.user-dropdown {
  position: absolute; top: 100%; right: 0; min-width: 160px;
  background: var(--md-sys-color-surface-container);
  border-radius: var(--md-sys-shape-corner-xs); box-shadow: var(--md-sys-elevation-3);
  padding: 8px 0; display: none; z-index: 150;
}
.user-dropdown--open { display: block; }
.user-dropdown button {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  font: var(--md-sys-typescale-body-medium); color: var(--md-sys-color-on-surface);
  cursor: pointer; background: none; border: none; width: 100%; text-align: left;
}
.user-dropdown button:hover { background: color-mix(in srgb, var(--md-sys-color-primary) 8%, transparent); }

/* ── Config Form ───────────────────────────────────────── */
.config-form { display: grid; grid-template-columns: 1fr 1fr; gap: var(--md-sp-2); }

/* ── Material Icons ────────────────────────────────────── */
.material-icons {
  font-family: 'Material Icons';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  vertical-align: middle;
}
.material-icons.md-18 { font-size: 18px; }
.material-icons.md-20 { font-size: 20px; }
.material-icons.md-36 { font-size: 36px; }
.material-icons.md-48 { font-size: 48px; }

/* ── Payment Method Selector ───────────────────────────── */
.payment-methods {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--md-sp-2); margin-bottom: var(--md-sp-3);
}
.payment-method-card {
  display: flex; align-items: center; gap: 12px; padding: 16px 20px;
  background: var(--md-sys-color-surface-container-low);
  border: 2px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-md);
  cursor: pointer; transition: all var(--md-sys-motion-short) var(--md-sys-motion-easing-standard);
}
.payment-method-card:hover {
  background: var(--md-sys-color-surface-container);
  border-color: var(--md-sys-color-outline);
}
.payment-method-card--active {
  border-color: var(--md-sys-color-primary);
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}
.payment-method-card__icon {
  width: 40px; height: 40px; border-radius: var(--md-sys-shape-corner-sm);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.payment-method-card__icon--alipay {
  background: #1677FF; color: #fff;
}
.payment-method-card__icon--wechat {
  background: #07C160; color: #fff;
}
.payment-method-card__label {
  font: var(--md-sys-typescale-title-small);
}
.payment-method-card__badge {
  margin-left: auto; padding: 2px 8px; border-radius: var(--md-sys-shape-corner-full);
  font: var(--md-sys-typescale-label-small);
  background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary);
}

/* ── Brand Typography ──────────────────────────────────── */
.brand-logo {
  font: 600 22px/28px 'Google Sans', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--md-sys-color-primary), var(--md-sys-color-tertiary));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.brand-logo--sm { font-size: 18px; }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 1024px) {
  .md3-grid-3, .md3-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  /* Hide sidebar, show bottom nav */
  .md3-nav-rail { display: none; }
  .md3-layout__nav { display: none; }
  .md3-layout__content { margin-left: 0; padding: var(--md-sp-2); padding-bottom: 88px; }
  .md3-bottom-nav { display: flex; }
  .main-content { margin-left: 0 !important; padding: var(--md-sp-2) !important; padding-bottom: 88px !important; }

  /* Single column grids */
  .md3-grid-2, .md3-grid-3, .md3-grid-4 { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr; }
  .file-info__details { grid-template-columns: 1fr; }
  .config-form { grid-template-columns: 1fr; }
  .dashboard-stats { grid-template-columns: repeat(2, 1fr); }

  /* Hero */
  .hero { padding: var(--md-sp-6) var(--md-sp-2); }
  .hero__title { font: var(--md-sys-typescale-headline-large); }
  .hero__actions { flex-direction: column; }
  .features { padding: var(--md-sp-4) var(--md-sp-2); }
  .pricing-grid { padding: var(--md-sp-4) var(--md-sp-2); }

  /* Auth */
  .auth-card { padding: var(--md-sp-3); }
  .auth-back { top: var(--md-sp-2); left: var(--md-sp-2); }

  /* FAB on mobile */
  .md3-fab { bottom: 88px; }
}

@media (max-width: 480px) {
  .dashboard-stats { grid-template-columns: 1fr; }
  .hero__actions { flex-direction: column; }
  .md3-bottom-nav__item { padding: 8px 4px; min-width: 48px; }
  .md3-bottom-nav { padding: 0 4px; }
}

/* ── Print styles ──────────────────────────────────────── */
@media print {
  .md3-nav-rail, .md3-bottom-nav, .md3-fab, .md3-drawer-overlay { display: none !important; }
  .md3-layout__content { margin-left: 0 !important; padding: 0 !important; }
  body { background: white; color: black; }
  .md3-card { box-shadow: none; border: 1px solid #ccc; }
}