@layer base {
  :root {
    --bg: #f8fafc;
    --card: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --muted: #64748b;
    --primary: #3b82f6;
    --primary-strong: #2563eb;
    --accent-blue: #3b82f6;
    --transition-fast: 140ms ease;
    --shadow-soft: 0 10px 28px rgba(15, 23, 42, 0.08);
    --shadow-elevated: 0 16px 36px rgba(15, 23, 42, 0.12);
    --danger: #dc2626;
    --ok: #16a34a;
    --warn: #d97706;
    --space-1: 8px;
    --space-2: 12px;
    --space-3: 16px;
    --space-4: 20px;
    --ease-out: cubic-bezier(0.33, 1, 0.68, 1);
    --dur-fast: 150ms;
    --instant-ease: cubic-bezier(0.25, 0.9, 0.35, 1);
    --instant-ms: 100ms;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 6px 18px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 10px 28px rgba(15, 23, 42, 0.12);
    --color-success: #16a34a;
    --color-warning: #d97706;
    --color-danger: #dc2626;
    --color-primary: #3b82f6;
    --color-muted: #64748b;
    --input-height: 34px;
    --font-ui: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-main: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    /* Typography scale (base — storefront / legacy) */
    --fs-2xs: 11px;
    --fs-xs: 12px;
    --fs-sm: 13px;
    --fs-md: 14px;
    --fs-lg: 16px;
    --fs-xl: 18px;
    --fs-2xl: 22px;
    --lh-tight: 1.2;
    --lh-normal: 1.45;
    --lh-table-dense: 1.35;
    --text-xs: var(--fs-xs);
    --text-sm: var(--fs-sm);
    --text-md: var(--fs-md);
    --text-lg: var(--fs-lg);
    --text-title: var(--fs-2xl);
    --ui-radius: var(--radius-md);
    --ui-shadow-soft: var(--shadow-sm);
    --ui-shadow-hover: 0 10px 28px rgba(15, 23, 42, 0.1);
    --ui-border: #e2e8f0;
    --ui-text: #0f172a;
    --ui-muted: var(--color-muted);
    --ui-focus: #3b82f6;
    --btn-height-xs: 24px;
    --btn-height-sm: 30px;
    --btn-height: 34px;
    --btn-height-lg: 40px;
    --btn-px-xs: 7px;
    --btn-px-sm: 10px;
    --btn-px: 12px;
    --btn-px-lg: 14px;
    --control-height: var(--input-height);
    --control-height-lg: 40px;
    --control-padding-x: 10px;
    --control-padding-y: 6px;
    --control-font-size: var(--text-sm);
    --panel-padding-sm: 10px;
    --panel-padding: 12px;
    --panel-padding-lg: 16px;
    --panel-radius: var(--radius-md);
    --panel-border: #e2e8f0;
    --panel-shadow: var(--shadow-sm);
    --toolbar-height: 40px;
    --sidebar-width: 260px;
    --content-max: 1520px;
    --panel-radius-premium: 22px;
    --panel-border-premium: rgba(205, 214, 228, 0.72);
    --panel-shadow-premium: 0 1px 2px rgba(15, 23, 42, 0.03), 0 12px 28px rgba(15, 23, 42, 0.04);
    --app-bg: #e8eef6;
    --app-bg-soft: #f3f7fb;
    --app-bg-gradient: linear-gradient(180deg, #eaf0f7 0%, #dfe8f3 46%, #edf3f9 100%);
    --surface: rgba(255, 255, 255, 0.88);
    --panel-bg: rgba(255, 255, 255, 0.88);
    --shell-bg: rgba(255, 255, 255, 0.72);
    --shell-border: rgba(148, 163, 184, 0.24);
    --shell-shadow: 0 14px 34px rgba(15, 23, 42, 0.06);
    --table-shell-radius: 24px;
    --table-row-height: 48px;
    --table-header-height: 44px;
    --table-cell-padding-x: 12px;
    --table-cell-padding-y: 10px;
    --modal-overlay: rgba(15, 23, 42, 0.45);
    --modal-radius: 20px;
    --modal-shadow: 0 10px 40px rgba(15, 23, 42, 0.12);
    --modal-border: #e2e8f0;
    --modal-pad: 28px;
    --modal-pad-sm: 20px;
    --control-radius: 12px;
    --control-border: #cbd5e1;
    --control-placeholder: #94a3b8;
    --control-text: #0f172a;
  }

  body {
    margin: 0;
    height: 100%;
    background: var(--bg);
    color: var(--text);
    scroll-behavior: smooth;
    overflow: hidden;
    font-size: var(--text-md);
    line-height: 1.45;
  }

  /* Admin premium design system (not dark mode; storefront unchanged) */
  body.use-new-ui {
    /* Spacing scale */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-7: 32px;
    /* Radius */
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --ui-radius: var(--radius-md);
    --panel-radius: var(--radius-md);
    --panel-radius-premium: var(--radius-xl);
    --table-shell-radius: var(--radius-xl);
    --control-radius: var(--radius-md);
    --modal-radius: var(--radius-xl);
    /* Motion — ease-out only */
    --dur-instant: 120ms;
    --dur-fast: 180ms;
    --dur-base: 240ms;
    --transition-fast: var(--dur-instant) var(--ease-out);
    --instant-ms: var(--dur-instant);
    --motion-fast: var(--dur-instant);
    --motion-base: var(--dur-fast);
    --motion-slow: var(--dur-base);
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 6px 18px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 14px 36px rgba(15, 23, 42, 0.09), 0 4px 12px rgba(15, 23, 42, 0.04);
    --shadow-card-hover: 0 16px 40px rgba(15, 23, 42, 0.1);
    --shadow-soft: var(--shadow-md);
    --shadow-elevated: var(--shadow-lg);
    --elevation-1: var(--shadow-sm);
    --elevation-2: var(--shadow-md);
    --elevation-3: var(--shadow-lg);
    --ui-shadow-soft: var(--shadow-sm);
    --ui-shadow-hover: var(--shadow-md);
    --panel-shadow: var(--shadow-sm);
    --panel-shadow-premium: var(--shadow-md);
    --surface-blur: blur(10px);
    --modal-shadow: var(--shadow-lg);
    /* Borders */
    --border-subtle: rgba(148, 163, 184, 0.14);
    --border-default: rgba(148, 163, 184, 0.18);
    --border-strong: rgba(148, 163, 184, 0.22);
    --ui-border: var(--border-default);
    --panel-border: var(--border-subtle);
    --panel-border-premium: var(--border-subtle);
    --modal-border: var(--border-subtle);
    /* Surfaces & workspace canvas */
    --app-bg: #e4ebf3;
    --app-bg-soft: #dbe4ee;
    --app-bg-gradient: linear-gradient(180deg, #e3eaf3 0%, #dfe7f1 100%);
    --workspace-bg:
      radial-gradient(circle at 50% -8%, rgba(255, 255, 255, 0.45), transparent 42%),
      linear-gradient(180deg, #e4ebf3 0%, #dbe4ee 100%);
    --surface-base: rgba(255, 255, 255, 0.88);
    --surface-elevated: rgba(255, 255, 255, 0.94);
    --surface-table: rgba(248, 250, 252, 0.82);
    --surface-modal: #ffffff;
    --surface: var(--surface-base);
    --panel-bg: var(--surface-base);
    --topbar-bg: rgba(255, 255, 255, 0.72);
    --topbar-blur: blur(12px);
    --table-row-hover: rgba(59, 130, 246, 0.045);
    --table-row-selected: rgba(59, 130, 246, 0.08);
    /* Brand */
    --hydra-navy: #0f172a;
    --hydra-slate: #475569;
    --hydra-accent: #3b82f6;
    --hydra-accent-soft: rgba(59, 130, 246, 0.1);
    --hydra-gold: #d97706;
    --hydra-gold-soft: rgba(217, 119, 6, 0.12);
    /* Typography — unified 2-tier admin scale */
    --type-admin-base: 16px;
    --type-admin-label: 14px;
    --type-admin-value: 18px;
    --fs-2xs: var(--type-admin-label);
    --fs-xs: var(--type-admin-label);
    --fs-sm: var(--type-admin-base);
    --fs-md: var(--type-admin-base);
    --fs-lg: 17px;
    --fs-xl: 20px;
    --fs-2xl: 24px;
    --text-xs: var(--fs-xs);
    --text-sm: var(--fs-sm);
    --text-md: var(--fs-md);
    --text-lg: var(--fs-lg);
    --text-title: var(--fs-2xl);
    --control-font-size: var(--type-admin-base);
    --type-section-title: 20px;
    --type-kpi-label: var(--type-admin-label);
    --type-kpi-value: 22px;
    --type-kpi-value-sm: var(--type-admin-value);
    --type-kpi-meta: var(--type-admin-label);
    --type-table-head: var(--type-admin-label);
    --type-table-cell: var(--type-admin-base);
    --type-chip: var(--type-admin-base);
    --type-btn-compact: var(--type-admin-base);
    --type-sidebar-menu: var(--type-admin-base);
    --type-sidebar-clock: 44px;
    --type-sidebar-meta: var(--type-admin-label);
    --type-topbar-title: 24px;
    --type-topbar-search: var(--type-admin-base);
    --type-modal-label: var(--type-admin-label);
    --type-modal-input: var(--type-admin-base);
    --type-modal-section: 17px;
    --hydra-kpi-title: var(--type-admin-label);
    --hydra-kpi-value: var(--type-admin-value);
    --table-row-height: 48px;
    --table-header-height: 44px;
    --table-cell-padding-x: 12px;
    --table-cell-padding-y: 10px;
    --panel-padding-sm: var(--space-3);
    --panel-padding: var(--space-4);
    --panel-padding-lg: var(--space-5);
    --admin-content-max: 1680px;
    --admin-gutter: 28px;
    --content-max: none;
    --bg: var(--app-bg-soft);
    --card: #ffffff;
    --text: #0f172a;
    --text-primary: #0f172a;
    --text-secondary: #5f6b7c;
    --text-muted: #7b8797;
    --muted: var(--text-muted);
    --ui-text: var(--text-primary);
    --ui-muted: var(--text-secondary);
    --color-muted: var(--text-muted);
  }

  @media (min-width: 1600px) {
    body.use-new-ui {
      --admin-content-max: 1720px;
      --content-max: 1720px;
    }
  }

  body.dark {
    --bg: #0f172a;
    --card: #111827;
    --border: #334155;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --ui-border: #475569;
    --ui-text: #e5e7eb;
    --panel-border: #334155;
    --control-border: #475569;
    --control-text: #e5e7eb;
    --control-placeholder: #94a3b8;
  }
}
