* { box-sizing: border-box; }
:root {
    --srm-font: Arial, sans-serif;
    --srm-page-bg: #f6f7f9;
    --srm-text: #1f2937;
    --srm-text-muted: #6b7280;
    --srm-heading: #111827;
    --srm-surface: #ffffff;
    --srm-surface-2: #f9fafb;
    --srm-border: #e5e7eb;
    --srm-border-2: #dcdfe4;
    --srm-primary: #3a7bd5;
    --srm-primary-contrast: #ffffff;
    --srm-secondary-bg: #f3f4f6;
    --srm-secondary-text: #1f2937;
    --srm-link: #3a7bd5;
    --srm-shadow: rgba(15, 23, 42, 0.05);
    --srm-shadow-card: rgba(15, 23, 42, 0.08);
    --srm-danger: #d14343;
    --srm-reports-insights-bg: #eff6ff;
    --srm-reports-insights-border: #bfdbfe;
    --srm-reports-insights-text: #1e3a5f;
    --srm-reports-kpi-bg: #f8fafc;
    --srm-chip-info-bg: rgba(58, 123, 213, 0.14);
    --srm-chip-info-text: var(--srm-link);
    --srm-chip-tag-bg: rgba(79, 70, 229, 0.1);
    --srm-chip-tag-text: #4338ca;
    --srm-drop-highlight-bg: rgba(58, 123, 213, 0.1);
    --srm-cal-cell-bg: #f3f4f6;
    --srm-cal-chip-free-bg: rgba(14, 165, 233, 0.16);
    --srm-cal-chip-free-text: #0c4a6e;
    --srm-cal-chip-busy-bg: rgba(220, 38, 38, 0.12);
    --srm-cal-chip-busy-text: #991b1b;
    --srm-cal-chip-busy-border: rgba(220, 38, 38, 0.45);
    --srm-accent-soft-bg: rgba(58, 123, 213, 0.12);
    --srm-accent-soft-text: #1e40af;
    --srm-lead-convert-bg: #f5f3ff;
    --srm-lead-convert-border: #ddd6fe;
    --srm-card-inset-bg: var(--srm-surface-2);
}
body {
    margin: 0;
    font-family: var(--srm-font);
    background: var(--srm-page-bg);
    color: var(--srm-text);
}
body.tasks-active {
    overflow: hidden;
}
.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    background: var(--srm-surface);
    border-bottom: 1px solid var(--srm-border);
}
.brand {
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.brand-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
    border-radius: 6px;
    background: var(--srm-surface);
    border: 1px solid var(--srm-border);
}
.brand-name { line-height: 1; }
.tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    min-width: 0;
}
.tab {
    padding: 8px 14px;
    border: 1px solid var(--srm-border-2);
    background: var(--srm-surface);
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    color: var(--srm-text);
}
.tab.active { background: var(--srm-primary); color: var(--srm-primary-contrast); border-color: var(--srm-primary); }
.topbar-link {
    text-decoration: none;
    color: var(--srm-link);
    font-weight: 600;
}
.topbar-btn { display: inline-flex; align-items: center; justify-content: center; }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* Иконки чата / новых лидов в шапке */
@keyframes srm-topbar-notify-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
    50% { box-shadow: 0 0 0 5px rgba(239, 68, 68, 0.35); }
}
.topbar-site-chat-btn {
    position: relative;
    flex-shrink: 0;
}
.topbar-site-chat-btn.topbar-btn--notify-active {
    border-radius: 10px;
    animation: srm-topbar-notify-pulse 1.4s ease-in-out infinite;
}
.topbar-site-chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    box-sizing: border-box;
    pointer-events: none;
}

.lead-site-chat {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--srm-border);
}
.lead-site-chat-heading {
    margin: 0 0 6px;
    font-size: 15px;
}
.lead-site-chat-hint {
    margin: 0 0 10px !important;
}
.lead-site-chat-messages {
    max-height: 260px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
    padding: 8px;
    border-radius: 10px;
    background: var(--srm-surface-2);
    border: 1px solid var(--srm-border);
}
.lead-site-chat-bubble {
    max-width: 92%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}
.lead-site-chat-bubble--visitor {
    align-self: flex-start;
    background: var(--srm-surface);
    border: 1px solid var(--srm-border);
}
.lead-site-chat-bubble--operator {
    align-self: flex-end;
    margin-left: auto;
    background: var(--srm-primary);
    color: var(--srm-primary-contrast);
    border: 1px solid var(--srm-primary);
}
.lead-site-chat-compose {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.lead-site-chat-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--srm-border);
    font: inherit;
    resize: vertical;
    min-height: 44px;
}
.lead-site-chat-compose .btn {
    align-self: flex-start;
}

@media (max-width: 780px) {
    .modal {
        align-items: flex-start;
        justify-content: center;
        padding: 10px;
        padding-top: max(10px, env(safe-area-inset-top));
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .modal-content {
        width: 100%;
        max-width: 520px;
        max-height: min(92dvh, calc(100vh - 20px));
        display: flex;
        flex-direction: column;
        overflow: hidden;
        box-sizing: border-box;
        margin: 0 auto;
    }
    .modal-header {
        flex-shrink: 0;
    }
    .modal-body {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 12px;
    }
    .lead-site-chat-messages {
        max-height: min(180px, 36vh);
    }
    .lead-site-chat-compose .btn {
        width: 100%;
        align-self: stretch;
        justify-content: center;
        box-sizing: border-box;
    }
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}
.topbar-back {
    flex-shrink: 0;
}
.topbar-menu-link {
    text-decoration: none;
    color: var(--srm-link);
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid transparent;
    white-space: nowrap;
}
.topbar-menu-link:hover { background: var(--srm-secondary-bg); }
.topbar-menu-link--logout { color: var(--srm-text-muted); }
.logout { text-decoration: none; color: var(--srm-link); }

.mobile-menu-toggle {
    display: none;
    margin-left: auto;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--srm-border-2);
    border-radius: 10px;
    background: var(--srm-surface);
    cursor: pointer;
    color: var(--srm-text);
    flex-shrink: 0;
}
.mobile-menu-toggle:hover { background: var(--srm-surface-2); }
.mobile-menu-icon {
    display: block;
    width: 20px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
    position: relative;
    transition: background 0.2s ease;
}
.mobile-menu-icon::before,
.mobile-menu-icon::after {
    content: '';
    position: absolute;
    left: 0;
    width: 20px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
    transition: transform 0.2s ease, top 0.2s ease;
}
.mobile-menu-icon::before { top: -7px; }
.mobile-menu-icon::after { top: 7px; }
.topbar.nav-open .mobile-menu-icon {
    background: transparent;
}
.topbar.nav-open .mobile-menu-icon::before {
    top: 0;
    transform: rotate(45deg);
}
.topbar.nav-open .mobile-menu-icon::after {
    top: 0;
    transform: rotate(-45deg);
}

.topbar-mobile-sheet {
    /* filled in media queries */
}

@media (min-width: 781px) {
    .topbar .tabs {
        flex: 1;
    }
    .mobile-menu-toggle {
        display: none !important;
    }
    .topbar-mobile-sheet {
        display: contents;
    }
}

@media (max-width: 780px) {
    body.mobile-nav-open {
        overflow: hidden;
        touch-action: none;
    }
    .topbar {
        flex-wrap: wrap;
        position: sticky;
        top: 0;
        z-index: 200;
        column-gap: 12px;
        row-gap: 0;
        padding-inline: 14px;
        padding-block: 10px;
    }
    .topbar .brand {
        flex: 1;
        min-width: 0;
    }
    .topbar .brand-name {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .mobile-menu-toggle {
        display: inline-flex;
        margin-left: auto;
    }
    .topbar-mobile-sheet {
        display: none;
        flex-basis: 100%;
        width: 100%;
        padding: 12px 0 14px;
        margin-top: 10px;
        border-top: 1px solid var(--srm-border);
        background: var(--srm-surface);
    box-shadow: 0 12px 32px var(--srm-shadow-card);
    }
    .topbar.nav-open .topbar-mobile-sheet {
        display: block;
    }
    .topbar-mobile-sheet .tabs {
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 6px;
        width: 100%;
        overflow: visible;
        padding-bottom: 0;
        margin-inline: 0;
    }
    .topbar-mobile-sheet .tab {
        width: 100%;
        text-align: left;
        white-space: normal;
        padding: 11px 14px;
        flex-shrink: 0;
    }
    .topbar-mobile-sheet .topbar-actions {
        margin-left: 0;
        margin-top: 12px;
        padding-top: 12px;
        border-top: 1px solid var(--srm-border);
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 4px;
    }
    .topbar-mobile-sheet .topbar-menu-link {
        width: 100%;
        text-align: left;
        padding: 12px 14px;
    }
    .topbar-mobile-sheet .topbar-actions .icon-btn.topbar-btn {
        align-self: flex-start;
    }
}

main { padding: 20px; }
.tab-pane { display: none; }
.tab-pane.active { display: flex; gap: 16px; }
#tab-contacts.active { flex-direction: column; }
#tab-payments.active { flex-direction: column; }
#tab-booking.active { flex-direction: column; }
#tab-reports.active {
    flex-direction: column;
    align-items: stretch;
    min-width: 0;
    width: 100%;
}

