/*
 * DataAstra Design Token System — Three-layer architecture
 * Layer 1: --prim-*    (raw values, palette)
 * Layer 2: --color-*   (semantic mappings, per-theme)
 * Layer 3: --comp-*    (component-level tokens)
 *
 * Themes applied via:  <html data-theme="dark|mid|light">
 * DEFAULT: dark  (deep-space navy, 13px base, terminal-dense)
 */

/* ==========================================================================
   LAYER 1: Primitive tokens (raw palette — never use directly in components)
   ========================================================================== */

:root {
  /* Brand */
  --prim-gold-500:    #f0a500;
  --prim-gold-400:    #f5bb33;
  --prim-gold-300:    #f8cc66;
  --prim-gold-600:    #c88700;

  /* Navy (dark backgrounds) */
  --prim-navy-950:    #050810;
  --prim-navy-900:    #0a0f1e;
  --prim-navy-800:    #0d1428;
  --prim-navy-700:    #141d34;
  --prim-navy-600:    #1c2845;
  --prim-navy-500:    #253356;
  --prim-navy-400:    #2e3f6a;

  /* Neutral */
  --prim-neutral-950: #0c0e14;
  --prim-neutral-900: #161a26;
  --prim-neutral-800: #1e2336;
  --prim-neutral-700: #2a304a;
  --prim-neutral-600: #3a425e;
  --prim-neutral-500: #525c7a;
  --prim-neutral-400: #6e7a9a;
  --prim-neutral-300: #8c98b8;
  --prim-neutral-200: #b0bbcf;
  --prim-neutral-100: #d4dae8;
  --prim-neutral-50:  #f4f6fc;

  /* Status */
  --prim-green-500:   #22c55e;
  --prim-green-400:   #4ade80;
  --prim-red-500:     #ef4444;
  --prim-red-400:     #f87171;
  --prim-amber-500:   #f59e0b;
  --prim-amber-400:   #fbbf24;
  --prim-blue-500:    #3b82f6;
  --prim-blue-400:    #60a5fa;

  /* AI / Intelligence */
  --prim-purple-600:  #7c5cfc;
  --prim-purple-500:  #9b7dfd;
  --prim-purple-400:  #b9a0fe;

  /* Type families — canonical brand fonts */
  --font-display: 'Syne', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-body:    'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Absolute display type scale (density-theme independent) */
  --font-size-display-1: 48px;
  --font-size-display-2: 40px;
  --font-size-display-3: 32px;
  --font-size-display-4: 24px;

  /* Absolute body type scale */
  --font-size-body-lg:   16px;
  --font-size-body-md:   14px;
  --font-size-body-sm:   12px;

  /* Mono size */
  --font-size-mono:      13px;
}

/* ==========================================================================
   LAYER 2: Semantic tokens — DARK theme (default, data-theme="dark")
   Background: #050810 | Font: 13px | Density: terminal-dense
   ========================================================================== */

[data-theme="dark"],
:root {
  /* Backgrounds */
  --color-bg-base:          var(--prim-navy-950);
  --color-bg-surface:       var(--prim-navy-900);
  --color-bg-elevated:      var(--prim-navy-800);
  --color-bg-overlay:       var(--prim-navy-700);
  --color-bg-subtle:        var(--prim-navy-800);

  /* Sidebar / TopBar */
  --color-bg-sidebar:       var(--prim-navy-900);
  --color-bg-topbar:        var(--prim-navy-900);

  /* Interactive hover surface */
  --color-bg-hover:         rgba(255, 255, 255, 0.05);
  /* Elevated card surface (alias for --color-bg-elevated used by pilets) */
  --color-bg-card:          var(--prim-navy-800);

  /* Text */
  --color-text-primary:     var(--prim-neutral-50);
  --color-text-secondary:   var(--prim-neutral-300);
  --color-text-muted:       var(--prim-neutral-400);
  --color-text-disabled:    var(--prim-neutral-600);
  --color-text-inverse:     var(--prim-navy-950);

  /* Brand accent */
  --color-accent:           var(--prim-gold-500);
  --color-accent-hover:     var(--prim-gold-400);
  --color-accent-subtle:    rgba(240, 165, 0, 0.12);
  /* Alias used by pilets for active nav / subtle highlight */
  --color-accent-dim:       rgba(240, 165, 0, 0.12);

  /* AI / Intelligence marker */
  --color-ai:               var(--prim-purple-600);
  --color-ai-subtle:        rgba(124, 92, 252, 0.12);
  /* Alias used by observability / RCA panel */
  --color-ai-dim:           rgba(124, 92, 252, 0.08);

  /* Status */
  --color-success:          var(--prim-green-500);
  --color-warning:          var(--prim-amber-500);
  --color-error:            var(--prim-red-500);
  --color-info:             var(--prim-blue-500);

  /* DataAstra live / healthy status (teal-green distinct from success green) */
  --color-live:             #00e5a0;
  --color-live-dim:         rgba(0, 229, 160, 0.12);

  /* Warning alias (gold = truth signal = warning in DataAstra language) */
  --color-warn:             var(--prim-gold-500);
  --color-warn-dim:         rgba(240, 165, 0, 0.12);

  /* Error dim — translucent error tint for backgrounds */
  --color-error-dim:        rgba(239, 68, 68, 0.12);

  /* Interactive */
  --color-interactive:      var(--prim-gold-500);
  --color-interactive-hover: var(--prim-gold-400);
  --color-focus-ring:       var(--prim-gold-500);

  /* No-line rule: boundaries via bg shifts, not borders */
  --color-border:           transparent;
  --color-border-subtle:    rgba(255, 255, 255, 0.06);

  /* Typography scale */
  --font-size-base:         13px;
  --font-size-sm:           12px;
  --font-size-xs:           11px;
  --font-size-lg:           14px;
  --font-size-xl:           16px;
  --font-size-2xl:          20px;
  --font-size-3xl:          24px;
  --font-size-display:      32px;
}

