/* UA-ERP by WEBHVA — Brand System v1.2 (vertical: UA-ERP Defense)
   Master mark colors: Deep Blue #022F7F · UA Blue #076CFD · Sky Blue #5AA2FD · UA Yellow #FDC704
   Support: Light Surface #F6F8FB · Deep Ink #061A2F · Slate #94A3B8
   Typography (p.05): Inter — H1 32-40/700 · H2 24-30/600 · H3 18-22/600 · Body 14-16/400 · Label 11-12/500 · Meta 9-10/500
   Rules: yellow ≤ 10-15% of composition · no decorative glow (p.19) · logo effects are forbidden (p.06)
   Loaded last to skin all existing ERP modules without changing business logic. */

/* --- Inter (brand typeface), bundled locally for offline/isolated use --- */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-cyrillic-ext.woff2") format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --ua-brand-navy: #022f7f;
  --ua-brand-sky: #5aa2fd;
  --ua-brand-blue: #076cfd;
  --ua-brand-yellow: #fdc704;
  --ua-brand-ink: #061a2f;
  --ua-brand-bg: #f6f8fb;
  --ua-brand-surface: #ffffff;
  --ua-brand-surface-alt: #f7f9fc;
  --ua-brand-slate: #94a3b8;
  --ua-brand-muted: #64748b;
  --ua-brand-line: #dbe4ef;
  --ua-brand-line-strong: #b7c6d8;
  --ua-brand-success: #169b62;
  --ua-brand-danger: #c2414b;
  --ua-brand-warning: #b7791f;
  --ua-brand-gradient: linear-gradient(135deg, #022f7f 0%, #076cfd 58%, #fdc704 100%);
  --ua-login-blur: 2px;
  --ua-brand-radius: 14px;
  --ua-brand-radius-sm: 10px;
  --ua-brand-shadow: 0 18px 52px rgba(2, 47, 127, 0.10);
  --ua-brand-shadow-tight: 0 8px 24px rgba(2, 47, 127, 0.08);

  --bg: var(--ua-brand-bg);
  --surface: var(--ua-brand-surface);
  --surface-alt: var(--ua-brand-surface-alt);
  --ink: var(--ua-brand-ink);
  --muted: var(--ua-brand-muted);
  --line: var(--ua-brand-line);
  --line-strong: var(--ua-brand-line-strong);
  --green: var(--ua-brand-blue);
  --green-deep: var(--ua-brand-navy);
  --green-black: #061a2f;
  --green-soft: #e9f2ff;
  --lime: var(--ua-brand-yellow);
  --danger: var(--ua-brand-danger);
  --danger-soft: #fff0f2;
  --warning: var(--ua-brand-warning);
  --warning-soft: #fff8e1;
  --shadow: var(--ua-brand-shadow);
  --shadow-tight: var(--ua-brand-shadow-tight);
  font-family: Inter, "Segoe UI", Arial, Helvetica, sans-serif;
}

body[data-theme="dark"] {
  --ua-brand-bg: #06111f;
  --ua-brand-surface: #0b1d31;
  --ua-brand-surface-alt: #0e2743;
  --ua-brand-ink: #f8fafc;
  --ua-brand-muted: #9cafc4;
  --ua-brand-line: rgba(90, 162, 253, 0.18);
  --ua-brand-line-strong: rgba(90, 162, 253, 0.34);
  --ua-brand-shadow: 0 20px 58px rgba(0, 0, 0, 0.34);
  --ua-brand-shadow-tight: 0 10px 28px rgba(0, 0, 0, 0.25);

  --bg: var(--ua-brand-bg);
  --surface: var(--ua-brand-surface);
  --surface-alt: var(--ua-brand-surface-alt);
  --ink: var(--ua-brand-ink);
  --muted: var(--ua-brand-muted);
  --line: var(--ua-brand-line);
  --line-strong: var(--ua-brand-line-strong);
  --green: var(--ua-brand-blue);
  --green-deep: var(--ua-brand-sky);
  --green-black: #031225;
  --green-soft: rgba(7, 108, 253, 0.13);
  --lime: var(--ua-brand-yellow);
  --danger-soft: rgba(194, 65, 75, 0.17);
  --warning-soft: rgba(253, 199, 4, 0.12);
  --shadow: var(--ua-brand-shadow);
  --shadow-tight: var(--ua-brand-shadow-tight);
}

html {
  background: var(--bg);
  color-scheme: light;
}

body[data-theme="dark"] {
  color-scheme: dark;
}

body {
  color: var(--ink);
  background: var(--bg);
}

body[data-theme="dark"] {
  background: linear-gradient(160deg, #06111f 0%, #081a2e 55%, #06111f 100%);
}

::selection {
  background: rgba(7, 108, 253, 0.22);
  color: var(--ink);
}

.login-brand,
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 13px;
}

.ua-brand-mark {
  display: block;
  width: 58px;
  height: auto;
  flex: 0 0 auto;
}

.sidebar-brand .ua-brand-mark {
  width: 42px;
}

.ua-brand-wordmark {
  display: grid;
  gap: 1px;
  line-height: 1;
}

.ua-brand-product {
  color: var(--ua-brand-navy);
  font-size: 1.32rem;
  font-weight: 850;
  letter-spacing: -0.035em;
}

.ua-brand-byline {
  color: var(--ua-brand-ink);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.10em;
}

.sidebar .ua-brand-product,
.sidebar .ua-brand-byline {
  color: #fff;
}

.sidebar .ua-brand-byline {
  color: rgba(255,255,255,0.68);
}

body[data-theme="dark"] .login-brand .ua-brand-product,
body[data-theme="dark"] .login-brand .ua-brand-byline {
  color: #fff;
}

/* p.19 "No glow" — decorative neon ambient is disabled. */
.ambient {
  display: none;
}

.login-screen {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  overflow: hidden;
  padding: 34px clamp(24px, 5vw, 84px);
}

/* Login background: blue-yellow tech composition (user-provided artwork),
   fills the whole page with preserved proportions (cover, no distortion).
   Theme grades per p.24: Light = brighter + white veil; Dark = navy overlay. */
.login-screen::before {
  position: absolute;
  inset: -36px;
  z-index: -2;
  content: "";
  background-color: #04122a;
  background-image: url("/ua-erp-login-bg.jpg?v=4");
  background-repeat: no-repeat;
  background-position: 50% 50%;
  background-size: cover;
  filter: blur(var(--ua-login-blur, 5px)) brightness(1.18) saturate(0.96) contrast(0.96);
}

body[data-theme="dark"] .login-screen::before {
  background-color: #04122a;
  filter: blur(var(--ua-login-blur, 5px)) brightness(0.92) saturate(1.06) contrast(1.02);
}

.login-screen::after {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
  background:
    linear-gradient(115deg, rgba(246,248,251,0.88) 0%, rgba(246,248,251,0.52) 52%, rgba(90,162,253,0.12) 100%);
}

body[data-theme="dark"] .login-screen::after {
  background:
    linear-gradient(115deg, rgba(4,14,28,0.72) 0%, rgba(2,47,127,0.38) 52%, rgba(2,47,127,0.18) 100%);
}

