.stats-modal {
    display: none;
    z-index: 10004;
}

.stats-modal.is-open {
    display: flex;
}

.stats-modal__box {
    max-width: 1200px;
}

.stats-section {
    margin-bottom: 30px;
}

.stats-section-title,
.stats-card__title {
    color: var(--admin-primary);
    font-size: 1.1rem;
    margin: 0 0 15px;
}

.stats-section-title {
    border-bottom: 2px solid var(--admin-info);
    display: inline-block;
    padding-bottom: 5px;
}

.stats-section-title--success {
    border-bottom-color: var(--admin-success);
}

.stats-section-title--info {
    border-bottom-color: var(--admin-info);
}

.stats-section-head {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: space-between;
    margin-bottom: 25px;
}

.stats-section-head form {
    margin: 0;
}

.stats-kpi-grid,
.stats-summary-grid {
    display: grid;
    gap: 15px;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.stats-kpi {
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
    color: #fff;
    padding: 20px;
}

.stats-kpi--revenue {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.stats-kpi--expenses {
    background: linear-gradient(135deg, #dc3545, #e4606d);
}

.stats-kpi--profit {
    background: linear-gradient(135deg, #d4af37, #e0c367);
}

.stats-kpi--potential {
    background: linear-gradient(135deg, #17a2b8, #138496);
}

.stats-kpi--orders {
    background: linear-gradient(135deg, #2c303a, #4a5060);
}

.stats-kpi--reviews {
    background: linear-gradient(135deg, #f09433, #e6683c);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.stats-kpi__label,
.stats-summary__label {
    font-size: 0.8rem;
    letter-spacing: 1px;
    margin-bottom: 5px;
    opacity: 0.9;
    text-transform: uppercase;
}

.stats-kpi__value {
    font-size: 2rem;
    font-weight: 700;
}

.stats-kpi__note {
    background: rgba(0, 0, 0, 0.18);
    border-radius: 4px;
    font-size: 0.78rem;
    margin-top: 10px;
    padding: 6px;
}

.stats-kpi__form {
    margin: 10px 0 0;
}

.stats-card,
.stats-chart-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.02);
    margin-bottom: 40px;
    padding: 20px;
}

.stats-card--info {
    border-left: 4px solid var(--admin-info);
}

.stats-card--success-top {
    border-top: 4px solid var(--admin-success);
}

.stats-card--gold-top {
    border-top: 4px solid var(--admin-secondary);
    display: flex;
    flex-direction: column;
}

.stats-card__title--danger {
    border-bottom: 2px solid var(--admin-danger);
    display: inline-block;
    padding-bottom: 5px;
}

.stats-card__copy {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0 0 15px;
}

.stats-inline-form,
.stats-expense-form {
    align-items: flex-end;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.stats-field {
    flex: 1;
    font-size: 0.8rem;
    font-weight: 700;
    min-width: 130px;
}

.stats-field--wide {
    flex: 2;
    min-width: 180px;
}

.stats-input {
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 10px;
    width: 100%;
}

.stats-input--file {
    font-size: 0.85rem;
    padding: 8px;
}

.stats-year-select {
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 700;
    padding: 10px 15px;
}

.stats-btn {
    border: 0;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 700;
    padding: 10px 20px;
    transition: transform 0.2s;
}

.stats-btn:hover {
    transform: translateY(-1px);
}

.stats-btn--light {
    background: #fff;
    color: #e6683c;
    font-size: 0.8rem;
    padding: 6px 10px;
    width: 100%;
}

.stats-btn--info {
    background: var(--admin-info);
    color: #fff;
}

.stats-btn--danger {
    background: var(--admin-danger);
    color: #fff;
}

.stats-table-wrap {
    border: 1px solid #eee;
    border-radius: 4px;
    overflow-x: auto;
}

.stats-table-wrap--compact {
    max-height: 200px;
    overflow-y: auto;
}

.stats-table-wrap--scroll {
    flex: 1;
    max-height: 250px;
    overflow-y: auto;
}

.stats-table {
    border-collapse: collapse;
    font-size: 0.9rem;
    width: 100%;
}

.stats-table--small {
    font-size: 0.85rem;
}

.stats-table th {
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
    padding: 10px;
    text-align: left;
}

.stats-table td {
    border-bottom: 1px solid #eee;
    padding: 10px;
    vertical-align: middle;
}

.stats-table__amount {
    text-align: right;
}

.stats-table__action {
    text-align: center;
    white-space: nowrap;
}

.stats-table__action form {
    margin: 0;
}

.stats-link {
    color: var(--admin-info);
    margin-left: 5px;
    text-decoration: none;
}

.stats-icon-btn {
    background: transparent;
    border: 0;
    color: var(--admin-danger);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
}

.stats-empty {
    color: #888;
    font-size: 0.85rem;
    font-style: italic;
    margin: 0;
}

.stats-empty--large {
    font-size: 0.9rem;
    padding: 40px 10px;
    text-align: center;
}

.stats-widget-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    margin-bottom: 40px;
}

.stats-tax-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.stats-tax-row__head,
.stats-tax-row__foot {
    display: flex;
    justify-content: space-between;
}

.stats-tax-row__head {
    color: #333;
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.stats-tax-row__foot {
    color: #666;
    font-size: 0.8rem;
}

.stats-tax-bar {
    background: #e9ecef;
    border-radius: 10px;
    height: 10px;
    margin-bottom: 6px;
    overflow: hidden;
}

.stats-tax-bar__fill {
    border-radius: 10px;
    height: 100%;
    width: 0;
}

.stats-tax-bar__fill--green {
    background: var(--admin-success);
}

.stats-tax-bar__fill--blue {
    background: var(--admin-info);
}

.stats-tax-bar__fill--gray {
    background: #6c757d;
}

.stats-muted {
    color: #888;
    font-size: 0.75rem;
}

.stats-value--negative {
    color: var(--admin-danger);
    font-weight: 700;
}

.stats-value--gold {
    color: var(--admin-secondary);
    font-weight: 700;
}

.stats-reminder-actions {
    display: flex;
    gap: 4px;
    justify-content: center;
}

.stats-reminder {
    border-radius: 4px;
    color: #fff !important;
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 6px 10px;
    text-decoration: none;
}

.stats-reminder--wa {
    background: #25d366;
}

.stats-reminder--mail {
    background: #007bff;
}

.stats-summary {
    background: #fff;
    border-left: 4px solid var(--admin-info);
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
    padding: 20px;
}

.stats-summary--revenue {
    border-left-color: var(--admin-success);
}

.stats-summary--expenses {
    border-left-color: var(--admin-danger);
}

.stats-summary--profit {
    border-left-color: var(--admin-secondary);
}

.stats-summary__label {
    color: #666;
}

.stats-summary__value {
    color: var(--admin-primary);
    font-size: 1.8rem;
    font-weight: 700;
}

.stats-chart-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: 2fr 1fr;
    margin-bottom: 20px;
}

.stats-chart-card {
    margin-bottom: 20px;
    min-width: 0;
    padding: 25px;
}

.stats-chart-card h3 {
    color: var(--admin-primary);
    font-size: 1.1rem;
    margin: 0 0 20px;
}

.stats-chart {
    height: 250px;
    position: relative;
    width: 100%;
}

.stats-chart--large {
    height: 300px;
}

.stats-chart--short {
    height: 150px;
}

#statsChartData {
    display: none;
}

.stats-modal__box {
    max-width: min(1540px, 96vw);
}

.stats-section {
    scroll-margin-top: 20px;
}

.stats-nav {
    background: rgba(255, 255, 255, 0.84);
    border: 1px solid rgba(32, 36, 44, 0.08);
    border-radius: 999px;
    box-shadow: 0 14px 30px rgba(32, 36, 44, 0.07);
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    overflow-x: auto;
    padding: 8px;
    position: sticky;
    top: 10px;
    z-index: 3;
}

.stats-nav button {
    background: transparent;
    border: 0;
    border-radius: 999px;
    color: #4b5563;
    cursor: pointer;
    font-size: 0.86rem;
    font-weight: 800;
    padding: 9px 14px;
    white-space: nowrap;
}

.stats-nav button:hover,
.stats-nav button.is-active {
    background: #fff7df;
    color: var(--admin-primary);
}

.stats-nav button.is-active {
    box-shadow: inset 0 0 0 1px rgba(212, 175, 55, 0.4);
}

[data-stats-panel] {
    display: none !important;
}

[data-stats-panel].is-active {
    display: block !important;
}

.stats-command-center[data-stats-panel].is-active,
.stats-widget-grid[data-stats-panel].is-active {
    display: grid !important;
}

.stats-command-center {
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    margin-bottom: 22px;
}

.stats-spotlight {
    border-radius: 26px;
    box-shadow: 0 18px 44px rgba(32, 36, 44, 0.14);
    color: #fff;
    padding: clamp(22px, 3vw, 32px);
}

.stats-spotlight--business {
    background: linear-gradient(135deg, #1f7f4a, #2c303a);
}

.stats-spotlight--web {
    background: linear-gradient(135deg, #6d3f22, #d4af37);
}

.stats-eyebrow {
    color: var(--admin-secondary);
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.14em;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.stats-spotlight--web .stats-eyebrow {
    color: rgba(255, 255, 255, 0.78);
}

.stats-spotlight h3 {
    color: #fff;
    font-size: clamp(1.3rem, 2.4vw, 2rem);
    margin: 0;
}

.stats-spotlight__value {
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 900;
    margin: 14px 0 8px;
}

.stats-spotlight p {
    color: rgba(255, 255, 255, 0.76);
    line-height: 1.5;
    margin: 0;
}

.stats-kpi {
    border-radius: 20px;
    box-shadow: 0 16px 36px rgba(32, 36, 44, 0.12);
}

.stats-kpi--visits {
    background: linear-gradient(135deg, #6d3f22, #d4af37);
}

.stats-card,
.stats-chart-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(32, 36, 44, 0.08);
    border-radius: 22px;
    box-shadow: 0 14px 30px rgba(32, 36, 44, 0.07);
}

.stats-input {
    border-radius: 12px;
}

.stats-btn,
.stats-reminder {
    border-radius: 999px;
}

.stats-table-wrap {
    border-radius: 16px;
}

.stats-section--website {
    background: rgba(255, 255, 255, 0.42);
    border: 1px solid rgba(212, 175, 55, 0.16);
    border-radius: 28px;
    padding: clamp(16px, 2vw, 22px);
}

.stats-section--heatmap {
    background: rgba(255, 255, 255, 0.42);
    border: 1px solid rgba(23, 162, 184, 0.16);
    border-radius: 28px;
    padding: clamp(16px, 2vw, 22px);
}

.stats-heatmap-controls {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(3, minmax(160px, 1fr));
    margin-bottom: 18px;
}

.stats-heatmap-controls label {
    color: #404650;
    font-size: 0.84rem;
    font-weight: 800;
}

.stats-heatmap-layout {
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
}

.stats-heatmap-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(32, 36, 44, 0.08);
    border-radius: 24px;
    box-shadow: 0 14px 30px rgba(32, 36, 44, 0.07);
    padding: clamp(16px, 2vw, 24px);
}

.stats-heatmap-device {
    background: linear-gradient(135deg, #20242d, #111318);
    border-radius: 28px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
    margin: 0 auto;
    max-width: 620px;
    padding: 18px;
}

.stats-heatmap-page {
    background: #fffaf0;
    border-radius: 18px;
    min-height: 640px;
    overflow: hidden;
    position: relative;
}

.stats-heatmap-section {
    align-items: center;
    border-bottom: 1px solid rgba(44, 48, 58, 0.08);
    color: rgba(44, 48, 58, 0.52);
    display: flex;
    font-size: 0.78rem;
    font-weight: 900;
    justify-content: center;
    letter-spacing: 0.1em;
    min-height: 118px;
    text-transform: uppercase;
}

.stats-heatmap-section--hero {
    background: linear-gradient(135deg, rgba(44, 48, 58, 0.12), rgba(212, 175, 55, 0.12));
    min-height: 170px;
}

.stats-heatmap-points {
    inset: 0;
    pointer-events: none;
    position: absolute;
}

.stats-heatmap-dot {
    background: radial-gradient(circle, rgba(220, 53, 69, var(--heat-opacity, 0.6)) 0%, rgba(212, 175, 55, calc(var(--heat-opacity, 0.6) * 0.72)) 48%, transparent 72%);
    border-radius: 50%;
    height: var(--heat-size, 18px);
    position: absolute;
    transform: translate(-50%, -50%);
    width: var(--heat-size, 18px);
}

.stats-heatmap-note {
    color: #68717d;
    font-size: 0.86rem;
    margin: 14px 0 0;
    text-align: center;
}

.stats-heatmap-list {
    display: grid;
    gap: 10px;
}

.stats-heatmap-list__item {
    align-items: center;
    background: #fbf7f1;
    border: 1px solid #f0e3d6;
    border-radius: 14px;
    display: flex;
    justify-content: space-between;
    padding: 12px 14px;
}

.stats-heatmap-list__item span {
    color: #5f6875;
    font-size: 0.9rem;
}

.stats-heatmap-list__item strong {
    color: var(--admin-primary);
    font-size: 1.12rem;
}

.stats-chart-grid--website {
    grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
}

.stats-widget-grid--website {
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
}

.stats-top-pages,
.stats-action-list {
    display: grid;
    gap: 10px;
}

.stats-top-page,
.stats-action-list div {
    align-items: center;
    background: #fbf7f1;
    border: 1px solid #f0e3d6;
    border-radius: 14px;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 12px 14px;
}

.stats-top-page span,
.stats-action-list span {
    color: #5f6875;
    font-size: 0.88rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stats-top-page strong,
.stats-action-list strong {
    color: var(--admin-primary);
    font-size: 1.12rem;
}

@media (max-width: 780px) {
    .stats-command-center,
    .stats-heatmap-controls,
    .stats-heatmap-layout,
    .stats-widget-grid,
    .stats-widget-grid--website,
    .stats-chart-grid,
    .stats-chart-grid--website {
        grid-template-columns: 1fr;
    }

    .stats-nav {
        border-radius: 18px;
        position: static;
    }
}
