:root {
  --bg: #eef2f8;
  --panel: #ffffff;
  --text: #1d2939;
  --muted: #7a8499;
  --line: #dce3ee;
  --primary: #315efb;
  --primary-weak: #edf2ff;
  --success: #16803a;
  --warning: #b86e00;
  --danger: #c0392b;
  --shadow: 0 18px 45px rgba(20, 32, 51, 0.08);
  --page-pad: 24px;
  --page-pad-sm: 16px;
  --page-pad-xs: 12px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #315efb 0%, #5b4fe8 100%);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  padding: 11px 14px;
  transition: filter 0.15s ease, box-shadow 0.15s ease;
}

button:not(.secondary):not(.link):not(.danger):not(.password-toggle):hover {
  box-shadow: 0 4px 16px rgba(49, 94, 251, 0.35);
}

button:hover {
  filter: brightness(0.96);
}

button.secondary,
button.link {
  background: var(--primary-weak);
  color: var(--primary);
}

button.danger {
  background: #ffe9e6;
  color: var(--danger);
}

button.link {
  padding: 8px 10px;
}

.shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}

body.sidebar-collapsed .shell {
  grid-template-columns: 64px minmax(0, 1fr);
}

body.auth-mode .shell {
  display: block;
}

body.auth-mode .sidebar {
  display: none;
}

body.auth-mode .topbar {
  display: none;
}

body.auth-mode .main {
  min-height: 100vh;
  padding: 0;
}

body.auth-mode #appContent,
#appContent.hidden {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

body.auth-mode #authGate,
body.auth-mode #emailGate,
body.auth-mode #inviteGate {
  position: relative;
  z-index: 30;
  pointer-events: auto;
}

body.auth-mode #authGate:not(.hidden),
body.auth-mode #inviteGate:not(.hidden) {
  display: flex;
}

body.auth-mode #emailGate:not(.hidden) {
  display: grid;
}

/* ── Auth gate: split layout ── */
.auth-gate {
  min-height: 100vh;
  width: 100%;
}

.auth-marketing {
  flex: 0 0 44%;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: #0f172a;
  color: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* decorative colour blobs */
.auth-marketing::before {
  content: '';
  position: absolute;
  top: -130px;
  right: -80px;
  width: 440px;
  height: 440px;
  background: radial-gradient(circle, rgba(49,94,251,0.38) 0%, transparent 65%);
  pointer-events: none;
  z-index: 0;
}

.auth-marketing::after {
  content: '';
  position: absolute;
  bottom: 40px;
  left: -110px;
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, rgba(139,92,246,0.28) 0%, transparent 65%);
  pointer-events: none;
  z-index: 0;
}

.auth-marketing .auth-marketing-inner {
  position: relative;
  z-index: 1;
}

/* third accent blob — teal, mid-right */
.auth-marketing .auth-brand::after {
  content: '';
  position: absolute;
  top: 38%;
  right: -60px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(20,184,166,0.2) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.auth-marketing-inner {
  display: flex;
  flex-direction: column;
  gap: 36px;
  padding: 48px 44px;
  flex: 1;
}

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

.auth-brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.auth-brand-name {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}

.auth-pitch {
  margin-top: 8px;
}

.auth-pitch-title {
  font-size: clamp(26px, 3.5vw, 38px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #ffffff 10%, #c7d9ff 55%, #b4a8ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0 0 14px;
}

.auth-pitch-sub {
  font-size: 15px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.62);
  margin: 0;
  max-width: 380px;
}

.auth-feature-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.af-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: rgba(49, 94, 251, 0.18);
  border: 1px solid rgba(49, 94, 251, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7fa8ff;
  flex-shrink: 0;
  margin-top: 1px;
}

/* Per-feature colours */
.auth-feature-list li:nth-child(1) .af-icon { background: rgba(99,139,255,0.18); border-color: rgba(99,139,255,0.3); color: #6b8fff; }
.auth-feature-list li:nth-child(2) .af-icon { background: rgba(16,185,129,0.18); border-color: rgba(16,185,129,0.35); color: #34d399; }
.auth-feature-list li:nth-child(3) .af-icon { background: rgba(245,158,11,0.18); border-color: rgba(245,158,11,0.35); color: #fbbf24; }
.auth-feature-list li:nth-child(4) .af-icon { background: rgba(139,92,246,0.18); border-color: rgba(139,92,246,0.35); color: #a78bfa; }
.auth-feature-list li:nth-child(5) .af-icon { background: rgba(20,184,166,0.18); border-color: rgba(20,184,166,0.35); color: #2dd4bf; }
.auth-feature-list li:nth-child(6) .af-icon { background: rgba(244,63,94,0.18); border-color: rgba(244,63,94,0.35); color: #fb7185; }

.auth-feature-list strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  margin-bottom: 2px;
}

.auth-feature-list span {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.48);
  line-height: 1.45;
}

.auth-marketing-footer {
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-marketing-footer p {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.38);
  line-height: 1.55;
  margin: 0;
}

.auth-terms-note {
  font-size: 11px !important;
  color: rgba(255, 255, 255, 0.25) !important;
}

/* ── Auth forms column ── */
.auth-forms-col {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #e6eeff 0%, #f0f4fa 40%, #ede9fd 100%);
  padding: 40px;
  min-height: 100vh;
  overflow-y: auto;
}

.auth-forms-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 18px;
  padding: 36px 32px;
  box-shadow: 0 4px 32px rgba(15, 23, 42, 0.10), 0 1px 0 rgba(49, 94, 251, 0.12);
  position: relative;
  overflow: hidden;
}

.auth-forms-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #315efb 0%, #8b5cf6 50%, #f43f5e 100%);
  border-radius: 18px 18px 0 0;
}

.auth-forms-header {
  margin-bottom: 28px;
}

.auth-forms-header h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--text);
  letter-spacing: -0.02em;
}

.auth-forms-header p {
  font-size: 14px;
  margin: 0;
}

.auth-links-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

.auth-forms-card .form label {
  font-size: 13px;
}

.auth-forms-card .muted.small {
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 16px;
  display: block;
}

.login-form-message {
  margin: 8px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.92rem;
  line-height: 1.4;
}

.login-form-message.hidden {
  display: none;
}

.login-form-message.danger {
  background: #fdecea;
  color: #b42318;
}

.login-form-message.warning {
  background: #fff8e6;
  color: #8a6116;
}

.login-form-message.success {
  background: #e8f7ee;
  color: #137333;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: #0f172a;
  color: #fff;
  padding: 0;
  border-right: 1px solid rgba(255,255,255,0.05);
}

.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.55);
  transition: background 0.15s ease, color 0.15s ease, transform 0.25s ease;
  flex-shrink: 0;
}

.sidebar-toggle:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

body.sidebar-collapsed .sidebar-toggle {
  transform: rotate(180deg);
  width: 32px;
}

body.sidebar-collapsed .brand span,
body.sidebar-collapsed .brand strong {
  display: none;
}

body.sidebar-collapsed .sidebar {
  align-items: stretch;
  overflow: visible;
}

body.sidebar-collapsed .brand {
  justify-content: center;
  padding: 18px 8px 14px;
}

body.sidebar-collapsed .nav {
  padding: 10px 6px;
}

body.sidebar-collapsed .nav button {
  justify-content: center;
  padding: 9px;
  gap: 0;
  width: 40px;
  height: 40px;
  margin: 0 auto;
  border-radius: 10px;
  overflow: visible;
}

body.sidebar-collapsed .nav button.active::before {
  display: none;
}

body.sidebar-collapsed .nav-label {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 14px;
  min-height: 72px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  overflow: hidden;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary);
  flex-shrink: 0;
}

.brand-mark img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.brand strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

.brand span {
  display: block;
  margin-top: 1px;
  font-size: 11px;
  color: rgba(255,255,255,0.38);
  white-space: nowrap;
}

.eyebrow,
.empty,
.muted {
  color: var(--muted);
}

.nav {
  flex: 1;
  padding: 10px 8px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  background: transparent;
  color: rgba(255,255,255,0.52);
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.12s ease, color 0.12s ease;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.nav button:hover {
  background: rgba(255,255,255,0.055);
  color: rgba(255,255,255,0.82);
}

.nav button.active {
  background: rgba(49,94,251,0.15);
  color: #fff;
}

.nav button.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 18%;
  bottom: 18%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--primary);
}

.nav-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  opacity: 0.75;
  transition: opacity 0.12s ease;
}

.nav button.active .nav-icon,
.nav button:hover .nav-icon {
  opacity: 1;
}

.nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.4);
  font-size: 12px;
  overflow: hidden;
}

body.sidebar-collapsed .sidebar-footer {
  justify-content: center;
  padding: 12px 8px;
}

body.sidebar-collapsed .sidebar-footer small,
body.sidebar-collapsed .sidebar-footer #apiStatus {
  display: none;
}

.main {
  position: relative;
  min-width: 0;
  padding: var(--page-pad);
  padding-bottom: max(var(--page-pad), env(safe-area-inset-bottom, 0px));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 12px 16px;
  margin-bottom: 22px;
}

.topbar-leading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  flex: 1 1 auto;
}

.topbar-leading > div {
  min-width: 0;
  flex: 1 1 auto;
}

.mobile-menu-btn {
  display: none;
  flex-shrink: 0;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: #344054;
  padding: 0;
}

.mobile-menu-icon {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 -7px 0 currentColor, 0 7px 0 currentColor;
}

.sidebar-backdrop {
  display: none;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: linear-gradient(90deg, var(--primary) 0%, #8b5cf6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(22px, 4.2vw, 32px);
  line-height: 1.15;
  word-break: break-word;
}

h2 {
  margin-bottom: 16px;
  font-size: 20px;
  font-weight: 600;
}

.account {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 10px;
  flex: 0 0 auto;
  max-width: min(100%, 420px);
}

.account-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  flex-shrink: 0;
}

.topbar-icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: #344054;
  flex-shrink: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.topbar-icon-btn svg {
  width: 22px;
  height: 22px;
}

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

.topbar-icon-btn.secondary {
  background: var(--primary-weak);
  color: var(--primary);
  border-color: transparent;
}

.topbar-icon-btn.danger {
  background: #ffe9e6;
  color: var(--danger);
  border-color: transparent;
}

.account-info {
  min-width: 0;
  max-width: 220px;
  flex: 0 1 auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 10px 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-grid,
.grid {
  display: grid;
  gap: 18px;
}

.auth-grid {
  grid-template-columns: 1.1fr 0.9fr;
}

.oauth-providers {
  margin-top: 20px;
}

.oauth-divider {
  text-align: center;
  margin: 0 0 14px;
  font-size: 13px;
}

.oauth-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.oauth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 18px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.oauth-btn:hover {
  border-color: #b0bbcc;
  box-shadow: 0 4px 12px rgba(20, 32, 51, 0.08);
  transform: translateY(-1px);
}

.oauth-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.oauth-btn.google {
  border-color: #dce3ee;
  color: #3c4043;
}

.oauth-btn.vk {
  border-color: #dce3ee;
  color: #0077ff;
}

.linked-accounts {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.linked-accounts h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.linked-hint {
  margin: 0 0 14px;
}

.linked-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.linked-row:last-child {
  border-bottom: none;
}

.telegram-link-wrap {
  margin-top: 12px;
}

.subscription-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #f0b429;
  border-radius: 999px;
  background: #fff9eb;
  color: #8a6100;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.subscription-badge:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(240, 180, 41, 0.18);
}

.subscription-badge .badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f0b429;
  flex-shrink: 0;
  animation: badge-pulse 1.8s ease-in-out infinite;
}

@keyframes badge-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.92); }
}

.subscription-pay-btn {
  margin-top: 12px;
}

.topbar-notify-wrap {
  position: relative;
}

.notification-bell {
  position: relative;
}

.notification-bell:hover,
.notification-bell[aria-expanded="true"] {
  border-color: #f0b429;
  box-shadow: 0 8px 20px rgba(240, 180, 41, 0.16);
}

.notification-dot {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 9px;
  height: 9px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #f04438;
}

.notification-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 30;
  width: min(320px, calc(100vw - 32px));
  border: 1px solid #f0b429;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(16, 24, 40, 0.16);
  padding: 16px 18px;
}

.notification-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.notification-count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #fff9eb;
  color: #8a6100;
  font-size: 12px;
  font-weight: 800;
}

.notification-meta {
  margin-top: 10px;
  font-size: 14px;
  font-weight: 700;
  color: #8a6100;
}

.notification-panel .muted {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
}

.trial-welcome {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: start center;
  padding-top: 88px;
  pointer-events: none;
  z-index: 2147483645;
}

#trialWelcomePopup:not(.hidden) {
  display: grid !important;
}

.trial-welcome-card {
  max-width: 360px;
  border: 1px solid #f0b429;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 40px rgba(16, 24, 40, 0.16);
  padding: 16px 18px;
  animation: trial-pop 0.25s ease-out;
}

.trial-welcome-card .eyebrow {
  margin: 0 0 6px;
}

.trial-welcome-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 18px;
}

.trial-welcome-card .muted {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
}

@keyframes trial-pop {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.form .link {
  margin-top: 8px;
  padding: 0;
  background: none;
  border: none;
  color: var(--accent);
  text-align: left;
  cursor: pointer;
}

.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 900px) {
  .investor-row.three {
    grid-template-columns: 1fr;
  }
}

.panel {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 20px;
}

.hero {
  display: flex;
  min-height: min(310px, 42vh);
  flex-direction: column;
  justify-content: center;
  background:
    radial-gradient(circle at top right, rgba(49, 94, 251, 0.2), transparent 34%),
    #fff;
}

.hero h2 {
  max-width: 620px;
  font-size: clamp(22px, 4.5vw, 34px);
  line-height: 1.2;
}

.hero p {
  max-width: 640px;
  color: var(--muted);
  font-size: clamp(15px, 2.2vw, 17px);
  line-height: 1.55;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.tabs button {
  flex: 1;
  background: var(--primary-weak);
  color: var(--primary);
}

.tabs button.active {
  background: var(--primary);
  color: #fff;
}

.form {
  display: grid;
  gap: 13px;
}

.create-account-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--primary-weak);
  border-radius: 10px;
  border: 1px solid #dde6ff;
}

.form label.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  cursor: pointer;
}

.form label.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
}

label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}

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

.password-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.password-toggle {
  height: 100%;
  padding: 0 12px;
  background: var(--primary-weak);
  color: var(--primary);
}

.file-picker {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 8px;
}

.file-picker input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-button {
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  padding: 10px 12px;
  font-weight: 900;
}

.file-name {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-source-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.file-source-row .file-source-btn {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  font-weight: 700;
}

label > .file-name {
  display: block;
  margin-top: 8px;
}

textarea {
  min-height: 86px;
  resize: vertical;
}

.page {
  display: none;
}

.page.active {
  display: grid;
  gap: 18px;
}

.contracts-workspace {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
  align-items: start;
}

.contracts-list-panel {
  display: grid;
  gap: 16px;
}

.contracts-list-panel .panel-head {
  margin: 0;
  gap: 12px;
}

.contracts-list-panel .panel-head h2 {
  margin-bottom: 0;
}

.contracts-list-panel > label {
  margin: 0;
}

.contracts-list-panel .filters {
  margin: 0;
}

.contracts-list-panel .list {
  margin-top: 2px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: clamp(260px, 52vh, 560px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-right: 4px;
}

/* Карточка договора в списке — компактно на всех экранах (полные данные в карточке справа). */
button.item.contract-list-item {
  display: block;
  flex: 0 0 auto;
  width: 100%;
  font-weight: 400;
  line-height: 1.35;
  height: auto;
  min-height: 0;
  overflow: visible;
  white-space: normal;
  text-align: left;
  appearance: none;
  -webkit-appearance: none;
  padding: 12px 14px;
}

.contract-list-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.contract-list-number {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.2;
}

.contract-list-body {
  display: grid;
  gap: 3px;
}

.contract-list-subtitle {
  font-size: 13px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contract-list-payment {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
}

.contract-list-meta {
  font-size: 12px;
  line-height: 1.35;
}

.contract-list-item strong {
  display: inline;
  margin-bottom: 0;
}

.contracts-list-panel .empty {
  padding: 22px 16px;
}

.contract-side-panel {
  position: sticky;
  top: max(12px, env(safe-area-inset-top, 0px));
  max-height: calc(100dvh - 36px);
  overflow: auto;
}

/* ── Payments split layout ─────────────────────────────────── */
.payments-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.payments-list-panel {
  display: grid;
  gap: 14px;
}

.payments-list-panel .panel-head {
  margin: 0;
}

.payments-list-panel .panel-head h2 {
  margin-bottom: 0;
}

.payments-list-panel > label {
  margin: 0;
}

.payments-list-panel .table-wrap {
  max-height: clamp(300px, 58vh, 680px);
  overflow-y: auto;
  overflow-x: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.payments-list-panel table {
  font-size: 13px;
}

.payments-list-panel th,
.payments-list-panel td {
  padding: 7px 10px;
}

.payments-detail-panel {
  position: sticky;
  top: max(12px, env(safe-area-inset-top, 0px));
  max-height: calc(100dvh - 36px);
  overflow: auto;
}

.section-gap {
  margin-top: 18px;
}

.filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fafc;
  padding: 12px;
}

.dashboard-metrics {
  margin-bottom: 16px;
}

.wizard-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.wizard-step-btn {
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  cursor: default;
  filter: none;
}

.wizard-step-btn.is-active {
  border-color: var(--primary);
  background: var(--primary-weak);
  color: var(--primary);
}

.wizard-step-btn.is-done {
  border-color: #c8d4f0;
  color: var(--text);
}

.contract-wizard-form .wizard-step-title {
  margin: 0 0 6px;
  font-size: 17px;
}

.contract-wizard-form .wizard-step-desc {
  margin: 0 0 14px;
}

.term-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.term-presets .preset-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}

.term-presets .preset-btn.is-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}

.terms-preview {
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}

.terms-preview.empty {
  color: var(--muted);
  background: var(--surface);
}

.terms-preview.is-error {
  border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
  background: color-mix(in srgb, var(--danger) 8%, var(--surface));
}

.terms-preview dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
  margin: 0;
}

.terms-preview dt {
  margin: 0;
  color: var(--muted);
  font-weight: 500;
}

.terms-preview dd {
  margin: 0;
  font-weight: 600;
}

.field-hint {
  display: block;
  font-size: 12px;
  margin-top: 4px;
}

.wizard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.contract-review-summary {
  display: grid;
  gap: 10px;
}

.contract-review-summary .review-block {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f8fafc;
}

.contract-review-summary .review-block h4 {
  margin: 0 0 8px;
  font-size: 13px;
}

.contract-review-summary p {
  margin: 4px 0;
  font-size: 13px;
}

.ops-panel {
  margin-bottom: 16px;
}

.ops-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.ops-tab {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  filter: none;
}

.ops-tab.active {
  border-color: var(--primary);
  background: var(--primary-weak);
  color: var(--primary);
}

.ops-item .linkish {
  margin-top: 8px;
  width: auto;
}

.excel-format-help {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f8fafc;
}

.excel-format-help ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.label-with-help {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.field-help {
  position: relative;
  display: inline-block;
}

.field-help > summary {
  list-style: none;
}

.field-help > summary::-webkit-details-marker {
  display: none;
}

.help-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--muted, #667085);
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.help-trigger:hover,
.field-help[open] > .help-trigger {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(37, 99, 235, 0.06);
}

.help-popover {
  position: absolute;
  z-index: 40;
  top: calc(100% + 8px);
  right: 0;
  width: min(340px, calc(100vw - 48px));
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.12);
  color: var(--text);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
}

.help-popover p {
  margin: 0 0 10px;
}

.help-popover p:last-child {
  margin-bottom: 0;
}

.help-popover strong {
  font-weight: 800;
  color: #344054;
}

.help-popover ol {
  margin: 0 0 10px;
  padding-left: 20px;
}

.help-popover li {
  margin-bottom: 6px;
}

.help-popover code {
  font-size: 12px;
}

html[data-theme="dark"] .help-trigger {
  background: var(--card, #1a1f2e);
}

html[data-theme="dark"] .help-popover {
  background: var(--card, #1a1f2e);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .help-popover strong {
  color: var(--text);
}

.reminder-channels {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px 6px;
  margin: 0;
}

.reminder-channels legend {
  font-size: 13px;
  font-weight: 800;
  color: #344054;
  padding: 0 6px;
}

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

.finance-panel.hidden {
  display: none;
}

.message-template {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.45;
  margin: 10px 0 0;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f8fafc;
  max-height: 280px;
  overflow: auto;
}

#dealAnalyticsTable table {
  font-size: 12px;
}

.page-progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 50;
  overflow: hidden;
  pointer-events: none;
  background: transparent;
}

.page-progress-bar {
  display: block;
  height: 100%;
  width: 35%;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  animation: page-progress-slide 1.1s ease-in-out infinite;
}

@keyframes page-progress-slide {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(320%);
  }
}

.global-loader {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 2147483644;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
  pointer-events: none;
  max-width: min(320px, calc(100vw - 32px));
}

.global-loader.hidden {
  display: none !important;
}

.loader-spinner {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: 2px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: loader-spin 0.75s linear infinite;
}

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

.loader-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.loader-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

button.is-loading,
.btn-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.85;
}

button.is-loading .btn-label,
.btn-loading .btn-label {
  visibility: hidden;
}

button.is-loading::after,
.btn-loading::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: loader-spin 0.75s linear infinite;
}

button.secondary.is-loading::after,
button.secondary.btn-loading::after {
  border-color: rgba(15, 23, 42, 0.15);
  border-top-color: var(--primary);
}

@media print {
  .sidebar,
  .topbar,
  .contracts-list-panel {
    display: none !important;
  }
}

.investor-stat-card .metric-change {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
}

.positive {
  color: var(--success);
}

.negative {
  color: var(--danger);
}

.neutral {
  color: var(--muted);
}

.dashboard-analytics {
  margin-top: 16px;
}

.compact-label {
  display: grid;
  gap: 6px;
  min-width: 190px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.comparison-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.comparison-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fafc;
  padding: 14px;
}

.comparison-card span,
.comparison-card small {
  display: block;
  font-size: 12px;
  font-weight: 800;
}

.comparison-card span {
  color: var(--muted);
}

.comparison-card strong {
  display: block;
  margin: 8px 0 6px;
  font-size: 20px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 18px;
  margin-top: 18px;
}

/* ───────── Конструктор дашборда ───────── */
.dashboard-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.dashboard-edit-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dashboard-edit-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.dashboard-palette {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px;
  border: 1px dashed var(--primary);
  border-radius: 14px;
  background: var(--primary-weak);
}

.dashboard-palette-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.palette-chip {
  background: #fff;
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.dash-widget {
  grid-column: span 2;
  min-width: 0;
  position: relative;
}

.dash-widget[data-width="1"] {
  grid-column: span 1;
}

.dashboard-grid.editing .dash-widget {
  outline: 2px dashed var(--line);
  outline-offset: 4px;
  border-radius: 22px;
  cursor: grab;
}

.dashboard-grid.editing .dash-widget.dragging {
  opacity: 0.5;
  outline-color: var(--primary);
}

.dash-widget-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  padding: 6px 10px;
  background: #0f172a;
  color: #fff;
  border-radius: 10px;
  font-size: 12.5px;
}

.dwb-handle {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: grab;
}

.dwb-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.dash-widget-bar button {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-radius: 7px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 600;
}

.dash-widget-bar button:hover {
  background: rgba(255, 255, 255, 0.26);
}

.dash-widget-bar .dwb-remove {
  background: rgba(244, 63, 94, 0.85);
}

.dashboard-analytics-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
}

/* Линейный график динамики */
.bar-chart.is-line {
  display: block;
}

.trend-line {
  width: 100%;
  height: auto;
  overflow: visible;
}

.trend-path {
  fill: none;
  stroke: #315efb;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trend-area {
  fill: rgba(49, 94, 251, 0.12);
  stroke: none;
}

.trend-dot {
  fill: #315efb;
  stroke: #fff;
  stroke-width: 1.5;
}

.trend-x {
  fill: var(--muted);
  font-size: 9px;
  font-weight: 700;
  text-anchor: middle;
}