.leads-panel {
    width: 20%;
    min-width: 220px;
    background: var(--srm-surface);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 4px 16px var(--srm-shadow);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 120px);
}
.pipelines {
    flex: 1;
    background: var(--srm-surface);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 4px 16px var(--srm-shadow);
    min-width: 0;
    overflow: hidden;
}
#tab-board.no-leads .pipelines {
    width: 100%;
}
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.panel-actions { display: flex; gap: 6px; }
.icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--srm-border-2);
    background: var(--srm-surface);
    cursor: pointer;
    color: var(--srm-text);
    font: inherit;
}
.leads-list { display: flex; flex-direction: column; gap: 8px; overflow: auto; }
.lead-card {
    background: var(--srm-card-inset-bg);
    border: 1px solid var(--srm-border);
    border-radius: 10px;
    padding: 10px;
}
.lead-card.lead-converted,
.pipeline-item.lead-converted {
    background: var(--srm-lead-convert-bg);
    border-color: var(--srm-lead-convert-border);
}
.lead-card.lead-existing-client,
.pipeline-item.lead-existing-client {
    background: var(--srm-lead-existing-bg, #ecfdf5);
    border-color: var(--srm-lead-existing-border, #86efac);
}
.lead-badge-existing {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--srm-lead-existing-badge, #166534);
    background: var(--srm-lead-existing-badge-bg, #dcfce7);
    border-radius: 4px;
    padding: 2px 6px;
    margin-bottom: 6px;
}
.lead-existing-hint {
    margin: 0 0 12px;
    padding: 10px 12px;
    background: var(--srm-lead-existing-bg, #ecfdf5);
    border: 1px solid var(--srm-lead-existing-border, #86efac);
    border-radius: 8px;
}
.lead-card { cursor: grab; }
.lead-card .name { font-weight: 600; color: var(--srm-heading); }
.lead-card .actions { margin-top: 6px; display: flex; gap: 6px; }

.pipelines-board { display: flex; flex-direction: column; gap: 12px; }
.pipeline-column {
    background: var(--srm-surface-2);
    border: 1px solid var(--srm-border);
    border-radius: 10px;
    padding: 10px;
    min-width: 0;
    overflow: hidden;
}
.pipeline-header {
    cursor: grab;
}
.pipeline-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.pipeline-header .pipeline-title {
    flex: 1;
    min-width: 0;
}
.pipeline-reorder-mobile {
    display: none;
}
.pipeline-reorder-btn {
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.pipeline-reorder-btn .icon {
    width: 16px;
    height: 16px;
    display: block;
}
.icon-btn:disabled {
    opacity: 0.38;
    cursor: not-allowed;
}
.pipeline-column .icon-btn:disabled {
    pointer-events: none;
}
.pipeline-column.pipeline-dragging { opacity: 0.6; }
.pipeline-column.pipeline-drop-target { outline: 2px dashed var(--srm-primary); }
.pipelines-board.pipelines-dragging .pipeline-column { transition: transform 0.1s ease; }
.pipeline-stages-row {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 6px;
    max-width: 100%;
}
.pipeline-stage-column {
    flex: 0 0 auto;
    min-width: 220px;
    box-sizing: border-box;
    /* Как .tasks-column: фон из темы, акцент — рамкой и заголовком */
    background: var(--srm-surface-2);
    border: 1px solid var(--srm-border);
    border-radius: 10px;
    padding: 8px;
}
/* Без своего цвета в настройках — те же акценты, что колонки сроков в задачах (today → older_week по кругу) */
.pipeline-stage-column:not(.pipeline-stage-column--custom-bg)[data-stage-tone="0"] {
    border-color: #bbf7d0;
}
.pipeline-stage-column:not(.pipeline-stage-column--custom-bg)[data-stage-tone="0"] .stage-header-title {
    color: #166534;
}
.pipeline-stage-column:not(.pipeline-stage-column--custom-bg)[data-stage-tone="1"] {
    border-color: #fde68a;
}
.pipeline-stage-column:not(.pipeline-stage-column--custom-bg)[data-stage-tone="1"] .stage-header-title {
    color: #b45309;
}
.pipeline-stage-column:not(.pipeline-stage-column--custom-bg)[data-stage-tone="2"] {
    border-color: #fde047;
}
.pipeline-stage-column:not(.pipeline-stage-column--custom-bg)[data-stage-tone="2"] .stage-header-title {
    color: #a16207;
}
.pipeline-stage-column:not(.pipeline-stage-column--custom-bg)[data-stage-tone="3"] {
    border-color: #ddd6fe;
}
.pipeline-stage-column:not(.pipeline-stage-column--custom-bg)[data-stage-tone="3"] .stage-header-title {
    color: #6d28d9;
}
.pipeline-stage-column:not(.pipeline-stage-column--custom-bg)[data-stage-tone="4"] {
    border-color: var(--srm-border);
}
.pipeline-stage-column:not(.pipeline-stage-column--custom-bg)[data-stage-tone="4"] .stage-header-title {
    color: var(--srm-text-muted);
}
.stage-header {
    font-weight: 600;
    margin-bottom: 6px;
}
.pipeline-stage-column .stage-header:hover .stage-header-title {
    color: var(--srm-primary);
}
.stage-header-title {
    display: block;
    transition: color 0.2s ease;
}
.pipeline-archive-tools {
    margin-top: 4px;
}
.pipeline-archive-toggle-btn {
    font-size: 12px;
    padding: 0;
    border: none;
    background: none;
    color: var(--srm-primary);
    cursor: pointer;
    text-align: left;
    font-weight: 400;
    line-height: 1.3;
}
.pipeline-archive-toggle-btn:hover {
    color: var(--srm-link);
    text-decoration: underline;
}
.pipeline-title {
    transition: color 0.2s ease;
}
.pipeline-title:hover {
    color: var(--srm-primary);
}
.stage-items { min-height: 40px; display: flex; flex-direction: column; gap: 6px; }
.pipeline-item {
    background: var(--srm-card-inset-bg);
    border: 1px solid var(--srm-border);
    border-radius: 8px;
    padding: 8px;
    position: relative;
    color: var(--srm-text);
}
.pipeline-item { cursor: grab; }
.pipeline-item-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--srm-border);
    position: relative;
}
.pipeline-move-stage-btn {
    color: var(--srm-primary);
}
.pipeline-move-stage-dropdown-item-current {
    background: var(--srm-accent-soft-bg);
    color: var(--srm-accent-soft-text);
}

/* Точки-этапы под заголовком воронки (только на узком экране) */
.pipeline-mobile-stage-dots {
    display: none;
}
@media (max-width: 780px) {
    .pipeline-mobile-stage-dots {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: center;
        gap: 4px;
        margin: -2px 0 10px;
        padding-inline: 4px;
    }
    .pipeline-stage-dot {
        box-sizing: border-box;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        padding: 0;
        margin: 0;
        border: none;
        background: transparent;
        cursor: pointer;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    .pipeline-stage-dot::after {
        content: '';
        display: block;
        width: 10px;
        height: 10px;
        border-radius: 3px;
        background: #cbd5e1;
        box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.12);
    }
    .pipeline-stage-dot[data-stage-tone="0"]::after {
        background: #16a34a;
        box-shadow: inset 0 0 0 1px rgba(21, 128, 61, 0.2);
    }
    .pipeline-stage-dot[data-stage-tone="1"]::after {
        background: #f59e0b;
        box-shadow: inset 0 0 0 1px rgba(180, 83, 9, 0.2);
    }
    .pipeline-stage-dot[data-stage-tone="2"]::after {
        background: #facc15;
        box-shadow: inset 0 0 0 1px rgba(161, 98, 7, 0.18);
    }
    .pipeline-stage-dot[data-stage-tone="3"]::after {
        background: #c4b5fd;
        box-shadow: inset 0 0 0 1px rgba(109, 40, 217, 0.2);
    }
    .pipeline-stage-dot[data-stage-tone="4"]::after {
        background: #cbd5e1;
        box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.12);
    }
    .pipeline-stage-dot.pipeline-stage-dot--custom::after {
        background: var(--pipeline-stage-dot-fill, #cbd5e1);
    }
    .pipeline-stage-dot.pipeline-stage-dot--contact::after {
        background: #22c55e;
        box-shadow: inset 0 0 0 1px rgba(21, 128, 61, 0.25);
    }
    .pipeline-stage-dot:active::after {
        transform: scale(0.92);
    }

    /* Воронки на мобилке — без карточек-обёрток (как доска задач), этапы — свайп-карусель */
    .pipelines {
        background: transparent;
        box-shadow: none;
        border-radius: 0;
        padding: 0;
        overflow: visible;
    }
    .pipelines-board {
        gap: 22px;
    }
    .pipeline-column {
        background: transparent;
        border: none;
        border-radius: 0;
        padding: 0;
        overflow: visible;
    }
    .pipeline-header.panel-header {
        margin-bottom: 10px;
    }
    .pipeline-reorder-mobile {
        display: inline-flex;
        align-items: center;
        gap: 4px;
    }
    .pipeline-stages-row {
        flex-wrap: nowrap;
        gap: 0;
        padding-bottom: 8px;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        scrollbar-width: thin;
    }
    .pipeline-stage-column {
        flex: 0 0 100%;
        width: 100%;
        min-width: 0;
        scroll-snap-align: start;
        scroll-snap-stop: always;
        /* Фон задают тема по тону этапа или inline при «Своём цвете» — не перебиваем единым surface-2 */
        /* Запас под липкий topbar, если браузер всё же подкрутит страницу к снапу/фокусу */
        scroll-margin-top: calc(12px + env(safe-area-inset-top, 0px) + 56px);
    }
}

/* Выпадающий список этапов воронки позиционируется через JS (fixed), чтобы не резался overflow карусели */
.pipeline-move-stage-dropdown.open {
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.22);
    touch-action: pan-y;
    overscroll-behavior: contain;
}
.pipeline-item-time {
    margin-top: 2px;
    font-size: 11px;
    color: var(--srm-text-muted);
}
.stage-items.drag-over {
    outline: 2px dashed var(--srm-primary);
    background: #eef4ff;
}

.filters { display: flex; gap: 8px; flex-wrap: wrap; width: 100%; }
.contacts-filters { margin-bottom: 12px; }
.filters-total {
    margin-left: auto;
    font-weight: 600;
    color: var(--srm-text);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
}
.filter-date-field {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.filter-date-label {
    font-size: 13px;
    color: var(--srm-text-muted);
    white-space: nowrap;
}
.filters input, .filters select {
    padding: 12px 14px;
    border: 1px solid var(--srm-border-2);
    border-radius: 8px;
    font-size: 15px;
    min-height: 44px;
    background: var(--srm-surface);
    color: var(--srm-text);
}
.filters select[multiple] {
    background-image: none;
    padding-right: 14px;
}
.filters select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, #9ca3af 50%), linear-gradient(135deg, #9ca3af 50%, transparent 50%);
    background-position: calc(100% - 18px) 18px, calc(100% - 12px) 18px;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    padding-right: 34px;
}
.filters input:focus, .filters select:focus {
    outline: none;
    border-color: var(--srm-primary);
    box-shadow: 0 0 0 3px rgba(58, 123, 213, 0.16);
}
.contacts-body { display: grid; grid-template-columns: 30% 70%; gap: 16px; min-width: 0; }
.contacts-list-panel, .contact-card {
    background: var(--srm-surface);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 4px 16px var(--srm-shadow);
    min-height: 360px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.contact-card {
    overflow-x: hidden;
}
.contacts-filter-search-row,
.payments-filter-search-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 220px;
    min-width: 0;
}
.contacts-filter-name-input,
.payments-filter-name-input {
    flex: 1;
    min-width: 0;
}
.contacts-filter-more-btn,
.payments-filter-more-btn {
    display: none;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--srm-border-2);
    border-radius: 8px;
    background: var(--srm-surface);
    color: var(--srm-text-muted);
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}
.contacts-filter-more-btn:hover,
.payments-filter-more-btn:hover {
    border-color: var(--srm-primary);
    color: var(--srm-primary);
}
.contacts-filters.contacts-filter-extra-open .contacts-filter-more-btn,
.payments-filters.payments-filter-extra-open .payments-filter-more-btn {
    border-color: var(--srm-primary);
    color: var(--srm-primary);
    box-shadow: 0 0 0 3px rgba(58, 123, 213, 0.16);
}
.contacts-filter-more-btn:focus-visible,
.payments-filter-more-btn:focus-visible {
    outline: none;
    border-color: var(--srm-primary);
    box-shadow: 0 0 0 3px rgba(58, 123, 213, 0.16);
}
/* Не использовать display:contents — иначе на мобилке display:none на обёртке не скрывает селекты в части браузеров */
.contacts-filter-extra-wrap,
.payments-filter-extra-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1 1 240px;
    align-items: center;
    min-width: 0;
}
.contacts-list-panel h2 {
    margin: 0 0 10px;
}
.contacts-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    max-height: 650px;
    flex: 1;
}
.contact-card textarea,
.contact-card input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--srm-border-2);
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 15px;
    min-height: 44px;
    background: var(--srm-surface-2);
    color: var(--srm-text);
    box-sizing: border-box;
}
.contact-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--srm-border-2);
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 15px;
    min-height: 44px;
    background: var(--srm-surface-2);
    color: var(--srm-text);
    box-sizing: border-box;
}
.contact-card-split {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    margin-top: 12px;
    min-width: 0;
}
.contact-card-column {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}
.contact-tags-container {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--srm-border);
}
.contact-tag-chip {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    border: 1px solid;
    display: inline-block;
    white-space: nowrap;
}
.contact-link-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    min-width: 0;
}
.contact-link-row a {
    overflow-wrap: anywhere;
    word-break: break-word;
}
.contact-mini-icon {
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--srm-text-muted);
    flex: 0 0 auto;
}
.contact-mini-icon svg {
    width: 14px;
    height: 14px;
    display: block;
}
.contact-card a {
    color: var(--srm-primary);
    text-decoration: none;
}
.contact-card a:hover {
    text-decoration: underline;
}
.contact-card-column > div:first-child {
    min-width: 0;
    align-self: stretch;
}
.contact-card-column > div:first-child h3 {
    min-width: 0;
}
.contact-payments-total {
    font-weight: 600;
}
.contact-payments-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.contact-payment-item {
    padding: 6px 8px;
    border: 1px solid var(--srm-border);
    border-radius: 8px;
    background: var(--srm-surface-2);
    cursor: pointer;
    overflow-wrap: anywhere;
    word-break: break-word;
    min-width: 0;
}
.comment-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
    max-height: 50vh;
    overflow-y: auto;
}
.comment-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
}
.comment-input-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.comment-input-wrapper textarea {
    flex: 1;
    min-height: 60px;
    resize: vertical;
    padding: 12px 14px;
    border: 1px solid var(--srm-border-2);
    border-radius: 8px;
    font-size: 15px;
    background: var(--srm-surface-2);
    color: var(--srm-text);
    box-sizing: border-box;
}
.comment-buttons-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    align-self: flex-start;
}
.comment-send-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.comment-attach-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.comment-attach-btn {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 14px;
    cursor: pointer;
    padding: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}
.comment-attach-btn:hover {
    color: var(--srm-text-muted);
}
.comment-file-name {
    font-size: 13px;
    color: var(--srm-text-muted);
    padding: 4px 8px;
    background: var(--srm-secondary-bg);
    border-radius: 4px;
}
.comment-file {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--srm-border);
}
.comment-file a {
    color: var(--srm-primary);
    text-decoration: none;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.comment-file a:hover {
    text-decoration: underline;
}
.comment-row {
    padding: 6px 8px;
    border: 1px solid var(--srm-border);
    border-radius: 8px;
    background: var(--srm-surface-2);
    cursor: context-menu;
}
.comment-date {
    font-size: 12px;
    color: var(--srm-text-muted);
    margin-bottom: 2px;
}
.comment-text {
    white-space: pre-wrap;
    overflow-wrap: break-word;
    word-break: break-word;
}
.comment-context-menu {
    position: fixed;
    z-index: 7000;
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 6px;
    background: var(--srm-surface);
    border: 1px solid var(--srm-border);
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(0,0,0,0.12);
}
.comment-context-menu.visible { display: flex; }
.comment-context-menu button {
    background: var(--srm-surface);
    border: 1px solid var(--srm-border);
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 13px;
    text-align: left;
}
.comment-context-menu button:hover { background: var(--srm-secondary-bg); }
.contact-main-comment,
.contact-requisites {
    white-space: pre-wrap;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
}
.contact-row {
    padding: 8px;
    border-bottom: 1px solid var(--srm-border);
    cursor: pointer;
    min-width: 0;
    max-width: 100%;
}
.contact-row-title {
    font-weight: 600;
    margin-bottom: 2px;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.contact-row-comment {
    color: var(--srm-text-muted);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.contact-row:last-child { border-bottom: none; }
.contact-card.empty { display: flex; align-items: center; justify-content: center; color: var(--srm-text-muted); }

.payments-filters { margin-bottom: 12px; }
.payments-total {
    flex: 0 0 auto;
}
.payments-body { display: grid; grid-template-columns: 30% 70%; gap: 16px; min-width: 0; }
.payments-list-panel, .payment-card {
    background: var(--srm-surface);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.05);
    min-height: 360px;
    min-width: 0;
}
.payments-list { display: flex; flex-direction: column; gap: 8px; }
.payment-row {
    padding: 8px;
    border-bottom: 1px solid var(--srm-border);
    cursor: pointer;
}
.payment-row:last-child { border-bottom: none; }
.payment-row .row-title { font-weight: 600; }
.payment-row .row-meta { color: var(--srm-text-muted); font-size: 12px; }
.payment-card.empty { display: flex; align-items: center; justify-content: center; color: var(--srm-text-muted); }

/* Reports */
.reports-filters {
    margin-bottom: 8px;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    width: 100%;
    box-sizing: border-box;
    background: var(--srm-surface);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 4px 16px var(--srm-shadow);
}
.reports-period-label {
    margin: 0 0 12px;
    font-size: 14px;
    color: var(--srm-text-muted);
    width: 100%;
    box-sizing: border-box;
}
.reports-period-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.reports-loading {
    padding: 8px 0;
    color: var(--srm-text-muted);
}
.reports-loading.is-hidden {
    display: none;
}
.reports-root {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding-bottom: 48px;
}
.reports-section {
    background: var(--srm-surface);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 4px 16px var(--srm-shadow);
}
.reports-section-title {
    margin: 0 0 12px;
    font-size: 17px;
    color: var(--srm-heading);
}
.reports-subtitle {
    margin: 16px 0 8px;
    font-size: 14px;
    color: var(--srm-text-muted);
}
.reports-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}
.reports-kpi {
    background: var(--srm-reports-kpi-bg);
    border: 1px solid var(--srm-border);
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.reports-kpi--wide {
    grid-column: 1 / -1;
}
.reports-kpi-label {
    font-size: 11px;
    color: var(--srm-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.reports-kpi-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--srm-text);
    word-break: break-word;
}
.reports-kpi--link {
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: inherit;
    width: 100%;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.reports-kpi--link:hover,
.reports-kpi--link:focus-visible {
    border-color: var(--primary, #0066ff);
    background: var(--srm-bg, #fff);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.12);
    outline: none;
}
.reports-kpi--split {
    background: var(--srm-reports-kpi-bg);
    border: 1px solid var(--srm-border);
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.reports-kpi-value--split {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px;
}
.reports-kpi-inline-link {
    border: none;
    background: none;
    padding: 0;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    color: var(--primary, #0066ff);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.reports-kpi-inline-link:hover,
.reports-kpi-inline-link:focus-visible {
    opacity: 0.85;
    outline: none;
}
.reports-kpi-split-sep {
    font-weight: 600;
    opacity: 0.55;
}
.reports-row-link {
    cursor: pointer;
}
.reports-row-link:hover td {
    background: rgba(0, 102, 255, 0.06);
}
.reports-bar-row.reports-bar-row--link {
    width: 100%;
    border: none;
    background: none;
    padding: 4px 6px;
    margin: 0;
    border-radius: 6px;
    cursor: pointer;
    font: inherit;
    color: inherit;
    text-align: left;
}
.reports-bar-row--link:hover,
.reports-bar-row--link:focus-visible {
    background: rgba(0, 102, 255, 0.08);
    outline: none;
}
.reports-drill-highlight {
    animation: reports-drill-pulse 2.5s ease-out;
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.45);
}
@keyframes reports-drill-pulse {
    0% { box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.55); }
    100% { box-shadow: 0 0 0 0 rgba(0, 102, 255, 0); }
}
.reports-leads-period-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0 0 10px;
    padding: 8px 10px;
    font-size: 13px;
    background: var(--srm-reports-insights-bg);
    border: 1px solid var(--srm-reports-insights-border);
    border-radius: 8px;
    color: var(--srm-reports-insights-text);
}
.reports-leads-period-banner-close {
    flex-shrink: 0;
    border: 1px solid var(--srm-border);
    background: var(--srm-bg, #fff);
    color: var(--primary, #0066ff);
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
}
.reports-leads-period-banner-close:hover {
    background: var(--srm-secondary-bg);
}
.reports-two-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 8px;
}
@media (max-width: 900px) {
    .reports-two-cols {
        grid-template-columns: 1fr;
    }
}
.reports-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.reports-table th,
.reports-table td {
    border: 1px solid var(--srm-border);
    padding: 8px;
    text-align: left;
    color: var(--srm-text);
}
.reports-table th {
    background: var(--srm-secondary-bg);
}
.reports-muted {
    color: var(--srm-text-muted);
    font-size: 13px;
}
.reports-error {
    background: #fef2f2;
    color: #991b1b;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #fecaca;
}
.reports-insights {
    background: var(--srm-reports-insights-bg);
    border: 1px solid var(--srm-reports-insights-border);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 16px;
}
.reports-insights .reports-section-title {
    color: var(--srm-heading);
}
.reports-insights-list {
    margin: 8px 0 0;
    padding-left: 18px;
    color: var(--srm-reports-insights-text);
}
.reports-bars {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.reports-bar-row {
    display: grid;
    grid-template-columns: 100px 1fr 100px;
    gap: 8px;
    align-items: center;
    font-size: 12px;
}
@media (max-width: 520px) {
    .reports-bar-row {
        grid-template-columns: 72px 1fr 72px;
    }
}
.reports-bar-date {
    color: var(--srm-text-muted);
}
.reports-bar-track {
    height: 10px;
    background: var(--srm-border);
    border-radius: 6px;
    overflow: hidden;
}
.reports-bar-fill {
    height: 100%;
    background: #22c55e;
    border-radius: 6px;
    min-width: 2px;
}
.reports-bar-fill--blue {
    background: var(--srm-primary);
}
.reports-bar-sum {
    text-align: right;
    font-weight: 600;
    color: var(--srm-text);
}
.reports-hint {
    font-size: 12px;
    color: var(--srm-text-muted);
    margin: 0 0 10px;
}

.empty-state-text {
    color: var(--srm-text-muted);
    text-align: center;
    padding: 20px;
}
.payment-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.payment-card .card-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.payment-history {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}
.payment-history .history-item {
    padding: 6px 8px;
    border: 1px solid var(--srm-border);
    border-radius: 8px;
    background: var(--srm-surface-2);
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 6000;
    background: rgba(0,0,0,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal.hidden { display: none; }
.modal.modal-stack {
    z-index: 6500;
}
.modal.modal-stack .modal-content {
    width: min(520px, 96vw);
    max-height: min(80vh, 720px);
    display: flex;
    flex-direction: column;
}
.modal.modal-stack .modal-body {
    overflow: auto;
    min-height: 0;
}
body.deal-modal-open .tasks-modal.open {
    z-index: 7200;
}
body.deal-modal-open .tasks-modal-overlay.open {
    z-index: 7100;
}
.modal-content {
    width: 520px;
    background: var(--srm-surface);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
}
.modal-content.pipeline-modal .modal-body {
    max-height: 70vh;
    overflow: auto;
    padding-right: 6px;
}
.description-modal-content {
    width: 520px;
    max-width: 90%;
    background: var(--srm-surface);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
}
.description-modal-body {
    padding: 0;
    font-size: 15px;
    line-height: 1.6;
    color: #374151;
    white-space: normal;
    word-wrap: break-word;
}
.description-modal-body p {
    margin: 0 0 12px 0;
}
.description-modal-body p:last-child {
    margin-bottom: 0;
}
.description-modal-body strong {
    font-weight: 600;
    color: var(--srm-heading);
}
.description-modal-body br {
    line-height: 1.6;
}
.description-modal-body .form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}
.description-modal-body .form-group label {
    font-weight: 600;
    font-size: 14px;
    color: #374151;
}
.description-modal-body .form-input,
.description-modal-body .form-textarea,
.description-modal-body select,
.description-modal-body #link-label,
.description-modal-body #link-script-id {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--srm-border-2);
    border-radius: 8px;
    font-size: 14px;
    background: var(--srm-surface);
    color: var(--srm-text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
    font-family: inherit;
}
.description-modal-body select,
.description-modal-body #link-script-id {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23374151' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}
.description-modal-body .form-input:focus,
.description-modal-body .form-textarea:focus,
.description-modal-body select:focus {
    outline: none;
    border-color: var(--srm-primary);
    box-shadow: 0 0 0 3px rgba(58, 123, 213, 0.16);
}
.description-modal-body .form-textarea {
    resize: vertical;
    min-height: 80px;
}
.description-modal-body .form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--srm-border);
}
.description-modal-body .hint {
    font-size: 12px;
    color: var(--srm-text-muted);
    margin-top: 4px;
}
.description-modal-body .btn,
.description-modal-body .btn-secondary {
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    min-width: 100px;
}
.description-modal-body form {
    display: flex;
    flex-direction: column;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.modal-header h3 {
    margin: 0;
    flex: 1;
    min-width: 0;
    font-size: 1.1rem;
}
.modal-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.modal-content.deal-modal-wide {
    width: min(920px, 96vw);
    max-width: 96vw;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    padding: 16px;
    box-sizing: border-box;
}
.modal-content.deal-modal-wide .modal-body {
    overflow: auto;
    flex: 1;
    min-height: 0;
    padding-right: 6px;
}
.modal-content.deal-modal-wide .task-contact-dropdown {
    z-index: 400;
}
.deal-editor-scroll {
    padding-bottom: 8px;
}
.deal-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 20px;
    align-items: start;
}
@media (max-width: 720px) {
    .deal-form-grid {
        grid-template-columns: 1fr;
    }
}
.deal-form-col .deal-editor-section,
.deal-view-summary .deal-editor-section {
    margin-bottom: 0;
}
.deal-view-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 20px;
    margin-bottom: 16px;
}
@media (max-width: 720px) {
    .deal-view-grid {
        grid-template-columns: 1fr;
    }
}
.deal-view-summary {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.deal-view-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.deal-view-field .deal-view-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--srm-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.deal-view-field .deal-view-value {
    font-size: 15px;
    color: var(--srm-text);
    line-height: 1.45;
}
.deal-view-desc {
    font-size: 14px;
    color: var(--srm-text);
    line-height: 1.55;
    white-space: pre-wrap;
    padding: 12px;
    background: var(--srm-surface-2);
    border-radius: 10px;
    border: 1px solid var(--srm-border);
}
.deal-checklist-view-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--srm-border);
}
.deal-checklist-view-row:last-child {
    border-bottom: none;
}
.deal-checklist-view-row input[type='checkbox'] {
    margin-top: 3px;
}
.deal-checklist-view-row--done span,
.deal-checklist-view-row--done .deal-checklist-view-label {
    color: var(--srm-text-muted);
    text-decoration: line-through;
}
.deal-timeline {
    margin-top: 10px;
}
.modal-content.deal-modal-wide .deal-timeline {
    max-height: 320px;
    overflow: auto;
    padding-right: 4px;
}
.deal-timeline-item {
    margin-bottom: 12px;
}
.deal-timeline-item.deal-timeline-event {
    padding: 10px 12px;
    background: var(--srm-surface-2);
    border-radius: 8px;
    border: 1px solid var(--srm-border);
    font-size: 13px;
    color: var(--srm-text-muted);
}
.deal-timeline-item.deal-timeline-event strong {
    color: var(--srm-heading);
    font-weight: 600;
}
.deal-pending-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 13px;
    color: var(--srm-text-muted);
}
.modal-body input, .modal-body textarea, .modal-body select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--srm-border);
    border-radius: 8px;
    margin-bottom: 8px;
    background: var(--srm-surface-2);
    color: var(--srm-heading);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.modal-body input[type="checkbox"] {
    width: auto;
    padding: 0;
    border: none;
    border-radius: 4px;
    margin: 0;
    background: transparent;
    box-shadow: none;
}
.modal-body input:focus, .modal-body textarea:focus, .modal-body select:focus {
    outline: none;
    border-color: var(--srm-primary);
    background: var(--srm-surface);
    box-shadow: 0 0 0 3px rgba(58, 123, 213, 0.16);
}
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.field label {
    display: block;
    font-size: 12px;
    color: var(--srm-text-muted);
    margin-bottom: 6px;
}
.field .field-hint {
    margin-top: 6px;
    font-size: 12px;
    color: var(--srm-text-muted);
}
.field-actions {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.multi-select {
    min-height: 92px;
}
.checkbox-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--srm-text);
}
.field.full { grid-column: 1 / -1; }
.modal-actions { display: flex; justify-content: flex-end; margin-top: 8px; }
.modal-actions.modal-actions-split { justify-content: space-between; }
.sources-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}
.source-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 8px;
    border: 1px solid var(--srm-border);
    border-radius: 8px;
    background: var(--srm-surface-2);
}
.source-row .source-delete {
    width: 28px;
    height: 28px;
}
.stages-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 6px 0 8px;
}
.stages-list { display: flex; flex-direction: column; gap: 8px; }
.stage-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.stage-row-main {
    display: grid;
    grid-template-columns: 1fr minmax(132px, 1fr) 32px;
    gap: 8px;
    align-items: start;
}
.stage-color-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.stage-color-custom-label {
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
    color: var(--srm-text);
}
.stage-color-auto-hint {
    font-size: 11px;
    line-height: 1.25;
    color: var(--srm-text-muted);
}
.stage-row:not(.stage-row--auto-stage-color) .stage-color-auto-hint {
    display: none;
}
.stage-row.stage-row--auto-stage-color .stage-color {
    display: none;
}
.stage-row .stage-color {
    width: 100%;
    height: 40px;
    padding: 0;
    border: 1px solid var(--srm-border);
    border-radius: 8px;
    background: var(--srm-surface);
    box-sizing: border-box;
}
.stage-row .stage-remove { width: 32px; height: 32px; }
.stage-row .stage-description {
    min-height: 64px;
    resize: vertical;
}
.stage-description-editable,
.pipeline-description-editable {
    width: 100%;
    min-height: 64px;
    padding: 10px 12px;
    border: 1px solid var(--srm-border);
    border-radius: 8px;
    margin-bottom: 8px;
    background: var(--srm-surface-2);
    color: var(--srm-heading);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    outline: none;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.stage-description-editable:focus,
.pipeline-description-editable:focus {
    border-color: var(--srm-primary);
    box-shadow: 0 0 0 3px rgba(58, 123, 213, 0.1);
    background: var(--srm-surface);
}
.stage-description-editable.empty:before,
.pipeline-description-editable.empty:before {
    content: attr(data-placeholder);
    color: #9ca3af;
    pointer-events: none;
}
.stage-description-editable.empty,
.pipeline-description-editable.empty {
    color: #9ca3af;
}
@media (max-width: 780px) {
    .context-menu-item {
        padding: 12px 14px;
        min-height: 44px;
        font-size: 15px;
    }
    .form-grid { grid-template-columns: 1fr; }
    .leads-panel { width: 100%; }
    .tab-pane.active { flex-direction: column; }
    #tab-contacts.active {
        min-width: 0;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    .contacts-filters,
    .payments-filters {
        flex-wrap: nowrap;
        flex-direction: column;
        align-items: stretch;
    }
    .contacts-filter-search-row,
    .payments-filter-search-row {
        flex: none;
        width: 100%;
    }
    .contacts-filter-extra-wrap,
    .payments-filter-extra-wrap {
        display: none !important;
        flex: none;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 8px;
    }
    .contacts-filters.contacts-filter-extra-open .contacts-filter-extra-wrap {
        display: flex !important;
    }
    .payments-filters.payments-filter-extra-open .payments-filter-extra-wrap {
        display: flex !important;
    }
    .contacts-filter-extra-wrap select,
    .contacts-filter-extra-wrap .filter-date-field,
    .payments-filter-extra-wrap select,
    .payments-filter-extra-wrap .filter-date-field {
        width: 100%;
        box-sizing: border-box;
    }
    .contacts-filter-extra-wrap select,
    .payments-filter-extra-wrap select {
        min-width: 0;
        max-width: 100%;
    }
    .contacts-filter-more-btn,
    .payments-filter-more-btn {
        display: inline-flex;
    }
    .payments-total {
        margin-left: 0;
        width: 100%;
        justify-content: flex-start;
    }
    .contacts-body {
        grid-template-columns: 1fr;
        min-width: 0;
        width: 100%;
        max-width: 100%;
    }
    .contacts-body.contacts-mobile-detail-open .contacts-list-panel {
        display: none;
    }
    .contacts-list-panel {
        max-width: 100%;
    }
    .contacts-list {
        max-height: none;
    }
    .payments-body {
        grid-template-columns: 1fr;
        min-width: 0;
        width: 100%;
        max-width: 100%;
    }
    .payments-body:not(.payments-mobile-detail-open) .payment-card {
        display: none;
    }
    .payments-body.payments-mobile-detail-open .payments-list-panel {
        display: none;
    }
    .contact-card-split { grid-template-columns: 1fr; }
    .lead-card {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
}
.btn {
    background: var(--srm-primary);
    border: none;
    color: var(--srm-primary-contrast);
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    width: fit-content;
    font: inherit;
}
.btn-secondary {
    background: var(--srm-secondary-bg);
    color: var(--srm-secondary-text);
    border: 1px solid var(--srm-border);
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
}
.btn.btn-danger { background: #d14343; }
.btn.btn-sm {
    padding: 6px 10px;
    font-size: 12px;
    line-height: 1.2;
}

#tab-tasks.active { 
    flex-direction: column; 
    height: calc(100vh - 102px);
    overflow: visible;
}

@media (max-width: 780px) {
    #tab-tasks.active {
        height: calc(100vh - 128px);
        height: calc(100dvh - 128px);
    }
    body.tasks-active main {
        padding-left: 10px;
        padding-right: 10px;
        padding-bottom: 8px;
    }
}
.tasks-layout {
    display: flex;
    width: 100%;
    height: 100%;
    overflow: hidden;
}
.tasks-sidebar,
.tasks-content {
    background: var(--srm-surface);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.05);
}
.tasks-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}
.tasks-content--boot .tasks-container {
    visibility: hidden;
}
.tasks-content--boot .empty-state {
    display: none !important;
}
.tasks-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.filter-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 8px;
    cursor: pointer;
}
.filter-item:hover {
    background: var(--srm-secondary-bg);
}
.filter-item input {
    margin: 0;
}
.tasks-container {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 6px;
    flex: 1;
    min-height: 0;
    width: 100%;
    max-width: 100%;
    touch-action: manipulation;
}
.tasks-column {
    min-width: 240px;
    background: var(--srm-surface-2);
    border: 1px solid var(--srm-border);
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 100%;
}
.tasks-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-weight: 600;
    color: var(--srm-text);
}
.tasks-column-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tasks-column-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.tasks-column-add-btn {
    display: none;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 999px;
    background: var(--srm-primary);
    color: var(--srm-primary-contrast);
    box-shadow: 0 8px 18px rgba(58, 123, 213, 0.28);
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    align-items: center;
    justify-content: center;
}
.tasks-column-count {
    font-size: 12px;
    color: var(--srm-text-muted);
    background: var(--srm-surface);
    border: 1px solid var(--srm-border);
    border-radius: 999px;
    padding: 2px 8px;
}
.tasks-column-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 40px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}
.tasks-subsection {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.tasks-subsection-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--srm-text-muted);
}
.tasks-column.today .tasks-column-header,
.tasks-column[data-stage="today"] .tasks-column-header {
    color: #166534;
}
.tasks-column.today,
.tasks-column[data-stage="today"] {
    border-color: #bbf7d0;
}
.tasks-column[data-stage="tomorrow"] .tasks-column-header {
    color: #b45309;
}
.tasks-column[data-stage="tomorrow"] {
    border-color: #fde68a;
}
.tasks-column[data-stage="later_week"] .tasks-column-header {
    color: #a16207;
}
.tasks-column[data-stage="later_week"] {
    border-color: #fde047;
}
.tasks-column[data-stage="next_week"] .tasks-column-header {
    color: #6d28d9;
}
.tasks-column[data-stage="next_week"] {
    border-color: #ddd6fe;
}
.tasks-column[data-stage="older_week"] .tasks-column-header {
    color: var(--srm-text-muted);
}
.tasks-column[data-stage="older_week"] {
    border-color: var(--srm-border);
}
.tasks-column[data-stage="no_due"] .tasks-column-header {
    color: #1d4ed8;
}
.tasks-column[data-stage="no_due"] {
    border-color: #bfdbfe;
}
.tasks-column-header--toggle {
    cursor: pointer;
}
.tasks-column-chevron {
    width: 14px;
    flex-shrink: 0;
    color: var(--srm-text-muted);
    font-size: 11px;
    line-height: 1;
}
.tasks-column-chevron::before {
    content: '▾';
}
.tasks-column.is-collapsed {
    min-width: 52px;
    width: 52px;
    flex: 0 0 52px;
    padding: 10px 6px;
    cursor: pointer;
}
.tasks-column.is-collapsed .tasks-column-body {
    display: none;
}
.tasks-column.is-collapsed .tasks-column-header {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    height: 100%;
    gap: 10px;
}
.tasks-column.is-collapsed .tasks-column-title {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    overflow: visible;
    text-overflow: clip;
}
.tasks-column.is-collapsed .tasks-column-chevron::before {
    content: '▸';
}
.tasks-column.is-collapsed .tasks-column-add-btn {
    display: none !important;
}
.tasks-subsection.overdue .tasks-subsection-title {
    color: #b91c1c;
}
.tasks-subsection.today .tasks-subsection-title {
    color: #166534;
}
.tasks-column.completed {
    background: var(--srm-secondary-bg);
}
.tasks-column.completed .tasks-column-header {
    color: var(--srm-text-muted);
}
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px 12px;
    color: var(--srm-text-muted);
    text-align: center;
}
.empty-icon svg {
    width: 48px;
    height: 48px;
    fill: none;
}
.empty-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--srm-text-muted);
}
.task-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.task-section-title {
    margin: 0;
    font-size: 16px;
    color: var(--srm-text);
}
.task-card {
    background: var(--srm-surface);
    border: 1px solid var(--srm-border);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.task-card.completed {
    opacity: 0.7;
}
.task-status-bar {
    height: 4px;
    border-radius: 4px;
    background: var(--srm-border);
}
.task-status-bar.completed { background: #16a34a; }
.task-status-bar.overdue { background: #dc2626; }
.task-status-bar.today { background: #16a34a; }
.tasks-column[data-stage="today"] .task-status-bar:not(.overdue):not(.completed) { background: #16a34a; }
.tasks-column[data-stage="tomorrow"] .task-status-bar:not(.overdue):not(.completed) { background: #f59e0b; }
.tasks-column[data-stage="later_week"] .task-status-bar:not(.overdue):not(.completed) { background: #facc15; }
.tasks-column[data-stage="next_week"] .task-status-bar:not(.overdue):not(.completed) { background: #c4b5fd; }
.tasks-column[data-stage="older_week"] .task-status-bar:not(.overdue):not(.completed) { background: var(--srm-border); }
.tasks-column[data-stage="no_due"] .task-status-bar:not(.overdue):not(.completed) { background: #93c5fd; }
.task-header {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}
.task-main {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}
.task-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}
.task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12px;
    color: var(--srm-text-muted);
}
.task-due-date {
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--srm-secondary-bg);
    color: var(--srm-text-muted);
    border: 1px solid var(--srm-border);
}
.task-due-date.overdue {
    background: #fee2e2;
    color: #b91c1c;
}
.task-due-date.today {
    background: #fef3c7;
    color: #92400e;
}
.task-contact {
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--srm-chip-info-bg);
    color: var(--srm-chip-info-text);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font: inherit;
    border: 1px solid var(--srm-border);
}
.task-contact-link {
    cursor: pointer;
}
.task-contact-link:hover {
    filter: brightness(1.06);
}
.task-actions {
    display: flex;
    gap: 6px;
    width: 100%;
    align-items: center;
    justify-content: flex-end;
    border-top: 1px solid var(--srm-border);
    padding-top: 6px;
    position: relative;
}
.task-reminder-icon {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid var(--srm-border);
    background: var(--srm-surface);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--srm-text-muted);
}
.task-reminder-icon .icon {
    width: 14px;
    height: 14px;
    fill: none;
}
.task-action-btn,
.task-complete-checkbox {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid var(--srm-border);
    background: var(--srm-surface);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.task-action-btn.danger {
    border-color: #fecaca;
    color: #b91c1c;
}
.task-complete-checkbox.checked {
    background: #16a34a;
    border-color: #16a34a;
}
.task-complete-checkbox.checked::after {
    content: '✓';
    color: var(--srm-primary-contrast);
    font-size: 14px;
}
.task-action-btn .icon {
    width: 14px;
    height: 14px;
    fill: none;
}
.task-color-btn {
    color: var(--srm-text-muted);
}
.task-move-stage-btn {
    color: var(--srm-primary);
}
.task-move-stage-dropdown {
    position: absolute;
    right: 0;
    bottom: calc(100% + 8px);
    display: none;
    width: min(240px, calc(100vw - 36px));
    padding: 6px;
    border: 1px solid var(--srm-border);
    border-radius: 12px;
    background: var(--srm-surface);
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.18);
    z-index: 120;
}
.task-move-stage-dropdown.open {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.task-move-stage-dropdown-item {
    width: 100%;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: var(--srm-text);
    cursor: pointer;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 12px;
    text-align: left;
}
.task-move-stage-dropdown-item:hover,
.task-move-stage-dropdown-item:focus {
    background: var(--srm-accent-soft-bg);
    color: var(--srm-accent-soft-text);
    outline: none;
}
.task-card[style*="background-color"] {
    border-color: transparent;
}
.task-details {
    display: none;
    border-top: 1px solid var(--srm-border);
    padding-top: 8px;
    gap: 8px;
}
.task-details.expanded {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.task-description {
    font-size: 14px;
    color: var(--srm-text-muted);
}
.checklist {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.checklist-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}
.checklist-checkbox {
    width: 18px;
    height: 18px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: var(--srm-surface);
    cursor: pointer;
}
.checklist-checkbox.checked {
    background: #16a34a;
    border-color: #16a34a;
}
.checklist-checkbox.checked::after {
    content: '✓';
    color: var(--srm-primary-contrast);
    font-size: 12px;
    display: inline-block;
    margin-left: 3px;
}
.checklist-text.completed {
    text-decoration: line-through;
    color: #9ca3af;
}
.checklist-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.checklist-form-item {
    display: flex;
    gap: 8px;
}
.checklist-form-item input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--srm-border-2);
    border-radius: 8px;
}
.remove-checklist-item {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--srm-border);
    background: var(--srm-surface);
    cursor: pointer;
}
.tasks-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}
.tasks-modal.open {
    display: flex;
}
.tasks-modal-content {
    background: var(--srm-surface);
    border-radius: 12px;
    max-width: 640px;
    width: 100%;
    max-height: calc(100vh - 40px);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.2);
    padding: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
@media (max-width: 780px) {
    .tasks-modal.task-modal-create {
        padding-inline: 0;
    }
    .tasks-modal.task-modal-create .tasks-modal-content {
        max-width: none;
        width: 100%;
        border-radius: 0;
    }
}
@media (min-width: 781px) {
    .tasks-modal.task-modal-create .tasks-modal-content {
        max-width: 640px;
        width: 100%;
        border-radius: 12px;
    }
    .tasks-modal.task-modal-create {
        padding: 20px;
    }
}
.tasks-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}
.tasks-modal-header-leading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 18px;
    flex: 1;
    min-width: 0;
}
.tasks-modal-header-leading h2 {
    margin: 0;
}
.task-modal-complete-wrap {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-color, #1e293b);
    line-height: 1.2;
}
.task-modal-complete-wrap[hidden] {
    display: none !important;
}
.task-modal-complete-input {
    width: 26px;
    height: 26px;
    min-width: 26px;
    margin: 0;
    flex-shrink: 0;
    accent-color: var(--primary, #3b82f6);
    cursor: pointer;
}
.task-modal-complete-text {
    white-space: nowrap;
}
@media (max-width: 480px) {
    .task-modal-complete-text {
        white-space: normal;
    }
}
.tasks-modal-body {
    margin-bottom: 12px;
}
.task-form {
    overflow-y: auto;
    flex: 1;
    padding-right: 4px;
}
.task-form::-webkit-scrollbar {
    width: 6px;
}
.task-form::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}
.task-form::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}
.task-form::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
.tasks-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1900;
}
.tasks-modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.tasks-modal-content.task-move-stage-modal-content {
    max-width: 420px;
    width: calc(100vw - 40px);
}
.task-move-stage-modal-body {
    max-height: min(58vh, 400px);
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}
.task-move-stage-hint {
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--srm-text-muted);
    line-height: 1.45;
}
.task-move-stage-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.task-move-stage-item {
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--srm-border);
    background: var(--srm-surface);
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    color: var(--srm-text);
    transition: background 0.15s ease, border-color 0.15s ease;
}
.task-move-stage-item:hover {
    background: var(--srm-surface-2);
    border-color: var(--srm-border-2);
}
.task-move-stage-item.task-move-stage-item--current {
    border-color: var(--srm-primary);
    background: var(--srm-accent-soft-bg);
    color: var(--srm-accent-soft-text);
}
.task-move-stage-item.task-move-stage-item--current:active {
    background: var(--srm-secondary-bg);
}

