/* ============================================
   MVP Lead Management System - Styles
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* «Спокойный плоский»: глобально убираем стеклянный блюр (glassmorphism → flat).
   Все поверхности остаются на плотных --surface/--surface-2 с тонкими границами. */
*, *::before, *::after {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* =====================================================================
   Дизайн-система «один акцент» (Supabase-style) — общие токены.
   Единственный хроматический акцент — изумруд #3ecf8e; всё остальное —
   нейтральная монохромная серая лестница на тёплом near-black графите.
   Цвет воронок живёт только на колонках/смысловых статус-элементах.
   ===================================================================== */
:root {
    /* Акцент — Supabase emerald (единственный хроматический акцент) */
    --accent:      #3ecf8e;   /* было #5e6ad2 (индиго) */
    --accent-soft: #4ade80;   /* светлее — градиенты/чарты */
    --accent-deep: #24b47e;   /* pressed/hover */
    --accent-text: #6ee7b7;   /* изумруд для ссылок/лейблов на тёмном (легибельность) */
    --on-accent:   #171717;   /* ФИШКА Supabase: почти-чёрный текст на изумрудной заливке */

    /* цвет воронок (только колонки/статусы) */
    --s-new:        #9a9a9a;   /* новые — нейтральный серый */
    --s-progress:   #3b82f6;   /* в работе — синий */
    --s-thinking:   #ffdb13;   /* думает — жёлтый (Supabase yellow) */
    --s-successful: #3ecf8e;   /* успешно — бренд-изумруд */
    --s-preparing:  #a16f4a;   /* готовится — коричневый */

    /* сигнальные цвета (риск/просрочка) */
    --danger: #e0607a;
    --warn:   #e0a23a;

    /* поверхности (тёплый near-black graphite — canvas-night Supabase) */
    --bg:        #161616;
    --surface:   #1c1c1c;   /* панели/карточки — плотная поверхность */
    --surface-2: #262626;   /* вложенные элементы */
    --bd:        rgba(255, 255, 255, 0.08);
    --bd-2:      rgba(255, 255, 255, 0.14);

    /* текст — нейтральная серая лестница Supabase */
    --text:   #ededed;
    --text-2: #9a9a9a;
    --text-3: #707070;

    /* радиусы — квадратноватые, технические (Supabase) */
    --r-sm:   6px;
    --r-md:   8px;
    --r-lg:   12px;
    --r-xl:   16px;
    --r-full: 9999px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    /* самодостаточный тёплый near-black фон + еле заметный изумрудный намёк (без атмосферных градиентов) */
    background:
        radial-gradient(1100px 700px at 15% -10%, rgba(62, 207, 142, 0.06), transparent 60%),
        linear-gradient(180deg, #161616 0%, #141414 55%, #121212 100%);
    background-attachment: fixed;
    min-height: 100vh;
    padding: 20px;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   TYPOGRAPHY — Supabase display tier
   Inter weight 500 + отрицательный трекинг для крупных заголовков;
   средним заголовкам — только уплотнение трекинга (вес не трогаем).
   ============================================ */

/* Крупные display-заголовки: инженерный mid-weight 500 + плотный трекинг */
.admin-header h1,
.login-title,
.login-wrapper h1,
.kpi-value,
.funnel-title,
.stat-value,
.financial-metric-value {
    font-weight: 500;
    letter-spacing: -0.02em;
}

/* Средние заголовки: только уплотнение (сохраняем существующий вес) */
.stage-title,
.modal-header h2,
.tasks-page-title,
.users-page-title,
.rq-title,
.analytics-header h2,
.section-title,
.card-title {
    letter-spacing: -0.015em;
}

/* ============================================
   PAGE LOAD ANIMATIONS
   ============================================ */

.page-fade-in {
    animation: fadeIn 0.6s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.4s ease-in;
}

.container {
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
    padding-left: 16px;
    padding-right: 16px;
    box-sizing: border-box;
}

/* ============================================
   LIQUID GLASS BASE
   ============================================ */

.glass {
    background: var(--surface);
    border-radius: 16px;
    border: 1px solid var(--bd);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    color: var(--text);
}

.glass.position-relative {
    position: relative;
    overflow: hidden;
}

.glass.position-relative::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        120deg,
        transparent,
        rgba(255, 255, 255, 0.05),
        transparent
    );
    opacity: 0;
    transition: opacity 0.4s;
    pointer-events: none;
}

.glass.position-relative:hover::after {
    opacity: 1;
}

.top-bar {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-top: 10px;
}

.top-bar--split {
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.top-bar-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.lang-switch {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
    margin-top: 0;
}

.lang-label {
    font-size: 0.7em;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.lang-toggle-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.lang-toggle {
    border: none;
    background: transparent;
    font-size: 0.75em;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    padding: 2px 8px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.lang-toggle.active {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.lang-toggle:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.lang-sep {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75em;
}

/* ============================================
   ЕДИНАЯ ТОНКАЯ ПАНЕЛЬ (app-bar) — заменяет три верхние полосы.
   Бренд+навигация слева; поиск+Добавить+язык+колокольчик+аккаунт справа.
   Логин-топбар (только язык) прячется, когда открыта панель.
   ============================================ */
.top-bar--login { justify-content: flex-start; }
body:has(#adminPanel[style*="block"]) #loginTopBar { display: none; }

.app-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin: 8px 0 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--bd);
}

.app-bar-left {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    min-width: 0;
    flex: 1 1 auto;
}

.app-bar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.app-brand {
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 1.15em;
    font-weight: 500;
    letter-spacing: -0.02em;
    color: var(--text);
    white-space: nowrap;
}

/* изумрудная точка-акцент в вордмарке (единственный хроматический штрих слева) */
.app-brand::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.app-bar-nav.header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.app-bar-lang { margin-left: 2px; }

/* ============================================
   FORM STYLING
   ============================================ */

.form-wrapper,
.login-wrapper {
    margin-top: 50px;
}

.form-wrapper.glass,
.login-box.glass {
    padding: 40px;
    border-radius: var(--r-xl);
}

.form-wrapper.glass {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    color: #fff;
}

.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    margin-top: 50px;
}

.login-box {
    width: 100%;
    max-width: 400px;
}

.login-box.glass {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    color: #fff;
}

h1 {
    color: #fff;
    margin-bottom: 10px;
    font-size: 2em;
}

.subtitle {
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 30px;
    font-size: 0.95em;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 500;
    font-size: 0.9em;
}

.required {
    color: #f87171;
}

.field-error {
    font-size: 0.85em;
    color: #fca5a5;
    margin-top: 6px;
}

input[type="text"],
input[type="tel"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 12px;
    font-size: 1em;
    transition: border-color 0.3s, box-shadow 0.2s;
    font-family: inherit;
}

select {
    cursor: pointer;
}

select option {
    background: #1f2937;
    color: #fff;
}

input::placeholder,
textarea::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.4);
}

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

.submit-btn {
    width: 100%;
    padding: 14px;
    background: var(--accent);
    color: var(--on-accent);
    border: none;
    border-radius: var(--r-sm);
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
    margin-top: 10px;
}

.submit-btn:hover {
    background: var(--accent-deep);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(62, 207, 142, 0.35);
}

.submit-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.submit-btn.loading {
    position: relative;
}

/* ============================================
   LOADING SPINNER ANIMATION
   ============================================ */

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ============================================
   MESSAGE STYLING
   ============================================ */

.message {
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.success-message {
    background: rgba(39, 174, 96, 0.25);
    color: var(--accent-text);
    border: 1px solid rgba(39, 174, 96, 0.4);
}

.error-message {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.info-message {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* ============================================
   MESSAGE ANIMATIONS
   ============================================ */

.slide-in-top {
    animation: slideInTop 0.4s ease-out;
}

@keyframes slideInTop {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   ADMIN PANEL STYLING
   ============================================ */

.admin-panel {
    margin-top: 20px;
}

.admin-panel.glass {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-radius: var(--r-xl);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    color: #fff;
    padding: 40px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--bd);
}

.admin-header h1 {
    color: var(--text);
    font-size: 1.3em;
}

.header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.table-controls {
    flex-wrap: wrap;
    gap: 10px;
}

.table-controls-wrapper {
    width: 100%;
}

.table-controls-wrapper.glass {
    padding: 16px;
    border-radius: var(--r-xl);
}

.controls-toggle {
    display: none;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    color: #fff;
}

.controls-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
}

.table-search {
    flex: 1 1 220px;
    min-width: 180px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    font-size: 0.95em;
    color: #fff;
}

.table-search::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.table-search:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.4);
}

.table-select {
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    font-size: 0.95em;
    color: #fff;
    min-width: 160px;
}

.table-select:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.4);
}