.trend-max {
  fill: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.analytics-grid h3 {
  margin: 0 0 12px;
}

.bar-chart,
.breakdown {
  display: grid;
  gap: 12px;
}

.chart-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 110px;
  align-items: center;
  gap: 12px;
}

.chart-row > span,
.chart-row > b {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.chart-row > b {
  color: var(--text);
  text-align: right;
}

.chart-bars {
  display: grid;
  gap: 4px;
}

.chart-bars i,
.breakdown-track i {
  display: block;
  height: 8px;
  border-radius: 999px;
}

.chart-bars .cash,
.chart-legend .cash {
  background: #315efb;
}

.chart-bars .income,
.chart-legend .income,
.breakdown-track .installment {
  background: #16a34a;
}

.chart-bars .contracts,
.chart-legend .contracts {
  background: #f59e0b;
}

.breakdown-track {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: #e8eef7;
}

.breakdown-track .investor {
  background: #7c3aed;
}

.breakdown-track .penalty {
  background: #ef4444;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

.chart-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.panel-head-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.similar-clients-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0;
}

.similar-client-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  cursor: pointer;
}

.similar-client-option input {
  margin-top: 4px;
}

.prefer-data-fieldset {
  border: none;
  margin: 12px 0;
  padding: 0;
}

.global-client-actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.client-scope-hint {
  padding: 10px 12px;
  border-radius: 10px;
  background: #eef3ff;
  border: 1px solid #d6e0ff;
}

.panel-head > div {
  min-width: min(100%, 200px);
  flex: 1 1 auto;
}

.list,
.catalog {
  display: grid;
  gap: 10px;
}

.item {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--text);
  padding: 14px;
  text-align: left;
}

.item:hover {
  border-color: #b9c7ff;
}

.item strong {
  display: block;
  margin-bottom: 5px;
}

.item-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
}

.item-row .secondary {
  flex-shrink: 0;
  margin-left: auto;
}

@media (max-width: 600px) {
  .item-row .secondary {
    width: 100%;
    margin-left: 0;
  }
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 900;
}

.pill.neutral {
  background: #eef2f7;
  color: #475467;
}

.pill.success {
  background: #d1fae5;
  color: #065f46;
}

.pill.warning {
  background: #fef3c7;
  color: #92400e;
}

.pill.danger {
  background: #fee2e2;
  color: #991b1b;
}

.pill.info {
  background: #dbeafe;
  color: #1e40af;
}

.pill.purple {
  background: #ede9fe;
  color: #5b21b6;
}

.steps {
  margin: 0;
  padding-left: 21px;
  color: #344054;
  line-height: 1.8;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 16px;
  padding: 18px;
  text-align: center;
}

.passport-box {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fafc;
  padding: 14px;
}

.passport-box h3 {
  margin-bottom: 0;
  font-size: 16px;
}

.passport-tips {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 13px;
  line-height: 1.45;
}

.passport-tips li + li {
  margin-top: 4px;
}

.passport-ocr-note {
  margin: 0;
  font-size: 13px;
}

.suggestions {
  display: grid;
  gap: 8px;
}

.suggestion {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  text-align: left;
}

.suggestion.active {
  border-color: var(--primary);
  background: var(--primary-weak);
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  top: max(16px, env(safe-area-inset-top, 0px));
  left: 50%;
  right: auto;
  bottom: auto;
  transform: translateX(-50%);
  max-width: min(420px, calc(100vw - 32px));
  border-radius: 16px;
  background: #101828;
  color: #fff;
  box-shadow: var(--shadow);
  padding: 14px 16px;
  z-index: 2147483646;
  font-weight: 700;
  text-align: center;
}

.toast.neutral {
  color: #e8edf5;
}

.toast.success {
  color: #c6f6d5;
}

.toast.warning {
  color: #fde68a;
}

.toast.danger {
  color: #fecaca;
}

#toast:not(.hidden) {
  display: block !important;
}

.verify-email-dev-code {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid #f0b429;
  background: #fff9eb;
  color: #5c4300;
  font-size: 15px;
  line-height: 1.45;
}

.verify-email-dev-code strong {
  font-size: 20px;
  letter-spacing: 0.12em;
  font-weight: 900;
}

.verify-email-dev-code--hint {
  border-color: var(--line);
  background: #f8fafc;
  color: #475467;
  font-weight: 700;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(16, 24, 40, 0.55);
  padding: 20px;
  z-index: 50;
}

