:root {
  --sova-bg: #F5F5F7;
  --sova-surface: #FFFFFF;
  --sova-surface-2: #F2F2F7;
  --sova-surface-3: #EDEEF2;
  --sova-text: #1D1D1F;
  --sova-text-2: #6E6E73;
  --sova-text-3: #8E8E93;
  --sova-line: #D2D2D7;
  --sova-line-soft: rgba(60, 60, 67, 0.12);
  --sova-accent: #007AFF;
  --sova-accent-hover: #0066D6;
  --sova-accent-soft: rgba(0, 122, 255, 0.10);
  --sova-success: #34C759;
  --sova-success-soft: rgba(52, 199, 89, 0.12);
  --sova-warning: #FF9F0A;
  --sova-warning-soft: rgba(255, 159, 10, 0.13);
  --sova-danger: #FF3B30;
  --sova-danger-soft: rgba(255, 59, 48, 0.11);
  --sova-info: #5AC8FA;
  --sova-overlay: rgba(0, 0, 0, 0.32);
  --sova-shadow-sm: 0 1px 2px rgba(0, 0, 0, .04);
  --sova-shadow-md: 0 8px 28px rgba(0, 0, 0, .08);
  --sova-shadow-lg: 0 22px 60px rgba(0, 0, 0, .14);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-pill: 999px;
  --motion-fast: 120ms;
  --motion-base: 180ms;
  --motion-slow: 260ms;
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--sova-bg); }
body { min-height: 100vh; margin: 0; color: var(--sova-text); background: var(--sova-bg); font-size: 16px; line-height: 1.48; }
body.dialog-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, select, summary { color: inherit; cursor: pointer; }
button { border: 0; }
[hidden] { display: none !important; }
.icon { width: 20px; height: 20px; flex: 0 0 auto; }
img { max-width: 100%; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; }

input, select, textarea {
  width: 100%; min-height: 44px; border: 1px solid var(--sova-line); border-radius: 11px;
  padding: 0 13px; color: var(--sova-text); background: var(--sova-surface); outline: none;
  transition: border-color var(--motion-base), box-shadow var(--motion-base), background var(--motion-base);
}
textarea { min-height: 96px; padding-block: 11px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--sova-text-3); opacity: 1; }
select option { color: var(--sova-text); background: var(--sova-surface); }
input:focus, select:focus, textarea:focus { border-color: var(--sova-accent); box-shadow: 0 0 0 3px var(--sova-accent-soft); }
input:disabled, select:disabled, textarea:disabled { color: var(--sova-text-2); background: var(--sova-surface-2); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--sova-accent); }
label { display: grid; gap: 7px; color: var(--sova-text-2); font-size: 14px; font-weight: 600; }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(0, 122, 255, .35); outline-offset: 2px; border-radius: 8px;
}

/* App shell */
.app-sidebar {
  position: fixed; z-index: 40; inset: 0 auto 0 0; display: flex; width: 240px; flex-direction: column;
  border-right: 1px solid var(--sova-line-soft); padding: 22px 14px 16px; background: rgba(255,255,255,.9);
  backdrop-filter: blur(18px) saturate(1.12);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 24px; }
