/* ===== КАНБАН ДОСКА ===== */
#board-container {
    width: 100%;
}

.board-wrapper {
    width: 100%;
    overflow-x: auto;
    padding: 0.5rem 0 1rem;
    -webkit-overflow-scrolling: touch;
    display: flex;
    justify-content: center;
}

.kanban-board {
    display: flex;
    gap: 1rem;
    align-items: stretch;
    flex-wrap: nowrap;
    padding: 0 0.25rem;
}

.kanban-column {
    flex: 0 0 220px;
    width: 220px;
    background: #f1f4f2;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 220px);
    min-height: 300px;
}

.kanban-column-header {
    padding: 0.65rem 1rem;
    border-radius: 10px 10px 0 0;
    font-weight: 600;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    color: #fff;
}

.kanban-column-header .col-icon {
    font-size: 1rem;
}

.kanban-column-count {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 20px;
    padding: 1px 9px;
    font-size: 0.8rem;
    font-weight: 700;
}

.kanban-column-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border-radius: 0 0 10px 10px;
    transition: background 0.15s;
}

.kanban-column-body.drag-over {
    background: rgba(26, 122, 66, 0.08);
    outline: 2px dashed var(--color-primary);
    outline-offset: -3px;
}

.kanban-placeholder {
    margin: 4px 0;
    padding: 0.5rem 0.75rem;
    border: 2px dashed #7C3AED;
    border-radius: 8px;
    background: rgba(124, 58, 237, 0.06);
    color: #7C3AED;
    font-style: italic;
    font-size: 0.78rem;
    text-align: center;
    pointer-events: none;
}

.kanban-empty {
    text-align: center;
    color: #aaa;
    font-size: 0.8rem;
    padding: 1.5rem 0.5rem;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kanban-card {
    background: #fff;
    border-radius: 8px;
    padding: 0.65rem 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: box-shadow 0.15s, transform 0.15s;
    border: 1px solid rgba(0, 0, 0, 0.06);
    user-select: none;
}

.kanban-card:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.13);
    transform: translateY(-2px);
}