.task-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}
.task-form .form-input,
.task-form .form-textarea {
    padding: 10px 12px;
    border: 1px solid var(--srm-border-2);
    border-radius: 8px;
    font-size: 14px;
    background: var(--srm-surface-2);
    color: var(--srm-text);
}
.task-form .form-textarea {
    resize: vertical;
}
.task-contact-combobox {
    position: relative;
}
.task-contact-dropdown {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    margin-top: 4px;
    max-height: 220px;
    overflow-y: auto;
    background: var(--srm-surface);
    border: 1px solid var(--srm-border-2);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    z-index: 100;
}
.task-contact-dropdown.open {
    display: block;
}
.task-contact-dropdown-item,
.task-contact-dropdown-empty {
    padding: 10px 12px;
    font-size: 14px;
    cursor: pointer;
}
.task-contact-dropdown-item:hover {
    background: #f0f4f8;
}
.task-contact-dropdown-empty {
    color: var(--srm-text-muted);
    cursor: default;
}
.date-time-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
.add-task-btn-fixed {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    background: var(--srm-primary);
    color: var(--srm-primary-contrast);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.2);
    z-index: 1860;
}
body.tasks-active .add-task-btn-fixed,
.add-task-btn-fixed.is-visible {
    display: inline-flex;
}
@media (max-width: 780px) {
    .add-task-btn-fixed {
        display: none !important;
    }
    #btn-add-lead,
    .add-lead-btn-fixed {
        display: none !important;
    }
}
.add-task-btn-fixed .icon {
    width: 22px;
    height: 22px;
    fill: none;
}
.add-lead-btn-fixed {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    background: var(--srm-primary);
    color: var(--srm-primary-contrast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.2);
    z-index: 1500;
}
#tab-board:not(.active) .add-lead-btn-fixed {
    display: none;
}
.add-lead-btn-fixed .icon {
    width: 22px;
    height: 22px;
    fill: none;
}
.loading {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.6);
    /* Ниже FAB и модалок (иначе затемняет всё включая форму задачи и диалог перемещения) */
    z-index: 1580;
}
.loading.show {
    display: flex;
}
.loading-spinner {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid #d1d5db;
    border-top-color: var(--srm-primary);
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.contact-task-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.contact-reminders-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}
.reminder-item {
    padding: 6px 8px;
    border: 1px solid var(--srm-border);
    border-radius: 8px;
    background: var(--srm-surface-2);
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.reminder-item span {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.reminder-delete-btn {
    background: transparent;
    border: none;
    color: #ef4444;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}
.reminder-delete-btn:hover {
    background: #fee2e2;
}
.contact-tasks-list {
    max-height: 60vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.contact-tasks-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.contact-task-item {
    padding: 8px 10px;
    border: 1px solid var(--srm-border);
    border-radius: 8px;
    background: var(--srm-surface-2);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.contact-task-item-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    text-align: left;
}
.contact-task-item .contact-task-delete {
    flex-shrink: 0;
    padding: 4px 10px;
    font-size: 13px;
}
.contact-task-item:hover {
    background: var(--srm-secondary-bg);
}
.contact-task-item span {
    font-size: 13px;
    color: var(--srm-text-muted);
}
.contact-task-item-completed {
    opacity: 0.6;
}
.contact-task-item-completed strong {
    text-decoration: line-through;
}
.task-card.drag-over {
    outline: 2px dashed var(--srm-primary);
    outline-offset: 6px;
    background: var(--srm-drop-highlight-bg);
}

.tasks-column-body.drag-over,
.tasks-subsection.drag-over,
.task-section.drag-over {
    outline: 2px dashed var(--srm-primary);
    outline-offset: -4px;
    background: var(--srm-drop-highlight-bg);
    border-radius: 10px;
}

@media (max-width: 900px) {
    .tasks-container {
        gap: 10px;
    }
}

@media (max-width: 780px) {
    .tasks-container.tasks-container--carousel {
        scroll-snap-type: x mandatory;
        scroll-padding-inline: 0;
        -webkit-overflow-scrolling: touch;
        gap: 0;
        scrollbar-width: none;
        -ms-overflow-style: none;
        touch-action: pan-x pinch-zoom;
        overscroll-behavior-x: contain;
    }
    .tasks-container.tasks-container--carousel::-webkit-scrollbar {
        display: none;
        width: 0;
        height: 0;
    }
    .tasks-container.tasks-container--carousel > .tasks-column,
    .tasks-container.tasks-container--carousel > .task-section {
        flex: 0 0 100%;
        min-width: 100%;
        max-width: 100%;
        scroll-snap-align: start;
        scroll-snap-stop: always;
        box-sizing: border-box;
        height: 100%;
        min-height: 0;
    }
    .tasks-container.tasks-container--carousel > .tasks-column.is-collapsed {
        width: auto;
        flex: 0 0 100%;
        min-width: 100%;
        max-width: 100%;
        padding: 0 4px;
    }
    .tasks-container.tasks-container--carousel > .tasks-column.is-collapsed .tasks-column-body {
        display: flex;
    }
    .tasks-container.tasks-container--carousel > .tasks-column.is-collapsed .tasks-column-header {
        flex-direction: row;
        align-items: center;
        height: auto;
        justify-content: space-between;
    }
    .tasks-container.tasks-container--carousel > .tasks-column.is-collapsed .tasks-column-title {
        writing-mode: horizontal-tb;
        transform: none;
    }
    .tasks-container.tasks-container--carousel .tasks-column-chevron {
        display: none;
    }
    .tasks-container.tasks-container--carousel .tasks-column-body {
        scrollbar-width: none;
        -ms-overflow-style: none;
        touch-action: pan-y;
    }
    .tasks-container.tasks-container--carousel .tasks-column-body::-webkit-scrollbar {
        display: none;
        width: 0;
        height: 0;
    }

    body.tasks-active .tasks-layout,
    body.tasks-active .tasks-content {
        background: transparent;
        box-shadow: none;
        border-radius: 0;
    }
    body.tasks-active .tasks-content {
        padding: 0 0 4px;
    }
    body.tasks-active .tasks-container.tasks-container--carousel .tasks-column {
        background: transparent;
        border: none;
        padding: 0 4px;
        gap: 8px;
    }
    body.tasks-active .tasks-container.tasks-container--carousel .tasks-column-header {
        font-size: 1.28rem;
        position: sticky;
        top: 0;
        z-index: 60;
        padding: 2px 2px 10px;
        margin-bottom: 4px;
        border-bottom: 1px solid var(--srm-border);
        background: var(--srm-surface);
        backdrop-filter: blur(10px);
    }
    body.tasks-active .tasks-container.tasks-container--carousel .tasks-column-add-btn {
        display: inline-flex;
    }
    body.tasks-active .tasks-container.tasks-container--carousel .tasks-column-count {
        font-size: 11px;
        padding: 2px 7px;
    }
    body.tasks-active .tasks-container.tasks-container--carousel .tasks-subsection-title {
        display: none;
    }
    body.tasks-active .tasks-container.tasks-container--carousel .task-card {
        padding: 10px 12px;
        gap: 6px;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
    body.tasks-active .tasks-container.tasks-container--carousel .task-title {
        font-size: 15px;
    }
}

.task-card-touch-ghost {
    position: fixed;
    z-index: 6000;
    max-width: min(90vw, 340px);
    padding: 12px 14px;
    background: var(--srm-surface);
    border-radius: 12px;
    border: 2px solid var(--srm-primary);
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.22);
    pointer-events: none;
    font-weight: 600;
    font-size: 15px;
    color: var(--srm-text);
    line-height: 1.35;
}
.task-card-touch-source {
    opacity: 0.32;
}
.tasks-column-touch-hint {
    outline: 2px dashed var(--srm-primary);
    outline-offset: 3px;
    border-radius: 10px;
}

.context-menu {
    position: fixed;
    z-index: 1000;
    background: var(--srm-surface);
    border: 1px solid var(--srm-border);
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
    padding: 6px;
    min-width: 180px;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}
.context-menu.hidden {
    display: none;
}
.context-menu-item {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--srm-heading);
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
}
.context-menu-item:hover {
    background: var(--srm-secondary-bg);
}

.settings-page {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.settings-title {
    margin: 0;
    font-size: 22px;
}
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}
.settings-card {
    background: var(--srm-surface);
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.05);
}
.settings-card h2 {
    margin: 0 0 10px;
    font-size: 16px;
}
.settings-inline {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}
.settings-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.settings-form label {
    font-size: 12px;
    color: var(--srm-text-muted);
}
.settings-page input {
    padding: 10px 12px;
    border: 1px solid var(--srm-border);
    border-radius: 8px;
    background: var(--srm-surface-2);
    color: var(--srm-heading);
}
.settings-page select,
.settings-form select {
    padding: 10px 12px;
    border: 1px solid var(--srm-border);
    border-radius: 8px;
    background: var(--srm-surface-2);
    color: var(--srm-heading);
    max-width: 100%;
}
.brand-preview-wrap {
    padding: 8px;
    background: var(--srm-surface-2);
    border: 1px dashed var(--srm-border);
    border-radius: 8px;
}
.brand-preview {
    max-width: 160px;
    max-height: 80px;
    display: none;
}
.brand-preview.visible { display: block; }

.settings-card-wide {
    grid-column: 1 / -1;
}
.booking-embed-textarea {
    width: 100%;
    min-height: 110px;
    font-family: ui-monospace, Consolas, monospace;
    font-size: 12px;
    line-height: 1.4;
    padding: 10px 12px;
    border: 1px solid var(--srm-border);
    border-radius: 8px;
    background: var(--srm-surface-2);
    color: var(--srm-heading);
    resize: vertical;
}
.booking-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}
.booking-admin-sub {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 10px;
    color: #374151;
}
.booking-two-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.booking-weekdays {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-bottom: 4px;
}
.booking-weekdays label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
}
.booking-slots-table {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 360px;
    overflow-y: auto;
    padding-right: 4px;
}
.booking-slot-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 8px 12px;
    background: var(--srm-surface-2);
    border-radius: 8px;
    border: 1px solid var(--srm-border);
    font-size: 13px;
}
.booking-slot-row.booked {
    border-left: 3px solid var(--srm-primary);
}
.booking-slot-meta {
    color: var(--srm-text-muted);
    font-size: 12px;
    margin-top: 2px;
}
.booking-slot-actions {
    display: flex;
    justify-content: flex-end;
}

