:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f59e0b;
    --bg: #f1f5f9;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}

.navbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 0 1.25rem;
    display: flex;
    align-items: center;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
    white-space: nowrap;
    text-decoration: none;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    width: 28px;
    height: 24px;
    flex-direction: column;
    justify-content: space-between;
    align-items: stretch;
}

.nav-toggle span {
    display: block;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.nav-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(6px, -6px); }

.nav-links {
    display: flex;
    gap: 0.15rem;
    flex: 1;
    margin-left: 1.5rem;
}

.nav-link {
    text-decoration: none;
    color: var(--text-muted);
    padding: 0.4rem 0.65rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    transition: all 0.15s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.nav-link svg {
    display: none;
}

.nav-link:hover {
    background: var(--bg);
    color: var(--text);
}

.nav-divider {
    display: none;
}

.nav-user-mobile {
    display: none;
}

.nav-overlay {
    display: none;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
    margin-left: auto;
}

.desktop-only { display: flex; align-items: center; gap: 0.75rem; }
.mobile-only { display: none; }

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem;
}

.page-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.page-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text);
}

.card h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.lead-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(400px, 100%), 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr));
    gap: 0.5rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    padding: 0.5rem;
    background: var(--bg);
    border-radius: 4px;
    word-break: break-word;
}

.info-item .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(140px, calc(50% - 0.5rem)), 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
}

.stat-card.stat-success { border-left: 4px solid var(--success); }
.stat-card.stat-danger { border-left: 4px solid var(--danger); }

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.filters-bar {
    margin-bottom: 1rem;
}

.filter-form {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table th, .data-table td {
    padding: 0.75rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg);
    white-space: nowrap;
}

.data-table-sm th, .data-table-sm td {
    padding: 0.5rem 0.35rem;
    font-size: 0.8rem;
}

.clickable-row {
    cursor: pointer;
    transition: background 0.15s;
}

.clickable-row:hover {
    background: var(--bg);
}