.table-select option {
    background: #1f2937;
    color: #fff;
}

/* Навигация в шапке — лёгкие «призрачные» текст-ссылки (изумруд держим редким:
   единственная заливка в шапке — первичная кнопка «Добавить»). */
.btn-link {
    padding: 7px 12px;
    background: transparent;
    color: var(--text-2);
    text-decoration: none;
    border-radius: var(--r-sm);
    font-size: 0.9em;
    font-weight: 500;
    letter-spacing: -0.01em;
    transition: background 0.15s ease, color 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid transparent;
}

.btn-link:hover {
    background: var(--surface-2);
    color: var(--text);
}

/* активный раздел навигации — изумрудный текст + тонкая подложка */
.btn-link.is-active {
    color: var(--accent-text);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.btn-excel {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: var(--accent-deep);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.2s;
}

.btn-excel:hover {
    background: #1c9d6b;
    transform: translateY(-1px);
}

.btn-excel:active {
    transform: translateY(0);
}

.logout-btn {
    padding: 10px 20px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.logout-btn:hover {
    background: #c0392b;
}

/* ============================================
   TABLE STYLING
   ============================================ */

.leads-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: transparent;
    color: #fff;
}

#leadsTableWrapper {
    width: 100%;
    overflow: visible;
}

#leadsTableWrapper.glass {
    padding: 20px;
    border-radius: var(--r-xl);
}

#analyticsWrapper.glass {
    padding: 24px;
    border-radius: var(--r-xl);
}

.leads-table thead {
    background: transparent;
}

.leads-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.leads-table td {
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

.leads-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Managers analytics (Boss table) */
.managers-analytics-section {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-radius: var(--r-xl);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
    padding: 20px;
    margin-bottom: 24px;
}

.managers-analytics-title {
    font-size: 1em;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.95);
    margin: 0 0 16px 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.managers-table-wrap {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.managers-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
}

.managers-table thead {
    background: rgba(255, 255, 255, 0.08);
}

.managers-table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    white-space: nowrap;
}

.managers-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
}

.managers-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.06);
}

.managers-table tbody tr:last-child td {
    border-bottom: none;
}

/* Personal stats (Call manager) */
.personal-stats-section {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-radius: var(--r-xl);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
    padding: 20px;
    margin-bottom: 24px;
}

.personal-stats-title {
    font-size: 1em;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.95);
    margin: 0 0 16px 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.personal-stats-grid .financial-metric {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: background 0.2s ease, border-color 0.2s ease;
}

.personal-stats-grid .financial-metric:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Financial analytics block */
.financial-analytics-block {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-radius: var(--r-xl);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
    padding: 20px;
    margin-bottom: 24px;
}

.financial-analytics-title {
    font-size: 1em;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.95);
    margin: 0 0 16px 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.financial-analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
}

.financial-metric {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.financial-metric-label {
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.75);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.financial-metric-value {
    font-size: 1.25em;
    font-weight: 700;
    color: #fff;
}

/* ============================================
   LIVE INDICATOR
   ============================================ */

.analytics-live {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8em;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.8);
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(102, 234, 168, 0.1);
    border: 1px solid rgba(102, 234, 168, 0.25);
    transition: opacity 0.3s ease;
}

.analytics-live.is-refreshing { opacity: 0.55; }

.analytics-live-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #2ecc71;
    box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.7);
    animation: livePulse 1.8s infinite;
}

@keyframes livePulse {
    0%   { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.6); }
    70%  { box-shadow: 0 0 0 8px rgba(46, 204, 113, 0); }
    100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0); }
}

/* Brief cue when the board auto-updates itself via live sync */
.btn-live-pulse {
    animation: btnLivePulse 0.9s ease-out;
}

@keyframes btnLivePulse {
    0%   { box-shadow: 0 0 0 0 rgba(62, 207, 142, 0.55); }
    100% { box-shadow: 0 0 0 12px rgba(62, 207, 142, 0); }
}

/* ============================================
   SALES FUNNEL
   ============================================ */

.funnel-section {
    padding: 20px;
    margin-bottom: 20px;
}

.funnel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.funnel-title {
    font-size: 1.1em;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.funnel-periods {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
}

.funnel-period-btn {
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.82em;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.funnel-period-btn:hover { color: #fff; }

.funnel-period-btn.is-active {
    background: linear-gradient(90deg, var(--accent), var(--accent-deep));
    color: #fff;
}

.funnel-bars {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 4px 0;
}

.funnel-empty {
    padding: 24px;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9em;
}

/* ---- amoCRM-style trapezoid funnel ---- */
.amo-funnel-stage {
    position: relative;
}

.amo-funnel-band {
    position: relative;
    height: 58px;
    background: linear-gradient(135deg, var(--c1), var(--c2));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
    transform-origin: center;
    transition: filter 0.18s ease, transform 0.18s ease;
    cursor: default;
}

.amo-funnel-band::before {
    /* subtle top sheen for depth */
    content: '';
    position: absolute;
    inset: 0 0 50% 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent);
    pointer-events: none;
}

.amo-funnel-stage:hover .amo-funnel-band {
    filter: brightness(1.08) saturate(1.05);
    transform: scaleY(1.04);
}

.amo-funnel-stage.is-leak .amo-funnel-band {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), inset 0 0 0 2px rgba(255, 255, 255, 0.55);
}

.amo-funnel-band-inner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 0 18px;
    pointer-events: none;
}

.amo-funnel-stage-name {
    font-size: 0.92em;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
    white-space: nowrap;
}

.amo-funnel-stage-count {
    display: inline-flex;
    align-items: baseline;
    gap: 7px;
    font-size: 1.25em;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
    line-height: 1;
}

.amo-funnel-stage-count small {
    font-size: 0.5em;
    font-weight: 600;
    opacity: 0.85;
    letter-spacing: 0.01em;
}

.amo-funnel-stalled {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    font-size: 0.74em;
    font-weight: 700;
    color: #fff;
    background: rgba(220, 38, 38, 0.92);
    padding: 3px 9px;
    border-radius: 999px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

.amo-funnel-conv-row {
    display: flex;
    justify-content: center;
    margin: -1px 0;
    position: relative;
    z-index: 2;
}

.amo-funnel-conv {
    font-size: 0.78em;
    font-weight: 700;
    color: #34d399;
    background: rgba(8, 12, 24, 0.72);
    border: 1px solid rgba(52, 211, 153, 0.4);
    padding: 2px 12px;
    border-radius: 999px;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.amo-funnel-conv.is-drop {
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.45);
}

.funnel-leak {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(230, 126, 34, 0.12);
    border: 1px solid rgba(230, 126, 34, 0.3);
    font-size: 0.9em;
    color: #f5b173;
    font-weight: 600;
}

.funnel-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

.funnel-summary-item {
    flex: 1;
    min-width: 130px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.funnel-summary-label {
    display: block;
    font-size: 0.74em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 4px;
}

.funnel-summary-value {
    font-size: 1.2em;
    font-weight: 700;
    color: #fff;
}

@media (max-width: 600px) {
    .amo-funnel-band { height: 50px; }
    .amo-funnel-band-inner { gap: 8px; padding: 0 10px; }
    .amo-funnel-stage-name { font-size: 0.82em; }
    .amo-funnel-stage-count { font-size: 1.05em; }
    .amo-funnel-stage-count small { display: none; }
    .amo-funnel-stalled { font-size: 0.66em; padding: 2px 6px; }
}

/* ============================================
   TABLE ROW ANIMATIONS
   ============================================ */

.table-row-animate {
    animation: fadeInSlideLeft 0.5s ease-out forwards;
    opacity: 0;
}

.card-animate {
    animation: fadeInUp 0.4s ease-out forwards;
    opacity: 0;
}

@keyframes fadeInSlideLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

/* ============================================
   CARD LAYOUT (LEADS)
   ============================================ */

.lead-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

/* Kanban: wrapper does not clip column fixed height; board scrolls horizontally */
.leads-kanban-wrap {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 12px;
    min-height: 0;
}

/* Kanban board */
.kanban-board {
    display: flex;
    align-items: stretch;
    gap: 14px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 10px;
    flex: 1;
    min-height: calc(100vh - 220px);
    scroll-behavior: smooth;
    scroll-snap-type: x proximity;       /* мягкое выравнивание колонок при свайпе */
    -webkit-overflow-scrolling: touch;   /* инерционный скролл на iOS */
}

.kanban-board--dragging .kanban-column {
    transition: border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}

.kanban-board--dragging .kanban-column-cards,
.kanban-board--dragging .column-content {
    outline: 1px dashed rgba(255, 255, 255, 0.12);
    outline-offset: 2px;
    border-radius: 10px;
}

.kanban-column {
    --c: var(--s-new); /* перекрывается per-stage ниже */
    flex: 1 1 0;            /* колонки делят ширину экрана — все 5 видны без горизонтального скролла */
    min-width: 210px;      /* ниже этого включится скролл (очень узкие экраны) */
    width: auto;
    height: calc(100vh - 220px);
    scroll-snap-align: start;
    background: var(--surface);
    border-radius: 14px;
    border: 1px solid color-mix(in srgb, var(--c) 20%, var(--bd)); /* рамка с оттенком воронки */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.kanban-column.drag-over {
    border-color: color-mix(in srgb, var(--accent) 55%, transparent);
    box-shadow:
        0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent),
        0 12px 36px color-mix(in srgb, var(--accent) 20%, transparent);
    transform: translateY(-2px);
}

/* Цвет воронки (только колонки): задаётся через --c, разливается по шапке/рамке/точке/счётчику */
.kanban-column[data-stage="new"]         { --c: var(--s-new); }
.kanban-column[data-stage="in_progress"] { --c: var(--s-progress); }
.kanban-column[data-stage="thinking"]    { --c: var(--s-thinking); }
.kanban-column[data-stage="successful"]  { --c: var(--s-successful); }
.kanban-column[data-stage="preparing"]   { --c: var(--s-preparing); }

.kanban-column-header {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    font-weight: 600;
    font-size: 0.9em;
    color: var(--text);
    border-bottom: 1px solid color-mix(in srgb, var(--c) 22%, var(--bd));
    /* шапка с мягким оттенком воронки поверх графита */
    background: linear-gradient(180deg, color-mix(in srgb, var(--c) 16%, transparent), transparent);
    flex-shrink: 0;
}

.stage-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex: 1;
    width: 100%;
    min-width: 0;
}

.stage-title {
    flex: 0 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* цветная точка-индикатор воронки перед названием стадии */
.stage-title::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
    background: var(--c);
    box-shadow: 0 0 8px color-mix(in srgb, var(--c) 70%, transparent);
}

.stage-counter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-width: 26px;
    height: 24px;
    padding: 0 9px;
    border-radius: 7px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text);
    /* нейтральный счётчик с лёгким оттенком воронки */
    background: color-mix(in srgb, var(--c) 22%, var(--surface-2));
    border: 1px solid color-mix(in srgb, var(--c) 32%, var(--bd));
    transition: all 0.2s ease;
}

.stage-counter.counter-update {
    animation: counterUpdate 0.4s ease-out;
}

@keyframes counterUpdate {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); filter: brightness(1.15); }
    100% { transform: scale(1); filter: brightness(1); }
}

/* Scrollable card list inside each column */
.kanban-column-cards.column-content,
.kanban-column .column-content {
    flex: 1;
    min-height: 0;
    min-width: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
    box-sizing: border-box;
}

.kanban-column-cards .lead-card,
.column-content .lead-card {
    margin-bottom: 8px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.kanban-column-cards .lead-card *,
.column-content .lead-card * {
    max-width: 100%;
    box-sizing: border-box;
}

.kanban-column-cards .lead-card svg,
.column-content .lead-card svg {
    max-width: none;
}

.kanban-column-cards .lead-card:last-child,
.column-content .lead-card:last-child {
    margin-bottom: 0;
}

.lead-card {
    position: relative;
    background: var(--surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--bd);
    border-radius: 12px;
    padding: 13px 14px 12px;
    box-shadow: none;
    color: var(--text);
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    overflow-wrap: anywhere;
    transition: transform 0.16s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.kanban-column-cards .lead-card:hover,
.column-content .lead-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
    border-color: var(--bd-2);
    background: var(--surface-2);
}

.lead-card--chosen {
    cursor: grabbing;
}

.lead-card--drag {
    opacity: 0.98;
    transform: rotate(1.5deg) scale(1.03);
    box-shadow: 0 20px 44px rgba(0, 0, 0, 0.5);
    border-color: color-mix(in srgb, var(--accent) 55%, transparent);
}

.lead-card--ghost {
    opacity: 0.5;
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    border: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent);
}