.modal-card {
  width: min(560px, 100%);
  max-height: min(90dvh, 900px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 20px;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 1280px) {
  .comparison-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

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

  .mobile-menu-btn {
    display: grid;
  }

  /* Шапка и кнопка меню остаются на экране при прокрутке */
  .topbar {
    position: sticky;
    top: 0;
    z-index: 180;
    margin-top: calc(-1 * var(--page-pad-sm));
    margin-left: calc(-1 * var(--page-pad-sm));
    margin-right: calc(-1 * var(--page-pad-sm));
    margin-bottom: 18px;
    padding: 10px var(--page-pad-sm);
    padding-top: max(10px, env(safe-area-inset-top, 0px));
    padding-left: max(var(--page-pad-sm), env(safe-area-inset-left, 0px));
    padding-right: max(var(--page-pad-sm), env(safe-area-inset-right, 0px));
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 4px 14px rgba(20, 32, 51, 0.06);
  }

  .mobile-menu-btn {
    position: relative;
    z-index: 1;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 200;
    border: 0;
    background: rgba(16, 24, 40, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  .sidebar-backdrop:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
  }

  body.mobile-nav-open {
    overflow: hidden;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 210;
    width: min(300px, 88vw);
    height: 100dvh;
    max-height: 100dvh;
    padding: 18px var(--page-pad-sm);
    padding-top: max(18px, env(safe-area-inset-top, 0px));
    padding-bottom: max(18px, env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  }

  body.mobile-nav-open .sidebar {
    transform: translateX(0);
    box-shadow: 12px 0 40px rgba(16, 24, 40, 0.35);
  }

  body.sidebar-collapsed .sidebar {
    width: min(300px, 88vw);
    align-items: stretch;
    overflow: hidden;
    padding: 0;
  }

  body.sidebar-collapsed .brand span,
  body.sidebar-collapsed .brand strong {
    display: block;
  }

  body.sidebar-collapsed .brand strong {
    display: block;
  }

  body.sidebar-collapsed .brand {
    padding: 18px 16px 14px;
    justify-content: flex-start;
  }

  body.sidebar-collapsed .nav {
    padding: 10px 8px;
  }

  body.sidebar-collapsed .nav button {
    display: flex;
    justify-content: flex-start;
    width: 100%;
    height: auto;
    margin: 0;
    padding: 8px 10px;
    gap: 10px;
    font-size: 14px;
    border-radius: 8px;
    overflow: hidden;
  }

  body.sidebar-collapsed .nav-label {
    display: block;
  }

  body.sidebar-collapsed .sidebar-footer small,
  body.sidebar-collapsed .sidebar-footer #apiStatus {
    display: flex;
  }

  body.sidebar-collapsed .sidebar-footer {
    justify-content: space-between;
    padding: 12px 14px;
  }

  .sidebar-toggle {
    display: none;
  }

  .nav {
    gap: 0;
  }

  .nav button {
    padding: 10px 12px;
    font-size: 14px;
  }

  .main {
    --page-pad: var(--page-pad-sm);
    width: 100%;
    min-width: 0;
  }

  .investor-stats-grid,
  .dashboard-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-grid,
  .contracts-workspace,
  .payments-workspace,
  .two {
    grid-template-columns: 1fr;
  }

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

  .dashboard-grid .dash-widget,
  .dashboard-grid .dash-widget[data-width="1"] {
    grid-column: span 1;
  }

  .auth-gate {
    flex-direction: column;
  }

  .auth-marketing {
    flex: none;
    position: static;
    height: auto;
  }

  .auth-marketing-inner {
    gap: 24px;
    padding: 32px 28px;
  }

  .auth-feature-list {
    display: none;
  }

  .auth-marketing-footer {
    display: none;
  }

  .auth-pitch-title {
    font-size: 26px;
  }

  .auth-forms-col {
    min-height: auto;
    padding: 28px 20px 40px;
  }

  .auth-forms-card {
    max-width: 100%;
    padding: 28px 24px;
  }

  .comparison-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .contract-side-panel,
  .payments-detail-panel {
    position: static;
    max-height: none;
  }

  .payments-list-panel .table-wrap {
    max-height: none;
    overflow-y: visible;
  }

  .contracts-list-panel .list {
    max-height: none;
    overflow-y: visible;
  }
}

@media (max-width: 900px) {
  .sidebar-footer {
    font-size: 12px;
  }

  .sidebar-footer small {
    line-height: 1.35;
  }

  .compact-label {
    min-width: 0;
    width: 100%;
  }

  .panel-head .compact-label {
    width: auto;
    flex: 1 1 140px;
  }

  .oauth-buttons {
    flex-direction: column;
    align-items: stretch;
  }

  .oauth-btn {
    width: 100%;
    min-width: 0;
  }

  .notification-panel {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: none;
    z-index: 100002;
    border-radius: 22px 22px 0 0;
    padding-bottom: max(18px, env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -12px 40px rgba(16, 24, 40, 0.18);
  }
}

@media (max-width: 680px) {
  .main {
    padding: var(--page-pad-sm);
    padding-left: max(var(--page-pad-sm), env(safe-area-inset-left, 0px));
    padding-right: max(var(--page-pad-sm), env(safe-area-inset-right, 0px));
  }

  .panel {
    padding: 16px;
    border-radius: 18px;
  }

  .topbar {
    gap: 10px;
  }

  .topbar-leading > div h1 {
    font-size: clamp(18px, 5vw, 24px);
  }

  .account {
    max-width: none;
  }

  .account-info {
    display: none;
  }

  .account-toolbar {
    gap: 6px;
  }

  .topbar-icon-btn {
    width: 40px;
    height: 40px;
    min-height: 40px;
    border-radius: 12px;
  }

  .topbar-icon-btn svg {
    width: 20px;
    height: 20px;
  }

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

  .panel-head {
    flex-direction: column;
    align-items: stretch;
  }

  .contracts-list-panel {
    gap: 14px;
    padding: 18px;
  }

  .contracts-list-panel .list {
    max-height: none;
    overflow-y: visible;
    gap: 10px;
  }

  .contract-list-payment {
    font-size: 14px;
  }

  button.item.contract-list-item {
    padding: 11px 12px;
  }

  .contracts-list-panel .panel-head .secondary {
    width: 100%;
  }

  .chart-row {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .comparison-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-row > b {
    text-align: left;
  }

  .trial-welcome {
    padding-top: max(72px, env(safe-area-inset-top, 0px));
    padding-left: 12px;
    padding-right: 12px;
  }

  .trial-welcome-card {
    max-width: 100%;
  }

  .hero {
    min-height: 0;
    padding-bottom: 8px;
  }

  .tabs {
    flex-direction: column;
  }

  .tabs button {
    width: 100%;
  }

  table {
    font-size: 13px;
  }

  th,
  td {
    padding: 10px 8px;
  }
}

@media (max-width: 480px) {
  :root {
    --page-pad-sm: var(--page-pad-xs);
  }

  h2 {
    font-size: 18px;
  }

  h3 {
    font-size: 16px;
  }

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

  .comparison-card strong {
    font-size: 18px;
  }

  .modal {
    padding: 12px;
    align-items: flex-end;
  }

  .modal-card {
    width: 100%;
    max-height: 92dvh;
    border-radius: 18px 18px 0 0;
    padding: 16px;
  }

  button {
    padding: 12px 14px;
    min-height: 44px;
  }

  button.link {
    min-height: 0;
  }
}

.client-picker {
  margin-bottom: 4px;
}

.client-picker-row {
  align-items: stretch;
  gap: 10px;
}

.client-picker-row input {
  flex: 1 1 auto;
  min-width: 0;
}

.client-picker-row button.secondary {
  flex: 0 0 auto;
  white-space: nowrap;
}

.investor-allocations {
  margin: 12px 0 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2, rgba(255, 255, 255, 0.03));
}

.investor-allocations .panel-head {
  margin-bottom: 8px;
}

.investor-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.investor-row .item-row {
  gap: 8px;
}

.investor-row .item-row input {
  flex: 1;
}

.investor-row button.secondary {
  min-width: 44px;
  padding-inline: 12px;
}

.investor-amount-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.investor-amount-actions .preset-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}

.investor-amount-actions .preset-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.investor-overview-panel {
  margin-bottom: 16px;
}

.forecast-period-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
}

.forecast-period-label select {
  min-width: 140px;
}

.investor-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

.investor-stat-card,
button.investor-stat-card {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: none;
  text-align: left;
}

button.investor-stat-card {
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-weight: inherit;
  filter: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

button.investor-stat-card:hover {
  border-color: #b9c7ff;
  background: var(--primary-weak);
  color: var(--text);
  filter: none;
}

.investor-stat-card span,
button.investor-stat-card span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
  font-weight: 700;
}

.investor-stat-card strong,
button.investor-stat-card strong,
.investor-stat-card b,
button.investor-stat-card b {
  display: block;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.25;
}

.investor-stats-detail {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.investor-stats-detail h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.investor-contracts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.investor-contracts-table th,
.investor-contracts-table td {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.investor-funds-summary {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--primary-weak);
}

.investor-funds-summary p {
  margin: 0;
}

.investor-payout-form {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.investor-payout-form h3,
.investor-edit-form h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.investor-payout-history {
  margin-bottom: 16px;
  max-height: 180px;
  overflow: auto;
}

.investor-payout-history .item {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.investor-detail-list {
  margin: 8px 0 0;
  padding-left: 18px;
}

.empty-inline {
  margin: 8px 0 0;
}

.modal-card-wide {
  max-width: 960px;
  width: min(95vw, 960px);
}

.client-card-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
  margin-bottom: 16px;
}

.star-rating {
  color: #e6a700;
  letter-spacing: 1px;
}

.star-rating-field {
  display: block;
  margin-bottom: 12px;
}

.star-rating-field-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.star-rating-stars {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 6px;
  align-items: center;
}

.star-btn {
  border: 0;
  background: none;
  font-size: 1.85rem;
  line-height: 1;
  padding: 2px 3px;
  cursor: pointer;
  color: #e6a700;
}

.star-btn:hover,
.star-btn.active {
  color: #c99200;
  transform: scale(1.06);
}

.star-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.star-clear-btn.linkish {
  display: inline-block;
  margin-top: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
}

.star-clear-btn.linkish:hover {
  color: var(--text);
}

.client-wall .item {
  border-left: 3px solid var(--primary);
  padding-left: 12px;
}

.phones-wrap {
  display: grid;
  gap: 8px;
  margin: 8px 0;
}

.item.warning {
  border: 1px solid #f0c36d;
  background: #fff8e6;
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 12px;
}

body.buyer-mode .shell {
  display: block;
}

body.buyer-mode .sidebar,
body.buyer-mode .sidebar-backdrop,
body.buyer-mode #pageProgress {
  display: none !important;
}

body.buyer-mode .topbar .account-toolbar > :not(#logoutBtn):not(#refreshBtn) {
  display: none;
}

body.buyer-mode .topbar-leading .eyebrow {
  display: block;
}

body.buyer-mode .main {
  min-height: 100vh;
  max-width: none;
  margin: 0;
}

body.buyer-mode #page-clientPortal.page.active {
  display: block;
}

.buyer-portal-wrap {
  max-width: 720px;
  margin: 0 auto;
}

.buyer-portal-summary {
  margin-bottom: 20px;
}

.buyer-portal-alerts {
  margin-bottom: 16px;
}

.buyer-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.buyer-stat-grid--summary {
  margin-bottom: 0;
}

.buyer-stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  min-width: 0;
}

.buyer-stat--emphasis strong {
  color: #2563eb;
}

.buyer-stat--danger {
  border-color: #fecaca;
  background: #fff5f5;
}

.buyer-stat--danger strong {
  color: #b42318;
}

.buyer-stat-label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.buyer-stat strong {
  display: block;
  font-size: 1rem;
  line-height: 1.35;
  word-break: break-word;
}