.login-layout {
  grid-template-columns: minmax(0, 1.2fr) minmax(350px, 0.58fr);
  gap: clamp(42px, 7vw, 112px);
}

.login-copy {
  max-width: 820px;
}

/* p.05 typography — Meta 9-10px / Medium 500. */
.eyebrow,
.panel-kicker {
  color: var(--ua-brand-blue);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.17em;
}

body[data-theme="dark"] .eyebrow,
body[data-theme="dark"] .panel-kicker {
  color: var(--ua-brand-sky);
}

/* p.05 typography — H1 32-40px / Bold 700. Login is not an ad banner (p.18). */
.login-copy h1 {
  max-width: 900px;
  margin: 22px 0 24px;
  color: var(--ua-brand-ink);
  font-size: clamp(2rem, 2.6vw, 2.5rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-transform: none;
  text-shadow: none;
}

body[data-theme="dark"] .login-copy h1 {
  color: #fff;
}

.login-copy p {
  max-width: 710px;
  color: var(--muted);
  font-size: clamp(1rem, 1.35vw, 1.18rem);
}

.security-strip {
  gap: 9px;
  margin-top: 30px;
}

.security-strip span,
.tag,
.role-tag {
  border-color: var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--ua-brand-navy);
  box-shadow: none;
}

body[data-theme="dark"] .security-strip span,
body[data-theme="dark"] .tag,
body[data-theme="dark"] .role-tag {
  color: var(--ua-brand-sky);
}

/* Transparent glass card over the photo (like the reference login). */
.login-panel {
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 20px;
  background: color-mix(in srgb, var(--surface) 42%, transparent);
  padding: clamp(28px, 4vw, 48px);
  box-shadow: 0 24px 70px rgba(2,47,127,0.14);
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
}

body[data-theme="dark"] .login-panel {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(10, 24, 42, 0.38);
  box-shadow: 0 24px 70px rgba(0,0,0,0.30);
}

.login-panel::before,
.panel::before,
.metric-card::before {
  display: none;
}

/* p.18 — "Вхід до системи" heading: H3 18-22px / SemiBold 600. */
.login-panel h2 {
  font-size: 1.375rem;
  font-weight: 600;
}

.login-footnote {
  border-color: var(--line);
}

input,
select,
textarea {
  border-color: var(--line-strong);
  border-radius: var(--ua-brand-radius-sm);
  background: var(--surface);
  color: var(--ink);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--ua-brand-blue);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(7,108,253,0.14);
}

.button,
.icon-button {
  border-radius: 10px;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.button:hover:not(:disabled),
.icon-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button-primary {
  border-color: var(--ua-brand-blue);
  background: linear-gradient(135deg, var(--ua-brand-navy), var(--ua-brand-blue));
  color: #fff;
  box-shadow: 0 8px 22px rgba(7,108,253,0.22);
}

.button-primary:hover {
  background: linear-gradient(135deg, #022863, #0562e7);
}

.button-ghost,
.icon-button {
  border-color: var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  color: var(--ink);
}

body[data-theme="dark"] .button-ghost,
body[data-theme="dark"] .icon-button {
  background: rgba(14,39,67,0.78);
}

.app-shell {
  grid-template-columns: 272px minmax(0, 1fr);
}

.sidebar {
  border-right: 1px solid rgba(90,162,253,0.15);
  background:
    radial-gradient(circle at 18% 6%, rgba(7,108,253,0.26), transparent 24rem),
    linear-gradient(168deg, #031a38 0%, #022f7f 55%, #021b48 100%);
  box-shadow: 18px 0 54px rgba(2,47,127,0.14);
}

.main-nav {
  gap: 5px;
  margin-top: 38px;
}

.main-nav button {
  border-radius: 10px;
  color: rgba(255,255,255,0.70);
}

.main-nav button:hover,
.main-nav button.active {
  border-color: rgba(90,162,253,0.45);
  background: linear-gradient(90deg, rgba(7,108,253,0.28), rgba(90,162,253,0.07));
  color: #fff;
  box-shadow: 0 0 12px rgba(255,138,31,0.30);
}

.nav-code {
  color: var(--ua-brand-sky);
}

.main-nav button.active .nav-code {
  color: var(--ua-brand-yellow);
}

/* p.19 "Status first" — the dot carries state, not decoration. */
.status-dot {
  background: var(--ua-brand-success);
  box-shadow: none;
}

.topbar {
  min-height: 86px;
  border-bottom-color: var(--line);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(20px);
}

body[data-theme="dark"] .topbar {
  background: rgba(6,17,31,0.84);
}

/* p.05 — H2 24-30px / SemiBold 600. */
.topbar h1 {
  font-size: clamp(1.5rem, 2vw, 1.875rem);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.identity-block {
  border-right-color: var(--line);
}

.content {
  padding: clamp(22px, 3.5vw, 48px);
}

.section-head h2 {
  color: var(--ink);
  font-size: clamp(1.5rem, 2vw, 1.875rem);
  font-weight: 600;
}

.metric-card,
.panel,
.tree-panel,
.org-node-card,
.quick-item,
.audit-preview-item,
.profile-row {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.metric-card,
.panel,
.tree-panel {
  border-radius: var(--ua-brand-radius);
  box-shadow: var(--shadow-tight);
}

.metric-card {
  overflow: hidden;
}

/* v1.2: accent strips replaced by a glowing border (see GLOW BORDER below). */
.metric-card::after {
  display: none;
  content: none;
}

.metric-card .metric-value {
  color: var(--ua-brand-navy);
}

body[data-theme="dark"] .metric-card .metric-value {
  color: #fff;
}

.metric-card .metric-note {
  color: var(--ua-brand-blue);
}

/* p.05 — H3 18-22px / SemiBold 600. */
.panel-title h3 {
  font-size: clamp(1.125rem, 1.4vw, 1.375rem);
  font-weight: 600;
}

.quick-list,
.audit-preview,
.profile-list {
  gap: 8px;
  background: transparent;
}

.quick-item,
.audit-preview-item,
.profile-row {
  border: 1px solid var(--line);
  border-radius: 10px;
}

.org-node-card {
  border-left: 3px solid var(--ua-brand-blue);
  border-radius: 10px;
  background: var(--surface);
}

.org-node.inactive > .org-node-card {
  background: var(--surface-alt);
}

.status-badge {
  border-radius: 999px;
}

table {
  border-collapse: separate;
  border-spacing: 0;
}

thead th {
  color: var(--muted);
  background: var(--surface-alt);
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

tbody td {
  border-color: var(--line) !important;
}

tbody tr:hover td {
  background: color-mix(in srgb, var(--surface-alt) 72%, var(--ua-brand-sky) 4%);
}

.modal,
dialog.modal {
  border-color: var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 28px 90px rgba(2,47,127,0.22);
}

body[data-theme="dark"] .modal,
body[data-theme="dark"] dialog.modal {
  box-shadow: 0 28px 90px rgba(0,0,0,0.48);
}

.modal-header,
.modal-footer {
  border-color: var(--line) !important;
}

.toast {
  border-radius: 12px;
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-tight);
}

#brand-theme-toggle {
  position: relative;
  overflow: hidden;
}

#brand-theme-toggle .theme-icon {
  width: 18px;
  height: 18px;
}

#brand-theme-toggle .theme-icon-sun { display: none; }
body[data-theme="dark"] #brand-theme-toggle .theme-icon-sun { display: block; }
body[data-theme="dark"] #brand-theme-toggle .theme-icon-moon { display: none; }

.button-danger {
  border-color: var(--ua-brand-danger);
  background: var(--ua-brand-danger);
}

* {
  scrollbar-color: rgba(7,108,253,0.42) transparent;
  scrollbar-width: thin;
}

*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(7,108,253,0.42);
  background-clip: padding-box;
}

body[data-theme="dark"] .metric-card,
body[data-theme="dark"] .panel,
body[data-theme="dark"] .tree-panel,
body[data-theme="dark"] .org-node-card,
body[data-theme="dark"] .quick-item,
body[data-theme="dark"] .audit-preview-item,
body[data-theme="dark"] .profile-row,
body[data-theme="dark"] input,
body[data-theme="dark"] select,
body[data-theme="dark"] textarea {
  background: var(--surface) !important;
  color: var(--ink) !important;
}

body[data-theme="dark"] thead th {
  background: var(--surface-alt) !important;
  color: var(--muted) !important;
}

body[data-theme="dark"] tbody td,
body[data-theme="dark"] tbody tr,
body[data-theme="dark"] table {
  color: var(--ink);
}

body[data-theme="dark"] a {
  color: var(--ua-brand-sky);
}

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 228px minmax(0, 1fr); }
  .sidebar { padding-inline: 14px; }
  .login-layout { grid-template-columns: 1fr; align-items: start; padding-top: 56px; }
  .login-copy { max-width: 760px; }
  .login-panel { max-width: 620px; width: 100%; }
}

