/*
 * Дизайн-система VOE.
 *
 * Один файл без сборки — проект поднимается artisan serve, без npm.
 * Устроен слоями: токены → база → раскладка → компоненты → экраны → адаптив.
 * Тема следует настройке системы и переключателю в шапке (data-theme).
 *
 * Цвета графиков — отдельные токены (--viz-*): порядковая рампа одного тона,
 * проверенная на монотонность светлоты и контраст с поверхностью.
 */

/* ============================================================ ТОКЕНЫ */

:root {
  color-scheme: light;

  /* Поверхности: тёплая бумага под контентом, белые карточки поверх. */
  --bg:          #F6F5F1;
  --bg-tint:     #EFEEE8;
  --surface:     #FFFFFF;
  --surface-2:   #F4F3EE;
  --surface-3:   #EAE9E2;
  --overlay:     rgba(19, 21, 17, .38);

  /* Текст */
  --ink:         #131511;
  --ink-2:       #4B4F46;
  --ink-3:       #7C8177;
  --ink-4:       #A9AEA3;

  /* Линии */
  --line:        rgba(19, 21, 17, .10);
  --line-2:      rgba(19, 21, 17, .18);

  /* Бренд */
  --accent:      #14664A;
  --accent-hi:   #0F5238;
  --on-accent:   #FFFFFF;
  --accent-lo:   #E7F1EC;
  --accent-ink:  #0C4531;

  /* Второй акцент — статусы «в работе», отметки редакции */
  --gold:        #A97C2F;
  --gold-lo:     #F7EFE0;

  --danger:      #A93226;
  --danger-lo:   #FAEBE8;
  --info:        #2A5F9E;
  --info-lo:     #E9F0F9;

  /* Данные: порядковая рампа одного тона + цвет затухания */
  --viz-1:       #6FBF9F;
  --viz-2:       #3FA37D;
  --viz-3:       #22815C;
  --viz-4:       #0F5238;
  --viz-mute:    #A9ADA4;
  --viz-track:   #EAE9E2;

  /* Тени: мягкие, тёплые, почти незаметные */
  --shadow-1:  0 1px 2px rgba(19, 21, 17, .05), 0 1px 3px rgba(19, 21, 17, .04);
  --shadow-2:  0 4px 12px rgba(19, 21, 17, .07), 0 2px 4px rgba(19, 21, 17, .04);
  --shadow-3:  0 18px 40px rgba(19, 21, 17, .13), 0 4px 12px rgba(19, 21, 17, .07);

  /* Скругления */
  --r-xs: 6px;
  --r-sm: 9px;
  --r-md: 13px;
  --r-lg: 18px;
  --r-xl: 26px;
  --r-full: 999px;

  /* Шаг сетки */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 22px; --s-6: 30px; --s-7: 42px; --s-8: 60px; --s-9: 84px;

  /* Типографика */
  --font-ui:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Fraunces', 'Playfair Display', Georgia, serif;

  --t-xs:   12px;
  --t-sm:   13px;
  --t-base: 14.5px;
  --t-md:   16px;
  --t-lg:   18px;
  --t-xl:   clamp(21px, 1.4vw + 16px, 25px);
  --t-2xl:  clamp(26px, 2vw + 18px, 34px);
  --t-3xl:  clamp(32px, 3.4vw + 20px, 52px);

  --ease: cubic-bezier(.2, .8, .2, 1);
}

