:root,
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c1014;
  --surface: #151b22;
  --surface2: #1c2430;
  --text: #e8eef5;
  --muted: #8494a8;
  --accent: #20d9b0;
  --accent-dim: #18b894;
  --danger: #f07178;
  --line: rgba(255,255,255,.08);
  --on-accent: #06261c;
  --overlay: rgba(0, 0, 0, .55);
  --shadow: 0 16px 40px rgba(0,0,0,.32);
  --neon-bg: rgba(8, 28, 24, 0.92);
  --neon-text: #7dffd2;
  --neon-border: rgba(32, 217, 176, 0.55);
  --neon-glow: rgba(32, 217, 176, 0.18);
  --neon-glow-soft: rgba(32, 217, 176, 0.1);
  --neon-inset: rgba(32, 217, 176, 0.08);
  --neon-text-glow: rgba(32, 217, 176, 0.25);
  --accent-soft: rgba(32,217,176,.12);
  --accent-border: rgba(32,217,176,.38);
  --glass: rgba(255,255,255,.03);
  --desktop-glow-a: rgba(32,217,176,.06);
  --desktop-glow-b: rgba(32,217,176,.03);
  --radius: 12px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --theme-meta: #0c1014;
  --control-border: rgba(255,255,255,.14);
  --control-bg: rgba(0,0,0,.22);
  --pill-active-text: #b8ffe8;
  --gold: #d4a84b;
  --gold-soft: rgba(212,168,75,.14);
  --gold-border: rgba(212,168,75,.4);
  --space: 8px;
  --control-h: 48px;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #eef2f6;
  --surface: #ffffff;
  --surface2: #e2e9f0;
  --text: #121a24;
  --muted: #4a5b6d;
  --accent: #0b8a68;
  --accent-dim: #097055;
  --danger: #c93b45;
  --line: rgba(18, 26, 36, .18);
  --on-accent: #06261c;
  --overlay: rgba(15, 30, 45, .4);
  --shadow: 0 14px 40px rgba(18, 26, 36, .12);
  --neon-bg: rgba(232, 255, 247, 0.98);
  --neon-text: #097055;
  --neon-border: rgba(11, 138, 104, 0.7);
  --neon-glow: rgba(11, 138, 104, 0.28);
  --neon-glow-soft: rgba(11, 138, 104, 0.16);
  --neon-inset: rgba(11, 138, 104, 0.1);
  --neon-text-glow: rgba(11, 138, 104, 0.28);
  --accent-soft: rgba(11,138,104,.12);
  --accent-border: rgba(11,138,104,.38);
  --glass: rgba(255,255,255,.8);
  --desktop-glow-a: rgba(11,138,104,.08);
  --desktop-glow-b: rgba(91,156,255,.07);
  --theme-meta: #eef2f6;
  --control-border: rgba(18, 26, 36, .28);
  --control-bg: #f7f9fb;
  --pill-active-text: #075c46;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html {
  scroll-behavior: smooth;
}
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.4;
  min-height: 100%;
  transition: background-color .25s var(--ease), color .2s var(--ease);
  overscroll-behavior-y: contain;
}
body.tg-expanded { min-height: 100vh; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

#app { max-width: 560px; margin: 0 auto; padding-bottom: calc(120px + var(--safe-b)); }

/* ПК / широкий экран */
@media (min-width: 900px) {
  body.desktop {
    background:
      radial-gradient(900px 420px at 12% -10%, var(--desktop-glow-a), transparent 55%),
      radial-gradient(700px 380px at 90% 0%, var(--desktop-glow-b), transparent 50%),
      var(--bg);
  }
  body.desktop #app {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 24px calc(88px + var(--safe-b));
  }
  body.desktop .chat-fab {
    bottom: calc(22px + var(--safe-b));
    right: max(24px, env(safe-area-inset-right));
  }
  body.desktop .scroll-top {
    bottom: calc(22px + var(--safe-b));
    /* слева от «Чат», без наезда */
    right: max(104px, calc(env(safe-area-inset-right) + 88px));
  }
  body.desktop .pager {
    padding-right: 16px;
  }
  body.desktop .top {
    padding: 12px 0 8px;
  }
  body.desktop .tabs {
    max-width: none;
    width: 100%;
    margin: 0 0 8px;
    padding: 6px 0 10px;
    top: 52px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }
  body.desktop .tab {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 14px;
    font-size: 13px;
  }
  body.desktop .tab-ico {
    width: 16px;
    height: 16px;
  }
  body.desktop main {
    display: block;
    width: 100%;
  }
  body.desktop .panel,
  body.desktop .panel.active {
    padding-left: 0;
    padding-right: 0;
    width: 100%;
  }
  /* Поиск: всегда колонка, не старый 2-col grid */
  body.desktop .search-workspace.main-filters,
  body.desktop .main-filters.search-workspace {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    max-width: none !important;
    gap: 12px;
    padding: 16px 18px;
  }
  body.desktop .search-workspace > * {
    width: 100%;
    max-width: none;
    grid-column: auto !important;
  }
  body.desktop .search-workspace .mf-row-3.sw-params {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 10px;
  }
  body.desktop .search-workspace .sw-actions {
    display: grid !important;
    grid-template-columns: 220px minmax(220px, 360px);
    gap: 10px;
    max-width: 600px;
  }
  body.desktop .search-workspace .search-tools {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    max-width: 600px;
  }
  body.desktop .tpl-workspace,
  body.desktop .fav-workspace,
  body.desktop .analytics {
    width: 100%;
  }
  body.desktop #tplLibrary.results-view-cards {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  body.desktop #tplLibrary.results-view-list {
    display: flex !important;
    flex-direction: column !important;
  }
  body.desktop #searchList.results-view-cards,
  body.desktop #favoritesList.results-view-cards {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    align-items: start;
  }
  body.desktop #searchList.results-view-list,
  body.desktop #searchList.results-view-table,
  body.desktop #favoritesList.results-view-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px;
  }
  body.desktop .card {
    height: auto !important;
    align-self: start;
  }
  body.desktop .overlay.fullpage-overlay .sheet.fullpage {
    max-width: 920px;
    margin: 0 auto;
  }
  body.desktop .search-sticky-bar { top: 104px; }
  body.desktop .sw-results-bar { top: 104px; }
  body.desktop.has-sticky-search .sw-results-bar { top: 152px; }
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 0;
  background:
    radial-gradient(900px 420px at 50% -10%, var(--desktop-glow-a), transparent 58%),
    radial-gradient(480px 280px at 90% 100%, rgba(45, 212, 168, 0.08), transparent 70%),
    var(--bg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
body.auth-screen { overflow: hidden; }
html.overlay-open,
body.overlay-open {
  overscroll-behavior: none;
}
body.scroll-locked {
  position: fixed !important;
  left: 0;
  right: 0;
  width: 100% !important;
  overflow: hidden !important;
  overscroll-behavior: none;
  touch-action: none;
}
body.scroll-locked #app {
  pointer-events: none;
}
body.scroll-locked .overlay.open,
body.scroll-locked .overlay.open * {
  pointer-events: auto;
}
body.scroll-locked .ax-overlay.open,
body.scroll-locked .ax-overlay.open *,
body.scroll-locked .detail-win-dock-tray,
body.scroll-locked .detail-win-dock-tray * {
  pointer-events: auto;
}
.auth-gate.hidden { display: none; }
.auth-gate-shell {
  width: min(440px, 100%);
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(20px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
}
.auth-gate-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px 20px 22px;
  text-align: center;
  box-shadow: var(--shadow);
}
.auth-gate-brand { margin-bottom: 22px; }
.auth-gate-logo {
  width: 52px;
  height: 52px;
  margin: 0 auto;
}
.auth-gate-card h1 {
  margin: 14px 0 8px;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
}
.auth-gate-lead {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}
.auth-login-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.auth-login-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 64px;
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface2);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: transform .15s, border-color .2s, background .2s, box-shadow .2s;
}
.auth-login-btn:hover:not(:disabled) {
  border-color: rgba(45, 212, 168, 0.45);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.auth-login-btn:active:not(:disabled) { transform: scale(0.985); }
.auth-login-btn:disabled { opacity: 0.55; cursor: wait; }
.auth-login-tg {
  background: linear-gradient(135deg, rgba(42, 171, 238, 0.16), rgba(42, 171, 238, 0.06));
  border-color: rgba(42, 171, 238, 0.28);
}
.auth-login-max {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.16), rgba(124, 58, 237, 0.06));
  border-color: rgba(124, 58, 237, 0.28);
}
.auth-login-ico {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 20px;
  line-height: 1;
}
.auth-login-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.auth-login-title {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
}
.auth-login-sub {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}
.auth-login-status {
  margin-top: 16px;
  padding: 16px 14px;
  border-radius: 16px;
  background: rgba(45, 212, 168, 0.08);
  border: 1px solid rgba(45, 212, 168, 0.22);
}
.auth-login-status.hidden { display: none; }
.auth-login-spinner {
  width: 28px;
  height: 28px;
  margin: 0 auto 12px;
  border-radius: 50%;
  border: 3px solid rgba(45, 212, 168, 0.22);
  border-top-color: var(--accent);
  animation: authSpin .8s linear infinite;
}
@keyframes authSpin { to { transform: rotate(360deg); } }
.auth-login-status-text {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.4;
}
.auth-login-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}
.auth-open-block {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.auth-open-label {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}
.auth-open-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.auth-open-grid.auth-open-single { grid-template-columns: 1fr; }
.auth-open-btn {
  min-height: 46px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface2);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.auth-open-btn:active { transform: scale(0.98); }
.auth-open-max {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.12), rgba(124, 58, 237, 0.04));
}
.auth-gate-hint {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}
.auth-gate-hint.hidden { display: none; }
.tg-login-wrap {
  margin-top: 16px;
  min-height: 44px;
  display: flex;
  justify-content: center;
}
@media (min-width: 900px) {
  .auth-gate-shell { padding: 32px 24px; }
  .auth-gate-card { padding: 32px 26px 24px; }
}
html[data-theme="light"] .auth-gate-card {
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
}
html[data-theme="light"] .auth-login-ico {
  background: rgba(15, 23, 42, 0.05);
}

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 8px;
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(180deg, var(--bg) 70%, transparent);
}
.brand { font-weight: 700; letter-spacing: .02em; font-size: 1.1rem; }
.brand span { color: var(--accent); font-weight: 600; }
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.theme-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform .15s var(--ease), border-color .2s, box-shadow .25s var(--ease), background .2s;
}
.theme-btn:hover {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.theme-btn:active { transform: scale(.94); }
.theme-btn .theme-ico {
  width: 18px;
  height: 18px;
  display: block;
}
.theme-btn[data-mode="auto"] {
  border-color: var(--accent-border);
  box-shadow: 0 0 12px var(--neon-glow-soft);
}
.applies-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--accent-border);
  background: linear-gradient(135deg, var(--accent-soft), var(--glass));
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
}
.applies-btn-ico { font-size: 14px; line-height: 1; }
.applies-btn:active { transform: scale(.96); }
.admin-users-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(91,156,255,.45);
  background: linear-gradient(135deg, rgba(91,156,255,.2), var(--glass));
  color: var(--text);
  font-weight: 750;
  font-size: 13px;
}
.admin-users-btn.hidden { display: none !important; }
.admin-users-btn-ico { font-size: 14px; line-height: 1; }
.admin-users-btn:active { transform: scale(.96); }
.applies-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chat-fab {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  /* слот под кнопку «наверх» (48) + зазор 12 */
  bottom: calc(80px + var(--safe-b));
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  min-height: 48px;
  border-radius: 999px;
  border: 1px solid var(--accent-border);
  background: var(--surface);
  color: var(--text);
  font-weight: 750;
  font-size: 14px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
}
.chat-fab:active { transform: scale(0.96); }
.chat-fab-ico {
  display: grid;
  place-items: center;
  color: var(--accent);
  line-height: 1;
}
.chat-fab-label { font-size: 13px; font-weight: 750; }
.chat-fab-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: #0b1220;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
html[data-theme="light"] .chat-fab {
  background: #fff;
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  color: #1a2332;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
}
html[data-theme="light"] .chat-fab-badge {
  background: #122033;
  color: var(--accent);
}
.chat-fab.hidden { display: none !important; }
.chat-fab,
.feedback-fab {
  transition:
    opacity .32s var(--ease),
    transform .34s var(--ease),
    background .2s,
    border-color .2s,
    box-shadow .25s;
}
body.overlay-open .chat-fab,
body.overlay-open .feedback-fab {
  opacity: 0;
  transform: translateY(10px) scale(.92);
  pointer-events: none;
}
body.overlay-open .feedback-menu:not(.in-chat) {
  opacity: 0;
  transform: translateY(8px) scale(.96);
  pointer-events: none;
}

.chat-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.chat-plus-btn {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 40%, #0b1220);
  color: #e8eef7;
  font-size: 24px;
  font-weight: 300;
  line-height: 1;
  display: inline-grid;
  place-items: center;
  padding: 0;
  box-shadow: 0 6px 16px rgba(0,0,0,.28);
  transition: transform .15s, background .15s, color .15s;
}
.chat-plus-btn:active { transform: scale(.94); }
.chat-plus-btn.open {
  background: var(--accent);
  color: #06261c;
  border-color: var(--accent-border);
}
.chat-plus-btn.open { transform: none; }
.chat-plus-btn.hidden { display: none !important; }
html[data-theme="light"] .chat-plus-btn {
  background: #122033;
  color: #fff;
  border-color: transparent;
}

.feedback-fab {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(72px, calc(14px + env(safe-area-inset-bottom)));
  z-index: 41;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(145deg, #1a2433, #0f1620);
  color: #e8eef7;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity .32s var(--ease), transform .34s var(--ease), background .2s ease, border-color .2s ease, box-shadow .25s;
}
.feedback-fab:active { transform: scale(0.94); }
.feedback-fab.open {
  background: linear-gradient(145deg, #2dd4a8, #14a082);
  color: #06261c;
}
.feedback-fab-plus {
  font-size: 28px;
  font-weight: 300;
  line-height: 1;
  margin-top: -2px;
  transition: transform 0.18s ease;
}
.feedback-fab.open .feedback-fab-plus { transform: rotate(45deg); }
.feedback-fab.hidden { display: none !important; }

.feedback-menu {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(136px, calc(78px + env(safe-area-inset-bottom)));
  z-index: 42;
  width: min(280px, calc(100vw - 28px));
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(12, 18, 28, 0.96);
  backdrop-filter: blur(12px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}
.feedback-menu.in-chat {
  z-index: 140;
  bottom: auto;
  top: max(72px, calc(56px + env(safe-area-inset-top)));
  right: max(16px, env(safe-area-inset-right));
}
.feedback-menu.hidden { display: none !important; }
.feedback-menu-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 12px 12px;
  border-radius: 14px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.feedback-menu-item:hover,
.feedback-menu-item:focus-visible {
  background: rgba(45, 212, 168, 0.12);
  outline: none;
}
.feedback-menu-ico { font-size: 20px; line-height: 1.2; flex: none; }
.feedback-menu-item strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
}
.feedback-menu-item small {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  opacity: 0.7;
}
.feedback-sheet textarea {
  width: 100%;
  resize: vertical;
  min-height: 120px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.25);
  color: inherit;
  padding: 12px 14px;
  font: inherit;
}
.feedback-attach-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 12px 0 16px;
}
.feedback-file-name { margin: 0; }

.apply-form-foot {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.apply-form-foot > button { width: 100%; flex: none; }
.apply-free-note { margin: 8px 0 0; font-size: 12px; }
.icon-btn, .text-btn, button { font: inherit; border: 0; cursor: pointer; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--surface); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .2s var(--ease), background .2s;
}
.icon-btn:active { transform: scale(.94); }

.tabs {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 6px; padding: 0 8px 10px;
  position: sticky; top: 52px; z-index: 19;
  background: var(--bg);
}
.tabs-4 { grid-template-columns: repeat(4, 1fr); }
.doc-search { margin-bottom: 8px; }
.doc-search .ghost { white-space: nowrap; }
.light-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 12px; font-weight: 700; margin: 8px 0;
}
.light-badge.green { background: rgba(45,212,168,.16); color: var(--accent); }
.light-badge.yellow { background: rgba(245,197,66,.16); color: #f5c542; }
.light-badge.red { background: rgba(240,113,120,.16); color: var(--danger); }
.light-dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.tab {
  padding: 10px 4px; border-radius: 12px;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--line);
  font-size: 12px; font-weight: 650;
  transition: background .25s var(--ease), color .25s, border-color .2s, transform .2s, box-shadow .2s;
  box-shadow: 0 1px 0 rgba(255,255,255,.04);
}
.tab.active {
  background: var(--surface);
  color: var(--accent);
  border-color: var(--accent-border);
  box-shadow: 0 0 0 1px rgba(45,212,168,.12), 0 4px 12px rgba(45,212,168,.12);
  font-weight: 750;
}
.tab:active { transform: scale(.97); }

.panel { display: none; padding: 0 12px 24px; animation: fadeIn .28s var(--ease); }
.panel.active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.search-bar { display: flex; gap: 8px; margin-bottom: 10px; }
.search-bar input {
  flex: 1; min-width: 0;
  padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface); color: var(--text);
  outline: none; transition: border-color .2s;
}
.search-bar input:focus { border-color: rgba(45,212,168,.45); }
.primary {
  background: var(--accent); color: #06261c;
  font-weight: 700; padding: 12px 16px; border-radius: 12px;
  transition: transform .15s, filter .2s;
}
.primary:active { transform: scale(.97); }
.primary.block { width: 100%; margin-bottom: 12px; }
.ghost {
  background: var(--surface2); color: var(--text);
  padding: 12px 14px; border-radius: 12px; font-weight: 600;
  border: 1px solid var(--line);
}
.text-btn { background: transparent; color: var(--accent); font-weight: 600; }

