@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@500;600;700;800&display=swap");

/* ==========================================================================
   Energoone Brand Tokens
   Цвета, радиусы и типографика из нового брендбука. Этот файл является
   основным CSS-файлом пользовательского интерфейса сервиса.
   ========================================================================== */

:root {
  --navy: #071426;
  --navy-2: #10294f;
  --deep-ink: #061120;
  --login-blue: #14325e;
  --brand-blue: #2f86ff;
  --brand-blue-soft: #75c8ff;
  --auth-gradient: linear-gradient(135deg, #14325e 0%, #071426 55%, #061120 100%);
  --prestige-dark: linear-gradient(180deg, #101c31 0%, #081324 100%);
  --bg: #F5F7FA;
  --surface: #ffffff;
  --surface-soft: #F5F7FA;
  --surface-code: #EEF3FA;
  --text: #081324;
  --heading: #081324;
  --muted: #6B7280;
  --muted-strong: #3F4A5C;
  --line: #E5EAF1;
  --line-strong: #D3DCE8;
  --accent: #2f86ff;
  --accent-soft: #EAF3FF;
  --green-bg: #e7f7ed;
  --green-line: #91d7ac;
  --blue-bg: #e6f3ff;
  --blue-line: #93c5fd;
  --pink-bg: #fde8ee;
  --pink-line: #f4a7bb;
  --red-bg: #fee2e2;
  --red-line: #ef4444;
  --orange-bg: #fff1d6;
  --orange-line: #f2c46d;
  --radius: 8px;
  --font: "Manrope", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --mono-font-family: var(--mono);
}

:root[data-theme="dark"] {
  --bg: #081324;
  --surface: #101C2F;
  --surface-soft: #14233A;
  --surface-code: #101C2F;
  --text: #F5F7FA;
  --heading: #ffffff;
  --muted: rgba(245, 247, 250, 0.66);
  --muted-strong: rgba(245, 247, 250, 0.82);
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.18);
  --accent: #2f86ff;
  --accent-soft: rgba(47, 134, 255, 0.16);
  --green-bg: #102619;
  --green-line: #2f8f55;
  --blue-bg: #102236;
  --blue-line: #3b82f6;
  --pink-bg: #321722;
  --pink-line: #d85b7d;
  --red-bg: #351616;
  --red-line: #ef4444;
  --orange-bg: #33240f;
  --orange-line: #c98514;
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-emphasis-color: var(--heading);
  --bs-secondary-color: var(--muted);
  --bs-border-color: var(--line);
}

/* ==========================================================================
   Base Layout
   Базовая сетка, фон приложения и типографика.
   ========================================================================== */

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: 0;
}

:root[data-theme="dark"] body {
  background:
    radial-gradient(circle at 20% 12%, rgba(47, 134, 255, 0.18), transparent 34%),
    radial-gradient(circle at 84% 75%, rgba(47, 134, 255, 0.10), transparent 32%),
    var(--bg);
}

/* ==========================================================================
   Auth Screen
   Страница входа в стиле текущего экрана из брендбука: Auth gradient,
   светлая стеклянная карточка и логотип Energoone для светлого фона.
   ========================================================================== */

.auth-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  background:
    radial-gradient(circle at 22% 18%, rgba(47, 134, 255, 0.28), transparent 30%),
    var(--auth-gradient);
}

.auth-page .app-header {
  display: none;
}

.auth-page .app-main {
  width: min(100%, 520px);
  padding: 28px;
}

a {
  color: var(--text);
  text-decoration: none;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--text);
  text-decoration: underline;
}

/* ==========================================================================
   Header And Navigation
   Темная навигация Prestige dark с логотипом Energoone для dark header.
   ========================================================================== */

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid #e1e8f2;
  background: #ffffff;
  backdrop-filter: blur(12px);
}

:root[data-theme="dark"] .app-header {
  background: var(--prestige-dark);
  border-bottom: 0;
}

.app-header-inner {
  width: min(100%, 1480px);
  margin: 0 auto;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.app-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(100%, 1480px);
  margin: 0 auto;
  padding: 10px 28px 12px;
  border-top: 1px solid #e5edf6;
  color: #667085;
  font-size: 11px;
  line-height: 18px;
}

:root[data-theme="dark"] .app-breadcrumbs {
  border-top-color: rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.62);
}

.app-breadcrumbs a,
.app-breadcrumbs span {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  color: #667085;
  white-space: nowrap;
}

:root[data-theme="dark"] .app-breadcrumbs a,
:root[data-theme="dark"] .app-breadcrumbs span {
  color: rgba(255, 255, 255, 0.62);
}

.app-breadcrumbs a:hover {
  color: var(--navy);
  text-decoration: none;
}

:root[data-theme="dark"] .app-breadcrumbs a:hover {
  color: #ffffff;
}

.app-breadcrumbs a + a::before,
.app-breadcrumbs a + span::before,
.app-breadcrumbs span + span::before,
.app-breadcrumbs span + a::before {
  content: "/";
  margin-right: 8px;
  color: #b8c4d4;
}

:root[data-theme="dark"] .app-breadcrumbs a + a::before,
:root[data-theme="dark"] .app-breadcrumbs a + span::before,
:root[data-theme="dark"] .app-breadcrumbs span + span::before,
:root[data-theme="dark"] .app-breadcrumbs span + a::before {
  color: rgba(255, 255, 255, 0.28);
}

.brand-stack {
  display: flex;
  align-items: center;
  gap: 22px;
  min-width: 0;
}

.app-title {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--navy);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.brand-logo {
  display: block;
  height: auto;
}

.app-title .brand-logo {
  width: 174px;
  max-width: 32vw;
}

.brand-logo-dark,
.app-title .brand-logo-dark {
  display: none;
}

.app-title .brand-logo-light {
  display: block;
}

:root[data-theme="dark"] .brand-logo-light {
  display: none;
}

:root[data-theme="dark"] .brand-logo-dark {
  display: block;
}

.app-title:hover {
  text-decoration: none;
}

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0;
}

.nav > a,
.nav-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid rgba(47, 134, 255, .14);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .9), rgba(238, 246, 255, .66)),
    #f7fbff;
  color: #34425a;
  font-size: 14px;
  font-weight: 700;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .9),
    0 8px 18px rgba(16, 41, 79, .06);
}

.nav-link-btn {
  line-height: 20px;
}

.nav-link-btn:hover,
.nav-link-btn:focus {
  border-color: rgba(47, 134, 255, .28);
  background:
    linear-gradient(180deg, #ffffff, #eaf4ff),
    #eef7ff;
  color: #17395c;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .95),
    0 10px 24px rgba(47, 134, 255, .12);
}

.nav > a:hover,
.nav > a:focus {
  border-color: rgba(47, 134, 255, .28);
  background:
    linear-gradient(180deg, #ffffff, #eaf4ff),
    #eef7ff;
  color: #17395c;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .95),
    0 10px 24px rgba(47, 134, 255, .12);
}

:root[data-theme="dark"] .nav > a,
:root[data-theme="dark"] .nav-link-btn {
  border-color: rgba(117, 200, 255, .12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .025)),
    rgba(255, 255, 255, .035);
  color: rgba(255, 255, 255, .78);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .08),
    0 10px 22px rgba(0, 0, 0, .12);
}

:root[data-theme="dark"] .nav > a:hover,
:root[data-theme="dark"] .nav-link-btn:hover,
:root[data-theme="dark"] .nav-link-btn:focus {
  border-color: rgba(117, 200, 255, .28);
  background:
    linear-gradient(180deg, rgba(47, 134, 255, .18), rgba(255, 255, 255, .055)),
    rgba(47, 134, 255, .10);
  color: #ffffff;
}

.dropdown-menu {
  min-width: 220px;
  padding: 8px 14px;
  border: 1px solid rgba(184, 211, 242, .78);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(248, 251, 255, .94)),
    #ffffff;
  box-shadow:
    0 24px 58px rgba(16, 24, 40, .16),
    inset 0 1px 0 rgba(255, 255, 255, .96);
  backdrop-filter: blur(18px) saturate(1.08);
}

:root[data-theme="dark"] .dropdown-menu {
  border-color: rgba(117, 200, 255, .16);
  background:
    linear-gradient(180deg, rgba(28, 42, 66, .96), rgba(8, 19, 36, .96)),
    #101C2F;
  box-shadow:
    0 24px 58px rgba(0, 0, 0, .34),
    inset 0 1px 0 rgba(255, 255, 255, .08);
}

.dropdown-item {
  position: relative;
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 0;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: #172033;
  font-size: 13px;
  font-weight: 800;
  box-shadow: none !important;
}

.dropdown-menu li {
  border-bottom: 1px solid rgba(184, 211, 242, .58);
}

.dropdown-menu li:last-child {
  border-bottom: 0;
}

.dropdown-item:hover,
.dropdown-item:focus {
  background: transparent !important;
  color: var(--brand-blue);
  text-decoration: none;
}

:root[data-theme="dark"] .dropdown-item {
  color: rgba(255, 255, 255, 0.82);
}