.buyer-alert {
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
}

.buyer-alert--danger {
  background: #fef3f2;
  border: 1px solid #fecdca;
}

.buyer-alert--compact {
  padding: 10px 12px;
  margin-bottom: 12px;
}

.buyer-alert p {
  margin: 6px 0 0;
}

.buyer-overdue-list {
  margin: 10px 0 0;
  padding-left: 18px;
}

.buyer-overdue-list li {
  margin: 4px 0;
}

.buyer-progress {
  height: 8px;
  background: #eef2f6;
  border-radius: 999px;
  overflow: hidden;
  margin: 10px 0 6px;
}

.buyer-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  border-radius: 999px;
}

.buyer-progress-caption {
  margin: 0 0 12px;
  font-size: 13px;
}

.buyer-contract-card--overdue {
  border-color: #fecdca;
  box-shadow: 0 0 0 1px rgba(240, 68, 56, 0.08);
}

.buyer-next-payment--overdue {
  border-left: 3px solid #f04438;
  padding-left: 12px;
  margin-bottom: 12px;
}

.buyer-next-payment-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 4px;
}

.buyer-next-payment-due {
  margin: 6px 0 10px;
}

.buyer-schedule-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.buyer-schedule-table-wrap table {
  min-width: 680px;
  font-size: 13px;
}

.buyer-reviews-section {
  margin-bottom: 24px;
}

.buyer-section-title {
  margin: 0 0 12px;
  font-size: 1.1rem;
}

.buyer-review-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

.buyer-contracts-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.buyer-contract-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
}

.buyer-contract-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.buyer-contract-product {
  margin: 6px 0 2px;
  font-weight: 600;
}

.buyer-contract-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.buyer-contract-stats .muted {
  display: block;
  font-size: 12px;
  margin-bottom: 2px;
}

.buyer-next-payment {
  margin: 0 0 12px;
}

.buyer-schedule-details {
  margin-top: 12px;
}

.buyer-schedule-details summary {
  cursor: pointer;
  font-weight: 600;
}

@media (max-width: 600px) {
  .buyer-contract-stats {
    grid-template-columns: 1fr;
  }

  .buyer-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

body.public-mode .shell {
  display: block;
}

body.public-mode .sidebar,
body.public-mode .sidebar-backdrop,
body.public-mode .topbar,
body.public-mode #pageProgress {
  display: none !important;
}

body.public-mode .main {
  min-height: 100vh;
  max-width: none;
  margin: 0;
  padding: max(20px, env(safe-area-inset-top, 0px)) var(--page-pad) max(24px, env(safe-area-inset-bottom, 0px));
}

body.public-mode #page-publicView.page.active {
  display: block;
}

.public-installments-wrap {
  max-width: 640px;
  margin: 0 auto;
}

.public-installments-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
}

.public-brand-mark {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: #101828;
  display: grid;
  place-items: center;
  padding: 6px;
}

.public-brand-mark img {
  width: 40px;
  height: 40px;
}

.public-installments-title {
  margin: 0;
  font-size: clamp(1.35rem, 4vw, 1.75rem);
  line-height: 1.2;
}

.public-installments-hint {
  margin: 0 0 16px;
  line-height: 1.5;
}

.public-installments-summary {
  margin-bottom: 20px;
}

.public-installments-summary .buyer-stat-grid {
  margin-bottom: 0;
}

.public-stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
}

.public-stat-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.public-stat strong {
  font-size: 1.1rem;
}

.public-installments-contracts {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.public-contract-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}

.public-contract-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 8px;
}

.public-contract-product {
  margin: 0 0 8px;
  font-weight: 600;
}

.public-installments-footer {
  margin-top: 24px;
  text-align: center;
}

.contract-detail-grid .item {
  min-width: 0;
}

.contract-finance-lines {
  display: grid;
  gap: 2px;
  margin: 10px 0 4px;
}

.contract-finance-lines .row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 20px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.contract-finance-lines .row:last-child {
  border-bottom: 0;
}