@media (max-width: 760px) {
  .login-screen { padding: 22px 18px; }
  .login-copy h1 { font-size: clamp(2.45rem, 12vw, 4.3rem); }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; width: 100%; height: auto; }
  .topbar { position: sticky; padding-inline: 16px; }
  .identity-block { display: none; }
}


/* Compatibility layer for the later legacy UI generations that use !important. */
:root {
  --v4-sidebar: 248px;
  --v4-sidebar-collapsed: 76px;
  --v4-bg: var(--ua-brand-bg);
  --v4-surface: rgba(255,255,255,0.98);
  --v4-surface-soft: rgba(247,249,252,0.98);
  --v4-ink: var(--ua-brand-ink);
  --v4-muted: var(--ua-brand-muted);
  --v4-green: var(--ua-brand-blue);
  --v4-green-strong: var(--ua-brand-navy);
  --v4-green-soft: rgba(7,108,253,0.07);
  --v4-line: rgba(2,47,127,0.10);
  --v4-line-strong: rgba(2,47,127,0.17);
  --v4-shadow: 0 8px 24px rgba(2,47,127,0.055);
  --v4-shadow-soft: 0 3px 12px rgba(2,47,127,0.04);

  --v5-ink: var(--ua-brand-ink);
  --v5-muted: var(--ua-brand-muted);
  --v5-green: var(--ua-brand-blue);
  --v5-green-strong: var(--ua-brand-navy);
  --v5-green-soft: rgba(7,108,253,0.065);
  --v5-line: rgba(2,47,127,0.105);
  --v5-line-soft: rgba(2,47,127,0.065);
  --v5-line-strong: rgba(2,47,127,0.16);
  --v5-shadow: 0 7px 22px rgba(2,47,127,0.045);

  --v7-ink: var(--ua-brand-ink);
  --v7-muted: var(--ua-brand-muted);
  --v7-green: var(--ua-brand-blue);
  --v7-green-soft: #eef5ff;
  --v7-line: rgba(2,47,127,0.10);
  --v7-line-strong: rgba(2,47,127,0.17);
  --v7-surface: var(--ua-brand-surface);
  --v7-surface-soft: var(--ua-brand-surface-alt);
  --v7-shadow: 0 14px 42px rgba(2,47,127,0.10);
}

body[data-theme="dark"] {
  --v4-bg: var(--ua-brand-bg);
  --v4-surface: rgba(11,29,49,0.98);
  --v4-surface-soft: rgba(14,39,67,0.98);
  --v4-ink: var(--ua-brand-ink);
  --v4-muted: var(--ua-brand-muted);
  --v4-green: var(--ua-brand-blue);
  --v4-green-strong: var(--ua-brand-sky);
  --v4-green-soft: rgba(7,108,253,0.13);
  --v4-line: rgba(90,162,253,0.17);
  --v4-line-strong: rgba(90,162,253,0.30);
  --v4-shadow: 0 10px 30px rgba(0,0,0,0.24);
  --v4-shadow-soft: 0 4px 14px rgba(0,0,0,0.20);

  --v5-ink: var(--ua-brand-ink);
  --v5-muted: var(--ua-brand-muted);
  --v5-green: var(--ua-brand-blue);
  --v5-green-strong: var(--ua-brand-sky);
  --v5-green-soft: rgba(7,108,253,0.13);
  --v5-line: rgba(90,162,253,0.17);
  --v5-line-soft: rgba(90,162,253,0.10);
  --v5-line-strong: rgba(90,162,253,0.30);
  --v5-shadow: 0 8px 26px rgba(0,0,0,0.24);

  --v7-ink: var(--ua-brand-ink);
  --v7-muted: var(--ua-brand-muted);
  --v7-green: var(--ua-brand-sky);
  --v7-green-soft: rgba(7,108,253,0.12);
  --v7-line: rgba(90,162,253,0.17);
  --v7-line-strong: rgba(90,162,253,0.30);
  --v7-surface: var(--ua-brand-surface);
  --v7-surface-soft: var(--ua-brand-surface-alt);
  --v7-shadow: 0 14px 42px rgba(0,0,0,0.30);
}

body {
  color: var(--ink) !important;
  background: var(--bg) !important;
}