.lead-card--new {
    border-color: var(--bd-2);
    background: var(--surface-2);
}

/* — сигнальные состояния: единый сдержанный «danger», без неона — */
.lead-card.stalled-card {
    border-color: color-mix(in srgb, var(--warn) 40%, var(--bd));
}

/* Preparing stage urgency (classes on .lead-card from Kanban) */
.lead-card.warning {
    border: 1px solid color-mix(in srgb, var(--warn) 55%, transparent);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--warn) 22%, transparent);
}

.lead-card.urgent {
    border: 1px solid color-mix(in srgb, var(--danger) 55%, transparent);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--danger) 30%, transparent);
}

.lead-card.overdue {
    border: 1px solid color-mix(in srgb, var(--danger) 70%, transparent);
    background: color-mix(in srgb, var(--danger) 10%, var(--surface));
}

.lead-card-preparing-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: -4px 0 0 0;
}

.preparing-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--s-preparing) 22%, transparent);
    color: #e9c9a8;
    border: 1px solid color-mix(in srgb, var(--s-preparing) 38%, transparent);
    box-shadow: none;
}

.btn-preparing-edit {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.btn-preparing-edit:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.04);
}

.preparing-edit-icon {
    display: block;
}

.lead-card-preparing-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.88);
}

.lead-card-preparing-meta .preparing-countdown {
    font-weight: 600;
    color: var(--text-2);
}

.lead-card.overdue .lead-card-preparing-meta .preparing-countdown,
.lead-card.urgent .lead-card-preparing-meta .preparing-countdown {
    color: #f3b6c2;
}

.optional-hint {
    font-weight: 400;
    opacity: 0.85;
    font-size: 0.88em;
}

@keyframes successGlow {
    0% { box-shadow: 0 0 0 rgba(16, 185, 129, 0); }
    50% { box-shadow: 0 0 25px rgba(16, 185, 129, 0.6); }
    100% { box-shadow: 0 0 0 rgba(16, 185, 129, 0); }
}

.lead-card.success-flash {
    animation: successGlow 0.8s ease-in-out;
}

.stalled-badge {
    margin-top: 8px;
    font-size: 12px;
    color: #f0c074;
    opacity: 0.95;
}

.lead-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    overflow: hidden;
}

/* === шапка карточки: аватар + имя/телефон (как в новой стилистике) === */
.lead-card-top {
    display: flex;
    align-items: center;
    gap: 11px;
}
.lead-card-avatar {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.02em;
    border: 1px solid var(--bd-2);
}
.lead-card-idblock {
    min-width: 0;
    flex: 1;
}

/* бейдж «new» в правом верхнем углу карточки новой стадии */
.lead-card-new-badge {
    position: absolute;
    top: 11px;
    right: 12px;
    z-index: 2;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--accent-text);
    background: color-mix(in srgb, var(--accent) 18%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
    padding: 3px 7px;
    border-radius: 999px;
}

/* === раскладка действий на карточке доски: акцент «Успех» + 2 иконки === */
/* flex-direction:row задан явно, чтобы перебить мобильное правило (column) */
.column-content .lead-card-actions {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 7px;
}
.column-content .lead-card-actions .btn-done.btn-card {
    flex: 1 1 auto;
}
.column-content .lead-card-actions .btn-log.btn-card,
.column-content .lead-card-actions .btn-not.btn-card {
    flex: 0 0 auto;
    width: 38px;
    padding-left: 0;
    padding-right: 0;
}
.column-content .lead-card-actions .btn-log.btn-card > span,
.column-content .lead-card-actions .btn-not.btn-card > span {
    display: none;
}

.lead-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.lead-card-name {
    font-size: 1.12em;
    font-weight: 700;
    color: var(--text);
    line-height: 1.25;
    letter-spacing: -0.01em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lead-card-source {
    flex-shrink: 0;
}

.lead-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: center;
}

.lead-card-priorities {
    margin-top: 2px;
}

.lead-card-date {
    font-size: 0.72rem;
    color: var(--text-3);
    font-weight: 500;
    margin-top: 2px;
}

.lead-card-assign {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    min-width: 0;
}

.lead-card-assign--compact {
    margin-top: 4px;
}

.lead-card-assign--compact .assign-dropdown {
    width: 100%;
    max-width: 100%;
}

.assign-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.95);
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.assign-dropdown,
.lead-card-assign .assign-select.assign-dropdown {
    min-width: 140px;
    width: auto;
    max-width: 100%;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.95);
    cursor: pointer;
}

.lead-card-assign .assign-select.assign-dropdown:hover,
.lead-card-assign .assign-select.assign-dropdown:focus {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.22);
    outline: none;
}