.quick-filters {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px;
}
.qf-btn, .picker-trigger {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  text-align: left; width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 12px 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--text);
  min-height: 56px;
  transition: border-color .2s, transform .15s, background .2s;
}
.qf-btn:active, .picker-trigger:active { transform: scale(.98); }
.qf-btn.has-value, .picker-trigger.has-value {
  border-color: rgba(45,212,168,.4);
  background: linear-gradient(135deg, rgba(45,212,168,.12), var(--surface));
}
.qf-label { display: block; font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; line-height: 1.25; }
.qf-value {
  display: block; width: 100%; max-width: 100%;
  font-size: 14px; font-weight: 650; color: var(--text);
  line-height: 1.35;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-align: left; direction: ltr;
}
.picker-trigger {
  flex-direction: row; align-items: center; justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.picker-trigger > span:first-child {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
}
.picker-trigger .chev { color: var(--muted); font-size: 20px; line-height: 1; flex-shrink: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip {
  font-size: 12px; padding: 5px 10px; border-radius: 999px;
  background: var(--surface2); color: var(--muted);
  animation: chipIn .28s var(--ease);
}
.chip.accent { background: rgba(45,212,168,.15); color: var(--accent); }
@keyframes chipIn {
  from { opacity: 0; transform: scale(.85); }
  to { opacity: 1; transform: none; }
}
.meta { color: var(--muted); font-size: 12px; margin-bottom: 10px; min-height: 1.2em; }

.list { display: flex; flex-direction: column; gap: 10px; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: flex; flex-direction: column; gap: 8px;
  animation: cardIn .35s var(--ease) both;
  transition: transform .15s, border-color .2s;
}
.card:nth-child(1) { animation-delay: .02s; }
.card:nth-child(2) { animation-delay: .05s; }
.card:nth-child(3) { animation-delay: .08s; }
.card:nth-child(4) { animation-delay: .11s; }
.card:nth-child(5) { animation-delay: .14s; }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
.card:active { transform: scale(.99); }
.card-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.card-top-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.note-btn {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--surface2); color: var(--muted); font-size: 15px;
  display: grid; place-items: center;
  transition: transform .2s var(--ease), color .2s, background .2s;
}
.note-btn.has-note { color: var(--accent); background: rgba(45,212,168,.12); }
.note-btn:active { transform: scale(1.1); }
.card-note {
  margin-top: 2px; padding: 8px 10px; border-radius: 10px;
  background: rgba(45,212,168,.08); border: 1px solid rgba(45,212,168,.2);
  color: var(--text); font-size: 12px; line-height: 1.35;
  white-space: pre-wrap; word-break: break-word;
  cursor: pointer;
}
.card-note .note-label {
  display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--accent); font-weight: 700; margin-bottom: 2px;
}
.card.unviewed { border-color: rgba(45,212,168,.28); }
.card.viewed { opacity: .92; }
.badge {
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 8px;
  background: var(--surface2); color: var(--accent); white-space: nowrap;
}
.badge-way {
  color: var(--text);
  background: var(--surface2);
  white-space: normal;
  max-width: 220px;
  line-height: 1.25;
}
.badge-stage {
  font-weight: 600;
  letter-spacing: 0.01em;
}
.badge-stage.af { background: rgba(45, 212, 168, 0.16); color: #0f8f6a; }
.badge-stage.ca { background: rgba(59, 130, 246, 0.14); color: #2563eb; }
.badge-stage.pc { background: rgba(100, 116, 139, 0.16); color: #475569; }
.badge-stage.pa { background: rgba(239, 68, 68, 0.14); color: #dc2626; }
.badge-stage.pl { background: rgba(245, 158, 11, 0.16); color: #b45309; }
body.theme-dark .badge-stage.af { color: #5eead4; }
body.theme-dark .badge-stage.ca { color: #93c5fd; }
body.theme-dark .badge-stage.pc { color: #cbd5e1; }
body.theme-dark .badge-stage.pa { color: #fca5a5; }
body.theme-dark .badge-stage.pl { color: #fbbf24; }
.card-way { color: var(--accent); font-weight: 600; }
.card-title { font-weight: 650; font-size: 14px; }
.card-sub { color: var(--muted); font-size: 12px; }
.card-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  margin-top: 2px;
}
.price { font-weight: 700; color: var(--text); }
.fav-btn {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--surface2); color: var(--muted); font-size: 16px;
  transition: transform .2s var(--ease), color .2s, background .2s, border-color .2s;
}
.fav-btn.on {
  color: #e8a317;
  background: rgba(245, 197, 66, 0.18);
}
.fav-btn:active { transform: scale(1.08); }

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  margin-top: 16px;
  margin-bottom: 4px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.pager button {
  flex: 0 0 auto;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--control-bg);
  color: var(--text);
  font-weight: 650;
  border: 1px solid var(--line);
}
.pager.hidden, .hidden { display: none !important; }

.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: var(--overlay);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .28s var(--ease);
}
.overlay.open {
  opacity: 1; pointer-events: auto;
}
.sheet {
  width: 100%; max-width: 560px;
  max-height: 88vh;
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  display: flex; flex-direction: column;
  padding-bottom: var(--safe-b);
  transform: translateY(110%);
  transition: transform .38s var(--ease);
  overflow: hidden;
  overscroll-behavior: contain;
}
.overlay.open .sheet { transform: translateY(0); }
.sheet.tall { max-height: 94vh; }
.sheet.compact { max-height: 78vh; }
.sheet.fullpage {
  max-height: 100%;
  height: 100%;
  max-width: 100%;
  width: 100%;
  border-radius: 0;
  transform: translateY(0);
  opacity: 0;
  transition: opacity .22s var(--ease);
  overflow: hidden;
}
.overlay.fullpage-overlay {
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  overscroll-behavior: contain;
}
.overlay.fullpage-overlay.open .sheet.fullpage {
  opacity: 1;
  transform: none;
}
.icon-head-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.icon-head-btn:active { transform: scale(.94); }

/* —— Settings screen —— */
.settings-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 24px;
}
.settings-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 4px 0 8px;
  overflow: visible;
}
.settings-card-title {
  margin: 0;
  padding: 12px 14px 6px;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.settings-hint {
  margin: 0;
  padding: 4px 14px 12px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}
.settings-hint:empty { display: none; }

.theme-seg {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 4px 12px 14px;
  padding: 6px;
  border-radius: 14px;
  background: var(--surface2);
  border: 1px solid var(--line);
  overflow: visible;
  box-sizing: border-box;
}
.theme-seg-btn {
  min-width: 0;
  min-height: 42px;
  padding: 10px 6px;
  border-radius: 11px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s, box-shadow .2s, transform .15s;
  box-sizing: border-box;
}
.theme-seg-btn:active { transform: scale(.97); }
.theme-seg-btn.active {
  background: var(--surface);
  color: var(--accent);
  border-color: var(--accent-border);
  box-shadow: 0 2px 8px rgba(45, 212, 168, .12);
}

/* Override global `label` / `label input` — those break iOS-style toggles */
.settings-toggle {
  position: relative;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 14px;
  row-gap: 0;
  margin: 0;
  padding: 14px 14px;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  border-top: 1px solid var(--line);
  transition: background .18s;
}
.settings-card > .settings-toggle:first-of-type { border-top: 0; }
.settings-toggle:active { background: rgba(45, 212, 168, .05); }
.settings-toggle > input[type="checkbox"] {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  opacity: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  pointer-events: none;
}
.settings-toggle-text {
  grid-column: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.settings-toggle-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.settings-toggle-sub {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.settings-switch {
  grid-column: 2;
  position: relative;
  flex-shrink: 0;
  width: 48px;
  height: 30px;
  border-radius: 99px;
  background: var(--surface2);
  border: 1px solid var(--line);
  transition: background .22s, border-color .22s;
  pointer-events: none;
}
.settings-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--text);
  opacity: .45;
  transition: transform .22s var(--ease), background .22s, opacity .22s, box-shadow .22s;
}
.settings-toggle input:checked ~ .settings-switch {
  background: linear-gradient(135deg, #3ee0b4, var(--accent));
  border-color: transparent;
}
.settings-toggle input:checked ~ .settings-switch::after {
  transform: translateX(18px);
  background: #06261c;
  opacity: 1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
}
.settings-toggle input:focus-visible ~ .settings-switch {
  outline: 2px solid rgba(45, 212, 168, .55);
  outline-offset: 2px;
}
@media (max-width: 380px) {
  .theme-seg-btn { font-size: 12px; padding: 10px 2px; }
  .settings-toggle { padding: 13px 12px; column-gap: 10px; }
  .settings-toggle-title { font-size: 13px; }
  .settings-switch { width: 46px; height: 28px; }
  .settings-switch::after { width: 22px; height: 22px; }
  .settings-toggle input:checked ~ .settings-switch::after { transform: translateX(18px); }
}

.settings-primary {
  display: block;
  width: calc(100% - 24px);
  margin: 4px 12px 8px;
  padding: 12px 14px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #3ee0b4, var(--accent));
  color: #06261c;
  font-weight: 750;
  font-size: 14px;
  text-align: center;
  cursor: pointer;
  transition: transform .15s, filter .2s;
}
.settings-primary:active { transform: scale(.98); }
.settings-primary:disabled { opacity: .55; pointer-events: none; }

.settings-links {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
  margin-top: 4px;
}
.settings-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background .18s;
}
.settings-links > .settings-link:first-child { border-top: 0; }
.settings-link:active { background: rgba(45, 212, 168, .06); }
.settings-link-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.settings-link-title {
  font-weight: 750;
  font-size: 14px;
  color: var(--accent);
}
.settings-link-sub {
  font-size: 12px;
  color: var(--muted);
  font-weight: 550;
}
.settings-link-chev {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}
.settings-foot {
  border-top: 1px solid var(--line);
  background: var(--surface);
}

html[data-theme="light"] .theme-seg {
  background: var(--surface2);
}
html[data-theme="light"] .theme-seg-btn.active {
  background: #fff;
  box-shadow: 0 1px 4px rgba(18, 26, 36, .08);
}
html[data-theme="light"] .settings-card {
  box-shadow: 0 1px 3px rgba(18, 26, 36, .05);
}
html[data-theme="light"] .settings-switch {
  background: #d5dde6;
  border-color: rgba(18, 26, 36, .12);
}
html[data-theme="light"] .settings-switch::after {
  background: #fff;
  opacity: 1;
  box-shadow: 0 1px 3px rgba(18, 26, 36, .2);
}
html[data-theme="light"] .settings-toggle input:checked ~ .settings-switch::after {
  background: #fff;
}

.settings-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.settings-row:last-of-type { border-bottom: 0; }
.settings-row input { margin-top: 3px; flex-shrink: 0; }
.settings-row span { display: flex; flex-direction: column; gap: 4px; }
.settings-row strong { font-weight: 700; font-size: 14px; }
.sheet-handle {
  flex-shrink: 0;
  width: 40px; height: 4px; border-radius: 99px;
  background: rgba(255,255,255,.18);
  margin: 10px auto 0;
}
.sheet-head {
  flex-shrink: 0;
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 10px;
  padding: 14px 16px 8px;
  border-bottom: 1px solid var(--line);
}
.sheet-head > div:first-child {
  min-width: 0;
  flex: 1;
}
.sheet-head > div:first-child strong {
  display: block;
  font-size: 16px;
  line-height: 1.25;
  word-break: break-word;
}
.sheet-head .card-sub {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.35;
  word-break: break-word;
}
.sheet-head-detail {
  gap: 8px;
  align-items: flex-start;
}
.sheet-head-detail > strong {
  flex: 0 0 auto;
  padding-top: 8px;
}
.sheet-head-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.sheet-head-actions .head-action {
  padding: 8px 10px;
  font-size: 12px;
  white-space: nowrap;
}
.sheet-head-actions .icon-foot {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sheet-head-actions .share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  border-radius: 12px;
  color: var(--text);
}
.sheet-head-actions .share-btn svg {
  flex-shrink: 0;
  opacity: .9;
}
.sheet-head-actions .text-btn {
  padding: 8px 6px;
}
.sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow: auto;
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
#detailBody,
#complianceBody,
#analysisHistoryBody {
  max-width: 100%;
  overflow-x: hidden;
  overscroll-behavior: contain;
}
.sheet-foot {
  flex-shrink: 0;
  display: flex; gap: 8px; padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: var(--bg);
  position: relative;
  bottom: auto;
  z-index: 5;
  box-shadow: 0 -8px 24px rgba(0,0,0,.25);
}
.sheet-foot > button { flex: 1; min-width: 0; }
.sheet-foot-3 > button { padding: 11px 8px; font-size: 12px; }
.sheet-foot-detail {
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 8px;
}
.sheet-foot-detail > .icon-foot {
  flex: 0 0 48px;
  padding: 10px 0;
  font-size: 16px;
  line-height: 1;
}
.sheet-foot-detail > .neon-btn {
  flex: 1 1 auto;
  padding: 12px 10px;
  font-size: 13px;
}
.sheet-foot .primary.block { margin: 0; }
.accent-btn {
  background: linear-gradient(135deg, #3ee0b4, var(--accent));
  color: #06261c; font-weight: 750; padding: 12px 14px; border-radius: 12px;
  transition: transform .15s, filter .2s;
  border: 0; cursor: pointer; font-size: 15px;
}
.accent-btn.block { display: block; width: 100%; margin-top: 16px; text-align: center; }
.accent-btn:active { transform: scale(.97); }
.accent-btn:disabled { opacity: .55; pointer-events: none; }
.auth-max-btn {
  margin-top: 10px;
  background: linear-gradient(135deg, #4b6bff, #2a3fd4);
  color: #f4f6ff;
}
.auth-max-btn.hidden { display: none !important; }
.auth-web-btn {
  margin-top: 10px;
  background: transparent;
  border: 1px solid rgba(255,255,255,.22);
  color: var(--text);
  box-shadow: none;
}
html[data-theme="light"] .auth-web-btn {
  border-color: rgba(0,0,0,.14);
}

.neon-btn {
  position: relative;
  border: 1px solid var(--neon-border);
  border-radius: 12px;
  background: var(--neon-bg);
  color: var(--neon-text);
  font-weight: 800;
  letter-spacing: 0.01em;
  text-shadow: 0 0 8px var(--neon-text-glow);
  box-shadow:
    0 0 10px var(--neon-glow),
    0 0 22px var(--neon-glow-soft),
    inset 0 0 12px var(--neon-inset);
  animation: neonPulse 2.4s ease-in-out infinite;
}
.neon-btn:active { transform: scale(.97); }
.neon-btn.is-busy {
  animation: neonPulse 1.1s ease-in-out infinite;
  letter-spacing: 0;
  font-size: 12px;
}
.neon-btn.is-busy::before {
  content: "";
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-right: 8px;
  border: 2px solid color-mix(in srgb, var(--neon-text) 25%, transparent);
  border-top-color: var(--neon-text);
  border-radius: 50%;
  vertical-align: -1px;
  animation: ax-spin .7s linear infinite;
}
.neon-btn:disabled {
  opacity: .55;
  pointer-events: none;
  animation: none;
  box-shadow: none;
  text-shadow: none;
}
@keyframes neonPulse {
  0%, 100% {
    box-shadow:
      0 0 8px var(--neon-glow-soft),
      0 0 18px color-mix(in srgb, var(--neon-glow) 55%, transparent),
      inset 0 0 10px var(--neon-inset);
  }
  50% {
    box-shadow:
      0 0 14px var(--neon-glow),
      0 0 28px var(--neon-glow-soft),
      inset 0 0 14px color-mix(in srgb, var(--neon-inset) 150%, transparent);
  }
}
.icon-foot.has-note {
  color: var(--neon-text);
  text-shadow: 0 0 8px var(--neon-text-glow);
}
.obj-table tfoot td {
  font-weight: 750;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.obj-table .obj-total-label { text-align: right; color: var(--muted); }

.section-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 700; margin-top: 4px;
}
.pill-group { display: flex; flex-wrap: nowrap; gap: 8px; }
.pill-group.wrap { flex-wrap: wrap; }
.pill {
  position: relative;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 14px; border-radius: 999px;
  background: var(--surface); color: var(--muted);
  border: 1px solid var(--line);
  font-weight: 650; font-size: 13px;
  overflow: hidden;
  transition:
    background .28s var(--ease), color .22s, border-color .28s var(--ease),
    transform .2s var(--ease), box-shadow .28s var(--ease), padding .22s var(--ease);
}
.pill::before {
  content: "";
  width: 0; height: 16px; opacity: 0; flex-shrink: 0;
  border-radius: 5px;
  background: linear-gradient(145deg, #4af0c4, var(--accent));
  box-shadow: 0 0 0 0 rgba(45,212,168,.0);
  transition: width .28s var(--ease), opacity .2s, box-shadow .28s var(--ease), transform .28s var(--ease);
  display: grid; place-items: center;
}
.pill::after {
  content: "";
  position: absolute; left: 17px; top: 50%;
  width: 5px; height: 9px; margin-top: -6px;
  border: solid #06261c; border-width: 0 2.2px 2.2px 0;
  opacity: 0; transform: scale(.4) rotate(45deg);
  transition: opacity .15s, transform .32s var(--ease);
  pointer-events: none;
}
.pill.active {
  background: linear-gradient(145deg, rgba(45,212,168,.22), rgba(45,212,168,.08));
  color: var(--pill-active-text);
  border-color: rgba(45,212,168,.55);
  box-shadow: 0 0 0 1px rgba(45,212,168,.12), 0 6px 18px rgba(45,212,168,.12);
  padding-left: 12px;
}
.pill.active::before {
  width: 16px; opacity: 1;
  box-shadow: 0 2px 8px rgba(45,212,168,.35);
  animation: checkPop .42s var(--ease);
}
.pill.active::after {
  opacity: 1;
  transform: scale(1) rotate(45deg);
  animation: checkDraw .38s var(--ease) .06s both;
}
.pill:active { transform: scale(.96); }
.pill:not(.active):hover { border-color: rgba(45,212,168,.28); color: var(--text); }

label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 12px; color: var(--muted); font-weight: 600;
}
label input, label select {
  padding: 11px 12px; border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface); color: var(--text);
  font: inherit;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

@keyframes checkPop {
  0% { transform: scale(.55); }
  55% { transform: scale(1.18); }
  100% { transform: scale(1); }
}
@keyframes checkDraw {
  0% { opacity: 0; transform: scale(.35) rotate(45deg); }
  100% { opacity: 1; transform: scale(1) rotate(45deg); }
}
@keyframes selectGlow {
  0% { box-shadow: 0 0 0 0 rgba(45,212,168,.0); }
  40% { box-shadow: 0 0 0 6px rgba(45,212,168,.16); }
  100% { box-shadow: 0 0 0 0 rgba(45,212,168,.0); }
}
@keyframes tickIn {
  0% { opacity: 0; transform: rotate(-45deg) scale(.2) translateY(2px); }
  60% { opacity: 1; transform: rotate(-45deg) scale(1.15) translateY(0); }
  100% { opacity: 1; transform: rotate(-45deg) scale(1) translateY(0); }
}

.check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  padding: 11px 13px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .28s var(--ease), background .28s var(--ease),
    transform .18s var(--ease), box-shadow .28s var(--ease);
}
.check:active { transform: scale(.985); }
.check:has(input:checked) {
  border-color: rgba(45,212,168,.5);
  background: linear-gradient(135deg, rgba(45,212,168,.16), rgba(45,212,168,.06));
  box-shadow: 0 4px 16px rgba(45,212,168,.1);
  animation: selectGlow .55s var(--ease);
}
.check input {
  appearance: none;
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
  border-radius: 8px;
  border: 2px solid var(--control-border);
  background: var(--control-bg);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  transition: background .22s var(--ease), border-color .22s var(--ease),
    transform .22s var(--ease), box-shadow .28s var(--ease);
}
.check input:checked {
  background: linear-gradient(145deg, #4af0c4, var(--accent-dim));
  border-color: transparent;
  box-shadow: 0 3px 10px rgba(45,212,168,.4);
  animation: checkPop .4s var(--ease);
}
.check input:checked::after {
  content: "";
  width: 6px; height: 11px;
  border: solid #06261c;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg) translate(-1px, -1px);
  animation: checkDraw .34s var(--ease) both;
}
.check input:focus-visible {
  outline: 2px solid rgba(45,212,168,.55);
  outline-offset: 2px;
}
.check:hover:not(:has(input:checked)) {
  border-color: rgba(45,212,168,.28);
}

.region-toolbar {
  padding: 10px 16px 0;
  display: flex; flex-direction: column; gap: 8px;
}
.region-toolbar input {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; outline: none;
}
.region-toolbar input:focus { border-color: rgba(45,212,168,.45); }
.region-actions { display: flex; gap: 12px; }
.region-count { font-size: 12px; color: var(--muted); }
.region-body { gap: 6px !important; padding-top: 8px !important; }
.region-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  padding: 12px 12px; border-radius: 14px;
  background: var(--surface); border: 1px solid transparent;
  color: var(--text); font-weight: 550;
  transition: border-color .28s var(--ease), background .28s var(--ease), transform .18s var(--ease);
}
.region-item .code {
  min-width: 28px; font-size: 12px; color: var(--muted); font-weight: 700;
}
.region-item .check-dot,
.multi-pick-item .check-dot {
  margin-left: auto; width: 24px; height: 24px; border-radius: 8px;
  border: 2px solid var(--control-border);
  background: var(--control-bg);
  display: grid; place-items: center; flex-shrink: 0;
  transition: background .25s var(--ease), border-color .25s var(--ease),
    transform .3s var(--ease), box-shadow .3s var(--ease);
}
.region-item.selected {
  border-color: rgba(45,212,168,.5);
  background: linear-gradient(135deg, rgba(45,212,168,.14), rgba(45,212,168,.05));
}
.region-item.selected .check-dot,
.multi-pick-item.selected .check-dot {
  background: linear-gradient(145deg, #4af0c4, var(--accent-dim));
  border-color: transparent;
  box-shadow: 0 3px 10px rgba(45,212,168,.35);
  animation: checkPop .4s var(--ease);
}
.region-item.selected .check-dot::after,
.multi-pick-item.selected .check-dot::after {
  content: "";
  width: 10px; height: 6px;
  border-left: 2.4px solid #06261c;
  border-bottom: 2.4px solid #06261c;
  animation: tickIn .36s var(--ease) both;
}
.region-item:active { transform: scale(.98); }
.region-item:hover:not(.selected) { border-color: rgba(45,212,168,.22); }
.region-item.hidden-item { display: none; }
.federal-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 700; padding: 10px 4px 4px;
}

.stage-cards { display: grid; gap: 8px; }
.stage-card {
  display: grid;
  grid-template-columns: 36px 1fr 28px;
  grid-template-areas:
    "icon title check"
    "icon hint  check";
  column-gap: 10px; row-gap: 2px;
  text-align: left; width: 100%;
  padding: 12px 12px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--text);
  transition: border-color .28s var(--ease), background .28s var(--ease),
    transform .18s var(--ease), box-shadow .28s var(--ease);
}
.stage-card .stage-icon { grid-area: icon; font-size: 22px; align-self: center; }
.stage-card .stage-title { grid-area: title; font-weight: 700; font-size: 14px; }
.stage-card .stage-hint { grid-area: hint; font-size: 12px; color: var(--muted); }
.stage-card .stage-check {
  grid-area: check;
  width: 24px; height: 24px; border-radius: 8px;
  border: 2px solid var(--control-border);
  background: rgba(0,0,0,.18);
  align-self: center; justify-self: end;
  display: grid; place-items: center;
  transition: background .25s var(--ease), border-color .25s var(--ease),
    transform .3s var(--ease), box-shadow .3s var(--ease);
}
.stage-card .stage-check::after {
  content: "";
  width: 10px; height: 6px;
  border-left: 2.4px solid #06261c;
  border-bottom: 2.4px solid #06261c;
  opacity: 0; transform: rotate(-45deg) scale(.2);
  transition: opacity .15s, transform .28s var(--ease);
}
.stage-card.active {
  border-color: rgba(45,212,168,.55);
  background: linear-gradient(135deg, rgba(45,212,168,.16), rgba(45,212,168,.05));
  box-shadow: 0 6px 18px rgba(45,212,168,.1);
}
.stage-card.active .stage-check {
  background: linear-gradient(145deg, #4af0c4, var(--accent-dim));
  border-color: transparent;
  box-shadow: 0 3px 10px rgba(45,212,168,.35);
  animation: checkPop .4s var(--ease);
}
.stage-card.active .stage-check::after {
  opacity: 1;
  animation: tickIn .36s var(--ease) both;
}
.stage-card:active { transform: scale(.98); }
.stage-card:hover:not(.active) { border-color: rgba(45,212,168,.25); }
.stage-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.chip-btn {
  padding: 8px 12px; border-radius: 999px;
  background: var(--surface2); color: var(--muted); font-weight: 600; font-size: 12px;
  border: 1px solid var(--line);
  transition: background .22s, color .22s, border-color .22s, transform .15s;
}
.chip-btn:hover { color: var(--text); border-color: rgba(45,212,168,.25); }
.chip-btn:active {
  color: var(--accent);
  background: rgba(45,212,168,.12);
  transform: scale(.96);
}

.detail-block h3 { margin: 0 0 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.detail-block p { margin: 0 0 10px; }
.kv {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 12px;
  font-size: 13px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  align-items: start;
}
.kv > span:nth-child(odd) {
  color: var(--muted);
  max-width: 9.5em;
  line-height: 1.35;
  overflow-wrap: break-word;
  word-break: normal;
}
.kv > span:nth-child(even) {
  min-width: 0;
  line-height: 1.35;
  overflow-wrap: break-word;
  word-break: normal;
}

.analytics { display: flex; flex-direction: column; gap: 12px; padding: 0 2px 12px; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat {
  background: var(--surface); border-radius: var(--radius);
  padding: 14px; border: 1px solid var(--line);
}
.stat .n { font-size: 1.4rem; font-weight: 750; color: var(--accent); }
.stat .l { font-size: 12px; color: var(--muted); margin-top: 4px; }

.an-hero {
  padding: 14px 16px; border-radius: 16px;
  background: linear-gradient(160deg, rgba(45,212,168,.16), var(--surface));
  border: 1px solid rgba(45,212,168,.28);
}
.an-hero-title { font-weight: 800; font-size: 1.05rem; }
.an-hero-sub { color: var(--muted); font-size: 13px; margin-top: 4px; line-height: 1.4; }
.an-tips { display: flex; flex-direction: column; gap: 8px; }
.an-tip {
  text-align: left; width: 100%;
  padding: 12px 14px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--text);
  transition: transform .18s var(--ease), border-color .22s;
}
.an-tip:active { transform: scale(.985); }
.an-tip.warn { border-color: rgba(240,113,120,.45); background: rgba(240,113,120,.08); }
.an-tip.accent { border-color: rgba(45,212,168,.4); background: rgba(45,212,168,.08); }
.an-tip.ok { border-color: rgba(45,212,168,.45); background: rgba(45,212,168,.1); }
.an-tip.info { border-color: rgba(91,156,255,.4); background: rgba(91,156,255,.08); }
.an-tip-title { font-weight: 750; margin-bottom: 4px; }
.an-tip-text { font-size: 13px; color: var(--muted); line-height: 1.4; }
.an-card .an-link { margin-top: 10px; padding: 0; color: var(--accent); font-weight: 700; }
.an-pipe-row {
  display: grid; grid-template-columns: 10px 1fr minmax(48px, 1.2fr) 28px;
  gap: 8px; align-items: center; margin: 6px 0;
}
.an-pipe-dot { width: 10px; height: 10px; border-radius: 50%; }
.an-pipe-name { font-size: 13px; font-weight: 650; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-pipe-bar {
  height: 8px; border-radius: 999px; background: rgba(255,255,255,.06); overflow: hidden;
}
.an-pipe-bar i { display: block; height: 100%; border-radius: 999px; }
.an-pipe-n { text-align: right; font-weight: 750; font-size: 13px; color: var(--accent); }
.an-deadline-list { display: flex; flex-direction: column; gap: 8px; }
.an-deadline {
  text-align: left; width: 100%;
  padding: 12px; border-radius: 12px;
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  transition: border-color .2s, transform .15s;
}
.an-deadline:active { transform: scale(.985); }
.an-deadline-top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.an-deadline-days {
  font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  color: #06261c; background: linear-gradient(135deg, #f5c542, #f07178);
  padding: 3px 8px; border-radius: 999px;
}
.an-deadline-price { color: var(--accent); font-weight: 750; font-size: 13px; }
.an-deadline-title { font-weight: 650; font-size: 14px; line-height: 1.3; margin-bottom: 4px; }
.an-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.an-chip {
  padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 650;
  background: rgba(45,212,168,.1); border: 1px solid rgba(45,212,168,.3); color: var(--text);
}
.an-queries { display: flex; flex-direction: column; gap: 6px; }
.an-query {
  text-align: left; width: 100%;
  padding: 10px 12px; border-radius: 12px;
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  font-weight: 600; font-size: 13px;
  display: flex; justify-content: space-between; gap: 8px;
}
.an-query span { color: var(--muted); font-weight: 700; }
.an-query:active { border-color: rgba(45,212,168,.4); }

.an-subtabs {
  display: flex; gap: 6px;
  padding: 4px 2px 12px;
  position: sticky; top: 52px; z-index: 11;
  background: linear-gradient(180deg, var(--bg) 70%, transparent);
}
.an-subtab {
  flex: 1;
  padding: 10px 8px;
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
  border: 1px solid var(--line);
  transition: transform .15s, border-color .2s, color .2s, background .2s;
}
.an-subtab.active {
  color: var(--text);
  border-color: rgba(45,212,168,.45);
  background: rgba(45,212,168,.1);
}
.an-subtab-pro {
  position: relative;
  background: linear-gradient(135deg, rgba(245,197,66,.12), rgba(45,212,168,.08));
  border-color: rgba(245,197,66,.35);
  color: #f5d78a;
}
.an-subtab-pro.active {
  background: linear-gradient(135deg, rgba(245,197,66,.22), rgba(45,212,168,.14));
  border-color: rgba(245,197,66,.55);
  color: #ffe6a3;
  box-shadow: 0 0 0 1px rgba(245,197,66,.15), 0 8px 24px rgba(245,197,66,.08);
}
.an-subtab-law {
  background: linear-gradient(135deg, rgba(240,113,120,.12), rgba(91,156,255,.08));
  border-color: rgba(240,113,120,.35);
  color: #f5a8ac;
}
.an-subtab-law.active {
  background: linear-gradient(135deg, rgba(240,113,120,.22), rgba(91,156,255,.12));
  border-color: rgba(240,113,120,.55);
  color: #ffc4c7;
  box-shadow: 0 0 0 1px rgba(240,113,120,.12);
}
.an-subtab.locked {
  opacity: .45;
  position: relative;
}
.an-subtab.locked::after {
  content: "Бизнес";
  position: absolute;
  right: 6px; top: 4px;
  font-size: 9px;
  font-weight: 800;
  color: #f5c542;
}
.an-subtab:active { transform: scale(.97); }

.law-check-btn {
  width: 100%;
  background: linear-gradient(135deg, rgba(240,113,120,.18), rgba(91,156,255,.1)) !important;
  border: 1px solid rgba(240,113,120,.4) !important;
  color: #ffc4c7 !important;
  font-weight: 750 !important;
}
.comp-hero {
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(240,113,120,.28);
  background:
    radial-gradient(ellipse 80% 60% at 0% 0%, rgba(240,113,120,.16), transparent 55%),
    linear-gradient(160deg, rgba(36,48,64,.95), rgba(22,30,40,.98));
}
.comp-score {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}
.comp-score.red { color: #f07178; }
.comp-score.yellow { color: #f5c542; }
.comp-score.green { color: var(--accent); }
.comp-issue {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  text-align: left;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow-wrap: break-word;
  word-break: normal;
}
.comp-issue.critical { border-color: rgba(240,113,120,.55); background: rgba(240,113,120,.08); }
.comp-issue.high { border-color: rgba(240,113,120,.35); }
.comp-issue.medium { border-color: rgba(245,197,66,.3); }
.comp-sev {
  display: inline-block;
  font-size: 10px; font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 2px 8px; border-radius: 999px;
  margin-bottom: 6px;
}
.comp-sev.critical, .comp-sev.high { background: rgba(240,113,120,.2); color: #f07178; }
.comp-sev.medium { background: rgba(245,197,66,.2); color: #f5c542; }
.comp-sev.info { background: rgba(91,156,255,.2); color: #8eb6ff; }

.an-hist-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  margin-bottom: 10px;
}
.an-hist-head .card-title { margin: 0; }
.an-clear-btn {
  flex-shrink: 0;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(240,113,120,.12);
  color: #f07178;
  font-weight: 700;
  font-size: 12px;
  border: 1px solid rgba(240,113,120,.3);
}
.an-clear-btn:disabled { opacity: .45; }

.an-full-card {
  text-align: left;
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(245,197,66,.28);
  background:
    linear-gradient(135deg, rgba(245,197,66,.1), rgba(45,212,168,.05)),
    var(--surface);
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  transition: transform .15s, border-color .2s;
}
.an-full-card:active { transform: scale(.985); border-color: rgba(245,197,66,.5); }
.an-full-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px; font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
  background: rgba(245,197,66,.2);
  color: #ffe6a3;
}
.an-risk {
  font-size: 11px; font-weight: 750;
  padding: 3px 8px; border-radius: 999px;
}
.an-risk.high { background: rgba(240,113,120,.18); color: #f07178; }
.an-risk.medium, .an-risk.средний { background: rgba(245,197,66,.18); color: #f5c542; }
.an-risk.low, .an-risk.низкий { background: rgba(45,212,168,.18); color: var(--accent); }
.comp-check-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  max-width: 100%;
  min-width: 0;
}
.comp-level-label {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  white-space: normal !important;
  overflow-wrap: break-word;
  word-break: normal;
  line-height: 1.4;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 650;
  text-transform: none;
  letter-spacing: normal;
}

.an-pro-hero {
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(245,197,66,.3);
  background:
    radial-gradient(ellipse 80% 60% at 100% 0%, rgba(245,197,66,.18), transparent 55%),
    linear-gradient(160deg, rgba(36,48,64,.95), rgba(22,30,40,.98));
  margin-bottom: 4px;
}
.an-pro-hero .an-hero-title { color: #ffe6a3; }

.profile-actions .profile-site {
  background: linear-gradient(145deg, rgba(45,212,168,.18), var(--surface2));
  border-color: rgba(45,212,168,.4);
}
.profile-site-main { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; }
.profile-site-title { font-weight: 800; color: var(--accent); }
.profile-site-sub { font-size: 12px; color: var(--muted); font-weight: 600; }

.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-b));
  transform: translateX(-50%) translateY(20px);
  background: var(--surface2); color: var(--text);
  padding: 10px 16px; border-radius: 12px; z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  max-width: 90%; opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .3s var(--ease);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.loading { opacity: .55; pointer-events: none; }

.brand { display: flex; align-items: center; gap: 8px; }
.brand-mark { border-radius: 8px; flex-shrink: 0; }

.profile-btn {
  width: 42px; height: 42px; border-radius: 14px; padding: 0;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, var(--surface2), var(--surface));
  display: grid; place-items: center;
  transition: transform .18s var(--ease), box-shadow .22s, border-color .2s;
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
}
.profile-btn:active { transform: scale(.94); }
.profile-btn.has-sub {
  border-color: rgba(45,212,168,.55);
  box-shadow: 0 4px 16px rgba(45,212,168,.25);
}
.profile-avatar {
  width: 34px; height: 34px; border-radius: 11px;
  display: grid; place-items: center;
  font-size: 14px; font-weight: 800; color: #06261c;
  background: linear-gradient(135deg, #3ee0b4, var(--accent));
  overflow: hidden;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }

.profile-hero {
  display: flex; gap: 12px; align-items: center;
  padding: 14px; border-radius: 16px;
  background: linear-gradient(160deg, rgba(45,212,168,.12), var(--surface));
  border: 1px solid var(--line);
  margin-bottom: 12px;
}
.profile-hero .ph-text { flex: 1; min-width: 0; }
.profile-hero .ph-edit-btn {
  flex-shrink: 0;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}
.profile-hero .ph-avatar {
  width: 56px; height: 56px; border-radius: 16px; flex-shrink: 0;
  display: grid; place-items: center;
  font-size: 22px; font-weight: 800; color: #06261c;
  background: linear-gradient(135deg, #3ee0b4, var(--accent));
  overflow: hidden;
}
.profile-hero .ph-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-hero .ph-name { font-weight: 750; font-size: 1.05rem; }
.profile-hero .ph-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.admin-pill {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  vertical-align: middle;
  color: #06261c;
  background: linear-gradient(135deg, #5eead4, #2dd4a8);
}

.profile-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: 6px;
  padding: 4px;
  margin: 0 0 12px;
  border-radius: 14px;
  background: var(--glass);
  border: 1px solid var(--line);
}
.profile-tab {
  min-width: 0;
  padding: 11px 8px;
  border-radius: 11px;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--line);
  font-weight: 750;
  font-size: 13px;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background .22s var(--ease), color .22s, border-color .2s, box-shadow .2s, transform .2s;
  box-shadow: 0 1px 0 rgba(255,255,255,.04);
}
.profile-tab.active {
  background: linear-gradient(135deg, rgba(45,212,168,.22), rgba(45,212,168,.08));
  color: var(--accent);
  border-color: var(--accent-border);
  box-shadow: 0 0 0 1px rgba(45,212,168,.12), 0 4px 12px rgba(45,212,168,.12);
}
.profile-tab:active { transform: scale(.97); }
.profile-tab-panel { display: none; animation: fadeIn .28s var(--ease); }
.profile-tab-panel.active { display: block; }

.admin-users-toolbar { display: grid; gap: 10px; margin-bottom: 12px; }
.admin-users-toolbar input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
}
.admin-users-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-filter-chip {
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.admin-filter-chip.on {
  border-color: rgba(45,212,168,.5);
  background: rgba(45,212,168,.14);
  color: var(--accent);
}
.admin-user-card {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  margin-bottom: 10px;
}
.admin-user-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}
.admin-user-main {
  flex: 1;
  min-width: 0;
}
.admin-user-name { font-weight: 800; font-size: 15px; }
.admin-user-name-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.admin-plat-badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-left: 2px;
}
.admin-plat-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .02em;
  line-height: 1.3;
  border: 1px solid transparent;
  opacity: .78;
}
.admin-plat-badge.last {
  opacity: 1;
  box-shadow: 0 0 0 1px rgba(255,255,255,.08);
}
.admin-plat-badge.plat-tg,
.admin-plat-badge.plat-telegram {
  background: rgba(56, 148, 220, .16);
  border-color: rgba(56, 148, 220, .4);
  color: #7ec8f5;
}
.admin-plat-badge.plat-max {
  background: rgba(124, 92, 255, .16);
  border-color: rgba(124, 92, 255, .4);
  color: #c4b5fd;
}
.admin-plat-badge.plat-web {
  background: rgba(45, 212, 168, .12);
  border-color: rgba(45, 212, 168, .35);
  color: #5eead4;
}
.admin-role-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .02em;
  line-height: 1.2;
  flex-shrink: 0;
}
.admin-role-badge.role-user {
  background: rgba(148,163,184,.16);
  color: #cbd5e1;
  border: 1px solid rgba(148,163,184,.28);
}
.admin-role-badge.role-manager {
  background: rgba(91,156,255,.18);
  color: #93c5fd;
  border: 1px solid rgba(91,156,255,.35);
}
.admin-role-badge.role-admin {
  background: rgba(251,191,36,.18);
  color: #fbbf24;
  border: 1px solid rgba(251,191,36,.4);
}
.admin-user-card.role-admin {
  border-color: rgba(251,191,36,.28);
}
.admin-user-card.role-manager {
  border-color: rgba(91,156,255,.22);
}
.admin-user-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 6px;
  align-items: stretch;
}
.admin-sub-badge,
.admin-bal-badge {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 7px 10px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.25;
  font-weight: 700;
}
.admin-sub-badge.on {
  background: rgba(45,212,168,.12);
  border: 1px solid rgba(45,212,168,.35);
  color: var(--text);
}
.admin-sub-badge.on strong { color: var(--accent); font-weight: 800; }
.admin-sub-badge.off {
  background: rgba(148,163,184,.1);
  border: 1px solid rgba(148,163,184,.28);
  color: var(--muted);
}
.admin-sub-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(45,212,168,.2);
  flex-shrink: 0;
}
.admin-sub-st,
.admin-sub-exp {
  color: var(--muted);
  font-weight: 650;
  font-size: 11px;
}
.admin-bal-badge {
  background: rgba(91,156,255,.12);
  border: 1px solid rgba(91,156,255,.32);
  color: var(--text);
  margin-left: auto;
}
.admin-bal-badge .admin-bal-label {
  color: var(--muted);
  font-weight: 650;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.admin-bal-badge strong {
  color: #93c5fd;
  font-weight: 800;
  font-size: 13px;
}
.admin-user-card.no-sub {
  border-color: color-mix(in srgb, var(--line) 80%, rgba(148,163,184,.35));
}
.admin-user-card.has-sub {
  border-color: color-mix(in srgb, var(--line) 70%, rgba(45,212,168,.4));
}
.admin-user-bal { font-weight: 800; color: var(--accent); white-space: nowrap; }
.admin-user-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.admin-user-stats > span {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.04);
  color: var(--muted);
}
.admin-user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.admin-user-actions > button { flex: 1 1 30%; }
.admin-users-bulk {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.admin-user-card.selected {
  border-color: rgba(45,212,168,.55);
  box-shadow: 0 0 0 1px rgba(45,212,168,.25);
}
.admin-user-check {
  display: flex;
  align-items: center;
  margin-right: 4px;
}
.admin-user-check input { width: 18px; height: 18px; }
.admin-user-main { flex: 1; min-width: 0; }
.admin-ctx { position: relative; flex-shrink: 0; }
.admin-ctx-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
}
.admin-ctx-menu {
  display: none;
  position: absolute;
  right: 0; top: 40px;
  z-index: 30;
  min-width: 210px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  box-shadow: 0 12px 32px rgba(0,0,0,.35);
}
.admin-ctx.open .admin-ctx-menu { display: grid; gap: 2px; }
.admin-ctx-menu button {
  text-align: left;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}
.admin-ctx-menu button:hover { background: var(--glass); }
.admin-kw-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.admin-kw-chip {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 12px;
}
.admin-fav-list { display: grid; gap: 8px; margin-top: 8px; }
.admin-fav-row {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.admin-gift-plans { display: grid; gap: 8px; }
.admin-gift-plan {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-weight: 700;
}
.admin-gift-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.gift-celebrate {
  position: fixed; inset: 0; z-index: 10050;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 90% 60% at 50% 20%, rgba(251,191,36,.22), transparent 55%),
    radial-gradient(circle at 50% 40%, rgba(45,212,168,.32), rgba(5,8,14,.94) 68%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .4s ease, visibility .4s ease;
}
.gift-celebrate.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.gift-celebrate.hidden { display: none !important; }
.gift-celebrate-burst {
  position: absolute; inset: -20%;
  background:
    radial-gradient(circle at 18% 28%, rgba(94,234,212,.4), transparent 26%),
    radial-gradient(circle at 82% 22%, rgba(251,113,133,.28), transparent 24%),
    radial-gradient(circle at 50% 82%, rgba(251,191,36,.28), transparent 28%),
    radial-gradient(circle at 70% 55%, rgba(91,156,255,.22), transparent 22%);
  animation: giftPulse 2.2s ease-in-out infinite;
  pointer-events: none;
}
.gift-celebrate-confetti {
  position: absolute; inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.gift-celebrate-confetti i {
  position: absolute;
  top: -12px;
  width: 8px; height: 12px;
  border-radius: 2px;
  opacity: .95;
  animation: giftFall linear forwards;
}
.gift-celebrate-card {
  position: relative;
  width: min(420px, 100%);
  padding: 32px 22px 24px;
  border-radius: 28px;
  text-align: center;
  background:
    linear-gradient(165deg, rgba(28,44,58,.98), rgba(10,16,24,.99));
  border: 1px solid rgba(251,191,36,.35);
  box-shadow:
    0 0 0 1px rgba(45,212,168,.12) inset,
    0 28px 80px rgba(0,0,0,.55),
    0 0 60px rgba(45,212,168,.12);
  transform: translateY(28px) scale(.9);
  transition: transform .55s cubic-bezier(.2,1.1,.3,1);
  overflow: hidden;
}
.gift-celebrate.show .gift-celebrate-card { transform: none; }
.gift-celebrate-spark {
  position: absolute; inset: -40%;
  background: conic-gradient(from 0deg, transparent, rgba(251,191,36,.12), transparent 30%, rgba(45,212,168,.1), transparent 60%);
  animation: giftSpin 8s linear infinite;
  pointer-events: none;
}
.gift-celebrate-ico {
  position: relative;
  font-size: 64px;
  line-height: 1;
  filter: drop-shadow(0 8px 18px rgba(251,191,36,.35));
  animation: giftBounce 1s ease infinite alternate;
}
.gift-celebrate-eyebrow {
  position: relative;
  margin-top: 12px;
  color: #fbbf24;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.gift-celebrate-title {
  position: relative;
  margin-top: 8px;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -.02em;
}
.gift-celebrate-sub {
  position: relative;
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}
.gift-celebrate-plan {
  position: relative;
  margin-top: 16px;
  font-size: 32px;
  font-weight: 900;
  background: linear-gradient(90deg, #fbbf24, #5eead4, #93c5fd);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: giftShine 2.8s linear infinite;
}
.gift-celebrate-days {
  position: relative;
  margin-top: 8px;
  font-size: 18px;
  font-weight: 800;
  color: #e8f5ef;
}
.gift-celebrate-until {
  position: relative;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}
.gift-celebrate-from {
  position: relative;
  margin-top: 12px;
  font-size: 14px;
  font-weight: 700;
  color: rgba(251,191,36,.95);
}
.gift-celebrate-btn {
  position: relative;
  margin-top: 20px;
  width: 100%;
  font-size: 16px;
  font-weight: 800;
  box-shadow: 0 10px 28px rgba(45,212,168,.28);
}
@keyframes giftBounce {
  from { transform: translateY(0) rotate(-6deg) scale(1); }
  to { transform: translateY(-10px) rotate(6deg) scale(1.06); }
}
@keyframes giftPulse {
  0%, 100% { opacity: .65; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.06); }
}
@keyframes giftSpin { to { transform: rotate(360deg); } }
@keyframes giftShine {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}
@keyframes giftFall {
  0% { transform: translate3d(0,-10vh,0) rotate(0deg); opacity: 1; }
  100% { transform: translate3d(var(--dx, 20px), 110vh, 0) rotate(720deg); opacity: .15; }
}


.bal-hero {
  margin: 0 0 12px;
  padding: 18px 16px 16px;
  border-radius: 18px;
  border: 1px solid var(--accent-border);
  background:
    radial-gradient(120% 90% at 100% 0%, var(--accent-soft), transparent 55%),
    var(--surface);
  color: var(--text);
}
.bal-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 700;
}
.bal-amount {
  margin-top: 4px;
  font-size: 32px; font-weight: 850; letter-spacing: -.02em;
  color: var(--accent); font-variant-numeric: tabular-nums;
}
.bal-hint { margin-top: 6px; font-size: 13px; color: var(--muted); }
.bal-status {
  margin-top: 12px; display: inline-flex; padding: 6px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 750;
}
.bal-status.ok { background: var(--accent-soft); color: var(--accent); }
.bal-status.warn { background: rgba(245,197,66,.14); color: #f5c542; }
.bal-topup-btn { margin-top: 16px; }

.bal-history {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.bal-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.bal-history-title {
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
}
.bal-history-list {
  max-height: 220px;
  overflow: auto;
  margin: 0 -4px;
  padding: 0 4px;
  display: grid;
  gap: 6px;
  scrollbar-width: thin;
}
.bal-ledger-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface2);
  color: var(--text);
}
.bal-ledger-row:last-child { border-bottom: 1px solid var(--line); }
.bal-ledger-ico {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
}
.bal-ledger-ico.plus {
  color: var(--accent);
  background: rgba(45,212,168,.14);
  border: 1px solid rgba(45,212,168,.28);
}
.bal-ledger-ico.minus {
  color: #f07178;
  background: rgba(240,113,120,.12);
  border: 1px solid rgba(240,113,120,.28);
}
.bal-ledger-main { min-width: 0; }
.bal-ledger-title {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bal-ledger-when {
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}
.bal-ledger-amt {
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-size: 13px;
}
.bal-ledger-amt.plus { color: var(--accent); }
.bal-ledger-amt.minus { color: #f07178; }
.bal-empty {
  color: var(--muted);
  font-size: 12px;
  padding: 8px 2px;
  line-height: 1.4;
}
.bal-history-more {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  padding: 4px 0 2px;
}

.ref-compact {
  margin: 0 0 14px;
  padding: 12px 12px 12px;
  border-radius: 16px;
  border: 1px solid var(--accent-border);
  background:
    radial-gradient(120% 90% at 100% 0%, var(--desktop-glow-b), transparent 42%),
    radial-gradient(90% 80% at 0% 0%, var(--accent-soft), transparent 48%),
    var(--surface);
  color: var(--text);
  display: grid;
  gap: 10px;
}
.ref-compact-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.ref-compact-title {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}
.ref-compact-title strong {
  display: block;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -.01em;
}
.ref-compact-title .card-sub {
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.3;
}
.ref-compact-ico {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 16px;
  background: rgba(45,212,168,.14);
  border: 1px solid rgba(45,212,168,.28);
  flex-shrink: 0;
}
.ref-compact-more {
  flex-shrink: 0;
  padding: 4px 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.ref-compact-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.ref-compact-stat {
  padding: 8px 4px;
  border-radius: 11px;
  text-align: center;
  background: var(--surface2);
  border: 1px solid var(--line);
  color: var(--text);
}
.ref-compact-stat .n {
  display: block;
  font-size: 13px;
  font-weight: 850;
  letter-spacing: -.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.ref-compact-stat .l {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  color: var(--muted);
  line-height: 1.2;
}
.ref-compact-stat.accent .n { color: var(--accent); }
.ref-share-neon {
  position: relative;
  overflow: hidden;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 11px 14px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: .01em;
}
.ref-share-neon .ref-share-glow {
  position: absolute;
  inset: -40% -20%;
  background: linear-gradient(
    110deg,
    transparent 30%,
    rgba(125,255,210,.22) 48%,
    transparent 62%
  );
  animation: refShareShine 2.8s ease-in-out infinite;
  pointer-events: none;
}
.ref-share-neon svg { position: relative; z-index: 1; flex-shrink: 0; }
@keyframes refShareShine {
  0% { transform: translateX(-55%); opacity: .35; }
  50% { opacity: .9; }
  100% { transform: translateX(55%); opacity: .35; }
}
@media (max-width: 380px) {
  .ref-compact-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.bal-presets {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.bal-preset {
  padding: 12px 10px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--text); font-weight: 750; font-size: 13px;
}
.bal-preset.active {
  border-color: rgba(45,212,168,.5);
  background: rgba(45,212,168,.12);
  color: var(--accent);
}
.bal-spend-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.bal-spend-title { font-weight: 700; font-size: 14px; }
.bal-spend-price { font-weight: 850; color: var(--accent); white-space: nowrap; }
.bal-ways { display: grid; gap: 8px; }
.bal-way {
  text-align: left; width: 100%;
  padding: 12px 14px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--text); display: grid; gap: 3px;
}
.bal-way:active { transform: scale(.99); }
.bal-way-title { font-weight: 750; font-size: 14px; }
.sub-hero {
  margin: 0 0 12px; padding: 16px;
  border-radius: 18px; border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(255,255,255,.04), rgba(12,16,22,.9));
}
.sub-hero.active {
  border-color: rgba(45,212,168,.35);
  background:
    radial-gradient(110% 80% at 0% 0%, rgba(45,212,168,.18), transparent 50%),
    linear-gradient(160deg, rgba(26,34,44,.95), rgba(12,16,22,.98));
}
.sub-hero.trial {
  border-color: rgba(245,197,66,.4);
  background:
    radial-gradient(110% 80% at 100% 0%, rgba(245,197,66,.2), transparent 48%),
    linear-gradient(160deg, rgba(26,34,44,.95), rgba(12,16,22,.98));
}
.sub-hero.trial .sub-pill {
  color: #2a1f05;
  background: linear-gradient(135deg, #ffe08a, #f5c542);
}
.sub-countdown-wrap {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(0,0,0,.22);
  border: 1px solid rgba(255,255,255,.08);
  text-align: center;
}
.sub-countdown-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.sub-countdown {
  font-size: 28px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
  color: var(--accent);
  line-height: 1.15;
}
.sub-countdown.urgent { color: #f5c542; }
.sub-hero.trial .sub-countdown { color: #f5c542; }
.sub-trial-note {
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}
.sub-hero-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.sub-eyebrow {
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 700; margin-bottom: 4px;
}
.sub-plan-name { font-size: 22px; font-weight: 850; letter-spacing: -.02em; }
.sub-until { margin-top: 4px; color: var(--muted); font-size: 13px; }
/* Тёмный hero-блок: текст всегда светлый (и в light theme) */
.sub-hero .sub-eyebrow,
.sub-hero .sub-until,
.sub-hero .sub-countdown-label,
.sub-hero .sub-trial-note {
  color: rgba(232, 238, 245, 0.72);
}
.sub-hero .sub-plan-name {
  color: #f3f7fb;
}
.sub-hero .sub-countdown {
  color: #3ee0b4;
}
.sub-hero.trial .sub-countdown {
  color: #f5c542;
}
.sub-hero .sub-meter {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.12);
}
.sub-hero .sub-meter .l {
  color: rgba(232, 238, 245, 0.62);
}
.sub-hero .sub-meter .v {
  color: #f3f7fb;
}
.sub-pill {
  flex-shrink: 0; width: 42px; height: 42px; border-radius: 14px;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 900; letter-spacing: .04em;
  color: #06261c; background: linear-gradient(135deg, #3ee0b4, var(--accent));
}
.sub-meters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}
.sub-meter {
  min-width: 0;
  padding: 10px 6px;
  border-radius: 12px;
  background: var(--glass);
  border: 1px solid rgba(255,255,255,.06);
  text-align: center;
}
.sub-meter .l {
  display: block;
  font-size: 10px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.sub-meter .v {
  display: block;
  margin-top: 4px;
  font-weight: 800;
  font-size: 13px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
@media (max-width: 380px) {
  .sub-meters { gap: 6px; }
  .sub-meter { padding: 9px 4px; }
  .sub-meter .l { font-size: 9px; letter-spacing: .02em; }
  .sub-meter .v { font-size: 12px; }
  .profile-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .profile-tab { font-size: 12px; padding: 10px 4px; }
}

.profile-block {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px; margin-bottom: 10px;
  animation: fadeIn .3s var(--ease);
}
.profile-block h3 {
  margin: 0 0 8px; font-size: 13px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); font-weight: 700;
}
.plan-card {
  border: 1px solid var(--line); border-radius: 16px;
  padding: 14px 14px 12px; margin-bottom: 10px;
  background: linear-gradient(165deg, rgba(255,255,255,.03), transparent 42%), var(--bg);
  transition: border-color .2s, transform .18s var(--ease), box-shadow .22s;
  position: relative;
  overflow: hidden;
}
.plan-card:active { transform: scale(.985); }
.plan-card.featured {
  border-color: rgba(45,212,168,.45);
  box-shadow: 0 0 0 1px rgba(45,212,168,.12), 0 12px 28px rgba(0,0,0,.18);
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(45,212,168,.16), transparent 55%),
    var(--bg);
}
.plan-card.current { border-color: rgba(45,212,168,.55); background: rgba(45,212,168,.08); }
.plan-card .plan-top {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
}
.plan-title-wrap { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.plan-badge {
  align-self: flex-start;
  font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: #06261c; background: linear-gradient(135deg, #3ee0b4, var(--accent));
  padding: 3px 8px; border-radius: 999px;
}
.plan-card .plan-name { font-weight: 800; font-size: 1.05rem; }
.plan-tagline { color: var(--muted); font-size: 12px; line-height: 1.35; }
.plan-price-wrap { text-align: right; flex-shrink: 0; }
.plan-card .plan-price { color: var(--accent); font-weight: 850; font-size: 1.2rem; display: block; }
.plan-card .plan-price-old {
  display: block; font-size: 11px; color: var(--muted); text-decoration: line-through;
  font-weight: 600; margin-top: 2px;
}
.plan-card .plan-price-note {
  display: block; font-size: 10px; color: var(--muted); margin-top: 2px; font-weight: 600;
}
.plan-card .plan-year-disc {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 750;
  color: #0d9488;
  background: rgba(45, 212, 168, 0.16);
  vertical-align: middle;
}
.plan-period-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  margin: 0 0 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
}
.plan-period-toggle .ppt-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
}
.plan-period-toggle .ppt-btn.active {
  background: rgba(45, 212, 168, 0.18);
  color: var(--text);
}
.plan-period-toggle .ppt-save {
  font-size: 11px;
  font-weight: 650;
  opacity: 0.85;
  margin-left: 2px;
}
.price-lock-banner {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(45,212,168,.35);
  background: linear-gradient(135deg, rgba(45,212,168,.14), rgba(8,28,24,.6));
}
.price-lock-banner.expired {
  border-color: rgba(240,113,120,.35);
  background: linear-gradient(135deg, rgba(240,113,120,.12), rgba(28,8,10,.5));
}
.price-lock-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 700; margin-bottom: 4px;
}
.price-lock-timer {
  font-size: 22px; font-weight: 850; letter-spacing: .04em;
  font-variant-numeric: tabular-nums; color: var(--accent);
}
.price-lock-banner.expired .price-lock-timer { color: #ffc4c7; }
.price-lock-sub { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.35; }
.plan-period { color: var(--muted); font-size: 11px; font-weight: 650; }
.plan-chip {
  display: inline-flex; margin-top: 10px; padding: 4px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; color: var(--accent);
  background: rgba(45,212,168,.12); border: 1px solid rgba(45,212,168,.25);
}
.plan-card ul, .plan-feats {
  margin: 10px 0 12px; padding-left: 0; list-style: none;
  color: var(--text); font-size: 12.5px; line-height: 1.45;
}
.plan-feats li {
  position: relative; padding: 5px 0 5px 18px;
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.plan-feats-more {
  margin-top: 0;
}
.plan-feats-more .plan-feats {
  margin-top: 0;
  border-top: 0;
}
.plan-feats-toggle {
  display: block;
  width: 100%;
  margin: 2px 0 10px;
  padding: 8px 4px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}
.plan-feats-toggle:hover { text-decoration: underline; }
.seats-block .seats-meters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.seats-block .sub-meter {
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
}
.plan-feats li::before {
  content: ""; position: absolute; left: 0; top: 11px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 3px rgba(45,212,168,.15);
}
.plan-card .plan-buy {
  width: 100%; padding: 12px; border-radius: 12px; font-weight: 800;
  background: linear-gradient(135deg, #3ee0b4, var(--accent)); color: #06261c;
  letter-spacing: .01em;
}
.plan-card.featured .plan-buy {
  box-shadow: 0 8px 20px rgba(45,212,168,.25);
}
.ref-block .ref-hero {
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px; border-radius: 14px;
  background: radial-gradient(120% 100% at 0% 0%, rgba(45,212,168,.18), transparent 60%),
    var(--surface2);
  border: 1px solid rgba(45,212,168,.22);
}
.ref-amount {
  font-size: 1.45rem; font-weight: 850; color: var(--accent); letter-spacing: -.02em;
}
.ref-card {
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(45,212,168,.28);
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(91,156,255,.14), transparent 45%),
    radial-gradient(90% 80% at 0% 0%, rgba(45,212,168,.2), transparent 50%),
    var(--surface);
}
.ref-card > h3 { padding: 14px 14px 0; margin: 0; }
.ref-card-inner { padding: 12px 14px 14px; }
.ref-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0;
}
.ref-stat {
  padding: 10px 8px;
  border-radius: 12px;
  background: var(--glass);
  border: 1px solid var(--line);
  text-align: center;
}
.ref-stat .n {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--text);
}
.ref-stat .l {
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.25;
}
.ref-stat.accent .n { color: var(--accent); }
.ref-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ref-step {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.ref-step-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 800;
  background: rgba(45,212,168,.16);
  color: var(--accent);
  border: 1px solid rgba(45,212,168,.35);
}
.ref-step-title { font-weight: 700; font-size: 13px; }
.ref-step-text { margin-top: 2px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.ref-link-box {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface2);
  border: 1px dashed rgba(45,212,168,.35);
  font-size: 12px;
  word-break: break-all;
  color: var(--muted);
  line-height: 1.4;
}
.ref-friend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface2);
  border: 1px solid var(--line);
}
.ref-friend-main { min-width: 0; }
.ref-friend-name {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ref-friend-meta { margin-top: 3px; color: var(--muted); font-size: 11px; }
.ref-badge {
  flex-shrink: 0;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.ref-badge.paid {
  background: rgba(45,212,168,.16);
  color: var(--accent);
  border: 1px solid rgba(45,212,168,.35);
}
.ref-badge.bound {
  background: rgba(245,197,66,.12);
  color: #f5c542;
  border: 1px solid rgba(245,197,66,.3);
}
.ref-ledger-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.ref-ledger-row:last-child { border-bottom: 0; }
.ref-ledger-amt {
  font-weight: 800;
  color: var(--accent);
  white-space: nowrap;
}
.ref-empty {
  padding: 16px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px dashed var(--line);
}
.profile-actions { display: grid; gap: 8px; }
.profile-actions button, .profile-actions a.profile-link {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 12px 14px; border-radius: 12px;
  background: var(--surface2); color: var(--text); font-weight: 650;
  border: 1px solid var(--line); text-decoration: none;
  transition: transform .18s var(--ease), background .2s;
}
.profile-actions button:active, .profile-actions a.profile-link:active { transform: scale(.98); }
.profile-actions .chev { color: var(--muted); }
.pending-pay {
  margin-top: 8px; padding: 10px; border-radius: 12px;
  background: rgba(245,197,66,.12); border: 1px solid rgba(245,197,66,.35);
  font-size: 13px;
}
.pending-pay.hidden { display: none; }

.paywall-reason {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(45, 212, 168, 0.1);
  border: 1px solid rgba(45, 212, 168, 0.28);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  font-weight: 600;
}
.paywall-plans {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.paywall-plans .plan-card .plan-buy {
  width: 100%;
}
.empty-paywall {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  text-align: left;
}
.empty-paywall .empty-msg {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}
.empty-paywall .primary {
  width: 100%;
}

.checkout-current {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(45,212,168,.1);
  border: 1px solid rgba(45,212,168,.28);
  margin-bottom: 12px;
}
.checkout-current .t { font-weight: 750; }
.checkout-current .s { color: var(--muted); font-size: 12px; margin-top: 3px; }
.checkout-plan {
  padding: 14px;
  border-radius: 16px;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(91,156,255,.12), transparent 50%),
    var(--surface2);
  border: 1px solid var(--line);
  margin-bottom: 14px;
}
.checkout-plan .name { font-weight: 800; font-size: 1.05rem; }
.checkout-plan .price {
  margin-top: 6px;
  color: var(--accent);
  font-weight: 850;
  font-size: 1.35rem;
  letter-spacing: -.02em;
}
.checkout-plan .price span { color: var(--muted); font-size: 13px; font-weight: 600; }
.checkout-methods { display: grid; gap: 8px; }
.pay-method {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 12px;
  border-radius: 14px;
  background: var(--surface2);
  border: 1px solid var(--line);
  color: var(--text);
  transition: border-color .2s, background .2s, transform .15s;
}
.pay-method:active { transform: scale(.985); }
.pay-method.selected {
  border-color: rgba(45,212,168,.55);
  background: rgba(45,212,168,.1);
  box-shadow: 0 0 0 1px rgba(45,212,168,.2);
}
.pay-method.soon,
.pay-method:disabled { opacity: .72; }
.pay-method .pm-ico {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.05);
  font-size: 18px;
  font-weight: 800;
}
.pay-method .pm-title { font-weight: 750; font-size: 14px; }
.pay-method .pm-sub { color: var(--muted); font-size: 12px; margin-top: 2px; line-height: 1.3; }
.pay-method .pm-note { color: #f5c542; font-size: 11px; margin-top: 4px; }
.pay-method .pm-badge {
  flex-shrink: 0;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
  background: rgba(45,212,168,.16);
  color: var(--accent);
  border: 1px solid rgba(45,212,168,.3);
  white-space: nowrap;
}
.pay-method .pm-badge.soon {
  background: rgba(245,197,66,.14);
  color: #f5c542;
  border-color: rgba(245,197,66,.3);
}
.pay-method .pm-check {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid var(--control-border);
  display: grid; place-items: center;
  font-size: 11px;
  color: transparent;
}
.pay-method.selected .pm-check {
  border-color: var(--accent);
  background: var(--accent);
  color: #06261c;
  font-weight: 900;
}
.checkout-pending { margin-top: 12px; }

.action-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px;
}
.btn-action {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 14px; border-radius: 14px; font-weight: 700; font-size: 14px;
  transition: transform .18s var(--ease), box-shadow .22s, filter .2s, background .2s;
}
.btn-action.ghost {
  background: var(--surface2); color: var(--text);
  border: 1px solid var(--line);
}
.btn-action.primary {
  background: linear-gradient(135deg, #3ee0b4, var(--accent));
  color: #06261c;
  box-shadow: 0 8px 20px rgba(45,212,168,.28);
}
.btn-action:active { transform: scale(.97); }
.btn-action.primary:hover { filter: brightness(1.05); }

.search-tools {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 2px;
}
.tool-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 12px; border-radius: 12px; font-weight: 650; font-size: 13px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line);
  transition: transform .18s var(--ease), border-color .2s, background .2s, color .2s;
}
.tool-btn.accent {
  color: var(--accent);
  border-color: rgba(45,212,168,.4);
  background: rgba(45,212,168,.1);
}
.tool-btn:active { transform: scale(.97); }
.tool-btn:disabled,
.tool-btn.is-disabled,
.tool-btn.is-busy {
  opacity: .45;
  pointer-events: none;
  cursor: not-allowed;
}
.tool-btn svg { flex-shrink: 0; }

.scroll-top {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(18px + var(--safe-b));
  z-index: 41;
  width: 48px; height: 48px; border-radius: 16px;
  display: grid !important; place-items: center;
  background: linear-gradient(145deg, #3ee0b4, var(--accent-dim));
  color: #06261c;
  box-shadow: 0 10px 28px rgba(45,212,168,.35);
  border: 0; cursor: pointer;
  opacity: 0; transform: translateY(16px) scale(.9);
  pointer-events: none;
  visibility: hidden;
  transition: opacity .32s var(--ease), transform .36s var(--ease), visibility .32s;
}
.scroll-top.visible {
  opacity: 1; transform: none; pointer-events: auto; visibility: visible;
}
.scroll-top.hidden {
  display: grid !important;
  opacity: 0;
  transform: translateY(16px) scale(.9);
  pointer-events: none;
  visibility: hidden;
}
.scroll-top:active { transform: scale(.94); }

.qf-btn, .picker-trigger, .pill, .tab, .primary, .ghost {
  transition: transform .18s var(--ease), background .22s, color .22s, border-color .22s, box-shadow .22s;
}
.tab:active, .pill:active, .qf-btn:active { transform: scale(.97); }

.excel-actions { flex-wrap: wrap; }
.excel-actions > button { flex: 1 1 30%; }
.excel-viewer-sheet .excel-viewer-body {
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}
.excel-viewer-body iframe {
  flex: 1;
  width: 100%;
  min-height: 70vh;
  border: 0;
  background: #fff;
}

.tpl-card .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tpl-card .actions button {
  flex: 1 1 calc(50% - 8px); min-width: 110px;
  padding: 10px; border-radius: 10px; font-weight: 650; font-size: 13px;
}
.tpl-open { background: var(--accent); color: #06261c; }
.tpl-edit { background: var(--surface2); color: var(--text); }
.tpl-apply { background: rgba(45,212,168,.16); color: var(--accent); border: 1px solid rgba(45,212,168,.35); }
.tpl-del { background: var(--surface2); color: var(--danger); }

.tpl-workspace { display: flex; flex-direction: column; gap: 0; min-height: 50vh; }
.tpl-select-bar {
  position: sticky; top: 96px; z-index: 12;
  padding: 4px 0 10px;
  background: linear-gradient(180deg, var(--bg) 82%, transparent);
}
.tpl-head-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.tpl-chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px;
  scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
  margin-bottom: 8px;
}
.tpl-chips::-webkit-scrollbar { height: 0; }
.tpl-chip-unit {
  position: relative;
  flex: 0 0 auto;
  scroll-snap-align: start;
  display: inline-flex;
  align-items: stretch;
  max-width: min(260px, 82vw);
  min-height: 40px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
  z-index: 1;
  transition: border-color .15s, background .15s, color .15s, box-shadow .15s;
}
.tpl-chip-unit.active {
  background: color-mix(in srgb, var(--bg) 70%, var(--accent-soft));
  border-color: var(--accent-border);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
  z-index: 2;
}
.tpl-chip-unit.is-menu-open { z-index: 45; overflow: visible; }
.tpl-chip {
  flex: 1 1 auto; min-width: 0;
  max-width: 200px;
  padding: 0 4px 0 14px;
  border-radius: 999px 0 0 999px;
  background: transparent; color: var(--text);
  border: 0;
  font-weight: 650; font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color .15s;
}
.tpl-chip-unit.active .tpl-chip { color: var(--accent); }
.tpl-chip:active { transform: none; opacity: .9; }
.tpl-chip.empty {
  color: var(--muted); border-style: dashed; font-weight: 550;
  border-radius: 999px; padding: 10px 14px; max-width: none;
  background: var(--surface); border: 1px dashed var(--line);
}
.tpl-chip-unit .tpl-menu-wrap {
  position: relative;
  flex-shrink: 0;
  z-index: 1;
  display: flex;
}
.tpl-chip-unit .tpl-more-btn {
  position: relative;
  z-index: 1;
  width: 36px; min-height: 100%;
  border-radius: 0 999px 999px 0;
  background: transparent;
  color: var(--muted);
  border: 0;
  border-left: 1px solid var(--line);
  font-size: 16px; line-height: 1; font-weight: 700;
  display: grid; place-items: center;
  padding: 0 10px;
  transition: background .15s, color .15s, border-color .15s;
}
.tpl-chip-unit.active .tpl-more-btn {
  color: var(--accent);
  border-left-color: var(--accent-border);
}
.tpl-chip-unit .tpl-more-btn:hover,
.tpl-chip-unit .tpl-more-btn.is-open {
  background: var(--accent-soft);
  color: var(--accent);
}
.tpl-chip-unit .tpl-more-btn:active {
  background: var(--accent-soft);
  transform: none;
}
.tpl-menu {
  min-width: 210px;
  padding: 6px;
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 2px;
}
.tpl-menu.hidden { display: none !important; }
.tpl-menu-float {
  position: fixed;
  z-index: 220;
  right: auto;
  top: 0;
  left: 0;
  margin: 0;
}
.tpl-menu-item {
  text-align: left; width: 100%;
  padding: 11px 12px; border-radius: 10px;
  background: transparent; color: var(--text);
  font-weight: 650; font-size: 13px;
  transition: background .15s;
}
.tpl-menu-item:active, .tpl-menu-item:hover { background: var(--surface2); }
.tpl-menu-item.danger { color: var(--danger); }
.tpl-filters {
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 8px;
  margin-bottom: 4px;
}
.tpl-filters .tpl-unviewed {
  margin: 0; padding: 10px 12px; font-size: 12px; gap: 10px;
}
.tpl-filters .tpl-stage-btn { margin: 0; }
.tpl-filters .tpl-stage-btn:disabled { opacity: .45; pointer-events: none; }
.tpl-sort-row {
  display: grid; grid-template-columns: 1fr auto; gap: 8px;
  align-items: center; margin: 4px 0 8px;
  position: relative;
  z-index: 1;
}
.tpl-sort-pills { min-width: 0; }
.tpl-sort-pills .pill { padding: 8px 12px; font-size: 12px; }
.tpl-sort-dir {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; min-width: 56px; min-height: 52px; padding: 8px 10px;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(45,212,168,.16), var(--surface));
  border: 1px solid rgba(45,212,168,.35);
  color: var(--accent); font-weight: 700;
  transition: transform .18s var(--ease), background .25s, border-color .25s, box-shadow .28s;
}
.tpl-sort-dir .tpl-sort-dir-icon {
  font-size: 18px; line-height: 1;
  transition: transform .28s var(--ease);
}
.tpl-sort-dir.asc .tpl-sort-dir-icon { transform: rotate(180deg); }
.tpl-sort-dir .tpl-sort-dir-label { font-size: 10px; letter-spacing: .04em; text-transform: uppercase; opacity: .85; }
.tpl-sort-dir:active { transform: scale(.96); }
.tpl-sort-dir:disabled { opacity: .45; pointer-events: none; }
.tpl-sort-dir:not(:disabled):hover {
  box-shadow: 0 4px 14px rgba(45,212,168,.18);
  border-color: rgba(45,212,168,.55);
}
@media (max-width: 420px) {
  .tpl-filters { grid-template-columns: 1fr; }
  .tpl-sort-row { grid-template-columns: 1fr auto; }
  .sheet-foot-3 { flex-wrap: wrap; }
  .sheet-foot-3 > button { flex: 1 1 30%; }
  .sheet-head-actions .head-action { font-size: 11px; padding: 7px 8px; }
  .sheet-head-actions .share-btn { font-size: 11px; padding: 7px 8px; gap: 5px; }
  .sheet-head-actions .share-btn svg { width: 14px; height: 14px; }
}

.mf-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mf-row > * { min-width: 0; max-width: 100%; }

.main-filters {
  display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(45,212,168,.08), var(--surface));
  border: 1px solid var(--line);
  animation: fadeIn .35s var(--ease);
}
.mf-field { gap: 6px; }
.mf-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 700;
}
.mf-field input {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
  font: inherit; outline: none;
}
.mf-field input:focus { border-color: rgba(45,212,168,.45); }

label textarea {
  padding: 11px 12px; border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface); color: var(--text);
  font: inherit; resize: vertical; min-height: 72px;
}

.doc-pick-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.doc-pick-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  background: var(--surface2); border: 1px solid var(--line);
}
.doc-pick-item .name { font-size: 13px; font-weight: 600; flex: 1; min-width: 0; word-break: break-word; }
.doc-pick-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.doc-pick-item .doc-check {
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.doc-pick-item .dl {
  flex-shrink: 0; padding: 8px 12px; border-radius: 10px;
  background: var(--accent); color: #06261c; font-weight: 700; font-size: 12px;
}
.doc-check-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.doc-check-chip {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(45, 212, 168, 0.12);
  border: 1px solid rgba(45, 212, 168, 0.28);
  font-size: 12px;
  font-weight: 650;
}
.doc-check-highs li,
.doc-check-preview {
  line-height: 1.45;
}
.doc-check-preview {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface2);
  border: 1px solid var(--line);
  max-height: 160px;
  overflow: auto;
}

.dc-report { display: grid; gap: 14px; }
.dc-hero {
  border-radius: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.dc-hero.dc-risk-high {
  border-color: rgba(239, 68, 68, .35);
  background: rgba(239, 68, 68, .08);
}
.dc-hero.dc-risk-mid {
  border-color: rgba(245, 198, 66, .4);
  background: rgba(245, 198, 66, .1);
}
.dc-hero.dc-risk-low {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}
.dc-hero-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.dc-kicker {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.dc-hero-title {
  margin-top: 4px;
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}
.dc-hero-sum {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}
.dc-risk-pill {
  flex-shrink: 0;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  max-width: 42%;
  text-align: center;
}
.dc-count-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}
.dc-count-row b { color: var(--text); font-weight: 800; }
.dc-sec {
  border-radius: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.dc-sec-title {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}
.dc-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
}
.dc-fact {
  display: grid;
  gap: 2px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.dc-fact-k {
  font-size: 11px;
  font-weight: 650;
  color: var(--muted);
}
.dc-fact-v {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  word-break: break-word;
}
.dc-att-list { display: grid; gap: 8px; }
.dc-att {
  border-radius: 12px;
  padding: 12px 12px 10px;
  border: 1px solid var(--line);
  background: var(--bg);
}
.dc-att-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.dc-att-lvl {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
}
.dc-att-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}
.dc-att-detail {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
}
.dc-att-action {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}
.dc-att-action span {
  font-weight: 750;
  color: var(--accent-dim);
}
.dc-att-crit {
  border-color: rgba(239, 68, 68, .35);
  background: rgba(239, 68, 68, .08);
}
.dc-att-crit .dc-att-lvl {
  background: rgba(239, 68, 68, .16);
  color: #b91c1c;
}
.dc-att-warn {
  border-color: rgba(245, 198, 66, .4);
  background: rgba(245, 198, 66, .1);
}
.dc-att-warn .dc-att-lvl {
  background: rgba(245, 198, 66, .2);
  color: #a16207;
}
.dc-att-info .dc-att-lvl {
  background: var(--accent-soft);
  color: var(--accent-dim);
}
html[data-theme="dark"] .dc-att-crit .dc-att-lvl { color: #fca5a5; }
html[data-theme="dark"] .dc-att-warn .dc-att-lvl { color: #f5d76e; }
.dc-list, .dc-check-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
}
.dc-check-list { list-style: none; padding-left: 0; }
.dc-check-list li {
  position: relative;
  padding: 8px 10px 8px 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
}
.dc-check-list li::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 10px;
  width: 16px;
  height: 16px;
  border-radius: 5px;
  border: 1.5px solid var(--accent-border);
  background: var(--accent-soft);
}
.dc-highs { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.dc-highs li {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  display: grid;
  gap: 4px;
}
.dc-hi-lab {
  font-size: 11px;
  font-weight: 750;
  color: var(--accent-dim);
}
.dc-hi-txt {
  font-size: 12px;
  color: var(--text);
  line-height: 1.45;
}
.dc-foot-note { margin: 0; }
@media (max-width: 640px) {
  .dc-facts { grid-template-columns: 1fr; }
  .dc-risk-pill { max-width: 100%; }
  .dc-hero-top { flex-direction: column; }
}
.stage-card.locked, .pill.locked { opacity: .55; }
.stage-card.locked .stage-hint { color: #f5c542; }

.analysis-report {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow-x: hidden;
}
.analysis-report .card-title,
.analysis-report .card-sub,
.analysis-report li,
.analysis-report p {
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: normal;
}
.analysis-report .badge {
  /* не ломаем бейджи по буквам */
  overflow-wrap: normal;
  word-break: normal;
  white-space: nowrap;
  flex-shrink: 0;
}
.analysis-report ul {
  padding-left: 1.15em;
  margin: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.analysis-report .analysis-h {
  margin: 14px 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  font-weight: 750;
  overflow-wrap: break-word;
  word-break: normal;
}
.analysis-docs { display: flex; flex-direction: column; gap: 8px; max-width: 100%; }
.analysis-doc {
  padding: 10px 12px; border-radius: 12px;
  background: var(--surface2); border: 1px solid var(--line);
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow-wrap: break-word;
  word-break: normal;
}
.analysis-doc-top {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 8px;
  min-width: 0;
}
.analysis-doc-top .card-sub {
  flex: 1 1 auto;
  min-width: 0;
  text-align: right;
}
.analysis-doc .card-title {
  /* длинные имена файлов без пробелов */
  overflow-wrap: break-word;
  word-break: break-word;
}
.analysis-ai {
  padding: 10px 12px; border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface2));
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  margin-bottom: 4px;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow-wrap: break-word;
  word-break: normal;
}
.analysis-ai ul { margin: 6px 0 0; padding-left: 1.1em; max-width: 100%; }
.analysis-ai li {
  overflow-wrap: break-word;
  word-break: normal;
}

/* —— Full analysis progress —— */
.ax-overlay {
  position: fixed; inset: 0; z-index: 160;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(ellipse 80% 50% at 50% 20%, rgba(45,212,168,.14), transparent 55%),
    rgba(8,12,16,.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0; pointer-events: none;
  transition: opacity .35s var(--ease), background .25s ease;
}
.ax-overlay.open {
  opacity: 1; pointer-events: auto;
}
.ax-overlay.hidden {
  display: flex !important;
  opacity: 0 !important;
  visibility: hidden;
  pointer-events: none !important;
}
.ax-overlay.open:not(.hidden) {
  display: flex;
  visibility: visible;
}
.ax-overlay.ax-min {
  align-items: flex-end;
  justify-content: flex-end;
  padding: 16px;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  pointer-events: none;
}
.ax-overlay.ax-min .ax-panel {
  display: none;
}
.ax-overlay.ax-min .ax-dock {
  display: flex;
  pointer-events: auto;
}
.ax-panel {
  position: relative;
  width: min(360px, 100%);
  padding: 28px 22px 24px;
  border-radius: 20px;
  background:
    linear-gradient(165deg, rgba(36,48,64,.95), rgba(22,30,40,.98));
  border: 1px solid rgba(45,212,168,.22);
  box-shadow:
    0 0 0 1px rgba(255,255,255,.04) inset,
    0 24px 64px rgba(0,0,0,.45);
  text-align: center;
  transform: translateY(18px) scale(.96);
  transition: transform .45s var(--ease);
}
.ax-overlay.open .ax-panel { transform: translateY(0) scale(1); }
.ax-panel-top {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
}
.ax-min-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.ax-min-btn:hover {
  background: rgba(45,212,168,.16);
  border-color: rgba(45,212,168,.35);
}
.ax-min-hint {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}
.ax-dock {
  display: none;
  align-items: center;
  gap: 12px;
  min-width: 260px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(45,212,168,.28);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 16px 40px rgba(0,0,0,.35);
  text-align: left;
  cursor: pointer;
}
.ax-dock:hover {
  border-color: rgba(45,212,168,.5);
}
.ax-dock-spin {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(45,212,168,.22);
  border-top-color: var(--accent);
  animation: ax-spin .8s linear infinite;
}
.ax-overlay.ax-done .ax-dock-spin,
.ax-dock.is-done .ax-dock-spin {
  animation: none;
  border-color: rgba(45,212,168,.45);
  background: rgba(45,212,168,.18);
  position: relative;
}
.ax-dock.is-done .ax-dock-spin::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}
.ax-dock-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.ax-dock-title {
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ax-dock-sub {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ax-dock-pct {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 800;
  color: var(--accent);
}
html[data-theme="light"] .ax-panel {
  background: linear-gradient(165deg, #fff, #f3f6f9);
  border-color: rgba(11,138,104,.2);
  box-shadow: 0 18px 48px rgba(15,23,42,.12);
}
html[data-theme="light"] .ax-min-btn {
  background: rgba(15,23,42,.04);
  border-color: var(--line);
}
html[data-theme="light"] .ax-dock {
  box-shadow: 0 14px 36px rgba(15,23,42,.14);
}
.ax-orb {
  position: relative;
  width: 88px; height: 88px;
  margin: 0 auto 18px;
}
.ax-ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
}
.ax-ring-a {
  border-top-color: var(--accent);
  border-right-color: rgba(45,212,168,.35);
  animation: ax-spin 1.1s linear infinite;
}
.ax-ring-b {
  inset: 10px;
  border-bottom-color: #5b9cff;
  border-left-color: rgba(91,156,255,.3);
  animation: ax-spin 1.7s linear infinite reverse;
}
.ax-core {
  position: absolute; inset: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, rgba(45,212,168,.22), rgba(91,156,255,.12));
  color: var(--accent);
  animation: ax-pulse 1.8s var(--ease) infinite;
}
.ax-title {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 750;
  letter-spacing: .01em;
}
.ax-sub {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
  min-height: 1.35em;
}
.ax-bar {
  height: 4px;
  border-radius: 99px;
  background: var(--surface2);
  overflow: hidden;
  margin-bottom: 18px;
}
.ax-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent), #5b9cff);
  background-size: 200% 100%;
  animation: ax-shimmer 1.4s linear infinite;
  transition: width .55s var(--ease);
}
.ax-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ax-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  transition: color .3s, background .3s, border-color .3s, transform .3s var(--ease);
}
.ax-step .ax-dot {
  flex-shrink: 0;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--control-border);
  display: grid; place-items: center;
  font-size: 10px;
  transition: all .3s var(--ease);
}
.ax-step.active {
  color: var(--text);
  background: rgba(45,212,168,.08);
  border-color: rgba(45,212,168,.25);
  transform: translateX(2px);
}
.ax-step.active .ax-dot {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(45,212,168,.15);
  animation: ax-dot-pulse 1s ease infinite;
}
.ax-step.done {
  color: var(--text);
  opacity: .85;
}
.ax-step.done .ax-dot {
  border-color: var(--accent);
  background: var(--accent);
  color: #06261c;
  box-shadow: none;
  animation: none;
}
.ax-step.done .ax-dot::after { content: "✓"; font-weight: 800; }
.ax-overlay.ax-done .ax-ring { animation-play-state: paused; opacity: .35; }
.ax-overlay.ax-done .ax-core {
  animation: none;
  background: linear-gradient(145deg, rgba(45,212,168,.4), rgba(45,212,168,.15));
}