/* ==========================================================================
   LAYER 2: Semantic tokens — MID theme (data-theme="mid")
   Background: #141d34 | Font: 14px | Density: daily-driver
   ========================================================================== */

[data-theme="mid"] {
  --color-bg-base:          var(--prim-navy-700);
  --color-bg-surface:       var(--prim-navy-800);
  --color-bg-elevated:      var(--prim-navy-600);
  --color-bg-overlay:       var(--prim-navy-500);
  --color-bg-subtle:        var(--prim-navy-600);
  --color-bg-sidebar:       var(--prim-navy-800);
  --color-bg-topbar:        var(--prim-navy-800);
  --color-bg-hover:         rgba(255, 255, 255, 0.06);
  --color-bg-card:          var(--prim-navy-600);

  --color-text-primary:     var(--prim-neutral-50);
  --color-text-secondary:   var(--prim-neutral-200);
  --color-text-muted:       var(--prim-neutral-300);
  --color-text-disabled:    var(--prim-neutral-500);
  --color-text-inverse:     var(--prim-navy-950);

  --color-accent:           var(--prim-gold-500);
  --color-accent-hover:     var(--prim-gold-400);
  --color-accent-subtle:    rgba(240, 165, 0, 0.14);
  --color-accent-dim:       rgba(240, 165, 0, 0.14);

  --color-ai:               var(--prim-purple-500);
  --color-ai-subtle:        rgba(155, 125, 253, 0.14);
  --color-ai-dim:           rgba(155, 125, 253, 0.10);

  --color-success:          var(--prim-green-400);
  --color-warning:          var(--prim-amber-400);
  --color-error:            var(--prim-red-400);
  --color-info:             var(--prim-blue-400);

  --color-live:             #00e5a0;
  --color-live-dim:         rgba(0, 229, 160, 0.14);
  --color-warn:             var(--prim-gold-400);
  --color-warn-dim:         rgba(240, 165, 0, 0.14);
  --color-error-dim:        rgba(248, 113, 113, 0.14);

  --color-interactive:      var(--prim-gold-500);
  --color-interactive-hover: var(--prim-gold-400);
  --color-focus-ring:       var(--prim-gold-500);

  --color-border:           transparent;
  --color-border-subtle:    rgba(255, 255, 255, 0.08);

  --font-size-base:         14px;
  --font-size-sm:           13px;
  --font-size-xs:           12px;
  --font-size-lg:           15px;
  --font-size-xl:           17px;
  --font-size-2xl:          21px;
  --font-size-3xl:          25px;
  --font-size-display:      34px;
}

/* ==========================================================================
   LAYER 2: Semantic tokens — LIGHT theme (data-theme="light")
   Background: #f4f6fc | Font: 15px | Density: executive/analyst
   ========================================================================== */

[data-theme="light"] {
  --color-bg-base:          var(--prim-neutral-50);
  --color-bg-surface:       #ffffff;
  --color-bg-elevated:      #ffffff;
  --color-bg-overlay:       var(--prim-neutral-100);
  --color-bg-subtle:        var(--prim-neutral-100);
  --color-bg-sidebar:       var(--prim-navy-800);
  --color-bg-topbar:        #ffffff;
  --color-bg-hover:         rgba(0, 0, 0, 0.04);
  --color-bg-card:          #ffffff;

  --color-text-primary:     var(--prim-navy-950);
  --color-text-secondary:   var(--prim-navy-700);
  --color-text-muted:       var(--prim-neutral-500);
  --color-text-disabled:    var(--prim-neutral-400);
  --color-text-inverse:     var(--prim-neutral-50);

  --color-accent:           var(--prim-gold-600);
  --color-accent-hover:     var(--prim-gold-500);
  --color-accent-subtle:    rgba(200, 135, 0, 0.10);
  /* WCAG-compliant gold for light theme — 5.5:1 contrast (approved in ux-designer-104) */
  --color-accent-dim:       rgba(138, 85, 0, 0.10);

  --color-ai:               var(--prim-purple-600);
  --color-ai-subtle:        rgba(124, 92, 252, 0.08);
  --color-ai-dim:           rgba(124, 92, 252, 0.06);

  --color-success:          #16a34a;
  --color-warning:          #d97706;
  --color-error:            #dc2626;
  --color-info:             #2563eb;

  --color-live:             #059669;
  --color-live-dim:         rgba(5, 150, 105, 0.10);
  --color-warn:             #8a5500;
  --color-warn-dim:         rgba(138, 85, 0, 0.10);
  --color-error-dim:        rgba(220, 38, 38, 0.10);

  --color-interactive:      var(--prim-gold-600);
  --color-interactive-hover: var(--prim-gold-500);
  --color-focus-ring:       var(--prim-gold-600);

  --color-border:           transparent;
  --color-border-subtle:    rgba(0, 0, 0, 0.08);

  --font-size-base:         15px;
  --font-size-sm:           14px;
  --font-size-xs:           13px;
  --font-size-lg:           16px;
  --font-size-xl:           18px;
  --font-size-2xl:          22px;
  --font-size-3xl:          28px;
  --font-size-display:      36px;
}

/* ==========================================================================
   LAYER 3: Component tokens (shared across all themes)
   ========================================================================== */

:root {
  /* Card surface — used by pilets for section cards.
     These are COMPUTED from Layer 2 tokens so they adapt to the active theme.
     We set them in :root as a fallback; each [data-theme] block above overrides
     --color-bg-elevated and --color-border-subtle which these alias. */
  --comp-card-bg:             var(--color-bg-elevated, #141d35);
  --comp-card-border:         var(--color-border-subtle, rgba(255, 255, 255, 0.06));

  /* Sidebar */
  --comp-sidebar-width:       220px;
  --comp-sidebar-collapsed:   56px;

  /* TopBar */
  --comp-topbar-height:       52px;

  /* -----------------------------------------------------------------------
     Layout grid dimensions — used by ShellLayout CSS Grid (T3-5)
     These are the authoritative values for the 5-zone shell layout.
     ----------------------------------------------------------------------- */
  --layout-topbar-height:          48px;
  --layout-sidebar-width:          200px;
  --layout-sidebar-width-collapsed: 64px;
  --layout-context-panel-width:    300px;
  --layout-statusbar-height:       32px;

  /* Spacing rhythm */
  --comp-spacing-page:        24px;
  --comp-spacing-section:     16px;
  --comp-spacing-item:        8px;

  /* Radius */
  --comp-radius-sm:           4px;
  --comp-radius-md:           6px;
  --comp-radius-lg:           8px;
  --comp-radius-xl:           12px;

  /* Z-index scale */
  --comp-z-sidebar:           100;
  --comp-z-topbar:            200;
  --comp-z-dropdown:          300;
  --comp-z-modal:             400;
  --comp-z-toast:             500;
  --comp-z-command:           600;
}

*, ::before, ::after {
  --tw-border-spacing-x:    0;
  --tw-border-spacing-y:    0;
  --tw-translate-x:    0;
  --tw-translate-y:    0;
  --tw-rotate:    0;
  --tw-skew-x:    0;
  --tw-skew-y:    0;
  --tw-scale-x:    1;
  --tw-scale-y:    1;
  --tw-pan-x:     ;
  --tw-pan-y:     ;
  --tw-pinch-zoom:     ;
  --tw-scroll-snap-strictness:    proximity;
  --tw-gradient-from-position:     ;
  --tw-gradient-via-position:     ;
  --tw-gradient-to-position:     ;
  --tw-ordinal:     ;
  --tw-slashed-zero:     ;
  --tw-numeric-figure:     ;
  --tw-numeric-spacing:     ;
  --tw-numeric-fraction:     ;
  --tw-ring-inset:     ;
  --tw-ring-offset-width:    0px;
  --tw-ring-offset-color:    #fff;
  --tw-ring-color:    rgb(59 130 246 / 0.5);
  --tw-ring-offset-shadow:    0 0 #0000;
  --tw-ring-shadow:    0 0 #0000;
  --tw-shadow:    0 0 #0000;
  --tw-shadow-colored:    0 0 #0000;
  --tw-blur:     ;
  --tw-brightness:     ;
  --tw-contrast:     ;
  --tw-grayscale:     ;
  --tw-hue-rotate:     ;
  --tw-invert:     ;
  --tw-saturate:     ;
  --tw-sepia:     ;
  --tw-drop-shadow:     ;
  --tw-backdrop-blur:     ;
  --tw-backdrop-brightness:     ;
  --tw-backdrop-contrast:     ;
  --tw-backdrop-grayscale:     ;
  --tw-backdrop-hue-rotate:     ;
  --tw-backdrop-invert:     ;
  --tw-backdrop-opacity:     ;
  --tw-backdrop-saturate:     ;
  --tw-backdrop-sepia:     ;
  --tw-contain-size:     ;
  --tw-contain-layout:     ;
  --tw-contain-paint:     ;
  --tw-contain-style:     ;
}

::backdrop {
  --tw-border-spacing-x:    0;
  --tw-border-spacing-y:    0;
  --tw-translate-x:    0;
  --tw-translate-y:    0;
  --tw-rotate:    0;
  --tw-skew-x:    0;
  --tw-skew-y:    0;
  --tw-scale-x:    1;
  --tw-scale-y:    1;
  --tw-pan-x:     ;
  --tw-pan-y:     ;
  --tw-pinch-zoom:     ;
  --tw-scroll-snap-strictness:    proximity;
  --tw-gradient-from-position:     ;
  --tw-gradient-via-position:     ;
  --tw-gradient-to-position:     ;
  --tw-ordinal:     ;
  --tw-slashed-zero:     ;
  --tw-numeric-figure:     ;
  --tw-numeric-spacing:     ;
  --tw-numeric-fraction:     ;
  --tw-ring-inset:     ;
  --tw-ring-offset-width:    0px;
  --tw-ring-offset-color:    #fff;
  --tw-ring-color:    rgb(59 130 246 / 0.5);
  --tw-ring-offset-shadow:    0 0 #0000;
  --tw-ring-shadow:    0 0 #0000;
  --tw-shadow:    0 0 #0000;
  --tw-shadow-colored:    0 0 #0000;
  --tw-blur:     ;
  --tw-brightness:     ;
  --tw-contrast:     ;
  --tw-grayscale:     ;
  --tw-hue-rotate:     ;
  --tw-invert:     ;
  --tw-saturate:     ;
  --tw-sepia:     ;
  --tw-drop-shadow:     ;
  --tw-backdrop-blur:     ;
  --tw-backdrop-brightness:     ;
  --tw-backdrop-contrast:     ;
  --tw-backdrop-grayscale:     ;
  --tw-backdrop-hue-rotate:     ;
  --tw-backdrop-invert:     ;
  --tw-backdrop-opacity:     ;
  --tw-backdrop-saturate:     ;
  --tw-backdrop-sepia:     ;
  --tw-contain-size:     ;
  --tw-contain-layout:     ;
  --tw-contain-paint:     ;
  --tw-contain-style:     ;
}

/*
 ! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com
 */

/*
1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
*/

*,
::before,
::after {
  box-sizing: border-box; /* 1 */
  border-width: 0; /* 2 */
  border-style: solid; /* 2 */
  border-color: #e5e7eb; /* 2 */
}

::before,
::after {
  --tw-content: '';
}

/*
1. Use a consistent sensible line-height in all browsers.
2. Prevent adjustments of font size after orientation changes in iOS.
3. Use a more readable tab size.
4. Use the user's configured `sans` font-family by default.
5. Use the user's configured `sans` font-feature-settings by default.
6. Use the user's configured `sans` font-variation-settings by default.
7. Disable tap highlights on iOS
*/

html,
:host {
  line-height: 1.5; /* 1 */
  -webkit-text-size-adjust: 100%; /* 2 */
  -moz-tab-size: 4; /* 3 */
  -o-tab-size: 4;
     tab-size: 4; /* 3 */
  font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; /* 4 */
  font-feature-settings: normal; /* 5 */
  font-variation-settings: normal; /* 6 */
  -webkit-tap-highlight-color: transparent; /* 7 */
}

/*
1. Remove the margin in all browsers.
2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.
*/

body {
  margin: 0; /* 1 */
  line-height: inherit; /* 2 */
}

/*
1. Add the correct height in Firefox.
2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)
3. Ensure horizontal rules are visible by default.
*/

hr {
  height: 0; /* 1 */
  color: inherit; /* 2 */
  border-top-width: 1px; /* 3 */
}

/*
Add the correct text decoration in Chrome, Edge, and Safari.
*/

abbr:where([title]) {
  -webkit-text-decoration: underline dotted;
          text-decoration: underline dotted;
}

/*
Remove the default font size and weight for headings.
*/

h1,
h2,
h3,
h4,
h5,
h6 {
  font-size: inherit;
  font-weight: inherit;
}

/*
Reset links to optimize for opt-in styling instead of opt-out.
*/

a {
  color: inherit;
  text-decoration: inherit;
}

/*
Add the correct font weight in Edge and Safari.
*/

b,
strong {
  font-weight: bolder;
}

/*
1. Use the user's configured `mono` font-family by default.
2. Use the user's configured `mono` font-feature-settings by default.
3. Use the user's configured `mono` font-variation-settings by default.
4. Correct the odd `em` font sizing in all browsers.
*/

code,
kbd,
samp,
pre {
  font-family: JetBrains Mono, monospace; /* 1 */
  font-feature-settings: normal; /* 2 */
  font-variation-settings: normal; /* 3 */
  font-size: 1em; /* 4 */
}

/*
Add the correct font size in all browsers.
*/

small {
  font-size: 80%;
}

/*
Prevent `sub` and `sup` elements from affecting the line height in all browsers.
*/

sub,
sup {
  font-size: 75%;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}

sub {
  bottom: -0.25em;
}

sup {
  top: -0.5em;
}

/*
1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)
2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)
3. Remove gaps between table borders by default.
*/

table {
  text-indent: 0; /* 1 */
  border-color: inherit; /* 2 */
  border-collapse: collapse; /* 3 */
}

/*
1. Change the font styles in all browsers.
2. Remove the margin in Firefox and Safari.
3. Remove default padding in all browsers.
*/

button,
input,
optgroup,
select,
textarea {
  font-family: inherit; /* 1 */
  font-feature-settings: inherit; /* 1 */
  font-variation-settings: inherit; /* 1 */
  font-size: 100%; /* 1 */
  font-weight: inherit; /* 1 */
  line-height: inherit; /* 1 */
  letter-spacing: inherit; /* 1 */
  color: inherit; /* 1 */
  margin: 0; /* 2 */
  padding: 0; /* 3 */
}

/*
Remove the inheritance of text transform in Edge and Firefox.
*/

button,
select {
  text-transform: none;
}

/*
1. Correct the inability to style clickable types in iOS and Safari.
2. Remove default button styles.
*/

button,
input:where([type='button']),
input:where([type='reset']),
input:where([type='submit']) {
  -webkit-appearance: button; /* 1 */
  background-color: transparent; /* 2 */
  background-image: none; /* 2 */
}

/*
Use the modern Firefox focus style for all focusable elements.
*/

:-moz-focusring {
  outline: auto;
}

/*
Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)
*/

:-moz-ui-invalid {
  box-shadow: none;
}

/*
Add the correct vertical alignment in Chrome and Firefox.
*/

progress {
  vertical-align: baseline;
}

/*
Correct the cursor style of increment and decrement buttons in Safari.
*/

::-webkit-inner-spin-button,
::-webkit-outer-spin-button {
  height: auto;
}

/*
1. Correct the odd appearance in Chrome and Safari.
2. Correct the outline style in Safari.
*/

[type='search'] {
  -webkit-appearance: textfield; /* 1 */
  outline-offset: -2px; /* 2 */
}

/*
Remove the inner padding in Chrome and Safari on macOS.
*/

::-webkit-search-decoration {
  -webkit-appearance: none;
}

/*
1. Correct the inability to style clickable types in iOS and Safari.
2. Change font properties to `inherit` in Safari.
*/

::-webkit-file-upload-button {
  -webkit-appearance: button; /* 1 */
  font: inherit; /* 2 */
}

/*
Add the correct display in Chrome and Safari.
*/

summary {
  display: list-item;
}

/*
Removes the default spacing and border for appropriate elements.
*/

blockquote,
dl,
dd,
h1,
h2,
h3,
h4,
h5,
h6,
hr,
figure,
p,
pre {
  margin: 0;
}

fieldset {
  margin: 0;
  padding: 0;
}

legend {
  padding: 0;
}

ol,
ul,
menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

/*
Reset default styling for dialogs.
*/

dialog {
  padding: 0;
}

/*
Prevent resizing textareas horizontally by default.
*/

textarea {
  resize: vertical;
}

/*
1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)
2. Set the default placeholder color to the user's configured gray 400 color.
*/

input::-moz-placeholder, textarea::-moz-placeholder {
  opacity: 1; /* 1 */
  color: #9ca3af; /* 2 */
}

input::placeholder,
textarea::placeholder {
  opacity: 1; /* 1 */
  color: #9ca3af; /* 2 */
}

/*
Set the default cursor for buttons.
*/

button,
[role="button"] {
  cursor: pointer;
}

/*
Make sure disabled buttons don't get the pointer cursor.
*/

:disabled {
  cursor: default;
}

/*
1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)
2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)
   This can trigger a poorly considered lint error in some tools but is included by design.
*/

img,
svg,
video,
canvas,
audio,
iframe,
embed,
object {
  display: block; /* 1 */
  vertical-align: middle; /* 2 */
}

/*
Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)
*/

img,
video {
  max-width: 100%;
  height: auto;
}

/* Make elements with the HTML hidden attribute stay hidden by default */

[hidden]:where(:not([hidden="until-found"])) {
  display: none;
}

.\!container {
  width:    100% !important;
}

.container {
  width:    100%;
}

@media (min-width: 640px) {

  .\!container {
    max-width:    640px !important;
  }

  .container {
    max-width:    640px;
  }
}

@media (min-width: 768px) {

  .\!container {
    max-width:    768px !important;
  }

  .container {
    max-width:    768px;
  }
}

@media (min-width: 1024px) {

  .\!container {
    max-width:    1024px !important;
  }

  .container {
    max-width:    1024px;
  }
}

@media (min-width: 1280px) {

  .\!container {
    max-width:    1280px !important;
  }

  .container {
    max-width:    1280px;
  }
}

@media (min-width: 1536px) {

  .\!container {
    max-width:    1536px !important;
  }

  .container {
    max-width:    1536px;
  }
}

.\!visible {
  visibility:    visible !important;
}

.visible {
  visibility:    visible;
}

.invisible {
  visibility:    hidden;
}

.collapse {
  visibility:    collapse;
}

.static {
  position:    static;
}

.fixed {
  position:    fixed;
}

.absolute {
  position:    absolute;
}

.relative {
  position:    relative;
}

.sticky {
  position:    sticky;
}

.m-0 {
  margin:    0px;
}

.mt-0\.5 {
  margin-top:    0.125rem;
}

.mt-1\.5 {
  margin-top:    0.375rem;
}

.block {
  display:    block;
}

.inline-block {
  display:    inline-block;
}

.inline {
  display:    inline;
}

.flex {
  display:    flex;
}

.inline-flex {
  display:    inline-flex;
}

.table {
  display:    table;
}

.grid {
  display:    grid;
}

.hidden {
  display:    none;
}

.h-1 {
  height:    0.25rem;
}

.h-1\.5 {
  height:    0.375rem;
}

.h-10 {
  height:    2.5rem;
}

.h-11 {
  height:    2.75rem;
}

.h-12 {
  height:    3rem;
}

.h-2 {
  height:    0.5rem;
}

.h-2\.5 {
  height:    0.625rem;
}

.h-3\.5 {
  height:    0.875rem;
}

.h-4 {
  height:    1rem;
}

.h-6 {
  height:    1.5rem;
}

.h-7 {
  height:    1.75rem;
}

.h-8 {
  height:    2rem;
}

.h-9 {
  height:    2.25rem;
}

.h-full {
  height:    100%;
}

.w-1\.5 {
  width:    0.375rem;
}

.w-10 {
  width:    2.5rem;
}

.w-12 {
  width:    3rem;
}

.w-2 {
  width:    0.5rem;
}

.w-2\.5 {
  width:    0.625rem;
}

.w-20 {
  width:    5rem;
}

.w-3\.5 {
  width:    0.875rem;
}

.w-4 {
  width:    1rem;
}

.w-6 {
  width:    1.5rem;
}

.w-8 {
  width:    2rem;
}

.w-9 {
  width:    2.25rem;
}

.w-full {
  width:    100%;
}

.min-w-0 {
  min-width:    0px;
}

.min-w-\[28px\] {
  min-width:    28px;
}

.flex-1 {
  flex:    1 1 0%;
}

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

.grow {
  flex-grow:    1;
}

.border-collapse {
  border-collapse:    collapse;
}

.transform {
  transform:    translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
}

.animate-\[dotPulse_2s_infinite\] {
  animation:    dotPulse 2s infinite;
}

@keyframes spin {

  to {
    transform:    rotate(360deg);
  }
}

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

.cursor-pointer {
  cursor:    pointer;
}

.select-none {
  -webkit-user-select:    none;
     -moz-user-select:    none;
          user-select:    none;
}

.resize {
  resize:    both;
}

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

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

.items-start {
  align-items:    flex-start;
}

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

.justify-end {
  justify-content:    flex-end;
}

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

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

.gap-1 {
  gap:    0.25rem;
}

.gap-1\.5 {
  gap:    0.375rem;
}

.gap-2 {
  gap:    0.5rem;
}

.gap-3 {
  gap:    0.75rem;
}

.overflow-auto {
  overflow:    auto;
}

.overflow-hidden {
  overflow:    hidden;
}

.overflow-x-auto {
  overflow-x:    auto;
}

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

.whitespace-nowrap {
  white-space:    nowrap;
}

.break-all {
  word-break:    break-all;
}

.rounded {
  border-radius:    0.25rem;
}

.rounded-full {
  border-radius:    9999px;
}

.rounded-lg {
  border-radius:    0.5rem;
}

.rounded-sm {
  border-radius:    0.125rem;
}

.border {
  border-width:    1px;
}

.border-2 {
  border-width:    2px;
}

.border-\[1\.5px\] {
  border-width:    1.5px;
}

.border-b {
  border-bottom-width:    1px;
}

.border-l-2 {
  border-left-width:    2px;
}

.border-t {
  border-top-width:    1px;
}

.border-current {
  border-color:    currentColor;
}

.border-t-transparent {
  border-top-color:    transparent;
}

.bg-transparent {
  background-color:    transparent;
}

.object-cover {
  -o-object-fit:    cover;
     object-fit:    cover;
}

.p-0\.5 {
  padding:    0.125rem;
}

.p-5 {
  padding:    1.25rem;
}

.px-1\.5 {
  padding-left:    0.375rem;
  padding-right:    0.375rem;
}

.px-2 {
  padding-left:    0.5rem;
  padding-right:    0.5rem;
}

.px-3 {
  padding-left:    0.75rem;
  padding-right:    0.75rem;
}

.px-4 {
  padding-left:    1rem;
  padding-right:    1rem;
}

.px-5 {
  padding-left:    1.25rem;
  padding-right:    1.25rem;
}

.px-6 {
  padding-left:    1.5rem;
  padding-right:    1.5rem;
}

.py-0\.5 {
  padding-top:    0.125rem;
  padding-bottom:    0.125rem;
}

.py-1 {
  padding-top:    0.25rem;
  padding-bottom:    0.25rem;
}

.py-12 {
  padding-top:    3rem;
  padding-bottom:    3rem;
}

.py-2\.5 {
  padding-top:    0.625rem;
  padding-bottom:    0.625rem;
}

.py-3 {
  padding-top:    0.75rem;
  padding-bottom:    0.75rem;
}

.py-4 {
  padding-top:    1rem;
  padding-bottom:    1rem;
}

.pr-4 {
  padding-right:    1rem;
}

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

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

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

.font-mono {
  font-family:    JetBrains Mono, monospace;
}

.text-2xl {
  font-size:    1.5rem;
  line-height:    2rem;
}

.text-\[10px\] {
  font-size:    10px;
}

.text-\[8px\] {
  font-size:    8px;
}

.text-base {
  font-size:    1rem;
  line-height:    1.5rem;
}

.text-sm {
  font-size:    0.875rem;
  line-height:    1.25rem;
}

.text-xs {
  font-size:    0.75rem;
  line-height:    1rem;
}

.font-medium {
  font-weight:    500;
}

.font-normal {
  font-weight:    400;
}

.font-semibold {
  font-weight:    600;
}

.uppercase {
  text-transform:    uppercase;
}

.lowercase {
  text-transform:    lowercase;
}

.capitalize {
  text-transform:    capitalize;
}

.italic {
  font-style:    italic;
}

.leading-none {
  line-height:    1;
}

.leading-relaxed {
  line-height:    1.625;
}

.leading-snug {
  line-height:    1.375;
}

.underline {
  text-decoration-line:    underline;
}

.line-through {
  text-decoration-line:    line-through;
}

.opacity-0 {
  opacity:    0;
}

.opacity-80 {
  opacity:    0.8;
}

.shadow {
  --tw-shadow:    0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --tw-shadow-colored:    0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);
  box-shadow:    var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
}