.brand-emblem { width: 40px; height: 40px; border: 1px solid var(--sova-line-soft); border-radius: 12px; object-fit: cover; }
.brand strong, .brand small, .sidebar-user strong, .sidebar-user small { display: block; }
.brand strong { font-size: 19px; letter-spacing: -.02em; }
.brand small, .sidebar-user small { margin-top: 2px; color: var(--sova-text-3); font-size: 12px; }
.main-nav { display: grid; gap: 4px; }
.nav-item {
  display: flex; width: 100%; min-height: 46px; align-items: center; gap: 12px; border-radius: 12px;
  padding: 0 12px; color: var(--sova-text-2); font-size: 15px; font-weight: 600; background: transparent;
  transition: color var(--motion-fast), background var(--motion-fast);
}
.nav-item:hover { color: var(--sova-text); background: var(--sova-surface-2); }
.nav-item.active { color: var(--sova-accent); background: var(--sova-accent-soft); }
.nav-icon { display: grid; width: 22px; place-items: center; }
.nav-button { text-align: left; }
.nav-divider { height: 1px; margin: 10px 12px; background: var(--sova-line-soft); }
.sidebar-user { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; margin-top: auto; border-top: 1px solid var(--sova-line-soft); padding: 14px 4px 0; }
.sidebar-profile-link { display: grid; min-width: 0; grid-template-columns: auto 1fr; align-items: center; gap: 10px; }
.sidebar-user strong { max-width: 112px; overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.avatar, .mini-avatar, .big-avatar, .today-avatar {
  display: grid; flex: 0 0 auto; place-items: center; border-radius: 50%; color: #FFFFFF; font-weight: 750; background: var(--sova-accent);
}
.avatar { width: 38px; height: 38px; }
.mini-avatar { width: 26px; height: 26px; font-size: 11px; }
.big-avatar { width: 50px; height: 50px; font-size: 18px; }
.avatar-image { display: block; object-fit: cover; }
.icon-button { display: inline-grid; width: 44px; height: 44px; place-items: center; border-radius: 11px; color: var(--sova-text-2); background: transparent; }
.icon-button:hover { color: var(--sova-text); background: var(--sova-surface-2); }
.app-main { min-height: 100vh; margin-left: 240px; padding: 0 32px 64px; }
.desktop-toolbar { display: flex; height: 68px; align-items: center; justify-content: space-between; }
.notification-button { position: relative; display: inline-flex; min-height: 42px; align-items: center; gap: 8px; border: 1px solid var(--sova-line-soft); border-radius: 12px; padding: 0 13px; color: var(--sova-text-2); background: rgba(255,255,255,.82); }
.notification-button b { display: inline-grid; min-width: 20px; height: 20px; place-items: center; border-radius: 10px; color: white; font-size: 11px; background: var(--sova-danger); }
.mobile-header, .mobile-nav, .sidebar-scrim { display: none; }

/* Shared headings and controls */
.page-heading, .lead-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin: 6px 0 26px; }
.page-heading h1, .lead-header h1 { margin: 4px 0 6px; font-size: clamp(30px, 3.2vw, 42px); line-height: 1.15; letter-spacing: -.035em; }
.page-heading p, .lead-header p { margin: 0; color: var(--sova-text-2); font-size: 15px; }
.page-heading-actions, .lead-header-actions, .card-header-actions { display: flex; align-items: center; gap: 10px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-heading h2 { margin: 3px 0 0; }
.eyebrow { margin: 0; color: var(--sova-accent) !important; font-size: 13px !important; font-weight: 750; text-transform: uppercase; letter-spacing: .1em; }
.back-link { display: inline-flex; min-height: 40px; align-items: center; gap: 6px; margin-bottom: 10px; color: var(--sova-text-2); font-size: 14px; font-weight: 650; }
.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 11px; padding: 0 18px; font-size: 15px; font-weight: 650; transition: background var(--motion-fast), border-color var(--motion-fast), color var(--motion-fast); }
.button.primary { color: white; background: var(--sova-accent); }
.button.primary:hover { background: var(--sova-accent-hover); }
.button.secondary { border-color: var(--sova-line); color: var(--sova-text); background: var(--sova-surface); }
.button.secondary:hover, .button.ghost:hover { background: var(--sova-surface-2); }
.button.ghost { color: var(--sova-text-2); background: transparent; }
.button.danger { color: var(--sova-danger); background: var(--sova-danger-soft); }
.button.small { min-height: 38px; padding-inline: 13px; font-size: 13px; }
.button.wide { width: 100%; }
.danger-text { color: var(--sova-danger); }
.form-card, .side-card, .card, .table-shell, .inbox-list, .today-section, .activity-list article {
  border: 1px solid var(--sova-line-soft); border-radius: var(--radius-lg); background: var(--sova-surface); box-shadow: var(--sova-shadow-sm);
}
.form-card, .side-card { padding: 22px; }
.form-card h2, .side-card h2 { margin: 0; font-size: 20px; }
.form-card > p, .side-card > p { color: var(--sova-text-2); font-size: 14px; }
.form-grid { display: grid; max-width: 920px; grid-template-columns: 1fr 1fr; gap: 18px; }
.span-2 { grid-column: span 2; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.inline-form { display: flex; gap: 8px; }
.inline-form select { min-height: 40px; }
.compact-form { display: grid; gap: 12px; }
.compact-create { display: grid; align-content: start; gap: 14px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip, .channel-tag, .type-tag, .segment-tag, .status-badge { display: inline-flex; width: fit-content; min-height: 28px; align-items: center; gap: 5px; border-radius: var(--radius-pill); padding: 0 10px; color: var(--sova-text-2); font-size: 12px; font-weight: 650; background: var(--sova-surface-2); }
.status-badge.accent { color: var(--sova-accent); background: var(--sova-accent-soft); }
.status-badge.warning { color: #9A5D00; background: var(--sova-warning-soft); }
.status-badge.success { color: #187B34; background: var(--sova-success-soft); }
.status-badge.danger { color: var(--sova-danger); background: var(--sova-danger-soft); }
.search-field { position: relative; display: block; }
.search-field > .icon, .search-field > span { position: absolute; z-index: 1; top: 50%; left: 13px; width: 19px; height: 19px; color: var(--sova-text-3); transform: translateY(-50%); }
.search-field input { padding-left: 42px; }
.filter-bar, .page-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.filter-bar .search-field, .page-toolbar .search-field { flex: 1; }
.filter-chip { display: inline-flex; min-height: 34px; align-items: center; gap: 6px; border-radius: var(--radius-pill); padding: 0 12px; color: var(--sova-accent); font-size: 13px; background: var(--sova-accent-soft); }
.filter-chip.active { color: white; background: var(--sova-accent); }
.filter-summary, .activity-filters { margin-bottom: 18px; }

/* Dialogs and sheets */
.dialog-backdrop { position: fixed; z-index: 90; inset: 0; background: var(--sova-overlay); backdrop-filter: blur(3px); }
.sheet { position: fixed; z-index: 100; top: 50%; left: 50%; width: min(520px, calc(100vw - 32px)); max-height: min(760px, calc(100vh - 32px)); overflow-y: auto; border: 1px solid var(--sova-line-soft); border-radius: var(--radius-xl); padding: 22px; background: var(--sova-surface); box-shadow: var(--sova-shadow-lg); transform: translate(-50%, -50%); }
.sheet > header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.sheet h2 { margin: 3px 0 0; font-size: 24px; }
.sheet-handle { display: none; }
.action-list { display: grid; gap: 8px; }
.action-list > a, .action-list > button { display: grid; min-height: 64px; grid-template-columns: auto 1fr; align-items: center; gap: 14px; border-radius: 14px; padding: 10px 13px; text-align: left; background: transparent; }
.action-list > a:hover, .action-list > button:hover { background: var(--sova-surface-2); }
.action-list .icon { color: var(--sova-accent); }
.action-list strong, .action-list small { display: block; }
.action-list small { margin-top: 3px; color: var(--sova-text-2); font-size: 13px; }

/* Notifications, flash, toast */
.notification-panel { position: fixed; z-index: 70; top: 58px; right: 28px; width: min(400px, calc(100vw - 28px)); max-height: calc(100vh - 84px); overflow: hidden; border: 1px solid var(--sova-line-soft); border-radius: var(--radius-lg); color: var(--sova-text); background: var(--sova-surface); box-shadow: var(--sova-shadow-lg); }
.notification-panel > header { display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--sova-line-soft); padding: 17px; }
.notification-panel h2 { margin: 3px 0 0; font-size: 20px; }
.notification-panel-actions { display: flex; align-items: center; gap: 4px; }
.notification-list { max-height: calc(100vh - 190px); overflow-y: auto; padding: 8px; }
.notification-item { position: relative; display: grid; gap: 5px; border-radius: 12px; padding: 13px 14px 13px 18px; }
.notification-item:hover { background: var(--sova-surface-2); }
.notification-item.unread::before { position: absolute; top: 18px; left: 8px; width: 5px; height: 5px; border-radius: 50%; background: var(--sova-accent); content: ""; }
.notification-item strong { font-size: 14px; }
.notification-item span { overflow: hidden; color: var(--sova-text-2); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.notification-item time { color: var(--sova-text-3); font-size: 12px; }
.notification-empty { padding: 36px 18px; color: var(--sova-text-2); text-align: center; }
.notification-permission { display: grid; max-width: 680px; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; margin: 0 auto 24px; border: 1px solid rgba(0,122,255,.2); border-radius: var(--radius-lg); padding: 14px; background: #F7FBFF; }
.notification-permission-actions { display: flex; align-items: center; gap: 4px; }
.notification-permission p { margin: 3px 0 0; color: var(--sova-text-2); font-size: 13px; }
.feature-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 12px; color: var(--sova-accent); background: var(--sova-accent-soft); }
.flash-stack { position: fixed; z-index: 80; top: 76px; right: 24px; display: grid; width: min(380px, calc(100vw - 32px)); gap: 8px; }
.flash, .toast { border: 1px solid var(--sova-line-soft); border-radius: 13px; padding: 13px 15px; background: var(--sova-surface); box-shadow: var(--sova-shadow-md); }
.flash.success { border-color: rgba(52,199,89,.3); background: #F4FCF6; }
.flash.error { border-color: rgba(255,59,48,.28); background: #FFF7F6; }
.toast-container { position: fixed; z-index: 110; right: 20px; bottom: 24px; display: grid; width: min(370px, calc(100vw - 30px)); gap: 8px; }
.toast strong, .toast span { display: block; }
.toast span { margin-top: 3px; color: var(--sova-text-2); font-size: 13px; }

/* Today */
.today-header { margin: 24px 0 24px; }
.today-header h1 { margin: 6px 0 8px; font-size: clamp(32px, 4vw, 48px); line-height: 1.1; letter-spacing: -.035em; }
.today-header > p:last-child { margin: 0; color: var(--sova-text-2); font-size: 17px; }
.today-focus { display: flex; min-height: 176px; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 28px; border-radius: var(--radius-lg); padding: 26px 28px; color: white; background: var(--sova-accent); }
.today-focus h2 { margin: 5px 0 7px; font-size: 28px; }
.today-focus p, .today-focus small { margin: 0; color: rgba(255,255,255,.82); }
.today-focus small { display: block; margin-top: 12px; font-size: 13px; }
.today-focus .eyebrow { color: rgba(255,255,255,.76) !important; }
.today-focus .button { color: var(--sova-accent); background: white; }
.today-section { margin-bottom: 22px; overflow: hidden; }
.today-section > header { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 20px 22px 13px; }
.today-section h2 { margin: 4px 0 0; font-size: 21px; }
.text-link { color: var(--sova-accent); font-size: 14px; font-weight: 650; }
.today-list > a { display: grid; min-height: 72px; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 13px; border-top: 1px solid var(--sova-line-soft); padding: 14px 22px; }
.today-list > a:hover { background: var(--sova-surface-2); }
.today-avatar { width: 42px; height: 42px; }
.today-list strong, .today-list small { display: block; }
.today-list strong { font-size: 15px; }
.today-list small { margin-top: 3px; overflow: hidden; color: var(--sova-text-2); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.today-meta, .today-list time { color: var(--sova-text-2); font-size: 12px; }
.today-empty, .empty-state { display: grid; min-height: 220px; place-items: center; align-content: center; gap: 8px; padding: 28px; color: var(--sova-text-2); text-align: center; }
.today-empty strong, .empty-state h2, .empty-state h3 { margin: 0; color: var(--sova-text); font-size: 18px; }
.today-empty p, .empty-state p { max-width: 420px; margin: 0; }
.today-agenda { display: grid; }
.today-agenda > div { display: grid; grid-template-columns: 92px 1fr; gap: 14px; border-top: 1px solid var(--sova-line-soft); padding: 15px 22px; }
.today-agenda time { color: var(--sova-text-2); }

/* Deals and people */
.kanban { display: flex; gap: 14px; padding-bottom: 16px; overflow-x: auto; scroll-snap-type: x proximity; }
.kanban-column { flex: 0 0 min(310px, 84vw); min-height: 480px; border: 1px solid var(--sova-line-soft); border-radius: var(--radius-lg); padding: 10px; background: var(--sova-surface-2); scroll-snap-align: start; }
.kanban-column > header { display: flex; min-height: 42px; align-items: center; justify-content: space-between; padding: 0 6px 9px; }
.kanban-column > header div { display: flex; align-items: center; gap: 8px; }
.kanban-column > header i { width: 9px; height: 9px; border-radius: 50%; background: var(--stage-color, var(--sova-accent)); }
.kanban-column > header > span { display: grid; min-width: 26px; height: 26px; place-items: center; border-radius: 8px; color: var(--sova-text-2); font-size: 12px; background: var(--sova-surface); }
.kanban-list, .client-grid, .collection-grid { display: grid; gap: 10px; }
.lead-card, .client-card, .collection-card, .client-lead-list > a { display: block; border: 1px solid var(--sova-line-soft); border-radius: var(--radius-md); padding: 15px; background: var(--sova-surface); box-shadow: var(--sova-shadow-sm); transition: border-color var(--motion-fast), box-shadow var(--motion-fast); }
.lead-card:hover, .client-card:hover, .collection-card:hover { border-color: rgba(0,122,255,.35); box-shadow: var(--sova-shadow-md); }
.lead-card-top, .lead-card footer, .lead-card-meta, .client-card header, .client-card footer { display: flex; align-items: center; }
.lead-card-top, .client-card header, .client-card footer { justify-content: space-between; gap: 10px; }
.lead-card h3, .client-card h3, .collection-card h3 { margin: 12px 0 4px; font-size: 17px; }
.lead-card > p, .client-card > p, .collection-card p { margin: 0; color: var(--sova-text-2); font-size: 14px; }
.lead-card-meta { flex-wrap: wrap; gap: 7px; margin: 13px 0; }
.lead-card footer { gap: 7px; border-top: 1px solid var(--sova-line-soft); padding-top: 11px; color: var(--sova-text-2); font-size: 13px; }
.lead-card footer b, .inbox-list > a > b { display: grid; min-width: 23px; height: 23px; place-items: center; border-radius: 12px; color: white; font-size: 11px; background: var(--sova-accent); }
.client-grid { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.client-card { display: grid; grid-template-columns: auto 1fr; gap: 14px; }
.client-card h3 { margin: 0 0 5px; }
.client-card header > span { color: var(--sova-text-2); font-size: 13px; }
.client-card footer { margin-top: 14px; border-top: 1px solid var(--sova-line-soft); padding-top: 11px; color: var(--sova-text-2); font-size: 12px; }
.client-card-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.client-detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; gap: 18px; }
.client-leads-panel > header, .side-card > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.client-lead-list { display: grid; gap: 9px; }
.client-lead-list footer { display: flex; justify-content: space-between; margin-top: 10px; color: var(--sova-text-2); font-size: 12px; }
.profile-facts { display: grid; gap: 0; margin: 0; }
.profile-facts > div { display: grid; grid-template-columns: minmax(110px, .7fr) 1fr; gap: 14px; border-top: 1px solid var(--sova-line-soft); padding: 13px 0; }
.profile-facts > div:first-child { border-top: 0; }
.profile-facts dt { color: var(--sova-text-2); }
.profile-facts dd { margin: 0; font-weight: 600; }
.technical-details { margin-top: 14px; border-top: 1px solid var(--sova-line-soft); padding-top: 12px; color: var(--sova-text-2); }
.technical-details summary { font-size: 13px; font-weight: 650; }
.profile-description { margin-top: 14px; border-radius: 12px; padding: 12px; background: var(--sova-surface-2); }
.profile-description small { color: var(--sova-text-2); }
.profile-description p { margin: 5px 0 0; }
.profile-links { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 12px; color: var(--sova-accent); }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.lead-summary { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 12px; }
.lead-summary span { display: grid; gap: 2px; }
.lead-summary small { color: var(--sova-text-3); font-size: 12px; }
.lead-summary strong { font-size: 13px; }

/* Inbox and chat */
.inbox-layout { display: grid; min-height: calc(100vh - 140px); grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); overflow: hidden; border: 1px solid var(--sova-line-soft); border-radius: var(--radius-lg); background: var(--sova-surface); }
.inbox-list { overflow-y: auto; border: 0; border-right: 1px solid var(--sova-line-soft); border-radius: 0; box-shadow: none; }
.inbox-search { position: sticky; z-index: 2; top: 0; border-bottom: 1px solid var(--sova-line-soft); padding: 12px; background: var(--sova-surface); }
.inbox-list > a { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 12px; border-bottom: 1px solid var(--sova-line-soft); padding: 15px; }
.inbox-list > a:hover, .inbox-list > a.active { background: var(--sova-accent-soft); }
.inbox-list strong, .inbox-list p, .inbox-list small { display: block; }
.inbox-list p { margin: 3px 0; overflow: hidden; color: var(--sova-text-2); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.inbox-list small, .inbox-list time { color: var(--sova-text-3); font-size: 12px; }
.conversation-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.inbox-chat { min-width: 0; }
.inbox-chat .messenger { min-height: 100%; border: 0; border-radius: 0; }
.inbox-back { display: none; color: var(--sova-accent); font-size: 13px; }
.lead-title-row { display: flex; align-items: center; gap: 12px; }
.lead-workspace { display: grid; grid-template-columns: minmax(0,1fr) 340px; align-items: start; gap: 18px; }
.messenger { position: relative; display: flex; min-height: 620px; max-height: calc(100vh - 110px); flex-direction: column; overflow: hidden; border: 1px solid var(--sova-line-soft); border-radius: var(--radius-lg); background: var(--sova-surface-2); }
.messenger-header { position: relative; z-index: 2; display: flex; min-height: 68px; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--sova-line-soft); padding: 11px 16px; background: rgba(255,255,255,.96); }
.messenger-header strong, .messenger-header small { display: block; }
.messenger-header small { margin-top: 3px; color: var(--sova-text-2); font-size: 12px; }
.messenger-header nav { display: flex; gap: 5px; }
.messenger-header nav a { min-height: 34px; border-radius: 9px; padding: 7px 10px; color: var(--sova-text-2); font-size: 12px; font-weight: 650; }
.messenger-header nav a.active { color: var(--sova-accent); background: var(--sova-accent-soft); }
.message-list { position: relative; z-index: 1; display: flex; flex: 1; flex-direction: column; gap: 9px; overflow-y: auto; padding: 20px; }
.message { width: fit-content; max-width: min(74%, 640px); margin: 0; border: 1px solid var(--sova-line-soft); border-radius: 15px 15px 15px 5px; padding: 10px 12px 7px; background: var(--sova-surface); box-shadow: var(--sova-shadow-sm); }
.message.outbound { align-self: flex-end; border-color: transparent; border-radius: 15px 15px 5px 15px; color: white; background: var(--sova-accent); }
.message.failed { outline: 2px solid rgba(255,59,48,.35); }
.message p { margin: 0; font-size: 15px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.message footer { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-top: 5px; color: var(--sova-text-3); font-size: 11px; }
.message.outbound footer { color: rgba(255,255,255,.72); }
.message-delete { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; color: inherit; background: rgba(0,0,0,.08); }
.message-attachment { display: flex; min-width: 190px; align-items: center; gap: 9px; margin-bottom: 7px; border-radius: 10px; padding: 8px 10px; background: rgba(127,138,164,.12); }
.message-attachment audio { width: min(280px, 66vw); }
.message-attachment video, .message-attachment img { display: block; width: min(330px, 66vw); max-height: 380px; border-radius: 10px; object-fit: contain; background: #111318; }
.message-attachment .video-note-player { width: min(250px, 64vw); height: min(250px, 64vw); border-radius: 50%; object-fit: cover; }
.composer { position: relative; z-index: 3; display: flex; align-items: end; gap: 8px; border-top: 1px solid var(--sova-line-soft); padding: 10px; background: var(--sova-surface); }
.composer-tools { display: flex; gap: 5px; }
.composer textarea { min-height: 48px; max-height: 130px; border-radius: 14px; resize: none; }
.composer-send { display: grid; width: 48px; height: 48px; flex: 0 0 auto; place-items: center; border-radius: 14px; color: white; background: var(--sova-accent); }
.composer-tool { display: grid; width: 44px; height: 48px; flex: 0 0 auto; place-items: center; border: 1px solid var(--sova-line); border-radius: 12px; color: var(--sova-text-2); background: var(--sova-surface); }
.composer-tool.recording { color: white; background: var(--sova-danger); animation: record-pulse 1.2s ease-in-out infinite; }
.composer-media-preview { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; border-top: 1px solid var(--sova-line-soft); padding: 10px; background: var(--sova-surface); }
.quick-actions { display: flex; gap: 8px; overflow-x: auto; border-top: 1px solid var(--sova-line-soft); padding: 8px 10px; background: var(--sova-surface); }
.quick-actions button, .quick-actions summary { min-height: 40px; border-radius: 10px; padding: 0 13px; color: var(--sova-accent); font-size: 13px; font-weight: 650; background: var(--sova-accent-soft); }
.collection-drawer { position: absolute; z-index: 8; right: 12px; bottom: 76px; left: 12px; max-height: 340px; overflow-y: auto; border: 1px solid var(--sova-line-soft); border-radius: 16px; padding: 13px; background: var(--sova-surface); box-shadow: var(--sova-shadow-lg); }
.collection-drawer > header, .collection-drawer form { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.collection-drawer form { border-top: 1px solid var(--sova-line-soft); padding: 10px 0; }
.lead-sidebar { display: grid; gap: 14px; }
.assignee-line { display: flex; align-items: center; gap: 10px; }
.timeline { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.timeline > div, .timeline > li { position: relative; border-left: 1px solid var(--sova-line); padding: 0 0 16px 18px; }
.timeline i { position: absolute; top: 4px; left: -5px; width: 9px; height: 9px; border-radius: 50%; background: var(--sova-accent); }
.empty-chat { display: grid; flex: 1; place-items: center; color: var(--sova-text-2); text-align: center; }
.empty-column { padding: 32px 8px; color: var(--sova-text-3); font-size: 13px; text-align: center; }
.mobile-stage-picker { display: none; }

/* Housing and collections */
.table-shell { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 14px 15px; color: var(--sova-text-2); font-size: 12px; font-weight: 650; text-align: left; background: var(--sova-surface-2); }
.data-table td { border-top: 1px solid var(--sova-line-soft); padding: 15px; font-size: 14px; vertical-align: top; }
.data-table td strong, .data-table td small, .data-table td a { display: block; }
.data-table td small { margin-top: 4px; color: var(--sova-text-2); font-size: 12px; }
.empty-cell { padding: 40px !important; color: var(--sova-text-2); text-align: center; }
.city-multiselect { position: relative; }
.city-multiselect > summary { display: flex; min-height: 44px; align-items: center; justify-content: space-between; border: 1px solid var(--sova-line); border-radius: 11px; padding: 0 13px; background: var(--sova-surface); list-style: none; }
.city-multiselect-popover { display: grid; gap: 9px; margin-top: 8px; border: 1px solid var(--sova-line-soft); border-radius: 14px; padding: 12px; background: var(--sova-surface); }
.city-options { display: grid; max-height: 280px; overflow-y: auto; }
.city-options label { display: flex; min-height: 42px; align-items: center; gap: 8px; border-radius: 9px; padding: 6px; }
.city-options label:hover { background: var(--sova-surface-2); }
.city-options input { width: 18px; height: 18px; }
.collections-layout { display: grid; grid-template-columns: minmax(250px, .34fr) minmax(0, 1fr); align-items: start; gap: 18px; }
.collection-grid { grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }
.collection-card { overflow: hidden; padding: 0; }
.collection-cover { display: grid; height: 130px; place-items: center; color: var(--sova-accent); background: var(--sova-accent-soft); }
.collection-card > div:last-child { padding: 16px; }
.collection-card footer { display: flex; justify-content: space-between; gap: 10px; margin-top: 15px; color: var(--sova-text-3); font-size: 12px; }
.collection-editor { display: grid; grid-template-columns: minmax(0, 1fr) 350px; align-items: start; gap: 18px; }
.editor-items { display: grid; gap: 12px; }
.editor-items article { display: grid; grid-template-columns: 130px 1fr auto; gap: 14px; border: 1px solid var(--sova-line-soft); border-radius: var(--radius-md); padding: 12px; background: var(--sova-surface); }
.editor-items article > div:not(.media-carousel) { min-width: 0; }
.editor-items article h3, .editor-items article p { overflow-wrap: anywhere; }
.editor-items img, .image-placeholder { display: grid; width: 130px; height: 110px; place-items: center; border-radius: 11px; object-fit: cover; background: var(--sova-surface-2); }
.editor-items video { width: 130px; height: 110px; border-radius: 11px; object-fit: cover; background: #111318; }
.media-carousel { position: relative; width: 130px; height: 110px; overflow: hidden; border-radius: 11px; background: var(--sova-surface-2); }
.media-carousel .carousel-slide { display: block; width: 100%; height: 100%; padding: 0; background: var(--sova-surface-2); }
.media-carousel .carousel-slide img, .media-carousel .carousel-slide video { width: 100%; height: 100%; object-fit: cover; }
.media-carousel .carousel-arrow { position: absolute; z-index: 2; top: 50%; display: grid; width: 26px; height: 26px; place-items: center; border-radius: 50%; color: var(--sova-text); background: rgba(255,255,255,.86); transform: translateY(-50%); }
.media-carousel .carousel-arrow .icon { width: 15px; height: 15px; }
.media-carousel .carousel-arrow.prev { left: 4px; }
.media-carousel .carousel-arrow.next { right: 4px; transform: translateY(-50%) rotate(180deg); }
.media-carousel .carousel-counter { position: absolute; right: 5px; bottom: 5px; border-radius: 999px; padding: 2px 5px; color: var(--sova-text); font-size: 10px; background: rgba(255,255,255,.9); }
.media-lightbox { position: fixed; z-index: 120; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(0,0,0,.9); }
.media-lightbox-content { max-width: min(94vw, 1200px); max-height: 90vh; object-fit: contain; }
.media-lightbox-close { position: absolute; top: 16px; right: 16px; display: grid; width: 44px; height: 44px; place-items: center; border: 1px solid rgba(255,255,255,.3); border-radius: 50%; color: white; background: rgba(0,0,0,.5); }
.media-lightbox-close .icon { width: 22px; height: 22px; }
.lightbox-open { overflow: hidden; }
.collection-meta-editor summary, .editor-item-edit summary, .collection-add summary { color: var(--sova-accent); font-weight: 650; list-style: none; }
.item-edit-form { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 11px; margin-top: 14px; border-top: 1px solid var(--sova-line-soft); padding-top: 14px; }
.checkbox-label { display: flex !important; align-items: center; gap: 8px; }
.checkbox-label input { width: auto; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 24px; border: 1px solid rgba(255,59,48,.2); border-radius: var(--radius-lg); padding: 18px; background: var(--sova-danger-soft); }

/* Activity, profile, settings */
.activity-list { display: grid; gap: 10px; }
.activity-list article { display: grid; grid-template-columns: auto 1fr; gap: 13px; padding: 15px; }
.activity-icon { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 12px; color: var(--sova-accent); background: var(--sova-accent-soft); }
.activity-list article > div > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.activity-list h3 { margin: 5px 0; font-size: 16px; }
.activity-list p { margin: 0; color: var(--sova-text-2); font-size: 14px; }
.activity-list time { color: var(--sova-text-3); font-size: 12px; }
.profile-layout { display: grid; grid-template-columns: minmax(280px, .8fr) minmax(320px, 1.2fr); gap: 18px; }
.profile-avatar-preview { display: grid; width: 116px; height: 116px; place-items: center; margin: 0 auto 18px; overflow: hidden; border-radius: 50%; color: white; font-size: 42px; font-weight: 800; background: var(--sova-accent); }
.profile-avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.settings-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); align-items: start; gap: 20px; }
.settings-nav { position: sticky; top: 20px; display: grid; gap: 4px; border: 1px solid var(--sova-line-soft); border-radius: var(--radius-lg); padding: 8px; background: var(--sova-surface); }
.settings-nav a { min-height: 42px; border-radius: 10px; padding: 10px 12px; color: var(--sova-text-2); font-size: 14px; }
.settings-nav a:hover { color: var(--sova-text); background: var(--sova-surface-2); }
.settings-content { display: grid; gap: 18px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.radio-card { display: grid; min-height: 84px; grid-template-columns: auto 1fr; align-items: start; gap: 10px; border: 1px solid var(--sova-line); border-radius: 13px; padding: 14px; }
.radio-card:has(input:checked) { border-color: var(--sova-accent); background: var(--sova-accent-soft); }
.radio-card input { width: 18px; height: 18px; margin-top: 2px; }
.radio-card strong, .radio-card small { display: block; }
.radio-card small { margin-top: 4px; color: var(--sova-text-2); }
.team-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.team-chips > span { display: grid; min-width: 190px; grid-template-columns: auto 1fr; align-items: center; gap: 10px; border: 1px solid var(--sova-line-soft); border-radius: 13px; padding: 10px; }
.team-chips b { display: grid; width: 36px; height: 36px; grid-row: span 2; place-items: center; border-radius: 50%; color: white; background: var(--sova-accent); }
.team-chips strong, .team-chips small { display: block; }
.team-chips small { color: var(--sova-text-2); }
.user-settings { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.user-settings > form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stage-settings > div { display: grid; gap: 9px; }
.stage-settings form { display: grid; grid-template-columns: auto minmax(180px,1fr) 90px auto auto; align-items: end; gap: 9px; border-top: 1px solid var(--sova-line-soft); padding-top: 10px; }
.stage-settings input[type="color"] { width: 44px; padding: 3px; }
.stage-settings label { display: grid; grid-template-columns: 90px 1fr; align-items: center; }
.stage-settings label small { color: var(--sova-text-3); }
.tilda-settings { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.integration-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 16px; border: 1px solid var(--sova-line-soft); border-radius: 14px; padding: 14px; }
.integration-row p { margin: 4px 0 0; color: var(--sova-text-2); }

/* Login is an intentional branded exception, not an app theme. */
[data-sova-theme="dark-brand"] { color-scheme: dark; }
.login-body { color: white; background: #0B0E12; }
.login-shell { display: grid; min-height: 100vh; grid-template-columns: minmax(0,1.3fr) minmax(410px,.7fr); }
.login-visual { position: relative; display: flex; overflow: hidden; flex-direction: column; justify-content: space-between; padding: clamp(32px,5vw,72px); background: radial-gradient(circle at 75% 52%, rgba(226,182,95,.14), transparent 24%), #0B0E12; }
.login-brand { position: relative; z-index: 3; display: flex; align-items: center; gap: 12px; }
.login-brand > img { width: 54px; height: 42px; border-radius: 10px; object-fit: cover; }
.login-brand strong, .login-brand small { display: block; }
.login-brand small { color: #8E98A6; font-size: 11px; }
.login-command-copy { position: relative; z-index: 3; max-width: 720px; }
.login-visual h1 { max-width: 720px; margin: 9px 0 20px; font-size: clamp(42px,5vw,72px); line-height: .98; letter-spacing: -.055em; }
.login-command-copy > p:last-child { max-width: 560px; color: #AAB3BE; font-size: 16px; line-height: 1.6; }
.login-mascot { position: absolute; z-index: 1; right: clamp(-70px,-3vw,-20px); bottom: 5%; width: min(54vw,620px); opacity: .68; filter: drop-shadow(0 25px 55px rgba(0,0,0,.65)); }
.login-stat-row { position: relative; z-index: 3; display: flex; gap: 9px; }
.login-stat-row span { border: 1px solid rgba(226,182,95,.16); border-radius: 9px; padding: 9px 12px; color: #AAB3BE; font-size: 11px; background: rgba(20,24,30,.72); }
.login-panel { display: grid; place-items: center; padding: 28px; background: #0F1318; }
.login-form { width: min(390px,100%); border: 1px solid #303945; border-radius: 20px; padding: clamp(24px,4vw,38px); background: #171D24; box-shadow: 0 28px 70px rgba(0,0,0,.42); }
.login-form-logo { width: 54px; height: 54px; margin-bottom: 22px; }
.login-kicker { color: #E2B65F !important; }
.login-form h2 { margin: 0; font-size: 26px; }
.login-form > p { margin: 7px 0 25px; color: #AAB3BE; }
.login-form label { margin-bottom: 14px; color: #AAB3BE; }
.login-form input { color: #F7F7F8; border-color: #3B4654; background: #10151B; }
.login-form input:focus { border-color: #E2B65F; box-shadow: 0 0 0 3px rgba(226,182,95,.16); }
.login-form .remember-login { display: flex; align-items: center; gap: 9px; }
.login-form .remember-login input { width: 18px; min-height: 18px; height: 18px; margin: 0; accent-color: #E2B65F; }
.login-form .button.primary { width: 100%; margin-top: 8px; color: #221A0C; background: #E2B65F; }

@keyframes record-pulse { 50% { opacity: .72; } }

@media (min-width: 1440px) { .app-main { padding-inline: 36px; } }
@media (max-width: 1023px) {
  .app-sidebar { transform: translateX(-102%); transition: transform var(--motion-slow); }
  .sidebar-open .app-sidebar { transform: translateX(0); }
  .sidebar-open .sidebar-scrim { position: fixed; z-index: 35; inset: 0; display: block; background: var(--sova-overlay); }
  .mobile-header { position: sticky; z-index: 30; top: 0; display: flex; height: 62px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--sova-line-soft); padding: 0 12px; background: rgba(255,255,255,.92); backdrop-filter: blur(18px); }
  .mobile-brand { display: flex; align-items: center; gap: 7px; font-weight: 750; }
  .mobile-brand img { width: 31px; height: 31px; border-radius: 9px; }
  .app-main { margin: 0; padding: 18px 16px 94px; }
  .desktop-toolbar { display: none; }
  .mobile-nav { position: fixed; z-index: 32; inset: auto 0 0; display: grid; height: calc(70px + env(safe-area-inset-bottom)); grid-template-columns: repeat(5,1fr); border-top: 1px solid var(--sova-line-soft); padding: 5px 8px env(safe-area-inset-bottom); background: rgba(255,255,255,.94); backdrop-filter: blur(18px); }
  .mobile-nav a, .mobile-nav button { display: grid; min-width: 0; place-items: center; align-content: center; gap: 2px; color: var(--sova-text-2); background: transparent; }
  .mobile-nav a.active, .mobile-nav button.active { color: var(--sova-accent); }
  .mobile-nav span { display: grid; place-items: center; }
  .mobile-nav small { font-size: 11px; font-weight: 650; }
  .mobile-create span { width: 48px; height: 48px; margin-top: -20px; border-radius: 50%; color: white; background: var(--sova-accent); box-shadow: var(--sova-shadow-md); }
  .notification-panel { top: 70px; right: 12px; }
  .lead-workspace, .client-detail-layout, .collection-editor, .profile-layout, .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; display: flex; overflow-x: auto; }
  .settings-nav a { flex: 0 0 auto; }
  .collections-layout { grid-template-columns: 1fr; }
  .command-grid, .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 767px) {
  .page-heading, .lead-header { align-items: flex-start; flex-direction: column; gap: 14px; }
  .page-heading h1, .lead-header h1 { font-size: 32px; }
  .page-heading-actions, .lead-header-actions { width: 100%; flex-wrap: wrap; }
  .filter-bar, .page-toolbar { align-items: stretch; flex-direction: column; }
  .form-grid, .item-edit-form, .user-settings, .user-settings > form, .tilda-settings { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .button { width: 100%; }
  .sheet { top: auto; right: 0; bottom: 0; left: 0; width: 100%; max-height: 90vh; border-radius: 24px 24px 0 0; padding-bottom: calc(22px + env(safe-area-inset-bottom)); transform: none; }
  .sheet-handle { display: block; width: 42px; height: 5px; margin: -10px auto 12px; border-radius: 3px; background: var(--sova-line); }
  .today-header { margin-top: 10px; }
  .today-focus { align-items: flex-start; flex-direction: column; padding: 21px; }
  .today-focus .button { width: 100%; }
  .today-section > header { align-items: flex-start; flex-direction: column; padding-inline: 16px; }
  .today-list > a { grid-template-columns: auto minmax(0,1fr) auto; padding-inline: 16px; }
  .today-list time { display: none; }
  .today-agenda > div { grid-template-columns: 1fr; gap: 4px; padding-inline: 16px; }
  .mobile-stage-picker { display: grid; gap: 6px; margin-bottom: 14px; }
  .kanban { display: grid; overflow: visible; }
  .kanban-column { min-height: 0; }
  .client-grid { grid-template-columns: 1fr; }
  .lead-sidebar { grid-template-columns: 1fr; }
  .messenger { min-height: 70vh; max-height: none; }
  .message { max-width: 88%; }
  .message-list { padding: 14px 10px; }
  .inbox-layout { min-height: calc(100vh - 170px); grid-template-columns: 1fr; }
  .inbox-layout.has-selection .inbox-list { display: none; }
  .inbox-list { border-right: 0; }
  .inbox-back { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 4px; }
  .collection-drawer { inset-inline: 7px; }
  .editor-items article { grid-template-columns: 96px minmax(0,1fr) auto; }
  .editor-items img, .image-placeholder { width: 96px; height: 96px; }
  .editor-items article { grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
  .editor-items article > .media-carousel, .editor-items article > .image-placeholder { grid-column: 1 / -1; width: 100%; height: 220px; }
  .editor-items article > .media-carousel .carousel-slide img, .editor-items article > .media-carousel .carousel-slide video { object-fit: contain; }
  .stage-settings form { grid-template-columns: auto 1fr; }
  .stage-settings form > .button { grid-column: span 2; }
  .login-shell { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .login-panel { min-height: 100vh; padding: 18px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }
