/* CRM light SaaS visual layer: shared by workspace, registry, analytics and admin. */
:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --panel-muted: #f5f6fa;
  --panel-subtle: #fafbff;
  --line: #e7e9f1;
  --text: #141528;
  --muted: #73768b;
  --blue: #4657f5;
  --blue-dark: #3546df;
  --green: #238c55;
  --shadow: 0 12px 34px rgb(37 45 82 / 7%);
  --radius-control: 12px;
  --radius-panel: 18px;
}

body {
  background: var(--bg);
}

/* Единый вид обычных выпадающих списков во всех разделах CRM. */
select:not([multiple]):not([size]) {
  appearance: none;
  cursor: pointer;
  padding-right: 42px !important;
  border-color: #d9deec !important;
  border-radius: 10px !important;
  background-color: #ffffff !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='m4 6 4 4 4-4' stroke='%236b7280' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 14px center !important;
  background-size: 16px !important;
  box-shadow: 0 1px 2px rgb(37 45 82 / 4%);
  color: var(--text);
  font-weight: 650;
  transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

select:not([multiple]):not([size]):hover:not(:disabled) {
  border-color: #aeb9dc !important;
  background-color: #fbfcff !important;
}

select:not([multiple]):not([size]):focus-visible {
  border-color: var(--blue) !important;
  outline: 3px solid rgb(70 87 245 / 18%) !important;
  outline-offset: 1px;
  box-shadow: 0 0 0 1px rgb(70 87 245 / 12%), 0 3px 10px rgb(37 45 82 / 8%);
}

select:not([multiple]):not([size]):disabled {
  cursor: not-allowed;
  color: #9aa3b5;
  background-color: #f3f5f9 !important;
  opacity: 1;
}

.crm-select-native { position: absolute !important; width: 1px !important; height: 1px !important; margin: -1px !important; padding: 0 !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; border: 0 !important; }
.crm-select { position: relative; display: inline-block; min-width: 148px; vertical-align: middle; }
.crm-select-trigger { display: flex; width: 100%; min-height: 42px; align-items: center; justify-content: space-between; gap: 12px; padding: 0 13px; border: 1px solid #d8dce7; border-radius: 7px; color: #363946; background: linear-gradient(180deg, #fff, #fafbfc); box-shadow: 0 1px 2px rgb(20 25 42 / 10%); font: inherit; font-weight: 650; line-height: 1.2; text-align: left; transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease; }
.crm-select-trigger::after { flex: 0 0 auto; width: 0; height: 0; border-top: 7px solid #3e4149; border-right: 5px solid transparent; border-left: 5px solid transparent; content: ''; transition: transform 180ms ease; }
.crm-select-trigger:hover:not(:disabled) { border-color: #b9c1d2; background: #fff; }
.crm-select-trigger:focus-visible { border-color: var(--blue); outline: 3px solid rgb(70 87 245 / 18%); outline-offset: 1px; box-shadow: 0 3px 10px rgb(37 45 82 / 11%); }
.crm-select.is-open .crm-select-trigger { border-color: var(--blue); background: #fff; }
.crm-select.is-open .crm-select-trigger::after { transform: rotate(180deg); }
.crm-select-trigger:disabled { cursor: not-allowed; color: #9aa3b5; background: #f3f5f9; }
.crm-select .crm-select-menu { position: absolute; z-index: 90; top: calc(100% + 10px); left: 0; display: none !important; width: max(100%, 180px); max-height: 264px; overflow: auto; padding: 6px 0; border: 1px solid #e0e3ea; border-radius: 5px; background: #fff; box-shadow: 0 16px 30px rgb(24 31 48 / 24%); }
.crm-select.is-open .crm-select-menu { display: grid !important; }
.crm-select-option { display: flex; width: 100%; min-height: 46px; align-items: center; justify-content: space-between; padding: 0 18px; border: 0; color: #363946; background: #fff; font: inherit; font-weight: 600; line-height: 1.2; text-align: left; }
.crm-select-option:hover:not(:disabled), .crm-select-option:focus-visible { outline: 0; background: #f2f5fb; }
.crm-select-option.is-selected { color: #fff; background: var(--blue); }
.crm-select-option.is-selected::after { content: '✓'; font-size: 21px; font-weight: 800; }
.crm-select-option:disabled { cursor: not-allowed; color: #b3b8c5; }
label .crm-select { width: 100%; }
.calendar-filters .crm-select { width: auto; min-width: 142px; }
label:has(> .crm-select) { gap: 10px !important; }
.calendar-filters { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.calendar-filters label { display: inline-flex; align-items: center; gap: 10px !important; white-space: nowrap; }

.customer-search { display: flex; gap: 10px; }
.customer-search input { min-width: 0; flex: 1; }
.customer-picker-button { flex: 0 0 auto; min-height: 44px; padding: 0 14px; border: 1px solid var(--blue); border-radius: 8px; color: #ffffff; background: var(--blue); font: inherit; font-size: 13px; font-weight: 800; }
.customer-picker-button:hover, .customer-picker-button:focus-visible { background: var(--blue-dark); }
.customer-picker { position: fixed; z-index: 210; inset: 0; display: grid; place-items: center; padding: 16px; background: rgb(20 25 42 / 48%); }
.customer-picker[hidden] { display: none; }
.customer-picker-card { display: grid; width: min(720px, 100%); max-height: min(680px, calc(100dvh - 32px)); gap: 14px; padding: 20px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #ffffff; box-shadow: 0 28px 80px rgb(16 24 40 / 32%); }
.customer-picker-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.customer-picker-card h2 { margin: 3px 0 0; font-size: 21px; }
.customer-picker-card > label { display: grid; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 800; }
.customer-picker-card > label input { min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--text); font: inherit; }
.customer-picker-list { display: grid; gap: 6px; overflow: auto; }
.customer-picker-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; width: 100%; padding: 12px 14px; border: 1px solid #e2e6f0; border-radius: 10px; color: var(--text); background: #ffffff; font: inherit; text-align: left; }
.customer-picker-row:hover, .customer-picker-row:focus-visible { border-color: #aebcf9; outline: 0; background: #f4f6ff; }
.customer-picker-row strong { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.customer-picker-row span { color: var(--muted); font-size: 13px; }
.customer-picker-row small { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
.customer-picker-empty { margin: 0; padding: 20px; color: var(--muted); text-align: center; }
.booking-release-action { min-height: 44px; margin-right: auto; padding: 0 14px; border: 1px solid #efb6bd; border-radius: 8px; color: #b42332; background: #fff; font: inherit; font-size: 13px; font-weight: 800; }
.booking-release-action:hover, .booking-release-action:focus-visible { border-color: #d84f5d; outline: 0; background: #fff1f2; }

@media (prefers-reduced-motion: reduce) {
  select:not([multiple]):not([size]) {
    transition: none;
  }

  .crm-select-trigger, .crm-select-trigger::after { transition: none; }
}

.global-app-bar {
  min-height: 68px;
  padding: 10px 24px;
  border-color: var(--line);
  background: rgb(255 255 255 / 92%);
  box-shadow: 0 2px 16px rgb(37 45 82 / 4%);
}

.global-app-brand-mark {
  border-radius: 11px;
  background: url("assets/ai-crm-manager-full.svg?v=20260816-message-icon-1") center / contain no-repeat;
}

.global-primary-nav a,
.global-widget-toggle,
.global-settings-toggle,
.global-today-widget {
  border-radius: 12px;
}

.global-primary-nav a[aria-current='page'],
.global-primary-nav a:hover {
  color: #ffffff;
  background: var(--blue);
}

.global-widget-toggle,
.global-settings-toggle {
  border-color: var(--line);
  color: var(--blue-dark);
  box-shadow: 0 2px 6px rgb(37 45 82 / 4%);
}

.app-shell,
.admin-shell {
  padding: 20px 24px 24px;
  gap: 18px;
}

.sidebar,
.chat-panel,
.leads-panel,
.admin-sidebar,
.admin-content,
.panel,
.lead-table-surface,
.lead-table-filters,
.analytics-panel {
  border-color: var(--line);
  border-radius: var(--radius-panel);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.sidebar,
.leads-panel,
.chat-panel {
  border-radius: var(--radius-panel);
}

.chat-panel {
  background: var(--panel-subtle);
}

.sidebar-header,
.leads-header,
.chat-header,
.lead-filters,
.topbar,
.brand-block {
  border-color: var(--line);
  background: transparent;
}

.sidebar-header,
.leads-header {
  min-height: 76px;
  padding: 18px 20px;
}

.eyebrow,
.lead-table-eyebrow {
  color: #8b8ea1;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .09em;
}

.panel-title,
.leads-header .panel-title {
  color: var(--text);
  font-size: 18px;
  font-weight: 850;
  letter-spacing: .02em;
}

.search-box {
  margin: 16px;
  border: 1px solid transparent;
  background: var(--panel-muted);
}

.search-box:focus-within {
  border-color: #b9c0ff;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgb(70 87 245 / 12%);
}

.tabs,
.lead-filter-tabs {
  gap: 8px;
}

.tab,
.lead-filter {
  border-radius: 10px;
  background: var(--panel-muted);
}

.tab.active,
.lead-filter.active {
  color: var(--blue-dark);
  background: #edf0ff;
}

.conversation {
  min-height: 76px;
  margin: 2px 0;
  border-radius: 14px;
}

.conversation:hover {
  background: #f2f4ff;
}

.conversation.active {
  background: linear-gradient(135deg, #5362f7, #3e4ee5);
  box-shadow: 0 8px 18px rgb(70 87 245 / 20%);
}

.lead-queue {
  padding: 16px;
  background: #fafbfe;
}

.lead-board {
  gap: 16px;
}

.lead-column {
  min-height: 240px;
  padding: 14px;
  border-color: var(--line);
  border-radius: 16px;
  background: #f8f9fd;
}

.lead-column-header {
  margin-bottom: 14px;
}

.lead-column-header strong {
  min-width: 28px;
  height: 28px;
  border-color: var(--line);
  border-radius: 9px;
  background: #ffffff;
}
.lead-status-guidance { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; font-weight: 700; line-height: 1.35; }

.lead-column-list {
  gap: 14px;
}

/* Desktop workspace: keep the complete CRM funnel visible beside the dialog. */
@media (min-width: 1024px) {
  .app-shell {
    grid-template-columns: minmax(216px, 1.85fr) minmax(300px, 2.45fr) minmax(0, 5.7fr);
    gap: 14px;
  }

  .lead-queue {
    padding: 12px;
  }

  .lead-board {
    grid-template-columns: repeat(var(--lead-board-column-count), minmax(0, 1fr));
    gap: 10px;
  }

  .lead-column {
    padding: 10px;
  }

  .lead-column-header {
    gap: 5px;
    margin-bottom: 10px;
  }

  .lead-column-header h3 {
    gap: 5px;
    font-size: 12px;
  }

  .lead-column-list {
    gap: 10px;
  }

  .lead-card {
    gap: 7px;
    min-height: 190px;
    padding: 10px;
  }
}

.lead-card {
  min-height: 196px;
  gap: 10px;
  padding: 14px;
  border-color: #eceef5;
  border-radius: 14px;
  box-shadow: 0 4px 12px rgb(37 45 82 / 4%);
}

.lead-card:hover,
.lead-card.active {
  border-color: #bbc2ff;
  box-shadow: 0 12px 24px rgb(37 45 82 / 10%);
}

.lead-card.is-new,
.lead-card.is-new:hover,
.lead-card.is-new.active {
  box-shadow: inset 4px 0 0 #f6af38, 0 4px 12px rgb(37 45 82 / 4%);
}

.lead-card.is-qualified,
.lead-card.is-qualified:hover,
.lead-card.is-qualified.active {
  box-shadow: inset 4px 0 0 var(--status-success-accent), 0 4px 12px rgb(37 45 82 / 4%);
}

.lead-card-details {
  min-height: 92px;
  border-color: var(--line);
}

.chat-header {
  min-height: 70px;
  padding: 14px 18px;
  background: #ffffff;
}

.message-list {
  gap: 12px;
  padding: 24px;
  background: #fbfcff;
}

.message {
  border: 1px solid #eef0f6;
  border-radius: 16px 16px 16px 5px;
  box-shadow: 0 4px 14px rgb(37 45 82 / 5%);
}

.message.mine {
  border-color: #dce1ff;
  border-radius: 16px 16px 5px 16px;
  background: #eef0ff;
}

.composer {
  margin: 0 16px 16px;
  border-color: var(--line);
  border-radius: 16px;
  box-shadow: 0 8px 22px rgb(37 45 82 / 7%);
}

.send-button,
.create-lead-button,
.lead-preview-primary,
.lead-quick-edit-actions button {
  background: var(--blue);
}

.send-button:hover,
.create-lead-button:hover:not(:disabled),
.lead-preview-primary:hover,
.lead-quick-edit-actions button:hover {
  background: var(--blue-dark);
}

.lead-table-page {
  width: 100%;
  max-width: none;
}

.analytics-shell {
  width: min(1440px, calc(100% - 48px));
}

.lead-table-header h1,
.analytics-page-header h1 {
  font-size: 28px;
  letter-spacing: -.03em;
}

.lead-table-filters,
.lead-table-surface,
.lead-preview-dialog,
.lead-preview-card {
  border-radius: var(--radius-panel);
}

.lead-table th {
  color: #888ca0;
  background: #fafbfe;
}

.lead-table tbody tr:hover,
.lead-table tbody tr:focus-visible {
  background: #f5f6ff;
}

.analytics-page .analytics-panel,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
}

.analytics-kpi,
.analytics-card {
  border-color: var(--line);
  border-radius: 16px;
  background: var(--panel-subtle);
  box-shadow: none;
}

.analytics-kpi {
  min-height: 124px;
  padding: 18px;
}

.analytics-kpi strong {
  color: var(--text);
  font-size: 28px;
  letter-spacing: -.04em;
}

.analytics-card {
  padding: 20px;
}

.analytics-bar-track {
  height: 8px;
  border-radius: 999px;
  background: #e9edfb;
}

.analytics-bar-track span {
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), #62b4ef);
}

.admin-shell {
  grid-template-columns: 264px minmax(0, 1fr);
}

.section-nav {
  gap: 5px;
  padding: 16px;
}

.section-link {
  border-radius: 12px;
}

.section-link:hover,
.section-link.active,
.channel-option.active {
  color: var(--blue-dark);
  background: #edf0ff;
}

.channel-option {
  border-radius: 12px 12px 0 0;
}

.topbar {
  padding: 20px 24px;
}

@media (max-width: 1023px) {
  .app-shell,
  .admin-shell { padding: 0; gap: 0; }

  .admin-shell { grid-template-columns: minmax(0, 1fr); }

  .sidebar,
  .chat-panel,
  .leads-panel,
  .admin-sidebar,
  .admin-content { border-radius: 0; }
}

@media (max-width: 760px) {
  .lead-table-page,
  .analytics-shell { width: min(100% - 24px, 1440px); }
  .lead-table-header h1,
  .analytics-page-header h1 { font-size: 24px; }
}