.outline {
  outline-style:    solid;
}

.ring {
  --tw-ring-offset-shadow:    var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
  --tw-ring-shadow:    var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);
  box-shadow:    var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
}

.ring-2 {
  --tw-ring-offset-shadow:    var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
  --tw-ring-shadow:    var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);
  box-shadow:    var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
}

.ring-offset-2 {
  --tw-ring-offset-width:    2px;
}

.blur {
  --tw-blur:    blur(8px);
  filter:    var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
}

.filter {
  filter:    var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
}

.backdrop-blur {
  --tw-backdrop-blur:    blur(8px);
  backdrop-filter:    var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
}

.transition {
  transition-property:    color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
  transition-timing-function:    cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration:    150ms;
}

.transition-all {
  transition-property:    all;
  transition-timing-function:    cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration:    150ms;
}

.transition-colors {
  transition-property:    color, background-color, border-color, text-decoration-color, fill, stroke;
  transition-timing-function:    cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration:    150ms;
}

.transition-opacity {
  transition-property:    opacity;
  transition-timing-function:    cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration:    150ms;
}

.duration-100 {
  transition-duration:    100ms;
}

.duration-150 {
  transition-duration:    150ms;
}

.duration-500 {
  transition-duration:    500ms;
}

.ease-in-out {
  transition-timing-function:    cubic-bezier(0.4, 0, 0.2, 1);
}