.booking-mail-templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin: 12px 0 16px;
}
.booking-mail-block strong {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: #374151;
}
.booking-mail-block label {
    display: block;
    font-size: 12px;
    color: var(--srm-text-muted);
    margin: 8px 0 4px;
}
.booking-mail-block .form-input-like,
.booking-mail-block input[type='text'] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--srm-border);
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
}

.contact-widget-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin: 12px 0 16px;
}
.cw-color-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    margin: 10px 0;
}
.cw-color-row label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    margin: 0;
    color: var(--srm-text, #374151);
}
.cw-color-row input[type='color'] {
    width: 44px;
    height: 36px;
    padding: 2px;
    border: 1px solid var(--srm-border);
    border-radius: 8px;
    cursor: pointer;
}
.cw-icon-slot {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid var(--srm-border);
}
.cw-icon-slot > span:first-child {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--srm-text-muted);
    margin-bottom: 6px;
}
.cw-icon-thumb {
    max-width: 52px;
    max-height: 52px;
    object-fit: contain;
    margin-top: 8px;
}

.feedback-forms-settings {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 8px;
}
.feedback-form-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.feedback-forms-empty {
    margin: 0;
}

.booking-tab-layout {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 16px 20px 32px;
    width: 100%;
    margin: 0;
    box-sizing: border-box;
    flex: 1 1 auto;
    min-width: 0;
}