/* Тёмная тема: та же система, свои поверхности и свои шаги рампы. */
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg:        #0F110F;
    --bg-tint:   #151815;
    --surface:   #171A17;
    --surface-2: #1E221E;
    --surface-3: #262B26;
    --overlay:   rgba(0, 0, 0, .55);

    --ink:       #F1F2EC;
    --ink-2:     #BEC3B9;
    --ink-3:     #8D948A;
    --ink-4:     #666C64;

    --line:      rgba(255, 255, 255, .10);
    --line-2:    rgba(255, 255, 255, .18);

    --accent:    #4FB68C;
    --accent-hi: #6ECBA3;
    --on-accent: #0F110F;
    --accent-lo: rgba(79, 182, 140, .13);
    --accent-ink:#8FDCBA;

    --gold:      #D6A961;
    --gold-lo:   rgba(214, 169, 97, .14);
    --danger:    #E0776A;
    --danger-lo: rgba(224, 119, 106, .14);
    --info:      #7FA9DE;
    --info-lo:   rgba(127, 169, 222, .14);

    --viz-1:     #7FC7AC;
    --viz-2:     #57B392;
    --viz-3:     #2F9670;
    --viz-4:     #1F8259;
    --viz-mute:  #5B615C;
    --viz-track: #262B26;

    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-2: 0 6px 16px rgba(0, 0, 0, .45);
    --shadow-3: 0 20px 44px rgba(0, 0, 0, .55);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg:        #0F110F;
  --bg-tint:   #151815;
  --surface:   #171A17;
  --surface-2: #1E221E;
  --surface-3: #262B26;
  --overlay:   rgba(0, 0, 0, .55);

  --ink:       #F1F2EC;
  --ink-2:     #BEC3B9;
  --ink-3:     #8D948A;
  --ink-4:     #666C64;

  --line:      rgba(255, 255, 255, .10);
  --line-2:    rgba(255, 255, 255, .18);

  --accent:    #4FB68C;
  --accent-hi: #6ECBA3;
  --on-accent: #0F110F;
  --accent-lo: rgba(79, 182, 140, .13);
  --accent-ink:#8FDCBA;

  --gold:      #D6A961;
  --gold-lo:   rgba(214, 169, 97, .14);
  --danger:    #E0776A;
  --danger-lo: rgba(224, 119, 106, .14);
  --info:      #7FA9DE;
  --info-lo:   rgba(127, 169, 222, .14);

  --viz-1:     #7FC7AC;
  --viz-2:     #57B392;
  --viz-3:     #2F9670;
  --viz-4:     #1F8259;
  --viz-mute:  #5B615C;
  --viz-track: #262B26;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-2: 0 6px 16px rgba(0, 0, 0, .45);
  --shadow-3: 0 20px 44px rgba(0, 0, 0, .55);
}

/* ============================================================ БАЗА */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font-ui);
  font-size: var(--t-base);
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

img, svg { max-width: 100%; }
b, strong { font-weight: 600; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em;
       background: var(--surface-2); padding: 1px 5px; border-radius: var(--r-xs); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

::selection { background: var(--accent-lo); color: var(--accent-ink); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: var(--r-full);
                            border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-4); background-clip: content-box; }

/* ============================================================ ТИПОГРАФИКА */

h1, h2, h3, h4 { line-height: 1.2; font-weight: 600; letter-spacing: -.011em; }
h1 { font-size: var(--t-2xl); }
h2 { font-size: var(--t-xl); }
h3 { font-size: var(--t-md); }
h4 { font-size: var(--t-base); }

.display {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -.02em;
  line-height: 1.1;
}
.display-xl { font-size: var(--t-3xl); }

.lead      { font-size: var(--t-md); color: var(--ink-2); line-height: 1.6; }
.muted     { color: var(--ink-3); }
.small     { font-size: var(--t-sm); }
.xs        { font-size: var(--t-xs); }
.num       { font-variant-numeric: tabular-nums; }
.upper     { text-transform: uppercase; letter-spacing: .08em; font-size: 11px; font-weight: 600; }
.truncate  { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Длинный текст кейса читается серифом и узкой колонкой. */
.prose { font-family: var(--font-display); font-size: 17px; line-height: 1.65; color: var(--ink-2); max-width: 68ch; }
.prose p + p { margin-top: .85em; }
.prose strong { color: var(--ink); }

/* ============================================================ РАСКЛАДКА */

.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 var(--s-5); }
.wrap-narrow { max-width: 780px; }
.wrap-mid    { max-width: 960px; }

.site-main { flex: 1 0 auto; padding: var(--s-6) 0 var(--s-9); }