.ease-out {
  transition-timing-function:    cubic-bezier(0, 0, 0.2, 1);
}

.\[backdrop-filter\:blur\(var\(--blur-card\)\)\] {
  backdrop-filter:    blur(var(--blur-card));
}

.\[background\:var\(--comp-btn-primary-bg\)\] {
  background:    var(--comp-btn-primary-bg);
}

.\[background\:var\(--comp-card-bg-glass\)\] {
  background:    var(--comp-card-bg-glass);
}

.\[background\:var\(--comp-input-bg\)\] {
  background:    var(--comp-input-bg);
}

.\[border-color\:var\(--color-error\)\] {
  border-color:    var(--color-error);
}

.\[border-left-color\:var\(--color-error\)\] {
  border-left-color:    var(--color-error);
}

.\[border-left-color\:var\(--color-warn\)\] {
  border-left-color:    var(--color-warn);
}

.\[border-left-color\:var\(--comp-card-accent-bar-ai\)\] {
  border-left-color:    var(--comp-card-accent-bar-ai);
}

.\[border-left-color\:var\(--comp-card-accent-bar-color\)\] {
  border-left-color:    var(--comp-card-accent-bar-color);
}

.\[border-left-color\:var\(--comp-card-accent-bar-error\)\] {
  border-left-color:    var(--comp-card-accent-bar-error);
}