.lead-card-assign .assign-select.assign-dropdown option {
    background: var(--bg-card, #1a1a2e);
    color: inherit;
}

.lead-card-assign .assign-label {
    font-size: 0.8em;
    color: var(--text-muted, #666);
    white-space: nowrap;
}

.lead-card-assign .assign-select {
    font-size: 0.85em;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color, #ddd);
    background: var(--bg-card, #fff);
    min-width: 120px;
}

.badge.badge-assigned {
    font-size: 0.72em;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    font-weight: 500;
}

.lead-card-phone {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lead-card-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 12px;
}

.lead-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.field-label {
    font-size: 0.72em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 700;
}

.field-value {
    font-size: 0.92em;
    color: rgba(255, 255, 255, 0.95);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.priority-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    min-width: 0;
}

.priority-chips--kanban {
    gap: 5px;
    min-width: 0;
}

.priority-chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--bd);
}

/* чипы нейтральны: цвет = смысл живёт только на воронке, не на карточке */
.priority-chip--quality,
.priority-chip--price,
.priority-chip--design,
.priority-chip--warranty,
.priority-chip--safety,
.priority-chip--default {
    background: var(--surface-2);
    border-color: var(--bd);
    color: var(--text-2);
}

.lead-field--priorities {
    grid-column: 1 / -1;
}

.lead-card-comment {
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.comment-text {
    font-size: 0.92em;
    color: rgba(255, 255, 255, 0.9);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lead-card .badge {
    font-size: 0.75em;
}

.lead-card .badge-source {
    padding: 6px 12px;
    font-size: 0.72em;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 600;
    white-space: nowrap;
}

.badge-source {
    color: white;
}

.badge-new {
    background: #e0e0e0;
    color: #555;
}

.badge-call-back {
    background: #f1c40f;
    color: #3b2f00;
}

.badge-successful {
    background: var(--accent-deep);
    color: white;
}

.badge-rejected {
    background: #e74c3c;
    color: white;
}

.badge-preparing {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.badge-instagram {
    background: linear-gradient(135deg, #833ab4, #fd1d1d, #fcb045);
}

.badge-telegram {
    background: #0088cc;
}

.badge-word {
    background: #b58900;
}

.badge-website {
    background: #2f2f2f;
}

.btn-done,
.btn-not {
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.15s ease, filter 0.15s ease, color 0.15s ease;
}

.lead-card-actions .btn-done.btn-card,
.lead-card-actions .btn-not.btn-card {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 10px;
    font-size: 0.75rem;
    border-radius: 8px;
    line-height: 1.2;
}

.lead-card-actions .btn-card-icon {
    flex-shrink: 0;
    opacity: 0.95;
}

.lead-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    justify-content: flex-end;
}

.btn-done {
    background: var(--accent);
    color: var(--on-accent);
}

.btn-done:hover {
    background: var(--accent);
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: none;
}

.btn-done:active {
    transform: translateY(0);
    transition: transform 0.1s;
}

.btn-not {
    background: var(--surface-2);
    color: var(--text-2);
    border-color: var(--bd);
}

.btn-not:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
    transform: translateY(-1px);
    box-shadow: none;
}

.btn-not:active {
    transform: translateY(0);
    transition: transform 0.1s;
}

.btn-edit {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    background: var(--accent);
    color: var(--on-accent);
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.btn-edit:hover {
    background: var(--accent-deep);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(62, 207, 142, 0.3);
}

.btn-edit:active {
    transform: translateY(0);
    transition: transform 0.1s;
}

/* ============================================
   MODAL STYLING
   ============================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: background 0.3s ease;
}

.modal.modal-open {
    background: rgba(0, 0, 0, 0.7);
}

.modal-content {
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--surface);   /* solid base so no modal is see-through */
    color: var(--text);
    transform: scale(0.9) translateY(-20px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.modal-content.glass {
    background: var(--surface);   /* solid — no see-through behind the modal */
    border: 1px solid var(--bd);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
    color: var(--text);
}

.modal.modal-open .modal-content {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5em;
    color: #fff;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2em;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.modal-body {
    padding: 20px;
    color: rgba(255, 255, 255, 0.95);
}

/* Remove number input arrows (global) */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Shared glass style for form inputs (length, width, name, phone, etc.) */
.glass-input {
    width: 100%;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: #fff;
    font-size: 1em;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.glass-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.glass-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.35);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

/* Length + Width in one row on desktop */
.form-row {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 569px) {
    .form-row.form-row--length-width {
        flex-direction: row;
    }

    .form-row.form-row--length-width .form-group {
        flex: 1;
        min-width: 0;
    }
}

/* Premium money input (success modal) */
.form-group--deal-amount {
    margin-bottom: 18px;
}

.money-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    margin-top: 6px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.2s ease;
}

.money-input-wrapper:focus-within {
    border-color: #10b981;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.25);
}

.success-amount-input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    font-size: 20px;
    font-weight: 600;
    color: #fff;
}

.success-amount-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.currency-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.currency-text {
    opacity: 0.7;
    font-size: 14px;
    flex-shrink: 0;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.btn-cancel,
.btn-submit {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-cancel {
    background: #95a5a6;
    color: white;
}

.btn-cancel:hover {
    background: #7f8c8d;
}

.btn-cancel:active {
    transform: scale(0.98);
    transition: transform 0.1s;
}

.btn-submit {
    background: var(--accent-deep);
    color: white;
}

.btn-submit:hover {
    background: #1c9d6b;
}

.btn-submit:active {
    transform: scale(0.98);
    transition: transform 0.1s;
}

.form-group--checkbox label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
.form-group--checkbox input[type="checkbox"] {
    width: auto;
}

/* ============================================
   PAGINATION
   ============================================ */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 16px;
    padding: 12px 0;
    flex-wrap: wrap;
}

.pagination-info {
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.9);
}

.pagination-btn {
    padding: 8px 14px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 0.9em;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.pagination-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   TOAST NOTIFICATION
   ============================================ */

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 0.95em;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    animation: toast-in 0.3s ease;
    max-width: 90%;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.toast--success {
    background: var(--accent-deep);
    color: #fff;
}

.toast--call-back {
    background: #f1c40f;
    color: #1a1a1a;
}

.toast--rejected {
    background: #e74c3c;
    color: #fff;
}

/* Success modal (public form) */
.success-modal-content {
    text-align: center;
}

.success-modal-text {
    margin: 0;
    font-size: 1.1em;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.95);
}

/* ============================================
   USER MENU (ADMIN)
   ============================================ */

.user-menu-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-menu-trigger {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 7px;
    min-height: 36px;
    padding: 0 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--r-md);
    cursor: pointer;
    transition: background 0.2s;
    color: var(--text);
}

.user-menu-trigger:hover {
    background: rgba(255, 255, 255, 0.15);
}

.user-icon {
    width: 20px;
    height: 20px;
    margin-bottom: 0;
    color: var(--text-2);
}

.user-role-label {
    font-size: 0.75em;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    min-width: 140px;
    z-index: 100;
    overflow: hidden;
}

.user-dropdown-item {
    display: block;
    width: 100%;
    padding: 12px 16px;
    text-align: left;
    border: none;
    background: none;
    font-size: 0.9em;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.95);
    transition: background 0.2s;
}

.user-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.user-dropdown-item.logout {
    color: #f87171;
    font-weight: 600;
}

.add-client-btn {
    padding: 9px 18px;
    background: var(--accent);
    color: var(--on-accent);
    border: none;
    border-radius: var(--r-sm);
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.add-client-btn:hover {
    background: var(--accent-deep);
    transform: translateY(-1px);
}

.priority-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.priority-btn {
    padding: 8px 14px;
    border-radius: var(--r-sm);
    border: 1px solid var(--bd-2);
    background: var(--surface-2);
    color: var(--text);
    font-size: 0.85em;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.priority-btn.selected,
.priority-btn.active {
    background: var(--accent);
    color: var(--on-accent);
    border-color: transparent;
    font-weight: 500;
}

.priority-hint {
    font-size: 0.85em;
    color: rgba(255, 255, 255, 0.7);
    margin: 0 0 8px 0;
}

.priority-buttons--checkboxes .priority-btn--check {
    border-radius: 12px;
    padding: 10px 16px;
    position: relative;
}

.priority-buttons--checkboxes .priority-btn--check.active {
    box-shadow: 0 0 0 2px rgba(62, 207, 142, 0.5);
}

.priority-btn--disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    .form-wrapper,
    .admin-panel,
    .login-box {
        padding: 20px;
    }

    h1 {
        font-size: 1.5em;
    }

    .admin-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .table-controls {
        flex-direction: column;
        align-items: stretch;
        display: none;
    }

    .table-controls .btn-link,
    .table-search,
    .table-select {
        width: 100%;
    }

    .pagination {
        gap: 10px;
        margin-top: 12px;
    }

    .pagination-btn {
        padding: 6px 12px;
        font-size: 0.85em;
    }

    .toast {
        bottom: 16px;
        padding: 12px 20px;
        font-size: 0.9em;
    }

    .money-input-wrapper {
        padding: 12px 14px;
        gap: 8px;
    }

    .stage-counter {
        min-width: 24px;
        height: 24px;
        padding: 0 8px;
        font-size: 12px;
    }

    .stage-header {
        gap: 8px;
    }

    .success-amount-input {
        font-size: 18px;
    }

    .currency-text {
        font-size: 13px;
    }

    .managers-table th,
    .managers-table td {
        padding: 10px 12px;
        font-size: 0.9em;
    }

    .personal-stats-grid {
        grid-template-columns: 1fr;
    }

    .analytics-chart-row {
        flex-direction: column;
    }

    .controls-toggle {
        display: inline-flex;
        align-self: flex-start;
    }

    .table-controls-wrapper.controls-open .table-controls {
        display: flex;
    }

    .table-search,
    .table-select {
        padding: 8px 10px;
        font-size: 0.9em;
    }

    .lead-cards-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .lead-card {
        padding: 14px;
    }

    .lead-card-details {
        grid-template-columns: 1fr;
    }

    .lead-card-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .lead-card-assign {
        gap: 6px;
    }

    .assign-chip {
        flex: 1 1 auto;
        min-width: 0;
    }

    .leads-table {
        font-size: 0.9em;
    }

    .leads-table th,
    .leads-table td {
        padding: 10px;
    }

    .actions-cell {
        flex-direction: column;
    }

    .btn-done,
    .btn-not {
        width: 100%;
    }

    .leads-table thead {
        display: none;
    }

    .leads-table,
    .leads-table tbody,
    .leads-table tr,
    .leads-table td {
        display: block;
        width: 100%;
    }

    .leads-table tr {
        margin-bottom: 12px;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        padding: 10px 12px;
        background: white;
    }

    .leads-table td {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        border-bottom: none;
        padding: 6px 0;
    }

    .leads-table td.cell-name,
    .leads-table td.cell-phone {
        flex-direction: column;
        align-items: flex-start;
    }

    .leads-table td.cell-name {
        font-size: 1em;
        font-weight: 700;
    }

    .leads-table td.cell-phone {
        font-size: 0.95em;
        font-weight: 600;
        color: #333;
    }

    .leads-table td.cell-name::before,
    .leads-table td.cell-phone::before {
        margin-bottom: 4px;
        font-size: 0.75em;
    }

    .leads-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #666;
        margin-right: 12px;
        flex-shrink: 0;
    }

    .actions-cell {
        justify-content: flex-end;
        gap: 8px;
    }

    .btn-done,
    .btn-not,
    .btn-edit {
        width: auto;
    }
}

/* Notifications (bell) */
.notif-bell-wrap {
    position: relative;
    display: flex;
    align-items: center;
    z-index: 50;
}

.notif-bell-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--r-md);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-2);
    cursor: pointer;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.notif-bell-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text);
}