.stack > * + *      { margin-top: var(--s-3); }
.stack-lg > * + *   { margin-top: var(--s-5); }
.row   { display: flex; gap: var(--s-3); flex-wrap: wrap; align-items: center; }
.row-tight { gap: var(--s-2); }
.spread{ display: flex; gap: var(--s-3); align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grow  { flex: 1 1 320px; min-width: 0; }
.mt    { margin-top: var(--s-5); }
.mb    { margin-bottom: var(--s-5); }
.mt-sm { margin-top: var(--s-3); }
.mb-sm { margin-bottom: var(--s-3); }

.grid   { display: grid; gap: var(--s-4); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-6 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
/* Два коротких поля рядом даже в узкой карточке — форма не растёт вниз. */
.grid-2-tight { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 560px) { .grid-2-tight { grid-template-columns: 1fr; } }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
/* Контент + липкая колонка действий. */
.grid-aside { display: grid; gap: var(--s-5); grid-template-columns: minmax(0, 1.65fr) minmax(280px, .95fr); align-items: start; }
.sticky-aside { position: sticky; top: 86px; }

.section { margin-top: var(--s-8); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-4); flex-wrap: wrap; }

.page-head { display: flex; gap: var(--s-5); align-items: flex-start; flex-wrap: wrap; margin-bottom: var(--s-6); }
.page-head .display { margin-top: 6px; }
.page-head .lead { margin-top: 8px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-sm); color: var(--ink-3); font-weight: 500; }
.back-link:hover { color: var(--ink); text-decoration: none; }

/* ============================================================ ШАПКА */

.topbar {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; gap: var(--s-5); height: 66px; }

.logo { display: inline-flex; align-items: baseline; gap: 7px; color: var(--ink); }
.logo:hover { text-decoration: none; }
.logo-mark {
  font-family: var(--font-display); font-size: 23px; font-weight: 600; letter-spacing: .01em;
  line-height: 1;
}
.logo-mark em { font-style: normal; color: var(--accent); }
.logo-sub { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }

.nav { display: flex; align-items: center; gap: 2px; margin-left: var(--s-3); }
.nav a {
  color: var(--ink-2); font-size: var(--t-sm); font-weight: 500;
  padding: 7px 12px; border-radius: var(--r-full);
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav a.active { background: var(--accent-lo); color: var(--accent-ink); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: var(--s-2); }

.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: var(--r-full);
  border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.icon-btn svg { width: 19px; height: 19px; }

.dot-badge {
  position: absolute; top: 2px; right: 1px;
  min-width: 17px; height: 17px; padding: 0 4px;
  background: var(--danger); color: #fff; border: 2px solid var(--surface);
  border-radius: var(--r-full); font-size: 10px; font-weight: 700; line-height: 13px;
  display: flex; align-items: center; justify-content: center;
}

.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--r-full); flex: none;
  background: var(--accent-lo); color: var(--accent-ink);
  font-weight: 600; font-size: 12.5px; letter-spacing: .02em;
}
.avatar-lg { width: 46px; height: 46px; font-size: 15px; }

.burger { display: none; }

/* ---- выпадающие меню ---- */

.menu-host { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 10px);
  width: 340px; max-width: calc(100vw - 24px);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-3);
  opacity: 0; transform: translateY(-6px) scale(.98); pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
  overflow: hidden; z-index: 70;
}
.menu.open { opacity: 1; transform: none; pointer-events: auto; }
.menu-sm { width: 250px; }
.menu-head { display: flex; align-items: center; justify-content: space-between;
             padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line); }
.menu-title { font-weight: 600; font-size: var(--t-sm); }
.menu-body { max-height: 62vh; overflow-y: auto; }
.menu-foot { padding: 10px var(--s-4); border-top: 1px solid var(--line); text-align: center; font-size: var(--t-sm); }
.menu-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px var(--s-4); color: var(--ink); border-bottom: 1px solid var(--line);
}
.menu-item:last-child { border-bottom: none; }
.menu-item:hover { background: var(--surface-2); text-decoration: none; }
.menu-item.unread { background: var(--accent-lo); }
.menu-item.unread:hover { background: color-mix(in srgb, var(--accent-lo) 70%, var(--surface-2)); }
.menu-link { display: block; padding: 9px var(--s-4); color: var(--ink); font-size: var(--t-sm); }
.menu-link:hover { background: var(--surface-2); text-decoration: none; }
.menu-sep { height: 1px; background: var(--line); margin: 4px 0; }

/* ============================================================ КНОПКИ */

.btn {
  --btn-bg: var(--accent); --btn-ink: var(--on-accent); --btn-line: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--r-full);
  border: 1px solid var(--btn-line); background: var(--btn-bg); color: var(--btn-ink);
  font: inherit; font-size: var(--t-sm); font-weight: 600; line-height: 1.2;
  cursor: pointer; white-space: nowrap;
  transition: transform .12s ease, filter .15s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; color: var(--btn-ink); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }
.btn svg { width: 16px; height: 16px; }

