  :root {
    --bg-primary: #ffffff;
    --bg-secondary: #f4f8ff;
    --bg-tertiary: #e8efff;
    --text-primary: #15203a;
    --text-secondary: #5b6e96;
    --text-tertiary: #8ea0c4;
    --text-info: #2552d6;
    --border-tertiary: rgba(56, 92, 176, 0.16);
    --border-secondary: rgba(33, 65, 140, 0.28);
    --border-radius-md: 14px;
    --border-radius-lg: 22px;
    --color-background-info: #e6efff;
  }
  * { box-sizing: border-box; }
  body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background:
      radial-gradient(900px 420px at 7% -8%, rgba(88, 125, 255, 0.22), transparent 66%),
      radial-gradient(880px 420px at 95% -12%, rgba(48, 195, 242, 0.18), transparent 62%),
      linear-gradient(180deg, #f6f9ff 0%, #edf3ff 46%, #e8f0ff 100%);
    background-size: 130% 130%, 120% 120%, 100% 100%;
    animation: none;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
    padding: 30px 0 36px;
    position: relative;
    overflow-x: hidden;
  }
  body::before,
  body::after {
    content: "";
    position: fixed;
    border-radius: 50%;
    filter: blur(54px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.72;
  }
  body::before {
    width: 640px;
    height: 640px;
    left: -210px;
    top: -190px;
    background: radial-gradient(circle, rgba(65, 120, 255, 0.55) 0%, rgba(65,120,255,0) 68%);
    animation: none;
  }
  body::after {
    width: 700px;
    height: 700px;
    right: -260px;
    top: 30%;
    background: radial-gradient(circle, rgba(58, 210, 255, 0.48) 0%, rgba(58,210,255,0) 70%);
    animation: none;
  }
  body > .bg-mesh {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.45;
    background:
      linear-gradient(120deg, rgba(255,255,255,0.35), rgba(255,255,255,0) 35%),
      repeating-linear-gradient(
        135deg,
        rgba(78, 121, 255, 0.14) 0px,
        rgba(78, 121, 255, 0.14) 1px,
        transparent 1px,
        transparent 22px
      );
    background-size: 170% 170%, 240px 240px;
    animation: none;
  }
  .container { max-width: 1920px; margin: 0 auto; padding: 0 20px; position: relative; z-index: 1; width: 100%; }
  input, select, button, textarea { font-family: inherit; }
  input[type="text"], input[type="date"], select, textarea {
    border: 1px solid var(--border-tertiary);
    border-radius: var(--border-radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  }
  input[type="text"]:focus, select:focus, textarea:focus { border-color: #3c6dff; box-shadow: 0 0 0 4px rgba(60,109,255,0.18); }

  .row {
    display: grid;
    grid-template-columns: minmax(172px, 1.45fr) 128px minmax(0, 1fr) 100px 120px;
    gap: 12px;
    padding: 13px 16px;
    border-top: 1px solid var(--border-tertiary);
    align-items: start;
    font-size: 13px;
    transition: background 0.25s;
  }
  .row > * { min-width: 0; max-width: 100%; }
  .row > :first-child,
  .row > :nth-child(2) { min-width: auto; max-width: none; overflow: visible; }
  .row:hover { background: #eef4ff; }
  .row:hover .pencil-btn { opacity: 1; }
  .row.highlight { background: #fff2dc !important; }
  .row.fresh { background: #e6f9ef !important; }

  .phone-cell {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 5px;
    min-width: 0;
  }
  .phone-cell .phone-btn {
    flex: 0 0 100%;
    width: 100%;
    min-width: 0;
    background: none;
    border: none;
    padding: 0;
    color: #2f5bf6;
    cursor: pointer;
    font-weight: 650;
    font-size: 13px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    text-align: left;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
  }
  .phone-btn:hover { text-decoration: underline; }
  .phone-copy-btn {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border: 1px solid rgba(47, 91, 246, 0.24);
    border-radius: 6px;
    background: #f4f8ff;
    color: #2f5bf6;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 12px;
    opacity: 0.85;
  }
  .phone-copy-btn:hover { opacity: 1; background: #eaf1ff; }
  .phone-wa-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 8px;
    background: #dcf8e8;
    color: #12843a;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 15px;
    padding: 0;
  }
  .phone-wa-btn:hover { background: #c4f0d4; }
  .wa-line-pick {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
  }
  .wa-line-pick--compact { margin-left: 2px; }
  .wa-line-pick-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
  }
  .wa-line-pick-label {
    font-size: 12px;
    font-weight: 650;
    color: #334155;
  }
  .wa-line-btn {
    min-width: 28px;
    height: 26px;
    padding: 0 8px;
    border: 1.5px solid #cbd5e1;
    border-radius: 7px;
    background: #fff;
    color: #334155;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
  }
  .wa-line-btn:hover { background: #f1f5f9; border-color: #94a3b8; }
  .wa-line-btn.active {
    background: #12843a;
    border-color: #12843a;
    color: #fff;
  }
  .wa-line-pick--compact .wa-line-btn {
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    font-size: 11px;
  }
  .wa-line-card-pick .wa-line-pick { margin-top: 6px; }
  .wa-line-hint {
    margin: 8px 0 0;
    font-size: 11px;
    color: #64748b;
  }
  .wa-chat-empty--setup {
    flex-direction: column;
    text-align: center;
    padding: 24px 16px;
    line-height: 1.5;
  }
  .wa-fallback-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 8px 14px;
    border-radius: 10px;
    background: #dcf8e8;
    color: #12843a;
    font-weight: 600;
    text-decoration: none;
  }
  .wa-fallback-link:hover { background: #c4f0d4; }
  .cal-card .phone-cell { min-width: 0; }

  .status-pill { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 650; white-space: nowrap; max-width: 100%; }
  .mgr-badge { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; font-size: 11px; font-weight: 500; margin-left: auto; }
  .comment-cell { display: flex; align-items: flex-start; gap: 6px; min-width: 0; overflow: hidden; }
  .comment-cell .pencil-btn { flex-shrink: 0; margin-top: 1px; }
  .date-cell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .comment-text-block { flex: 1; min-width: 0; overflow: hidden; }
  .last-comment {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.35;
    overflow: hidden;
    word-break: break-word;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }
  .comment-date-line {
    display: block;
    margin-top: 2px;
    font-size: 10px;
    color: var(--text-tertiary);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .pencil-btn { background: transparent; border: none; cursor: pointer; padding: 5px; border-radius: 6px; color: var(--text-tertiary); opacity: 0.4; transition: opacity 0.15s, background 0.15s; flex-shrink: 0; }
  .pencil-btn:hover { background: var(--bg-secondary); color: var(--text-info); opacity: 1; }
  .pencil-btn.active { opacity: 1; color: var(--text-info); background: var(--color-background-info); }
  .quick-comment-input { width: 100%; height: 28px; font-size: 12px; padding: 0 8px; flex: 1; }
  .date-cell { font-size: 11px; color: var(--text-secondary); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

  .status-option { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--border-radius-md); cursor: pointer; font-size: 12px; white-space: nowrap; }
  .status-option:hover { background: var(--bg-secondary); }
  .status-option.selected { background: var(--color-background-info); }

  .table-head {
    display: grid;
    grid-template-columns: minmax(172px, 1.45fr) 128px minmax(0, 1fr) 100px 120px;
    gap: 12px;
    padding: 10px 16px;
    background: var(--bg-secondary);
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 500;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 5;
    overflow: visible;
  }
  .status-filter-cell { position: relative; overflow: visible; }
  #status-header-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: inherit;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    max-width: 100%;
  }
  #status-dropdown {
    display: none;
    position: fixed;
    background: var(--bg-primary);
    border: 0.5px solid var(--border-secondary);
    border-radius: var(--border-radius-md);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
    padding: 4px;
    z-index: 12000;
    min-width: 188px;
    max-height: min(360px, 70vh);
    overflow-x: hidden;
    overflow-y: auto;
  }

  .cal-card { background: white; border-radius: var(--border-radius-md); padding: 9px 10px; display: grid; grid-template-columns: 75px 130px 1fr 30px; gap: 10px; align-items: center; font-size: 12px; margin-bottom: 6px; border: 1px solid rgba(94, 135, 255, 0.24); }
  .cal-card:last-child { margin-bottom: 0; }
  .cal-datetime { color: #5d4a22; font-family: ui-monospace, monospace; font-size: 10px; line-height: 1.2; }
  .cal-datetime .time { font-weight: 500; font-size: 13px; display: block; }
  .cal-name { font-weight: 500; }

  .modal-overlay { position: fixed; inset: 0; background: rgba(17,24,39,0.35); display: flex; align-items: flex-start; justify-content: center; z-index: 100; padding: 40px 20px; overflow-y: auto; }
  .modal-card { background: var(--bg-primary); border-radius: var(--border-radius-lg); width: 460px; max-width: 100%; border: 1px solid var(--border-tertiary); box-shadow: 0 18px 42px rgba(23, 32, 51, 0.22); }
  .modal-card--wa { width: min(920px, 96vw); }
  .modal-tabs-row {
    display: flex;
    gap: 8px;
    padding-top: 0;
  }
  .modal-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid var(--border-tertiary);
    background: #fff;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
  }
  .modal-tab-btn.active {
    background: #e8f5ec;
    border-color: rgba(37, 161, 72, 0.45);
    color: #12843a;
  }
  .modal-wa-panel { padding-top: 10px; }
  .wa-channel-pick {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 12px;
    color: var(--text-secondary);
  }
  .wa-channel-pick select {
    min-width: 220px;
    height: 32px;
  }
  .wa-chat-host { min-height: 520px; }
  .wa-chat-iframe {
    width: 100%;
    height: min(68vh, 620px);
    border: 1px solid var(--border-tertiary);
    border-radius: 12px;
    background: #f8fafc;
  }
  .wa-chat-loading,
  .wa-chat-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    color: var(--text-secondary);
    font-size: 13px;
    gap: 8px;
  }
  .wa-chat-hint {
    margin: 10px 0 0;
    font-size: 11px;
    color: var(--text-tertiary);
  }
  .modal-section { padding: 15px 20px; border-bottom: 1px solid var(--border-tertiary); }
  .field-label { color: var(--text-secondary); font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; font-weight: 500; }
  .field-input { width: 100%; height: 32px; font-size: 13px; padding: 0 8px; }

  .tranche-card { border-radius: var(--border-radius-md); padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; background: var(--bg-secondary); border: 0.5px solid var(--border-tertiary); transition: all 0.15s; }
  .tranche-card:hover { border-color: #3a3a3a; }
  .tranche-card .amount { font-size: 13px; font-weight: 500; font-family: ui-monospace, monospace; display: flex; align-items: center; justify-content: space-between; }
  .tranche-amount-wrap { display: inline-flex; align-items: center; gap: 3px; }
  .tranche-amount-input {
    width: 72px;
    height: 22px;
    border: 0.5px solid var(--border-tertiary);
    border-radius: 6px;
    padding: 0 6px;
    font-size: 12px;
    font-family: ui-monospace, monospace;
    background: rgba(255,255,255,0.88);
    color: var(--text-primary);
  }
  .tranche-card .check-icon { font-size: 14px; opacity: 0; transition: opacity 0.2s; }
  .tranche-card.paid { background: #2c2c2c; border-color: #1a1a1a; }
  .tranche-card.paid .amount, .tranche-card.paid .label, .tranche-card.paid .check-icon { color: white; }
  .tranche-card.paid .tranche-amount-input { color: white; border-color: rgba(255,255,255,0.42); background: rgba(255,255,255,0.1); }
  .tranche-card.paid .check-icon { opacity: 1; }
  .tranche-card.paid .deadline-input { color: white; border-color: rgba(255,255,255,0.4); background: rgba(255,255,255,0.1); }
  .tranche-card .label { font-size: 9px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-tertiary); }
  .deadline-input { height: 24px; font-size: 11px; padding: 0 4px; border: 0.5px solid var(--border-tertiary); border-radius: 4px; background: transparent; color: inherit; }
  .comment-history-item { padding: 8px 0; border-bottom: 0.5px solid var(--border-tertiary); }
  .comment-history-item:last-child { border-bottom: none; }

  .leads-table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 4px;
    padding: 8px 4px 0;
  }
  .leads-table-toolbar__title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #24458f;
  }
  .filters-btn--excel {
    background: #e8f0ff;
    border-color: rgba(47, 91, 246, 0.35);
    color: #1f4fd6;
    font-weight: 600;
  }
  .filters-btn--excel:hover {
    background: #d9e6ff;
    border-color: rgba(47, 91, 246, 0.55);
  }
  .table-wrap {
    background: var(--bg-primary);
    border: 1px solid var(--border-tertiary);
    border-radius: var(--border-radius-lg);
    overflow: visible;
    position: relative;
    box-shadow: 0 10px 26px rgba(27, 39, 62, 0.08);
    margin-top: 8px;
  }
  .table-wrap #table-body {
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
    overflow-x: hidden;
  }
  .table-wrap::-webkit-scrollbar { width: 8px; }
  #table-body { max-height: 560px; overflow-y: auto; }
  #table-body .virtual-spacer { width: 100%; pointer-events: none; }
  #table-body .virtual-viewport { will-change: transform; contain: layout paint; }
  .auth-wrap { min-height: calc(100vh - 48px); display: flex; align-items: center; justify-content: center; }
  .auth-card { width: 400px; max-width: 100%; background: var(--bg-primary); border: 1px solid var(--border-tertiary); border-radius: var(--border-radius-lg); padding: 22px; box-shadow: 0 16px 36px rgba(15, 23, 42, 0.12); }
  .auth-card h2 { margin: 0 0 12px; font-size: 20px; }
  .auth-card .hint { margin: 0 0 14px; font-size: 12px; color: var(--text-secondary); }
  .auth-row { margin-bottom: 10px; }
  .auth-row input { width: 100%; height: 36px; padding: 0 10px; font-size: 13px; }
  .auth-error { min-height: 18px; color: #b53939; font-size: 12px; margin-bottom: 8px; }
  .admin-list-item { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; padding: 9px 11px; border: 1px solid var(--border-tertiary); border-radius: 10px; margin-bottom: 7px; }
  .admin-list-item:last-child { margin-bottom: 0; }
  .user-toolbar { display:flex; align-items:center; gap:8px; font-size:12px; color:var(--text-secondary); background:var(--bg-primary); border:1px solid var(--border-tertiary); border-radius:12px; padding:7px 9px; box-shadow: 0 6px 16px rgba(22, 32, 50, 0.06); }
  .user-chip { display:inline-flex; align-items:center; gap:6px; padding:0 8px; height:30px; border-radius:8px; background:var(--bg-secondary); font-size:11px; color:var(--text-secondary); }
  .toolbar-btn { height:30px; padding:0 12px; border-radius:8px; border:1px solid var(--border-tertiary); background:var(--bg-primary); color:var(--text-secondary); font-size:12px; cursor:pointer; display:inline-flex; align-items:center; gap:6px; transition:all .15s ease; }
  .toolbar-btn:hover { background:var(--bg-secondary); transform:translateY(-1px); }
  .toolbar-btn.logout { background:#ffe9e9; border-color:#f9caca; color:#9f2b2b; font-weight:600; }
  .toolbar-btn.logout:hover { background:#ffdede; }
  .fun-bank-chip {
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    border-radius: 10px;
    border: 1px solid rgba(47, 91, 246, 0.25);
    background: linear-gradient(180deg, #f4f8ff 0%, #eaf2ff 100%);
    color: #1f4fb6;
    font-size: 12px;
    font-weight: 700;
    padding: 0 10px;
    margin-bottom: 8px;
  }
  .fun-bank-chip small {
    opacity: 0.8;
    margin-left: 6px;
    font-weight: 600;
  }
  .fun-sticker-pack {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    padding: 8px;
    border: 1px solid rgba(102, 133, 246, 0.2);
    border-radius: 10px;
    background: #fff;
  }
  .fun-sticker-chip {
    height: 30px;
    border-radius: 8px;
    border: 1px solid rgba(102, 133, 246, 0.18);
    background-color: #f6f9ff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
  }
  .fun-sticker-chip img,
  .fun-sticker-chip video {
    width: 26px;
    height: 26px;
    object-fit: contain;
    display: block;
  }
  .fun-cat-floating {
    position: fixed;
    z-index: 700;
    min-width: auto;
    height: auto;
    border-radius: 0;
    border: none;
    background: transparent;
    color: #7a4b00;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: none;
    animation: funCatBounce 1.2s ease-in-out infinite;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0;
  }
  .fun-cat-floating.gold {
    color: #6b3c00;
  }
  .fun-challenge-line {
    margin: 0 0 10px;
    border: 1px dashed rgba(47, 91, 246, 0.35);
    border-radius: 10px;
    background: #f9fbff;
    color: #335187;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 600;
  }
  .fun-cat-floating:hover { transform: scale(1.04); }
  .fun-cat-sticker-frame {
    width: auto;
    height: auto;
    border-radius: 0;
    border: none;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: none;
  }
  .fun-cat-icon {
    width: 86px;
    height: 86px;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 6px 10px rgba(0,0,0,0.35));
  }
  .fun-cat-reward {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 0.01em;
    color: #f7b931;
    line-height: 1;
    text-shadow: 0 2px 6px rgba(0,0,0,0.42);
  }
  .meme-shop-wrap {
    margin-bottom: 12px;
    background: #f9fbff;
  }
  .meme-shop-wrap .analytics-section-toggle span {
    font-weight: 700;
    color: #1f3c79;
  }
  .meme-shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
  }
  .meme-shop-card {
    text-align: left;
    border: 1px solid rgba(47, 91, 246, 0.22);
    border-radius: 12px;
    background: linear-gradient(180deg, #ffffff 0%, #f6f9ff 100%);
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    min-height: 106px;
    cursor: pointer;
    white-space: normal;
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
  }
  .meme-shop-card:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: rgba(47, 91, 246, 0.45);
    box-shadow: 0 8px 16px rgba(37, 80, 188, 0.16);
  }
  .meme-shop-card:disabled {
    opacity: 0.62;
    filter: grayscale(0.15);
    cursor: not-allowed;
    box-shadow: none;
  }
  .meme-shop-title { font-weight: 700; color: #1f3c79; font-size: 13px; line-height: 1.2; }
  .meme-shop-desc { color: #5b6f95; font-size: 12px; line-height: 1.3; min-height: 32px; }
  .meme-shop-price {
    margin-top: auto;
    color: #0d6b3c;
    font-size: 12px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 999px;
    background: #eaf8ef;
    border: 1px solid #c9ecd7;
  }
  .meme-shop-card--mega {
    border-color: rgba(255, 140, 0, 0.5);
    background: linear-gradient(180deg, #fff9ef 0%, #fff2db 100%);
    box-shadow: 0 8px 18px rgba(255, 163, 51, 0.18);
  }
  .meme-shop-title--mega {
    background: linear-gradient(90deg, #ff7a00 0%, #ff2d95 35%, #7c4dff 70%, #00b3ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: megaPrizeShine 2.4s linear infinite;
    background-size: 220% 220%;
    font-weight: 800;
  }
  @keyframes megaPrizeShine {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
  }
  @keyframes funCatBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
  }
  #crm-root { position: relative; display: flex; flex-direction: column; gap: 34px; }
  #crm-shell {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
    width: 100%;
  }
  #crm-sidebar {
    position: sticky;
    top: 18px;
    background: rgba(255,255,255,0.86);
    border: 1px solid rgba(121, 153, 255, 0.24);
    border-radius: 18px;
    padding: 14px;
    backdrop-filter: blur(10px);
    box-shadow: 0 14px 28px rgba(49, 85, 170, 0.14);
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .sidebar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: #21396f;
    font-size: 14px;
  }
  .sidebar-brand i { font-size: 18px; color: var(--text-secondary); }
  .sidebar-user { width: 100%; justify-content: flex-start; }
  .sidebar-actions { display: grid; gap: 8px; }
  .sidebar-btn { width: 100%; justify-content: center; }
  .sidebar-nav {
    border-top: 1px solid var(--border-tertiary);
    padding-top: 10px;
    display: grid;
    gap: 6px;
  }
  .side-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 12px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid transparent;
    transition: all .15s ease;
  }
  .side-nav-link:hover {
    background: var(--bg-secondary);
    color: #24458f;
    border-color: var(--border-tertiary);
    transform: translateY(-1px);
  }
  .side-nav-link.is-active {
    background: #e8f0ff;
    color: #1f4fd6;
    border-color: rgba(47, 91, 246, 0.45);
    font-weight: 600;
  }
  #crm-content {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
  }
  #crm-root::before {
    content: "";
    position: absolute;
    inset: -170px -140px auto -140px;
    height: 320px;
    background:
      radial-gradient(circle at 72% 52%, rgba(92, 131, 255, 0.24), transparent 62%),
      radial-gradient(circle at 28% 38%, rgba(38, 196, 237, 0.22), transparent 58%);
    pointer-events: none;
    z-index: 0;
    animation: topGlowShift 14s ease-in-out infinite alternate;
  }
  #crm-root > * { position: relative; z-index: 1; margin-bottom: 0 !important; }
  #crm-topbar,
  #crm-main-layout,
  #crm-calendly-block,
  #crm-filters-bar,
  .table-wrap {
    box-shadow: 0 14px 28px rgba(49, 85, 170, 0.14);
  }
  #crm-main-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    align-items: start;
    width: 100%;
    min-width: 0;
  }
  body.crm-view-stats #admin-stats-wrap {
    width: 100%;
    max-width: 100%;
  }
  body.crm-view-stats.analytics-performance-mode #crm-main-layout,
  body.crm-view-stats #crm-main-layout {
    grid-template-columns: 1fr !important;
  }
  #crm-shell > #crm-content {
    min-width: 0;
    width: 100%;
  }
  #crm-content > .table-wrap {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  #crm-right-pane {
    display: flex;
    flex-direction: column;
    gap: 28px;
    min-width: 0;
    width: 100%;
    max-width: 100%;
  }
  #crm-kpi-grid { gap: 22px !important; }
  #crm-calendly-block { padding: 16px 18px !important; }

  /* —— Панель фильтров —— */
  .filters-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f6f9ff 100%);
    border: 1px solid rgba(102, 133, 246, 0.2);
    border-radius: 16px;
    box-shadow: 0 8px 22px rgba(49, 85, 170, 0.1);
  }
  .filters-panel__main {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px 12px;
  }
  .filters-panel__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
  }
  .filters-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 40px;
    padding: 0 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.12s;
    white-space: nowrap;
  }
  .filters-btn i { font-size: 16px; }
  .filters-btn--primary {
    background: #2f5bf6;
    color: #fff;
    box-shadow: 0 4px 14px rgba(47, 91, 246, 0.35);
  }
  .filters-btn--primary:hover {
    background: #2549d4;
    transform: translateY(-1px);
  }
  .filters-btn--ghost {
    background: #fff;
    color: var(--text-secondary);
    border-color: var(--border-tertiary);
  }
  .filters-btn--ghost:hover {
    border-color: rgba(47, 91, 246, 0.35);
    color: #2f5bf6;
  }
  .filters-panel__search {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1 1 220px;
    min-width: 200px;
  }
  .filters-search-icon,
  #search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    color: var(--text-secondary);
    pointer-events: none;
    transition: color 0.2s;
  }
  .filters-panel__search input {
    width: 100%;
    height: 40px;
    padding: 0 12px 0 38px;
    border: 1px solid var(--border-tertiary);
    border-radius: 10px;
    font-size: 13px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    background: #fff;
    box-shadow: inset 0 1px 2px rgba(17, 24, 39, 0.04);
  }
  .filters-panel__search input:focus {
    outline: none;
    border-color: rgba(47, 91, 246, 0.55);
    box-shadow: 0 0 0 3px rgba(47, 91, 246, 0.12);
  }
  .filters-panel__manager {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 0 1 200px;
    min-width: 160px;
  }
  .filters-field-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
  }
  .filters-panel__manager select {
    height: 40px;
    padding: 0 10px;
    border: 1px solid var(--border-tertiary);
    border-radius: 10px;
    font-size: 13px;
    background: #fff;
    cursor: pointer;
  }
  .filters-panel__period {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid rgba(102, 133, 246, 0.12);
  }
  .period-picker {
    flex: 1 1 280px;
    min-width: 0;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid var(--border-tertiary);
    border-radius: 12px;
  }
  .period-picker__head {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 600;
    color: #3d5080;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  .period-picker__head i {
    font-size: 15px;
    color: #2f5bf6;
  }
  .period-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
  }
  .period-preset-btn {
    height: 26px;
    padding: 0 10px;
    border: 1px solid var(--border-tertiary);
    border-radius: 999px;
    background: #fff;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
  }
  .period-preset-btn:hover {
    border-color: rgba(47, 91, 246, 0.45);
    color: #2f5bf6;
    background: #f4f7ff;
  }
  .period-preset-btn.is-active {
    border-color: #2f5bf6;
    background: #2f5bf6;
    color: #fff;
    box-shadow: 0 4px 12px rgba(47, 91, 246, 0.25);
  }
  .period-picker__fields {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }
  .period-field {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 130px;
    min-width: 0;
    padding: 6px 10px;
    background: #f4f7fc;
    border: 1px solid rgba(102, 133, 246, 0.15);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
  }
  .period-field:hover,
  .period-field:focus-within {
    border-color: rgba(47, 91, 246, 0.45);
    background: #eef3ff;
  }
  .period-field__label {
    font-size: 11px;
    font-weight: 700;
    color: #6b7fa8;
    flex-shrink: 0;
    width: 1.2em;
  }
  .period-field input[type="date"] {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 500;
    color: #1a2d52;
    padding: 0;
    height: 24px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    cursor: pointer;
  }
  .period-field input[type="date"]::-webkit-calendar-picker-indicator {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    opacity: 0;
    cursor: pointer;
  }
  .period-field {
    position: relative;
  }
  .period-field__sep {
    color: var(--text-tertiary);
    font-size: 14px;
    flex-shrink: 0;
    user-select: none;
  }
  .period-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-tertiary);
    border-radius: 10px;
    background: #fff;
    color: var(--text-secondary);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
  }
  .period-clear:hover {
    background: #fff0f0;
    border-color: #f5b8b8;
    color: #c53030;
  }
  .period-clear[hidden] { display: none !important; }
  .period-summary {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    min-width: 140px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #2f5bf6 0%, #4f7dff 100%);
    border-radius: 12px;
    color: #fff;
    box-shadow: 0 6px 18px rgba(47, 91, 246, 0.35);
  }
  .period-summary[hidden] { display: none !important; }
  .period-summary__count {
    display: flex;
    align-items: baseline;
    gap: 6px;
  }
  .period-summary__num {
    font-size: 26px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.02em;
  }
  .period-summary__word {
    font-size: 13px;
    font-weight: 500;
    opacity: 0.92;
  }
  .period-summary__range {
    font-size: 11px;
    opacity: 0.85;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
  }
  .filters-feedback {
    font-size: 12px;
    min-height: 0;
    color: var(--text-secondary);
    padding: 0 2px;
    line-height: 1.5;
  }
  .filters-feedback:empty { display: none; }
  #admin-stats-wrap {
    background: linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%);
    border: 1px solid rgba(102, 133, 246, 0.22);
    border-radius: var(--border-radius-lg);
    padding: 20px;
  }
  .admin-stats-tabs {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
    background: #eef3ff;
    border: 1px solid rgba(102, 133, 246, 0.2);
    border-radius: 12px;
    padding: 4px;
  }
  .admin-tab-btn {
    height: 30px;
    border: none;
    border-radius: 8px;
    padding: 0 12px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s ease;
  }
  .admin-tab-btn.active {
    background: #ffffff;
    color: #1b3f90;
    box-shadow: 0 6px 14px rgba(60, 109, 255, 0.16);
  }
  .analytics-global-toolbar {
    margin: 0 0 8px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    align-items: start;
    padding: 10px 12px;
    border: 1px solid rgba(102, 133, 246, 0.18);
    border-radius: 12px;
    background: linear-gradient(180deg, #f8faff 0%, #f2f6ff 100%);
  }
  .analytics-global-toolbar__label {
    font-size: 11px;
    font-weight: 700;
    color: #395184;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  .period-presets--compact {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .period-presets--compact .period-preset-btn {
    white-space: nowrap;
    height: 24px;
    padding: 0 9px;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .analytics-global-toolbar__dates {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: center;
    gap: 8px;
    width: 100%;
  }
  .analytics-date-field {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 8px;
    border: 1px solid rgba(102, 133, 246, 0.22);
    border-radius: 9px;
    background: #fff;
  }
  .analytics-date-field span {
    font-size: 11px;
    color: #6b7fa8;
    font-weight: 700;
  }
  .analytics-date-field input[type="date"] {
    border: none;
    background: transparent;
    font-size: 12px;
    color: #1a2d52;
    height: 22px;
    min-width: 118px;
    padding: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  }
  .analytics-date-field input[type="date"]:focus {
    outline: none;
  }
  @media (max-width: 900px) {
    .analytics-global-toolbar__label { margin-bottom: 2px; }
  }
  @media (max-width: 560px) {
    .analytics-global-toolbar {
      padding: 9px 10px;
    }
    .period-presets--compact {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 6px;
      width: 100%;
    }
    .period-presets--compact .period-preset-btn {
      width: 100%;
      justify-content: center;
      padding: 0 6px;
      font-size: 10px;
    }
    .analytics-global-toolbar__dates {
      display: grid;
      grid-template-columns: 1fr;
      width: 100%;
    }
    .analytics-date-field {
      width: 100%;
      justify-content: space-between;
      height: 30px;
    }
    .analytics-date-field input[type="date"] {
      min-width: 0;
      width: 100%;
      text-align: right;
    }
  }
  #admin-panel-overview { display: block; }
  .crm-donut-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
  }
  .crm-donut {
    --p1: 0deg;
    --p2: 0deg;
    --p3: 0deg;
    width: 122px;
    height: 122px;
    border-radius: 50%;
    background:
      conic-gradient(
        #1f7cff 0deg var(--p1),
        #27c281 var(--p1) var(--p2),
        #f6a623 var(--p2) var(--p3),
        #d6deef var(--p3) 360deg
      );
    position: relative;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.85), 0 10px 20px rgba(38, 67, 147, 0.16);
    flex-shrink: 0;
  }
  .crm-donut::after {
    content: "";
    position: absolute;
    inset: 17px;
    border-radius: 50%;
    background: #ffffff;
  }
  .crm-donut-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1;
    pointer-events: none;
  }
  .crm-donut-center .total {
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
    color: #1d2f62;
  }
  .crm-donut-center .caption {
    margin-top: 4px;
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }
  .crm-donut-legend {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
  }
  .crm-donut-legend .item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
  }
  .crm-donut-legend .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
  }
  .crm-donut-legend .name {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
  }
  .crm-donut-legend .val {
    color: #21396f;
    font-weight: 600;
  }
  .stat-mini-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 14px;
  }
  .stat-mini-card {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid rgba(102, 133, 246, 0.2);
    border-radius: var(--border-radius-md);
    padding: 12px;
  }
  .stat-mini-card .label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
  }
  .stat-mini-card .value {
    font-size: 20px;
    font-weight: 650;
    color: #1d2f62;
    line-height: 1.1;
  }
  .analytics-scope-hint {
    margin: 0 0 12px;
    padding: 8px 12px;
    border-radius: 10px;
    background: #eef3ff;
    border: 1px solid rgba(102, 133, 246, 0.25);
    font-size: 12px;
    color: #35528f;
    line-height: 1.4;
  }
  .analytics-scope-hint strong { color: #1b3f90; }
  .analytics-kpi-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
  }
  .analytics-kpi-row--wide {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    margin-bottom: 18px;
  }
  .analytics-kpi {
    background: linear-gradient(180deg, #fff 0%, #f8fbff 100%);
    border: 1px solid rgba(102, 133, 246, 0.22);
    border-radius: 12px;
    padding: 12px;
  }
  .analytics-kpi-value {
    font-size: 22px;
    font-weight: 700;
    color: #1d2f62;
    line-height: 1.1;
  }
  .analytics-kpi-label {
    margin-top: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #2a457f;
  }
  .analytics-kpi-hint {
    margin-top: 2px;
    font-size: 10px;
    color: var(--text-tertiary);
    line-height: 1.3;
  }
  .analytics-section { margin-bottom: 14px; }
  .analytics-collapsible .analytics-section-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
    font-size: 13px;
    font-weight: 700;
    color: #1a2d61;
    line-height: 1.3;
  }
  .analytics-collapsible .analytics-section-toggle:hover {
    color: #2f5bf6;
  }
  .analytics-collapsible .analytics-chevron {
    font-size: 16px;
    color: #5b7fd6;
    transition: transform 0.2s ease;
    flex-shrink: 0;
  }
  .analytics-collapsible.is-open .analytics-chevron {
    transform: rotate(90deg);
  }
  .analytics-collapsible:not(.is-open) .analytics-section-body {
    display: none;
  }
  .analytics-collapsible.is-open .analytics-section-body {
    display: block;
    margin-top: 10px;
    padding-top: 2px;
  }
  .analytics-section--card.analytics-collapsible .analytics-section-toggle {
    padding: 0;
  }
  .analytics-section--card.analytics-collapsible.is-open .analytics-section-body {
    border-top: 1px solid rgba(102, 133, 246, 0.15);
    padding-top: 10px;
    margin-top: 8px;
  }
  .analytics-section--card {
    padding: 12px 14px;
    border: 1px solid rgba(102, 133, 246, 0.2);
    border-radius: 12px;
    background: #fff;
  }
  .analytics-section--warn {
    background: #fffaf5;
    border-color: rgba(242, 164, 39, 0.35);
  }
  .analytics-section-title {
    font-size: 13px;
    font-weight: 700;
    color: #1a2d61;
    margin-bottom: 4px;
  }
  .analytics-section-desc {
    margin: 0 0 10px;
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
  }
  .analytics-inline-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 8px;
  }
  .analytics-chip-btn {
    height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    border: 1px solid var(--border-tertiary);
    background: #fff;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s ease;
  }
  .analytics-chip-btn:hover {
    border-color: rgba(47,91,246,.45);
    color: #2f5bf6;
    background: #f5f8ff;
  }
  .analytics-chip-btn.is-active {
    border-color: #2f5bf6;
    color: #fff;
    background: #2f5bf6;
    box-shadow: 0 3px 10px rgba(47,91,246,.24);
  }
  .analytics-plain-summary {
    font-size: 12px;
    color: #35528f;
    line-height: 1.55;
  }
  .analytics-plain-summary p { margin: 0 0 6px; }
  .analytics-highlight-line {
    font-size: 13px;
    font-weight: 600;
    color: #8d5d11;
    margin-bottom: 8px;
  }
  .analytics-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
  }
  .analytics-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
  }
  .analytics-data-table th,
  .analytics-data-table td {
    padding: 7px 8px;
    text-align: left;
    border-bottom: 1px solid #e8eeff;
  }
  .analytics-data-table th {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    font-weight: 600;
  }
  .analytics-data-table tr:last-child td { border-bottom: none; }
  .analytics-data-table .num {
    text-align: right;
    font-weight: 600;
    color: #1d2f62;
    white-space: nowrap;
  }
  .analytics-status-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 12px;
  }
  .analytics-status-row .track {
    grid-column: 1 / -1;
    height: 6px;
    border-radius: 999px;
    background: #e9efff;
    overflow: hidden;
  }
  .analytics-status-row .fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #6b8fff, #2f5bf6);
  }
  .funnel-step {
    margin-bottom: 10px;
  }
  .funnel-step-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    font-size: 12px;
    margin-bottom: 4px;
  }
  .funnel-step-head .label { font-weight: 600; color: #1d2f62; }
  .funnel-step-head .nums { color: #3e5fb3; font-weight: 600; white-space: nowrap; }
  .funnel-step .hint { font-size: 10px; color: var(--text-tertiary); margin-bottom: 4px; }
  #advanced-analytics-wrap {
    margin-top: 16px !important;
    border-top: 1px solid var(--border-tertiary) !important;
    padding-top: 14px !important;
    max-height: none;
    overflow: visible;
    padding-right: 0;
    contain: layout paint style;
  }
  #phone-citizenship-stats {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  content-visibility: auto;
  contain-intrinsic-size: 460px;
  }
  .analytics-card {
    padding: 12px 13px;
    border: 1px solid rgba(102, 133, 246, 0.2);
    border-radius: 12px;
    background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
  }
  .analytics-card-title {
    font-size: 13px;
    font-weight: 700;
    color: #1a2d61;
    margin-bottom: 4px;
  }
  .analytics-card-title span { color: #3e5fb3; }
  .analytics-note {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    font-size: 11px;
    color: var(--text-secondary);
  }
  .analytics-note-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid var(--border-tertiary);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 11px;
  }
  .status-country-breakdown-wrap {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed rgba(78, 113, 210, 0.25);
  }
  .status-country-grid {
    display: grid;
    gap: 10px;
  }
  .status-country-block {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(78, 113, 210, 0.18);
    background: linear-gradient(180deg, #fff 0%, var(--st-bg, #f8faff) 100%);
  }
  .status-country-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
  }
  .status-country-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--st-fg, #1d2f62);
  }
  .status-country-total {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
  }
  .status-country-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .status-country-chips .analytics-note-chip strong {
    font-weight: 700;
    color: var(--st-fg, #1d2f62);
  }
  .status-country-chips .status-country-others {
    border-style: dashed;
    color: var(--text-secondary);
  }
  .status-country-chips .status-country-others strong {
    color: var(--text-primary);
  }
  .analytics-geo-rank-wrap {
    margin-top: 12px;
  }
  .analytics-geo-bars-wrap {
    margin-bottom: 4px;
  }
  .analytics-geo-rank-table .geo-rank-pos {
    color: var(--text-tertiary);
    font-weight: 600;
    width: 36px;
  }
  .analytics-geo-rank-table tbody tr:nth-child(1) .geo-rank-pos,
  .analytics-geo-rank-table tbody tr:nth-child(2) .geo-rank-pos,
  .analytics-geo-rank-table tbody tr:nth-child(3) .geo-rank-pos {
    color: #2f5bf6;
    font-weight: 700;
  }
  .analytics-geo-more {
    margin: 8px 0 0;
    font-size: 11px;
    color: var(--text-secondary);
  }
  .geo-unknown-note {
    margin-top: 10px;
  }
  .admin-geo-leads-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
  .geo-leads-toolbar {
    margin-bottom: 0;
  }
  .geo-leads-search-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
  }
  .geo-leads-search-row input {
    flex: 1 1 220px;
    min-width: 180px;
    height: 38px;
    padding: 0 12px 0 36px;
    font-size: 14px;
  }
  .geo-leads-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    pointer-events: none;
    font-size: 16px;
    z-index: 1;
  }
  .geo-leads-toolbar__search {
    flex: 1 1 100%;
  }
  .geo-country-chips-label {
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
  }
  .geo-country-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 2px 2px 6px;
    margin-bottom: 4px;
  }
  .geo-country-chip {
    cursor: pointer;
  }
  .geo-country-chip--more {
    border-style: dashed;
    color: #3a5fbf;
    background: #f4f8ff;
    font-weight: 600;
  }
  .geo-country-chip--more:hover {
    background: #e8f0ff;
  }
  .geo-country-chip.is-active {
    background: #dce8ff;
    border-color: rgba(47, 91, 246, 0.55);
    color: #1f4fd6;
    font-weight: 600;
  }
  .geo-leads-count-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
  }
  .geo-leads-count {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #2a4a8f;
  }
  .geo-leads-table-wrap {
    margin-top: 0;
  }
  .geo-leads-table-wrap .table-head,
  .geo-leads-table-wrap .geo-leads-row {
    grid-template-columns: 130px 118px 120px minmax(0, 1fr) 92px 108px;
  }
  .geo-lead-country {
    font-size: 12px;
    font-weight: 600;
    color: #2f5bf6;
  }
  .geo-lead-comment {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
  }
  .geo-leads-empty {
    padding: 28px 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
  }
  .geo-leads-more-wrap {
    padding: 10px 14px;
    text-align: center;
    border-top: 1px solid var(--border-tertiary);
  }
  #geo-leads-table-body {
    max-height: min(70vh, 720px);
    overflow-y: auto;
  }
  .side-nav-link--admin {
    display: none;
  }
  body.crm-role-admin .side-nav-link--admin {
    display: inline-flex;
  }
  .analytics-card-subtitle {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 6px;
  }
  .analytics-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 4px;
  }
  .analytics-list li,
  .analytics-ol li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    font-size: 12px;
    color: #1d2f62;
    line-height: 1.3;
  }
  .analytics-list .name,
  .analytics-ol .name {
    color: #243b74;
    min-width: 0;
  }
  .analytics-list .meta,
  .analytics-ol .meta {
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
  }
  .analytics-ol {
    margin: 0;
    padding-left: 16px;
    display: grid;
    gap: 4px;
  }
  .analytics-empty {
    font-size: 12px;
    color: var(--text-secondary);
  }
  #analytics-charts-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 10px;
    margin-bottom: 10px;
  }
  .analytics-chart-card {
    background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
    border: 1px solid rgba(102, 133, 246, 0.2);
    border-radius: 12px;
    padding: 10px 12px;
    box-shadow: 0 8px 16px rgba(49, 85, 170, 0.08);
  }
  .analytics-funnel-card { grid-column: 1 / -1; }
  .analytics-daily-card { grid-column: 1 / -1; }
  .chart-title {
    font-size: 12px;
    font-weight: 700;
    color: #1b376f;
    margin-bottom: 8px;
  }
  .analytics-subtitle {
    margin: 4px 0 8px;
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .04em;
  }
