/* Shared Angular, prototype and hosted Account design tokens. */
:root {
  --rz-radius: 12px;
  --rz-control-height: 44px;
  --rz-font: 'Golos Text', sans-serif;
  color-scheme: dark;
  --bg: #080520;
  --rail: #0b062d;
  --surface: #100b32;
  --raised: #19133f;
  --text: #eeeef8;
  --muted: #aaa6c3;
  --border: #30294e;
  --blue: #018df0;
  --action: #0769b4;
  --turquoise: #01c5ba;
  --danger: #ffb0b8;
  --success: #65dcc6;
  --warning: #edce87;
  --focus: #73caff;
  --action-hover: #0873c2;
  --action-pressed: #055590;
  --action-text: #8bcfff;
  --secondary: #211a49;
  --secondary-hover: #30265c;
  --secondary-pressed: #3e326e;
  --control-border: #887ca9;
  --overlay: #26204c;
  --field: #0b0827;
  --destructive: #a42138;
  --destructive-hover: #b12640;
  --destructive-pressed: #891b30;
  --negative-pale: #3b192f;
  --positive-pale: #103a37;
  --warning-pale: #3c321c;
  --info-pale: #102e49;
  --rz-overlay-shadow: 0 16px 48px #02001466;
}
:root[data-theme='light'] {
  --rz-radius: 12px;
  --rz-control-height: 44px;
  --rz-font: 'Golos Text', sans-serif;
  color-scheme: light;
  --bg: #f6f7fb;
  --rail: #e9edf7;
  --surface: #fff;
  --raised: #eef0f7;
  --text: #17132c;
  --muted: #5f5b75;
  --border: #d9dbe7;
  --blue: #006eaf;
  --action: #0769b4;
  --turquoise: #007e77;
  --danger: #a42138;
  --success: #086f5e;
  --warning: #765600;
  --focus: #006bba;
  --action-hover: #0873c2;
  --action-pressed: #055590;
  --action-text: #075b99;
  --secondary: #e5edf9;
  --secondary-hover: #dae5f6;
  --secondary-pressed: #cbdaf0;
  --control-border: #857f99;
  --overlay: #fff;
  --field: #fff;
  --destructive: #a42138;
  --destructive-hover: #b12640;
  --destructive-pressed: #891b30;
  --negative-pale: #fbe9ed;
  --positive-pale: #e1f4ee;
  --warning-pale: #fff1ce;
  --info-pale: #e5effc;
  --rz-overlay-shadow: 0 16px 48px #17132c24;
}

:root {
  --rz-chart-1: #018df0; --rz-chart-2: #01c5ba; --rz-chart-3: #a78bfa;
  --rz-chart-4: #f4b860; --rz-chart-5: #fb8faf; --rz-chart-6: #93c5fd;
}
:root[data-theme='light'] {
  --rz-chart-1: #0769b4; --rz-chart-2: #007e77; --rz-chart-3: #7045b5;
  --rz-chart-4: #936000; --rz-chart-5: #b52e5a; --rz-chart-6: #3157aa;
}
/* Netfly role/state model, expressed in Razrabov tokens rather than copied template CSS. */
:root {
  --rz-space-field: 0.5rem;
  --rz-space-row: 0.75rem;
  --rz-space-section: 1.5rem;
  --rz-space-page: clamp(1rem, 3vw, 2rem);
  --rz-radius-control: 8px;
  --rz-radius-card: 12px;
  --rz-radius-overlay: 16px;
}
/* Override Taiga defaults for both the application and portal overlays. */
:root, [tuiTheme], tui-root {
  --tui-height-m: var(--rz-control-height); --tui-height-l: 48px;
  --tui-typography-family-text: var(--rz-font); --tui-typography-family-display: var(--rz-font);
  --tui-background-base: var(--bg); --tui-background-base-alt: var(--rail);
  --tui-background-neutral-1: var(--secondary); --tui-background-neutral-2: var(--raised);
  --tui-background-elevation-1: var(--surface); --tui-background-elevation-2: var(--overlay);
  --tui-background-accent-1: var(--action); --tui-background-accent-1-hover: var(--action-hover);
  --tui-background-accent-1-pressed: var(--action-pressed);
  --tui-background-neutral-1-hover: var(--secondary-hover); --tui-background-neutral-1-pressed: var(--secondary-pressed);
  --tui-background-neutral-2-hover: var(--secondary-hover); --tui-background-neutral-2-pressed: var(--secondary-pressed);
  --tui-text-primary: var(--text); --tui-text-secondary: var(--muted);
  --tui-text-action: var(--action-text); --tui-text-primary-on-accent-1: #fff;
  --tui-border-normal: var(--control-border); --tui-border-hover: var(--focus); --tui-border-focus: var(--focus);
  --tui-status-negative: var(--destructive); --tui-status-negative-pale: var(--negative-pale);
  --tui-status-negative-pale-hover: var(--negative-pale); --tui-text-negative-hover: var(--danger);
  --tui-status-positive: var(--success); --tui-status-positive-pale: var(--positive-pale);
  --tui-status-positive-pale-hover: var(--positive-pale);
  --tui-status-warning: var(--warning); --tui-status-warning-pale: var(--warning-pale);
  --tui-status-warning-pale-hover: var(--warning-pale);
  --tui-status-info: var(--focus); --tui-status-info-pale: var(--info-pale);
  --tui-status-info-pale-hover: var(--info-pale);
  --tui-text-positive: var(--success); --tui-text-negative: var(--danger);
  --tui-text-warning: var(--warning); --tui-radius-m: var(--rz-radius);
  --tui-chart-categorical-00: var(--rz-chart-1); --tui-chart-categorical-01: var(--rz-chart-2);
  --tui-chart-categorical-02: var(--rz-chart-3); --tui-chart-categorical-03: var(--rz-chart-4);
  --tui-chart-categorical-04: var(--rz-chart-5); --tui-chart-categorical-05: var(--rz-chart-6);
}
/* Theme changes must not interpolate through unreadable foreground/background pairs.
   Cards outrank the TuiSurface styles injected later at runtime. */