:root[data-theme="dark"] .dropdown-menu li {
  border-bottom-color: rgba(255, 255, 255, 0.10);
}

:root[data-theme="dark"] .dropdown-item:hover,
:root[data-theme="dark"] .dropdown-item:focus {
  background: transparent;
  color: var(--brand-blue-soft);
}

.dropdown-divider {
  border-top-color: rgba(184, 211, 242, .75);
  margin: 8px 0;
}

:root[data-theme="dark"] .dropdown-divider {
  border-top-color: rgba(255, 255, 255, 0.10);
}

.topbar {
  margin-left: auto;
}

.topbar form {
  margin: 0;
}

.nav-action {
  flex: 0 0 auto;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(117, 200, 255, .34);
  border-radius: 7px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, .04)),
    rgba(47, 134, 255, .12);
  color: #17395c;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16);
}

.nav-action:hover {
  color: #0758b8;
  text-decoration: none;
}

:root[data-theme="dark"] .nav-action {
  color: #ffffff;
}

.user-menu {
  position: relative;
  flex: 0 0 auto;
}

.user-trigger {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid #d8e4f1;
  border-radius: 50%;
  background: #f2f6fb;
  color: #17395c;
  padding: 0;
}

.user-trigger:hover,
.user-trigger:focus {
  border-color: rgba(47, 134, 255, .44);
  background: #e8f1ff;
  color: #0758b8;
}

:root[data-theme="dark"] .user-trigger {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.86);
}

:root[data-theme="dark"] .user-trigger:hover,
:root[data-theme="dark"] .user-trigger:focus {
  border-color: rgba(47, 134, 255, .70);
  background: rgba(47, 134, 255, .16);
  color: #8fd4ff;
}

.user-trigger::after {
  display: none;
}

.user-trigger-icon,
.logout-trigger svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.user-avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, .36), transparent 34%),
    #098cff;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .26);
}

.dropdown-menu.user-dropdown {
  display: none;
  gap: 8px;
  width: min(100vw - 32px, 380px);
  padding: 14px;
  border-radius: 14px;
}

.dropdown-menu.user-dropdown.show {
  display: grid;
}

.user-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5edf6;
}

:root[data-theme="dark"] .user-menu-header {
  border-color: rgba(255, 255, 255, .12);
}

.user-menu-header strong {
  display: block;
  color: #172033;
  font-size: 13px;
}

.user-menu-header span {
  display: block;
  max-width: 210px;
  overflow: hidden;
  color: #667085;
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

:root[data-theme="dark"] .user-menu-header strong {
  color: #ffffff;
}

:root[data-theme="dark"] .user-menu-header span {
  color: rgba(255, 255, 255, .62);
}

.user-menu-list {
  display: grid;
  gap: 0;
}

.user-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 9px 2px;
  border: 0;
  border-bottom: 1px solid rgba(184, 211, 242, .58);
  border-radius: 0;
  background: transparent;
  color: #172033;
  font-size: 12px;
  font-weight: 800;
  text-align: left;
  text-decoration: none;
}

.user-menu-list .user-menu-item:last-child {
  border-bottom: 0;
}

:root[data-theme="dark"] .user-menu-item {
  border-bottom-color: rgba(255, 255, 255, .10);
  background: transparent;
  color: #ffffff;
}

.user-menu-item em {
  color: #098cff;
  font-style: normal;
  font-size: 11px;
  text-align: right;
  white-space: nowrap;
}

:root[data-theme="dark"] .user-menu-item em {
  color: #80d7ff;
}

.user-menu-link:hover,
.user-menu-link:focus {
  background:
    linear-gradient(180deg, #ffffff, #edf6ff),
    #edf5ff;
  color: #0758b8;
  text-decoration: none;
}

:root[data-theme="dark"] .user-menu-link:hover,
:root[data-theme="dark"] .user-menu-link:focus {
  background: rgba(255, 255, 255, .10);
  color: #ffffff;
}

.user-menu-button {
  cursor: pointer;
}

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

.logout-trigger {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid #d8e4f1;
  border-radius: 50%;
  background: #f2f6fb;
  color: #17395c;
}

.logout-trigger:hover,
.logout-trigger:focus {
  border-color: rgba(47, 134, 255, .44);
  background: #e8f1ff;
  color: #0758b8;
}

:root[data-theme="dark"] .logout-trigger {
  border-color: rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .08);
  color: rgba(255, 255, 255, .86);
}

:root[data-theme="dark"] .logout-trigger:hover,
:root[data-theme="dark"] .logout-trigger:focus {
  border-color: rgba(47, 134, 255, .70);
  background: rgba(47, 134, 255, .16);
  color: #8fd4ff;
}

.job-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.job-actions form {
  margin: 0;
}

.job-icon-btn {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 0 !important;
  border-radius: 6px;
  background: transparent !important;
  color: var(--muted-strong);
  line-height: 1;
  cursor: pointer;
  box-shadow: none !important;
  outline: 0;
}

.job-icon-btn:hover,
.job-icon-btn:focus,
.job-icon-btn:active {
  background: transparent !important;
  color: var(--heading);
  text-decoration: none;
  box-shadow: none !important;
  outline: 0;
}

.job-icon-btn.pause {
  color: #d97706;
}

.job-icon-btn.pause:hover {
  color: #b45309;
}

.job-icon-btn.start {
  color: #16a34a;
}

.job-icon-btn.start:hover {
  color: #15803d;
}

.job-icon-btn.rerun {
  color: #2563eb;
}

.job-icon-btn.rerun:hover,
.job-icon-btn.rerun:focus {
  color: #1d4ed8;
}

.job-icon-btn.danger {
  color: #dc2626;
}

.job-icon-btn.danger:hover,
.job-icon-btn.danger:focus {
  background: transparent !important;
  color: #b91c1c;
}

.job-icon-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.quota-strip {
  display: grid;
  gap: 2px;
  width: min(330px, 34vw);
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.quota-chip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 18px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  font-size: 11px;
  line-height: 14px;
}

.quota-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quota-name::after {
  content: ":";
}

.quota-value {
  color: rgba(255, 255, 255, 0.66);
  font-family: var(--mono-font-family);
  white-space: nowrap;
}

.user-chip,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 400;
}

.app-header .user-chip {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.82);
  min-height: 30px;
  border-radius: 6px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid #d8e4f1;
  border-radius: 50%;
  background: #f2f6fb;
  color: #17395c;
}

.theme-toggle:hover,
.theme-toggle:focus {
  background: #e8f1ff;
  color: #0758b8;
}

:root[data-theme="dark"] .theme-toggle {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.86);
}

:root[data-theme="dark"] .theme-toggle:hover,
:root[data-theme="dark"] .theme-toggle:focus {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.theme-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-icon-sun {
  display: none;
}

:root[data-theme="dark"] .theme-icon-sun {
  display: block;
}

:root[data-theme="dark"] .theme-icon-moon {
  display: none;
}

.app-header .btn-outline-secondary,
.app-header button.secondary {
  border-color: #d8e4f1 !important;
  background: transparent !important;
  color: #17395c !important;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px !important;
  font-size: 14px;
}

.app-header .btn-outline-secondary:hover,
.app-header button.secondary:hover {
  border-color: #bee1ff !important;
  background: #eef6ff !important;
  color: #0758b8 !important;
}

:root[data-theme="dark"] .app-header .btn-outline-secondary,
:root[data-theme="dark"] .app-header button.secondary {
  border-color: rgba(255, 255, 255, 0.14) !important;
  color: rgba(255, 255, 255, 0.84) !important;
}

:root[data-theme="dark"] .app-header .btn-outline-secondary:hover,
:root[data-theme="dark"] .app-header button.secondary:hover {
  border-color: rgba(255, 255, 255, 0.28) !important;
  background: rgba(255, 255, 255, 0.08) !important;
  color: #ffffff !important;
}

.app-main {
  width: min(100%, 1480px);
  margin: 0 auto;
  padding: 28px;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--heading);
  line-height: 1.16;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
  font-weight: 650;
}

h2 {
  margin-bottom: 14px;
  font-size: 18px;
  font-weight: 650;
}

h3 {
  margin: 24px 0 10px;
  font-size: 15px;
  font-weight: 650;
}

p {
  margin: 0 0 12px;
}

ul,
ol {
  padding-left: 21px;
}

li + li {
  margin-top: 5px;
}

.panel {
  margin-bottom: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.service-action-panel {
  position: relative;
  overflow: hidden;
  padding: 34px 34px 38px;
  border-color: rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 255, 255, 0.15), transparent 34%),
    linear-gradient(135deg, #1c2a42 0%, #071426 48%, #2f86ff 142%);
  color: #ffffff;
  box-shadow: 0 18px 48px rgba(8, 19, 36, 0.08);
}