.\[border-left-color\:var\(--comp-card-accent-bar-info\)\] {
  border-left-color:    var(--comp-card-accent-bar-info);
}

.\[border-left-color\:var\(--comp-card-accent-bar-live\)\] {
  border-left-color:    var(--comp-card-accent-bar-live);
}

.\[border-left-color\:var\(--comp-card-accent-bar-warn\)\] {
  border-left-color:    var(--comp-card-accent-bar-warn);
}

.\[border-left-width\:var\(--comp-card-accent-bar\)\] {
  border-left-width:    var(--comp-card-accent-bar);
}

.\[border-left\:2px_solid_var\(--color-accent\)\] {
  border-left:    2px solid var(--color-accent);
}

.\[box-shadow\:var\(--comp-btn-primary-shadow\)\] {
  box-shadow:    var(--comp-btn-primary-shadow);
}

.\[box-shadow\:var\(--comp-card-shadow\)\] {
  box-shadow:    var(--comp-card-shadow);
}

.\[box-shadow\:var\(--prim-shadow-glow-md\)\] {
  box-shadow:    var(--prim-shadow-glow-md);
}

.\[letter-spacing\:-0\.01em\] {
  letter-spacing:    -0.01em;
}

.\[letter-spacing\:0\.04em\] {
  letter-spacing:    0.04em;
}

