/* ===================== Підсумки ===================== */

.reports-page {
    --series-1: #2a78d6; /* запити */
    --series-2: #eb6834; /* типи / логісти */
    --series-3: #1baf7a; /* ліди */
    --grid: #e2e8f0;
    --muted: #64748b;
}

.month-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    margin-right: 8px;
}

.month-title {
    min-width: 150px;
    text-align: center;
    font-size: 17px;
    font-weight: 700;
    color: #0f172a;
}

.reports-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-bottom: 24px;
}

.rep-scope {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 14px;
    font-size: 13px;
    color: var(--muted);
}

/* Головні цифри */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.kpi {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 14px 16px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}

.kpi-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
}

.kpi-value {
    font-size: 28px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
}

.kpi-trend {
    font-size: 12px;
    color: var(--muted);
}

.kpi-trend.up {
    color: #15803d;
}

.kpi-trend.down {
    color: #b91c1c;
}

/* Картки з графіками */
.rep-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 16px;
}

.rep-card-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.rep-card-head h2 {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
}

.rep-sub {
    font-size: 12px;
    color: var(--muted);
}

.rep-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.rep-two .rep-card {
    margin-bottom: 16px;
}

.rep-empty {
    padding: 18px 0;
    color: #94a3b8;
    font-size: 13px;
    text-align: center;
}

/* Горизонтальні смуги */
.hbar {
    display: grid;
    grid-template-columns: 120px 1fr 44px;
    align-items: center;
    gap: 10px;
    padding: 5px 0;
    cursor: default;
}

.hbar-label {
    font-size: 13px;
    color: #334155;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hbar-track {
    height: 14px;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
}

.hbar-fill {
    display: block;
    height: 100%;
    border-radius: 0 4px 4px 0;
    transition: width 0.4s ease;
}

.hbar:hover .hbar-track {
    background: #e2e8f0;
}

.hbar-value {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    text-align: right;
}

/* Стовпчики по днях */
.dc-plot {
    position: relative;
    height: 180px;
    margin-left: 26px;
}

.dc-grid {
    position: absolute;
    inset: 0;
}

.dc-gridline {
    position: absolute;
    left: 0;
    right: 0;
    border-top: 1px solid var(--grid);
}

.dc-gridline span {
    position: absolute;
    left: -26px;
    top: -8px;
    width: 20px;
    text-align: right;
    font-size: 11px;
    color: #94a3b8;
}

.dc-cols {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    gap: 2px;
}

.dc-col {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: flex-end;
    cursor: default;
}

.dc-col:hover {
    background: #f1f5f9;
}

.dc-weekend {
    background: #f8fafc;
}

.dc-bar {
    width: 100%;
    background: var(--series-1);
    border-radius: 4px 4px 0 0;
    transition: height 0.4s ease;
}

.dc-today .dc-bar {
    background: #1d4ed8;
}

.dc-axis {
    display: flex;
    gap: 2px;
    margin-left: 26px;
    margin-top: 4px;
}

.dc-axis span {
    flex: 1;
    text-align: center;
    font-size: 11px;
    color: #94a3b8;
}

/* Таблиці по людях і архів */
.rep-table-wrap {
    overflow-x: auto;
}

.rep-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.rep-table th {
    position: static;
    background: #f8fafc;
    font-size: 12px;
    text-transform: none;
    letter-spacing: 0;
    color: var(--muted);
    padding: 8px 12px;
    border-right: none;
}

.rep-table td {
    padding: 9px 12px;
    border-right: none;
    border-bottom: 1px solid #f1f5f9;
}

.rep-table tbody tr:nth-child(even) {
    background: #ffffff;
}

.rep-table tbody tr:hover {
    background: #f8fafc;
}

.rep-table .num {
    text-align: right;
    white-space: nowrap;
}

.cell-with-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 160px;
}

.cell-with-bar > span:last-child {
    font-weight: 700;
    min-width: 24px;
}

.cell-bar {
    flex: 1;
    height: 10px;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
}

.cell-bar > span {
    display: block;
    height: 100%;
    border-radius: 0 4px 4px 0;
}

.conv {
    font-weight: 700;
    color: #334155;
}

.conv-good {
    color: #15803d;
}

.conv-mid {
    color: #b45309;
}

.conv-bad {
    color: #b91c1c;
}

.arch-current {
    background: #eff6ff !important;
}

.arch-open {
    font-size: 12px;
    color: #2563eb;
    font-weight: 600;
}

.btn-more {
    padding: 5px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #ffffff;
    color: #1d4ed8;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.btn-more:hover {
    border-color: #2563eb;
    background: #eff6ff;
}

/* Підказка */
.rep-tip {
    position: fixed;
    z-index: 3000;
    pointer-events: none;
    padding: 7px 10px;
    border-radius: 8px;
    background: #0f172a;
    color: #f8fafc;
    font-size: 12px;
    line-height: 1.4;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

@media (max-width: 900px) {
    .rep-two {
        grid-template-columns: 1fr;
    }
}

/* Моя робота */
.my-card {
    border-color: #bfdbfe;
    background: linear-gradient(180deg, #f5f9ff 0%, #ffffff 120px);
}

.my-card .kpi-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    margin-bottom: 12px;
}

.my-role {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 4px 0 10px;
    font-size: 14px;
    font-weight: 700;
    color: #1e3a8a;
}

.my-role .rep-sub {
    font-weight: 400;
}

.team-h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0 12px;
    font-size: 18px;
    color: #0f172a;
}

[hidden] {
    display: none !important;
}