.cell-truncate {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.score-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.score-high { background: #dcfce7; color: #166534; }
.score-mid { background: #fef9c3; color: #854d0e; }
.score-low { background: #fee2e2; color: #991b1b; }

.risk-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.risk-badge[class*="низкий"], .risk-низкий { background: #dcfce7; color: #166534; }
.risk-badge[class*="средний"], .risk-средний { background: #fef9c3; color: #854d0e; }
.risk-badge[class*="высокий"], .risk-высокий { background: #fee2e2; color: #991b1b; }

.status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.status-badge { background: #e2e8f0; color: #475569; }
.status-badge[class*="Новая"] { background: #dbeafe; color: #1e40af; }
.status-badge[class*="работе"] { background: #fef9c3; color: #854d0e; }
.status-badge[class*="Связались"] { background: #e0e7ff; color: #3730a3; }
.status-badge[class*="отправлено"] { background: #f3e8ff; color: #6b21a8; }
.status-badge[class*="Согласование"] { background: #ccfbf1; color: #134e4a; }
.status-badge[class*="Успешно"] { background: #dcfce7; color: #166534; }
.status-badge[class*="Неуспешно"] { background: #fee2e2; color: #991b1b; }
.status-badge[class*="Отложено"] { background: #f1f5f9; color: #64748b; }
.status-badge[class*="Эскалация"] { background: #fef2f2; color: #b91c1c; }

.score-display {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.score-big {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
}

.risk-display {
    font-size: 1rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: var(--text-muted);
}

input, select, textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    background: var(--card-bg);
    color: var(--text);
    -webkit-appearance: none;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

input[type="checkbox"] {
    width: auto;
}

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    font-family: inherit;
    white-space: nowrap;
    text-align: center;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #64748b; color: white; }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }
.btn-outline-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-outline-success { background: transparent; border-color: var(--success); color: var(--success); }
.btn-outline-warning { background: transparent; border-color: #f0ad4e; color: #f0ad4e; }
.btn-outline-warning:hover { background: #f0ad4e; color: #fff; }
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.8rem; }
.btn-block { display: block; width: 100%; }

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.text-muted { color: var(--text-muted); font-size: 0.875rem; }

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
    padding: 1rem;
}

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

.login-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2rem 1.5rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-card h1 {
    text-align: center;
    color: var(--primary);
    margin-bottom: 0.25rem;
    font-size: 1.5rem;
}

.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.form-inline-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr));
    gap: 0.5rem 1rem;
    align-items: end;
}

.form-inline {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: end;
}

.form-actions { display: flex; align-items: end; padding-bottom: 0; }

.comment-form { margin-bottom: 1rem; }
.comments-list, .actions-list { margin-top: 1rem; }

.comment-item {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
}
.comment-item:last-child { border-bottom: none; }

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.comment-date, .action-date { font-size: 0.75rem; color: var(--text-muted); }

.action-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    flex-wrap: wrap;
}

.action-user { font-weight: 600; min-width: 80px; }
.action-desc { flex: 1; color: var(--text-muted); min-width: 0; }
.actions-cell { display: flex; gap: 0.25rem; flex-wrap: wrap; }

.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    width: auto;
    padding: 0;
}

a { color: var(--primary); }

.quick-links {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
}
.quick-links .btn { text-align: left; }

@media (max-width: 768px) {
    .desktop-only { display: none !important; }
    .mobile-only { display: block !important; }

    .navbar {
        padding: 0 0.75rem;
        height: 52px;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100vh;
        background: var(--card-bg);
        flex-direction: column;
        z-index: 1001;
        padding: 1.25rem 1rem;
        gap: 0.25rem;
        overflow-y: auto;
        transition: left 0.3s ease;
        box-shadow: 4px 0 20px rgba(0,0,0,0.15);
        margin-left: 0;
    }

    .nav-links.nav-open {
        left: 0;
    }

    .nav-link {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
        border-radius: var(--radius);
        color: var(--text);
    }

    .nav-link svg {
        display: inline-block;
        flex-shrink: 0;
        color: var(--primary);
    }

    .nav-link:hover, .nav-link:active {
        background: var(--bg);
        color: var(--primary);
    }

    .nav-divider {
        display: block;
        height: 1px;
        background: var(--border);
        margin: 0.5rem 0;
    }

    .nav-user-mobile {
        display: flex;
        flex-direction: column;
        padding: 0.75rem 1rem;
        gap: 0.15rem;
    }

    .nav-user-name {
        font-weight: 600;
        font-size: 0.9rem;
        color: var(--text);
    }

    .nav-user-role {
        font-size: 0.75rem;
        color: var(--text-muted);
    }

    .nav-overlay {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.4);
        z-index: 1000;
    }

    .nav-overlay.active {
        display: block;
    }

    .container {
        padding: 1rem 0.75rem;
    }

    .page-header h2 { font-size: 1.25rem; }

    .card {
        padding: 1rem;
        margin-bottom: 0.75rem;
    }

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

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .stat-card { padding: 0.75rem 0.5rem; }
    .stat-value { font-size: 1.25rem; }
    .stat-label { font-size: 0.7rem; }

    .form-inline-grid { grid-template-columns: 1fr; }

    .filter-form {
        flex-direction: column;
        align-items: stretch;
    }

    .data-table { font-size: 0.8rem; }
    .data-table th, .data-table td { padding: 0.5rem 0.35rem; }
    .cell-truncate { max-width: 120px; }
    .score-big { font-size: 2rem; }

    .action-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .comment-header { flex-direction: column; }
    .btn { padding: 0.5rem 0.75rem; }

    .form-inline {
        flex-direction: column;
        align-items: stretch;
    }

    .login-card { padding: 1.5rem 1.25rem; }
    .modal-content { padding: 1rem; }
}

@media (max-width: 480px) {
    .stats-grid { gap: 0.4rem; }
    .stat-card { padding: 0.6rem 0.4rem; }
    .stat-value { font-size: 1.1rem; }
    .container { padding: 0.75rem 0.5rem; }
    .page-header h2 { font-size: 1.1rem; }
    .data-table { font-size: 0.75rem; }
    .cell-truncate { max-width: 90px; }
    .btn-sm { padding: 0.2rem 0.35rem; font-size: 0.7rem; }
}

.stat-card.stat-warning { border-left: 4px solid var(--warning); }

.sla-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.sla-ok { background: #dcfce7; color: #166534; }
.sla-caution { background: #fef9c3; color: #854d0e; }
.sla-warning { background: #fed7aa; color: #9a3412; }
.sla-overdue { background: #fee2e2; color: #991b1b; font-weight: 700; }

.row-overdue {
    background: #fff5f5 !important;
    border-left: 3px solid var(--danger);
}

.row-overdue:hover {
    background: #fee2e2 !important;
}

.contact-priority-card {
    border-left: 4px solid var(--primary);
    background: linear-gradient(135deg, #f0f7ff 0%, var(--card-bg) 100%);
}
.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
}
.contact-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.contact-item.contact-phone {
    border-color: var(--primary);
    background: #eff6ff;
}
.contact-item.contact-phone .contact-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary);
}
.contact-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    width: 2rem;
    text-align: center;
}
.contact-item .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 0.15rem;
}
.contact-value {
    font-size: 0.95rem;
    font-weight: 500;
    word-break: break-word;
}
a.contact-value {
    color: var(--primary);
    text-decoration: none;
}
a.contact-value:hover {
    text-decoration: underline;
}
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 480px) {
    .contact-grid {
        grid-template-columns: 1fr;
    }
}

.upcoming-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}
.upcoming-header h3 {
    margin: 0;
    font-size: 1.05rem;
    color: var(--text);
}
.upcoming-count {
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0.15rem 0.6rem;
    border-radius: 12px;
    min-width: 1.5rem;
    text-align: center;
}
.upcoming-widget {
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--primary);
}
.upcoming-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}
@media (max-width: 768px) {
    .upcoming-summary-grid { grid-template-columns: repeat(2, 1fr); }
}
.upcoming-stat-card {
    background: #f0f4ff;
    border-radius: 10px;
    padding: 0.9rem 1rem;
    text-align: center;
    border: 1px solid #e0e7ff;
    transition: transform 0.15s;
}
.upcoming-stat-card:hover { transform: translateY(-2px); }
.upcoming-stat-card.smr { background: #ecfdf5; border-color: #a7f3d0; }
.upcoming-stat-card.other { background: #fefce8; border-color: #fde68a; }
.upcoming-stat-card.urgent { background: #fef2f2; border-color: #fca5a5; }
.upcoming-stat-card.total { background: #eff6ff; border-color: #bfdbfe; }
.upcoming-stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}
.upcoming-stat-card.smr .upcoming-stat-value { color: #059669; }
.upcoming-stat-card.other .upcoming-stat-value { color: #b45309; }
.upcoming-stat-card.urgent .upcoming-stat-value { color: #dc2626; }
.upcoming-stat-card.total .upcoming-stat-value { color: #2563eb; }
.upcoming-stat-label {
    font-size: 0.78rem;
    color: #64748b;
    margin-top: 0.2rem;
    font-weight: 500;
}
.upcoming-stat-sum {
    font-size: 0.8rem;
    color: #475569;
    margin-top: 0.35rem;
    font-weight: 600;
}
.smr-badge {
    background: #e8f5e9;
    color: #2e7d32;
    font-weight: 600;
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}
.row-highlight-smr {
    background: #f0f9f0 !important;
}
.end-date-badge {
    font-weight: 500;
    font-size: 0.85rem;
}
.data-table-compact {
    font-size: 0.85rem;
}
.data-table-compact th,
.data-table-compact td {
    padding: 0.4rem 0.6rem;
}
.row-warning {
    background: #fff7ed !important;
}
.row-caution {
    background: #fefce8 !important;
}

.bulk-actions-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    font-weight: 500;
}
.btn-danger {
    background: var(--danger);
    color: #fff;
    border: none;
    cursor: pointer;
}
.btn-danger:hover {
    background: #b91c1c;
}
.btn-icon-danger {
    background: none;
    border: 1px solid var(--danger);
    color: var(--danger);
    cursor: pointer;
    border-radius: 4px;
    padding: 0.15rem 0.4rem;
    font-size: 0.8rem;
    line-height: 1;
}
.btn-icon-danger:hover {
    background: var(--danger);
    color: #fff;
}

.lead-checkbox,
#selectAll {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    min-width: 16px;
    border: 1.5px solid var(--border);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    background: #fff;
    transition: all 0.15s ease;
    margin: 0;
    padding: 0;
    flex-shrink: 0;
}
.lead-checkbox:hover,
#selectAll:hover {
    border-color: var(--primary);
}
.lead-checkbox:checked,
#selectAll:checked {
    background: var(--primary);
    border-color: var(--primary);
}
.lead-checkbox:checked::after,
#selectAll:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.auto-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}
.auto-badge::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.api-status-card { margin-bottom: 1.5rem; }
.api-list { display: flex; flex-direction: column; gap: 0.75rem; }
.api-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    transition: box-shadow 0.2s;
}
.api-row:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.api-indicator { flex-shrink: 0; }
.api-dot {
    display: block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}
.api-dot-ok { background: #10b981; box-shadow: 0 0 6px rgba(16,185,129,0.5); animation: pulse-dot 2s infinite; }
.api-dot-error { background: #ef4444; box-shadow: 0 0 6px rgba(239,68,68,0.4); }
.api-dot-waiting { background: #d1d5db; }
.api-info { flex: 1; min-width: 0; }
.api-name { font-weight: 600; font-size: 0.95rem; color: #1f2937; }
.api-desc { font-size: 0.8rem; color: #6b7280; margin-top: 0.15rem; }
.api-detail { flex-shrink: 0; }
.api-badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}
.api-badge-ok { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }
.api-badge-error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.api-badge-waiting { background: #f3f4f6; color: #6b7280; border: 1px solid #d1d5db; }

@media (max-width: 600px) {
    .api-row { flex-wrap: wrap; gap: 0.5rem; }
    .api-detail { width: 100%; text-align: right; }
}

.site-footer {
    margin-top: 3rem;
    padding: 1.25rem 1rem;
    text-align: center;
    font-size: 0.8rem;
    color: #6b7280;
    border-top: 1px solid #e5e7eb;
}
.site-footer .footer-content {
    max-width: 1200px;
    margin: 0 auto;
    letter-spacing: 0.03em;
}

.risk-checks-grid { display: flex; flex-direction: column; gap: 1rem; }
.risk-check-item { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.risk-check-item.risk-flagged { border-color: var(--danger); border-left: 4px solid var(--danger); }
.risk-check-header { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; background: #f8fafc; border-bottom: 1px solid var(--border); }
.risk-check-source { font-weight: 600; color: var(--primary); font-size: 0.85rem; }
.risk-check-type { font-size: 0.85rem; color: var(--text); }
.risk-check-body { padding: 1rem; }
.risk-check-footer { padding: 0.5rem 1rem; background: #fafafa; }
.badge-danger { background: var(--danger); color: #fff; padding: 2px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 600; }
.badge-success { background: var(--success); color: #fff; padding: 2px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 600; }
.text-danger { color: var(--danger) !important; font-weight: 600; }

@media (min-width: 769px) {
    .nav-toggle { display: none !important; }
    .nav-links { display: flex !important; position: static !important; width: auto !important; height: auto !important; box-shadow: none !important; padding: 0 !important; }
    .nav-overlay { display: none !important; }
    .nav-link svg { display: none; }
    .nav-divider { display: none; }
    .nav-user-mobile { display: none !important; }
    .mobile-only { display: none !important; }
    .desktop-only { display: flex !important; }
}

.nav-bell { position: relative; display: flex; align-items: center; color: #fff; text-decoration: none; margin-right: 0.75rem; }
.nav-bell:hover { opacity: 0.8; }
.bell-badge { position: absolute; top: -4px; right: -6px; background: var(--danger); color: #fff; font-size: 0.65rem; font-weight: 700; min-width: 16px; height: 16px; border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0 3px; }

.upcoming-count-lg { font-size: 1.5rem; font-weight: 700; color: var(--primary); }

.pre-score-badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.8rem; font-weight: 600; }
.pre-score-высокий { background: #fee2e2; color: #b91c1c; }
.pre-score-средний { background: #fef3c7; color: #92400e; }
.pre-score-низкий { background: #d1fae5; color: #065f46; }

.smr-badge { display: inline-block; padding: 0.1rem 0.4rem; border-radius: 3px; font-size: 0.75rem; font-weight: 600; background: #dbeafe; color: #1e40af; }

.row-highlight-smr { background: #eff6ff; }

.notifications-list { display: flex; flex-direction: column; gap: 0.5rem; }
.notification-item { display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.75rem 1rem; background: var(--card-bg); border-radius: 8px; border: 1px solid #e2e8f0; }
.notification-unread { background: #eff6ff; border-color: #bfdbfe; }
.notification-icon { flex-shrink: 0; padding-top: 0.15rem; }
.notif-icon { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; font-weight: 700; font-size: 0.85rem; }
.notif-icon-lead { background: #dbeafe; color: #1d4ed8; }
.notif-icon-overdue { background: #fee2e2; color: #b91c1c; }
.notif-icon-spike { background: #fef3c7; color: #92400e; }
.notif-icon-system { background: #e2e8f0; color: #475569; }
.notification-content { flex: 1; min-width: 0; }
.notification-title { font-weight: 600; margin-bottom: 0.15rem; }
.notification-title a { color: var(--primary); text-decoration: none; }
.notification-title a:hover { text-decoration: underline; }
.notification-message { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.15rem; }
.notification-time { font-size: 0.75rem; color: var(--text-muted); }
.cell-truncate { max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-table-compact { font-size: 0.85rem; }
.data-table-compact th, .data-table-compact td { padding: 0.35rem 0.5rem; }

.calc-result { background: var(--bg); border-radius: 8px; padding: 1rem; }
.calc-row { display: flex; justify-content: space-between; padding: 0.3rem 0; font-size: 0.9rem; }
.calc-row .label { color: var(--text-muted); }
.calc-premium { font-weight: 700; font-size: 1.05rem; padding-top: 0.5rem; margin-top: 0.3rem; border-top: 2px solid var(--primary); }
.rate-slider { width: 100%; height: 6px; -webkit-appearance: none; appearance: none; background: linear-gradient(to right, #e0e7ff, var(--primary)); border-radius: 3px; outline: none; cursor: pointer; margin: 0.5rem 0 0.25rem; }
.rate-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: var(--primary); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.2); cursor: pointer; }
.rate-slider::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--primary); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.2); cursor: pointer; }
.rate-slider-labels { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-muted); padding: 0 2px; }
.recommended-rate-block { background: linear-gradient(135deg, #eef2ff, #e0e7ff); border: 1px solid #c7d2fe; border-radius: 8px; padding: 0.75rem 1rem; margin-bottom: 0.75rem; }
.recommended-rate-value { font-size: 1.05rem; color: #1e3a8a; }
.recommended-rate-value strong { font-size: 1.2rem; }
.recommended-rate-reason { font-size: 0.8rem; color: #6366f1; margin-top: 0.2rem; }
.rate-deviation { padding: 0.5rem 0.75rem; border-radius: 6px; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.5rem; }
.deviation-up { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.deviation-down { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.fin-model-grid { display: flex; flex-direction: column; gap: 0.4rem; }
.fin-row { display: flex; justify-content: space-between; padding: 0.4rem 0; font-size: 0.9rem; border-bottom: 1px solid #f0f0f0; }
.fin-row .label { color: var(--text-muted); }
.fin-profit { font-weight: 700; font-size: 1rem; border-top: 2px solid var(--primary); border-bottom: none; padding-top: 0.6rem; margin-top: 0.2rem; }
.margin-badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 4px; font-weight: 700; font-size: 1rem; }
.margin-green { background: #d1fae5; color: #065f46; }
.margin-yellow { background: #fef3c7; color: #92400e; }
.margin-red { background: #fee2e2; color: #991b1b; }
.strategic-badge { display: inline-block; background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #78350f; font-size: 0.7rem; padding: 0.15rem 0.5rem; border-radius: 10px; font-weight: 600; margin-left: 0.5rem; vertical-align: middle; }
.premium-cell { font-weight: 600; color: var(--primary); white-space: nowrap; }

.uw-badge { display: inline-block; padding: 0.15rem 0.6rem; border-radius: 10px; font-size: 0.75rem; font-weight: 600; }
.uw-NOT_SENT { background: #e2e8f0; color: #475569; }
.uw-IN_REVIEW { background: #dbeafe; color: #1d4ed8; }
.uw-APPROVED { background: #d1fae5; color: #065f46; }
.uw-REJECTED { background: #fee2e2; color: #991b1b; }
.uw-NEED_MORE_INFO { background: #fef3c7; color: #92400e; }

.uw-comment-block { background: #fef3c7; border: 1px solid #fcd34d; border-radius: 6px; padding: 0.6rem 0.8rem; margin-bottom: 1rem; font-size: 0.9rem; }

.checklist-block { margin-top: 0.5rem; }
.checklist-category { margin-bottom: 1rem; }
.checklist-cat-title { font-size: 0.9rem; color: var(--primary); border-bottom: 1px solid var(--border); padding-bottom: 0.3rem; margin-bottom: 0.5rem; }
.checklist-item { padding: 0.3rem 0; border-bottom: 1px solid #f0f0f0; }
.checklist-item.checked { opacity: 0.7; }
.checklist-label { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; font-size: 0.9rem; }
.checklist-label input[type="checkbox"] { width: 1.1rem; height: 1.1rem; accent-color: var(--success); }
.checklist-comment { font-size: 0.8rem; color: var(--text-muted); margin-left: 1.6rem; font-style: italic; }
.checklist-meta { font-size: 0.75rem; color: #94a3b8; margin-left: 1.6rem; }

.doc-actions .text-muted { font-size: 0.85rem; }
