:root {
  --kx-color-canvas: #0b0d0f;
  --kx-color-shell: #101316;
  --kx-color-surface: #15191d;
  --kx-color-surface-subtle: #1a1f24;
  --kx-color-surface-raised: #222930;
  --kx-color-text: #f5f5ee;
  --kx-color-text-soft: #e4e6e9;
  --kx-color-text-muted: #86909c;
  --kx-color-action: #ff6600;
  --kx-color-action-text: #ff6600;
  --kx-color-action-hover: #ff8533;
  --kx-color-on-action: #111111;
  --kx-color-cta: #ff6600;
  --kx-color-cta-hover: #ff6600;
  --kx-color-on-cta: #ffffff;
  --kx-color-cta-outline: #1e1c19;
  --kx-color-focus: #ff994d;
  --kx-color-success: #00b42a;
  --kx-color-success-soft: #4bd66c;
  --kx-color-warning: #b8bec8;
  --kx-color-danger: #bc171d;
  --kx-color-danger-soft: #ef9c9f;
  --kx-color-line: rgb(255 255 255 / 0.04);
  --kx-color-line-strong: rgb(255 255 255 / 0.12);
  --kx-font-family-sans: "Ubuntu Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --kx-font-weight-regular: 450;
  --kx-font-weight-label: 550;
  --kx-font-weight-screen: 550;
  --kx-font-weight-title: 650;
  --kx-font-weight-strong: 700;
  --kx-font-size-caption: 0.75rem;
  --kx-font-size-label: 0.8125rem;
  --kx-font-size-body: 1rem;
  --kx-font-size-title: clamp(1.75rem, 3.4vw, 2.625rem);
  --kx-type-display-size: clamp(3rem, 7vw, 4rem);
  --kx-type-display-line-height: 1.08;
  --kx-type-title-line-height: 1.25;
  --kx-type-section-size: 1.25rem;
  --kx-type-section-letter-spacing: 0;
  --kx-type-row-size: 1rem;
  --kx-type-body-size: 0.875rem;
  --kx-line-height-tight: 1.1;
  --kx-line-height-body: 1.5;
  --kx-space-1: 0.25rem;
  --kx-space-2: 0.5rem;
  --kx-space-3: 0.75rem;
  --kx-space-4: 1rem;
  --kx-space-5: 1.5rem;
  --kx-space-6: 2rem;
  --kx-space-7: 3rem;
  --kx-radius-control: 0.875rem;
  --kx-radius-panel: 1.5rem;
  --kx-radius-compact: 0.875rem;
  --kx-radius-pill: 999px;
  --kx-control-height: 3rem;
  --kx-control-padding-inline: 1.125rem;
  --kx-elevation-control: inset 0 1px 0 rgb(255 255 255 / 0.08);
  --kx-elevation-panel: inset 0 1px 0 rgb(255 255 255 / 0.045);
  --kx-motion-duration-fast: 120ms;
  --kx-motion-duration-standard: 200ms;
  --kx-motion-easing-standard: cubic-bezier(0, 0, 0.2, 1);
  --kx-layout-content-max: 52rem;
  --kx-layout-rail: 17.5rem;
  --kx-layout-gutter-mobile: 1.25rem;
  --kx-layout-gutter-tablet: 1.75rem;
  --kx-layout-gutter-desktop: 2rem;
  --kx-touch-target: 3rem;
  --kx-touch-target-comfortable: 3.5rem;
  --kx-safe-top: env(safe-area-inset-top, 0px);
  --kx-safe-right: env(safe-area-inset-right, 0px);
  --kx-safe-bottom: env(safe-area-inset-bottom, 0px);
  --kx-safe-left: env(safe-area-inset-left, 0px);

  /* Aliases de compatibilidade; a fonte canônica são os tokens semânticos kx. */
  --bg: var(--kx-color-canvas);
  --shell: var(--kx-color-shell);
  --card: var(--kx-color-surface);
  --card-2: var(--kx-color-surface-subtle);
  --card-3: var(--kx-color-surface-raised);
  --line: var(--kx-color-line);
  --legacy-muted: var(--kx-color-text-muted);
  --soft: var(--kx-color-text-soft);
  --text: var(--kx-color-text);
  --blue: var(--kx-color-action);
  --blue-2: var(--kx-color-focus);
  --green: var(--kx-color-success);
  --green-2: var(--kx-color-success-soft);
  --red: var(--kx-color-danger);
  --red-soft: var(--kx-color-danger-soft);
  --glass: rgb(33 34 35 / 0.88);
  --shadow: 0 4px 10px rgb(0 0 0 / 0.1);
  --tone-blue-bg: rgb(255 102 0 / 0.055);
  --tone-blue-border: rgb(255 153 77 / 0.12);
  --tone-green-bg: rgb(0 180 42 / 0.055);
  --tone-green-border: rgb(75 214 108 / 0.12);
  --tone-red-bg: rgb(188 23 29 / 0.07);
  --tone-red-border: rgb(213 74 79 / 0.14);
  --tone-neutral-bg: rgb(255 255 255 / 0.035);
  --tone-neutral-border: rgb(255 255 255 / 0.045);
  --color-canvas: 15 15 15;
  --color-panel: 33 34 35;
  --color-stroke: 55 55 55;
  --color-ink: 245 245 245;
  --color-muted: 134 144 156;
  --color-action: 255 102 0;
  --color-success: 75 214 108;
  --color-warning: 184 190 200;
  --color-danger: 239 156 159;
  color-scheme: dark;
}