/* ================================================================= */
/* Вкладки, період, гроші (раніше окрема сторінка «Аналітика»)        */
/* ================================================================= */
.reports-page [hidden] { display: none !important; }
.rep-top { flex-wrap: wrap; gap: 12px; }
.rep-period { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rep-seg { display: inline-flex; background: #eef1f6; border-radius: 10px; padding: 3px; gap: 2px; }
.rep-seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font: inherit; font-size: 13px; font-weight: 600; color: #475569; cursor: pointer; }
.rep-seg button.active { background: #fff; color: var(--f-text, #111827); box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12); }
.rep-seg-sm { margin-left: auto; }
.rep-seg-sm button { padding: 4px 10px; font-size: 12px; }
.rep-tabs { display: flex; gap: 4px; padding: 0 24px; border-bottom: 1px solid var(--f-line, #e4e8ef); overflow-x: auto; }
.rep-tabs button { border: 0; background: none; padding: 10px 14px; font: inherit; font-size: 14px; font-weight: 600; color: #64748b; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.rep-tabs button.active { color: var(--f-text, #111827); border-bottom-color: var(--f-orange, #c9973a); }
.rep-tabs button:hover { color: var(--f-text, #111827); }
.rep-three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.rep-three .rep-card { margin-bottom: 16px; }
@media (max-width: 1100px) { .rep-three { grid-template-columns: 1fr; } }
.rep-card-head { flex-wrap: wrap; }
.kpi.an-bad { border-color: #fecaca; background: #fff7f7; }
.an-warn { color: #b45309; font-weight: 600; }
.an-neg { color: #dc2626; }

.an-filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; background: var(--f-card, #fff); border: 1px solid var(--f-line, #e4e8ef); border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; }
.an-filters label { display: grid; gap: 3px; font-size: 12px; color: var(--f-muted, #6b7280); font-weight: 600; }
.an-filters select, .an-filters input { height: 34px; border: 1px solid var(--f-line, #e4e8ef); border-radius: 8px; padding: 0 8px; background: #fff; font: inherit; font-size: 14px; color: var(--f-text, #111827); min-width: 0; }
.an-filters .an-q { flex: 1; min-width: 180px; }
.an-scope { font-size: 13px; color: var(--f-muted, #6b7280); margin: 4px 2px 10px; }
.an-kpis { margin-bottom: 16px; }

.an-svg { width: 100%; height: auto; display: block; }
.an-axis { stroke: #cbd5e1; stroke-width: 1; }
.an-bar-p { fill: var(--series-3, #1baf7a); }
.an-bar-dim { fill: #b9e5d3; }
.an-bar-neg { fill: #dc2626; }
.an-val { font-size: 10px; fill: #475569; text-anchor: middle; font-weight: 600; }
.an-lbl { font-size: 11px; fill: #64748b; text-anchor: middle; }
.an-yr { font-size: 10px; fill: #94a3b8; }
.an-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--f-muted, #6b7280); margin-top: 4px; }
.an-sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; }
.an-sw-p { background: var(--series-3, #1baf7a); } .an-sw-dim { background: #b9e5d3; } .an-sw-neg { background: #dc2626; }

.an-table th.an-sort { cursor: pointer; user-select: none; white-space: nowrap; }
.an-table th.an-sort:hover { color: var(--f-blue, #1d5bd8); }
.an-row { cursor: pointer; }
.an-row:hover td { background: #f8fafc; }
.an-mini { font-size: 11px; color: var(--f-muted, #6b7280); font-weight: 500; }
.an-mini .kpi-trend { font-size: 11px; }
.an-problem td { background: #fffbeb; }
.an-pay span { color: #94a3b8; font-weight: 600; font-size: 12px; white-space: nowrap; }
.an-pay span.ok { color: #15803d; }
.an-count { font-size: 13px; color: var(--f-muted, #6b7280); font-weight: 600; margin-left: 6px; }
.an-check { font-size: 13px; color: var(--f-muted, #6b7280); display: inline-flex; gap: 6px; align-items: center; }
.an-more { margin-top: 10px; }
.an-deals td { vertical-align: top; }
.an-hbar { grid-template-columns: minmax(80px, 34%) 1fr auto !important; }
.an-hbar .hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-hbar .hbar-value { white-space: nowrap; text-align: right; min-width: 70px; line-height: 1.15; }
.an-hbar .hbar-value .an-mini { display: block; }

.an-mgr { max-width: 860px; width: calc(100% - 32px); max-height: 90vh; overflow-y: auto; }
.an-close { border: 0; background: none; font-size: 24px; cursor: pointer; color: var(--f-muted, #6b7280); }
.an-mgr-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
.an-h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--f-muted, #6b7280); margin: 16px 0 6px; }
.an-spark { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; height: 120px; align-items: end; }
.an-spark-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.an-spark-bar { width: 70%; min-height: 2px; background: var(--series-3, #1baf7a); border-radius: 4px 4px 0 0; }
.an-spark-bar.neg { background: #dc2626; }
.an-spark-l { font-size: 11px; color: #64748b; }
.an-li { display: grid; grid-template-columns: 1fr auto; gap: 0 10px; padding: 6px 0; border-bottom: 1px solid #eef1f5; font-size: 14px; color: inherit; text-decoration: none; }
.an-li .an-mini { grid-column: 1 / -1; }
a.an-li:hover span:first-child { color: var(--f-blue, #1d5bd8); }
.an-mgr-deals { max-height: 320px; overflow-y: auto; }
@media (max-width: 700px) {
    .an-mgr-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    .rep-tabs { padding: 0 12px; }
}
.rep-kpi6 { grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 16px; }
@media (max-width: 1250px) { .rep-kpi6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 600px) { .rep-kpi6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