.btn-ghost { --btn-bg: transparent; --btn-ink: var(--ink); --btn-line: var(--line-2); }
.btn-ghost:hover { background: var(--surface-2); filter: none; }
.btn-quiet { --btn-bg: var(--surface-2); --btn-ink: var(--ink); }
.btn-quiet:hover { background: var(--surface-3); filter: none; }
.btn-danger { --btn-bg: var(--danger); }
.btn-lg { padding: 13px 24px; font-size: var(--t-base); }
.btn-sm { padding: 7px 13px; font-size: var(--t-xs); }
.btn-block { width: 100%; }

/* ============================================================ КАРТОЧКИ */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  box-shadow: var(--shadow-1);
}
.card + .card { margin-top: var(--s-4); }
.card-flat { box-shadow: none; background: transparent; }
.card-tint { background: var(--surface-2); box-shadow: none; }
.card-pad-0 { padding: 0; overflow: hidden; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
              margin-bottom: var(--s-4); flex-wrap: wrap; }
.card-title h2, .card-title h3 { margin: 0; }

.card-link { display: block; color: inherit; }
.card-link:hover { text-decoration: none; border-color: var(--line-2); box-shadow: var(--shadow-2); }

.divide > * + * { border-top: 1px solid var(--line); padding-top: var(--s-4); margin-top: var(--s-4); }

/* ---- статистика ---- */

.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
        padding: var(--s-4) var(--s-5); display: block; color: inherit; }
a.stat:hover { text-decoration: none; border-color: var(--line-2); box-shadow: var(--shadow-2); }
.stat-value { font-size: 30px; font-weight: 600; line-height: 1.05; letter-spacing: -.02em; }
.stat-label { color: var(--ink-3); font-size: var(--t-xs); margin-top: 5px; }
.stat-hero { font-size: clamp(38px, 4vw, 54px); font-weight: 600; letter-spacing: -.03em; }

/* ============================================================ БЕЙДЖИ */

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: var(--r-full);
  background: var(--surface-2); color: var(--ink-2);
  font-size: var(--t-xs); font-weight: 600; line-height: 1.35; white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .75; }
.badge-plain::before { display: none; }
.badge-green { background: var(--accent-lo); color: var(--accent-ink); }
.badge-gold  { background: var(--gold-lo);   color: var(--gold); }
.badge-red   { background: var(--danger-lo); color: var(--danger); }
.badge-info  { background: var(--info-lo);   color: var(--info); }
.badge-muted { background: var(--surface-2); color: var(--ink-3); }

.tag {
  display: inline-block; padding: 3px 10px; border: 1px solid var(--line);
  border-radius: var(--r-full); font-size: var(--t-xs); color: var(--ink-3); background: transparent;
}
a.tag:hover { border-color: var(--line-2); color: var(--ink); text-decoration: none; }
a.tag.active { background: var(--ink); border-color: var(--ink); color: var(--bg); }

/* ============================================================ ФОРМЫ */

label { display: block; font-size: var(--t-sm); font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field + .field { margin-top: var(--s-4); }
.hint { font-size: var(--t-xs); color: var(--ink-3); margin-top: 6px; line-height: 1.5; }
.req { color: var(--danger); }

input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], input[type=search], input[type=tel], input[type=url], select, textarea {
  width: 100%; padding: 11px 13px;
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink);
  font: inherit; font-size: var(--t-base);
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--ink-4); }
input:hover, select:hover, textarea:hover { border-color: var(--ink-4); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-lo);
}
textarea { min-height: 104px; resize: vertical; line-height: 1.55; }
select {
  appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5 6 6.5l5-5' stroke='%237C8177' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
[disabled] { opacity: .82; cursor: default; }
select[disabled], input[disabled], textarea[disabled] { background: var(--surface-2); }

.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 400;
         color: var(--ink-2); font-size: var(--t-base); margin-bottom: 0; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); flex: none; }

/* Выбор из списка: карточка-переключатель вместо голого чекбокса. */
.choice-grid { display: grid; gap: var(--s-2); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.choice {
  display: flex; gap: 10px; align-items: flex-start; margin: 0;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); cursor: pointer;
  font-weight: 400; font-size: var(--t-sm); color: var(--ink-2);
  transition: border-color .15s, background .15s;
}
.choice:hover { border-color: var(--line-2); }
.choice input { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-lo); color: var(--ink); }
.choice b { display: block; color: var(--ink); }