:root[data-kaxis-theme-scope="admin"][data-kaxis-theme="dark"],
:root[data-kaxis-theme-scope="user"][data-kaxis-theme="dark"] {
  --kx-color-canvas: #171513;
  --kx-color-shell: #211e1b;
  --kx-color-surface: #302b27;
  --kx-color-surface-subtle: #3c3732;
  --kx-color-surface-raised: #49423b;
  --kx-color-text: #f8f5ef;
  --kx-color-text-soft: #ebe6e0;
  --kx-color-text-muted: #ded4ca;
  --kx-color-line: #63584d;
  --kx-color-line-strong: #81756a;
}

:root[data-kaxis-theme-scope="admin"][data-kaxis-theme="light"],
:root[data-kaxis-theme-scope="user"][data-kaxis-theme="light"] {
  --kx-color-action-text: #b34700;
  --kx-color-canvas: #eae7e0;
  --kx-color-shell: #f1eee8;
  --kx-color-surface: #fffefa;
  --kx-color-surface-subtle: #f1eee8;
  --kx-color-surface-raised: #fffefa;
  --kx-color-text: #1e1c19;
  --kx-color-text-soft: #34312d;
  --kx-color-text-muted: #57534d;
  --kx-color-action: #ff6600;
  --kx-color-action-hover: #ff8533;
  --kx-color-on-action: #111111;
  --kx-color-focus: #111111;
  --kx-color-success: #00501f;
  --kx-color-success-soft: #00501f;
  --kx-color-warning: #3f474f;
  --kx-color-danger: #7a1117;
  --kx-color-danger-soft: #7a1117;
  --kx-color-line: #d1cbc1;
  --kx-color-line-strong: #9b9488;
  --kx-elevation-control: 0 0 0 1px rgb(0 0 0 / 0.1);
  --kx-elevation-panel: 0 0 0 1px rgb(0 0 0 / 0.1);

  --glass: rgb(245 245 238 / 0.98);
  --shadow: 0 4px 12px rgb(0 0 0 / 0.08);
  --tone-blue-bg: rgb(255 102 0 / 0.07);
  --tone-blue-border: rgb(255 102 0 / 0.18);
  --tone-green-bg: rgb(0 80 31 / 0.08);
  --tone-green-border: rgb(0 80 31 / 0.22);
  --tone-red-bg: rgb(122 17 23 / 0.08);
  --tone-red-border: rgb(122 17 23 / 0.22);
  --tone-neutral-bg: rgb(0 0 0 / 0.07);
  --tone-neutral-border: rgb(0 0 0 / 0.12);
  --color-canvas: 245 245 238;
  --color-panel: 255 255 255;
  --color-stroke: 216 214 204;
  --color-ink: 17 17 17;
  --color-muted: 113 109 96;
  --color-action: 255 102 0;
  --color-success: 0 80 31;
  --color-warning: 63 71 79;
  --color-danger: 122 17 23;
  color-scheme: light;
}

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

/* Every in-app scrolling surface shares the same quiet, authored treatment. */
* {scrollbar-width:thin;scrollbar-color:var(--kx-color-line-strong) transparent;}
*::-webkit-scrollbar {width:6px;height:6px;}
*::-webkit-scrollbar-track {background:transparent;}
*::-webkit-scrollbar-thumb {background:var(--kx-color-line-strong);border:1px solid transparent;border-radius:999px;background-clip:padding-box;}
*::-webkit-scrollbar-thumb:hover {background:var(--kx-color-text-muted);}
*::-webkit-scrollbar-corner {background:transparent;}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--kx-color-canvas);
  color: var(--kx-color-text);
  scrollbar-width: none;
}

html {
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
  text-size-adjust: 100%;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
}

body {
  overflow-x: hidden;
  font-family: var(--kx-font-family-sans);
  text-rendering: optimizeLegibility;
}

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

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--kx-color-focus);
  outline-offset: 3px;
}

::selection {
  background: var(--kx-color-action);
  color: var(--kx-color-on-action);
}

@media (pointer: coarse) {
  button,
  a,
  input,
  select,
  textarea,
  summary {
    min-height: var(--kx-touch-target);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  button:active,
  a:active {
    transform: none !important;
  }
}