@keyframes ax-spin {
  to { transform: rotate(360deg); }
}
@keyframes ax-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
@keyframes ax-dot-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(45,212,168,.12); }
  50% { box-shadow: 0 0 0 6px rgba(45,212,168,.08); }
}
@keyframes ax-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .ax-ring-a, .ax-ring-b, .ax-core, .ax-bar-fill, .ax-step.active .ax-dot {
    animation: none !important;
  }
  .neon-btn { animation: none !important; }
  .ref-share-neon .ref-share-glow { animation: none !important; }
}

/* Excel export progress: reuse ax-* look; sit above analysis dock */
.xl-overlay {
  z-index: 165;
}
.xl-overlay.ax-min .ax-dock {
  margin-bottom: 64px;
}
body.desktop .xl-overlay.ax-min .ax-dock {
  margin-bottom: 72px;
}

.fav-workspace { display: flex; flex-direction: column; gap: 0; }
.fav-toolbar {
  position: sticky; top: 96px; z-index: 12;
  padding: 4px 0 10px;
  margin-bottom: 4px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.fav-toolbar-top {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 8px;
}
.fav-toolbar-actions { display: flex; gap: 6px; }
.fav-toolbar-actions .tool-btn { padding: 8px 12px; font-size: 12px; }
.fav-filter-row { margin-bottom: 8px; }
.fav-label-filters {
  display: flex; gap: 6px; overflow-x: auto; padding: 2px 0;
  -webkit-overflow-scrolling: touch;
}
.fav-label-filters::-webkit-scrollbar { height: 0; }
.fav-tag {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface); color: var(--muted);
  font-weight: 650; font-size: 12px;
  white-space: nowrap;
  transition: transform .18s var(--ease), border-color .25s var(--ease),
    background .25s var(--ease), color .22s, box-shadow .28s var(--ease), padding .22s;
}
.fav-tag::before {
  content: "";
  width: 0; height: 14px; opacity: 0; flex-shrink: 0;
  border-radius: 4px;
  background: linear-gradient(145deg, #4af0c4, var(--accent));
  transition: width .25s var(--ease), opacity .2s;
}
.fav-tag.active {
  color: #06261c;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(0,0,0,.22);
  padding-left: 10px;
}
.fav-tag.active::before {
  width: 14px; opacity: 1;
  animation: checkPop .4s var(--ease);
}
.fav-tag:active { transform: scale(.97); }
.fav-stage-row {
  display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center;
}
.fav-stage-btn { margin: 0; }

.label-chip {
  display: inline-flex; align-items: center; gap: 4px;
  max-width: 108px; height: 30px; min-height: 30px; padding: 0 9px; border-radius: 8px;
  font-size: 11px; font-weight: 700; color: #06261c;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border: 0; cursor: pointer;
  box-shadow: none;
  transition: transform .15s, border-color .2s, background .2s;
  flex-shrink: 0;
}
.label-chip.empty {
  background: var(--surface2);
  color: var(--muted);
  border: 1px solid var(--line);
  font-weight: 650;
}
.label-chip:active { transform: scale(.96); }

.label-pick-list, .label-manage-list {
  display: flex; flex-direction: column; gap: 8px;
}
.label-pick-item, .label-manage-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  padding: 12px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--text); font-weight: 650;
  transition: border-color .28s var(--ease), background .28s var(--ease), transform .18s var(--ease);
}
.label-pick-item:active, .label-manage-item:active { transform: scale(.98); }
.label-pick-item.active {
  border-color: rgba(45,212,168,.5);
  background: linear-gradient(135deg, rgba(45,212,168,.14), rgba(45,212,168,.05));
}
.label-pick-item::after {
  content: "";
  margin-left: auto;
  width: 22px; height: 22px; border-radius: 7px;
  border: 2px solid var(--control-border);
  background: rgba(0,0,0,.16);
  flex-shrink: 0;
  transition: background .25s var(--ease), border-color .25s, box-shadow .28s var(--ease);
}
.label-pick-item.active::after {
  background: linear-gradient(145deg, #4af0c4, var(--accent-dim));
  border-color: transparent;
  box-shadow: 0 3px 10px rgba(45,212,168,.35);
  animation: checkPop .4s var(--ease);
  background-image:
    linear-gradient(145deg, #4af0c4, var(--accent-dim)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath fill='none' stroke='%2306261c' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M1.5 5.2 4.6 8.2 10.5 1.8'/%3E%3C/svg%3E");
  background-size: cover, 12px 10px;
  background-position: center, center;
  background-repeat: no-repeat;
}
.label-dot {
  width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0;
}
.label-manage-item .del-label {
  margin-left: auto; color: var(--danger);
  background: transparent; font-weight: 700; font-size: 12px; padding: 6px 8px;
}
#newLabelColor {
  height: 42px; padding: 4px; cursor: pointer;
}

.cust-add-row {
  display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: stretch;
}
.cust-add-row input {
  width: 100%; padding: 11px 12px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; outline: none; min-width: 0;
}
.cust-add-row input:focus { border-color: rgba(45,212,168,.45); }
.cust-add-row .primary { padding: 11px 14px; white-space: nowrap; }
.sel-chips {
  display: flex; flex-wrap: wrap; gap: 6px; min-height: 0;
}
.sel-chip {
  display: inline-flex; align-items: center; gap: 6px;
  max-width: 100%; padding: 6px 8px 6px 10px; border-radius: 999px;
  background: rgba(45,212,168,.12); border: 1px solid rgba(45,212,168,.35);
  color: var(--accent); font-size: 12px; font-weight: 650;
}
.sel-chip .t {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px;
}
.sel-chip .x {
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0,0,0,.2); color: var(--text);
  display: grid; place-items: center; font-size: 14px; line-height: 1;
  flex-shrink: 0;
}
.multi-pick-list { display: flex; flex-direction: column; gap: 6px; }
.multi-pick-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  padding: 12px; border-radius: 14px;
  background: var(--surface); border: 1px solid transparent;
  color: var(--text); font-weight: 550;
  transition: border-color .28s var(--ease), background .28s var(--ease), transform .18s var(--ease);
}
.multi-pick-item.selected {
  border-color: rgba(45,212,168,.5);
  background: linear-gradient(135deg, rgba(45,212,168,.14), rgba(45,212,168,.05));
}
.multi-pick-item:active { transform: scale(.98); }
.multi-pick-item:hover:not(.selected) { border-color: rgba(45,212,168,.22); }
.multi-pick-item .name { flex: 1; min-width: 0; font-size: 13px; line-height: 1.3; }