.booking-page-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: stretch;
}

@media (max-width: 960px) {
    /* Мобила/планшет: календарь «Слоты» сверху, затем «Добавить запись», в конце «вручную и генерация».
       Десктоп (шире 961px): две карточки в ряд, календарь снизу на всю ширину */
    #tab-booking .booking-tab-layout {
        gap: 20px;
    }
    #tab-booking .booking-calendar-panel {
        order: -1;
    }
    #tab-booking .booking-page-split {
        display: flex;
        flex-direction: column-reverse;
        gap: 20px;
    }
    #tab-booking .booking-add-header {
        margin-bottom: 0;
    }
    #tab-booking .booking-add-hint-toggle {
        display: inline-flex;
    }
    #tab-booking .booking-add-hint {
        display: none;
        margin: 8px 0 12px;
    }
    #tab-booking .booking-add-hint.booking-add-hint--open {
        display: block;
    }
    #tab-booking .booking-add-contact-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    #tab-booking .booking-add-contact-row .task-contact-combobox {
        flex: 0 0 auto;
        width: 100%;
    }
    #tab-booking .booking-add-contact-row .btn-shrink {
        width: 100%;
    }
    #tab-booking .booking-two-cols {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    #tab-booking .booking-admin-inner {
        gap: 16px;
    }
    #tab-booking .booking-admin-block--border {
        padding-top: 14px;
    }
    #tab-booking .booking-card-intro {
        margin: 0 0 12px;
        font-size: 12px;
    }
    #tab-booking .settings-form input[type='datetime-local'],
    #tab-booking .settings-form input[type='date'],
    #tab-booking .settings-form input[type='time'],
    #tab-booking .settings-form input[type='number'] {
        max-width: 100%;
        box-sizing: border-box;
    }
    /* Массовая очистка только с десктопа — на телефоне легко промахнуться */
    #tab-booking #booking-slots-clear-free {
        display: none;
    }
}

.booking-card {
    background: var(--srm-surface);
    border: 1px solid var(--srm-border);
    border-radius: 12px;
    padding: 16px 18px 20px;
    box-sizing: border-box;
    min-width: 0;
}

.booking-card-title {
    margin: 0 0 12px;
    font-size: 18px;
    font-weight: 600;
    color: var(--srm-heading);
}

.booking-admin-inner {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.booking-admin-block--border {
    padding-top: 16px;
    border-top: 1px solid var(--srm-border);
}

.booking-add-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}
.booking-add-header .booking-add-title {
    margin-bottom: 0;
    flex: 1;
    min-width: 0;
}
.booking-add-hint-toggle {
    display: none;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: -10px -6px -10px 0;
    padding: 0;
    border: 1px solid var(--srm-border);
    border-radius: 10px;
    background: var(--srm-surface-2);
    color: var(--srm-text-muted);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.booking-add-hint-toggle:hover {
    background: var(--srm-secondary-bg);
    border-color: var(--srm-border);
    color: var(--srm-text);
}
.booking-add-hint-toggle[aria-expanded='true'] {
    background: var(--srm-accent-soft-bg);
    border-color: var(--srm-primary);
    color: var(--srm-accent-soft-text);
}
.booking-hint-icon {
    display: block;
}
.booking-add-hint {
    margin: -4px 0 14px;
    font-size: 13px;
    color: var(--srm-text-muted);
    line-height: 1.45;
}

.booking-card-intro {
    margin: -4px 0 14px;
    font-size: 13px;
    color: var(--srm-text-muted);
    line-height: 1.45;
}

.booking-add-contact-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
}

.booking-add-contact-row .task-contact-combobox {
    flex: 1 1 200px;
    min-width: 0;
}
.booking-add-contact-row .task-contact-combobox input[type='text'],
.booking-add-contact-row .task-contact-combobox .form-input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    min-height: 48px;
    border: 1px solid var(--srm-border);
    border-radius: 10px;
    background: var(--srm-surface-2);
    color: var(--srm-text);
    font-size: 15px;
}

.btn-shrink {
    flex: 0 0 auto;
    white-space: nowrap;
}

.booking-add-custom-panel {
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px dashed var(--srm-border);
}

.booking-add-custom-label {
    font-weight: 600;
}

.booking-add-dur-inline {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.booking-slot-manual-row {
    display: grid;
    grid-template-columns: 1fr minmax(120px, 160px);
    gap: 12px;
    align-items: end;
    margin-bottom: 12px;
}
.booking-slot-manual-row .booking-field label,
.booking-slot-manual-row label {
    font-size: 12px;
    color: var(--srm-text-muted);
    margin-bottom: 4px;
    display: block;
}
.booking-slot-manual-row input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    min-height: 48px;
    border: 1px solid var(--srm-border);
    border-radius: 10px;
    background: var(--srm-surface-2);
    color: var(--srm-text);
    font-size: 15px;
}

.booking-custom-datetime-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    margin-top: 8px;
}
.booking-custom-datetime-row .booking-field-grow {
    flex: 1 1 220px;
    min-width: 0;
}
.booking-custom-datetime-row .booking-field-narrow {
    flex: 0 1 160px;
    min-width: 120px;
}
.booking-custom-datetime-row .form-input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    min-height: 48px;
    border: 1px solid var(--srm-border);
    border-radius: 10px;
    background: var(--srm-surface-2);
    color: var(--srm-text);
    font-size: 15px;
}

#tab-booking .settings-form input[type='datetime-local'],
#tab-booking .settings-form input[type='date'],
#tab-booking .settings-form input[type='time'],
#tab-booking .settings-form input[type='number'] {
    padding: 12px 14px;
    min-height: 48px;
    border-radius: 10px;
    border: 1px solid var(--srm-border);
    background: var(--srm-surface-2);
    color: var(--srm-text);
    font-size: 15px;
    box-sizing: border-box;
}

@media (max-width: 560px) {
    .booking-slot-manual-row {
        grid-template-columns: 1fr;
    }
}

.booking-inline-label {
    font-size: 12px;
    color: var(--srm-text-muted);
    margin: 0;
}

.booking-office-section-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--srm-text-muted);
    margin: 0 0 6px;
}