.\[letter-spacing\:0\.06em\] {
  letter-spacing:    0.06em;
}

.\[letter-spacing\:0\.12em\] {
  letter-spacing:    0.12em;
}

/* ==========================================================================
   Base reset and global styles
   ========================================================================== */

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

html {
  font-size: var(--font-size-base, 13px);
  /* font-size transitions smoothly on theme switch */
  transition: font-size 0.15s ease;
}

body {
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  line-height: 1.5;
  background-color: var(--color-bg-base);
  color: var(--color-text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow: hidden; /* Shell manages scroll per-panel */
}

#app {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Typography hierarchy */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-body);
  font-weight: 700;
  color: var(--color-text-primary);
  line-height: 1.2;
}

/* Type scale — display (Syne, fixed px, density-independent) */

h1 { font-size: var(--font-size-display-1, 48px); font-weight: 800; letter-spacing: -0.02em; }

h2 { font-size: var(--font-size-display-2, 40px); font-weight: 700; letter-spacing: -0.02em; }

h3 { font-size: var(--font-size-display-3, 32px); font-weight: 700; letter-spacing: -0.01em; }

h4 { font-size: var(--font-size-display-4, 24px); font-weight: 600; letter-spacing: -0.01em; }

h5 { font-size: var(--font-size-body-lg, 16px);   font-weight: 600; }