.kanban-card.dragging {
    opacity: 0.45;
    cursor: grabbing;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.kanban-card-name {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.2rem;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kanban-card-phone {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-bottom: 0.3rem;
}

.kanban-card-products {
    font-size: 0.78rem;
    color: #555;
    margin-bottom: 0.35rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kanban-card-price {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--color-primary);
}

.kanban-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.4rem;
    gap: 0.25rem;
}

.kanban-card-date {
    font-size: 0.72rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.kanban-card-assignee {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kanban-card-assignee-avatar {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-transform: uppercase;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.85);
    overflow: hidden;
}

.kanban-card-assignee-avatar.has-image {
    background: #e2e8f0;
    color: transparent;
}

.kanban-card-assignee-avatar img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.kanban-card-address,
.kanban-card-comment {
    font-size: 0.75rem;
    color: #888;
    margin-top: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.kanban-card-address {
    color: #475569;
    font-style: normal;
    font-weight: 500;
}

.kanban-card-comment {
    font-style: italic;
}

.kanban-col-new { background: #3b82f6; }
.kanban-col-processing { background: #f59e0b; }
.kanban-col-paid { background: #10b981; }
.kanban-col-shipping { background: #8b5cf6; }
.kanban-col-done { background: #059669; }
.kanban-col-cancelled { background: #ef4444; }

.kanban-column-body::-webkit-scrollbar {
    width: 4px;
}

.kanban-column-body::-webkit-scrollbar-track {
    background: transparent;
}

.kanban-column-body::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.kanban-column-body::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* ── Stat bar ── */
.stat-bar {
    display: flex;
    align-items: center;
    background: #fff;
    border-bottom: 1px solid #e8eaed;
    padding: 10px 1rem;
    gap: 0;
    min-height: 90px;
    flex-shrink: 0;
    overflow-x: auto;
    scrollbar-width: none;
    margin-bottom: 0;
}

.stat-bar::-webkit-scrollbar {
    display: none;
}

.stat-bar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 10px 14px;
    cursor: default;
    flex-shrink: 0;
}

.stat-filter-item {
    cursor: pointer;
    border-radius: 10px;
    border: 2px solid transparent;
    transition: background 0.15s ease, border-color 0.15s ease;
    user-select: none;
    position: relative;
}

.stat-filter-item:hover {
    background: #f4f5f8;
}

.stat-filter-item.active {
    border-color: var(--stat-accent, #6366f1);
    background: color-mix(in srgb, var(--stat-accent, #6366f1) 8%, #ffffff);
}

@supports not (color: color-mix(in srgb, red 8%, white)) {
    .stat-filter-item.active {
        background: #eef0ff;
    }
}

.stat-filter-item.active .stat-bar-value {
    color: var(--stat-accent, #6366f1);
}

.stat-filter-item:active {
    transform: scale(0.97);
}

.stat-bar-spacer {
    flex: 1;
    min-width: 12px;
}

.stat-bar-revenue {
    flex-shrink: 0;
}

.stat-bar-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 4px;
}

.stat-bar-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.stat-bar-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1.1;
    transition: color 0.15s;
}

.stat-bar-label {
    font-size: 0.68rem;
    color: #aaa;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.stat-bar-meta {
    font-size: 0.66rem;
    color: #94a3b8;
    margin-top: 1px;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.stat-sparkline-wrap {
    margin-top: 5px;
    cursor: pointer;
    border-radius: 4px;
    transition: opacity 0.15s, transform 0.12s;
    opacity: 0.7;
    min-width: 64px;
    height: 20px;
    position: relative;
}

.stat-sparkline-wrap:hover {
    opacity: 1;
    transform: scaleY(1.1);
}

.stat-sparkline-wrap svg {
    display: block;
    width: 100%;
    height: 100%;
}

.stat-sparkline-wrap::after {
    content: 'Подробный график';
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26,26,46,0.88);
    color: #fff;
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 0.65rem;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 200;
}

.stat-sparkline-wrap:hover::after {
    opacity: 1;
}

.stat-bar-divider {
    width: 1px;
    height: 40px;
    background: #e8eaed;
    flex-shrink: 0;
    margin: 0 2px;
    align-self: center;
}

/* Модалка графика статуса */
.status-chart-modal-content {
    border: none;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18);
    overflow: hidden;
}

.status-chart-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem 1rem;
    border-bottom: 1px solid #f0f0f3;
}

.status-chart-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1a1a2e;
    display: flex;
    align-items: center;
    margin: 0;
}

.status-chart-modal-body {
    padding: 1.5rem;
}

.chart-period-group {
    display: flex;
    gap: 6px;
    margin-bottom: 1.25rem;
}

.chart-period-btn {
    padding: 5px 14px;
    border-radius: 20px;
    border: 1.5px solid #e0e3ea;
    background: transparent;
    color: #666;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    outline: none;
}

.chart-period-btn:hover {
    border-color: #6366f1;
    color: #6366f1;
    background: #f3f2ff;
}

.chart-period-btn.active {
    background: #6366f1;
    border-color: #6366f1;
    color: #fff;
}

.status-chart-wrap {
    position: relative;
    height: 280px;
}

.status-chart-wrap canvas {
    width: 100% !important;
}

.status-chart-footer {
    display: flex;
    gap: 1.5rem;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f0f0f3;
}

.chart-stat-item {
    font-size: 0.8rem;
    color: #888;
    font-weight: 500;
}

@media (max-width: 600px) {
    .stat-bar {
        padding: 0 0.5rem;
        min-height: 80px;
    }

    .stat-bar-item {
        padding: 8px 10px;
        flex-shrink: 0;
    }

    .stat-bar-value {
        font-size: 1.05rem;
    }

    .stat-bar-icon {
        width: 34px;
        height: 34px;
        font-size: 0.9rem;
    }

    .stat-bar-label {
        display: none;
    }

    .stat-bar-meta {
        display: none;
    }

    .stat-sparkline-wrap {
        min-width: 50px;
    }
}