.analytics-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.analytics-summary-line {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0 0 10px;
}
  .bar-chart-row {
    display: grid;
    grid-template-columns: 88px 1fr auto;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 11px;
  }
  .bar-chart-track {
    height: 7px;
    border-radius: 999px;
    background: #e9efff;
    overflow: hidden;
  }
  .bar-chart-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #4f7dff, #2f5bf6);
  }
  .status-donut-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
  }
  .status-donut {
    --seg1: 25%;
    --seg2: 25%;
    --seg3: 25%;
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: conic-gradient(
      #2f5bf6 0 var(--seg1),
      #27c281 var(--seg1) calc(var(--seg1) + var(--seg2)),
      #f6a623 calc(var(--seg1) + var(--seg2)) calc(var(--seg1) + var(--seg2) + var(--seg3)),
      #dfe7fb calc(var(--seg1) + var(--seg2) + var(--seg3)) 100%
    );
    position: relative;
    flex-shrink: 0;
  }
  .status-donut::after {
    content: "";
    position: absolute;
    inset: 12px;
    border-radius: 50%;
    background: #fff;
  }
  .status-legend {
    display: grid;
    gap: 4px;
    font-size: 11px;
  }
  .status-legend .item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
  }
  .status-legend .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
  }
  .funnel-row {
    margin-bottom: 8px;
    display: grid;
    gap: 3px;
    font-size: 11px;
    color: var(--text-secondary);
  }
  .funnel-row:last-child { margin-bottom: 0; }
  .funnel-bar {
    height: 8px;
    border-radius: 999px;
    background: #e9efff;
    overflow: hidden;
  }
  .funnel-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #3165ff, #6d8dff);
  }
  .daily-cols-wrap {
    height: 140px;
    display: grid;
    grid-template-columns: repeat(14, minmax(0,1fr));
    gap: 6px;
    align-items: end;
  }
  .daily-col {
    display: grid;
    gap: 3px;
    align-content: end;
    justify-items: center;
  }
  .daily-col-track {
    width: 100%;
    height: 84px;
    background: #edf2ff;
    border-radius: 8px;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
  }
  .daily-col-fill {
    width: 100%;
    background: linear-gradient(180deg, #6f90ff, #2f5bf6);
    border-radius: 8px;
    min-height: 4px;
  }
  .daily-col-value {
    font-size: 10px;
    color: #3556a8;
    line-height: 1;
    min-height: 10px;
  }
  .daily-col-label {
    font-size: 10px;
    color: var(--text-tertiary);
    line-height: 1;
    min-height: 10px;
  }
  #admin-stats-wrap.advanced-mode {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border-color: rgba(95, 126, 235, 0.3);
    box-shadow: 0 16px 30px rgba(47, 76, 161, 0.14);
    padding: 22px;
  }
  body.analytics-performance-mode::before,
  body.analytics-performance-mode::after,
  body.analytics-performance-mode > .bg-mesh,
  body.crm-lite-mode::before,
  body.crm-lite-mode::after,
  body.crm-lite-mode > .bg-mesh {
    display: none !important;
  }
  body.crm-lite-mode {
    background: #f3f6fc !important;
    background-size: auto !important;
  }
  body.crm-role-manager #crm-main-layout {
    grid-template-columns: 1fr !important;
  }
  body.crm-role-manager #crm-right-pane {
    grid-column: 1 / -1;
    min-width: 0;
    width: 100%;
    max-width: 100%;
  }
  body.crm-role-manager #crm-content {
    min-width: 0;
    max-width: 100%;
  }
  body.crm-lite-mode .table-wrap,
  body.crm-lite-mode #crm-topbar,
  body.crm-lite-mode #crm-kpi-grid > div,
  body.crm-lite-mode .analytics-section--card {
    box-shadow: 0 4px 12px rgba(27, 39, 62, 0.06) !important;
  }
  body.crm-lite-mode .fun-cat-floating,
  body.crm-lite-mode .mega-prize-banner {
    animation: none !important;
  }
  body.crm-lite-mode .toolbar-btn:hover {
    transform: none;
  }
  body.crm-lite-mode .row {
    transition: none;
  }
  body.crm-lite-mode .analytics-collapsible:not(.is-open) .analytics-section-body {
    content-visibility: hidden;
    contain-intrinsic-size: 0 120px;
  }
  .lite-mode-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 12px 0;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--border-tertiary);
    background: rgba(255,255,255,0.7);
    font-size: 11px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
  }
  .lite-mode-toggle input { accent-color: #2f5bf6; }
  .lite-mode-hint {
    display: block;
    margin: 2px 14px 0;
    font-size: 10px;
    color: var(--text-tertiary);
    min-height: 14px;
  }
  body.analytics-performance-mode #admin-stats-wrap.advanced-mode,
  body.analytics-performance-mode #admin-stats-wrap.advanced-mode .analytics-chart-card,
  body.analytics-performance-mode #admin-stats-wrap.advanced-mode .analytics-card {
    box-shadow: none !important;
  }
  body.analytics-performance-mode #admin-stats-wrap.advanced-mode #analytics-charts-grid,
  body.analytics-performance-mode #admin-stats-wrap.advanced-mode .daily-cols-wrap,
  body.analytics-performance-mode #admin-stats-wrap.advanced-mode .status-donut-wrap,
  body.analytics-performance-mode #admin-stats-wrap.advanced-mode #phone-citizenship-stats {
    contain: layout paint;
  }
  #admin-stats-wrap.advanced-mode .admin-stats-tabs {
    margin-bottom: 14px;
  }
  #admin-stats-wrap.advanced-mode .chart-title {
    font-size: 14px;
    margin-bottom: 10px;
  }
  #admin-stats-wrap.advanced-mode #analytics-charts-grid {
    gap: 14px;
    margin-bottom: 14px;
  }
  #admin-stats-wrap.advanced-mode .analytics-chart-card {
    border-radius: 14px;
    border-color: rgba(96, 129, 241, 0.3);
    box-shadow: 0 10px 20px rgba(49, 85, 170, 0.12);
    padding: 12px 14px;
  }
  #admin-stats-wrap.advanced-mode .bar-chart-row {
    grid-template-columns: 120px 1fr auto;
    font-size: 12px;
  }
  #admin-stats-wrap.advanced-mode .bar-chart-track,
  #admin-stats-wrap.advanced-mode .funnel-bar {
    height: 9px;
  }
  #admin-stats-wrap.advanced-mode .status-donut {
    width: 100px;
    height: 100px;
  }
  #admin-stats-wrap.advanced-mode .status-donut::after {
    inset: 15px;
  }
  #admin-stats-wrap.advanced-mode .status-legend {
    font-size: 12px;
    gap: 6px;
  }
  #admin-stats-wrap.advanced-mode .daily-cols-wrap {
    height: 160px;
    gap: 8px;
  }
  #admin-stats-wrap.advanced-mode .daily-col-track {
    height: 98px;
  }
  #admin-stats-wrap.advanced-mode .daily-col-value,
  #admin-stats-wrap.advanced-mode .daily-col-label {
    font-size: 11px;
  }
  #admin-stats-wrap.advanced-mode .analytics-subtitle {
    font-size: 12px;
    margin: 8px 0 10px;
  }
  #admin-stats-wrap.advanced-mode .analytics-card {
    border-radius: 14px;
    padding: 13px 14px;
  }
  #admin-stats-wrap.advanced-mode .analytics-card-title {
    font-size: 14px;
  }
  #admin-stats-wrap.advanced-mode .analytics-list li,
  #admin-stats-wrap.advanced-mode .analytics-ol li {
    font-size: 13px;
  }
  #admin-stats-wrap.advanced-mode #invalid-total-line,
  #admin-stats-wrap.advanced-mode #call-stage-line {
    font-size: 14px !important;
    line-height: 1.45;
    color: #35528f !important;
    font-weight: 500;
    letter-spacing: 0.01em;
  }
  #admin-stats-wrap.advanced-mode #invalid-breakdown {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed rgba(78, 113, 210, 0.25);
  }
  #admin-stats-wrap.advanced-mode #invalid-breakdown .analytics-ol {
    gap: 8px;
    padding-left: 18px;
  }
  #admin-stats-wrap.advanced-mode #invalid-breakdown .analytics-ol li {
    font-size: 14px;
    line-height: 1.4;
    align-items: center;
  }
  #admin-stats-wrap.advanced-mode #invalid-breakdown .analytics-ol .name {
    color: #1b376f;
    font-weight: 500;
  }
  #admin-stats-wrap.advanced-mode #invalid-breakdown .analytics-ol .meta {
    color: #4d6fb2;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
  }
  #crm-topbar {
    background: rgba(255,255,255,0.78);
    border: 1px solid rgba(121, 153, 255, 0.24);
    border-radius: 16px;
    padding: 15px 18px;
    backdrop-filter: none;
  }
  #crm-kpi-grid > div {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(102, 133, 246, 0.2);
    background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%) !important;
    box-shadow: 0 10px 20px rgba(63, 97, 191, 0.12), inset 0 1px 0 rgba(255,255,255,0.8);
    border-radius: 16px !important;
    padding: 1.05rem 1.15rem !important;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
  }
  #crm-kpi-grid > div::after {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, rgba(47,91,246,.15), rgba(47,91,246,.45), rgba(47,91,246,.15));
    opacity: .85;
  }
  #crm-kpi-grid > div:hover {
    transform: translateY(-2px);
    border-color: rgba(59, 101, 224, 0.34);
    box-shadow: 0 14px 28px rgba(49, 85, 170, 0.18), inset 0 1px 0 rgba(255,255,255,0.9);
  }
  #crm-calendly-block {
    border: 1px solid rgba(239, 189, 99, 0.85) !important;
    border-radius: 20px !important;
    background: linear-gradient(180deg, #fffaf1 0%, #fff2df 100%) !important;
    box-shadow: 0 12px 24px rgba(246, 172, 49, 0.18), inset 0 1px 0 rgba(255,255,255,0.8);
  }
  #cal-api-btn, #cal-refresh-btn {
    border-radius: 8px !important;
    border: 1px solid rgba(141,93,17,0.28) !important;
    box-shadow: 0 4px 10px rgba(190, 134, 33, 0.08);
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
  }
  #cal-api-btn:hover, #cal-refresh-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 14px rgba(185, 128, 26, 0.14);
  }
  #crm-filters-bar.filters-panel {
    border-radius: 20px !important;
    padding: 16px !important;
  }
  #reset-filters {
    border-radius: 12px !important;
    font-weight: 600;
  }
  .table-wrap > div:first-child {
    background: linear-gradient(180deg, #f5f9ff 0%, #eaf1ff 100%) !important;
    border-bottom: 1px solid var(--border-tertiary);
  }
  .row {
    background: rgba(255, 255, 255, 0.7);
  }
  .row:nth-child(2n) {
    background: rgba(247, 250, 255, 0.95);
  }
  .row:hover {
    background: linear-gradient(90deg, #eef4ff 0%, #f8fbff 100%);
  }
  #add-btn {
    background: linear-gradient(135deg, #3266ff, #1b4ef5) !important;
    box-shadow: 0 10px 20px rgba(50,102,255,0.32);
  }
  #add-btn:hover { filter: brightness(1.04); transform: translateY(-1px); }
  #login-btn {
    background: linear-gradient(135deg, #3266ff, #1b4ef5) !important;
    box-shadow: 0 10px 20px rgba(50,102,255,0.28);
  }
  #status-header-btn, #manager-filter, #reset-filters, #cal-api-btn, #cal-refresh-btn {
    transition: all .15s ease;
  }
  #status-header-btn:hover, #manager-filter:hover, #reset-filters:hover, #cal-api-btn:hover, #cal-refresh-btn:hover {
    transform: translateY(-1px);
  }
  .modal-card {
    background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
  }
  @keyframes pageGradientShift {
    0% { background-position: 0% 0%, 100% 0%, 0% 0%; }
    100% { background-position: 10% 8%, 92% 10%, 0% 0%; }
  }
  @keyframes blobFloatA {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    50% { transform: translate3d(34px, 24px, 0) scale(1.08); }
  }
  @keyframes blobFloatB {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    50% { transform: translate3d(-40px, -18px, 0) scale(1.06); }
  }
  @keyframes meshDrift {
    0% { background-position: 0% 0%, 0 0; }
    100% { background-position: 100% 100%, 240px 180px; }
  }
  @keyframes topGlowShift {
    0% { transform: translate3d(0, 0, 0); opacity: 0.9; }
    100% { transform: translate3d(18px, 10px, 0); opacity: 1; }
  }
  @media (max-width: 980px) {
    body { padding: 16px 0 20px; }
    .container { padding: 0 12px; }
    #crm-shell { grid-template-columns: 1fr; }
    #crm-sidebar { position: static; }
    #crm-main-layout { grid-template-columns: 1fr !important; }
    #crm-root { gap: 22px; }
    #crm-right-pane { gap: 18px; }
    .crm-donut-wrap { flex-direction: column; align-items: flex-start; }
    .stat-mini-grid, #crm-kpi-grid { grid-template-columns: 1fr !important; }
    #analytics-charts-grid { grid-template-columns: 1fr; }
    .analytics-two-col { grid-template-columns: 1fr; }
    .analytics-kpi-row--wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filters-panel__main { flex-direction: column; align-items: stretch; }
    .filters-panel__actions { width: 100%; }
    .filters-panel__actions .filters-btn { flex: 1; }
    .filters-panel__search,
    .filters-panel__manager { flex: 1 1 100%; min-width: 0; }
    .filters-panel__period { flex-direction: column; }
    .period-summary { width: 100%; max-width: none; }
    .period-summary__range { max-width: none; }
    .row, .table-wrap > div:first-child { grid-template-columns: 1.2fr .9fr 1.5fr .9fr 1.1fr !important; }
  }