.intel-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.intel-item {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.obj-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.obj-table th, .obj-table td {
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}
.obj-table th {
  color: var(--muted);
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.obj-table td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.obj-table .obj-name { font-weight: 650; line-height: 1.35; }
.obj-table .obj-okpd { color: var(--muted); font-size: 11px; margin-top: 2px; }
.obj-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 4px;
}
.obj-cell {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.obj-rub {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
}

/* ——— Detail page redesign (reference-inspired) ——— */
#detailBody {
  background: transparent;
}
.dpro {
  display: grid;
  gap: 14px;
  padding-bottom: 8px;
}
.dpro-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 16px 14px;
  box-shadow: 0 8px 24px rgba(12, 24, 20, .04);
}
.dpro-hero-top { margin-bottom: 12px; }
.dpro-enrich {
  margin: 0 0 12px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.35;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--text);
}
.dpro-enrich.is-warn {
  background: color-mix(in srgb, #f5c542 22%, transparent);
}
.empty-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 10px;
}
.dpro-reg-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.dpro-reg {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -.01em;
  color: var(--text);
}
.dpro-law {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
  color: var(--accent-dim);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
}
.dpro-title {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--text);
}
.dpro-title-ico {
  color: var(--accent);
  margin-top: 3px;
  flex-shrink: 0;
}
.dpro-note {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--accent-border);
  background: var(--accent-soft);
  color: var(--text);
  cursor: pointer;
  font: inherit;
}
.dpro-note-ico { color: var(--accent); margin-top: 2px; }
.dpro-note-body { display: grid; gap: 2px; min-width: 0; }
.dpro-note .note-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}
.dpro-note-text {
  font-size: 14px;
  font-weight: 600;
  word-break: break-word;
}
.dpro-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 28px;
}
.dpro-col { display: grid; gap: 0; }
.dpro-kv-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.dpro-col .dpro-kv-row:last-child { border-bottom: 0; }
.dpro-kv-ico {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--accent);
  background: var(--accent-soft);
}
.dpro-kv-text {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.dpro-kv-lab {
  font-size: 11px;
  font-weight: 650;
  color: var(--muted);
}
.dpro-kv-val {
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
  word-break: break-word;
  line-height: 1.35;
}
.dpro-kv-val strong {
  font-size: 15px;
  font-weight: 800;
}
.dpro-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.dpro-btn-ghost,
.dpro-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 750;
  font-size: 13px;
}
.dpro-btn-primary svg,
.dpro-btn-ghost svg { flex-shrink: 0; }
.dpro-sec-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}
.dpro-sec-ico {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  flex-shrink: 0;
}
.dpro-sec-titles { min-width: 0; }
.dpro-sec-title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
}
.dpro-sec-sub {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}
.dpro-empty {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}
.dpro-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
}
.dpro-restrict-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.dpro-restrict-head .dpro-sec-head { margin-bottom: 0; flex: 1; }
.dpro-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
  flex-shrink: 0;
}
.dpro-status-ok {
  color: var(--accent-dim);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
}
.dpro-status-warn {
  color: #a16207;
  background: rgba(245, 198, 66, .16);
  border: 1px solid rgba(245, 198, 66, .35);
}
html[data-theme="dark"] .dpro-status-warn {
  color: #f5d76e;
  background: rgba(245, 198, 66, .12);
}

.doc-pick-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.doc-pick-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.doc-type {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 850;
  flex-shrink: 0;
}
.doc-type-word { background: rgba(59,130,246,.14); color: #3b82f6; }
.doc-type-excel { background: rgba(34,197,94,.14); color: #16a34a; }
.doc-type-pdf { background: rgba(239,68,68,.14); color: #ef4444; }
.doc-type-zip { background: rgba(168,85,247,.14); color: #a855f7; }
.doc-type-file { background: var(--accent-soft); color: var(--accent-dim); }
.doc-pick-main {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}
.doc-pick-item .name {
  font-size: 13px;
  font-weight: 700;
  word-break: break-word;
  color: var(--text);
}
.doc-meta {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}
.doc-pick-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.doc-pick-item .doc-check {
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.doc-pick-item .dl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 8px 12px;
  border-radius: 10px;
  background: transparent;
  color: var(--accent-dim);
  border: 1px solid var(--accent-border);
  font-weight: 750;
  font-size: 12px;
}
.doc-pick-item .dl:hover {
  background: var(--accent-soft);
}
.docs-index-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.docs-index-hint svg { color: var(--accent); flex-shrink: 0; }

.sheet-foot-detail.dpro-foot {
  background: color-mix(in srgb, var(--accent-soft) 70%, var(--surface));
  border-top: 1px solid var(--accent-border);
  box-shadow: 0 -10px 28px rgba(12, 24, 20, .06);
  gap: 10px;
  padding: 12px 14px calc(12px + var(--safe-b));
}
.dpro-fav-btn {
  width: 48px;
  height: 48px;
  flex: 0 0 48px !important;
  border-radius: 14px !important;
  display: grid !important;
  place-items: center;
  padding: 0 !important;
  background: var(--surface) !important;
  border: 1px solid var(--line) !important;
  color: var(--text) !important;
}
.dpro-fav-btn.on {
  color: var(--accent-dim) !important;
  border-color: var(--accent-border) !important;
  background: var(--accent-soft) !important;
}
.dpro-fav-btn.on svg { fill: currentColor; }
.sheet-foot-detail > .dpro-analyze-btn.neon-btn {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  border-radius: 14px;
  animation: none;
  text-shadow: none;
  box-shadow: none;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent-dim);
  font-weight: 800;
  letter-spacing: 0;
}
.sheet-foot-detail > .dpro-analyze-btn.neon-btn:hover {
  filter: brightness(0.98);
}
.sheet-foot-detail > .dpro-analyze-btn.neon-btn.is-busy {
  animation: none;
  opacity: .9;
}
.dpro-analyze-label { white-space: nowrap; }

#detailOverlay .sheet-head-detail .accent-btn.head-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  box-shadow: none;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
}
#detailOverlay .sheet-head-detail .share-btn {
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
}
#detailOverlay .dpro-note-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  padding: 0;
}
#detailOverlay .dpro-note-btn.has-note {
  color: var(--accent-dim);
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

