@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* ========================================================================
     Typography Tokens
     ======================================================================== */
  --font-mono: 'JetBrains Mono', monospace;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;

  /* ========================================================================
     Color Palette & RGB Tuples (for rgba opacity math)
     ======================================================================== */
  --color-bg: #1e1e1e;
  --color-bg-rgb: 30, 30, 30;
  --color-bg-deep: #121212;

  --color-surface: #252525;
  --color-surface-rgb: 37, 37, 37;
  --color-surface-soft: #2d2d2d;
  --color-border: #333333;
  --color-border-hover: #444444;

  --color-accent: #ffffff;
  --color-accent-rgb: 255, 255, 255;
  --color-accent-dim: #858585;

  --color-primary: #a582ff;
  --color-primary-rgb: 165, 130, 255;

  --color-text-primary: #dcdcdc;
  --color-text-secondary: #858585;
  --color-text-disabled: #555555;

  /* Aliases for component compatibility */
  --color-text: var(--color-text-primary);
  --color-text-dim: var(--color-text-secondary);

  --color-error: #f48771;
  --color-error-rgb: 244, 135, 113;

  --color-success: #81b88b;
  --color-success-rgb: 129, 184, 139;

  --color-warning: #e2c08d;
  --color-warning-rgb: 226, 192, 141;

  /* ========================================================================
     Curves & Spacing
     ======================================================================== */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 12px;
  --spacing-unit: 8px;
  --spacing-sm: 12px;
  --spacing-std: 20px;
  --spacing-lg: 32px;

  /* ========================================================================
     Animation Transitions
     ======================================================================== */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  --transition-slow: 0.6s cubic-bezier(0.22, 1, 0.36, 1);

  /* Typography Scale */
  --font-size-base: 13px;
  --font-size-header: 24px;
  --font-size-small: 11px;

  /* Layout constraints */
  --sidebar-width: 240px;
  --header-height: 64px;
}

@media (max-width: 768px) {
  :root {
    --font-size-base: 12px;
    --font-size-header: 20px;
    --font-size-small: 10px;
  }
}

/* ==========================================================================
   Global Reset & Base Box Model
   ========================================================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: var(--font-size-base);
  scrollbar-gutter: stable;
}

body {
  font-family: var(--font-mono);
  background-color: var(--color-bg);
  color: var(--color-text-primary);
  min-height: 100dvh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

#root {
  width: 100%;
}

/* ==========================================================================
   Global Stage Recession Architecture (Modals, Sheets, Toast Decks)
   ========================================================================== */

#root,
#storybook-root,
.sheet-recede-target {
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              filter 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              border-radius 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: center top;
}

body.has-modal #root,
body.has-modal #storybook-root,
body.has-modal .sheet-recede-target {
  transform: scale(0.97) translateY(-6px) !important;
  filter: brightness(0.82) blur(3px) !important;
  border-radius: 16px !important;
  box-shadow: none !important;
  pointer-events: none !important;
  overflow: hidden !important;
}

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

/* Typography Scale */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-mono);
  color: var(--color-text-primary);
  letter-spacing: -0.01em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

p {
  color: var(--color-text-secondary);
  margin-bottom: 1rem;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: var(--transition-fast);
}

a:hover {
  opacity: 0.8;
}

/* ==========================================================================
   Core Utility Classes
   ========================================================================== */

.mono {
  font-family: var(--font-mono);
}

.bold,
.font-bold {
  font-weight: 700;
}

.text-primary { color: var(--color-text-primary); }

.text-secondary { color: var(--color-text-secondary); }

.text-dim { color: var(--color-text-dim); }

.text-disabled { color: var(--color-text-disabled); }

.text-accent { color: var(--color-accent); }

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

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

.text-warning { color: var(--color-warning); }

.text-xxs { font-size: 9.5px; }

.text-xs { font-size: 11px; }

.text-sm { font-size: 12px; }

.text-base { font-size: 13px; }

.text-center { text-align: center; }