body[data-theme="dark"] {
  background: linear-gradient(160deg, #06111f 0%, #081a2e 55%, #06111f 100%) !important;
}

.sidebar {
  border-right-color: rgba(90,162,253,0.15) !important;
  background:
    radial-gradient(circle at 18% 6%, rgba(7,108,253,0.26), transparent 24rem),
    linear-gradient(168deg, #031a38 0%, #022f7f 55%, #021b48 100%) !important;
  box-shadow: 18px 0 54px rgba(2,47,127,0.14) !important;
}

.sidebar-brand {
  border-bottom-color: rgba(90,162,253,0.16) !important;
}

.sidebar .ua-brand-product {
  color: #fff !important;
  letter-spacing: -0.02em !important;
}

.sidebar .ua-brand-byline {
  color: rgba(255,255,255,0.66) !important;
}

.main-nav button {
  border-radius: 10px !important;
  color: rgba(255,255,255,0.73) !important;
}

.main-nav button:hover {
  border-color: rgba(90,162,253,0.18) !important;
  background: rgba(7,108,253,0.12) !important;
}

.main-nav button.active {
  border-color: rgba(90,162,253,0.45) !important;
  background: linear-gradient(90deg, rgba(7,108,253,0.34), rgba(90,162,253,0.07)) !important;
  box-shadow: 0 0 12px rgba(255,138,31,0.30) !important;
  color: #fff !important;
}

.nav-code {
  color: var(--ua-brand-sky) !important;
}

.main-nav button.active .nav-code {
  color: var(--ua-brand-yellow) !important;
}

.nav-icon {
  color: rgba(231,241,255,0.90) !important;
}

.topbar {
  border-bottom-color: var(--line) !important;
  background: color-mix(in srgb, var(--surface) 90%, transparent) !important;
  backdrop-filter: blur(20px) !important;
}

body[data-theme="dark"] .topbar {
  background: rgba(6,17,31,0.86) !important;
}

.panel,
.tree-panel,
.filters,
.warehouse-filter-panel,
.warehouse-reference-block,
.org-node-card,
.budget-classification-block,
.login-panel,
.metric-card {
  border-color: var(--line) !important;
  border-radius: var(--ua-brand-radius) !important;
  background: var(--surface) !important;
  color: var(--ink) !important;
  box-shadow: var(--shadow-tight) !important;
}

.metric-card::after {
  display: none !important;
  content: none !important;
}

.login-panel::after,
.panel::after,
.tree-panel::after,
.filters::after,
.warehouse-filter-panel::after,
.warehouse-reference-block::after,
.org-node-card::after,
.budget-classification-block::after {
  display: none !important;
  content: none !important;
}

.button-primary {
  border-color: var(--ua-brand-blue) !important;
  background: linear-gradient(135deg, var(--ua-brand-navy), var(--ua-brand-blue)) !important;
  color: #fff !important;
  box-shadow: 0 8px 22px rgba(7,108,253,0.22) !important;
}

.button-primary:hover {
  background: linear-gradient(135deg, #022863, #0562e7) !important;
}

.button-ghost,
.icon-button,
.sidebar-collapse-button {
  border-color: var(--line) !important;
}

body[data-theme="dark"] .button-ghost,
body[data-theme="dark"] .icon-button {
  background: rgba(14,39,67,0.80) !important;
  color: var(--ink) !important;
}

input,
select,
textarea {
  border-color: var(--line-strong) !important;
  border-radius: var(--ua-brand-radius-sm) !important;
  background: var(--surface) !important;
  color: var(--ink) !important;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--ua-brand-blue) !important;
  box-shadow: 0 0 0 3px rgba(7,108,253,0.14) !important;
}

.status-badge,
.role-tag,
.tag,
.warehouse-tracking-chip,
.v5-status-chip {
  border-color: var(--line-strong) !important;
  color: var(--ua-brand-navy) !important;
}

body[data-theme="dark"] .status-badge,
body[data-theme="dark"] .role-tag,
body[data-theme="dark"] .tag,
body[data-theme="dark"] .warehouse-tracking-chip,
body[data-theme="dark"] .v5-status-chip {
  color: var(--ua-brand-sky) !important;
}

body[data-theme="dark"] .v7-audit-dialog,
body[data-theme="dark"] .v7-audit-drawer,
body[data-theme="dark"] .v7-audit-drawer-head,
body[data-theme="dark"] .v7-audit-drawer-body,
body[data-theme="dark"] .v7-audit-section,
body[data-theme="dark"] .v7-audit-close {
  border-color: var(--line) !important;
  background: var(--surface) !important;
  color: var(--ink) !important;
}

/* Dark-theme corrections for HR and warehouse modules that still contain literal light colors. */
body[data-theme="dark"] .hr-ops-summary,
body[data-theme="dark"] .hr-ops-dashboard > div,
body[data-theme="dark"] .hr-ops-worker,
body[data-theme="dark"] .hr-ops-filters,
body[data-theme="dark"] .hr-ops-task-card,
body[data-theme="dark"] .hr-ops-order-card,
body[data-theme="dark"] .hr-ops-order-grid p,
body[data-theme="dark"] .hr-ops-attachment,
body[data-theme="dark"] .wh-v31-entry,
body[data-theme="dark"] .wh-v31-center,
body[data-theme="dark"] .wh-v31-detail,
body[data-theme="dark"] .wh-v31-hero,
body[data-theme="dark"] .wh-v31-detail > header,
body[data-theme="dark"] .wh-v31-metric,
body[data-theme="dark"] .wh-v31-filters,
body[data-theme="dark"] .wh-v31-tabs,
body[data-theme="dark"] .wh-v31-table-wrap,
body[data-theme="dark"] .wh-v31-footer,
body[data-theme="dark"] .wh-v31-acceptance article,
body[data-theme="dark"] .wh-v31-import-panel,
body[data-theme="dark"] .wh-v31-detail-grid > div,
body[data-theme="dark"] .wh-v31-actions {
  border-color: var(--line) !important;
  background: var(--surface) !important;
  color: var(--ink) !important;
  box-shadow: none !important;
}

body[data-theme="dark"] .hr-ops-dashboard span,
body[data-theme="dark"] .hr-ops-order-grid span,
body[data-theme="dark"] .hr-ops-order-card > footer,
body[data-theme="dark"] .wh-v31-entry small,
body[data-theme="dark"] .wh-v31-hero p,
body[data-theme="dark"] .wh-v31-detail header p,
body[data-theme="dark"] .wh-v31-metric span,
body[data-theme="dark"] .wh-v31-metric small,
body[data-theme="dark"] .wh-v31-detail-grid span,
body[data-theme="dark"] .wh-v31-footer {
  color: var(--muted) !important;
}

body[data-theme="dark"] .hr-ops-dashboard b,
body[data-theme="dark"] .wh-v31-entry strong,
body[data-theme="dark"] .wh-v31-hero h3,
body[data-theme="dark"] .wh-v31-detail h3,
body[data-theme="dark"] .wh-v31-metric strong,
body[data-theme="dark"] .wh-v31-detail-grid strong {
  color: var(--ink) !important;
}

/* ==========================================================
   UA-ERP DARK COMPATIBILITY v3
   Consolidates the production dark-table hotfix and removes
   legacy light surfaces across ERP modules.
   Dark theme only. Print/document paper surfaces are preserved.
   ========================================================== */

body[data-theme="dark"] {
  --ua-dark-surface-0: #0b1d31;
  --ua-dark-surface-1: #10263b;
  --ua-dark-surface-2: #142d45;
  --ua-dark-surface-3: #193751;
  --ua-dark-surface-hover: #214764;
  --ua-dark-text: #f5f8fc;
  --ua-dark-text-muted: #afc1d3;
  --ua-dark-line: rgba(121, 164, 207, 0.20);
  --ua-dark-line-strong: rgba(121, 164, 207, 0.32);
  --ua-dark-danger-bg: rgba(194, 65, 75, 0.12);
  --ua-dark-danger-text: #ffabb3;
  --ua-dark-warning-bg: rgba(253, 199, 4, 0.10);
  --ua-dark-warning-text: #f8d96a;
}

/* Core legacy surfaces. */
body[data-theme="dark"] :is(
  .panel,
  .tree-panel,
  .filters,
  .quick-item,
  .audit-preview-item,
  .profile-row,
  .org-node-card,
  .budget-classification-block,
  .metric-card,
  .warehouse-kpi,
  .empty-state,
  .loading-state,
  .error-state,
  .toast,
  .checkbox-item
) {
  background: var(--ua-dark-surface-0) !important;
  color: var(--ua-dark-text) !important;
  border-color: var(--ua-dark-line) !important;
}

body[data-theme="dark"] :is(.modal, dialog.modal) {
  background: var(--ua-dark-surface-0) !important;
  color: var(--ua-dark-text) !important;
  border-color: var(--ua-dark-line-strong) !important;
}

body[data-theme="dark"] :is(.modal-header, .modal-footer) {
  background: var(--ua-dark-surface-1) !important;
  color: var(--ua-dark-text) !important;
  border-color: var(--ua-dark-line) !important;
}

/* Inputs and generic controls from legacy modules. */
body[data-theme="dark"] :is(input, select, textarea) {
  background: var(--ua-dark-surface-1) !important;
  color: var(--ua-dark-text) !important;
  border-color: var(--ua-dark-line-strong) !important;
}

body[data-theme="dark"] :is(input, select, textarea)::placeholder {
  color: #8fa5ba !important;
}

/* Consolidated dark table system (production hotfix v2 + v3). */
body[data-theme="dark"] table {
  background: var(--ua-dark-surface-2) !important;
  color: var(--ua-dark-text) !important;
  border-color: var(--ua-dark-line) !important;
}

body[data-theme="dark"] table thead,
body[data-theme="dark"] table thead tr,
body[data-theme="dark"] table thead th {
  background: #0f2e4a !important;
  color: #f7faff !important;
  border-color: var(--ua-dark-line-strong) !important;
}

body[data-theme="dark"] table tbody tr,
body[data-theme="dark"] table tbody tr:nth-child(odd) {
  background: var(--ua-dark-surface-2) !important;
}

body[data-theme="dark"] table tbody tr:nth-child(even) {
  background: #172f47 !important;
}

body[data-theme="dark"] table tbody td {
  background: transparent !important;
  color: var(--ua-dark-text) !important;
  border-color: var(--ua-dark-line) !important;
}

body[data-theme="dark"] table tbody tr:hover,
body[data-theme="dark"] table tbody tr:hover td {
  background: var(--ua-dark-surface-hover) !important;
  color: #ffffff !important;
}

body[data-theme="dark"] table tfoot,
body[data-theme="dark"] table tfoot tr,
body[data-theme="dark"] table tfoot th,
body[data-theme="dark"] table tfoot td {
  background: #102a42 !important;
  color: var(--ua-dark-text) !important;
  border-color: var(--ua-dark-line-strong) !important;
}

body[data-theme="dark"] table tbody td :is(small, .muted, .secondary, .meta, .subtle, .hint),
body[data-theme="dark"] table tfoot :is(small, .muted, .secondary, .meta, .subtle, .hint) {
  color: var(--ua-dark-text-muted) !important;
}

body[data-theme="dark"] table tbody td a:not(.button) {
  color: #bcd8ff !important;
}

/* Table statuses and actions retain semantic accents. */
body[data-theme="dark"] table :is(.status-badge, .role-tag, .tag, .v5-status-chip) {
  background: rgba(7, 108, 253, 0.10) !important;
  border-color: rgba(90, 162, 253, 0.35) !important;
  color: #69adff !important;
}

body[data-theme="dark"] table :is(
  .status-badge.inactive,
  .status-badge.cancelled,
  .status-badge.closed,
  .status-badge.blocked,
  .accounting-status-reversed,
  .v5-status-danger
) {
  background: var(--ua-dark-danger-bg) !important;
  border-color: rgba(235, 115, 125, 0.40) !important;
  color: var(--ua-dark-danger-text) !important;
}

body[data-theme="dark"] table :is(
  .cell-actions .button,
  .cell-actions button,
  td > .button,
  td > button
) {
  background: #284761 !important;
  border-color: rgba(121, 164, 207, 0.30) !important;
  color: #f7fbff !important;
}

body[data-theme="dark"] table :is(
  .cell-actions .button:hover,
  .cell-actions button:hover,
  td > .button:hover,
  td > button:hover
) {
  background: #365d7e !important;
  border-color: rgba(141, 187, 232, 0.46) !important;
  color: #ffffff !important;
}

/* Accounting: eliminate remaining white first-column / totals islands. */
body[data-theme="dark"] .accounting-trial-table :is(th:first-child, td:first-child) {
  background: var(--ua-dark-surface-1) !important;
  color: var(--ua-dark-text) !important;
}

body[data-theme="dark"] .accounting-trial-table tfoot th,
body[data-theme="dark"] .accounting-trial-table tfoot td {
  background: #102a42 !important;
  color: var(--ua-dark-text) !important;
}

body[data-theme="dark"] .accounting-trial-table :is(a, .text-button) {
  background: transparent !important;
  color: #d8eaff !important;
}

/* Audit drawer. */
body[data-theme="dark"] .v7-audit-dialog,
body[data-theme="dark"] .v7-audit-drawer-head,
body[data-theme="dark"] .v7-audit-drawer-body,
body[data-theme="dark"] .v7-audit-section,
body[data-theme="dark"] .v7-technical-details {
  background: var(--ua-dark-surface-0) !important;
  color: var(--ua-dark-text) !important;
  border-color: var(--ua-dark-line) !important;
}

body[data-theme="dark"] .v7-audit-section h3 {
  background: var(--ua-dark-surface-1) !important;
  color: var(--ua-dark-text) !important;
  border-color: var(--ua-dark-line) !important;
}

body[data-theme="dark"] .v7-audit-close {
  background: var(--ua-dark-surface-1) !important;
  color: var(--ua-dark-text) !important;
  border-color: var(--ua-dark-line-strong) !important;
}

body[data-theme="dark"] .v7-technical-json {
  background: #071827 !important;
  color: #d7e6f5 !important;
  border-color: var(--ua-dark-line) !important;
}

/* Organization staffing. */
body[data-theme="dark"] :is(
  .staff-v29-dashboard > div,
  .staff-v29-section,
  .staff-v29-section > summary,
  .staff-v29-section > summary span,
  .staff-v29-edition,
  .staff-v29-slot,
  .staff-v29-unit,
  .staff-v29-occupant,
  .staff-v29-issue
) {
  background: var(--ua-dark-surface-1) !important;
  color: var(--ua-dark-text) !important;
  border-color: var(--ua-dark-line) !important;
}

body[data-theme="dark"] .staff-v29-dashboard .is-ready {
  background: rgba(7, 108, 253, 0.10) !important;
}

body[data-theme="dark"] :is(.staff-v29-acceptance, .staff-v29-status.is-vacant, .staff-v29-status.is-draft, .staff-v29-status.is-approved, .staff-v29-issue.is-warning) {
  background: var(--ua-dark-warning-bg) !important;
  color: var(--ua-dark-warning-text) !important;
}

body[data-theme="dark"] :is(.staff-v29-issue.is-error) {
  background: var(--ua-dark-danger-bg) !important;
  color: var(--ua-dark-danger-text) !important;
}

body[data-theme="dark"] .staff-v29-slot.is-frozen {
  background: #202c38 !important;
}

/* HR / personnel. */
body[data-theme="dark"] :is(
  .hr-ops-dashboard > div,
  .hr-ops-task-card,
  .hr-ops-order-card,
  .hr-ops-attachment,
  .hr-ops-tasks > header span,
  .hr-ops-journal > header span,
  .hr-ops-badges span,
  .hr-ops-order-counters span
) {
  background: var(--ua-dark-surface-1) !important;
  color: var(--ua-dark-text) !important;
  border-color: var(--ua-dark-line) !important;
}

body[data-theme="dark"] .hr-ops-dashboard .is-ready {
  background: rgba(7, 108, 253, 0.10) !important;
}

body[data-theme="dark"] :is(.hr-ops-worker.is-error, .hr-ops-attachment.is-revoked) {
  background: var(--ua-dark-danger-bg) !important;
}

body[data-theme="dark"] .hr-ops-badges .is-task {
  background: var(--ua-dark-warning-bg) !important;
  color: var(--ua-dark-warning-text) !important;
}

/* Warehouse operations v30. */
body[data-theme="dark"] :is(
  .wh-v30-center,
  .wh-v30-metric,
  .wh-v30-table-wrap,
  .wh-v30-card,
  .wh-v30-detail-grid p,
  .wh-v30-location,
  .wh-v30-issue
) {
  background: var(--ua-dark-surface-1) !important;
  color: var(--ua-dark-text) !important;
  border-color: var(--ua-dark-line) !important;
}

body[data-theme="dark"] .wh-v30-filters :is(input, select) {
  background: var(--ua-dark-surface-1) !important;
  color: var(--ua-dark-text) !important;
  border-color: var(--ua-dark-line-strong) !important;
}

body[data-theme="dark"] .wh-v30-status.is-warning {
  background: var(--ua-dark-warning-bg) !important;
  color: var(--ua-dark-warning-text) !important;
}

body[data-theme="dark"] .wh-v30-status.is-bad {
  background: var(--ua-dark-danger-bg) !important;
  color: var(--ua-dark-danger-text) !important;
}

/* Warehouse document lifecycle v31. */
body[data-theme="dark"] :is(
  .wh-v31-center,
  .wh-v31-detail,
  .wh-v31-filters,
  .wh-v31-tabs,
  .wh-v31-table-wrap,
  .wh-v31-footer,
  .wh-v31-acceptance article,
  .wh-v31-detail-grid > div,
  .wh-v31-actions,
  .wh-v31-two-column > section,
  .wh-v31-history article
) {
  background: var(--ua-dark-surface-1) !important;
  color: var(--ua-dark-text) !important;
  border-color: var(--ua-dark-line) !important;
}

body[data-theme="dark"] .wh-v31-filters :is(input, select),
body[data-theme="dark"] :is(.wh-v31-lines-field textarea, .wh-v31-file-field input, .wh-v31-form input, .wh-v31-form select, .wh-v31-attachment-upload input) {
  background: var(--ua-dark-surface-1) !important;
  color: var(--ua-dark-text) !important;
  border-color: var(--ua-dark-line-strong) !important;
}

/* Payroll. */
body[data-theme="dark"] :is(
  .payroll-policy-note,
  .payroll-message,
  .payroll-detail-summary,
  .payroll-integration-panel,
  .payroll-transfer-summary,
  .payroll-payment-order-panel,
  .payroll-report-status-list > div
) {
  background: var(--ua-dark-surface-1) !important;
  color: var(--ua-dark-text) !important;
  border-color: var(--ua-dark-line) !important;
}

body[data-theme="dark"] .payroll-filters select {
  background: var(--ua-dark-surface-1) !important;
  color: var(--ua-dark-text) !important;
  border-color: var(--ua-dark-line-strong) !important;
}

body[data-theme="dark"] .payroll-table td {
  background: var(--ua-dark-surface-2) !important;
  color: var(--ua-dark-text) !important;
}

body[data-theme="dark"] .payroll-table tbody tr:nth-child(even) td {
  background: #172f47 !important;
}

body[data-theme="dark"] .payroll-message.is-error,
body[data-theme="dark"] .payroll-integration-panel.is-error {
  background: var(--ua-dark-danger-bg) !important;
  color: var(--ua-dark-danger-text) !important;
}

/* Treasury. */
body[data-theme="dark"] :is(
  .treasury-connection-step-grid > div,
  .treasury-checkbox,
  .treasury-secret-row,
  .treasury-connection-note,
  .treasury-path-grid > div,
  .treasury-connection-result,
  .treasury-import-result-grid > div
) {
  background: var(--ua-dark-surface-1) !important;
  color: var(--ua-dark-text) !important;
  border-color: var(--ua-dark-line) !important;
}

body[data-theme="dark"] .treasury-import-panel input[type="file"] {
  background: var(--ua-dark-surface-1) !important;
  color: var(--ua-dark-text) !important;
  border-color: var(--ua-dark-line-strong) !important;
}

body[data-theme="dark"] .treasury-connection-result.is-error,
body[data-theme="dark"] .treasury-import-result-grid > div.is-error {
  background: var(--ua-dark-danger-bg) !important;
}

/* Financial control center. */
body[data-theme="dark"] :is(
  .financial-control-summary article,
  .financial-control-connection,
  .financial-control-issues > div
) {
  background: var(--ua-dark-surface-1) !important;
  color: var(--ua-dark-text) !important;
  border-color: var(--ua-dark-line) !important;
}

body[data-theme="dark"] .financial-control-summary :is(span, small),
body[data-theme="dark"] .financial-control-connection :is(span, p),
body[data-theme="dark"] .financial-control-table td small {
  color: var(--ua-dark-text-muted) !important;
}

body[data-theme="dark"] .financial-control-summary strong,
body[data-theme="dark"] .financial-control-connection strong,
body[data-theme="dark"] .financial-control-issues strong,
body[data-theme="dark"] .financial-control-table code {
  color: var(--ua-dark-text) !important;
}

body[data-theme="dark"] .financial-control-table th {
  background: #0f2e4a !important;
  color: var(--ua-dark-text) !important;
}

/* Semantic legacy status blocks. */
body[data-theme="dark"] :is(.core-status-submitted, .core-status-warning) {
  background: var(--ua-dark-warning-bg) !important;
  color: var(--ua-dark-warning-text) !important;
}

body[data-theme="dark"] :is(.core-status-rejected, .core-status-cancelled) {
  background: var(--ua-dark-danger-bg) !important;
  color: var(--ua-dark-danger-text) !important;
}

/* Print/document previews intentionally remain paper-white. */
body[data-theme="dark"] .clerical-m39-sheet {
  background: #ffffff !important;
  color: #000000 !important;
}

@media print {
  .clerical-m39-sheet {
    background: #ffffff !important;
    color: #000000 !important;
  }
}

/* ==========================================================
   BRAND SYSTEM v1.2 — TYPOGRAPHY SCALE (p.05)
   H1 32-40/700 · H2 24-30/600 · H3 18-22/600
   Body 14-16/400 · Label 11-12/500 · Meta 9-10/500
   ========================================================== */
body {
  font-size: 15px;
  font-weight: 400;
  line-height: 1.55;
}

label span,
label > span,
.form-label,
input,
select,
textarea {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

input,
select,
textarea {
  font-size: 14px;
  font-weight: 400;
}

.meta,
small,
.hint,
.subtle {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

thead th {
  font-size: 11px !important;
  font-weight: 500 !important;
}

/* ==========================================================
   BRAND SYSTEM v1.2 — STATUS SYSTEM (p.12)
   ACTIVE · PENDING · ERROR — "колір = стан, не декор" (p.19)
   ========================================================== */
.status-badge {
  border: 1px solid rgba(22, 155, 98, 0.35) !important;
  border-radius: 999px !important;
  background: rgba(22, 155, 98, 0.12) !important;
  color: #0e7a4b !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.status-badge.warning,
.status-badge.is-warning,
.status-badge[class*="draft"],
.status-badge[class*="pending"],
.status-badge[class*="submitted"],
.status-badge[class*="progress"],
.status-badge[class*="review"] {
  border-color: rgba(253, 199, 4, 0.50) !important;
  background: rgba(253, 199, 4, 0.16) !important;
  color: #7d6104 !important;
}

.status-badge.inactive,
.status-badge.is-bad,
.status-badge[class*="rejected"],
.status-badge[class*="cancelled"],
.status-badge[class*="canceled"],
.status-badge[class*="reversed"],
.status-badge[class*="closed"],
.status-badge[class*="blocked"],
.status-badge[class*="error"],
.status-badge[class*="revoked"],
.status-badge[class*="superseded"] {
  border-color: rgba(194, 65, 75, 0.35) !important;
  background: rgba(194, 65, 75, 0.12) !important;
  color: #b0323c !important;
}

.status-chip.is-good {
  border-color: rgba(22, 155, 98, 0.35) !important;
  background: rgba(22, 155, 98, 0.12) !important;
  color: #0e7a4b !important;
}

.status-chip.is-warning {
  border-color: rgba(253, 199, 4, 0.50) !important;
  background: rgba(253, 199, 4, 0.16) !important;
  color: #7d6104 !important;
}

.status-chip.is-bad {
  border-color: rgba(194, 65, 75, 0.35) !important;
  background: rgba(194, 65, 75, 0.12) !important;
  color: #b0323c !important;
}

body[data-theme="dark"] .status-badge,
body[data-theme="dark"] .status-chip.is-good {
  border-color: rgba(22, 155, 98, 0.45) !important;
  background: rgba(22, 155, 98, 0.16) !important;
  color: #5fd6a2 !important;
}

body[data-theme="dark"] .status-badge.warning,
body[data-theme="dark"] .status-badge.is-warning,
body[data-theme="dark"] .status-badge[class*="draft"],
body[data-theme="dark"] .status-badge[class*="pending"],
body[data-theme="dark"] .status-badge[class*="submitted"],
body[data-theme="dark"] .status-badge[class*="progress"],
body[data-theme="dark"] .status-badge[class*="review"],
body[data-theme="dark"] .status-chip.is-warning {
  border-color: rgba(253, 199, 4, 0.45) !important;
  background: rgba(253, 199, 4, 0.14) !important;
  color: #f8d96a !important;
}

body[data-theme="dark"] .status-badge.inactive,
body[data-theme="dark"] .status-badge.is-bad,
body[data-theme="dark"] .status-badge[class*="rejected"],
body[data-theme="dark"] .status-badge[class*="cancelled"],
body[data-theme="dark"] .status-badge[class*="canceled"],
body[data-theme="dark"] .status-badge[class*="reversed"],
body[data-theme="dark"] .status-badge[class*="closed"],
body[data-theme="dark"] .status-badge[class*="blocked"],
body[data-theme="dark"] .status-badge[class*="error"],
body[data-theme="dark"] .status-badge[class*="revoked"],
body[data-theme="dark"] .status-badge[class*="superseded"],
body[data-theme="dark"] .status-chip.is-bad {
  border-color: rgba(235, 115, 125, 0.45) !important;
  background: rgba(194, 65, 75, 0.18) !important;
  color: #ffabb3 !important;
}

/* ==========================================================
   BRAND SYSTEM v1.2 — VERTICAL LABEL (p.07, p.15)
   "Назва вертикалі завжди додається після UA-ERP.
    Фірмовий знак і підпис by WEBHVA залишаються незмінними."
   ========================================================== */
.ua-brand-product {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ua-brand-vertical {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--ua-brand-line-strong);
  border-radius: 999px;
  color: var(--ua-brand-navy);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  line-height: 1.6;
}

.sidebar .ua-brand-vertical,
body[data-theme="dark"] .login-brand .ua-brand-vertical {
  border-color: rgba(255, 255, 255, 0.32);
  color: rgba(255, 255, 255, 0.82);
}

/* ==========================================================
   BRAND SYSTEM v1.2 — YELLOW DISCIPLINE (p.10)
   Yellow ≤ 10-15% of the composition: active-nav accent,
   focus ring and the firm gradient strip only.
   ========================================================== */
.metric-card::after {
  display: none !important;
  content: none !important;
}

::selection {
  background: rgba(7, 108, 253, 0.22);
}

/* ==========================================================
   BRAND SYSTEM v1.2 — LOGIN GLASS (p.18)
   The auth card stays transparent so the photo reads through.
   Declared last with !important: legacy layers force opaque surfaces.
   ========================================================== */
.login-panel {
  border: 1px solid rgba(255, 255, 255, 0.55) !important;
  border-radius: 20px !important;
  background: color-mix(in srgb, var(--surface) 42%, transparent) !important;
  box-shadow: 0 24px 70px rgba(2, 47, 127, 0.14) !important;
  backdrop-filter: blur(14px) saturate(1.15) !important;
  -webkit-backdrop-filter: blur(14px) saturate(1.15) !important;
}

body[data-theme="dark"] .login-panel {
  border-color: rgba(255, 255, 255, 0.16) !important;
  background: rgba(10, 24, 42, 0.38) !important;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.30) !important;
}

.login-panel input {
  border-color: rgba(2, 47, 127, 0.18) !important;
  background: rgba(255, 255, 255, 0.58) !important;
  color: var(--ink) !important;
}

body[data-theme="dark"] .login-panel input {
  border-color: rgba(255, 255, 255, 0.22) !important;
  background: rgba(255, 255, 255, 0.10) !important;
  color: #ffffff !important;
}

body[data-theme="dark"] .login-panel input::placeholder {
  color: rgba(255, 255, 255, 0.45) !important;
}

body[data-theme="dark"] .login-panel input:focus {
  border-color: rgba(90, 162, 253, 0.65) !important;
  box-shadow: 0 0 0 3px rgba(90, 162, 253, 0.18) !important;
}

/* ==========================================================
   BRAND SYSTEM v1.2 — CONTRAST FIXES
   Staff v2.9 summary banner ships a hardcoded light surface;
   in Dark theme its text turned white on white. Theme parity (p.16).
   ========================================================== */
.staff-v29-summary {
  border-color: var(--line) !important;
  background: var(--surface) !important;
  color: var(--ink) !important;
}

.staff-v29-summary strong {
  color: var(--ink) !important;
}

.staff-v29-summary small {
  color: var(--muted) !important;
}

/* ==========================================================
   BRAND SYSTEM v1.2 — THEME PARITY AUDIT (29.10.2026)
   51 module surfaces ship hardcoded light backgrounds without
   dark overrides — white text on white in Dark theme. All are
   driven from theme tokens now (p.16 "Light/Dark рівноправні").
   ========================================================== */
.staff-v29-filters,
.staff-v29-slot-grid p,
.person-master-summary,
.person-lifecycle-summary,
.person-lifecycle-grid > div,
.person-lifecycle-section,
.person-governance-summary,
.person-governance-toolbar,
.person-governance-section,
.person-governance-directory > button,
.person-governance-person-head,
.person-coverage-summary,
.person-coverage-dashboard > div,
.person-coverage-person-head,
.person-coverage-module,
.person-hr-history-summary,
.person-hr-history-dashboard > div,
.person-hr-history-note,
.person-hr-event,
.person-hr-event-basis,
.person-hr-person-head,
.person-hr-order-summary,
.person-hr-order-dashboard > div,
.person-hr-order-note,
.person-hr-order-card,
.person-hr-order-basis,
.warehouse-kpis,
.warehouse-alert-panel,
.treasury-connection-status-card,
.treasury-payment-summary article,
.treasury-payment-status,
.treasury-import-status,
.payroll-reports-summary article,
.payroll-report-export-grid article,
.wh-v31-accounting,
.wh-v30-entry,
.wh-v30-hero,
.wh-v30-panel,
.table-wrap {
  background: var(--surface) !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
}

.person-lifecycle-metrics,
.person-lifecycle-metrics span,
.person-governance-metrics span,
.person-governance-dashboard > div,
.person-governance-usage-grid,
.person-governance-section-head,
.person-hr-history-summary-metrics span,
.person-hr-order-summary-metrics span,
.person-hr-order-grid p,
.person-hr-event-grid p,
.person-hr-order-badges span,
.staff-v29-manning-row:nth-child(even),
.person-coverage-directory > button:hover,
.person-governance-directory > button:hover {
  background: var(--surface-alt) !important;
  color: var(--ink) !important;
}

.person-governance-issues .is-warning {
  background: var(--warning-soft) !important;
  color: var(--warning) !important;
}

.person-governance-issues .is-error,
.payroll-list-row.is-reversal {
  background: var(--danger-soft) !important;
  color: var(--danger) !important;
}

.main-nav .nav-fixed-assets-link:hover,
.main-nav .nav-fixed-assets-link:focus {
  background: rgba(7, 108, 253, 0.16) !important;
  color: #ffffff !important;
}

/* ==========================================================
   BRAND SYSTEM v1.2 — STRUCTURE PAGE: PROCESS FLOW BLOCKS
   Two columns per step: who acts / which documents flow.
   ========================================================== */
.fs-intro {
  margin-bottom: 14px;
}

.fs-head {
  display: grid;
  grid-template-columns: 44px 1fr 44px 1fr;
  gap: 12px;
  margin: 0 0 8px;
}

.fs-head > div {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--muted);
}

.fs-head > div:first-child { grid-column: 2; }
.fs-head > div:last-child { grid-column: 4; }

.flow-steps {
  display: grid;
  gap: 0;
}

.fs-row {
  display: grid;
  grid-template-columns: 44px 1fr 44px 1fr;
  gap: 12px;
  align-items: stretch;
}

.fs-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--ua-brand-navy);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
}

.fs-side {
  border: 1px solid rgba(90, 162, 253, 0.30);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  padding: 12px 14px;
  display: grid;
  gap: 4px;
  align-content: start;
  box-shadow: 0 0 14px rgba(255, 138, 31, 0.16);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.fs-side:hover {
  border-color: rgba(90, 162, 253, 0.50);
  box-shadow: 0 0 22px rgba(255, 138, 31, 0.26);
}

.fs-side b {
  font-size: 14px;
  color: var(--ink);
}

.fs-side span {
  font-size: 12.5px;
  color: var(--muted);
}

.fs-who-name {
  color: var(--ua-brand-blue) !important;
  font-weight: 600;
}

.fs-where {
  margin-top: 4px;
  font-size: 11px !important;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted) !important;
}

.fs-arrow {
  align-self: center;
  text-align: center;
  color: var(--muted);
  font-size: 18px;
  font-weight: 700;
}

.fs-down {
  text-align: center;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.2;
  padding: 2px 0;
}

.fs-result {
  margin-top: 14px;
  border: 1px solid rgba(90, 162, 253, 0.30);
  border-radius: 12px;
  background: var(--green-soft);
  color: var(--ink);
  padding: 14px 16px;
  font-size: 14px;
  box-shadow: 0 0 14px rgba(255, 138, 31, 0.16);
}

.fs-result b {
  color: var(--ink);
}

.fs-chain {
  margin: 26px 0 4px;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}

.fs-chain-hint {
  margin: 0 0 10px;
}

@media (max-width: 900px) {
  .fs-head { display: none; }
  .fs-row { grid-template-columns: 34px 1fr; }
  .fs-arrow { display: none; }
  .fs-docs { grid-column: 2; }
}

/* ==========================================================
   BRAND SYSTEM v1.2 — GLOW BORDER (заміна кольорових смуг)
   Блоки виділяються м'якою підсвіткою бордера, а не смугою.
   ========================================================== */
.metric-card,
.panel,
.tree-panel,
.org-node-card,
.quick-item,
.audit-preview-item,
.profile-row,
.staff-v29-summary,
.staff-v29-section,
.staff-v29-slot,
.staff-v29-unit,
.person-master-summary,
.person-lifecycle-summary,
.person-governance-summary,
.person-coverage-summary,
.person-hr-history-summary,
.person-hr-order-summary,
.warehouse-kpis,
.wh-v30-panel,
.wh-v31-center,
.payroll-detail-summary,
.treasury-connection-status-card,
.financial-control-summary article {
  border: 1px solid rgba(90, 162, 253, 0.30) !important;
  box-shadow: 0 0 14px rgba(255, 138, 31, 0.16) !important;
}

.metric-card:hover,
.panel:hover,
.tree-panel:hover,
.org-node-card:hover,
.staff-v29-section:hover,
.person-master-summary:hover,
.person-lifecycle-summary:hover,
.person-governance-summary:hover,
.person-coverage-summary:hover,
.person-hr-history-summary:hover,
.person-hr-order-summary:hover {
  border-color: rgba(90, 162, 253, 0.50) !important;
  box-shadow: 0 0 22px rgba(255, 138, 31, 0.26) !important;
}