html[data-theme="light"] #detailOverlay .detail-sheet,
html[data-theme="light"] #detailBody {
  background: #f3f5f7;
}
html[data-theme="light"] .dpro-card {
  background: #fff;
  border-color: rgba(18, 26, 36, .08);
  box-shadow: 0 10px 28px rgba(18, 26, 36, .05);
}
html[data-theme="light"] .doc-pick-item {
  background: #fff;
  border-color: rgba(18, 26, 36, .1);
}
html[data-theme="light"] .sheet-foot-detail.dpro-foot {
  background: #eaf7f2;
}

@media (max-width: 720px) {
  .dpro-grid { grid-template-columns: 1fr; gap: 0; }
  .dpro-title { font-size: 17px; }
  .dpro-restrict-head {
    flex-direction: column;
    align-items: stretch;
  }
  .dpro-status { align-self: flex-start; }
  .doc-pick-item {
    flex-wrap: wrap;
  }
  .doc-pick-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .dpro-actions .dpro-btn-primary,
  .dpro-actions .dpro-btn-ghost {
    flex: 1 1 160px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sheet-foot-detail > .dpro-analyze-btn.neon-btn { animation: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .pill, .check, .check input, .region-item, .stage-card, .stage-check,
  .multi-pick-item, .fav-tag, .label-pick-item, .chip-btn,
  .pill::before, .pill::after, .check-dot {
    animation: none !important;
    transition-duration: .01ms !important;
  }
}

.apply-tender-card {
  background: linear-gradient(160deg, rgba(45,212,168,.1), var(--surface));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 14px 12px;
}
.apply-tender-card .reg {
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 6px;
}
.apply-tender-card .title { font-weight: 700; font-size: 15px; line-height: 1.35; margin-bottom: 8px; }
.apply-tender-card .meta { font-size: 13px; color: var(--muted); line-height: 1.45; }
.mf-label .req { color: #f07178; }
.mf-label .opt { color: var(--muted); font-weight: 500; text-transform: none; letter-spacing: 0; }
.file-drop {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 12px 14px; border-radius: 14px;
  border: 1px dashed rgba(255,255,255,.22); background: var(--surface);
  color: var(--text); font-weight: 650; font-size: 14px; cursor: pointer; text-align: center;
}
.file-drop input { display: none; }
.file-drop.has-file { border-color: rgba(45,212,168,.45); background: rgba(45,212,168,.08); }
.apply-fee-note {
  margin-top: 4px; padding: 12px 14px; border-radius: 14px;
  background: rgba(245,197,66,.1); border: 1px solid rgba(245,197,66,.28);
  font-size: 13px; line-height: 1.45; color: var(--text);
}
.apply-list-item {
  display: grid; gap: 6px; padding: 14px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line);
  text-align: left; color: inherit; width: 100%;
  cursor: pointer;
}
.apply-list-item:active { transform: scale(.99); }
.apply-list-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.apply-del-btn {
  border: 1px solid rgba(240,113,120,.35);
  background: rgba(240,113,120,.12);
  color: #f07178;
  border-radius: 10px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  flex-shrink: 0;
}
.apply-del-btn:active { transform: scale(.96); }
.apply-status {
  display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 99px;
  font-size: 11px; font-weight: 750; background: rgba(45,212,168,.15); color: var(--accent); width: fit-content;
}
.apply-status.warn { background: rgba(245,197,66,.15); color: #f5c542; }
.apply-status.done { background: rgba(91,156,255,.15); color: #5b9cff; }
.apply-status.won { background: rgba(45,212,168,.18); color: #2dd4a8; }
.apply-status.bad { background: rgba(240,113,120,.15); color: #f07178; }

.apply-funnel-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0 0 10px;
}
.apply-funnel-stats .afs-item {
  padding: 10px 8px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  text-align: center;
}
.apply-funnel-stats .n {
  display: block;
  font-size: 16px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}
.apply-funnel-stats .l {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.apply-funnel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}
.apply-status-hist {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.apply-hist-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 12px;
  line-height: 1.35;
}
.apply-hist-when {
  flex-shrink: 0;
  width: 118px;
  color: var(--muted);
  font-weight: 600;
}
.apply-hist-txt {
  flex: 1;
  min-width: 0;
  color: var(--text);
}
.apply-funnel-btn {
  flex: 1 1 auto;
  min-width: 42%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
}
.apply-funnel-btn.submitted { border-color: rgba(245,197,66,.35); color: #f5c542; }
.apply-funnel-btn.won { border-color: rgba(45,212,168,.4); color: #2dd4a8; }
.apply-funnel-btn.lost,
.apply-funnel-btn.cancelled { border-color: rgba(240,113,120,.35); color: #f07178; }
.apply-funnel-btn:active { transform: scale(.98); }
.apply-mode-tabs {
  display: flex;
  gap: 8px;
  margin: 0 0 12px;
}
.apply-mode-tab {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--muted);
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 700;
  font-size: 13px;
}
.apply-mode-tab.on {
  border-color: rgba(45,212,168,.45);
  color: var(--accent);
  background: rgba(45,212,168,.1);
}
.apply-chat { display: flex; flex-direction: column; gap: 8px; max-height: 280px; overflow: auto; padding: 8px 0; }
.apply-chat-full {
  flex: 1;
  max-height: none;
  min-height: 0;
  overflow: auto;
  padding: 4px 2px 12px;
}
.apply-chat-page {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.apply-chat-page-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}
.apply-chat-full-row {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  padding-top: 8px;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--bg) 92%, transparent) 28%);
}
.apply-bubble {
  max-width: min(82%, 420px);
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.4;
  white-space: pre-wrap;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
/* свои справа, входящие слева (телефон и ПК) */
.apply-bubble.mine {
  align-self: flex-end;
  background: rgba(45,212,168,.16);
  border: 1px solid rgba(45,212,168,.28);
  border-bottom-right-radius: 6px;
}
.apply-bubble.theirs {
  align-self: flex-start;
  background: rgba(91,156,255,.14);
  border: 1px solid rgba(91,156,255,.28);
  border-bottom-left-radius: 6px;
}
.apply-bubble.system {
  align-self: center;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  max-width: 100%;
}
.apply-bubble-meta {
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .01em;
  color: var(--muted);
  opacity: 1;
  margin-bottom: 2px;
}
/* fallback, если нет mine/theirs */
.apply-bubble.client:not(.mine):not(.theirs) {
  align-self: flex-end;
  background: rgba(45,212,168,.16);
  border: 1px solid rgba(45,212,168,.28);
}
.apply-bubble.admin:not(.mine):not(.theirs) {
  align-self: flex-start;
  background: rgba(91,156,255,.14);
  border: 1px solid rgba(91,156,255,.28);
}
.apply-chat.staff-view .apply-bubble.client:not(.mine):not(.theirs) {
  align-self: flex-start;
  background: rgba(91,156,255,.14);
  border-color: rgba(91,156,255,.28);
}
.apply-chat.staff-view .apply-bubble.admin:not(.mine):not(.theirs) {
  align-self: flex-end;
  background: rgba(45,212,168,.16);
  border-color: rgba(45,212,168,.28);
}
.chat-thread-list { display: grid; gap: 8px; }
.chat-thread-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 12px 12px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.chat-thread-item.unread {
  border-color: rgba(45,212,168,.35);
  background: linear-gradient(135deg, rgba(45,212,168,.08), var(--surface));
}
.chat-thread-item:active { transform: scale(.99); }
.chat-thread-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  flex-shrink: 0;
  font-weight: 800; font-size: 15px;
  background: rgba(45,212,168,.16);
  color: var(--accent);
  border: 1px solid rgba(45,212,168,.28);
}
.chat-thread-avatar-goc {
  background: linear-gradient(135deg, #3ee0b4, var(--accent));
  color: #06261c;
  border-color: transparent;
}
.chat-thread-main { flex: 1; min-width: 0; display: grid; gap: 3px; }
.chat-thread-top {
  display: flex; justify-content: space-between; gap: 8px; align-items: baseline;
}
.chat-thread-top strong { font-size: 14px; }
.chat-thread-time { font-size: 11px; color: var(--muted); flex-shrink: 0; }
.chat-thread-preview {
  font-size: 13px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-thread-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(45,212,168,.2);
  margin-top: 8px; flex-shrink: 0;
}
.apply-chat-row { display: flex; gap: 8px; margin-top: 8px; }
.apply-chat-row input { flex: 1; min-width: 0; }
.apply-attach-btn {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface2);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
}
.apply-attach-btn:active { transform: scale(.96); }
.apply-attach-name {
  margin: 4px 0 0;
  padding: 0 2px;
}
.apply-bubble .apply-file {
  display: block;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface2) 80%, transparent);
  border: 1px solid var(--line);
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
  word-break: break-word;
}
.apply-bubble .apply-file-thumb {
  display: block;
  margin-top: 8px;
  max-width: min(240px, 100%);
  border-radius: 10px;
  border: 1px solid var(--line);
}
.topup-hero { text-align: center; padding: 8px 4px 4px; }
.topup-hero .n { font-size: 28px; font-weight: 800; color: var(--accent); margin: 6px 0; }

/* Светлая тема: контраст кнопок / контуров / текста */
html[data-theme="light"] .sheet,
html[data-theme="light"] .card,
html[data-theme="light"] .auth-gate-card {
  box-shadow: var(--shadow);
}
html[data-theme="light"] .fav-toolbar,
html[data-theme="light"] .top {
  background: linear-gradient(180deg, var(--bg) 82%, transparent);
}
html[data-theme="light"] .plan-card {
  background: var(--surface);
  border-color: var(--line);
}
html[data-theme="light"] .plan-period-toggle {
  background: rgba(15, 23, 42, 0.04);
}
html[data-theme="light"] .plan-period-toggle .ppt-btn.active {
  background: rgba(13, 148, 136, 0.14);
  color: var(--text);
}
html[data-theme="light"] input,
html[data-theme="light"] textarea,
html[data-theme="light"] select {
  color-scheme: light;
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}
html[data-theme="light"] .pill {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}
html[data-theme="light"] .pill.active {
  color: var(--pill-active-text);
  background: linear-gradient(145deg, rgba(11,138,104,.16), rgba(11,138,104,.06));
  border-color: rgba(11,138,104,.5);
}
html[data-theme="light"] .tab,
html[data-theme="light"] .profile-tab {
  color: var(--text);
  background: var(--surface);
  border-color: var(--line);
  box-shadow: 0 1px 2px rgba(18, 26, 36, .06);
}
html[data-theme="light"] .tab.active,
html[data-theme="light"] .profile-tab.active {
  background: linear-gradient(145deg, rgba(11,138,104,.14), rgba(11,138,104,.06));
  color: var(--accent);
  border-color: rgba(11,138,104,.45);
  box-shadow: 0 2px 8px rgba(11,138,104,.12);
}
html[data-theme="light"] .profile-tabs {
  background: var(--surface2);
  border-color: var(--line);
}
html[data-theme="light"] .ghost,
html[data-theme="light"] .btn-action.ghost,
html[data-theme="light"] .tool-btn,
html[data-theme="light"] .qf-btn,
html[data-theme="light"] .picker-trigger,
html[data-theme="light"] .chip-btn,
html[data-theme="light"] .pay-method,
html[data-theme="light"] .profile-actions button,
html[data-theme="light"] .bal-preset,
html[data-theme="light"] .bal-way,
html[data-theme="light"] .theme-btn,
html[data-theme="light"] .applies-btn,
html[data-theme="light"] .apply-attach-btn,
html[data-theme="light"] .icon-btn {
  border: 1px solid var(--line);
  color: var(--text);
}
html[data-theme="light"] .chip-btn,
html[data-theme="light"] .chip {
  color: var(--muted);
}
html[data-theme="light"] .text-btn {
  color: var(--accent);
}
html[data-theme="light"] .check,
html[data-theme="light"] .stage-card,
html[data-theme="light"] .region-item,
html[data-theme="light"] .multi-pick-item {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}
html[data-theme="light"] .check input,
html[data-theme="light"] .check-dot,
html[data-theme="light"] .stage-check,
html[data-theme="light"] .region-item .check-dot,
html[data-theme="light"] .multi-pick-item .check-dot {
  border-color: var(--control-border);
  background: var(--control-bg);
}
html[data-theme="light"] .note-btn,
html[data-theme="light"] .pager button {
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--surface);
}
html[data-theme="light"] .fav-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: #9aa3ad;
}
html[data-theme="light"] .fav-btn.on {
  color: #c98900;
  background: rgba(245, 197, 66, 0.22);
  border-color: rgba(201, 137, 0, 0.35);
}
html[data-theme="light"] .label-chip.empty {
  background: var(--surface);
  color: #5b6670;
  border-color: var(--line);
}
html[data-theme="light"] .fav-status {
  background: var(--surface);
}
html[data-theme="light"] .an-tip,
html[data-theme="light"] .profile-actions > button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}
html[data-theme="light"] .light-badge.yellow { color: #9a6b00; background: rgba(245,197,66,.22); }
html[data-theme="light"] .bal-status.warn { color: #9a6b00; background: rgba(245,197,66,.22); }
html[data-theme="light"] .bal-hero,
html[data-theme="light"] .ref-compact {
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(11,138,104,.1), transparent 55%),
    var(--surface);
  border-color: rgba(11,138,104,.28);
  color: var(--text);
  box-shadow: var(--shadow);
}
html[data-theme="light"] .bal-ledger-row,
html[data-theme="light"] .ref-compact-stat {
  background: var(--surface2);
  border-color: var(--line);
  color: var(--text);
}
html[data-theme="light"] .ref-share-neon {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(11,138,104,.28);
}
html[data-theme="light"] .pay-method .pm-note { color: #9a6b00; }
html[data-theme="light"] .comp-score.yellow,
html[data-theme="light"] .an-risk.medium,
html[data-theme="light"] .an-risk.средний { color: #9a6b00; }
html[data-theme="light"] .tpl-chip-unit,
html[data-theme="light"] .tpl-menu,
html[data-theme="light"] .tpl-menu-float {
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
}
html[data-theme="light"] .tpl-chip-unit.active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  box-shadow: none;
}
html[data-theme="light"] .tpl-chip.active,
html[data-theme="light"] .tpl-chip-unit.active .tpl-chip {
  color: var(--accent-dim);
}
html[data-theme="light"] .tpl-chip-unit .tpl-more-btn {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}
html[data-theme="light"] .tpl-sort-dir {
  background: linear-gradient(145deg, rgba(11,138,104,.12), var(--surface));
  border-color: rgba(11,138,104,.35);
  color: var(--accent);
}
html[data-theme="light"] .sheet-head .text-btn,
html[data-theme="light"] #btnCloseSettings,
html[data-theme="light"] #btnCloseCheckout,
html[data-theme="light"] #btnCloseApplyChat {
  color: var(--accent);
}

.bc-header-btn {
  border-color: rgba(251,191,36,.35) !important;
  background: linear-gradient(145deg, rgba(251,191,36,.16), rgba(45,212,168,.1)) !important;
  box-shadow: 0 0 0 1px rgba(251,191,36,.08), 0 6px 18px rgba(251,191,36,.12);
}
.bc-header-btn:hover {
  border-color: rgba(251,191,36,.55) !important;
  box-shadow: 0 0 0 3px rgba(251,191,36,.15), 0 8px 22px rgba(45,212,168,.12);
}
.bc-header-btn-ico {
  display: inline-flex;
  color: #fbbf24;
}
.bc-sheet-head .card-sub { margin-top: 2px; }
.bc-sheet .sheet-body {
  padding-bottom: 8px;
}
.bc-card {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  margin-bottom: 12px;
}
.bc-card-templates {
  background:
    radial-gradient(circle at 8% 0%, rgba(45,212,168,.12), transparent 42%),
    var(--surface);
}
.bc-step {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.bc-opt {
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
}
.bc-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.bc-card-hint { margin: 0 0 10px; }
.bc-templates {
  display: grid;
  grid-template-columns: 1.35fr .9fr;
  gap: 8px;
}
@media (max-width: 420px) {
  .bc-templates { grid-template-columns: 1fr; }
}
.bc-tpl-btn {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  min-height: 56px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--accent-border);
  background: var(--accent-soft);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: transform .12s ease, border-color .15s, background .15s;
}
.bc-tpl-btn:active { transform: scale(.98); }
.bc-tpl-btn.on {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.bc-tpl-muted {
  border-color: var(--line);
  background: var(--bg);
}
.bc-tpl-ico {
  width: 34px; height: 34px;
  border-radius: 11px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.06);
  flex-shrink: 0;
  font-size: 16px;
}
.bc-tpl-txt {
  display: grid;
  gap: 1px;
  min-width: 0;
}
.bc-tpl-txt strong {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
}
.bc-tpl-txt small {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.25;
}
.bc-tool-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
  min-height: 32px;
}
.bc-tool-btn:active { transform: scale(.97); }
.bc-tool-btn.ghostish { opacity: .8; }
.bc-textarea {
  width: 100%;
  min-height: 128px;
  resize: vertical;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  line-height: 1.45;
}
.bc-textarea:focus {
  outline: none;
  border-color: rgba(45,212,168,.45);
  box-shadow: 0 0 0 3px rgba(45,212,168,.12);
}
.bc-file-drop {
  display: grid;
  place-items: center;
  gap: 4px;
  text-align: center;
  padding: 18px 14px !important;
  border-style: dashed !important;
  border-radius: 14px !important;
  cursor: pointer;
  color: var(--muted);
}
.bc-file-drop.has-file {
  border-color: rgba(45,212,168,.45) !important;
  background: rgba(45,212,168,.08) !important;
  color: var(--text);
}
.bc-file-ico {
  display: grid;
  place-items: center;
  color: var(--accent);
  margin-bottom: 2px;
}
.bc-file-title { font-weight: 750; font-size: 14px; color: var(--text); }
.bc-btn-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.bc-preset {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
  min-height: 34px;
}
.bc-preset:active { transform: scale(.97); }
.bc-buttons { display: grid; gap: 10px; }
.bc-btn-row {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg);
}
.bc-btn-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.bc-btn-preview-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 16px;
  border-radius: 10px;
  background: #2aabee;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bc-btn-fields {
  display: grid;
  gap: 8px;
}
.bc-btn-fields label {
  display: grid;
  gap: 4px;
}
.bc-btn-fields .bc-field-lab {
  font-size: 11px;
  font-weight: 750;
  color: var(--muted);
  letter-spacing: .02em;
  text-transform: uppercase;
}
.bc-btn-fields input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}
.bc-btn-fields input:focus {
  outline: none;
  border-color: rgba(45,212,168,.45);
  box-shadow: 0 0 0 3px rgba(45,212,168,.12);
}
.bc-btn-del {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  border: 1px solid rgba(248,113,113,.3);
  background: rgba(248,113,113,.1);
  color: #f87171;
  font-weight: 800;
  cursor: pointer;
}
.bc-empty {
  padding: 16px;
  border-radius: 12px;
  border: 1px dashed var(--line);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.bc-dest-list { display: grid; gap: 8px; margin-top: 4px; }
.bc-chip-group { display: grid; gap: 8px; }
.bc-chip-group-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 4px;
}
.bc-chip-row {
  display: grid;
  gap: 8px;
}
.bc-chip-empty { margin: 0; padding: 4px 0; }
.bc-dest-item {
  position: relative;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 12px;
  min-height: 56px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg);
  cursor: pointer;
  user-select: none;
  transition: border-color .15s, background .15s, transform .12s;
}
.bc-dest-item:active { transform: scale(.99); }
.bc-dest-item.on {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}
.bc-dest-item input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}
.bc-dest-check {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  transition: background .15s, border-color .15s;
}
.bc-dest-item.on .bc-dest-check {
  border-color: var(--accent);
  background: var(--accent);
  color: #06261c;
}
.bc-dest-item.on .bc-dest-check::after {
  content: "";
  width: 6px;
  height: 10px;
  border: solid #06261c;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translateY(-1px);
}
.bc-dest-ico {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .04em;
  flex-shrink: 0;
  border: 1px solid transparent;
}
.bc-dest-item.plat-tg .bc-dest-ico {
  background: rgba(56,189,248,.14);
  color: #7dd3fc;
  border-color: rgba(56,189,248,.28);
}
.bc-dest-item.plat-max .bc-dest-ico {
  background: rgba(167,139,250,.14);
  color: #c4b5fd;
  border-color: rgba(167,139,250,.28);
}
.bc-dest-item.plat-mail .bc-dest-ico {
  background: rgba(45,212,168,.14);
  color: #5eead4;
  border-color: rgba(45,212,168,.28);
  font-size: 10px;
  letter-spacing: .02em;
}
.bc-plat-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 8px;
}
.bc-plat-filter {
  border: 1px solid var(--stroke, rgba(255,255,255,.12));
  background: transparent;
  color: var(--text, #e8eef5);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.bc-plat-filter:active { transform: scale(.98); }
.bc-dest-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.bc-dest-title {
  font-size: 14px;
  font-weight: 750;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bc-dest-sub {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bc-dest-del {
  margin: 0;
  padding: 0;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 10px;
  background: rgba(248,113,113,.1);
  color: #f87171;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.bc-dest-del:hover { background: rgba(248,113,113,.2); }
.bc-dest-tools { display: flex; gap: 6px; }
.bc-add-dest {
  margin-top: 12px;
  border: 1px dashed rgba(45,212,168,.3);
  border-radius: 14px;
  padding: 0;
  background: rgba(45,212,168,.04);
  overflow: hidden;
}
.bc-add-dest summary {
  cursor: pointer;
  font-weight: 750;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  min-height: 48px;
}
.bc-add-dest summary::-webkit-details-marker { display: none; }
.bc-add-ico {
  width: 26px; height: 26px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: rgba(45,212,168,.16);
  color: var(--accent);
  font-weight: 800;
}
.bc-add-body { padding: 0 14px 14px; display: grid; gap: 10px; }
.bc-add-steps {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}
.bc-add-steps code {
  font-size: 11px;
  padding: 0 4px;
  border-radius: 4px;
  background: rgba(255,255,255,.06);
}
.bc-add-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
}
.bc-add-chat { grid-column: 1 / -1; }
@media (max-width: 420px) {
  .bc-add-grid { grid-template-columns: 1fr; }
  .bc-add-chat { grid-column: auto; }
}
.bc-add-note {
  margin: 0;
  line-height: 1.4;
}
.bc-add-note code {
  font-size: 11px;
  word-break: break-all;
}
.bc-status { white-space: pre-wrap; margin-top: 8px; }
.bc-sheet-foot {
  display: grid !important;
  gap: 8px;
  padding-top: 12px;
}
.bc-send-meta {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  font-weight: 650;
}
.bc-send-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px !important;
  font-weight: 800 !important;
  font-size: 15px !important;
  box-shadow: 0 10px 28px rgba(45,212,168,.25);
}
.bc-send-ico {
  display: inline-flex;
  align-items: center;
}
.bc-progress {
  margin-top: 4px;
  margin-bottom: 12px;
  padding: 14px 14px 12px;
  border-radius: 16px;
  background: linear-gradient(165deg, rgba(36,48,64,.9), rgba(22,30,40,.96));
  border: 1px solid rgba(45,212,168,.2);
}
.bc-progress.done { border-color: rgba(45,212,168,.35); }
.bc-progress.error { border-color: rgba(248,113,113,.4); }
.bc-progress-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 15px;
}
.bc-progress-spin {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(45,212,168,.25);
  border-top-color: var(--accent, #2dd4a8);
  animation: bc-spin .7s linear infinite;
  flex-shrink: 0;
}
.bc-progress.done .bc-progress-spin,
.bc-progress.error .bc-progress-spin {
  animation: none;
  border-color: transparent;
  background: var(--accent, #2dd4a8);
  box-shadow: inset 0 0 0 3px rgba(22,30,40,.96);
}
.bc-progress.error .bc-progress-spin { background: #f87171; }
@keyframes bc-spin { to { transform: rotate(360deg); } }
.bc-progress-bar {
  height: 8px;
  border-radius: 99px;
  background: rgba(255,255,255,.08);
  overflow: hidden;
}
.bc-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1aa884, #2dd4a8, #5eead4);
  background-size: 200% 100%;
  animation: bc-fill-shine 1.4s linear infinite;
  transition: width .25s ease;
}
.bc-progress.done .bc-progress-fill { animation: none; }
.bc-progress.error .bc-progress-fill {
  animation: none;
  background: #f87171;
}
@keyframes bc-fill-shine {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
.bc-progress-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
  text-align: center;
}
.bc-progress-n {
  display: block;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: #e8f5ef;
}
.bc-progress-l {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: rgba(200,220,210,.65);
}
#bcProgressNote { margin: 10px 0 0; }
html[data-theme="light"] .bc-progress {
  background: linear-gradient(165deg, #f4faf7, #e8f2ed);
  border-color: rgba(11,138,104,.22);
}
html[data-theme="light"] .bc-progress-n { color: #0b3d2e; }
html[data-theme="light"] .bc-progress-l { color: rgba(18,40,32,.55); }
html[data-theme="light"] .bc-btn-preview-pill { background: #229ed9; }
html[data-theme="light"] .bc-dest-item.plat-tg .bc-dest-ico {
  color: #0284c7;
  background: rgba(14,165,233,.12);
}
html[data-theme="light"] .bc-dest-item.plat-max .bc-dest-ico {
  color: #6d28d9;
  background: rgba(139,92,246,.12);
}
html[data-theme="light"] .bc-dest-item.plat-mail .bc-dest-ico {
  color: #0f766e;
  background: rgba(13,148,136,.12);
}

.mf-row-search {
  grid-template-columns: 1fr auto;
  align-items: end;
}
.mf-row-search .accent-btn {
  height: 44px;
  padding: 0 14px;
  white-space: nowrap;
}
.op-doc-upload {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}
.op-doc-upload select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: inherit;
}
.op-docs-list { display: grid; gap: 8px; margin-top: 12px; }
.op-doc-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.op-doc-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ===== Enterprise UX polish (search / header / templates / chat) ===== */
.top {
  padding: 10px 12px 6px;
  backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--line);
}
.brand { font-size: 1rem; font-weight: 750; letter-spacing: .01em; }
.brand-mark { border-radius: 8px; }
.header-actions { gap: 6px; }
.theme-btn,
.admin-users-btn,
.profile-btn {
  height: 36px;
  min-height: 36px;
  border-radius: 10px;
  box-shadow: none !important;
}
.theme-btn { width: 36px; }
.theme-btn:hover { box-shadow: 0 0 0 2px var(--accent-soft) !important; }
.theme-btn[data-mode="auto"] { box-shadow: none !important; border-color: var(--accent-border); }
.admin-users-btn {
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
  border-color: var(--line);
  background: var(--surface);
}
.bc-header-btn {
  border-color: var(--gold-border) !important;
  background: var(--gold-soft) !important;
  box-shadow: none !important;
}
.bc-header-btn-ico { color: var(--gold) !important; }
.profile-btn { width: 36px; }

.tabs {
  gap: 4px;
  padding: 8px 10px 10px;
  top: 48px;
  border-bottom: 1px solid var(--line);
}
.tab {
  padding: 9px 4px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 650;
  background: transparent;
  border: 1px solid transparent;
  box-shadow: none;
  color: var(--muted);
}
.tab.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-border);
  box-shadow: none;
  font-weight: 750;
}

.search-workspace.main-filters,
.main-filters.search-workspace {
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: none;
  animation: none;
}
.sw-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sw-title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.01em;
}
.sw-reset { font-size: 12px; padding: 0; }
.sw-reset.hidden { display: none !important; }

.sw-query-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--control-h);
  padding: 0 8px 0 12px;
  border-radius: 12px;
  border: 1px solid var(--control-border);
  background: var(--bg);
  transition: border-color .15s, box-shadow .15s;
}
.sw-query-box:focus-within {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.sw-query-box input {
  flex: 1;
  min-width: 0;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 12px 4px !important;
  outline: none;
}
.sw-query-ico { color: var(--muted); display: grid; place-items: center; flex-shrink: 0; }
.sw-query-adv {
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  display: grid; place-items: center;
}
.sw-query-adv:hover { color: var(--accent); background: var(--accent-soft); }

.mf-row-3 {
  grid-template-columns: 1fr 1fr;
}
@media (min-width: 720px) {
  .mf-row-3 { grid-template-columns: 1fr 1fr 1fr; }
}
.sw-params .qf-btn {
  min-height: var(--control-h);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--bg);
}
.sw-params .qf-btn.has-value {
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

.law-chips .pill {
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--muted);
  box-shadow: none;
}
.law-chips .pill::before,
.law-chips .pill::after { display: none !important; content: none !important; }
.law-chips .pill.active {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-soft);
  box-shadow: none;
}
.law-chips .pill.active::before {
  display: inline !important;
  content: "✓ ";
  font-weight: 800;
}