.filters { display: flex; gap: var(--s-3); flex-wrap: wrap; align-items: center; }
.filters .field { margin: 0; }
.search-field { position: relative; flex: 1 1 240px; }
.search-field input { padding-left: 38px; }
.search-field svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
                    width: 16px; height: 16px; color: var(--ink-3); pointer-events: none; }


/* ---- Регистрация: выбор роли и пароль ---- */

.intent-grid { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.intent-card {
  position: relative; display: grid; gap: 12px; margin: 0;
  grid-template-columns: auto 1fr auto; align-items: start;
  padding: 16px; border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); cursor: pointer; font-weight: 400;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.intent-card:hover { border-color: var(--line-2); box-shadow: var(--shadow-1); }
.intent-card input { position: absolute; opacity: 0; pointer-events: none; }
.intent-card:has(input:checked) { border-color: var(--accent); background: var(--accent-lo); }
.intent-card:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.intent-icon {
  width: 34px; height: 34px; border-radius: var(--r-full); flex: none;
  display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2);
}
.intent-card:has(input:checked) .intent-icon { background: var(--accent); color: var(--on-accent); }
.intent-body { display: grid; gap: 4px; min-width: 0; }
.intent-body b { font-size: var(--t-base); color: var(--ink); }
.intent-lead { font-size: var(--t-sm); color: var(--ink-3); line-height: 1.45; }
.intent-badge { justify-self: start; margin-top: 2px; }
.intent-check {
  width: 22px; height: 22px; border-radius: var(--r-full); flex: none;
  display: grid; place-items: center; border: 1px solid var(--line-2); color: transparent;
}
.intent-card:has(input:checked) .intent-check { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 92px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: var(--surface-2); border: none; border-radius: var(--r-xs);
  padding: 6px 10px; font: inherit; font-size: var(--t-xs); font-weight: 600;
  color: var(--ink-2); cursor: pointer;
}
.pw-toggle:hover { background: var(--surface-3); color: var(--ink); }

/* ============================================================ СООБЩЕНИЯ */

.alert {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 16px; border-radius: var(--r-md);
  font-size: var(--t-sm); line-height: 1.5;
  border: 1px solid transparent; margin-bottom: var(--s-5);
}
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.alert-ok   { background: var(--accent-lo); color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.alert-err  { background: var(--danger-lo); color: var(--danger);     border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert-info { background: var(--info-lo);   color: var(--info);       border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.alert ul { margin: 0; padding-left: 18px; }

.empty { text-align: center; padding: var(--s-7) var(--s-5); color: var(--ink-3); }
.empty-icon { width: 44px; height: 44px; margin: 0 auto var(--s-3);
              display: grid; place-items: center; border-radius: var(--r-full);
              background: var(--surface-2); color: var(--ink-3); }
.empty h3 { color: var(--ink); margin-bottom: 6px; }

/* Всплывающее сообщение автосохранения. */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 18px);
  background: var(--ink); color: var(--bg);
  padding: 11px 18px; border-radius: var(--r-full); box-shadow: var(--shadow-3);
  font-size: var(--t-sm); font-weight: 500; z-index: 200;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============================================================ ТАБЛИЦЫ */

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.card .table-wrap { box-shadow: none; }
table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
th, td { padding: 11px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface-2); color: var(--ink-3);
  font-size: 11px; text-transform: uppercase; letter-spacing: .07em; font-weight: 600;
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: center; font-variant-numeric: tabular-nums; }
.table-plain thead th { position: static; background: transparent; }
.table-compact { table-layout: fixed; }
/* Заголовки переносятся: иначе длинное название бренда распирает таблицу
   и последняя колонка уезжает за край карточки. */
.table-compact th { white-space: normal; padding: 8px 10px; line-height: 1.3; }
.table-compact td { padding: 8px 10px; }
.table-compact th:first-child, .table-compact td:first-child { width: 22%; }
.table-key th { width: 42%; color: var(--ink-3); font-weight: 500; text-transform: none;
                letter-spacing: 0; font-size: var(--t-sm); background: transparent; position: static; }

/* ============================================================ ПРОГРЕСС И ГРАФИКИ */

.progress { height: 6px; background: var(--viz-track); border-radius: var(--r-full); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--viz-3); border-radius: var(--r-full);
              transition: width .35s ease; }
.progress-lg { height: 9px; }

/* Кольцо прогресса на вкладке анкеты. */
.ring { --p: 0; width: 20px; height: 20px; border-radius: 50%; flex: none;
        background: conic-gradient(var(--viz-3) calc(var(--p) * 1%), var(--viz-track) 0); }
.ring::after { content: ''; display: block; width: 12px; height: 12px; margin: 4px;
               border-radius: 50%; background: var(--surface); }
.ring.done { background: var(--viz-3); }
.ring.done::after { background: var(--viz-3); }

/*
 * Полосчатая диаграмма: одна серия магнитуды, столбик растёт от общей базы,
 * значение подписано у кончика, выделенный бренд — акцентом, остальные тише.
 */
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(84px, 27%) 1fr auto; gap: 12px; align-items: center; }
.bar-name { font-size: var(--t-sm); color: var(--ink-2); overflow-wrap: anywhere; }
.bar-track { height: 22px; background: var(--viz-track); border-radius: var(--r-xs); overflow: hidden; }
.bar-fill  { display: block; height: 100%; background: var(--viz-mute);
             border-radius: 0 4px 4px 0; transition: width .4s ease; min-width: 2px; }
.bar-row.is-primary .bar-fill { background: var(--viz-3); }
.bar-row.is-primary .bar-name { color: var(--ink); font-weight: 600; }
.bar-value { font-size: var(--t-sm); font-weight: 600; font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }
.bar-rank  { font-size: var(--t-xs); color: var(--ink-3); }
.bars-compact .bar-row { grid-template-columns: 1fr auto; }
.bars-compact .bar-name { grid-column: 1 / -1; margin-bottom: 2px; }
.bars-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-4);
              margin-top: 8px; font-variant-numeric: tabular-nums; }

/* Небольшие полосы в ячейке таблицы — профиль по трекам. */
.cell-bar { display: flex; align-items: center; gap: 8px; }
.cell-bar-track { flex: 1 1 auto; height: 6px; min-width: 32px; background: var(--viz-track); border-radius: var(--r-full); }
.cell-bar-fill { display: block; height: 100%; background: var(--viz-2); border-radius: var(--r-full); }

/* ============================================================ КАРТОЧКА КЕЙСА */

.case-card { display: flex; flex-direction: column; gap: 11px; height: 100%; position: relative; }
.case-card h3 { font-size: var(--t-lg); line-height: 1.3; letter-spacing: -.01em; }
.case-card h3 a { color: inherit; }
.case-card h3 a:hover { color: var(--accent); text-decoration: none; }
.case-card .lead { font-size: var(--t-sm); color: var(--ink-3); }
.case-foot { margin-top: auto; padding-top: var(--s-3); border-top: 1px solid var(--line);
             display: flex; gap: 10px; flex-wrap: wrap; font-size: var(--t-xs); color: var(--ink-3); }
.case-foot .dot { color: var(--ink-4); }

/* ============================================================ ЛЕНДИНГ */

.hero { padding: var(--s-8) 0 var(--s-7); }
.hero-eyebrow { display: inline-flex; align-items: center; gap: 8px; margin-bottom: var(--s-4);
                color: var(--ink-3); font-size: var(--t-xs); font-weight: 600;
                letter-spacing: .1em; text-transform: uppercase; }
.hero h1 { max-width: 15ch; }
.hero .lead { max-width: 60ch; margin-top: var(--s-4); font-size: var(--t-lg); }
.hero-actions { margin-top: var(--s-6); }

.role-card { display: flex; flex-direction: column; gap: 10px; height: 100%; }
.role-card .badge { align-self: flex-start; }
.role-card h3 { font-size: var(--t-lg); }
.role-card p { color: var(--ink-3); font-size: var(--t-sm); }
.role-card .role-link { margin-top: auto; padding-top: var(--s-3); font-weight: 600; font-size: var(--t-sm); }

.steps { counter-reset: step; display: grid; gap: var(--s-4); }
.step { display: flex; gap: var(--s-4); align-items: flex-start; }
.step::before {
  counter-increment: step; content: counter(step);
  width: 30px; height: 30px; flex: none; border-radius: var(--r-full);
  background: var(--accent-lo); color: var(--accent-ink);
  display: grid; place-items: center; font-weight: 600; font-size: var(--t-sm);
}

/* ============================================================ АНКЕТА */

.form-shell { position: relative; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: var(--s-5);
        border-bottom: 1px solid var(--line); padding-bottom: 0; }
.tab {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 11px 15px; border: 1px solid transparent; border-bottom: none;
  border-radius: var(--r-md) var(--r-md) 0 0;
  background: transparent; color: var(--ink-3); cursor: pointer;
  font: inherit; font-size: var(--t-sm); font-weight: 600;
  transition: color .15s, background .15s;
}
.tab:hover { color: var(--ink); background: var(--surface-2); }
.tab.active { background: var(--surface); border-color: var(--line); color: var(--ink); margin-bottom: -1px; }
.tab-count { font-weight: 500; color: var(--ink-4); font-size: var(--t-xs); font-variant-numeric: tabular-nums; }
.tab.done .tab-count { color: var(--accent); }

.panel { display: none; }
.panel.active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.crit { border-top: 1px solid var(--line); padding: var(--s-4) 0; }
.crit:first-of-type { border-top: none; padding-top: var(--s-2); }
.crit-head { display: flex; gap: var(--s-3); align-items: flex-start; margin-bottom: 12px; }
.crit-text { flex: 1 1 auto; font-size: var(--t-base); line-height: 1.5; }
.crit-state { width: 9px; height: 9px; border-radius: 50%; flex: none; margin-top: 7px;
              background: var(--line-2); transition: background .2s; }
.crit.is-filled .crit-state { background: var(--viz-3); }

