/*
 * Slate RM design system applied via a token bridge: the Slate token files define the palette /
 * spacing / type scale, the vendored ATAS component CSS (_ds_bundle.css) provides the .atas-* class
 * styling, and the :root bridge below re-points every --atas-* token at its Slate equivalent — so the
 * whole app (components + inline var(--atas-*) usages) re-skins to Slate RM with no component rewrites.
 */
@import './slate/fonts.css';
@import './slate/colors.css';
@import './slate/theme-light.css';
@import './slate/spacing.css';
@import './slate/typography.css';
@import './_ds_bundle.css';

:root {
  /* surfaces */
  --atas-bg-page: var(--canvas);
  --atas-bg-section: var(--surface-bar);
  --atas-bg-card: var(--surface-1);
  --atas-bg-elevated: var(--surface-2);
  --atas-bg-hover: var(--surface-2);
  --atas-bg-tooltip: var(--surface-3);
  --atas-bg-overlay: rgba(0, 0, 0, 0.6);

  /* Data-table odd-row tint (AG Grid zebra). Dark keeps a faint stripe; light flattens to white (see theme-light). */
  --grid-row-odd: #13171e;

  /* text */
  --atas-fg-primary: var(--text-primary);
  --atas-fg-body: var(--text-secondary);
  --atas-fg-secondary: var(--text-secondary);
  --atas-fg-muted: var(--text-muted);
  --atas-fg-quote: var(--text-muted);
  --atas-fg-disabled: var(--text-faint);
  --atas-fg-on-accent: var(--accent-on);

  /* borders + focus */
  --atas-border-subtle: var(--border);
  --atas-border-default: var(--border);
  --atas-border-strong: var(--border-strong);
  --atas-border-focus: var(--accent);
  --atas-focus: var(--accent);

  /* accent / brand (Slate is flat — gradients collapse to the solid accent) */
  --atas-accent: var(--accent);
  --atas-secondary: var(--text-secondary); /* ghost buttons (text + border) — subdued, not the old purple */
  --atas-primary: var(--accent);
  --atas-primary-glow: var(--accent-subtle);
  /* Components use these in `background-image:`, which rejects a bare color — Slate is flat, so use a
     solid "gradient" (accent→accent) that's valid as a background-image and renders as the accent fill. */
  --atas-primary-gradient: linear-gradient(var(--accent), var(--accent));
  --atas-primary-gradient-full: linear-gradient(var(--accent), var(--accent));

  /* semantic (reuse the Slate risk scale) */
  --atas-success: var(--risk-low);
  --atas-warning: var(--risk-med);
  --atas-error: var(--risk-crit);
  --atas-info: var(--accent);

  /* spacing (Slate 4px grid) */
  --atas-space-xs: var(--space-1);
  --atas-space-sm: var(--space-2);
  --atas-space-md: var(--space-3);
  --atas-space-lg: var(--space-4);
  --atas-space-xl: var(--space-6);
  --atas-space-2xl: var(--space-8);

  /* radius */
  --atas-radius-input: var(--radius-2);
  --atas-radius-button: var(--radius-2);
  --atas-radius-card: var(--radius-3);

  /* typography — a notch larger than the Slate default scale for comfortable reading */
  --atas-font-sans: var(--font-sans);
  --atas-font-size-body: 14px;
  --atas-font-size-caption: 12px;
  --atas-font-size-h3: 16px;
  --atas-font-size-h2: 22px;
  --atas-line-height-normal: 1.45;
}

/* Control sizing — comfortable but still compact. */
.atas-button {
  padding: 8px 16px;
}
.atas-input {
  padding: 7px 11px;
  border-width: 1px;
}
.atas-input--number::-webkit-outer-spin-button,
.atas-input--number::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.atas-input--number[type='number'] {
  -moz-appearance: textfield;
  appearance: textfield;
}
.atas-number-input {
  position: relative;
  width: 100%;
}
.atas-number-input .atas-input--number {
  padding-right: 40px;
}
.atas-number-input__stepper {
  position: absolute;
  top: 1px;
  right: 1px;
  bottom: 1px;
  width: 28px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface-2);
  border-left: 1px solid var(--border);
  border-top-right-radius: var(--atas-radius-input);
  border-bottom-right-radius: var(--atas-radius-input);
}
.atas-number-input__stepper button {
  flex: 1;
  min-height: 0;
  appearance: none;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.atas-number-input__stepper button:last-child {
  border-bottom: 0;
}
.atas-number-input__stepper button:hover:not(:disabled) {
  color: var(--text-primary);
  background: var(--surface-3);
}
.atas-number-input__stepper button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
/* Slate-align the design-system select so it matches the .sv-input slate fields used across all panels:
   1px strong border, canvas surface, accent focus ring, themed option list (keeps the bundle's chevron). */
.atas-select {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-2);
  background-color: var(--canvas);
  color: var(--text-primary);
  font-size: 13px;
  padding: 8px 34px 8px 11px;
  background-position: right 11px center;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.atas-select:hover:not(:disabled) {
  border-color: color-mix(in oklch, var(--border-strong) 55%, var(--text-faint));
}
.atas-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 22%, transparent);
}
.atas-select:disabled {
  background-color: var(--surface-2);
  color: var(--text-muted);
}
.atas-select option {
  background: var(--surface-1);
  color: var(--text-primary);
}
.atas-tab {
  padding: 9px 16px;
}
.atas-textarea {
  min-height: 80px;
}
/* Ghost-button hover: the bundle hardcodes an old-purple tint — use a Slate surface instead. */
.atas-button--ghost:hover {
  background: var(--surface-2);
}

/* Danger buttons: ghost anatomy in the risk palette — the bundle has no danger variant. */
.atas-button--danger {
  background: transparent;
  color: var(--risk-crit);
  border-color: color-mix(in oklch, var(--risk-crit) 45%, var(--border-strong));
}
.atas-button--danger:hover:not(:disabled) {
  background: var(--risk-crit-subtle);
}

/* Scrollbars in the Slate palette (page, modals, grids, lists). */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-corner {
  background: transparent;
}

html,
body,
#app {
  margin: 0;
  height: 100%;
}

#app {
  min-height: 100vh;
  background: var(--canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
}