.sw-actions {
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.2fr);
  gap: 10px;
}
.btn-action {
  min-height: 48px;
  border-radius: 12px;
  position: relative;
}
.btn-action.ghost {
  background: var(--bg);
  border: 1px solid var(--line);
  font-weight: 700;
}
.btn-action.primary {
  background: var(--accent);
  background-image: none;
  color: var(--on-accent);
  box-shadow: 0 6px 16px rgba(32,217,176,.22);
  font-weight: 800;
}
.filter-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 2px;
}
.filter-badge.hidden { display: none !important; }

.search-tools {
  gap: 8px;
}
.tool-btn {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 56px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg);
  font-weight: 700;
}
.tool-btn > span { display: inline-flex; align-items: center; gap: 8px; }
.tool-btn-sub {
  font-size: 11px;
  font-weight: 550;
  color: var(--muted);
  padding-left: 26px;
}
.tool-btn.accent {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}
.tool-btn.accent span { color: var(--accent); }

.sw-recent {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.sw-recent[hidden] { display: none !important; }
.sw-recent-label {
  font-size: 11px;
  font-weight: 750;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-right: 2px;
}
.sw-recent-chip {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.sw-results-bar { margin: 4px 0 8px; }
.sw-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.sw-sort {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.sw-sort.hidden { display: none !important; }
.sw-sort select {
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 0 10px;
  font: inherit;
  font-size: 13px;
}
.list.loading { opacity: .55; pointer-events: none; }
.empty {
  text-align: center;
  padding: 28px 16px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
  background: var(--surface);
}

.chat-fab {
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(80px + var(--safe-b));
  padding: 10px 14px;
  border-radius: 999px;
  min-height: 44px;
  box-shadow: 0 8px 20px rgba(0,0,0,.28);
  background: var(--surface);
  border: 1px solid var(--accent-border);
  color: var(--text);
}
.chat-fab-label { font-size: 13px; font-weight: 750; }
.chat-fab-badge {
  min-width: 18px;
  height: 18px;
  font-size: 11px;
}
.chat-fab-ico { display: grid; place-items: center; color: var(--accent); }
.feedback-fab {
  display: none !important;
}

.tpl-chip-unit {
  border-radius: 999px;
  max-width: min(280px, 88vw);
  background: var(--surface);
}
.tpl-chip-unit.active {
  background: color-mix(in srgb, var(--bg) 65%, var(--accent-soft));
  border-color: var(--accent-border);
  box-shadow: none;
}
.tpl-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 220px;
  padding: 0 6px 0 14px;
  white-space: nowrap;
  text-align: left;
  line-height: 1.2;
}
.tpl-chip-name {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tpl-chip-mail { display: inline-flex; align-items: center; flex-shrink: 0; }
.tpl-chip-meta {
  display: none;
}
.tpl-mail-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--muted);
  margin-right: 4px;
  vertical-align: 1px;
}
.tpl-mail-dot.on { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* desktop overrides for search-workspace live in the final block at EOF */

html[data-theme="light"] .search-workspace.main-filters {
  background: var(--surface);
}
html[data-theme="light"] .law-chips .pill.active {
  color: var(--accent-dim);
}

.tab {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 52px;
}
.tab-ico { opacity: .75; }
.tab.active .tab-ico { opacity: 1; color: var(--accent); }
.tool-btn-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 750;
}
.tool-btn-sub { padding-left: 0 !important; }
.search-tools .tool-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}
.tpl-mail-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  margin-top: 8px;
}
.tpl-mail-compact.hidden { display: none !important; }
.tpl-mail-compact-title {
  font-size: 13px;
  font-weight: 700;
}
.tpl-mail-compact-meta {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}
.tpl-mail-setup {
  flex-shrink: 0;
  padding: 8px 12px !important;
  font-size: 12px !important;
  border-radius: 10px !important;
}
.tpl-freq-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 10px;
}
.tpl-freq-btn {
  flex: 1 1 calc(50% - 8px);
  min-height: 42px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface2);
  color: var(--text);
  font-weight: 750;
  font-size: 13px;
  line-height: 1.2;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
}
.tpl-freq-btn:nth-child(n+3) {
  flex: 1 1 calc(33.33% - 8px);
}
.tpl-freq-btn.active {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent);
}
.empty-title { font-weight: 800; color: var(--text); margin-bottom: 4px; }
.empty-msg { font-size: 13px; margin-bottom: 10px; }
.chat-fab-ico { display: grid; place-items: center; color: var(--accent); }
.admin-users-btn-label { white-space: nowrap; }
@media (max-width: 420px) {
  .admin-users-btn-label { display: none; }
}

.sw-laws-flash { outline: 2px solid var(--accent-border); outline-offset: 4px; border-radius: 12px; }


/* ===== Search results enterprise density ===== */
@media (max-width: 640px) {
  #searchList.results-view-cards,
  #favoritesList.results-view-cards,
  #tplLibrary.results-view-cards {
    grid-template-columns: 1fr !important;
  }
}

#searchList.results-view-list,
#searchList.results-view-table {
  display: flex !important;
  flex-direction: column;
  gap: 6px;
}

.search-sticky-bar {
  position: sticky;
  top: 96px;
  z-index: 18;
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 8px 0;
  margin: 0 0 8px;
  max-height: 56px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  -webkit-overflow-scrolling: touch;
  transition:
    opacity .28s var(--ease),
    transform .32s var(--ease),
    max-height .32s var(--ease),
    padding .32s var(--ease),
    margin .32s var(--ease),
    border-color .25s ease;
}
/* не display:none — иначе при листании дёргается layout */
.search-sticky-bar.hidden {
  display: flex !important;
  opacity: 0;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin: 0;
  border-bottom-color: transparent;
  transform: translateY(-6px);
  pointer-events: none;
  visibility: hidden;
  overflow: hidden;
}
.ssb-btn {
  appearance: none;
  flex: 0 0 auto;
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  cursor: pointer;
}
.ssb-btn:hover { border-color: var(--accent-border); }
.ssb-filter { position: relative; }

.sw-results-bar {
  position: sticky;
  top: 96px;
  z-index: 17;
  padding: 8px 0 10px;
  margin: 0 0 8px;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  transition: top .32s var(--ease);
}
body.has-sticky-search .sw-results-bar { top: 138px; }
.sw-chips-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}
.sw-chips-row .chips { flex: 1; min-width: 0; margin: 0; }
.chips-reset { flex-shrink: 0; font-size: 12px; padding: 4px 0; }
.chips-reset.hidden { display: none !important; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 220px;
}
.chip-x {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  opacity: .7;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
}
.chip-x:hover { opacity: 1; }

.results-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.results-meta {
  margin: 0;
  font-size: 13px;
  font-weight: 650;
  color: var(--muted);
  min-height: 0;
}
.results-meta strong { color: var(--text); font-weight: 750; }
.results-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.results-controls.hidden { display: none !important; }
.sw-sort { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.sw-sort .mf-label { margin: 0; font-size: 11px; }
.sw-sort select {
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 0 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
}
.view-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
}
.view-btn {
  width: 34px; height: 34px;
  border: 0;
  background: transparent;
  color: var(--muted);
  display: grid; place-items: center;
  cursor: pointer;
}
.view-btn + .view-btn { border-left: 1px solid var(--line); }
.view-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.card {
  gap: 6px;
  padding: 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 92%, #122033);
  animation: none;
}
.card:hover {
  border-color: var(--accent-border);
}
.card-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: default;
}
.card-customer {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}
.card-meta-line .dot { opacity: .45; }
.card-auction {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}
.card-foot {
  margin-top: 4px;
  gap: 10px;
}
.card-finance {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}
.card-guarantees {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 2px;
}
.card-g-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 11px;
  line-height: 1.35;
  color: var(--muted);
}
.card-g-row .g-lab {
  flex: 0 0 auto;
  min-width: 4.6em;
  opacity: .9;
}
.card-g-row .g-val {
  font-weight: 650;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.card-g-row .g-pct {
  margin-left: 4px;
  font-weight: 600;
  color: var(--accent);
  opacity: .95;
}
.price {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.01em;
}
.card-actions { display: inline-flex; gap: 6px; align-items: center; }
.btn-eis {
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
}
.btn-etp {
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  background: color-mix(in srgb, var(--accent) 12%, var(--bg));
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dpro-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-word;
}
.btn-open {
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  border: 0;
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-size: 13px;
  font-weight: 750;
}
.note-btn, .fav-btn, .card-more-btn {
  width: 30px; height: 30px; border-radius: 8px;
  font-size: 13px;
  flex-shrink: 0;
}
.note-btn { position: relative; }
.note-badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 14px; height: 14px;
  padding: 0 3px;
  border-radius: 99px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 10px;
  font-weight: 800;
  display: grid; place-items: center;
}
.fav-btn {
  font-size: 15px;
  line-height: 1;
}
.fav-btn.on {
  color: #e8a317;
  background: rgba(245, 197, 66, 0.18);
  animation: favPop .28s var(--ease);
}
@keyframes favPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
.card-top-actions {
  display: flex;
  gap: 5px;
  align-items: center;
  flex-shrink: 0;
  max-width: 58%;
  flex-wrap: nowrap;
}
.card-top-actions .fav-status,
.card-top-actions .label-chip {
  order: -1;
  max-width: 96px;
  height: 30px;
  min-height: 30px;
  border-radius: 8px;
}
.card-more-btn {
  border: 0;
  background: var(--surface2);
  color: var(--muted);
  display: grid; place-items: center;
  opacity: 1;
  pointer-events: auto;
  transition: opacity .15s, background .2s, color .2s;
}
.card:hover .card-more-btn,
.card-more-btn.is-open {
  opacity: 1;
  pointer-events: auto;
}
@media (hover: none) {
  .card-more-btn { opacity: 1; pointer-events: auto; }
}
.card-note { margin-top: 0; padding: 6px 8px; }
.badge { font-size: 11px; padding: 2px 7px; border-radius: 7px; }
.badge-way { max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.result-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1.4fr) minmax(0, 1fr) 72px 110px 88px auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
}
.result-row:hover { border-color: var(--accent-border); }
.result-row-title {
  font-weight: 700;
  font-size: 13px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.result-row-sub {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.result-row-price { font-weight: 750; font-size: 14px; white-space: nowrap; }
.result-row-actions { display: inline-flex; gap: 4px; justify-content: flex-end; }
@media (max-width: 980px) {
  .result-row {
    grid-template-columns: 1fr auto;
    gap: 6px 10px;
  }
  .result-row > *:nth-child(n+3):nth-child(-n+6) { display: none; }
}

.results-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.results-table th,
.results-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.results-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  font-weight: 750;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 1;
}
.results-table tr:hover td { background: var(--accent-soft); }
.results-table .t-title {
  font-weight: 700;
  max-width: 360px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.results-table .t-cust {
  color: var(--muted);
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.results-table .t-actions { white-space: nowrap; }

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  margin-top: 16px;
  margin-bottom: 4px;
}
.pager-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1 1 auto;
  min-width: 0;
}
.pager-meta {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  flex-wrap: wrap;
}
.pager-nav {
  flex: 0 0 auto !important;
  padding: 8px 12px !important;
  border-radius: 10px !important;
  font-size: 13px;
}
.pager-pages { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.pager-page {
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--control-bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
.pager-page.active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
}
.pager-page.ellipsis {
  border: 0;
  background: transparent;
  cursor: default;
  min-width: 20px;
}
.pager-size {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 650;
  margin: 0;
}
.pager-size-label { white-space: nowrap; }
.pager-size select {
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--control-bg);
  color: var(--text);
  padding: 0 8px;
  font: inherit;
}
.pager-info {
  font-size: 12px;
  color: var(--muted);
  font-weight: 650;
  white-space: nowrap;
}

.skel-card {
  height: 148px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface2) 37%, var(--surface) 63%);
  background-size: 400% 100%;
  animation: skel 1.1s ease-in-out infinite;
}
@keyframes skel {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  .skel-card { animation: none; }
  .fav-btn.on { animation: none; }
}


/* ===== Templates management center ===== */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.tpl-chips-block {
  margin-bottom: 12px;
}
.tpl-chips-block .section-label {
  margin-bottom: 8px;
}
.tpl-detail-head-inline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.tpl-detail-head-inline .tpl-detail-title {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 800;
}
.tpl-detail-head-inline .tpl-detail-sub {
  font-size: 13px;
  color: var(--muted);
}
.tpl-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}
.tpl-detail-actions .ghost,
.tpl-detail-actions .btn-eis,
.tpl-detail-actions .btn-open {
  height: 34px;
  padding: 0 12px;
  font-size: 12px;
}
.tpl-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.tpl-page-title {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.02em;
}
.tpl-page-sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.tpl-new-btn {
  flex-shrink: 0;
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
}

.tpl-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.tpl-toolbar-left,
.tpl-toolbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.tpl-folder-wrap select {
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 0 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  max-width: 200px;
}
.tpl-search-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
.tpl-search-box {
  flex: 1;
  min-height: 40px !important;
  padding: 0 10px !important;
}
.tpl-search-box input {
  padding: 10px 4px !important;
  font-size: 13px;
}