.contract-finance-lines .row strong {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.contract-finance-lines .row.emphasis strong {
  color: var(--accent, #0d6efd);
}

.contract-finance-meta {
  margin-top: 4px;
}

.investor-list-item {
  display: grid;
  gap: 4px;
}

.investor-list-main,
.investor-list-body {
  display: grid;
  gap: 4px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.investor-list-delete {
  flex-shrink: 0;
  padding: 6px 10px;
  font-size: 0.85rem;
}

.investor-delete-blocked {
  opacity: 0.55;
  cursor: help;
}

.investor-delete-hint {
  margin: 0 0 12px;
  color: var(--danger, #c0392b);
}

.account-danger-zone {
  margin-top: 12px;
  border-color: rgba(192, 57, 43, 0.35);
}

.account-delete-hint {
  margin: 6px 0 0;
  font-size: 0.9rem;
}

.account-delete-blocked {
  opacity: 0.55;
}

.contract-guarantor-card {
  margin-top: 4px;
}

.guarantor-details {
  border: 0;
}

.guarantor-details-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 16px;
  cursor: pointer;
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
}

.guarantor-details-summary::-webkit-details-marker {
  display: none;
}

.guarantor-details-summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 6px;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.guarantor-details[open] .guarantor-details-summary::before {
  transform: rotate(90deg);
}

.guarantor-edit-form {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.guarantor-phones-grid {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.guarantor-form-hint {
  margin: 4px 0 12px;
}

.investor-income-mode-fieldset {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 12px 0;
}

.investor-income-mode-fieldset legend {
  padding: 0 6px;
  font-weight: 600;
}

.investor-row-actions {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding-bottom: 4px;
}

.investor-row input:disabled {
  background: #f5f6f8;
  color: var(--muted);
}

.earnings-summary-panel {
  margin-bottom: 18px;
}

.earnings-block {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}

.earnings-lifetime {
  font-size: 1.35rem;
  margin: 8px 0 12px;
}

.earnings-subtitle {
  margin: 16px 0 8px;
  font-size: 0.95rem;
}

.earnings-month-table table {
  font-size: 14px;
}

.earnings-month-table th,
.earnings-month-table td {
  white-space: nowrap;
}

.grid-span-2 {
  grid-column: 1 / -1;
}

.client-scope-picker {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
}

.client-scope-picker .scope-option {
  display: block;
  margin: 8px 0;
}

.scope-pill.private {
  background: #eef2ff;
  color: #315efb;
}

.scope-pill.pending {
  background: #fff8e6;
  color: #b86e00;
}

.scope-pill.global {
  background: #e8f8ee;
  color: #16803a;
}

.guarantor-box {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-top: 12px;
}

.guarantor-box summary {
  cursor: pointer;
  font-weight: 600;
}

.client-share-panel {
  background: var(--primary-weak);
  border: 1px solid #c5d4ff;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 16px;
}

.share-url-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.share-url-row input {
  flex: 1;
  min-width: 200px;
  font-size: 13px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-bottom: 6px;
}

.nav-group-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.25);
  padding: 10px 10px 3px;
  white-space: nowrap;
  overflow: hidden;
}

/* ── Nav group accent colours ── */
[data-nav-group="operate"] button.active {
  background: rgba(49, 94, 251, 0.14);
}
[data-nav-group="operate"] button.active::before {
  background: linear-gradient(180deg, #315efb, #5b8fff);
}

[data-nav-group="catalog"] button.active {
  background: rgba(16, 185, 129, 0.12);
  color: #6ee7b7;
}
[data-nav-group="catalog"] button.active::before {
  background: linear-gradient(180deg, #10b981, #34d399);
}
[data-nav-group="catalog"] .nav-group-label {
  color: rgba(52, 211, 153, 0.45);
}

[data-nav-group="finance"] button.active {
  background: rgba(245, 158, 11, 0.11);
  color: #fcd34d;
}
[data-nav-group="finance"] button.active::before {
  background: linear-gradient(180deg, #f59e0b, #fbbf24);
}
[data-nav-group="finance"] .nav-group-label {
  color: rgba(251, 191, 36, 0.45);
}

[data-nav-group="account"] button.active {
  background: rgba(139, 92, 246, 0.12);
  color: #c4b5fd;
}
[data-nav-group="account"] button.active::before {
  background: linear-gradient(180deg, #8b5cf6, #a78bfa);
}
[data-nav-group="account"] .nav-group-label {
  color: rgba(167, 139, 250, 0.45);
}

body.sidebar-collapsed .nav-group-label {
  display: none;
}

body.sidebar-collapsed .nav-group[data-nav-group="catalog"],
body.sidebar-collapsed .nav-group[data-nav-group="finance"] {
  display: flex;
}

body.nav-simple .nav-group[data-nav-group="catalog"],
body.nav-simple .nav-group[data-nav-group="finance"] {
  display: none;
}

.onboarding-panel {
  border: 1px solid #c5d4ff;
  background: linear-gradient(135deg, #f8faff 0%, #fff 60%);
  margin-bottom: 16px;
}

.onboarding-checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.onboarding-checklist li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.onboarding-checklist li.done {
  opacity: 0.72;
}

.onboarding-checklist li.done strong::after {
  content: " ✓";
  color: var(--success);
}

.load-error-banner {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #ffe9e6;
  color: var(--danger);
  font-size: 0.92rem;
}

.billing-panel .subscription-pay-btn {
  margin-top: 12px;
}

#mfaSettings .mfa-secret {
  word-break: break-all;
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
}

:root[data-theme="dark"] {
  --bg: #0f1419;
  --panel: #1a2332;
  --text: #e8edf5;
  --muted: #9aa5b8;
  --line: #2a3548;
  --primary: #5b8cff;
  --primary-weak: #1e2a44;
  --success: #3ecf7a;
  --warning: #e6a23c;
  --danger: #f07167;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
}

:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .item,
:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea {
  color: var(--text);
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea {
  background: #121a26;
  border-color: var(--line);
}

.command-palette {
  position: fixed;
  inset: 0;
  z-index: 2147483640;
  display: grid;
  place-items: start center;
  padding: 12vh 16px 16px;
}

.command-palette.hidden {
  display: none !important;
}

.command-palette-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 16, 28, 0.55);
}

.command-palette-card {
  position: relative;
  width: min(560px, 100%);
  background: var(--panel);
  border-radius: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 12px;
}

.command-palette-card input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
}

.command-palette-results {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  max-height: 50vh;
  overflow: auto;
}

.command-palette-results li button {
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--text);
  font-weight: 600;
  padding: 10px 12px;
  border-radius: 10px;
}

.command-palette-results li button:hover,
.command-palette-results li button.focused {
  background: var(--primary-weak);
  color: var(--primary);
}

.command-palette-hint {
  margin: 8px 4px 0;
  font-size: 0.82rem;
}

label.checkbox-row,
label.theme-toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  cursor: pointer;
  margin: 0;
}

label.checkbox-row input[type="checkbox"],
label.theme-toggle-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  flex-shrink: 0;
  cursor: pointer;
}

.settings-grid {
  align-items: start;
}

.settings-appearance {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.settings-subheading {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 800;
}

.settings-appearance-hint {
  margin: 8px 0 0;
}

.pagination,
.contracts-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.pagination.hidden,
.contracts-pagination.hidden {
  display: none;
}

.pagination button {
  min-width: 36px;
  padding: 7px 12px;
  font-size: 16px;
}

.pagination-info {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.support-report-fab {
  position: fixed;
  right: max(18px, env(safe-area-inset-right, 0px));
  bottom: max(18px, env(safe-area-inset-bottom, 0px));
  left: auto;
  top: auto;
  z-index: 350;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px 10px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff7a45, #ff5722);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  box-shadow: 0 10px 28px rgba(255, 87, 34, 0.42);
  border: 2px solid rgba(255, 255, 255, 0.28);
}

.support-report-fab:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.support-report-fab svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.support-report-fab-label {
  white-space: nowrap;
}

@media (max-width: 640px) {
  .support-report-fab-label {
    display: none;
  }

  .support-report-fab {
    width: 44px;
    height: 44px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }
}

/* «Новый договор»: «Далее» справа внизу — FAB уводим влево только на этой странице */
body:has(#page-contractCreate.page.active) .support-report-fab {
  left: max(18px, env(safe-area-inset-left, 0px));
  right: auto;
}

.support-report-modal textarea {
  min-height: 110px;
  resize: vertical;
}

.support-report-attach-label input[type="file"] {
  margin-top: 8px;
}

.support-report-attach-preview {
  margin-top: 10px;
}

.support-report-preview-media {
  display: block;
  max-width: 100%;
  max-height: 220px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #f8fafc;
}

.support-report-status {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.92rem;
}

.support-report-status.hidden {
  display: none;
}

.support-report-status.danger {
  background: #fdecea;
  color: #b42318;
}

.support-report-status.success {
  background: #e8f7ee;
  color: #137333;
}

.support-report-status.neutral {
  background: var(--primary-weak);
  color: var(--primary);
}

.required-mark {
  color: var(--danger);
}

.support-reports-workspace {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.support-reports-list-panel,
.support-report-detail-panel {
  min-width: 0;
}

.support-report-item {
  width: 100%;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
}

.support-report-item.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary-weak);
}

.support-report-admin-form {
  margin: 12px 0;
}

.support-report-message {
  white-space: pre-wrap;
  word-break: break-word;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin: 0;
  font: inherit;
}

.support-report-downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

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

.contract-create-page {
  padding-bottom: max(88px, env(safe-area-inset-bottom, 0px));
}

.contract-create-page .contract-create-panel {
  max-width: 960px;
}

.contract-create-page .wizard-steps {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 8px 0 12px;
  margin-bottom: 8px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.contract-create-page .wizard-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin-top: 16px;
  padding: 12px 0 max(12px, env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, var(--panel) 78%, transparent);
}

/* ── Payment modal ─────────────────────────────────────────── */
.pay-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(16, 24, 40, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fade-in 0.15s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.pay-modal {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(16, 24, 40, 0.22);
  padding: 28px 28px 24px;
  width: 100%;
  max-width: 420px;
  animation: slide-up 0.18s ease;
}

@keyframes slide-up {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.pay-modal h3 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
}

.pay-modal .pay-modal-sub {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14px;
}

.pay-modal .pay-modal-input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  outline: none;
  transition: border-color 0.15s ease;
  margin-bottom: 8px;
}

.pay-modal .pay-modal-input:focus {
  border-color: var(--primary);
}

.pay-modal .pay-modal-hint {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 20px;
  text-align: center;
}

.pay-modal .pay-modal-actions {
  display: flex;
  gap: 10px;
}

.pay-modal .pay-modal-actions button {
  flex: 1;
  padding: 12px;
}

.pay-modal .pay-modal-actions .pay-modal-cancel {
  background: var(--primary-weak);
  color: var(--primary);
}

/* overpayment mode modal */
.pay-mode-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.pay-mode-option {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  text-align: left;
  background: #fff;
  width: 100%;
  color: var(--text);
  font-weight: 400;
}

.pay-mode-option:hover {
  border-color: var(--primary);
  background: var(--primary-weak);
}

.pay-mode-option .pay-mode-icon {
  font-size: 22px;
  flex-shrink: 0;
  line-height: 1.2;
}

.pay-mode-option strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.pay-mode-option span {
  font-size: 13px;
  color: var(--muted);
}

/* ── Toggle switch ─────────────────────────────────────────── */
.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  display: block;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: var(--line);
  transition: background 0.2s ease;
  position: relative;
}

.toggle-switch input:checked + .toggle-track {
  background: var(--primary);
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
  transition: transform 0.2s ease;
}

.toggle-switch input:checked + .toggle-track .toggle-thumb {
  transform: translateX(20px);
}


/* ───────── Dashboard Builder ───────── */
.db-panel { padding: 0; overflow: hidden; }
.db-root { display: block; }
.db-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.db-title { font-size: 16px; font-weight: 700; }
.db-toolbar-actions { display: flex; gap: 8px; align-items: center; }
.db-edit-group { display: inline-flex; gap: 8px; }
.db-grid {
  display: grid; grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: 14px; padding: 16px; align-items: start;
}
.db-grid.editing { background:
  repeating-linear-gradient(90deg, transparent, transparent calc(100%/24 - 1px), rgba(49,94,251,0.06) calc(100%/24)); }
.db-widget {
  grid-column: span 6; min-width: 0; display: flex; flex-direction: column;
  background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px;
  box-shadow: 0 1px 3px rgba(20,32,51,0.04);
}
.db-grid.editing .db-widget { outline: 1px dashed var(--line); cursor: grab; }
.db-grid.editing .db-widget.dragging { opacity: .5; outline-color: var(--primary); }
.db-widget-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin: -14px -14px 10px; padding: 6px 10px;
  background: #0f172a; color: #fff; border-radius: 14px 14px 0 0; font-size: 12px;
}
.db-handle { cursor: grab; font-weight: 700; }
.db-bar-actions { display: flex; gap: 4px; }
.db-widget-bar button {
  background: rgba(255,255,255,0.14); color: #fff; border-radius: 6px;
  padding: 3px 7px; font-size: 11px; font-weight: 600;
}
.db-widget-bar button:hover { background: rgba(255,255,255,0.28); }
.db-widget-bar .db-remove { background: rgba(244,63,94,0.85); }
.db-widget-head { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.db-widget-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.db-kpi { font-size: clamp(18px, 2vw, 23px); font-weight: 800; color: var(--text); letter-spacing: -0.02em; }
.db-chart { flex: 1; min-height: 180px; width: 100%; }
.db-table-wrap { overflow: auto; max-height: 320px; }
.db-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.db-table th, .db-table td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.db-table th { color: var(--muted); font-weight: 700; position: sticky; top: 0; background: #fff; }
.db-table td:not(:first-child), .db-table th:not(:first-child) { text-align: right; }
.db-empty { text-align: center; color: var(--muted); }
.db-error { color: var(--danger); font-size: 13px; padding: 10px; }

.db-inspector {
  position: fixed; top: 0; right: 0; width: min(360px, 92vw); height: 100vh; z-index: 400;
  background: #fff; border-left: 1px solid var(--line); box-shadow: -8px 0 32px rgba(15,23,42,0.16);
  padding: 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px;
}
.db-insp-head { display: flex; align-items: center; justify-content: space-between; }
.db-insp-close { background: var(--primary-weak); color: var(--primary); border-radius: 8px; padding: 4px 10px; }
.db-inspector label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--text); }
.db-inspector select, .db-inspector input { width: 100%; }
.db-insp-actions { margin-top: auto; }
.db-insp-apply { width: 100%; }

/* Планшет/телефон: KPI по 2 в ряд, графики/таблицы/блоки на всю ширину */
@media (max-width: 900px) {
  .db-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 12px !important; }
  .db-widget { grid-column: span 2 !important; }
  .db-widget--kpi { grid-column: span 1 !important; }
}
@media (max-width: 480px) {
  .db-grid { grid-template-columns: 1fr !important; }
  .db-widget, .db-widget--kpi { grid-column: span 1 !important; }
}