.text-right { text-align: right; }

.text-left { text-align: left; }

.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.flex { display: flex; }

.flex-col { display: flex; flex-direction: column; }

.items-center { align-items: center; }

.justify-center { justify-content: center; }

.justify-between { justify-content: space-between; }

.flex-center { display: flex; align-items: center; justify-content: center; }

.flex-wrap { flex-wrap: wrap; }

.flex-1 { flex: 1; }

.flex-shrink-0 { flex-shrink: 0; }

.gap-4 { gap: 4px; }

.gap-6 { gap: 6px; }

.gap-8 { gap: 8px; }

.gap-10 { gap: 10px; }

.gap-12 { gap: 12px; }

.gap-16 { gap: 16px; }

.dash-primary { color: #a582ff; opacity: 0.5; font-weight: 700; font-family: var(--font-mono); }

.dash-warning { color: var(--color-warning); opacity: 0.5; font-weight: 700; font-family: var(--font-mono); }

.dash-error   { color: var(--color-error); opacity: 0.5; font-weight: 700; font-family: var(--font-mono); }

.dash-accent  { color: #4cd3ff; opacity: 0.5; font-weight: 700; font-family: var(--font-mono); }

.dash-success { color: var(--color-success); opacity: 0.5; font-weight: 700; font-family: var(--font-mono); }

.dash-dim     { color: var(--color-text-dim); opacity: 0.5; font-weight: 700; font-family: var(--font-mono); }

.role-pa { color: #a0c4ff !important; border-color: rgba(160, 196, 255, 0.5) !important; --role-bg: rgba(160, 196, 255, 0.1); }

.role-mzs { color: #9bf6ff !important; border-color: rgba(155, 246, 255, 0.5) !important; --role-bg: rgba(155, 246, 255, 0.1); }

.role-gr { color: #90e0ef !important; border-color: rgba(144, 224, 239, 0.5) !important; --role-bg: rgba(144, 224, 239, 0.1); }

.role-high { color: #ffadad !important; border-color: rgba(255, 173, 173, 0.5) !important; --role-bg: rgba(255, 173, 173, 0.1); }

.role-mk { color: #c8b6ff !important; border-color: rgba(200, 182, 255, 0.5) !important; --role-bg: rgba(200, 182, 255, 0.1); }

.role-ok { color: #ade8f4 !important; border-color: rgba(173, 232, 244, 0.5) !important; --role-bg: rgba(173, 232, 244, 0.1); }

.role-general { color: var(--color-text-dim) !important; border-color: rgba(255, 255, 255, 0.15) !important; --role-bg: rgba(255, 255, 255, 0.05); }

.aura-row {
  position: relative;
  z-index: 1;
  transition: background 0.15s ease;
}

.aura-row:hover {
  background: rgba(255, 255, 255, 0.02) !important;
}

.aura-card {
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.aura-hover {
  transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.aura-hover:hover {
  border-color: var(--color-border-hover);
  background: var(--color-surface-soft);
}

@media (max-width: 768px) {
  .hide-mobile {
    display: none !important;
  }
}

.page-layout {
  width: 100%;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 40px 20px;
}

.container-main {
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
}

.header-underlined {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 24px;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-border-hover);
}

.page-fade-in {
  animation: fadeIn var(--transition-smooth);
}

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

.spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}/* Global App Styles */
body {
  background: var(--color-bg);
  overflow-x: hidden;
}

#root,
#storybook-root {
  display: flex;
  width: 100%;
  min-height: 100vh;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              filter 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              border-radius 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: center top;
  background: var(--color-bg);
}

/* Subtle, gentle recession: slight scale (0.97), soft blur (3px), ZERO SHADOW */
body.has-modal #root,
body.has-modal #storybook-root {
  transform: scale(0.97) translateY(-6px);
  filter: brightness(0.82) blur(3px);
  border-radius: 16px;
  box-shadow: none !important;
  pointer-events: none;
  overflow: hidden;
}