.tpl-library {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 900px) {
  .tpl-library.results-view-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.tpl-library.results-view-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tpl-mcard {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 92%, #122033);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: border-color .15s;
}
.tpl-mcard:hover { border-color: var(--accent-border); }
.tpl-mcard-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.tpl-mcard-name {
  margin: 0;
  font-size: 15px;
  font-weight: 750;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.tpl-mcard-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tpl-mcard-fav { color: #f5c542; font-size: 13px; }
.tpl-mcard-query {
  font-size: 13px;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tpl-mcard-query em { font-style: normal; color: var(--muted); }
.tpl-mcard-filters {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}
.tpl-mcard-stats {
  display: grid;
  gap: 2px;
  font-size: 12px;
  color: var(--muted);
}
.tpl-mcard-stats strong { color: var(--text); font-weight: 700; }
.tpl-mcard-mail {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
}
.tpl-mcard-mail-title {
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}
.tpl-mcard-mail-status {
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tpl-mcard-mail-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tpl-mcard-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.tpl-mcard-actions .btn-open,
.tpl-mcard-actions .btn-eis {
  height: 32px;
  font-size: 12px;
}

.tpl-list-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.tpl-list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tpl-list-table th,
.tpl-list-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
.tpl-list-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  background: var(--bg);
  font-weight: 750;
}
.tpl-list-table tr { cursor: pointer; }
.tpl-list-table tr:hover td { background: var(--accent-soft); }
.tpl-list-name { font-weight: 750; }
.tpl-list-actions { white-space: nowrap; }

.tpl-detail-view { display: flex; flex-direction: column; gap: 10px; }
.tpl-detail-view.hidden { display: none !important; }
.tpl-detail-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.tpl-detail-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.tpl-detail-title { margin: 0; font-size: 18px; font-weight: 800; }
.tpl-detail-sub { margin-top: 4px; font-size: 13px; color: var(--muted); }

#tplLibraryView.hidden { display: none !important; }

.tpl-mcard .tpl-more-btn {
  width: 30px; height: 30px;
  border-radius: 8px;
  border: 0;
  background: var(--surface2);
  color: var(--muted);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.tpl-scope-pills .pill { padding: 8px 12px; font-size: 12px; }

@media (max-width: 720px) {
  .tpl-page-head { flex-direction: column; align-items: stretch; }
  .tpl-toolbar-right .tpl-unviewed { order: 3; width: 100%; }
  .tpl-detail-head-inline { flex-direction: column; align-items: stretch; }
  .tpl-detail-actions { justify-content: stretch; }
  .tpl-detail-actions .ghost,
  .tpl-detail-actions .btn-eis,
  .tpl-detail-actions .btn-open { flex: 1; }
}


/* ===== Favorites workspace density ===== */
.fav-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.fav-page-title {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.02em;
}
.fav-page-sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.fav-page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}
.fav-page-actions .btn-eis,
.fav-page-actions .btn-open {
  height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

.fav-cats {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  margin-bottom: 8px;
  -webkit-overflow-scrolling: touch;
}
.fav-cats::-webkit-scrollbar { height: 0; }
.fav-tag {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}
.fav-tag .fav-tag-n {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--bg);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.fav-tag.active {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: none;
}
.fav-tag.active .fav-tag-n {
  background: var(--accent);
  color: var(--on-accent);
}
.fav-tag::before { display: none !important; content: none !important; }

.fav-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.fav-filter-bar .fav-stage-btn {
  min-height: 40px;
  padding: 6px 10px;
  border-radius: 10px;
  min-width: 140px;
}
.fav-mini-select {
  margin: 0;
}
.fav-mini-select select {
  height: 34px;
  min-width: 130px;
}

.fav-chips-row {
  margin-bottom: 6px;
}
.fav-chips-row:empty,
.fav-chips-row .chips:empty { display: none; }

.fav-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.fav-meta-row .meta { margin: 0; min-height: 0; }

#favoritesList.results-view-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: start;
}
@media (min-width: 860px) {
  body.desktop #favoritesList.results-view-cards,
  #favoritesList.results-view-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
#favoritesList.results-view-list {
  display: flex !important;
  flex-direction: column;
  gap: 6px;
}

.fav-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  min-height: 30px;
  padding: 0 9px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--line);
  background: var(--surface2);
  color: var(--text);
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 1;
  min-width: 0;
}
.fav-status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}

.fav-list-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.fav-list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.fav-list-table th,
.fav-list-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.fav-list-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  background: var(--bg);
  font-weight: 750;
  position: sticky;
  top: 0;
}
.fav-list-table tr { cursor: pointer; }
.fav-list-table tr:hover td { background: var(--accent-soft); }
.fav-list-title {
  font-weight: 700;
  max-width: 280px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.fav-list-actions { white-space: nowrap; }

.fav-workspace .card {
  padding: 10px 12px;
  gap: 5px;
}
.fav-workspace .card-title { font-size: 15px; -webkit-line-clamp: 2; }
.fav-workspace .price { font-size: 16px; }

@media (max-width: 720px) {
  .fav-page-head { flex-direction: column; align-items: stretch; }
  .fav-page-actions { justify-content: stretch; }
  .fav-page-actions .btn-eis,
  .fav-page-actions .btn-open { flex: 1; }
}

/* ===== FINAL desktop layout (must be last) ===== */
@media (min-width: 900px) {
  body.desktop #app {
    max-width: 1200px !important;
    width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 24px !important;
    padding-right: 24px !important;
    box-sizing: border-box;
  }
  body.desktop .tabs {
    max-width: none !important;
    width: 100% !important;
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 8px;
    padding-left: 0;
    padding-right: 0;
  }
  body.desktop .tab {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px;
    min-height: 44px;
  }
  body.desktop main,
  body.desktop .panel.active,
  body.desktop .tpl-workspace,
  body.desktop .fav-workspace,
  body.desktop .analytics,
  body.desktop .search-workspace {
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box;
  }
  body.desktop .panel {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  /* Kill legacy 2-col .main-filters grid on PC */
  body.desktop .main-filters,
  body.desktop .main-filters.search-workspace,
  body.desktop .search-workspace.main-filters,
  body.desktop #searchWorkspace {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    grid-template-columns: none !important;
    grid-template-rows: none !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 12px !important;
    width: 100% !important;
  }
  body.desktop .search-workspace > *,
  body.desktop #searchWorkspace > * {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    grid-column: auto !important;
    grid-row: auto !important;
  }
  body.desktop .search-workspace .sw-head {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
  }
  body.desktop .search-workspace .mf-row.mf-row-3.sw-params,
  body.desktop .search-workspace .sw-params {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }
  body.desktop .search-workspace .sw-actions.action-row,
  body.desktop .search-workspace .sw-actions {
    display: grid !important;
    grid-template-columns: 220px minmax(220px, 1fr) !important;
    gap: 10px !important;
    max-width: 560px !important;
    width: auto !important;
    margin-right: auto !important;
  }
  body.desktop .search-workspace .search-tools {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    max-width: 560px !important;
    width: auto !important;
    margin-right: auto !important;
  }
  body.desktop .search-workspace .sw-laws,
  body.desktop .search-workspace .law-chips {
    width: 100% !important;
  }

  body.desktop #searchList.results-view-cards,
  body.desktop #favoritesList.results-view-cards,
  body.desktop #tplLibrary.results-view-cards,
  body.desktop .tpl-library.results-view-cards {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    align-items: start;
  }
  body.desktop #searchList.results-view-list,
  body.desktop #searchList.results-view-table,
  body.desktop #favoritesList.results-view-list,
  body.desktop #tplLibrary.results-view-list,
  body.desktop .tpl-library.results-view-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
  }
  body.desktop #searchList:not(.results-view-cards):not(.results-view-list):not(.results-view-table),
  body.desktop #favoritesList:not(.results-view-cards):not(.results-view-list),
  body.desktop #tplLibrary:not(.results-view-cards):not(.results-view-list) {
    display: flex !important;
    flex-direction: column !important;
  }
  body.desktop .card {
    height: auto !important;
    align-self: stretch;
  }
  body.desktop .tpl-page-head,
  body.desktop .fav-page-head {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    width: 100%;
  }
  body.desktop .fav-filter-bar,
  body.desktop .tpl-toolbar {
    width: 100%;
  }
  body.desktop .search-sticky-bar { top: 104px !important; }
  body.desktop .sw-results-bar { top: 104px !important; }
  body.desktop.has-sticky-search .sw-results-bar { top: 152px !important; }
}
@media (min-width: 1280px) {
  body.desktop #searchList.results-view-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

/* ===== Analytics enterprise dashboard ===== */
.an-dash { display: flex; flex-direction: column; gap: 12px; padding-bottom: 8px; }
.an-page-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.an-page-title { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.an-page-sub { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.an-page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; justify-content: flex-end; }
.an-period { margin: 0; display: grid; gap: 4px; }
.an-period select {
  height: 34px; min-width: 120px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  padding: 0 10px; font: inherit; font-size: 13px;
}
.an-page-actions .btn-eis { height: 34px; padding: 0 12px; font-size: 12px; }

.an-attention-strip {
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  padding: 10px 12px; display: grid; gap: 8px;
}
.an-attention-strip.ok { border-color: var(--accent-border); background: var(--accent-soft); }
.an-attention-summary {
  display: inline-flex; align-items: center; gap: 8px; width: 100%;
  background: transparent; border: 0; color: var(--text); font: inherit; text-align: left; padding: 0;
  cursor: pointer;
}
.an-attention-summary.static { cursor: default; }
.an-attention-ico { color: #f5c542; }
.an-attention-strip.ok .an-attention-ico { color: var(--accent); }
.an-attention-chev { margin-left: auto; color: var(--muted); transition: transform .15s; }
.an-attention-summary.open .an-attention-chev { transform: rotate(180deg); }
.an-attention-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.an-att-chip {
  height: 28px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 650;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
.an-att-chip.an-att-danger { border-color: rgba(240,113,120,.45); color: #f07178; }
.an-att-chip.an-att-warn { border-color: rgba(245,197,66,.45); color: #f5c542; }
.an-att-chip.an-att-info { border-color: rgba(91,156,255,.45); color: #5B9CFF; }

.an-att-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px;
}
.an-att-card {
  text-align: left; padding: 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
.an-att-card.an-att-danger { border-color: rgba(240,113,120,.35); }
.an-att-card.an-att-warn { border-color: rgba(245,197,66,.35); }
.an-att-card.an-att-info { border-color: rgba(91,156,255,.35); }
.an-att-n { font-size: 24px; font-weight: 800; line-height: 1.1; }
.an-att-l { margin-top: 4px; font-size: 12px; color: var(--muted); font-weight: 650; }

.an-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.an-kpi {
  text-align: left; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  min-width: 0;
}
.an-kpi.warn .an-kpi-n { color: #f5c542; }
.an-kpi.gold .an-kpi-n { color: #f5c542; }
.an-kpi-l { font-size: 12px; color: var(--muted); font-weight: 650; }
.an-kpi-n { margin-top: 6px; font-size: 26px; font-weight: 800; color: var(--accent); letter-spacing: -.02em; }

.an-grid-2 {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 10px; align-items: start;
}
.an-panel {
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  padding: 12px 14px;
}
.an-panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px;
}
.an-panel-title { margin: 0; font-size: 15px; font-weight: 800; }

.an-funnel { display: flex; flex-direction: column; gap: 10px; }
.an-funnel-row {
  width: 100%; text-align: left; background: transparent; border: 0; color: var(--text); padding: 0; font: inherit;
}
.an-funnel-meta {
  display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; margin-bottom: 4px;
}
.an-funnel-name { font-size: 13px; font-weight: 700; }
.an-funnel-n { font-size: 14px; font-weight: 800; color: var(--accent); }
.an-funnel-conv { font-size: 12px; color: var(--muted); min-width: 36px; text-align: right; }
.an-funnel-conv.muted { opacity: .6; }
.an-funnel-bar {
  height: 10px; border-radius: 999px; background: color-mix(in srgb, var(--bg) 80%, #fff 6%);
  overflow: hidden;
}
.an-funnel-bar i { display: block; height: 100%; border-radius: 999px; }

.an-dl-buckets {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: 10px;
}
.an-dl-b {
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
  padding: 8px; display: grid; gap: 2px;
}
.an-dl-b span { font-size: 11px; color: var(--muted); font-weight: 650; }
.an-dl-b strong { font-size: 18px; font-weight: 800; }
.an-dl-b.danger strong { color: #f07178; }
.an-dl-b.warn strong { color: #f5c542; }
.an-dl-b.info strong { color: #5B9CFF; }

.an-deadline.an-dl-danger { border-color: rgba(240,113,120,.35); }
.an-deadline.an-dl-warn { border-color: rgba(245,197,66,.35); }
.an-deadline-days {
  background: var(--bg) !important; color: var(--text) !important;
  border: 1px solid var(--line); font-size: 11px;
}

.an-activity {
  display: flex; align-items: flex-end; gap: 4px; min-height: 140px;
  overflow-x: auto; padding-top: 8px;
}
.an-act-col {
  flex: 1 0 18px; min-width: 16px; max-width: 36px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.an-act-bar-wrap {
  width: 100%; height: 110px; display: flex; align-items: flex-end;
  background: transparent;
}
.an-act-bar {
  width: 100%; border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 40%, transparent));
  min-height: 2px;
}
.an-act-x { font-size: 9px; color: var(--muted); transform: rotate(-45deg); transform-origin: top left; height: 14px; white-space: nowrap; }

.an-tpl-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.an-tpl-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.an-tpl-table th, .an-tpl-table td {
  padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top;
}
.an-tpl-table th {
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  background: var(--bg); font-weight: 750;
}
.an-tpl-table tr { cursor: pointer; }
.an-tpl-table tr:hover td { background: var(--accent-soft); }
.an-tpl-name { font-weight: 700; max-width: 180px; }

.an-status-list, .an-law-list { display: grid; gap: 10px; }
.an-status-row, .an-law-row {
  width: 100%; text-align: left; background: transparent; border: 0; color: var(--text); padding: 0; font: inherit;
}
.an-status-top {
  display: flex; justify-content: space-between; gap: 8px; align-items: center;
  margin-bottom: 4px; font-size: 13px; font-weight: 650;
}
.an-status-top .an-pipe-dot { display: inline-block; margin-right: 6px; vertical-align: middle; }

.an-finance {
  margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line);
}
.an-finance-row {
  display: flex; justify-content: space-between; gap: 8px; align-items: baseline;
  font-size: 14px; margin-bottom: 4px;
}
.an-finance-row strong { color: #f5c542; font-size: 18px; font-weight: 800; }

.an-quick { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.an-quick .btn-eis { height: 34px; font-size: 12px; padding: 0 10px; }
.an-mini-stats {
  margin-top: 10px; display: grid; gap: 6px;
}
.an-mini-stats > div,
.an-mini-stat {
  display: flex; justify-content: space-between; gap: 8px; align-items: center;
  font-size: 12px; color: var(--muted); padding: 6px 0; border-top: 1px solid var(--line);
  width: 100%; background: transparent; text-align: left; cursor: pointer;
}
.an-mini-stats > div { cursor: default; }
.an-mini-stat:hover span,
.an-mini-stat:hover b { color: var(--text); }
.an-mini-stats b { color: var(--text); font-size: 13px; }
.an-back {
  margin: 0 0 12px;
  padding: 0;
}
.an-subview { padding-bottom: 8px; }

@media (max-width: 900px) {
  .an-kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .an-grid-2 { grid-template-columns: 1fr; }
  .an-att-grid { grid-template-columns: 1fr 1fr; }
  .an-dl-buckets { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .an-page-head { flex-direction: column; align-items: stretch; }
  .an-page-actions { justify-content: stretch; }
  .an-period { flex: 1; }
  .an-period select { width: 100%; }
  .an-att-grid { grid-template-columns: 1fr; }
  .an-quick { grid-template-columns: 1fr; }
  .an-kpi-n { font-size: 22px; }
}
@media (min-width: 900px) {
  body.desktop .an-kpi-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  body.desktop .an-grid-2 { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); }
}

/* —— Desktop tender detail as floating window —— */
.detail-win-controls { display: none; }
.detail-win-dock { display: none; }
.detail-win-resize { display: none; }

@media (min-width: 900px) {
  body.desktop .detail-win-controls {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 4px;
  }
  body.desktop .detail-win-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface2);
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
  }
  body.desktop .detail-win-btn:hover {
    background: var(--surface);
    border-color: rgba(45, 212, 168, 0.35);
  }
  body.desktop .detail-win-close:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.35);
    color: #dc2626;
  }
  body.desktop #detailOverlay {
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    background: rgba(8, 12, 18, 0.42);
  }
  body.desktop #detailOverlay .detail-sheet {
    position: absolute;
    left: 18px;
    top: 18px;
    right: 18px;
    bottom: 18px;
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    border-radius: 16px;
    border: 1px solid var(--line);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
    transform: none !important;
    transition: box-shadow .2s ease;
    overflow: hidden;
  }
  body.desktop #detailOverlay.open .detail-sheet {
    transform: none !important;
  }
  body.desktop #detailOverlay .detail-sheet .sheet-handle {
    display: none;
  }
  body.desktop #detailOverlay .detail-win-bar {
    cursor: default;
    user-select: none;
    gap: 10px;
  }
  body.desktop #detailOverlay.detail-win-normal .detail-win-bar {
    cursor: grab;
  }
  body.desktop #detailOverlay.detail-win-normal .detail-win-bar:active {
    cursor: grabbing;
  }
  body.desktop #detailOverlay.detail-win-normal .detail-sheet {
    left: 14%;
    top: 7%;
    right: auto;
    bottom: auto;
    width: min(820px, 72vw);
    height: min(860px, 86vh);
  }
  body.desktop #detailOverlay.detail-win-normal .detail-win-resize {
    display: block;
    position: absolute;
    right: 0;
    bottom: 0;
    width: 18px;
    height: 18px;
    cursor: nwse-resize;
    background:
      linear-gradient(135deg, transparent 50%, rgba(45, 212, 168, 0.55) 50%) no-repeat;
    background-size: 10px 10px;
    background-position: right 4px bottom 4px;
    z-index: 3;
  }
  body.desktop #detailOverlay.detail-win-min {
    background: transparent !important;
    pointer-events: none;
  }
  body.desktop #detailOverlay.detail-win-normal {
    background: transparent !important;
    pointer-events: none;
  }
  body.desktop #detailOverlay.detail-win-normal .detail-sheet {
    pointer-events: auto;
  }
  body.desktop #detailOverlay.detail-win-min .detail-sheet {
    display: none !important;
  }
  /* стек свёрнутых окон — вне overlay */
  .detail-win-dock-tray {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 170;
    display: none;
    flex-direction: column-reverse;
    align-items: flex-end;
    gap: 8px;
    max-width: min(420px, calc(100vw - 32px));
    pointer-events: none;
  }
  body.desktop .detail-win-dock-tray:not(.hidden) {
    display: flex;
    opacity: 1;
    transform: none;
    visibility: visible;
  }
  .detail-win-dock-tray.hidden {
    display: flex !important;
    opacity: 0;
    transform: translateY(10px) scale(.96);
    pointer-events: none;
    visibility: hidden;
  }
  .detail-win-dock-tray {
    transition: opacity .3s var(--ease), transform .34s var(--ease), visibility .3s;
  }
  .detail-win-dock-chip {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 260px;
    max-width: min(400px, calc(100vw - 32px));
    padding: 10px 10px 10px 12px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.28);
    text-align: left;
    cursor: pointer;
  }
  .detail-win-dock-chip:hover {
    border-color: rgba(45, 212, 168, 0.45);
  }
  .detail-win-dock-chip .detail-win-dock-ico {
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(45, 212, 168, 0.14);
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .detail-win-dock-chip .detail-win-dock-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
  }
  .detail-win-dock-chip .detail-win-dock-title {
    font-size: 13px;
    font-weight: 750;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .detail-win-dock-chip .detail-win-dock-sub {
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .detail-win-dock-chip .detail-win-dock-x {
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface2);
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .detail-win-dock-chip .detail-win-dock-x:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.35);
    color: #dc2626;
  }
  .detail-win-dock-more {
    pointer-events: auto;
    min-width: 160px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px dashed rgba(45, 212, 168, 0.4);
    background: var(--surface);
    color: var(--accent);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  }
  .detail-win-dock-more:hover {
    border-style: solid;
    background: rgba(45, 212, 168, 0.08);
  }
  html[data-theme="light"] body.desktop #detailOverlay {
    background: rgba(15, 23, 42, 0.28);
  }
  html[data-theme="light"] body.desktop #detailOverlay.detail-win-min,
  html[data-theme="light"] body.desktop #detailOverlay.detail-win-normal {
    background: transparent !important;
  }
  html[data-theme="light"] .detail-win-dock-chip {
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.14);
  }
  body.desktop .detail-win-close .detail-close-label { display: none; }
  body.desktop .detail-win-close .detail-close-x { display: inline; }
  body.desktop .detail-win-close.detail-win-btn {
    color: var(--text);
    font-size: 14px;
  }
}
@media (max-width: 899px) {
  .detail-win-dock-tray { display: none !important; }
  .detail-win-controls {
    display: contents;
  }
  .detail-win-btn:not(.detail-win-close) {
    display: none !important;
  }
  #btnCloseDetail.detail-win-close {
    width: auto;
    height: auto;
    border: 0;
    background: transparent;
    color: var(--accent);
    font-size: 14px;
    font-weight: 650;
    padding: 0;
  }
  #btnCloseDetail .detail-close-x { display: none; }
  #btnCloseDetail .detail-close-label { display: inline; }
}

/* —— Motion polish: page flip + soft UI —— */
#searchList,
#favoritesList,
#tplTendersList,
#tplViewList {
  transition: opacity .22s var(--ease), transform .28s var(--ease);
  will-change: opacity, transform;
}
#searchList.is-swapping,
#favoritesList.is-swapping,
#tplTendersList.is-swapping,
#tplViewList.is-swapping {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}
#searchList.loading {
  opacity: .72;
}
.pager {
  transition: opacity .25s var(--ease), transform .28s var(--ease);
}
.pager.hidden {
  display: none !important;
}
.filter-badge,
.chips-reset,
.results-controls,
.search-sort-wrap,
#searchSortWrap {
  transition: opacity .24s var(--ease), transform .28s var(--ease);
}
.feedback-menu {
  transition: opacity .28s var(--ease), transform .32s var(--ease), visibility .28s;
}
.overlay {
  transition: opacity .32s var(--ease);
}
.sheet {
  transition: transform .42s var(--ease);
}
.overlay.fullpage-overlay .sheet.fullpage {
  transition: opacity .3s var(--ease), transform .36s var(--ease);
}
.panel.active {
  animation: fadeIn .32s var(--ease);
}
@media (prefers-reduced-motion: reduce) {
  #searchList,
  #favoritesList,
  #tplTendersList,
  #tplViewList,
  .search-sticky-bar,
  .sw-results-bar,
  .scroll-top,
  .pager,
  .overlay,
  .sheet,
  .chat-fab,
  .feedback-fab,
  .feedback-menu,
  .ax-overlay {
    transition: none !important;
    animation: none !important;
  }
  #searchList.is-swapping,
  #favoritesList.is-swapping,
  #tplTendersList.is-swapping,
  #tplViewList.is-swapping {
    opacity: 1;
    transform: none;
  }
}