.booking-office-dates {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 10px;
    margin-bottom: 8px;
    -webkit-overflow-scrolling: touch;
}

.booking-office-date-btn {
    flex: 0 0 auto;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--srm-border);
    background: var(--srm-surface-2);
    font-size: 12px;
    color: var(--srm-text);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.booking-office-date-btn:hover {
    border-color: var(--srm-primary);
}

.booking-office-date-btn--active {
    border-color: var(--srm-primary);
    background: var(--srm-accent-soft-bg);
    font-weight: 600;
    color: var(--srm-accent-soft-text);
}

.booking-office-slots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
    margin-bottom: 4px;
}

.booking-office-slot-btn {
    padding: 8px 6px;
    border-radius: 10px;
    border: 1px solid var(--srm-border);
    background: var(--srm-surface);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: var(--srm-heading);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.booking-office-slot-btn:hover {
    border-color: var(--srm-primary);
}

.booking-office-slot-btn--selected {
    border-color: var(--srm-primary);
    background: var(--srm-accent-soft-bg);
    font-weight: 600;
    color: var(--srm-accent-soft-text);
}

.booking-office-empty {
    font-size: 13px;
    color: var(--srm-text-muted);
    padding: 12px 0;
    line-height: 1.45;
}

.booking-add-form .form-input,
.booking-add-form .form-textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    min-height: 48px;
    border: 1px solid var(--srm-border);
    border-radius: 10px;
    background: var(--srm-surface-2);
    font-size: 14px;
    color: var(--srm-text);
}
.booking-add-form .form-textarea {
    min-height: 72px;
    resize: vertical;
}

.booking-calendar-panel {
    background: var(--srm-surface);
    border: 1px solid var(--srm-border);
    border-radius: 12px;
    padding: 16px 18px 20px;
}
.booking-calendar-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.booking-calendar-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}
.booking-calendar-nav {
    display: flex;
    align-items: center;
    gap: 10px;
}
.booking-cal-label {
    font-size: 15px;
    font-weight: 600;
    min-width: 160px;
    text-align: center;
    text-transform: capitalize;
}
.booking-calendar-root {
    --booking-cal-gap: 6px;
}
.booking-cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: var(--booking-cal-gap);
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--srm-text-muted);
    text-align: center;
}
.booking-cal-wd {
    padding: 4px 2px;
}
.booking-cal-cells {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: var(--booking-cal-gap);
}
.booking-cal-cell {
    min-height: 88px;
    border: 1px solid var(--srm-border);
    border-radius: 8px;
    padding: 6px 5px 8px;
    background: var(--srm-cal-cell-bg);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.booking-cal-cell--pad {
    background: transparent;
    border: none;
    min-height: 0;
}
.booking-cal-day-num {
    font-size: 13px;
    font-weight: 600;
    color: var(--srm-heading);
}
.booking-cal-chips {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    overflow: hidden;
}
.booking-cal-chip {
    border: none;
    border-radius: 6px;
    padding: 3px 6px;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    text-align: center;
    width: 100%;
    transition: filter 0.12s, transform 0.12s;
}
.booking-cal-chip--free {
    background: var(--srm-cal-chip-free-bg);
    color: var(--srm-cal-chip-free-text);
}
.booking-cal-chip--free:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}
.booking-cal-chip--busy {
    background: var(--srm-cal-chip-busy-bg);
    color: var(--srm-cal-chip-busy-text);
    border: 1px solid var(--srm-cal-chip-busy-border);
    font-weight: 600;
}
.booking-cal-chip--busy:hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
}
.booking-cal-legend {
    margin: 14px 0 0;
    font-size: 12px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.booking-legend-free,
.booking-legend-busy {
    display: inline-block;
    width: 14px;
    height: 10px;
    border-radius: 3px;
    vertical-align: middle;
    margin-right: 4px;
}
.booking-legend-free {
    background: var(--srm-cal-chip-free-bg);
    border: 1px solid var(--srm-border);
}
.booking-legend-busy {
    background: var(--srm-cal-chip-busy-bg);
    border: 1px solid var(--srm-cal-chip-busy-border);
}
@media (max-width: 720px) {
    .booking-cal-cell {
        min-height: 72px;
        padding: 4px 3px;
    }
    .booking-cal-chip {
        font-size: 10px;
        padding: 2px 4px;
    }
}

@media (max-width: 780px) {
    #tab-booking.active {
        gap: 0;
        width: calc(100% + 40px);
        max-width: none;
        margin-left: -20px;
        margin-right: -20px;
        box-sizing: border-box;
    }
    #tab-booking.active .booking-tab-layout {
        padding: 0;
        gap: 0;
    }
    #tab-booking.active .booking-calendar-panel {
        border: none;
        border-radius: 0;
        background: var(--srm-page-bg);
        padding: 8px 10px 12px;
        border-bottom: 1px solid var(--srm-border);
    }
    #tab-booking.active .booking-calendar-head {
        margin-bottom: 8px;
        gap: 8px;
    }
    #tab-booking.active .booking-calendar-title {
        font-size: 17px;
    }
    #tab-booking.active .booking-calendar-nav {
        flex: 1 1 auto;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 8px;
        min-width: 0;
    }
    #tab-booking.active .booking-cal-label {
        min-width: 0;
        flex: 1 1 120px;
        font-size: 14px;
    }
    #tab-booking.active .booking-cal-legend {
        margin-top: 10px;
        font-size: 11px;
        line-height: 1.4;
    }
    #tab-booking.active .booking-card {
        border: none;
        border-radius: 0;
        padding: 14px 12px 18px;
        background: var(--srm-surface);
        border-bottom: 1px solid var(--srm-border);
    }
    #tab-booking.active .booking-card--admin-slots {
        border-bottom: none;
    }
    #tab-booking.active .booking-card-title {
        font-size: 17px;
    }
}

/* Сделки (deals kanban) */
#tab-deals.active {
    flex-direction: column;
    position: relative;
    min-height: calc(100vh - 100px);
}
.deals-layout {
    flex: 1;
    width: 100%;
    overflow: auto;
}
.deals-toolbar {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}
.deals-toolbar h2 {
    margin: 0;
}
.deals-kanban {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    align-items: start;
}
@media (max-width: 960px) {
    .deals-kanban {
        grid-template-columns: 1fr;
    }
}
.deals-column {
    background: var(--srm-surface);
    border-radius: 12px;
    box-shadow: 0 4px 16px var(--srm-shadow);
    min-height: 200px;
    border: 2px dashed transparent;
}
.deals-column.deals-drop-hover {
    border-color: var(--srm-primary);
    background: var(--srm-drop-highlight-bg);
}
.deals-column-header {
    padding: 12px 14px;
    font-weight: 700;
    border-bottom: 1px solid var(--srm-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.deals-column-body {
    padding: 10px;
    min-height: 120px;
}
.deal-card {
    background: var(--srm-card-inset-bg);
    border: 1px solid var(--srm-border);
    border-radius: 10px;
    padding: 10px 36px 10px 12px;
    margin-bottom: 8px;
    cursor: grab;
    font-size: 14px;
    position: relative;
    color: var(--srm-text);
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
    --deal-neon-glow-1: transparent;
    --deal-neon-glow-2: transparent;
    --deal-neon-glow-3: transparent;
    --deal-accent-bar: transparent;
}
.deal-card--accent-overdue,
.deal-card--accent-today,
.deal-card--accent-future {
    border-width: 2px;
    border-style: solid;
    animation: deal-card-neon-pulse 2.4s ease-in-out infinite;
}
.deal-card--accent-overdue {
    border-color: #ff3355;
    --deal-accent-bar: #ff3355;
    --deal-neon-glow-1: rgba(255, 51, 85, 0.95);
    --deal-neon-glow-2: rgba(255, 51, 85, 0.5);
    --deal-neon-glow-3: rgba(255, 80, 120, 0.22);
    box-shadow:
        inset 5px 0 0 0 var(--deal-accent-bar),
        0 0 4px 0 var(--deal-neon-glow-1),
        0 0 12px 2px var(--deal-neon-glow-2),
        0 0 28px 6px var(--deal-neon-glow-3);
}
.deal-card--accent-today {
    border-color: #f5cc25;
    --deal-accent-bar: #f5cc25;
    --deal-neon-glow-1: rgba(245, 204, 37, 0.95);
    --deal-neon-glow-2: rgba(245, 204, 37, 0.48);
    --deal-neon-glow-3: rgba(255, 230, 100, 0.18);
    box-shadow:
        inset 5px 0 0 0 var(--deal-accent-bar),
        0 0 4px 0 var(--deal-neon-glow-1),
        0 0 12px 2px var(--deal-neon-glow-2),
        0 0 28px 6px var(--deal-neon-glow-3);
}
.deal-card--accent-future {
    border-color: #34d399;
    --deal-accent-bar: #34d399;
    --deal-neon-glow-1: rgba(52, 211, 153, 0.9);
    --deal-neon-glow-2: rgba(52, 211, 153, 0.42);
    --deal-neon-glow-3: rgba(110, 231, 183, 0.16);
    box-shadow:
        inset 5px 0 0 0 var(--deal-accent-bar),
        0 0 4px 0 var(--deal-neon-glow-1),
        0 0 12px 2px var(--deal-neon-glow-2),
        0 0 28px 6px var(--deal-neon-glow-3);
}
@keyframes deal-card-neon-pulse {
    0%,
    100% {
        filter: brightness(1);
        box-shadow:
            inset 5px 0 0 0 var(--deal-accent-bar),
            0 0 4px 0 var(--deal-neon-glow-1),
            0 0 12px 2px var(--deal-neon-glow-2),
            0 0 28px 6px var(--deal-neon-glow-3);
    }
    50% {
        filter: brightness(1.04);
        box-shadow:
            inset 5px 0 0 0 var(--deal-accent-bar),
            0 0 6px 1px var(--deal-neon-glow-1),
            0 0 18px 4px var(--deal-neon-glow-2),
            0 0 36px 10px var(--deal-neon-glow-3);
    }
}
@media (prefers-reduced-motion: reduce) {
    .deal-card--accent-overdue,
    .deal-card--accent-today,
    .deal-card--accent-future {
        animation: none;
    }
}
.deal-card:active {
    cursor: grabbing;
}
.deal-card-edit {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
    width: 28px;
    height: 28px;
    padding: 0;
    line-height: 1;
    border-radius: 6px;
    background: var(--srm-surface);
    border: 1px solid var(--srm-border);
    box-shadow: 0 1px 2px var(--srm-shadow);
    cursor: pointer;
    color: var(--srm-text);
}
.deal-card-edit:hover {
    background: var(--srm-surface-2);
    border-color: var(--srm-border-2);
}
.deal-card-title {
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--srm-heading);
}
.deal-card-meta {
    font-size: 12px;
    color: var(--srm-text-muted);
    line-height: 1.4;
}
.deal-card-amount {
    font-weight: 600;
    color: var(--srm-text);
    margin-top: 6px;
}
.deal-card-tasks {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--srm-border);
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    line-height: 1.35;
}
.deal-card-task-link {
    display: block;
    color: var(--srm-text-muted);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    word-break: break-word;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    text-align: left;
}
.deal-card-task-link:hover {
    filter: brightness(1.08);
}
.deal-card-task-link.deal-card-task--overdue {
    color: #dc2626;
    font-weight: 600;
}
.deal-card-task-link.deal-card-task--today {
    color: #ca8a04;
    font-weight: 600;
}
.deal-card-task-link.deal-card-task--future {
    color: #16a34a;
}
.deal-card-task-link.deal-card-task--nodue {
    color: var(--srm-text-muted);
    font-weight: 400;
}
.deal-card-tasks-more {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.deal-card-tasks-more[hidden] {
    display: none !important;
}
.deal-card-tasks-toggle {
    align-self: flex-start;
    margin-top: 2px;
    padding: 0;
    border: none;
    background: none;
    font: inherit;
    font-size: 11px;
    color: var(--srm-text-muted);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}
.deal-card-tasks-toggle:hover {
    filter: brightness(1.08);
}
.add-deal-btn-fixed {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: var(--srm-primary);
    color: var(--srm-primary-contrast);
    box-shadow: 0 6px 20px rgba(58, 123, 213, 0.45);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 50;
}
#tab-deals.active .add-deal-btn-fixed {
    display: flex;
}
.add-deal-btn-fixed .icon {
    width: 28px;
    height: 28px;
}
.deal-context-label {
    padding: 8px 10px;
    background: var(--srm-surface-2);
    border: 1px solid var(--srm-border);
    border-radius: 8px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--srm-heading);
}
.deal-editor-section {
    margin-bottom: 18px;
}
.deal-editor-section h4 {
    margin: 0 0 8px;
    font-size: 15px;
}
.deal-attach-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 8px;
}
.deal-file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: var(--srm-surface-2);
    border: 1px solid var(--srm-border);
    border-radius: 8px;
    font-size: 13px;
    color: var(--srm-text);
}
.deal-history-row {
    font-size: 12px;
    color: var(--srm-text-muted);
    border-bottom: 1px solid var(--srm-border);
    padding: 6px 0;
}
.task-deal-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}
.task-deal-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--srm-chip-tag-bg);
    color: var(--srm-chip-tag-text);
    border: 1px solid var(--srm-border);
}
button.task-deal-badge-link {
    border: none;
    font: inherit;
    cursor: pointer;
    text-align: left;
    line-height: inherit;
}
button.task-deal-badge-link:hover {
    filter: brightness(1.08);
}
.tasks-column .task-deal-section-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--srm-text-muted);
    margin: 8px 0 4px;
}
.contact-payment-note {
    font-size: 12px;
    color: var(--srm-text-muted);
    margin-top: 4px;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.deals-column-body.drag-over {
    background: var(--srm-drop-highlight-bg);
}

/* ========== Темы интерфейса (настройки брендинга) ========== */
.is-hidden {
    display: none !important;
}
.ui-theme-custom-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px 14px;
    margin-top: 8px;
}
.ui-theme-custom-grid label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--srm-text-muted);
}
.ui-theme-custom-grid input[type="color"] {
    width: 100%;
    height: 40px;
    padding: 2px;
    border: 1px solid var(--srm-border);
    border-radius: 8px;
    cursor: pointer;
    background: var(--srm-surface);
}