.notif-bell-ico {
    width: 20px;
    height: 20px;
}

.notif-bell-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 0.65rem;
    font-weight: 800;
    line-height: 18px;
    text-align: center;
    color: #fff;
    background: #e11d48;
    border-radius: 999px;
    border: 2px solid rgba(15, 23, 42, 0.9);
}

.notif-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: min(360px, calc(100vw - 32px));
    max-height: min(70vh, 420px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    z-index: 100;
}

.notif-dropdown-header {
    padding: 12px 16px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.notif-list {
    list-style: none;
    margin: 0;
    padding: 8px 0;
    overflow-y: auto;
    flex: 1;
}

.notif-item {
    padding: 10px 16px;
    border-left: 3px solid transparent;
    transition: background 0.15s;
}

.notif-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.notif-item--ok {
    border-left-color: var(--accent);
}

.notif-item--bad {
    border-left-color: #f43f5e;
}

.notif-item--wait {
    border-left-color: #fbbf24;
}

.notif-item-msg {
    margin: 0 0 4px;
    font-size: 0.88rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.95);
}

.notif-item-time {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.5);
}

.notif-empty {
    margin: 0;
    padding: 16px;
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
}

/* Manager pending strip */
.manager-pending-strip {
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(251, 191, 36, 0.35);
    background: rgba(251, 191, 36, 0.08);
}

.manager-pending-strip__head {
    margin-bottom: 8px;
}

.manager-pending-strip__title {
    font-size: 0.85rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
}

.manager-pending-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.manager-pending-chip {
    font-size: 0.8rem;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    color: rgba(255, 255, 255, 0.92);
}

.manager-pending-chip__type {
    font-weight: 700;
    color: #fef08a;
}

/* Time-locked lead cards */
.lead-card--time-locked {
    opacity: 0.6;
    cursor: not-allowed !important;
    position: relative;
}

.lead-card-timer-wrap {
    margin: -2px -2px 8px;
}

.lead-card-timer-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-text);
    background: color-mix(in srgb, var(--accent) 22%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
    box-shadow: none;
}

/* Boss approval queue */
.requests-page {
    width: 100%;
}

.requests-panel-outer {
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

.requests-panel-inner {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-height: min(88vh, 800px);
}

.requests-header-fixed {
    flex-shrink: 0;
    padding-bottom: 8px;
}

.requests-list-scroll {
    flex: 1;
    min-height: 0;
    max-height: min(70vh, 520px);
    overflow-y: auto;
    padding: 4px 2px 8px 0;
    scrollbar-gutter: stable;
}

.requests-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 0;
}

.requests-list--cards {
    padding-bottom: 8px;
}

.requests-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0 4px;
}

.requests-title {
    margin: 0;
}

.requests-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-deep));
    box-shadow: 0 2px 10px rgba(62, 207, 142, 0.4);
}

.requests-hint {
    margin: 0 0 4px;
    font-size: 0.9rem;
    opacity: 0.85;
}

.requests-skeleton {
    height: 120px;
    border-radius: 16px;
    background: linear-gradient(100deg, rgba(255,255,255,0.04) 30%, rgba(255,255,255,0.09) 50%, rgba(255,255,255,0.04) 70%);
    background-size: 200% 100%;
    animation: reqShimmer 1.3s ease-in-out infinite;
}

@keyframes reqShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.requests-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 48px 20px;
    text-align: center;
}

.requests-empty__ico {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1.6rem;
    color: var(--accent-text);
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.requests-empty__text {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.65);
}

.approval-card {
    position: relative;
    border-radius: 16px;
    padding: 16px 18px 16px 22px;
    text-align: left;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
    animation: reqCardIn 0.4s ease-out backwards;
}

@keyframes reqCardIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.approval-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.approval-card:hover {
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.18);
}