.service-action-panel::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 0;
  width: min(34%, 430px);
  height: 168px;
  pointer-events: none;
  background: #ffffff;
  opacity: 0.14;
  transform: translate3d(0, 0, 0);
  transform-origin: 100% 100%;
  transition: none;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 660 280'%3E%3Cg fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M86 336C162 252 256 220 338 238S484 278 716 88'/%3E%3Cpath d='M112 344C188 260 270 230 350 248S500 290 716 106'/%3E%3Cpath d='M138 352C210 270 286 242 364 258S516 302 716 124'/%3E%3Cpath d='M164 360C232 280 302 254 378 268S532 314 716 142'/%3E%3Cpath d='M190 368C254 290 318 266 392 278S548 326 716 160'/%3E%3Cpath d='M216 376C276 300 334 278 406 288S564 338 716 178'/%3E%3Cpath d='M242 384C298 310 350 290 420 298S580 350 716 196'/%3E%3Cpath d='M268 392C320 320 366 302 434 308S596 362 716 214'/%3E%3C/g%3E%3C/svg%3E") right bottom / 100% 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 660 280'%3E%3Cg fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M86 336C162 252 256 220 338 238S484 278 716 88'/%3E%3Cpath d='M112 344C188 260 270 230 350 248S500 290 716 106'/%3E%3Cpath d='M138 352C210 270 286 242 364 258S516 302 716 124'/%3E%3Cpath d='M164 360C232 280 302 254 378 268S532 314 716 142'/%3E%3Cpath d='M190 368C254 290 318 266 392 278S548 326 716 160'/%3E%3Cpath d='M216 376C276 300 334 278 406 288S564 338 716 178'/%3E%3Cpath d='M242 384C298 310 350 290 420 298S580 350 716 196'/%3E%3Cpath d='M268 392C320 320 366 302 434 308S596 362 716 214'/%3E%3C/g%3E%3C/svg%3E") right bottom / 100% 100% no-repeat;
}

.service-action-panel > * {
  position: relative;
  z-index: 1;
}

.service-action-head {
  min-height: 62px;
  padding-right: 62px;
}

.service-action-title {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
  color: #ffffff;
  font-size: 30px;
  font-weight: 560;
  line-height: 1.14;
}

.service-help-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 2;
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 50%;
  background: transparent;
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.service-help-btn:hover,
.service-help-btn:focus {
  border-color: rgba(255, 255, 255, 0.88);
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.service-action-panel > form {
  margin-top: 8px;
  margin-bottom: 6px;
}

.service-file-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 190px;
  gap: 8px;
  align-items: stretch;
  width: 100%;
}

.service-file-field {
  min-width: 0;
}

.service-file-action {
  display: flex;
  min-width: 0;
}

.service-file-action .btn {
  width: 100%;
  min-height: 44px;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .service-file-form {
    grid-template-columns: 1fr;
  }
}

.service-action-panel .muted,
.service-action-panel .form-label {
  color: rgba(255, 255, 255, 0.76);
}

.service-action-panel .form-label {
  font-weight: 500;
}

.service-action-panel .form-control,
.service-action-panel .form-select {
  min-height: 44px;
  border-color: rgba(255, 255, 255, 0.18);
  background-color: rgba(255, 255, 255, 0.96);
  color: var(--navy);
}

.file-picker {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  width: 100%;
  height: 44px;
  min-height: 44px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--navy);
  cursor: pointer;
}

.file-picker input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.file-picker-button,
.file-picker-name {
  display: flex;
  min-width: 0;
  align-items: center;
  padding: 0 16px;
}

.file-picker-button {
  border-right: 1px solid #D7DEE9;
  background: #F5F7FA;
  color: var(--navy);
  font-weight: 520;
}

.file-picker-name {
  overflow: hidden;
  color: #374151;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-picker:hover .file-picker-button {
  background: #EAF3FF;
}

.file-picker.locked {
  cursor: default;
}

.file-picker.locked .file-picker-button {
  background: #eef2f7;
}

.file-picker.locked:hover .file-picker-button {
  background: #eef2f7;
}

.file-picker:focus-within {
  border-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.20);
}

.service-action-panel input[type="file"]::file-selector-button,
.service-action-panel input[type="file"]::-webkit-file-upload-button {
  min-height: 42px;
  background: #F5F7FA;
  color: var(--navy);
}

.service-action-panel .btn-primary {
  min-height: 44px;
  border-color: #ffffff !important;
  background: #ffffff !important;
  color: var(--navy) !important;
}

.service-action-panel .btn-secondary {
  min-height: 44px;
  border-color: rgba(255, 255, 255, 0.22) !important;
  background: rgba(255, 255, 255, 0.08) !important;
  color: #ffffff !important;
}

.service-action-panel .btn-secondary:hover {
  border-color: rgba(255, 255, 255, 0.42) !important;
  background: rgba(255, 255, 255, 0.14) !important;
  color: #ffffff !important;
}

.service-action-panel .btn-primary:hover {
  border-color: #EAF3FF !important;
  background: #EAF3FF !important;
  color: var(--navy) !important;
}

.service-action-panel .btn-outline-secondary {
  border-color: rgba(255, 255, 255, 0.22) !important;
  background: rgba(255, 255, 255, 0.08) !important;
  color: #ffffff !important;
}

.service-help-modal .modal-content {
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 70px rgba(8, 19, 36, 0.18);
}

.service-help-modal .modal-header {
  border-bottom-color: var(--line);
  background: var(--surface-soft);
}

.service-help-modal .modal-title {
  color: var(--heading);
  font-size: 20px;
  font-weight: 800;
}

.service-help-modal .btn-close {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  padding: 5px;
  margin: 0 0 0 auto;
  border: 0;
  border-radius: 999px;
  background-color: transparent;
  background-size: 10px 10px;
  opacity: 1;
  filter: none;
}

.service-help-modal .btn-close:hover,
.service-help-modal .btn-close:focus {
  background-color: rgba(47, 134, 255, 0.10);
  box-shadow: none;
}

:root[data-theme="dark"] .service-help-modal .btn-close {
  background-color: transparent;
  filter: invert(1) grayscale(100%);
}

:root[data-theme="dark"] .service-help-modal .btn-close:hover,
:root[data-theme="dark"] .service-help-modal .btn-close:focus {
  background-color: rgba(255, 255, 255, 0.10);
}

.service-help-modal .modal-body {
  display: grid;
  gap: 14px;
  color: var(--muted-strong);
  font-size: 14px;
}

.service-help-modal .modal-body p {
  margin: 0;
}

.service-help-modal h3 {
  margin: 8px 0 0;
  color: var(--heading);
  font-size: 16px;
  font-weight: 800;
}

.service-help-content:empty {
  display: none;
}

.service-help-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.service-help-table {
  min-width: 900px;
  margin: 0;
  background: var(--surface);
}

.service-help-table th,
.service-help-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-size: 12px;
  vertical-align: top;
}

.service-help-table th {
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-weight: 800;
  text-transform: none;
}

.service-help-table tr:last-child td {
  border-bottom: 0;
}

/* ==========================================================================
   Brand Loader
   Loader 05 fast pulse из брендбука. Используется в overlay и внутри
   компактных состояний ожидания на страницах сервисов.
   ========================================================================== */

@keyframes brand-loader-pulse {
  0%, 100% {
    transform: scale(.985);
  }
  50% {
    transform: scale(1.035);
  }
}

.brand-loader {
  width: min(100%, 260px);
  height: auto;
  overflow: visible;
}

.brand-loader-compact {
  width: 74px;
  flex: 0 0 74px;
}

.brand-loader-fast-pulse {
  animation: brand-loader-pulse 1.65s ease-in-out infinite;
}

.brand-loader-eye-line {
  fill: none;
  stroke: url(#brandLoaderEyeBlue);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-loader-lid-fill {
  fill: #098cff;
}

.brand-loader-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(6, 17, 32, .34);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
  backdrop-filter: blur(2px);
}

.brand-loader-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.brand-loader-card {
  display: grid;
  place-items: center;
  gap: 16px;
  min-width: min(100%, 320px);
  padding: 24px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #ffffff;
  text-shadow: 0 2px 18px rgba(0, 12, 28, .52);
  box-shadow: none;
}

.brand-loader-card .brand-loader-compact {
  width: 132px;
  flex-basis: 132px;
  filter: drop-shadow(0 18px 34px rgba(0, 12, 28, .36));
}

.brand-loader-card span {
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
}

.single-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.10);
  color: #ffffff;
}

.single-progress[hidden] {
  display: none;
}

.single-progress b,
.single-progress small {
  display: block;
}

.single-progress small {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.72);
}

/* ==========================================================================
   Dashboard Service Cards
   Основные плитки сервисов с уже согласованной волной и брендовой палитрой.
   ========================================================================== */

.service-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.service-card {
  position: relative;
  display: flex;
  min-height: 306px;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  gap: 34px;
  padding: 32px;
  border: 1px solid #d9e3ef;
  border-radius: 8px;
  color: var(--navy);
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(16, 24, 40, .05);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.service-card::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 0;
  width: min(76%, 460px);
  height: min(58%, 230px);
  pointer-events: none;
  background: #1d9bf0;
  opacity: 0.16;
  transform: translate3d(0, 0, 0);
  transform-origin: 100% 100%;
  transition: opacity 180ms ease, transform 180ms ease, background-color 180ms ease;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 660 280'%3E%3Cg fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M86 336C162 252 256 220 338 238S484 278 716 88'/%3E%3Cpath d='M112 344C188 260 270 230 350 248S500 290 716 106'/%3E%3Cpath d='M138 352C210 270 286 242 364 258S516 302 716 124'/%3E%3Cpath d='M164 360C232 280 302 254 378 268S532 314 716 142'/%3E%3Cpath d='M190 368C254 290 318 266 392 278S548 326 716 160'/%3E%3Cpath d='M216 376C276 300 334 278 406 288S564 338 716 178'/%3E%3Cpath d='M242 384C298 310 350 290 420 298S580 350 716 196'/%3E%3Cpath d='M268 392C320 320 366 302 434 308S596 362 716 214'/%3E%3C/g%3E%3C/svg%3E") right bottom / 100% 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 660 280'%3E%3Cg fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M86 336C162 252 256 220 338 238S484 278 716 88'/%3E%3Cpath d='M112 344C188 260 270 230 350 248S500 290 716 106'/%3E%3Cpath d='M138 352C210 270 286 242 364 258S516 302 716 124'/%3E%3Cpath d='M164 360C232 280 302 254 378 268S532 314 716 142'/%3E%3Cpath d='M190 368C254 290 318 266 392 278S548 326 716 160'/%3E%3Cpath d='M216 376C276 300 334 278 406 288S564 338 716 178'/%3E%3Cpath d='M242 384C298 310 350 290 420 298S580 350 716 196'/%3E%3Cpath d='M268 392C320 320 366 302 434 308S596 362 716 214'/%3E%3C/g%3E%3C/svg%3E") right bottom / 100% 100% no-repeat;
}

.service-card > * {
  position: relative;
  z-index: 1;
}

.service-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 62px rgba(8, 19, 36, 0.12);
  border-color: rgba(255, 255, 255, 0.14);
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 255, 255, 0.22), transparent 34%),
    linear-gradient(135deg, #081324 0%, #10284F 58%, #2B84FF 100%);
  color: #ffffff;
  text-decoration: none;
}

.service-card:hover::after {
  background: #ffffff;
  opacity: 0.24;
  transform: scale(1.03);
}

.service-card:hover .service-copy {
  color: rgba(255, 255, 255, 0.78);
}

.service-card-audit {
  border-color: #d9e3ef;
  background: #f8fbff;
}

.service-card-bulk {
  background: #f8fbff;
}

.service-card-single {
  background: #f8fbff;
  color: var(--navy);
}

.service-card-single .service-copy,
.service-card-single .service-meta {
  color: var(--muted);
}

.service-card-single .service-count {
  color: var(--navy);
}

.service-card-planned {
  border-style: dashed;
  border-color: #94a3b8;
  cursor: not-allowed;
}

.service-card-planned::after {
  opacity: .10;
}

.service-card-planned .service-icon {
  opacity: .72;
}

.service-card-planned:hover {
  transform: none;
  border-color: #94a3b8;
  background: #f8fbff;
  color: var(--navy);
  box-shadow: 0 6px 16px rgba(16, 24, 40, .05);
}

.service-card-planned:hover::after {
  background: #1d9bf0;
  opacity: .10;
  transform: none;
}

.service-card-planned:hover .service-copy {
  color: var(--muted);
}

.service-planned-status {
  color: var(--muted);
  font-weight: 800;
  opacity: 1;
}

.service-icon {
  display: inline-grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 12px 30px rgba(8, 19, 36, 0.10);
}

.service-card-single .service-icon {
  background: rgba(255, 255, 255, .92);
  box-shadow: none;
}

.service-icon img {
  display: block;
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.service-card-body {
  display: block;
}

.service-title,
.service-copy,
.service-meta {
  display: block;
}

.service-title {
  margin-bottom: 13px;
  color: currentColor;
  font-size: 30px;
  font-weight: 560;
  line-height: 1.14;
}

.service-copy {
  max-width: 440px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.42;
}

.service-meta {
  color: inherit;
  font-size: 13px;
  opacity: 0.68;
}

:root[data-theme="dark"] .service-card-audit {
  border-color: rgba(255, 255, 255, 0.12);
  background:
    linear-gradient(180deg, #101c31 0%, #081324 100%);
  color: #ffffff;
}

:root[data-theme="dark"] .service-card-bulk {
  border-color: rgba(255, 255, 255, 0.12);
  background:
    linear-gradient(180deg, #101c31 0%, #081324 100%);
  color: #ffffff;
}

:root[data-theme="dark"] .service-card-single {
  border-color: rgba(255, 255, 255, 0.14);
  background:
    linear-gradient(180deg, #101c31 0%, #081324 100%);
  color: #ffffff;
}

:root[data-theme="dark"] .service-card-single .service-copy,
:root[data-theme="dark"] .service-card-single .service-meta {
  color: rgba(255, 255, 255, .68);
}

:root[data-theme="dark"] .service-card-single .service-count {
  color: #ffffff;
}

:root[data-theme="dark"] .service-copy {
  color: rgba(255, 255, 255, 0.74);
}

.panel:first-child:not(.service-action-panel) {
  border-color: transparent;
  background: linear-gradient(180deg, #fafafa 0%, #ffffff 100%);
}

:root[data-theme="dark"] .panel:first-child:not(.service-action-panel) {
  border-color: var(--line);
  background: var(--surface);
}

/* ==========================================================================
   Login Card
   Карточка входа по варианту "Страница входа: вариант в стиле текущего экрана".
   ========================================================================== */

.login-panel {
  width: min(100%, 420px);
  margin-top: 0;
  padding: 32px 34px;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 18px;
  background: rgba(255, 255, 255, .94);
  box-shadow:
    0 22px 58px rgba(0, 12, 28, .24),
    inset 0 1px 0 rgba(255, 255, 255, .9);
  backdrop-filter: blur(10px);
}

.login-logo {
  display: grid;
  place-items: center;
  margin-bottom: 30px;
}

.login-logo img {
  display: block;
  width: 214px;
  height: auto;
}

.auth-page .form-control {
  min-height: 54px;
  border-color: rgba(162, 184, 214, .58);
  border-radius: 10px;
  background: #e8f1ff;
  color: var(--navy);
  font-size: 16px;
  font-weight: 700;
  box-shadow: inset 0 1px 2px rgba(16, 24, 40, .04);
}

.auth-page .btn-primary {
  min-height: 58px;
  border-radius: 10px !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .2) 0%, rgba(255, 255, 255, 0) 48%),
    var(--brand-blue) !important;
  border-color: var(--brand-blue) !important;
  color: #ffffff !important;
  font-size: 17px;
  font-weight: 800;
  box-shadow:
    0 12px 24px rgba(47, 134, 255, .2),
    inset 0 1px 0 rgba(255, 255, 255, .24);
}

.login-subtitle {
  margin-top: 8px;
  color: #223047;
  font-size: 14px;
  font-weight: 700;
}

.login-subtitle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  border: 2px solid #6f86a5;
  accent-color: var(--brand-blue);
}

/* ==========================================================================
   Documentation And Content Pages
   Страницы справки, статический контент и схемы.
   ========================================================================== */

.docs-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.docs-sidebar {
  position: sticky;
  top: 88px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.docs-sidebar-title {
  padding: 8px 10px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.docs-sidebar a {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--muted-strong);
  font-size: 14px;
  line-height: 20px;
  text-decoration: none;
}

.docs-sidebar a:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.docs-content {
  min-width: 0;
}

.docs-hero {
  padding-top: 28px;
  padding-bottom: 28px;
}

.docs-section {
  scroll-margin-top: 96px;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.muted,
.label,
.small {
  color: var(--muted);
}

.small {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  font-weight: 500;
}

.error {
  color: #b42318;
  font-weight: 620;
}

.success {
  color: #15803d;
  font-weight: 620;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.reference-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.reference-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.reference-meta div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.reference-meta dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.reference-meta dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text);
}

.reference-upload {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.status-found {
  border-color: var(--green-line);
  background: var(--green-bg);
  color: #166534;
}

.status-error {
  border-color: var(--red-line);
  background: var(--red-bg);
  color: #991b1b;
}

:root[data-theme="dark"] .success {
  color: #86efac;
}

:root[data-theme="dark"] .status-found {
  color: #bbf7d0;
}

:root[data-theme="dark"] .status-error {
  color: #fecaca;
}

.btn,
button,
.button {
  border-radius: 6px !important;
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
}

.btn-primary,
button:not(.secondary):not(.btn-outline-primary):not(.btn-outline-secondary):not(.nav-link-btn):not(.theme-toggle):not(.user-trigger):not(.logout-trigger):not(.job-icon-btn):not(.history-page-btn):not(.service-help-btn):not(.btn-close):not(.exclude-match-button),
.button {
  border-color: var(--accent) !important;
  background: var(--accent) !important;
  color: #ffffff !important;
}

.btn-primary:hover,
button:not(.secondary):not(.btn-outline-primary):not(.btn-outline-secondary):not(.nav-link-btn):not(.theme-toggle):not(.user-trigger):not(.logout-trigger):not(.job-icon-btn):not(.history-page-btn):not(.service-help-btn):not(.btn-close):not(.exclude-match-button):hover,
.button:hover {
  border-color: #176DE6 !important;
  background: #176DE6 !important;
  color: #ffffff !important;
  text-decoration: none;
}

.btn-outline-primary,
.btn-outline-secondary,
button.secondary,
.button.secondary {
  border-color: var(--line-strong) !important;
  background: var(--surface) !important;
  color: var(--text) !important;
}

.btn-outline-primary:hover,
.btn-outline-secondary:hover,
button.secondary:hover,
.button.secondary:hover {
  border-color: var(--text) !important;
  background: var(--surface-soft) !important;
  color: var(--text) !important;
}

.form-control,
.form-select,
input[type="text"],
input[type="password"],
input[type="file"],
input[type="search"],
select {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background-color: var(--surface);
  color: var(--text);
  font-size: 14px;
}

input[type="file"]::file-selector-button {
  min-height: 36px;
  margin: -1px 12px -1px -12px;
  padding: 0 12px;
  border: 0;
  border-right: 1px solid var(--line-strong);
  background: var(--surface-soft);
  color: var(--text);
  font: inherit;
}

input[type="file"]::-webkit-file-upload-button {
  min-height: 36px;
  margin: -1px 12px -1px -12px;
  padding: 0 12px;
  border: 0;
  border-right: 1px solid var(--line-strong);
  background: var(--surface-soft);
  color: var(--text);
  font: inherit;
}

input[type="file"]::file-selector-button:hover,
input[type="file"]:hover::file-selector-button {
  background: var(--surface-soft) !important;
  color: var(--text) !important;
}

input[type="file"]::-webkit-file-upload-button:hover,
input[type="file"]:hover::-webkit-file-upload-button {
  background: var(--surface-soft) !important;
  color: var(--text) !important;
}

:root[data-theme="dark"] input[type="file"]::file-selector-button,
:root[data-theme="dark"] input[type="file"]::-webkit-file-upload-button {
  background: #2a2a2a !important;
  color: #ececf1 !important;
}

:root[data-theme="dark"] input[type="file"]::file-selector-button:hover,
:root[data-theme="dark"] input[type="file"]:hover::file-selector-button,
:root[data-theme="dark"] input[type="file"]::-webkit-file-upload-button:hover,
:root[data-theme="dark"] input[type="file"]:hover::-webkit-file-upload-button {
  background: #343434 !important;
  color: #ffffff !important;
}

:root[data-theme="dark"] .form-control,
:root[data-theme="dark"] .form-select,
:root[data-theme="dark"] input[type="text"],
:root[data-theme="dark"] input[type="password"],
:root[data-theme="dark"] input[type="file"],
:root[data-theme="dark"] input[type="search"],
:root[data-theme="dark"] select {
  background-color: var(--surface);
  color: var(--text);
}

:root[data-theme="dark"] .form-control::placeholder,
:root[data-theme="dark"] input::placeholder {
  color: var(--muted);
}

.form-control:focus,
.form-select:focus,
input:focus,
select:focus {
  border-color: var(--text);
  box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.08);
}

.form-check-input:checked {
  border-color: var(--text);
  background-color: var(--text);
}

.table-responsive-soft {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.table-responsive-soft table {
  min-width: 980px;
  margin: 0;
}

.history-th-wrap {
  display: inline-block;
  line-height: 1.18;
  min-width: max-content;
  white-space: normal;
}

.history-sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  line-height: 1.15;
  user-select: none;
}

.history-sort-btn:hover {
  color: var(--accent);
}

.history-sort-arrows {
  display: inline-grid;
  width: 12px;
  height: 14px;
  flex: 0 0 12px;
  place-items: center;
  color: var(--muted);
}

.history-sort-arrows svg {
  display: block;
  width: 10px;
  height: 7px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.history-sort-up {
  margin-bottom: -2px;
}

.history-sort-down {
  margin-top: -2px;
}

.history-sort-btn[data-history-active="asc"] .history-sort-up,
.history-sort-btn[data-history-active="desc"] .history-sort-down {
  color: var(--accent);
}

.history-controls {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0 14px;
}

.history-filter {
  display: grid;
  gap: 6px;
  min-width: 190px;
  margin: 0;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 800;
}

.history-filter:first-child {
  flex: 1 1 420px;
}

.history-filter input,
.history-filter select {
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.history-filter input {
  padding: 0 12px;
}

.history-filter select {
  padding: 0 36px 0 12px;
}

.history-filter input:focus,
.history-filter select:focus {
  border-color: rgba(47, 134, 255, .58);
  box-shadow: 0 0 0 3px rgba(47, 134, 255, .12);
  outline: none;
}


.draft-file-line,
.draft-stage-line {
  display: block;
  color: var(--text);
  font-size: inherit;
  font-weight: 500;
  line-height: 1.35;
}

.draft-file-line + .draft-file-line {
  margin-top: 3px;
}

.history-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0 0;
  color: var(--muted-strong);
  font-size: 14px;
}

.history-pagination-summary {
  font-weight: 600;
}

.history-pagination-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: var(--radius);
  color: var(--muted-strong);
  background: transparent;
}

.history-page-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.history-page-btn:hover:not(:disabled) {
  color: var(--heading);
  background: var(--surface-soft);
}

.history-page-btn:disabled {
  cursor: default;
  opacity: .35;
}

.history-page-size {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 500;
}

.history-page-size span {
  padding: 0 16px;
  border-right: 1px solid var(--line);
  white-space: nowrap;
}

.history-page-size select {
  min-width: 74px;
  height: 40px;
  padding: 0 34px 0 16px;
  border: 0;
  background-color: transparent;
  color: var(--text);
  font-weight: 650;
}

:root[data-theme="dark"] .history-page-size {
  border-color: var(--line-strong);
}

@media (max-width: 700px) {
  .history-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .history-filter {
    min-width: 0;
  }

  
.draft-file-line,
.draft-stage-line {
  display: block;
  color: var(--text);
  font-size: inherit;
  font-weight: 500;
  line-height: 1.35;
}

.draft-file-line + .draft-file-line {
  margin-top: 3px;
}

.history-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .history-pagination-actions {
    justify-content: space-between;
  }
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  color: var(--text);
}

.table {
  --bs-table-bg: var(--surface);
  --bs-table-color: var(--text);
  --bs-table-border-color: var(--line);
  color: var(--text);
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 650;
  text-transform: none;
}

tbody tr:hover td {
  background: #fafafa;
}

:root[data-theme="dark"] tbody tr:hover td {
  background: #1d1d1d;
}

tr.single-exact-row td {
  background: #F3F5F7;
}

tr.single-latest-row td {
  background: #F3F5F7;
}

tr.single-unverified-row td,
tbody tr.single-unverified-row:hover td {
  background: var(--red-bg);
}

tr.single-best-row td {
  background: #BDF3B2;
}

tr.single-best-row td:first-child {
  box-shadow: inset 4px 0 0 #6ED17E;
}

tr.single-nearby-row td {
  background: #FFF7E6;
}

tr.single-excluded-row td {
  background: #FFF1D6;
  color: #5F3B05;
}

tr.single-other-row td {
  background: #FAFBFD;
}

tbody tr.single-exact-row:hover td,
tbody tr.single-latest-row:hover td,
tbody tr.single-best-row:hover td,
tbody tr.single-nearby-row:hover td,
tbody tr.single-excluded-row:hover td,
tbody tr.single-other-row:hover td {
  filter: brightness(0.985);
}

:root[data-theme="dark"] tr.single-exact-row td {
  background: rgba(255, 255, 255, 0.06);
}

:root[data-theme="dark"] tr.single-other-row td {
  background: rgba(255, 255, 255, 0.04);
}

:root[data-theme="dark"] tr.single-latest-row td,
:root[data-theme="dark"] tr.single-best-row td {
  background: rgba(47, 143, 85, 0.20);
}

:root[data-theme="dark"] tr.single-nearby-row td {
  background: rgba(201, 133, 20, 0.18);
}

:root[data-theme="dark"] tr.single-excluded-row td {
  background: rgba(201, 133, 20, 0.22);
  color: rgba(255, 241, 214, 0.90);
}

.single-doc-badge {
  display: inline-flex;
  max-width: 100%;
  margin-top: 5px;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(43, 132, 255, 0.12);
  color: var(--brand-blue);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 650;
  white-space: normal;
}

tr.single-latest-row .single-doc-badge {
  background: #1F8F45;
  color: #ffffff;
}

.single-doc-badge-best {
  margin-top: 6px;
  margin-left: 0;
  vertical-align: middle;
  background: #2FA64A;
  color: #ffffff;
  font-size: 12px;
  font-weight: 750;
}

tr.single-excluded-row .single-doc-badge {
  background: #C98514;
  color: #ffffff;
}

.mono,
code {
  font-family: var(--mono);
}

code {
  padding: 1px 4px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-code);
  color: var(--text);
  font-size: 0.92em;
}

pre {
  max-height: 420px;
  margin: 12px 0;
  overflow: auto;
  padding: 14px;
  border: 1px solid #242424;
  border-radius: var(--radius);
  background: #101010;
  color: #f5f5f0;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.help-code {
  max-height: none;
  border-color: var(--line);
  background: var(--surface-code);
  color: var(--text);
}

.db-diagram {
  margin: 16px 0;
  padding: 16px;
  overflow-x: auto;
  border: 1px solid #D3DCE8;
  border-radius: var(--radius);
  background: #F5F7FA;
}

.db-diagram-drawio svg {
  display: block;
  width: 100%;
  min-width: 1040px;
  height: auto;
}

.db-schema-image {
  display: block;
  width: 100%;
  min-width: 1040px;
  height: auto;
  border-radius: 10px;
  background: #ffffff;
}

.db-interactive {
  margin: 16px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.db-interactive-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.db-interactive-toolbar b {
  display: block;
  margin-bottom: 2px;
  color: var(--heading);
  font-size: 15px;
}

.db-interactive-toolbar span {
  color: var(--muted);
  font-size: 12px;
}

.db-interactive-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.db-interactive-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  min-height: 520px;
}

.db-schema-canvas {
  position: relative;
  min-height: 520px;
  overflow: hidden;
  background:
    linear-gradient(rgba(8, 19, 36, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(8, 19, 36, 0.035) 1px, transparent 1px),
    #ffffff;
  background-size: 24px 24px;
  cursor: grab;
}

.db-schema-canvas:active {
  cursor: grabbing;
}

.db-live-svg {
  display: block;
  width: 100%;
  height: 520px;
  touch-action: none;
}

.db-live-node {
  cursor: move;
  outline: none;
}

.db-live-node-box {
  fill: #ffffff;
  stroke: #D3DCE8;
  stroke-width: 1.5;
}

.db-live-node-head {
  fill: #081324;
}

.db-live-node.is-accent .db-live-node-head {
  fill: #2B84FF;
}

.db-live-node.is-selected .db-live-node-box {
  stroke: #2B84FF;
  stroke-width: 3;
}

.db-live-node-title {
  fill: #ffffff;
  font-size: 18px;
  font-weight: 700;
}

.db-live-field {
  fill: #3F4A5C;
  font-family: var(--mono);
  font-size: 12px;
}

.db-live-field.is-pk {
  fill: #081324;
  font-weight: 700;
}

.db-live-field.is-fk {
  fill: #2B84FF;
}

.db-live-edge {
  opacity: 0.82;
}

.db-live-edge.is-highlighted {
  opacity: 1;
}

.db-live-edge-path {
  fill: none;
  stroke: #2B84FF;
  stroke-width: 2.4;
}

.db-live-edge.is-highlighted .db-live-edge-path {
  stroke-width: 3.4;
}

.db-live-edge.is-soft .db-live-edge-path {
  stroke: #3F4A5C;
  stroke-dasharray: 7 5;
}

.db-live-edge-label-bg {
  fill: #ffffff;
  stroke: #E5EAF1;
}

.db-live-edge-label {
  fill: #081324;
  font-size: 13px;
  font-weight: 700;
}

.db-live-edge-sublabel {
  fill: #6B7280;
  font-size: 11px;
}

.db-schema-details {
  min-width: 0;
  padding: 18px;
  border-left: 1px solid var(--line);
  background: var(--surface);
}

.db-schema-details h4 {
  margin: 0 0 8px;
  color: var(--heading);
  font-size: 24px;
  font-weight: 650;
}

.db-detail-fields {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.db-detail-field {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.db-detail-field code {
  display: block;
  margin-bottom: 4px;
  color: var(--heading);
  font-size: 12px;
  font-weight: 700;
}

.db-detail-field span {
  display: block;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11px;
}

.db-detail-field p {
  margin: 6px 0 0;
  color: var(--muted-strong);
  font-size: 12px;
}

.db-canvas {
  fill: #ffffff;
  stroke: #E5EAF1;
}

.db-title {
  fill: #081324;
  font-size: 22px;
  font-weight: 700;
}

.db-subtitle {
  fill: #6B7280;
  font-size: 14px;
}

.db-box {
  fill: #ffffff;
  stroke: #D3DCE8;
  stroke-width: 1.5;
  filter: drop-shadow(0 10px 18px rgba(8, 19, 36, 0.08));
}

.db-box-head {
  fill: #081324;
  stroke: #081324;
}

.db-box-head-alt {
  fill: #2B84FF;
  stroke: #2B84FF;
}

.db-table-title {
  fill: #ffffff;
  font-size: 18px;
  font-weight: 700;
}

.db-field {
  fill: #3F4A5C;
  font-family: var(--mono);
  font-size: 13px;
}

.db-pk {
  fill: #081324;
  font-weight: 700;
}

.db-fk {
  fill: #2B84FF;
}

.db-link {
  fill: none;
  stroke: #2B84FF;
  stroke-width: 2.4;
}

.db-link-soft {
  stroke: #3F4A5C;
  stroke-dasharray: 7 5;
}

.db-arrow-head {
  fill: #2B84FF;
}

.db-link-soft + .db-link-label-bg,
.db-link-label-bg {
  fill: #ffffff;
  stroke: #E5EAF1;
}

.db-link-label {
  fill: #081324;
  font-size: 13px;
  font-weight: 700;
}

.db-link-label-small {
  fill: #6B7280;
  font-size: 11px;
}

.db-note {
  fill: #EAF3FF;
  stroke: #93c5fd;
}

.db-note-title {
  fill: #081324;
  font-size: 15px;
  font-weight: 700;
}

.db-note-text {
  fill: #3F4A5C;
  font-size: 13px;
}

:root[data-theme="dark"] .db-box {
  filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.24));
}

.help-block summary {
  cursor: pointer;
  color: var(--text);
  font-size: 18px;
  font-weight: 650;
}

.help-block summary:hover {
  text-decoration: underline;
}

.help-block h2 {
  margin-top: 22px;
}

.help-block p,
.help-block li {
  line-height: 1.5;
}

.help-table {
  margin: 10px 0 16px;
  font-size: 13px;
}

.help-table th:first-child,
.help-table td:first-child {
  width: 260px;
}

details summary {
  cursor: pointer;
  color: var(--heading);
  font-size: 16px;
  font-weight: 500;
  list-style-position: outside;
}

details summary:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.queued {
  border-color: #e7d38e;
  background: #fff6d8;
  color: #7c5800;
}

.running {
  border-color: var(--blue-line);
  background: var(--blue-bg);
}

.paused {
  border-color: #cbd5e1;
  background: #f1f5f9;
  color: #475569;
}

.job-status-active {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.job-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #1f8a4c;
  box-shadow: 0 0 0 0 rgba(31, 138, 76, 0.35);
  animation: job-status-pulse 1.35s ease-out infinite;
}

.job-status-queued .job-status-dot {
  background: #d89b00;
  box-shadow: 0 0 0 0 rgba(216, 155, 0, 0.38);
  animation-name: job-status-pulse-queue;
}

.job-status-running .job-status-dot {
  background: #1f8a4c;
}

.job-status-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.job-status-dots span {
  width: 3px;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.35;
  animation: job-status-dot-wave 1.2s ease-in-out infinite;
}

.job-status-dots span:nth-child(2) {
  animation-delay: 0.16s;
}

.job-status-dots span:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes job-status-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(31, 138, 76, 0.35);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(31, 138, 76, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(31, 138, 76, 0);
  }
}

@keyframes job-status-pulse-queue {
  0% {
    box-shadow: 0 0 0 0 rgba(216, 155, 0, 0.38);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(216, 155, 0, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(216, 155, 0, 0);
  }
}

@keyframes job-status-dot-wave {
  0%, 80%, 100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

.done {
  border-color: var(--green-line);
  background: var(--green-bg);
}

.failed {
  border-color: var(--pink-line);
  background: var(--pink-bg);
}

.not-found {
  border-color: var(--red-line);
  background: var(--red-bg);
  color: #991b1b;
}

.stats {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.stat {
  min-height: 94px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.stat.good {
  border-color: var(--green-line);
  background: var(--green-bg);
}

.stat.blue {
  border-color: var(--blue-line);
  background: var(--blue-bg);
}

.stat.pink {
  border-color: var(--pink-line);
  background: var(--pink-bg);
}

.stat.orange {
  border-color: var(--orange-line);
  background: var(--orange-bg);
}

.stat.red {
  border-color: var(--red-line);
  background: var(--red-bg);
}

.label {
  font-size: 12px;
  font-weight: 560;
}

.metric {
  margin-top: 5px;
  font-size: 23px;
  font-weight: 680;
  line-height: 1.05;
}

.log-line {
  display: block;
  min-height: 18px;
}

.log-ok {
  color: #8ee6a9;
}

.log-warning {
  color: #ffd166;
}

.log-error {
  color: #ff9aa8;
}

.log-final {
  color: #8ee6a9;
  font-weight: 750;
}

@media (max-width: 1100px) {
  .app-header-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand-stack {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .topbar {
    margin-left: 0;
    width: 100%;
  }

  .quota-strip {
    width: min(100%, 300px);
  }

  .stats {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .service-grid {
    grid-template-columns: 1fr;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .service-card {
    min-height: 240px;
  }

  .db-diagram {
    grid-template-columns: 1fr;
  }

  .db-relation {
    min-width: 0;
  }

  .db-entity-wide {
    grid-column: auto;
    display: block;
  }

  .db-interactive-body {
    grid-template-columns: 1fr;
  }

  .db-schema-details {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 640px) {
  .app-header-inner,
  .app-main {
    padding-left: 16px;
    padding-right: 16px;
  }

  .nav {
    width: 100%;
  }

  .nav > a {
    padding: 0 8px;
  }

  .app-title .brand-logo {
    width: 150px;
    max-width: 72vw;
  }

  .quota-strip {
    width: 100%;
  }

  .panel {
    padding: 16px;
  }

  .service-copy {
    font-size: 16px;
  }

  .service-card {
    min-height: 230px;
    padding: 24px;
  }

  .file-picker {
    grid-template-columns: 1fr;
  }

  .file-picker-button {
    min-height: 42px;
    border-right: 0;
    border-bottom: 1px solid #D7DEE9;
    justify-content: center;
  }

  .file-picker-name {
    min-height: 42px;
    justify-content: center;
  }

  .reference-meta,
  .reference-upload {
    grid-template-columns: 1fr;
  }

  .service-title {
    font-size: 26px;
  }

  .docs-layout {
    display: block;
  }

  .docs-sidebar {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 16px;
  }

  .docs-sidebar-title {
    grid-column: 1 / -1;
  }

  .db-interactive-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .db-live-svg,
  .db-schema-canvas {
    min-height: 460px;
  }

  .stats {
    grid-template-columns: 1fr;
  }
}

.admin-panel-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.single-progress-pending {
  margin-top: 20px;
  background: rgba(255, 255, 255, 0.14);
}

.single-best-card {
  border-color: rgba(110, 209, 126, 0.38);
  background: linear-gradient(180deg, #F6FFF3 0%, #ffffff 46%);
}

:root[data-theme="dark"] .single-best-card {
  border-color: #9BE08C;
  background: linear-gradient(180deg, #F6FFF3 0%, #ffffff 46%);
  color: var(--navy);
}

:root[data-theme="dark"] .single-best-card h2,
:root[data-theme="dark"] .single-best-card .eyebrow,
:root[data-theme="dark"] .single-best-card .muted,
:root[data-theme="dark"] .single-best-card .small,
:root[data-theme="dark"] .single-best-card .label {
  color: #3F4A5C;
}

.single-best-card-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.single-best-card-head h2 {
  margin-bottom: 8px;
}

.single-best-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.single-best-metric {
  min-width: 0;
  padding: 14px;
  border: 1px solid #D7EED0;
  border-radius: 8px;
  background: #ffffff;
}

:root[data-theme="dark"] .single-best-metric {
  border-color: #D7EED0;
  background: #ffffff;
  color: var(--navy);
}

.single-best-metric span,
.single-best-details span {
  display: block;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 650;
}

:root[data-theme="dark"] .single-best-metric span,
:root[data-theme="dark"] .single-best-details span {
  color: #3F4A5C;
}

.single-best-metric b {
  display: block;
  margin-top: 5px;
  color: var(--navy);
  font-size: 18px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.single-best-metric.good {
  border-color: #9BE08C;
  background: #EEFFE8;
}

:root[data-theme="dark"] .single-best-metric.good {
  border-color: #9BE08C;
  background: #EEFFE8;
}

.single-best-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
}

.single-best-details div {
  min-width: 0;
  padding-top: 10px;
  border-top: 1px solid #E5EAF1;
}

:root[data-theme="dark"] .single-best-details div {
  border-top-color: #E5EAF1;
}

.single-best-details b {
  display: block;
  margin-top: 3px;
  color: var(--navy);
  font-weight: 560;
  overflow-wrap: anywhere;
}

.single-request-log {
  max-height: 420px;
  overflow: auto;
  margin: 0;
  padding: 16px;
  border-radius: 8px;
  background: #05070B;
  color: #D6F5D6;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 900px) {
  .single-best-card-head,
  .single-best-grid,
  .single-best-details {
    grid-template-columns: 1fr;
  }

  .single-best-card-head {
    display: grid;
  }
}
.single-request-log code {
  display: block;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}
.single-request-cards {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.single-request-card {
  border: 1px solid #D7DEE9;
  border-left-width: 4px;
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.single-request-card.is-ok {
  border-left-color: #2FA64A;
}

.single-request-card.is-error {
  border-left-color: #D14343;
}

.single-request-card-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 12px 14px;
  background: #F8FAFC;
  border-bottom: 1px solid #E5EAF1;
}

.single-request-index {
  display: block;
  margin-bottom: 4px;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 650;
}

.single-request-card-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  color: var(--muted-strong);
  font-size: 12px;
}

.single-request-status {
  padding: 2px 8px;
  border-radius: 6px;
  background: #E9F8E7;
  color: #1F7A35;
  font-weight: 700;
}

.single-request-card.is-error .single-request-status {
  background: #FDECEC;
  color: #B42318;
}

.single-request-error {
  padding: 10px 14px;
  background: #FFF5F5;
  color: #9F1D1D;
  font-size: 13px;
}

.single-request-url {
  padding: 12px 14px 14px;
  background: #081324;
  color: #DCEBFF;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.single-request-url a {
  color: #B9D7FF;
  text-decoration: none;
}

.single-request-url a:hover {
  color: #ffffff;
  text-decoration: underline;
}

@media (max-width: 760px) {
  .single-request-card-head {
    display: grid;
  }

  .single-request-card-meta {
    justify-content: flex-start;
  }
}
.single-request-description {
  max-width: 380px;
  color: var(--muted-strong);
  font-size: 13px;
  line-height: 1.45;
}

.single-request-purpose {
  display: block;
  max-width: 720px;
  margin-top: 5px;
  color: var(--muted-strong);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
}
.service-count {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  min-height: 38px;
  padding: 0 18px;
  border: 1px solid rgba(8, 19, 36, 0.10);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  color: currentColor;
  font-weight: 800;
  opacity: 0.86;
}

:root[data-theme="dark"] .service-count,
.service-card:hover .service-count {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.10);
  color: #ffffff;
  opacity: 1;
}
.progress-stat {
  overflow: hidden;
}

.job-progress {
  width: 100%;
  height: 7px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #ececf1;
}

.job-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #1f8f45;
  transition: width 0.35s ease;
}

.live-stage-panel {
  margin-top: -6px;
}

.live-stage {
  margin-top: 6px;
  color: var(--heading);
  font-size: 18px;
  font-weight: 650;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

/* Формирование 2000: навигация этапов мастера */
.wizard-nav-panel {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.service-wizard-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 8px;
  margin-top: 8px;
  border: 1px solid rgba(92, 163, 255, .28);
  border-radius: 12px;
  background: linear-gradient(100deg, #071529 0%, #123a70 54%, #2b84ff 100%);
  padding: 7px;
  box-shadow: 0 10px 24px rgba(8, 19, 36, .12);
}

.wizard-step {
  display: flex;
  min-height: 38px;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border: 1px solid rgba(147, 197, 253, .18);
  border-radius: 8px;
  background: rgba(31, 79, 139, .58);
  color: rgba(239, 246, 255, .78);
  text-decoration: none;
  transition: border-color .2s ease, background .2s ease, color .2s ease;
}

.wizard-step:hover,
.wizard-step:focus,
.wizard-step span,
.wizard-step b {
  text-decoration: none;
}

.wizard-step span {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 7px;
  background: rgba(147, 197, 253, .22);
  color: #dbeafe;
  font-size: 12px;
  font-weight: 850;
}

.wizard-step b {
  font-size: 13px;
  font-weight: 800;
}

.wizard-step:hover,
.wizard-step.active {
  border-color: rgba(147, 197, 253, .48);
  background: rgba(43, 132, 255, .20);
  color: #fff;
}

.wizard-step.active span {
  background: #8fc4ff;
  color: #071529;
}

.wizard-step.disabled {
  pointer-events: none;
  opacity: .56;
}

@media (max-width: 900px) {
  .service-wizard-nav {
    grid-template-columns: 1fr;
  }
}

/* Формирование 2000: мэппинг ТИ */
.matcher-list {
  display: grid;
  gap: 12px;
}

.matcher-card {
  display: grid;
  grid-template-columns: minmax(250px, .82fr) minmax(340px, 1.16fr) minmax(320px, 1.02fr);
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.matcher-card.excluded {
  opacity: .62;
}

.matcher-card.excluded .matcher-candidates,
.matcher-card.excluded .matcher-preview {
  pointer-events: none;
}

.matcher-ref,
.matcher-preview,
.match-card {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
  padding: 9px;
}

.matcher-ref {
  position: relative;
  padding-right: 42px;
}

.exclude-match-button {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid #fca5a5 !important;
  border-radius: 50% !important;
  background: #fee2e2 !important;
  color: #b42318 !important;
  padding: 0;
  font-size: 15px;
  line-height: 1;
  font-weight: 800;
  box-shadow: none;
}

.exclude-match-button:hover {
  background: #fecaca !important;
  border-color: #f87171 !important;
}

.matcher-card.excluded .exclude-match-button {
  border-color: #fca5a5 !important;
  background: #fee2e2 !important;
  color: #b42318 !important;
  font-size: 14px;
}

.matcher-preview {
  position: sticky;
  top: 12px;
  transition: background .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.matcher-preview.pending {
  border-color: var(--line);
  background: var(--surface-soft);
  box-shadow: none;
}

.matcher-preview.confirmed {
  border-color: rgba(187, 247, 208, .65);
  background: #f0fdf4;
  box-shadow: none;
}

.matcher-preview.excluded {
  border-color: rgba(148, 163, 184, .38);
  background: #f8fafc;
  box-shadow: none;
}

.matcher-candidates {
  display: grid;
  max-height: 330px;
  gap: 6px;
  overflow: auto;
  padding-right: 4px;
}

.match-card {
  position: relative;
  display: grid;
  gap: 5px;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, opacity .2s ease;
}

.match-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.match-card.selected {
  border-color: rgba(31, 143, 69, .65);
  background: rgba(34, 197, 94, .11);
}

.score {
  position: absolute;
  top: 7px;
  right: 7px;
  display: inline-flex;
  min-width: 42px;
  justify-content: center;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
}

.score.good {
  background: #dcfce7;
  color: #166534;
}

.score.mid {
  background: #fff4d6;
  color: #9a5b00;
}

.score.low {
  background: #fee2e2;
  color: #991b1b;
}

.confirm-match-button {
  width: 100%;
  min-height: 34px;
  margin-bottom: 7px;
  border: 1px solid rgba(43, 132, 255, .36);
  border-radius: 9px;
  background: var(--brand-blue);
  color: #fff;
  font-weight: 850;
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}

.confirm-match-button.confirmed {
  border-color: rgba(31, 143, 69, .42);
  background: #137547;
}

.selected-summary {
  display: grid;
  gap: 3px;
  margin-bottom: 7px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  padding: 7px 8px;
}

.selected-summary span {
  color: var(--muted);
  font-size: 9.8px;
  font-weight: 800;
  text-transform: uppercase;
}

.devices {
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}

.device {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 7px;
  padding: 6px 7px;
  border-bottom: 1px solid var(--line);
}

.device:last-child {
  border-bottom: 0;
}

.device-type {
  font-weight: 900;
}

.device-params {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 12px;
}

/* Формирование 2000: диагностическая таблица */
.diag-warning,
.diag-ok {
  margin: 14px 0;
  border-radius: 8px;
  padding: 12px 14px;
  font-weight: 750;
}

.diag-warning {
  border: 1px solid #fed7aa;
  background: #fff7ed;
  color: #9a3412;
}

.diag-ok {
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend i {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.legend-ready { background: #dcfce7; }
.legend-pending { background: #ffedd5; }
.legend-missing { background: #fee2e2; }
.legend-empty { background: #f8fafc; }

.diag-sectors {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 12px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}

.sector-button {
  position: relative;
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted-strong);
  padding: 0 13px;
  font-size: 13px;
  font-weight: 800;
  box-shadow: none;
  transition: background .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.sector-button::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background .18s ease, transform .18s ease;
}

.sector-button:hover,
.sector-button:focus {
  background: var(--accent-soft);
  color: var(--heading);
  outline: none;
}

.sector-button.active {
  background: var(--brand-blue);
  color: #fff;
  box-shadow: 0 8px 18px rgba(47, 134, 255, .24);
}

.sector-button.active::before {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .22);
  transform: scale(1.25);
}

.sector-button.active::after {
  content: "текущий";
  border-radius: 999px;
  background: rgba(255, 255, 255, .18);
  padding: 2px 7px;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
}

:root[data-theme="dark"] .diag-sectors {
  background: rgba(255, 255, 255, .04);
}

:root[data-theme="dark"] .sector-button.active {
  box-shadow: 0 8px 18px rgba(47, 134, 255, .30);
}

.diag-wrap {
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.diag-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.diag-table th,
.diag-table td {
  width: 112px;
  min-width: 112px;
  max-width: 112px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 4px 5px;
  vertical-align: top;
}



.diag-table.diag-show-groups th,
.diag-table.diag-show-groups td {
  width: 96px;
  min-width: 96px;
  max-width: 96px;
  padding: 3px 4px;
}

.diag-table.diag-show-groups th[data-col="1"],
.diag-table.diag-show-groups th[data-col="2"],
.diag-table.diag-show-groups td[data-col="1"],
.diag-table.diag-show-groups td[data-col="2"] {
  width: 52px;
  min-width: 52px;
  max-width: 52px;
}

.diag-table.diag-show-groups th[data-col="3"],
.diag-table.diag-show-groups td[data-col="3"] {
  width: 210px;
  min-width: 210px;
  max-width: 210px;
}

.diag-point-name-merged {
  border-bottom-width: 3px;
  vertical-align: middle;
}

.diag-point-name-merged .diag-value {
  font-size: 10.5px;
  line-height: 1.2;
}

.diag-table.diag-show-groups tr.diag-group-start td {
  border-top: 3px solid rgba(47, 134, 255, .42);
}

.diag-table.diag-show-groups tr.diag-group-start:first-child td {
  border-top-width: 0;
}

.diag-table.diag-show-groups tr.diag-group-continuation td[data-col="1"],
.diag-table.diag-show-groups tr.diag-group-continuation td[data-col="2"],
.diag-table.diag-show-groups tr.diag-group-continuation td[data-col="3"],
.diag-table.diag-show-groups tr.diag-group-continuation td[data-col="4"],
.diag-table.diag-show-groups tr.diag-group-continuation td[data-col="5"],
.diag-table.diag-show-groups tr.diag-group-continuation td[data-col="6"],
.diag-table.diag-show-groups tr.diag-group-continuation td[data-col="7"],
.diag-table.diag-show-groups tr.diag-group-continuation td[data-col="8"],
.diag-table.diag-show-groups tr.diag-group-continuation td[data-col="9"],
.diag-table.diag-show-groups tr.diag-group-continuation td[data-col="10"],
.diag-table.diag-show-groups tr.diag-group-continuation td[data-col="17"],
.diag-table.diag-show-groups tr.diag-group-continuation td[data-col="18"],
.diag-table.diag-show-groups tr.diag-group-continuation td[data-col="19"],
.diag-table.diag-show-groups tr.diag-group-continuation td[data-col="20"],
.diag-table.diag-show-groups tr.diag-group-continuation td[data-col="21"],
.diag-table.diag-show-groups tr.diag-group-continuation td[data-col="22"],
.diag-table.diag-show-groups tr.diag-group-continuation td[data-col="23"],
.diag-table.diag-show-groups tr.diag-group-continuation td[data-col="24"] {
  opacity: .72;
}

:root[data-theme="dark"] .diag-table.diag-show-groups tr.diag-group-start td {
  border-top-color: rgba(47, 134, 255, .58);
}

.diag-table th[data-col="1"],
.diag-table th[data-col="2"],
.diag-table td[data-col="1"],
.diag-table td[data-col="2"] {
  width: 58px;
  min-width: 58px;
  max-width: 58px;
}

.diag-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #eaf1f8;
  color: #344054;
  font-size: 9.8px;
  font-weight: 850;
}

.col-num {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  margin-bottom: 3px;
  border-radius: 6px;
  background: #d5e6f8;
  font-size: 11px;
}

.col-title {
  display: block;
  line-height: 1.15;
}

.diag-value {
  color: #16452b;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.diag-source {
  margin-top: 3px;
  color: #5b8f6d;
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
}

.diag-ready { background: #dcfce7; }
.diag-pending { background: #ffedd5; }
.diag-missing { background: #fee2e2; }
.diag-conflict { background: #ffedd5; }
.diag-empty { background: #f8fafc; }

.diag-empty .diag-value {
  color: #94a3b8;
}

.diag-click {
  cursor: pointer;
}

.diag-click:hover {
  outline: 2px solid rgba(43, 132, 255, .45);
  outline-offset: -2px;
}

.diag-context-col {
  box-shadow: inset 3px 0 0 rgba(43, 132, 255, .28);
}

.modal-kv,
.origin-box {
  display: grid;
  gap: 5px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
  padding: 12px;
}

.modal-kv span,
.origin-box span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.modal-kv b,
.origin-box b {
  color: var(--heading);
  font-size: 18px;
}

.origin-box small {
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 1050px) {
  .matcher-card {
    grid-template-columns: 1fr;
  }
}