body[data-ui-theme="dark"] {
    --srm-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --srm-page-bg: #1e1e1e;
    --srm-text: #d4d4d4;
    --srm-text-muted: #9d9d9d;
    --srm-heading: #e8e8e8;
    --srm-surface: #252526;
    --srm-surface-2: #2d2d30;
    --srm-border: #3c3c3c;
    --srm-border-2: #464647;
    --srm-primary: #0e639c;
    --srm-primary-contrast: #ffffff;
    --srm-secondary-bg: #333333;
    --srm-secondary-text: #d4d4d4;
    --srm-link: #3794ff;
    --srm-shadow: rgba(0, 0, 0, 0.35);
    --srm-shadow-card: rgba(0, 0, 0, 0.45);
    --srm-reports-insights-bg: #2d2d30;
    --srm-reports-insights-border: #3c3c3c;
    --srm-reports-insights-text: #e6e6e6;
    --srm-reports-kpi-bg: #1c1c1f;
    --srm-chip-info-bg: rgba(88, 166, 255, 0.14);
    --srm-chip-info-text: #c8ddff;
    --srm-chip-tag-bg: rgba(167, 139, 250, 0.14);
    --srm-chip-tag-text: #ddd6fe;
    --srm-drop-highlight-bg: rgba(88, 166, 255, 0.12);
    --srm-cal-cell-bg: #1e1e21;
    --srm-cal-chip-free-bg: rgba(56, 189, 248, 0.14);
    --srm-cal-chip-free-text: #7dd3fc;
    --srm-cal-chip-busy-bg: rgba(248, 113, 113, 0.12);
    --srm-cal-chip-busy-text: #fecaca;
    --srm-cal-chip-busy-border: rgba(248, 113, 113, 0.45);
    --srm-accent-soft-bg: rgba(55, 148, 255, 0.18);
    --srm-accent-soft-text: #dbeafe;
    --srm-lead-convert-bg: rgba(167, 139, 250, 0.12);
    --srm-lead-convert-border: rgba(167, 139, 250, 0.4);
    --srm-card-inset-bg: #1c1d21;
}

body[data-ui-theme="dark"] .task-due-date.overdue,
body[data-ui-theme="neon"] .task-due-date.overdue {
    background: rgba(248, 113, 113, 0.15);
    color: #fecaca;
    border-color: rgba(248, 113, 113, 0.4);
}
body[data-ui-theme="dark"] .task-due-date.today,
body[data-ui-theme="neon"] .task-due-date.today {
    background: rgba(250, 204, 21, 0.15);
    color: #fde047;
    border-color: rgba(250, 204, 21, 0.35);
}
body[data-ui-theme="dark"] .reports-error,
body[data-ui-theme="neon"] .reports-error {
    background: rgba(127, 29, 29, 0.38);
    color: #fecaca;
    border-color: rgba(248, 113, 113, 0.5);
}

body[data-ui-theme="neon"] {
    --srm-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --srm-page-bg: transparent;
    --srm-text: #c8f7ec;
    --srm-text-muted: #6eb8a8;
    --srm-heading: #e0fff7;
    --srm-surface: rgba(8, 22, 32, 0.82);
    --srm-surface-2: rgba(6, 28, 38, 0.75);
    --srm-border: rgba(0, 245, 212, 0.45);
    --srm-border-2: rgba(123, 97, 255, 0.4);
    --srm-primary: #00f5d4;
    --srm-primary-contrast: #f4fffd;
    --srm-secondary-bg: rgba(10, 40, 48, 0.85);
    --srm-secondary-text: #c8f7ec;
    --srm-link: #7df9ff;
    --srm-shadow: rgba(0, 245, 212, 0.12);
    --srm-shadow-card: rgba(0, 0, 0, 0.55);
    --srm-reports-insights-bg: rgba(10, 32, 42, 0.9);
    --srm-reports-insights-border: rgba(0, 245, 212, 0.38);
    --srm-reports-insights-text: #d4f8ef;
    --srm-reports-kpi-bg: rgba(5, 18, 26, 0.92);
    --srm-chip-info-bg: rgba(0, 245, 212, 0.12);
    --srm-chip-info-text: #c8fff0;
    --srm-chip-tag-bg: rgba(123, 97, 255, 0.18);
    --srm-chip-tag-text: #e8e4ff;
    --srm-drop-highlight-bg: rgba(0, 245, 212, 0.1);
    --srm-cal-cell-bg: rgba(6, 22, 30, 0.92);
    --srm-cal-chip-free-bg: rgba(0, 245, 212, 0.16);
    --srm-cal-chip-free-text: #b8fff0;
    --srm-cal-chip-busy-bg: rgba(248, 113, 113, 0.14);
    --srm-cal-chip-busy-text: #fecaca;
    --srm-cal-chip-busy-border: rgba(248, 113, 113, 0.5);
    --srm-accent-soft-bg: rgba(0, 245, 212, 0.14);
    --srm-accent-soft-text: #ecfffc;
    --srm-lead-convert-bg: rgba(123, 97, 255, 0.14);
    --srm-lead-convert-border: rgba(0, 245, 212, 0.35);
    --srm-card-inset-bg: rgba(4, 14, 22, 0.92);
    position: relative;
    isolation: isolate;
    min-height: 100vh;
}

body[data-ui-theme="neon"]::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background: linear-gradient(
        125deg,
        #030a12 0%,
        #0a1f2e 28%,
        #06251c 55%,
        #081028 78%,
        #041a14 100%
    );
    background-size: 420% 420%;
    animation: srm-neon-bg-shift 22s ease-in-out infinite;
}

@keyframes srm-neon-bg-shift {
    0%,
    100% {
        background-position: 0% 40%;
    }
    50% {
        background-position: 100% 60%;
    }
}

@keyframes srm-neon-glow-pulse {
    0%,
    100% {
        box-shadow:
            0 0 18px rgba(0, 245, 212, 0.14),
            0 0 36px rgba(123, 97, 255, 0.08),
            0 4px 24px rgba(0, 0, 0, 0.5);
    }
    50% {
        box-shadow:
            0 0 28px rgba(0, 245, 212, 0.28),
            0 0 48px rgba(123, 97, 255, 0.18),
            0 4px 28px rgba(0, 0, 0, 0.55);
    }
}

body[data-ui-theme="neon"] .topbar,
body[data-ui-theme="neon"] .settings-card,
body[data-ui-theme="neon"] .modal-content,
body[data-ui-theme="neon"] .tasks-sidebar,
body[data-ui-theme="neon"] .tasks-content,
body[data-ui-theme="neon"] .leads-panel,
body[data-ui-theme="neon"] .pipelines,
body[data-ui-theme="neon"] .topbar--settings,
body[data-ui-theme="neon"] .mobile-menu-toggle {
    animation: srm-neon-glow-pulse 5.5s ease-in-out infinite;
}

body[data-ui-theme="custom"] {
    --srm-link: var(--srm-primary);
    --srm-secondary-text: var(--srm-text);
    --srm-card-inset-bg: var(--srm-surface-2);
}

/* Страница входа с общей темой */
.login-page {
    min-height: 100vh;
    margin: 0;
    font-family: var(--srm-font);
    background: var(--srm-page-bg);
    color: var(--srm-text);
}
.login-page .wrap {
    max-width: 420px;
    margin: 60px auto;
    background: var(--srm-surface);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--srm-border);
    box-shadow: 0 6px 24px var(--srm-shadow-card);
}
.login-page h1 {
    margin-top: 0;
    color: var(--srm-heading);
}
.login-page label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    color: var(--srm-text-muted);
}
.login-page input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--srm-border-2);
    border-radius: 8px;
    background: var(--srm-surface-2);
    color: var(--srm-text);
    box-sizing: border-box;
}
.login-page .btn {
    margin-top: 18px;
    width: 100%;
    background: var(--srm-primary);
    color: var(--srm-primary-contrast);
    padding: 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
}
.login-page .error {
    color: #f87171;
    margin-top: 12px;
}

.task-focus-btn.is-active {
    background: var(--srm-primary);
    border-color: var(--srm-primary);
    color: var(--srm-primary-contrast);
}

.focus-bar[hidden],
.focus-prompt[hidden] {
    display: none !important;
}
.focus-bar {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 1900;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: min(560px, calc(100vw - 32px));
    padding: 10px 12px;
    border-radius: 14px;
    background: var(--srm-surface);
    border: 1px solid var(--srm-border);
    box-shadow: 0 10px 28px var(--srm-shadow);
}
.focus-bar-main {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}
.focus-bar-kicker {
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--srm-primary);
    flex: none;
}
.focus-bar-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}
.focus-bar-time {
    font-variant-numeric: tabular-nums;
    flex: none;
    font-weight: 700;
}
.focus-prompt {
    position: fixed;
    inset: 0;
    z-index: 8000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 23, 42, 0.62);
}
.focus-prompt-card {
    width: min(440px, 100%);
    background: var(--srm-surface);
    border-radius: 14px;
    padding: 18px;
    border: 2px solid var(--srm-primary);
    box-shadow: 0 16px 40px var(--srm-shadow);
    animation: focus-prompt-pulse 1.1s ease-in-out infinite;
}
@keyframes focus-prompt-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0, 102, 255, 0.55); }
    50% { box-shadow: 0 0 0 12px rgba(0, 102, 255, 0); }
}
.focus-prompt-card p {
    margin: 0 0 10px;
}
.focus-prompt-countdown {
    color: var(--srm-text-muted);
    font-size: 14px;
}
.focus-prompt-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 14px;
}
.reports-activity {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.reports-activity-item {
    width: 100%;
    text-align: left;
    display: grid;
    grid-template-columns: 132px 1fr;
    gap: 4px 12px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--srm-border);
    background: var(--srm-reports-kpi-bg);
    color: inherit;
    cursor: pointer;
}
.reports-activity-time {
    grid-row: span 2;
    color: var(--srm-text-muted);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}
.reports-activity-title {
    font-weight: 600;
}
.reports-activity-detail {
    color: var(--srm-text-muted);
    font-size: 13px;
}
@media (max-width: 640px) {
    .focus-bar {
        left: 12px;
        right: 12px;
        bottom: 12px;
        transform: none;
        max-width: none;
    }
    .reports-activity-item {
        grid-template-columns: 1fr;
    }
    .reports-activity-time {
        grid-row: auto;
    }
}