h6 { font-size: var(--font-size-body-md, 14px);   font-weight: 600; }

code, pre, kbd, samp, .mono {
  font-family: var(--font-mono);
  font-size: var(--font-size-mono, 13px);
}

/* Focus ring — gold, consistent */

:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
  border-radius: var(--comp-radius-sm);
}

/* Scrollbars — subtle, themed */

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

::-webkit-scrollbar-track {
  background: transparent;
}

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

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

/* Selection */

::-moz-selection {
  background: var(--color-accent-subtle);
  color: var(--color-text-primary);
}

::selection {
  background: var(--color-accent-subtle);
  color: var(--color-text-primary);
}

/* ==========================================================================
   Route transitions — applied to the MainArea content wrapper.
   ========================================================================== */

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

.da-page-transition {
  animation: da-page-enter 150ms ease-out both;
}

/* ==========================================================================
   RCA panel entry animation
   ========================================================================== */

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

/* ==========================================================================
   Shared animations
   ========================================================================== */

@keyframes da-node-fade-in {
  from { opacity: 0; transform: scale(0.82); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes da-sparkle {
  0%, 100% { opacity: 1; transform: scale(1) rotate(0deg); }
  50%       { opacity: 0.7; transform: scale(1.3) rotate(20deg); }
}

@keyframes da-canvas-flash {
  0%, 100% { box-shadow: inset 0 0 0 0 transparent; }
  50%       { box-shadow: inset 0 0 40px 8px rgba(240, 165, 0, 0.12); }
}

@keyframes da-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Alias for backward compat with any inline `animation: spin ...` references */

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes da-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}

/* Utility animation classes */

.da-node-fade-in  { animation: da-node-fade-in 200ms ease-out both; }

.da-sparkle       { animation: da-sparkle 2s ease-in-out infinite; }

.da-canvas-flash  { animation: da-canvas-flash 1s ease-in-out 2; }

.da-spin          { animation: da-spin 0.7s linear infinite; }

.da-pulse         { animation: da-pulse 2s ease-in-out infinite; }

.hover\:-translate-y-px:hover {
  --tw-translate-y:    -1px;
  transform:    translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
}

.hover\:bg-current:hover {
  background-color:    currentColor;
}

.hover\:brightness-110:hover {
  --tw-brightness:    brightness(1.1);
  filter:    var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
}

.hover\:\[background\:var\(--comp-btn-primary-bg-hover\)\]:hover {
  background:    var(--comp-btn-primary-bg-hover);
}

.hover\:\[box-shadow\:var\(--comp-btn-primary-shadow-hover\)\]:hover {
  box-shadow:    var(--comp-btn-primary-shadow-hover);
}

.hover\:\[box-shadow\:var\(--comp-card-shadow-hover\)\]:hover {
  box-shadow:    var(--comp-card-shadow-hover);
}

.focus\:outline-none:focus {
  outline:    2px solid transparent;
  outline-offset:    2px;
}

.focus\:\[background\:var\(--comp-input-bg-focus\)\]:focus {
  background:    var(--comp-input-bg-focus);
}

.focus\:\[box-shadow\:0_0_0_3px_var\(--color-error-dim\)\]:focus {
  box-shadow:    0 0 0 3px var(--color-error-dim);
}

.focus\:\[box-shadow\:var\(--comp-input-shadow-focus\)\]:focus {
  box-shadow:    var(--comp-input-shadow-focus);
}

.focus-visible\:outline-none:focus-visible {
  outline:    2px solid transparent;
  outline-offset:    2px;
}

.focus-visible\:ring-1:focus-visible {
  --tw-ring-offset-shadow:    var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
  --tw-ring-shadow:    var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);
  box-shadow:    var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
}

.focus-visible\:ring-2:focus-visible {
  --tw-ring-offset-shadow:    var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
  --tw-ring-shadow:    var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);
  box-shadow:    var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
}

.focus-visible\:ring-offset-1:focus-visible {
  --tw-ring-offset-width:    1px;
}

.focus-visible\:ring-offset-2:focus-visible {
  --tw-ring-offset-width:    2px;
}

.active\:translate-y-0:active {
  --tw-translate-y:    0px;
  transform:    translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
}

.disabled\:pointer-events-none:disabled {
  pointer-events:    none;
}

.disabled\:cursor-not-allowed:disabled {
  cursor:    not-allowed;
}

.disabled\:opacity-30:disabled {
  opacity:    0.3;
}

.disabled\:opacity-40:disabled {
  opacity:    0.4;
}

.group:hover .group-hover\:opacity-100 {
  opacity:    1;
}