[tuiAppearance],
:root [tuiCardMedium][data-tui-version],
:root [tuiCardLarge][data-tui-version] { transition-property: opacity, transform !important; }

/* Explicit adapter for Taiga's destructive role: its stock brightness filter can
   lower white-label contrast. Use the same measured states as legacy controls. */
[tuiAppearance][data-appearance='primary-destructive']:not(:disabled):not([data-state='disabled']):is(:hover, [data-state='hover']) {
  background: var(--destructive-hover); filter: none;
}
[tuiAppearance][data-appearance='primary-destructive']:not(:disabled):not([data-state='disabled']):is(:active, [data-state='active']) {
  background: var(--destructive-pressed); filter: none;
}
/* Checked semantic badges use the theme base against their solid status fill. */
[tuiAppearance]:is([data-appearance='positive'], [data-appearance='warning'], [data-appearance='info']):is(:checked, [data-mode~='checked']) { color: var(--bg); }
[tuiAppearance]:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

/* Both SPA clients retain native controls during the page-by-page migration.
   Never override a Taiga-owned appearance with a generic button selector. */
:where(tui-root :is(button, .button, .btn):not([tuiAppearance]):not([tuiButton])),
.rz-button {
  --rz-button-bg: var(--secondary);
  --rz-button-hover: var(--secondary-hover);
  --rz-button-pressed: var(--secondary-pressed);
  --rz-button-text: var(--action-text);
  --rz-button-border: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--rz-space-field); min-block-size: var(--rz-control-height);
  padding: 0.625rem 1rem; border: 1px solid var(--rz-button-border);
  border-radius: var(--rz-radius-control); background: var(--rz-button-bg);
  color: var(--rz-button-text); font: inherit; font-weight: 550;
  line-height: 1.4; white-space: normal; text-align: center;
  text-decoration: none; cursor: pointer;
}
:where(tui-root) :is(button, .button, .btn):not([tuiAppearance]):not([tuiButton]):is(.primary, .btn-primary, .primary-button),
.rz-button[data-role='primary'] {
  --rz-button-bg: var(--action); --rz-button-hover: var(--action-hover);
  --rz-button-pressed: var(--action-pressed); --rz-button-text: #fff;
}
:where(tui-root) :is(button, .button, .btn):not([tuiAppearance]):not([tuiButton]):is(.outline, .btn-outline),
.rz-button[data-role='outline'] {
  --rz-button-bg: transparent; --rz-button-border: var(--control-border);
}
:where(tui-root) :is(button, .button, .btn):not([tuiAppearance]):not([tuiButton]):is(.ghost, .btn-ghost),
.rz-button[data-role='ghost'] { --rz-button-bg: transparent; }
:where(tui-root) :is(button, .button, .btn):not([tuiAppearance]):not([tuiButton]):is(.danger, .btn-danger),
.rz-button[data-role='destructive'] {
  --rz-button-bg: var(--destructive); --rz-button-hover: var(--destructive-hover);
  --rz-button-pressed: var(--destructive-pressed); --rz-button-text: #fff;
}
:where(tui-root) :is(button, .button, .btn):not([tuiAppearance]):not([tuiButton]):hover:not(:disabled):not([aria-disabled='true']),
.rz-button:hover:not(:disabled):not([aria-disabled='true']) {
  background: var(--rz-button-hover); text-decoration: none;
}
:where(tui-root) :is(button, .button, .btn):not([tuiAppearance]):not([tuiButton]):active:not(:disabled):not([aria-disabled='true']),
.rz-button:active:not(:disabled):not([aria-disabled='true']) { background: var(--rz-button-pressed); }
:where(tui-root) :is(button, .button, .btn):not([tuiAppearance]):not([tuiButton]):is(:disabled, [aria-disabled='true']),
.rz-button:is(:disabled, [aria-disabled='true']) { opacity: 0.5; cursor: not-allowed; }
:where(tui-root) :is(button, .button, .btn):not([tuiAppearance]):not([tuiButton])[aria-busy='true'],
.rz-button[aria-busy='true'] { cursor: progress; }
.rz-button:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
/* Busy is explicit and remains legible with reduced motion. The caller still
   owns duplicate-submit prevention and an accessible loading label. */
.rz-button[aria-busy='true']::before {
  content: ''; inline-size: 0.875rem; block-size: 0.875rem;
  border: 2px solid currentColor; border-inline-end-color: transparent;
  border-radius: 50%; animation: rz-busy 0.8s linear infinite;
}
@keyframes rz-busy { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .rz-button[aria-busy='true']::before { animation: none; }
}

/* Action groups wrap whole Taiga controls instead of clipping their labels. */
:where(.actions) > :is([tuiButton], [tuiIconButton]) { flex-basis: auto; flex-shrink: 0; max-inline-size: 100%; }