.approval-card--delete::before { background: linear-gradient(180deg, #f43f5e, #be123c); }
.approval-card--close::before  { background: linear-gradient(180deg, var(--accent), var(--accent-deep)); }

.approval-card--delete .approval-card__icon {
    background: rgba(244, 63, 94, 0.14);
    border: 1px solid rgba(244, 63, 94, 0.3);
}
.approval-card--close .approval-card__icon {
    background: rgba(34, 197, 94, 0.14);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.approval-card--delete .approval-card__type-badge {
    background: rgba(244, 63, 94, 0.2);
    color: #fda4af;
    border: 1px solid rgba(244, 63, 94, 0.4);
}
.approval-card--close .approval-card__type-badge {
    background: rgba(62, 207, 142, 0.18);
    color: var(--accent-text);
    border: 1px solid rgba(34, 197, 94, 0.4);
}

.approval-card__top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.approval-card__icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 1.15rem;
}

.approval-card__titles {
    flex: 1;
    min-width: 0;
}

.approval-card__name {
    font-size: 1.02rem;
    font-weight: 700;
    line-height: 1.25;
    color: rgba(255, 255, 255, 0.98);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.approval-card__phone {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 2px;
}

.approval-card__type-badge {
    flex-shrink: 0;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 5px 10px;
    border-radius: 8px;
    white-space: nowrap;
}

.approval-card__details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    margin-bottom: 12px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.18);
}

.approval-detail {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.88rem;
}

.approval-detail__k {
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
}

.approval-detail__v {
    color: rgba(255, 255, 255, 0.95);
    font-weight: 700;
}

.approval-detail__v--money { color: var(--accent-text); }

.approval-detail--comment {
    display: block;
    font-style: italic;
    color: rgba(255, 255, 255, 0.78);
    line-height: 1.4;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    padding-top: 8px;
}

.approval-card__foot {
    margin-bottom: 14px;
}

.approval-card__by {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.4;
}

.approval-card__by b { color: rgba(255, 255, 255, 0.82); font-weight: 700; }

.approval-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.approval-card__btn {
    flex: 1 1 42%;
    min-width: 120px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 14px;
    font-size: 0.9rem;
    font-weight: 700;
    border: none;
    border-radius: 11px;
    cursor: pointer;
    transition: filter 0.2s, transform 0.15s, box-shadow 0.2s;
}

.approval-card__btn:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.approval-card__btn:active { transform: translateY(0); }

.approval-card__btn--ok {
    color: #fff;
    background: linear-gradient(135deg, var(--accent-deep), var(--accent));
    box-shadow: 0 4px 14px rgba(22, 163, 74, 0.32);
}

.approval-card__btn--no {
    color: #fff;
    background: linear-gradient(135deg, #be123c, #e11d48);
    box-shadow: 0 4px 14px rgba(190, 18, 60, 0.32);
}

.approval-card__btn-ico {
    font-size: 0.95rem;
}

.lead-card--no-drag {
    cursor: not-allowed;
    opacity: 0.9;
}

.lead-card-pinned {
    font-size: 0.8rem;
    opacity: 0.95;
    margin: 4px 0 2px;
    line-height: 1.3;
    color: var(--text-2);
}
.lead-card-pinned--other {
    color: var(--accent-text);
}
.lead-card--actions-locked .btn-done:disabled,
.lead-card--actions-locked .btn-not:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}
button.btn-preparing-edit--disabled {
    cursor: not-allowed;
    opacity: 0.45;
    pointer-events: none;
}

/* ============================================
   ACTIVITY TIMELINE + RETURNING CUSTOMER
   ============================================ */

/* Returning-customer badge on a card */
.lead-card-returning {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 2px 0 4px;
    padding: 3px 9px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--accent-text);
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
    border-radius: 999px;
    cursor: pointer;
    transition: filter 0.15s, transform 0.15s;
}
.lead-card-returning:hover { filter: brightness(1.12); transform: translateY(-1px); }

/* Timeline (journal) button on a card */
.lead-card-actions .btn-log.btn-card {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 10px;
    font-size: 0.75rem;
    border-radius: 8px;
    line-height: 1.2;
    cursor: pointer;
    color: var(--text-2);
    background: var(--surface-2);
    border: 1px solid var(--bd);
    transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.15s ease, color 0.15s ease;
}
.lead-card-actions .btn-log.btn-card:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
    transform: translateY(-1px);
    box-shadow: none;
}

/* Timeline modal */
.modal-content--timeline {
    max-width: 560px;
    width: 100%;
    max-height: 86vh;
    display: flex;
    flex-direction: column;
}
.modal-content--timeline .modal-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow: hidden;
    min-height: 0;
    padding: 4px 2px;
}