.score-grid { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.score-cell { background: var(--surface-2); border-radius: var(--r-md); padding: 10px 12px; }
.score-brand { font-size: var(--t-xs); font-weight: 600; color: var(--ink-2); margin-bottom: 7px;
               display: flex; justify-content: space-between; gap: 6px; }

/* Сегментированный переключатель балла вместо выпадающего списка:
   один клик вместо трёх и вся шкала на виду. */
.scale { display: flex; gap: 4px; }
.scale input { position: absolute; opacity: 0; pointer-events: none; }
.scale label {
  flex: 1 1 0; margin: 0; text-align: center; cursor: pointer;
  padding: 7px 0; border-radius: var(--r-xs);
  background: var(--surface); border: 1px solid var(--line);
  font-size: var(--t-sm); font-weight: 600; color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  transition: background .12s, color .12s, border-color .12s;
}
.scale label:hover { border-color: var(--accent); color: var(--ink); }
.scale input:checked + label { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.scale input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.scale-na input:checked + label { background: var(--ink-3); border-color: var(--ink-3); }
.scale.is-readonly label { cursor: default; }

.crit-extra { display: grid; gap: var(--s-3); grid-template-columns: 200px 1fr; margin-top: var(--s-3); }
.crit-extra textarea { min-height: 62px; font-size: var(--t-sm); }

.scale-legend { display: grid; gap: 6px; font-size: var(--t-sm); color: var(--ink-2); }
.scale-legend div { display: flex; gap: 10px; }
.scale-legend b { flex: none; width: 18px; color: var(--ink); }

.actionbar {
  position: sticky; bottom: 0; z-index: 30; margin-top: var(--s-6);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 12px 18px; box-shadow: var(--shadow-2);
  display: flex; align-items: center; gap: var(--s-4); flex-wrap: wrap;
}
.actionbar .progress { flex: 1 1 160px; min-width: 120px; }
.save-state { font-size: var(--t-xs); color: var(--ink-3); }

/* ============================================================ ОПОВЕЩЕНИЯ */

.notice { display: flex; gap: 12px; padding: 15px var(--s-5); border-bottom: 1px solid var(--line); color: inherit; }
.notice:last-child { border-bottom: none; }
.notice:hover { background: var(--surface-2); text-decoration: none; }
.notice.unread { background: var(--accent-lo); }
.notice-title { font-weight: 600; }
.notice-time { color: var(--ink-3); font-size: var(--t-xs); margin-top: 3px; }
.notice-mark { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; margin-top: 7px; }

/* Лента событий заявки/кейса. */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.timeline-item { position: relative; padding-bottom: var(--s-4); }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before { content: ''; position: absolute; left: -23px; top: 5px; width: 10px; height: 10px;
                         border-radius: 50%; background: var(--surface); border: 2px solid var(--line-2); }
.timeline-item.done::before { background: var(--accent); border-color: var(--accent); }
.timeline-item.current::before { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-lo); }

/* Цитата эксперта. */
.quote { border-left: 3px solid var(--accent-lo); padding: 2px 0 2px 14px; }
.quote p { font-family: var(--font-display); font-size: var(--t-md); line-height: 1.55; color: var(--ink); }
.quote-by { margin-top: 6px; font-size: var(--t-xs); color: var(--ink-3); }

/* ============================================================ АВТОРИЗАЦИЯ */

.auth { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.auth-brand {
  background: var(--accent-hi); color: #fff; padding: var(--s-8) var(--s-7);
  display: flex; flex-direction: column; justify-content: space-between; gap: var(--s-6);
}
.auth-brand .logo, .auth-brand .logo-mark em { color: #fff; }
.auth-brand .logo-sub { color: rgba(255,255,255,.62); }
.auth-brand h2 { font-family: var(--font-display); font-weight: 500; font-size: var(--t-2xl);
                 line-height: 1.15; max-width: 18ch; }
.auth-brand p { color: rgba(255,255,255,.78); max-width: 42ch; margin-top: var(--s-4); }
.auth-points { display: grid; gap: 12px; }
.auth-point { display: flex; gap: 11px; align-items: flex-start; color: rgba(255,255,255,.86); font-size: var(--t-sm); }
.auth-point svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: var(--s-7) var(--s-5); }
.auth-form-inner { width: 100%; max-width: 420px; }

/* ============================================================ АДМИНКА */

.admin-shell { display: flex; min-height: 100vh; }
.admin-side {
  width: 244px; flex: none; background: var(--surface); border-right: 1px solid var(--line);
  padding: var(--s-4) 0; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.admin-side .logo { padding: 0 var(--s-5) var(--s-5); }
.admin-group { padding: var(--s-4) var(--s-5) 6px; color: var(--ink-4);
               font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; }
.admin-side a.side-link {
  display: flex; align-items: center; gap: 10px; margin: 1px var(--s-3);
  padding: 8px 12px; border-radius: var(--r-sm);
  color: var(--ink-2); font-size: var(--t-sm); font-weight: 500;
}
.admin-side a.side-link:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.admin-side a.side-link.active { background: var(--accent-lo); color: var(--accent-ink); font-weight: 600; }
.admin-side button.side-link { width: calc(100% - 24px); background: none; border: none; font: inherit; cursor: pointer; text-align: left; }
.side-count { margin-left: auto; background: var(--danger); color: #fff; border-radius: var(--r-full);
              padding: 1px 7px; font-size: 10.5px; font-weight: 700; }
.admin-side a.side-link.active .side-count { background: var(--accent); }
.admin-main { flex: 1 1 auto; min-width: 0; padding: var(--s-5) var(--s-6) var(--s-8); }
.admin-topbar { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-5); }

/* ============================================================ ПОДВАЛ */

.site-footer { border-top: 1px solid var(--line); padding: var(--s-6) 0; margin-top: var(--s-8);
               color: var(--ink-3); font-size: var(--t-sm); background: var(--surface); }
.site-footer a { color: var(--ink-2); }

/* ============================================================ АДАПТИВ */

@media (max-width: 1080px) {
  .grid-aside { grid-template-columns: 1fr; }
  .sticky-aside { position: static; }
}

@media (max-width: 860px) {
  .wrap { padding: 0 var(--s-4); }
  .topbar-inner { height: 58px; }
  .burger { display: inline-flex; }
  .nav {
    position: fixed; inset: 58px 0 auto 0; flex-direction: column; align-items: stretch;
    gap: 0; margin: 0; padding: var(--s-3);
    background: var(--surface); border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-2); display: none; z-index: 65;
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px 14px; border-radius: var(--r-sm); font-size: var(--t-base); }
  .logo-sub { display: none; }

  .crit-extra { grid-template-columns: 1fr; }
  .admin-shell { flex-direction: column; }
  .admin-side { width: 100%; height: auto; position: static; border-right: none;
                border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; padding: var(--s-3); }
  .admin-side .logo { padding: 0 var(--s-3); width: 100%; margin-bottom: var(--s-3); }
  .admin-group { display: none; }
  .admin-side a.side-link { margin: 2px; }
  .admin-main { padding: var(--s-4); }

  .auth { grid-template-columns: 1fr; }
  .auth-brand { display: none; }

  .bar-row { grid-template-columns: 1fr auto; }
  .bar-name { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
