:root {
  --bg: #f8fafc;
  /* светлый фон */
  --panel: #ffffff;
  /* панели/карточки */
  --text: #0f172a;
  /* основной текст (slate-900) */
  --muted: #64748b;
  /* вторичный текст (slate-500) */
  --border: #e2e8f0;
  /* границы */
  --primary: #225472;
  /* синий акцент */
  --primary-ink: #ffffff;
  /* текст на кнопках */
  --shadow: 0 6px 24px rgba(2, 6, 23, .06);
  --radius: 14px;
  --c-bright-blue: #84c4f0;
  /* ярко-голубой */
  --c-ruby: #a41558;
  /* рубиново-красный */
  --c-soft-blue: #c7e3f9;
  /* светло-голубой */
  --c-deep-navy: #225472;
  /* темно-синий */
  --c-clay: #c5ba9f;
  /* глиняный */
  --c-deep-purple: #80217e;
  /* темно-пурпурный */
  --c-blue: #6687c3;
  /* синий */
  --c-red: #c7362f;
  /* красный */
  --c-gray: #6f6f6e;
  /* серый */
  --header-height: 64px;
  --content-padding-y: 20px;
}

* {
  box-sizing: border-box
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

/* Глобально шире на всём сайте */
.container {
  width: 96%;
  max-width: 100%;
  margin: 0 auto;
  padding: 0 12px;
}

/* Header */
.site-header {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 6px 24px rgba(2, 6, 23, .04);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px
}

.brand-title {
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  letter-spacing: .2px;
  font-family: "Raleway", "Poppins", system-ui, -apple-system, Segoe UI, Roboto, Arial;
}

.nav {
  display: flex;
  align-items: center;
  gap: 12px
}

.nav-user {
  color: var(--muted);
  font-size: 14px
}

/* Footer */
.site-footer {
  padding: 16px 0;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: var(--panel);
  margin-top: auto;
  /* футер уезжает вниз */
}

/* Content wrapper */
.content {
  padding: var(--content-padding-y) 0
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: all .15s ease;
  box-shadow: 0 1px 0 rgba(2, 6, 23, .04);
  font-family: "Poppins", system-ui, -apple-system, Segoe UI, Roboto, Arial;
}

.btn:hover {
  transform: translateY(-1px)
}

.btn:active {
  transform: translateY(0)
}


.btn-light {
  background: var(--panel);
  border-color: var(--border);
  color: var(--text)
}

/* Cards / panels */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.card h1 {
  margin: 0 0 8px;
  font-size: 20px
}

.card .hint {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px
}

/* Forms */
label {
  display: block;
  margin: 10px 0 6px;
  color: var(--muted);
  font-size: 13px
}

input,
select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  outline: none;
}

input:focus,
select:focus {
  border-color: #cbd5e1;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12)
}

.form-actions {
  margin-top: 14px;
  display: flex;
  gap: 10px
}

/* alerts */
.alert {
  margin: 16px 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #fecaca;
  background: #fff7f7;
  color: #b91c1c;
}

/* Report layout */
.report-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  height: 100%;
}

.report-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
}

.report-chip {
  padding: 6px 10px;
  background: #eef2ff;
  border: 1px solid #e0e7ff;
  border-radius: 999px;
  color: #3730a3;
  font-size: 12px
}


.report-holder {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}

.report-holder .report-container {
  flex: 1 1 auto;
}

.report-loader {
  position: absolute;
  inset: 0;
  background: #fff;
  z-index: 10;
}

.report-loader .spinner {
  width: 48px;
  height: 48px;
  border: 5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.report-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-shrink: 0;
}


.icon-btn:disabled {
  opacity: .5;
  cursor: not-allowed
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: var(--text)
}

.counter {
  color: var(--muted);
  font-size: 13px
}

.select-wrap {
  position: relative
}

.select-wrap select {
  max-width: 420px
}

/* tiny banner */
.banner {
  position: fixed;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  background: #111827;
  color: #f9fafb;
  border: 1px solid #1f2937;
  padding: 10px 14px;
  border-radius: 10px;
  display: none;
  z-index: 1000;
  box-shadow: var(--shadow)
}

/* ===== Auth (Login) ===== */

body {
  font-family: "Poppins", system-ui, -apple-system, Segoe UI, Roboto, Arial;
}

.auth-shell {
  min-height: calc(100vh - 140px);
  /* с учётом шапки/футера */
  display: grid;
  place-items: center;
  padding: 24px 0;
}

.auth-gradient {
  background: linear-gradient(90deg, #6687c3 0%, #84c4f0 100%);
  border-radius: 26px;
  margin: 16px;
  padding: 6px;
  box-shadow: var(--shadow);
}

.auth-card {
  background: #ffffff;
  color: var(--text);
  border-radius: 20px;
  padding: clamp(18px, 4vw, 40px);
  border: 20px solid transparent;
  /* имитация толстой рамки из примера */
}

.auth-title {
  text-align: center;
  font-weight: 700;
  letter-spacing: .2px;
  font-size: clamp(28px, 4.5vw, 44px);
  margin: 8px 0 24px;
  font-family: "Poppins", sans-serif;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.form-field label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 16px;
}

.form-field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  box-shadow: 0 1px 0 rgba(2, 6, 23, .04);
}

.form-field input::placeholder {
  color: #94a3b8;
}

.form-field input:focus {
  outline: none;
  transform: scale(1.02);
  border-color: #cbd5e1;
  box-shadow: 0 0 0 4px rgba(34, 84, 114, .15);
}

.auth-submit {
  margin-top: 8px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  color: #fff;
  font-weight: 600;
  letter-spacing: .3px;
  background: linear-gradient(90deg, #6687c3 0%, #84c4f0 100%);
  transition: transform .15s ease, filter .2s ease;
  box-shadow: 0 10px 24px rgba(34, 84, 114, .25);
}

.auth-submit:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

.auth-submit:active {
  transform: translateY(0);
}

.auth-meta {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  text-align: center;
}

.meta-text {
  color: var(--muted);
  font-size: 14px;
}

.meta-terms {
  color: var(--muted);
  font-size: 13px;
}

.meta-link {
  color: #2563eb;
  text-decoration: none;
  position: relative;
  padding-bottom: 2px;
  background-image: linear-gradient(#6687c3, #84c4f0);
  background-position: left bottom;
  background-repeat: no-repeat;
  background-size: 0% 2px;
  transition: background-size .35s ease;
}

.meta-link:hover {
  background-size: 100% 2px;
}


/* OTP inputs в стиле логин-инпутов */
.form-field-input-otp {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 20px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  transition: all .2s ease;
  box-shadow: 0 1px 0 rgba(2, 6, 23, .04);
}

.form-field-input-otp:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
  transform: scale(1.05);
}

.auth-checkbox {
  display: flex !important;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}

.auth-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
}

.auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.auth-logo img {
  max-width: 70px;
  /* или любое нужное значение */
  height: auto;
}

.brand-link {
  display: flex;
  align-items: center;
}

.brand-logo {
  height: 40px;
  /* подбери размер под высоту шапки (у тебя .header-inner = 64px) */
  width: auto;
  display: block;
}

.reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.report-card {
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease;
}

.report-name {
  font-weight: 600;
  margin-bottom: 4px;
}

.report-sub {
  color: var(--muted);
  font-size: 13px;
}

body {
  display: flex;
  flex-direction: column;
  min-width: 100%;
  /* растягиваем по ширине */
}

main {
  flex: 1;
  /* занимает оставшееся место */
  width: 100%;
  /* не сжимается */
}


/* Для страниц отчётов используем свой контейнер, без жёсткого ограничения */
.container--wide {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0 16px;
  /* небольшой внутренний отступ */
}

/* Макет отчёта: слева список, справа сам отчёт */
.report-layout {
  --sidebar-width: 260px;
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  gap: 16px;
  align-items: stretch;
  min-height: 0;
  transition: grid-template-columns .3s ease, gap .3s ease;
}

.report-layout.sidebar-hidden {
  --sidebar-width: 48px;
  grid-template-columns: var(--sidebar-width) 1fr;
  gap: 12px;
}

/* Сайдбар */
.report-sidebar {
  position: sticky;
  top: calc(var(--header-height) + var(--content-padding-y));
  /* ниже шапки */
  align-self: start;
  max-height: calc(100vh - var(--header-height) - var(--content-padding-y) - 32px);
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 12px;
  overflow: visible;
  transition: transform .3s ease, background .3s ease, border-color .3s ease, box-shadow .3s ease, padding .3s ease;
}

.report-layout.sidebar-hidden .report-sidebar {
  transform: translateX(calc(-100% + 48px));
  padding: 12px 8px;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.report-layout.sidebar-hidden .sidebar-toggle {
  align-self: flex-end;
  box-shadow: var(--shadow);
  z-index: 1;
}

.sidebar-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  transition: opacity .3s ease, transform .3s ease;
}

.report-layout.sidebar-hidden .sidebar-content {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-24px);
}

.sidebar-title {
  font-weight: 600;
}

.sidebar-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-item {
  display: block;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
}

.sidebar-item .line-1 {
  font-weight: 600;
  font-size: 14px;
  display: block;
}

.sidebar-item .line-2 {
  font-size: 12px;
  color: var(--muted);
  display: block;
}

.sidebar-item:hover {
  transform: translateY(-1px);
  transition: transform .15s ease;
}

.sidebar-item.active {
  border-color: #c7d2fe;
  background: #eef2ff;
}

/* Контент с отчётом */
.report-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body.page-report {
  overflow: hidden;
}

body.page-report main.content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-bottom: 0;
}

body.page-report .container--wide {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body.page-report .report-layout {
  flex: 1 1 auto;
  min-height: 0;
}

body.page-report .report-wrap {
  flex: 1 1 auto;
  min-height: 0;
}

body.page-report .report-holder {
  flex: 1 1 auto;
  min-height: 0;
}

body.page-report .report-container {
  height: 100%;
}


/* На мобильных — вертикально */
@media (max-width: 900px) {
  .report-layout {
    grid-template-columns: 1fr;
  }

  .report-layout.sidebar-hidden {
    grid-template-columns: 1fr;
  }

  .report-sidebar {
    position: static;
    max-height: none;
  }

  .report-layout.sidebar-hidden .report-sidebar {
    transform: none;
    padding: 12px 0 0;
    background: transparent;
    border-color: transparent;
    box-shadow: none;
  }

  .report-layout.sidebar-hidden .sidebar-toggle {
    align-self: flex-start;
  }

  .report-layout.sidebar-hidden .sidebar-content {
    display: none;
  }
}

.site-footer a {
  color: inherit;
  /* берём цвет текста футера */
  text-decoration: none;
  /* убираем подчёркивание */
}

.site-footer a:hover {
  text-decoration: underline;
  /* можно подсветить при наведении, если нужно */
}

/* =========================
   Доступные отчёты (современно, крупно)
   ========================= */

/* сетка 5 в ряд */
.reports-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width:1400px) {
  .reports-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width:1100px) {
  .reports-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width:800px) {
  .reports-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width:520px) {
  .reports-grid {
    grid-template-columns: 1fr;
  }
}

.report-card {
  /* размеры цветного угла (адаптивно) */
  --corner-w: clamp(110px, 18vw, 240px);
  --corner-h: clamp(70px, 12vw, 160px);

  --accent: var(--c-bright-blue);

  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 190px;

  /* БАЗОВЫЕ ПОЛЯ + SAFE-ЗОНА под угол */
  padding: 22px;
  padding-right: calc(22px + var(--corner-w) * 0.55);
  padding-top: calc(22px + var(--corner-h) * 0.30);

  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);

  color: inherit;
  text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  overflow: hidden;
  isolation: isolate;
}

/* сам цветной угол — ПОД контентом */
.report-card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: var(--corner-w);
  height: var(--corner-h);
  clip-path: polygon(100% 0, 0 0, 100% 100%);
  background: linear-gradient(135deg,
      color-mix(in srgb, var(--accent) 55%, white) 0%,
      color-mix(in srgb, var(--accent) 28%, transparent) 100%);
  opacity: .9;
  z-index: 0;
  pointer-events: none;
}

/* контент над фоном */
.report-card>* {
  position: relative;
  z-index: 1;
}

/* ротация фирменных акцентов */
.reports-grid .report-card:nth-child(9n+1) {
  --accent: var(--c-bright-blue);
}

.reports-grid .report-card:nth-child(9n+2) {
  --accent: var(--c-blue);
}

.reports-grid .report-card:nth-child(9n+3) {
  --accent: var(--c-soft-blue);
}

.reports-grid .report-card:nth-child(9n+4) {
  --accent: var(--c-deep-navy);
}

.reports-grid .report-card:nth-child(9n+5) {
  --accent: var(--c-clay);
}

.reports-grid .report-card:nth-child(9n+6) {
  --accent: var(--c-deep-purple);
}

.reports-grid .report-card:nth-child(9n+7) {
  --accent: var(--c-ruby);
}

.reports-grid .report-card:nth-child(9n+8) {
  --accent: var(--c-red);
}

.reports-grid .report-card:nth-child(9n+9) {
  --accent: var(--c-gray);
}

/* заголовок и подпись */
.report-card__title {
  font-weight: 800;
  font-size: clamp(14px, 1.25vw, 18px);
  line-height: 1.25;
  letter-spacing: .2px;
  margin: 6px 0 10px;

  /* не даём тексту упираться в угол */
  max-width: 100%;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.report-card__meta {
  margin-top: auto;
  font-size: 13px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.report-card__meta::after {
  content: "⟶";
  opacity: .55;
  transform: translateY(1px);
}

/* hover/focus */
.report-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
  box-shadow: 0 16px 34px rgba(2, 6, 23, .12);
}

.report-card:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 32%, transparent);
  outline-offset: 2px;
  border-color: color-mix(in srgb, var(--accent) 38%, var(--border));
}

/* чуть крупнее на очень широких */
@media (min-width:1600px) {
  .report-card {
    min-height: 200px;
    padding: 24px;
    padding-right: calc(24px + var(--corner-w) * 0.55);
    padding-top: calc(24px + var(--corner-h) * 0.30);
  }
}

/* только на страницах авторизации */
.auth-shell .lang-switch {
  position: absolute;
  top: 16px;
  right: 16px;

  margin: 0;
  z-index: 10;
  /* чтобы было поверх формы */
}

/* Верхняя панель действий */
.report-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

/* Контейнер отчёта */
.report-container {
  width: 100%;
  height: 100%;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.report-container iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Верхняя панель = та же сетка, что и контент */
.report-topbar-grid {
  display: grid;
  grid-template-columns: 260px 1fr;
  /* как .report-layout */
  gap: 16px;
  margin-bottom: 14px;
  align-items: center;
  transition: grid-template-columns .3s ease, gap .3s ease;
}

.report-topbar-grid.sidebar-hidden {
  grid-template-columns: auto 1fr;
  gap: 12px;
}

.report-topbar-grid.sidebar-hidden .btn-wide {
  width: 38px;
  height: 38px;
  padding: 0;
  justify-content: center;
  min-width: 0;
}

/* Левая колонка — просто кнопка */
.report-topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#btnBack {
  gap: 8px;
  border-radius: 12px;
}

.btn-back-icon {
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.report-topbar-grid.sidebar-hidden #btnBack .btn-back-label {
  display: none;
}

/* Правая колонка — заголовок и иконка */
.report-topbar-right {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sidebar-toggle {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--primary);
  cursor: pointer;
  transition: color .2s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .08);
}

.sidebar-toggle:hover {
  color: var(--c-deep-navy);
  border-color: #cbd5e1;
}

.sidebar-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.sidebar-toggle-icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  transition: transform .3s ease;
}

.sidebar-toggle[aria-expanded="false"] .sidebar-toggle-icon {
  transform: scaleX(-1);
}

/* Заголовок теперь будет идти от левого края отчёта */
.report-title {
  flex: 1 1 auto;
  text-align: left;
  font-size: 1.5rem;
  /* ~24px */
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* На маленьких экранах позволим перенос */
@media (max-width: 720px) {
  .report-title {
    white-space: normal;
    font-size: 1.25rem;
  }
}

/* ===== Admin UI ===== */
.admin-shell {
  display: grid;
  gap: 16px;
}

.admin-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

.admin-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.admin-tabs {
  display: flex;
  gap: 8px;
}

.admin-tab {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  cursor: pointer;
  transition: .15s ease;
  font: inherit;
}

.admin-tab.is-active {
  border-color: #c7d2fe;
  background: #eef2ff;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1.4fr .9fr;
  gap: 16px;
}

@media (max-width: 1000px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }
}

.admin-col__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.admin-h2 {
  margin: 0;
  font-size: 18px;
}

.admin-h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

/* table */
.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.table th,
.table td {
  padding: 10px 12px;
  text-align: left;
}

.table thead th {
  position: sticky;
  top: 0;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
}

.table tbody tr+tr td {
  border-top: 1px solid var(--border);
}

.btn-sm {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
}

.ml-6 {
  margin-left: 6px;
}

/* form */
.admin-form {
  position: sticky;
  top: 88px;
  align-self: start;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.form-field .input {
  width: 100%;
}

.fieldset {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  margin: 4px 0 0;
}

.fieldset>legend {
  padding: 0 6px;
  font-size: 13px;
  color: var(--muted);
}

.form-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
}

.chip input {
  margin: 0;
}

.chip--warn {
  border-color: #fecaca;
  background: #fff7f7;
}

/* checklist */
.checklist {
  display: grid;
  gap: 6px;
  max-height: 240px;
  overflow: auto;
}

.checkitem {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
}

.checkitem.is-disabled {
  opacity: .6;
}

.checkitem__text {
  font-weight: 600;
}

.checkitem__meta {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

/* badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef2ff;
  border: 1px solid #e0e7ff;
  font-size: 12px;
  line-height: 1;
}

.badge--blue {
  background: #e0f2fe;
  border-color: #bae6fd;
}

.badge--demo {
  background: #ede9fe;
  border-color: #c4b5fd;
  color: #5b21b6;
}

.badge--muted {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #475569;
}

.badge--ok {
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #15803d;
}

.badge--warn {
  background: #fff7f7;
  border-color: #fecaca;
  color: #b91c1c;
}

/* hide helper */
.admin-section.is-hidden {
  display: none;
}


/* ===== Admin modal ===== */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  z-index: 1000;
}

.modal.is-open {
  display: grid;
  background: rgba(0, 0, 0, .32);
  backdrop-filter: saturate(120%) blur(2px);
}

.modal__overlay {
  position: absolute;
  inset: 0;
}

.modal__dialog {
  position: relative;
  width: min(720px, 96vw);
  max-height: 96vh;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  background: var(--panel, #fff);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .18);
  animation: modal-pop .16s ease-out;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.modal__title {
  margin: 0;
  font-size: 18px;
}

.modal__close {
  appearance: none;
  border: 0;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: #475569;
  padding: 4px 8px;
  border-radius: 8px;
}

.modal__close:hover {
  background: #f1f5f9;
}

.modal__body {
  padding: 14px 16px;
  overflow-y: auto;
  flex: 1 1 auto;
}

.modal__footer {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

/* wider dialog and two-column layout for user form */
#userModal .modal__dialog {
  width: min(1000px, 96vw);
}

#userForm .form-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

#userForm .form-reports {
  margin: 0;
  display: flex;
  flex-direction: column;
}


@keyframes modal-pop {
  from {
    transform: translateY(6px) scale(.98);
    opacity: 0;
  }

  to {
    transform: none;
    opacity: 1;
  }
}

/* single-column users grid (since form moved to modal) */
.admin-grid--single {
  grid-template-columns: 1fr;
}

/* ===== Admin tune-ups ===== */

/* Чуть крупнее общий кегль внутри админки */
.admin--xl-font {
  font-size: 16px;
}

/* Таблица пользователей: фиксированные колонки, чтобы ничего не "ехало" */
.table--fixed {
  table-layout: fixed;
}

#usersTable th.col-status,
#usersTable td.cell-status {
  width: 140px;
  text-align: center;
}

#usersTable th.col-actions,
#usersTable td.t-actions {
  width: 108px;
  text-align: right;
}

#usersTable td,
#usersTable th {
  vertical-align: middle;
}

/* Бейджи одинаковой ширины */
.status-badge {
  min-width: 120px;
  justify-content: center;
}

/* Иконки-кнопки */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  cursor: pointer;
  transition: all .15s ease;
  margin-left: 6px;
}

.icon-btn:hover {
  filter: brightness(1.03);
  box-shadow: 0 1px 0 rgba(2, 6, 23, .04);
}

.t-actions {
  white-space: nowrap;
}

/* Иконка "корзина" (через CSS — чтобы не тянуть SVG) */
.icon-trash {
  display: inline-block;
  width: 18px;
  height: 18px;
  position: relative;
  box-sizing: border-box;
}

.icon-trash:before,
.icon-trash:after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: currentColor;
}

.icon-trash:before {
  width: 14px;
  height: 12px;
  bottom: 1px;
  border: 1.6px solid currentColor;
  border-radius: 3px;
  background: transparent;
}

.icon-trash:after {
  width: 16px;
  height: 2px;
  top: -2px;
  border-radius: 2px;
}

/* Ровный список отчётов с переключателями */
.list {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
  margin-top: 8px;
}

.listitem {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  min-height: 46px;
}

.listitem.is-disabled {
  opacity: .6;
  pointer-events: none;
}

.listitem__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.listitem__title {
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.listitem__meta {
  font-size: 12px;
  color: var(--muted);
}

/* Переключатель (switch) */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

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

.switch__ui {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #f1f5f9;
  position: relative;
  transition: all .15s ease;
  box-shadow: inset 0 1px 0 rgba(0, 0, 0, .03);
}

.switch__ui::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 3px;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--border);
  transition: left .15s ease;
}

.switch input:checked+.switch__ui {
  background: #dbeafe;
  border-color: #bfdbfe;
}

.switch input:checked+.switch__ui::after {
  left: 21px;
}

.switch__label {
  color: var(--muted);
  font-size: 14px;
}

/* Кнопки/вкладки — чуть крупнее, чтобы соответствовать остальному UI */
.admin-tab {
  font-size: 15px;
}

.table th {
  font-size: 14px;
}

.table td {
  font-size: 15px;
}

/* ===== Material Symbols tune ===== */
.material-symbols-outlined {
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  font-size: 20px;
  line-height: 1;
  display: inline-block;
  vertical-align: middle;
}

.t-actions {
  white-space: nowrap;
}

/* Таблица пользователей: фиксированные колонки, чтобы ничего не «ехало» */
.table--fixed {
  table-layout: fixed;
}

#usersTable th.col-status,
#usersTable td.cell-status {
  width: 140px;
  text-align: center;
}

#usersTable th.col-actions,
#usersTable td.col-actions,
#usersTable td.t-actions {
  width: 108px;
  text-align: right;
}

#usersTable td,
#usersTable th {
  vertical-align: middle;
}

/* Бейджи статуса с одинаковой шириной */
.status-badge {
  min-width: 120px;
  justify-content: center;
}

/* Ровный список отчётов с переключателями (switch) */
.list {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
  margin-top: 8px;
}

.listitem {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  min-height: 46px;
}

.listitem.is-disabled {
  opacity: .6;
  pointer-events: none;
}

.listitem__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.listitem__title {
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.listitem__meta {
  font-size: 12px;
  color: var(--muted);
}

/* Переключатель (switch) */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

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

.switch__ui {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #f1f5f9;
  position: relative;
  transition: all .15s ease;
  box-shadow: inset 0 1px 0 rgba(0, 0, 0, .03);
}

.switch__ui::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 3px;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--border);
  transition: left .15s ease;
}

.switch input:checked+.switch__ui {
  background: #dbeafe;
  border-color: #bfdbfe;
}

.switch input:checked+.switch__ui::after {
  left: 21px;
}

.switch__label {
  color: var(--muted);
  font-size: 14px;
}

.btn-lg {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 15px;
}

.table th {
  font-size: 14px;
}

.table td {
  font-size: 15px;
}

/* Модалки — уже добавлены ранее, оставляем без изменений */

/* ========== Brand-mapped primary button (корп. цвета) ========== */
:root {
  /* можно быстро поменять бренд-кнопки на рубин, просто заменив var(--c-deep-navy) -> var(--c-ruby) */
  --brand: var(--c-deep-navy);
  --brand-contrast: #fff;
}

/* базовое состояние */
.btn-primary {
  background: var(--brand);
  color: var(--brand-contrast);
  border: 1px solid color-mix(in srgb, var(--brand), black 12%);
}

/* hover / active */
.btn-primary:hover {
  background: color-mix(in srgb, var(--brand), black 8%);
  border-color: color-mix(in srgb, var(--brand), black 18%);
}

.btn-primary:active {
  background: color-mix(in srgb, var(--brand), black 16%);
  border-color: color-mix(in srgb, var(--brand), black 22%);
}

/* focus */
.btn-primary:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--brand), white 30%);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand), white 55%);
}

/* disabled */
.btn-primary:disabled {
  background: color-mix(in srgb, var(--brand), white 38%);
  border-color: color-mix(in srgb, var(--brand), white 22%);
  color: color-mix(in srgb, var(--brand-contrast), black 35%);
  cursor: not-allowed;
}

/* ----- Фолбэк для браузеров без color-mix (например, старый Safari/Chromium) ----- */
@supports not (color: color-mix(in srgb, #000, #fff)) {
  .btn-primary {
    background: #225472;
    border-color: #1b435a;
    color: #fff;
  }

  .btn-primary:hover {
    background: #1d4a63;
    border-color: #173f54;
  }

  .btn-primary:active {
    background: #173f54;
    border-color: #123345;
  }

  .btn-primary:disabled {
    background: #9fb8c8;
    border-color: #b7c8d3;
    color: #f8fafc;
  }
}

/* Новый бейдж статуса: Неактивен (не принял политику) */
.badge--inactive {
  background: var(--c-soft-blue);
  /* #c7e3f9 */
  border: 1px solid color-mix(in srgb, var(--c-soft-blue), #000 12%);
  color: var(--c-deep-navy);
  /* #225472 */
}

@supports not (color: color-mix(in srgb, #000, #fff)) {
  .badge--inactive {
    background: #c7e3f9;
    border-color: #a9c8e3;
    color: #225472;
  }
}

.secret-box {
  display: flex;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  background: #fff;
}

.secret-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 16px;
}

/* ==== Fix right scroll only by layout clamps ==== */
html,
body {
  overflow-x: hidden;
}

/* последняя линия обороны */
.content,
.admin-shell,
.admin-section,
.card,
.admin-grid,
.form-grid {
  max-width: 100%;
  min-width: 0;
}

/* grid должен уметь сжиматься без переполнения */
.admin-grid--single {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

/* любые текстовые блоки внутри — не растягиваем контейнер */
.form-field .input,
.secret-input,
.listitem,
.listitem__text {
  max-width: 100%;
}

.listitem__title,
.listitem__meta {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* иногда overflow даёт кнопка с иконкой/гэпы — обрежем край у строки */
#tab-security {
  overflow-x: clip;
}

/* только на вкладке Security */

/* ==== ensure [hidden] is really hidden ==== */
[hidden] {
  display: none !important;
}

/* Хлебные крошки */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0 14px;
  color: var(--muted);
  font-size: 16px;
}

.crumb {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px dotted #cbd5e1;
}

.crumb:hover {
  border-bottom-color: transparent;
}

.crumb-sep {
  opacity: .6;
}

.crumb.is-current {
  color: var(--muted);
  border-bottom: none;
  cursor: default;
}

/* === Folder card styling === */
.folder-card {
  position: relative;
  overflow: hidden;
}

/* убираем цветной уголок у папки */
.folder-card::before {
  display: none;
}

/* большой полупрозрачный фон-иконка папки */
.folder-card__bg-icon {
  position: absolute;
  right: 12px;
  bottom: 12px;
  opacity: 0.25;
  /* чуть ярче чем 0.1 */
  color: var(--accent);
  /* используем акцентный цвет */
  pointer-events: none;
  z-index: 0;
}

.folder-card__title,
.folder-card__meta {
  position: relative;
  z-index: 1;
  /* поверх иконки */
}

.folder-card__title {
  font-weight: 600;
}

.folder-card__meta {
  color: var(--muted);
  font-size: 14px;
}


.folder-card__bg-icon svg {
  width: 120px;
  height: 120px;
}

/* ---------- Explorer styles ---------- */
.explorer {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.explorer__toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.tree {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

.tree-node {
  position: relative;
  padding-left: 24px;
  margin: 6px 0;
}

.tree-node__row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 8px;
}

.tree-node__row:hover {
  background: var(--bg-soft);
}

.tree-node__toggle {
  position: absolute;
  left: 0;
  top: 6px;
  width: 18px;
  height: 18px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: .7;
}

.tree-node__toggle:disabled {
  opacity: .25;
  cursor: default;
}

.tree-node__icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tree-node__title {
  font-weight: 600;
}

.tree-node__meta {
  color: var(--muted);
  font-size: 12px;
}

.tree-node__actions {
  margin-left: auto;
  display: inline-flex;
  gap: 6px;
}

.tree-children {
  margin-left: 22px;
  margin-top: 4px;
}

.badge-kind {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--muted);
}

.icon-btn.small {
  width: 28px;
  height: 28px;
}

.select-inline {
  min-width: 200px;
}

/* table tweaks */
.table td.col-folder,
.table th.col-folder {
  width: 220px;
}

.tree-node__row[data-toggle] {
  cursor: pointer;
}

.tree-node__row[data-toggle]:hover {
  background: var(--bg-soft);
}

/* Flags */
.flag-img {
  width: 24px;
  height: 16px;
  object-fit: cover;
  display: inline-block;
  vertical-align: middle;
}

.lang-menu .lang-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lang-menu .lang-item .flag-img {
  width: 20px;
  height: 14px;
}

/* Обёртка для поля с иконкой */
.input-with-icon {
  position: relative;
}

/* Чуть больше правого паддинга у инпута, чтобы глазик не перекрывал текст */
.input-with-icon>input {
  padding-right: 44px;
  /* под кнопку 36px + зазор */
}

/* Кнопка-глазик внутри инпута */
.toggle-password-btn {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 10px;
  cursor: pointer;

  /* соответствие общим эффектам */
  transition: transform .15s ease, filter .2s ease, box-shadow .15s ease;
  box-shadow: 0 1px 0 rgba(2, 6, 23, .04);
  color: var(--muted);
}

.toggle-password-btn:hover {
  transform: translateY(-50%) translateY(-1px);
  filter: brightness(1.03);
}

.toggle-password-btn:active {
  transform: translateY(-50%);
}

/* Размер иконки под твой базовый стиль */
.toggle-password-btn .material-symbols-outlined {
  font-size: 20px;
  line-height: 1;
}

.report-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.loader-text {
  margin-top: 10px;
  font-size: 14px;
  color: #555;
  font-family: sans-serif;
}

/* ==== FIX: User modal – scroll only "Available reports" ==== */

/* 1) Внутри формы выравниваем элементы по содержимому, а не растягиваем */
#userForm .form-cols {
  align-items: start;
}

#userForm .form-left,
#userForm .form-reports {
  align-self: start;
}

/* 2) Отключаем прокрутку body модалки именно для модалки пользователя,
      чтобы не скроллилась вся модалка, когда много отчётов */
#userModal .modal__body {
  overflow: hidden;
  /* было overflow-y: auto в общем правиле */
}

/* 3) Возвращаем ограничение высоты списку отчётов и включаем у него скролл */
#userForm .form-reports .list {
  flex: initial;
  /* убираем растягивание */
  max-height: min(50vh, 420px);
  overflow: auto;
}

/* ==== FIX: Password (optional) summary with plus/minus ==== */

#userForm details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  margin: 10px 0 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  /* убираем стандартный треугольник */
}

#userForm details summary::before {
  content: "+";
  /* плюсик по умолчанию */
  font-weight: 600;
  font-size: 16px;
  line-height: 1;
  color: var(--primary);
  display: inline-block;
  width: 16px;
  text-align: center;
}

/* При раскрытии details меняем плюсик на минус */
#userForm details[open] summary::before {
  content: "−";
  /* минус */
}

/* Hover-эффект для наглядности */
#userForm details summary:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* Отступ у инпута, как у остальных полей */
#userForm details input {
  margin-top: 6px;
}

#usersTable {
  table-layout: auto;
  width: auto;
  min-width: 100%;
}

#tab-users .table-wrap {
  overflow-x: auto;
  overflow-y: hidden;
}

/* Кнопка "Назад" такой же ширины, как блок "Доступные отчёты" */
.btn-wide {
  display: inline-flex;
  justify-content: left;
  width: 260px;
  /* как .report-sidebar */
}

.error-split {
  display: flex;
  gap: 0;
  background: var(--panel, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius, 14px);
  box-shadow: var(--shadow, 0 6px 24px rgba(2, 6, 23, .06));
  overflow: hidden;
  max-width: 1100px;
  margin: 0 auto;
}

.error-illustration {
  flex: 1 1 50%;
  background: color-mix(in srgb, var(--bg, #f8fafc), #000 2%);
  display: grid;
  place-items: center;
  padding: clamp(18px, 4vw, 40px);
}

.error-illustration img {
  max-width: min(520px, 100%);
  height: auto;
}

.error-content {
  flex: 1 1 50%;
  padding: clamp(24px, 5vw, 60px);
  display: grid;
  align-content: center;
  gap: 12px;
}

.error-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted, #64748b);
  background: #eef2ff;
  border: 1px solid #e0e7ff;
  border-radius: 999px;
  padding: 6px 10px;
  width: fit-content;
}

.error-title {
  margin: 6px 0 4px;
  font-weight: 800;
  letter-spacing: .2px;
  font-size: clamp(28px, 4vw, 44px);
}

.error-sub {
  color: var(--muted, #64748b);
  font-size: clamp(15px, 2vw, 18px);
  line-height: 1.6;
  margin: 0 0 8px;
}

.error-actions {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Мобильная адаптация */
@media (max-width: 900px) {
  .error-split {
    flex-direction: column;
  }

  .error-illustration {
    order: -1;
  }
}