/* Customer history (prior deals) */
.timeline-history {
    flex-shrink: 0;
    max-height: 30vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    border-radius: 14px;
    background: rgba(245, 158, 11, 0.07);
    border: 1px solid rgba(245, 158, 11, 0.22);
}
.timeline-history__title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #fcd34d;
    margin-bottom: 2px;
}
.hist-card {
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-left: 3px solid rgba(255, 255, 255, 0.2);
}
.hist-card--won { border-left-color: var(--accent); }
.hist-card--lost { border-left-color: #f43f5e; }
.hist-card--open { border-left-color: var(--accent); }
.hist-card__top {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.hist-status {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 3px 8px;
    border-radius: 7px;
}
.hist-status--won { background: rgba(62, 207, 142, 0.18); color: var(--accent-text); }
.hist-status--lost { background: rgba(244, 63, 94, 0.18); color: #fda4af; }
.hist-status--open { background: rgba(62, 207, 142, 0.2); color: var(--accent-text); }
.hist-amount { font-weight: 700; color: var(--accent-text); font-size: 0.9rem; }
.hist-date { margin-left: auto; font-size: 0.78rem; color: rgba(255,255,255,0.55); }
.hist-by { font-size: 0.8rem; color: rgba(255,255,255,0.7); margin-top: 6px; }
.hist-comment { font-size: 0.82rem; font-style: italic; color: rgba(255,255,255,0.78); margin-top: 6px; line-height: 1.4; }

/* Timeline feed */
.timeline-feed {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-right: 6px;
}
.timeline-empty {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    padding: 40px 12px;
    font-size: 0.92rem;
}
.timeline-item {
    display: flex;
    gap: 14px;
    position: relative;
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
}
.timeline-item__ico {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1.05rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.timeline-item__main {
    flex: 1;
    min-width: 0;
}
.timeline-item__title { font-size: 0.95rem; font-weight: 600; color: rgba(255,255,255,0.95); line-height: 1.35; }
.timeline-item__text {
    margin-top: 8px;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.88);
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.18);
}
.timeline-item__meta { margin-top: 8px; font-size: 0.78rem; color: rgba(255,255,255,0.5); }
.timeline-item--comment .timeline-item__ico { background: rgba(62,207,142,0.16); border-color: rgba(62,207,142,0.3); }
.timeline-item--closed_won .timeline-item__ico { background: rgba(34,197,94,0.16); border-color: rgba(34,197,94,0.3); }
.timeline-item--closed_lost .timeline-item__ico { background: rgba(244,63,94,0.16); border-color: rgba(244,63,94,0.3); }

/* Composer */
.timeline-composer {
    flex-shrink: 0;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.timeline-composer-input { flex: 1; resize: vertical; min-height: 42px; max-height: 140px; }
.timeline-send { flex-shrink: 0; white-space: nowrap; }
.timeline-send:disabled { opacity: 0.5; cursor: not-allowed; }

@media (max-width: 600px) {
    .modal-content--timeline { max-height: 92vh; }
    .timeline-history { max-height: 26vh; }
}

/* =====================================================================
   Доска на телефоне: колонки НЕ сужаются (контент не «жмётся»),
   листаются свайпом по одной как карусель (scroll-snap mandatory),
   край соседней колонки выглядывает как подсказка. Крупнее зоны тапа.
   ===================================================================== */
@media (max-width: 600px) {
    body { padding: 10px; }
    .kanban-board {
        gap: 10px;
        scroll-snap-type: x mandatory;
    }
    .kanban-column {
        flex: 0 0 86vw;
        width: 86vw;
        min-width: 0;
        max-width: 360px;
    }
    .lead-card-actions .btn-done.btn-card,
    .lead-card-actions .btn-not.btn-card,
    .lead-card-actions .btn-log.btn-card {
        padding: 9px 10px;
    }
}

/* =====================================================================
   TASKS (follow-up / reminders) — единый стиль на токенах
   ===================================================================== */
/* чип задачи на карточке */
.lead-card-task {
    display: flex; align-items: center; gap: 6px; width: 100%;
    margin-top: 2px; padding: 7px 10px; border-radius: 9px;
    font-size: 12px; font-weight: 600; text-align: left; cursor: pointer;
    color: var(--text-2); background: var(--surface-2); border: 1px solid var(--bd);
    transition: background .15s ease, border-color .15s ease, color .15s ease, transform .12s ease;
}
.lead-card-task:hover { background: rgba(255, 255, 255, 0.1); color: var(--text); transform: translateY(-1px); }
.lead-card-task .lct-ico { font-size: 12px; flex: 0 0 auto; }
.lead-card-task .lct-txt { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-card-task .lct-more { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 99px; background: var(--bd-2); color: var(--text); }
.lead-card-task--add { color: var(--text-3); border-style: dashed; background: transparent; }
.lead-card-task--add:hover { color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.lead-card-task.is-overdue { color: #f3b6c2; background: color-mix(in srgb, var(--danger) 14%, transparent); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.lead-card-task.is-today { color: #f0c074; background: color-mix(in srgb, var(--warn) 14%, transparent); border-color: color-mix(in srgb, var(--warn) 32%, transparent); }
.lead-card-task.is-soon { color: var(--accent-text); background: color-mix(in srgb, var(--accent) 12%, transparent); border-color: color-mix(in srgb, var(--accent) 28%, transparent); }

/* кнопка «Задачи» в верхней панели */
.tasks-nav-btn {
    position: relative; display: inline-flex; align-items: center; gap: 7px;
    padding: 7px 12px; border-radius: 9px; cursor: pointer;
    font-size: 13px; font-weight: 600; color: var(--text);
    background: var(--surface-2); border: 1px solid var(--bd);
    transition: background .15s ease, border-color .15s ease, transform .12s ease;
}
.tasks-nav-btn:hover { background: rgba(255, 255, 255, 0.1); transform: translateY(-1px); }
.tasks-nav-emoji { font-size: 13px; }
.tasks-nav-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px;
    font-size: 11px; font-weight: 800; color: #fff; background: var(--danger);
}

/* композер создания задачи */
.task-composer { display: flex; flex-direction: column; gap: 9px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--bd); }
.task-composer-row { display: flex; gap: 8px; }
.task-field { width: 100%; }
.task-when-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.task-when-chip {
    padding: 6px 10px; border-radius: 8px; font-size: 12px; font-weight: 600; cursor: pointer;
    color: var(--text-2); background: var(--surface-2); border: 1px solid var(--bd);
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.task-when-chip:hover { color: var(--text); }
.task-when-chip.active { color: var(--on-accent); background: var(--accent); border-color: transparent; }

/* строки задач (модалка лида + панель) */
.tasks-list, .tasks-panel-body { display: flex; flex-direction: column; gap: 8px; }
.tasks-empty { text-align: center; color: var(--text-3); font-size: 13px; padding: 18px 8px; }
.task-row {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px 12px; border-radius: 10px;
    background: var(--surface-2); border: 1px solid var(--bd);
}
.task-row--overdue { border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.task-row--done { opacity: .6; }
.task-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.task-row-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 12.5px; }
.task-row-type { font-weight: 700; color: var(--text); }
.task-row-due { color: var(--text-2); }
.task-row--overdue .task-row-due { color: #f3b6c2; }
.task-row-who { margin-left: auto; font-size: 11px; color: var(--text-3); }
.task-row-title { font-size: 12.5px; color: var(--text-2); }
.task-row-result { font-size: 12px; color: var(--text-3); font-style: italic; }
.task-row-lead { align-self: flex-start; font-size: 12.5px; font-weight: 600; color: var(--accent-text); background: none; border: none; padding: 0; cursor: pointer; text-align: left; }
.task-row-lead:hover { text-decoration: underline; }
.task-row-done {
    flex: 0 0 auto; width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 800;
    color: var(--text-2); background: var(--surface-2); border: 1px solid var(--bd-2);
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.task-row-done:hover { color: var(--on-accent); background: var(--accent); border-color: transparent; }

/* секции панели задач */
.tasks-section { display: flex; flex-direction: column; gap: 8px; margin-bottom: 6px; }
.tasks-section-head { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); margin-top: 6px; }
.tasks-section-head.is-overdue { color: #f3b6c2; }
.tasks-section-head.is-today { color: #f0c074; }
.tasks-section-count { font-size: 11px; padding: 1px 7px; border-radius: 99px; background: var(--bd-2); color: var(--text); }

/* переключатель «Мои / Все» */
.tasks-scope-toggle { display: inline-flex; gap: 4px; margin-left: auto; margin-right: 10px; }
.tasks-scope-btn { padding: 4px 12px; border-radius: 7px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--bd); }
.tasks-scope-btn.active { color: var(--on-accent); background: var(--accent); border-color: transparent; }

/* кнопка «Задачи» в навигации (с бейджем) */
.tasks-page-btn { display: inline-flex; align-items: center; gap: 6px; }
.tasks-page-btn .tasks-nav-badge { position: static; }

/* страница задач */
.tasks-page { padding: 18px 20px 22px; }
.tasks-page-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 6px 0 16px; }
.tasks-page-title { font-size: 1.15em; font-weight: 700; color: var(--text); margin: 0; }
.tasks-filter { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.tasks-filter-chip {
    padding: 5px 13px; border-radius: 8px; font-size: 12.5px; font-weight: 600; cursor: pointer;
    color: var(--text-2); background: var(--surface-2); border: 1px solid var(--bd);
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.tasks-filter-chip:hover { color: var(--text); }
.tasks-filter-chip.active { color: var(--on-accent); background: var(--accent); border-color: transparent; }
.tasks-page .tasks-panel-body { max-width: 720px; }