.db-period-label { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.db-period-label select, .db-select { padding: 7px 10px; border-radius: 9px; font-size: 13px; }
.db-select { max-width: 220px; }
@media (max-width: 700px) {
  .db-toolbar { flex-direction: column; align-items: stretch; }
  .db-toolbar-actions { flex-wrap: wrap; }
}

.db-insp-section { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.db-insp-section:first-of-type { border-top: none; padding-top: 0; }
.db-check { flex-direction: row !important; align-items: center; gap: 8px !important; font-weight: 600; }
.db-check input { width: auto !important; }

.db-crossfilter { display: flex; align-items: center; gap: 10px; padding: 8px 18px; background: #fff7ed; border-bottom: 1px solid #fed7aa; }
.db-cf-label { font-size: 12px; font-weight: 700; color: #9a3412; }
.db-cf-chip { display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 1px solid #fdba74; border-radius: 999px; padding: 4px 6px 4px 12px; font-size: 13px; color: #7c2d12; }
.db-cf-chip b { color: #1d2939; }
.db-cf-clear { background: #f97316; color: #fff; border-radius: 999px; width: 20px; height: 20px; padding: 0; font-size: 11px; line-height: 1; }
.db-cf-clear:hover { background: #ea580c; }

/* Resize-ручка (тянуть угол как окно в macOS, снэп к сетке) */
.db-widget { position: relative; }
.db-resize-handle {
  position: absolute; right: 3px; bottom: 3px; width: 20px; height: 20px;
  cursor: nwse-resize; z-index: 6; border-radius: 0 0 12px 0; opacity: .65;
  background:
    linear-gradient(135deg, transparent 45%, var(--primary) 45%, var(--primary) 55%, transparent 55%),
    linear-gradient(135deg, transparent 65%, var(--primary) 65%, var(--primary) 75%, transparent 75%);
  touch-action: none;
}
.db-resize-handle:hover { opacity: 1; }
.db-widget.resizing { outline: 2px solid var(--primary); user-select: none; }
.db-widget.resizing * { pointer-events: none; }
.db-widget-slot .db-widget-body { overflow: auto; }
.db-widget-slot .panel-head { margin-bottom: 10px; }
.db-widget-slot .earnings-summary-grid { grid-template-columns: 1fr 1fr; }
@media (max-width: 760px) { .db-widget-slot .earnings-summary-grid { grid-template-columns: 1fr; } }

/* Модалка добавления виджета */
.db-modal-overlay {
  position: fixed; inset: 0; z-index: 500; background: rgba(15,23,42,0.5);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.db-modal {
  background: #fff; border-radius: 18px; width: min(720px, 96vw); max-height: 88vh;
  overflow-y: auto; padding: 22px; box-shadow: 0 24px 64px rgba(15,23,42,0.3);
}
.db-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.db-modal-head strong { font-size: 18px; }
.db-modal-close { background: var(--primary-weak); color: var(--primary); border-radius: 8px; padding: 4px 10px; }
.db-modal-section { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 16px 0 8px; }
.db-wcatalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.db-wcard {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  background: #f7f9fc; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  text-align: left; cursor: pointer; transition: border-color .12s, box-shadow .12s, transform .1s;
}
.db-wcard:hover { border-color: var(--primary); box-shadow: 0 4px 14px rgba(49,94,251,.14); transform: translateY(-1px); }
.db-wcard-icon { font-size: 22px; }
.db-wcard-label { font-weight: 700; font-size: 14px; color: var(--text); }
.db-wcard-desc { font-size: 12px; color: var(--muted); }

/* KPI-дельта (сравнение с прошлым периодом) в Dashboard Builder */
.db-kpi-delta { font-size: 12px; font-weight: 600; margin-top: 5px; line-height: 1.3; font-variant-numeric: tabular-nums; }
.db-delta-up { color: #16803a; }
.db-delta-down { color: #c0392b; }
.db-delta-flat { color: var(--muted); }

/* ── Инфо-иконка «?» на блоках дашборда: подсказка при наведении ── */
.db-widget { position: relative; }
.db-info {
  position: absolute; top: 8px; right: 8px;
  width: 17px; height: 17px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; line-height: 1;
  color: #8a8f98; background: rgba(15, 23, 42, 0.05);
  border: 1px solid rgba(15, 23, 42, 0.1); cursor: help; z-index: 6;
  transition: background 0.15s ease, color 0.15s ease;
}
.db-info:hover, .db-info:focus-visible {
  background: rgba(15, 23, 42, 0.14); color: #1f2430; outline: none;
}
.db-info::after {
  content: attr(data-tip);
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 230px; max-width: 72vw;
  background: #1e1e24; color: #f3f4f6;
  font-size: 12px; font-weight: 500; line-height: 1.45;
  text-align: left; padding: 9px 11px; border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
  opacity: 0; transform: translateY(-4px); pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease; z-index: 50;
  white-space: normal;
}
.db-info::before {
  content: ""; position: absolute; top: calc(100% + 2px); right: 5px;
  border: 6px solid transparent; border-bottom-color: #1e1e24;
  opacity: 0; transition: opacity 0.15s ease; z-index: 51;
}
.db-info:hover::after, .db-info:focus-visible::after,
.db-info:hover::before, .db-info:focus-visible::before {
  opacity: 1; transform: none;
}
/* В режиме редактирования сверху панель управления — иконку прячем */
.db-widget[draggable="true"] .db-info { display: none; }
