@font-face {
    font-family: "Roboto Slab";
    src: url("../fonts/RobotoSlab-VariableFont_wght.ttf") format("truetype");
    font-weight: 100 900;
    font-style: normal;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Roboto Slab", serif;
    color: #28496f;
    background: linear-gradient(180deg, #f7fbff 0%, #edf5ff 100%);
}

button,
input,
select,
textarea {
    font-family: inherit;
}

button {
    cursor: pointer;
}

.container {
    width: calc(100% - 108px);
    margin: 0 auto;
}

.header {
    padding-top: 55px;
}

.header-inner {
    height: 72px;
    padding: 0 20px 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
    border: 1px solid #dbe8f7;
    border-radius: 20px;
    box-shadow: 0 10px 28px rgba(40, 73, 111, 0.06);
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 34px;
    font-weight: 800;
    color: #24466f;
    line-height: 1;
    cursor: pointer;
}

.logo-img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.right-menu {
    display: flex;
    align-items: center;
    gap: 18px;
}

.nav {
    display: flex;
    align-items: center;
    gap: 18px;
}

.nav a {
    color: #2a4b73;
    font-size: 23px;
    font-weight: 800;
    text-decoration: none;
    line-height: 1;
}

.nav a.active {
    padding: 2px 10px 4px;
    color: #41648c;
    background: #d9e8ff;
    border-radius: 18px;
}

.btn {
    min-width: 145px;
    height: 42px;
    border: none;
    border-radius: 11px;
    background: #2f80ed;
    color: #ffffff;
    font-size: 24px;
    font-weight: 800;
}

.analytics-page {
    padding: 26px 0 70px;
}

.analytics-filters {
    padding: 18px 21px 11px;
    background: #ffffff;
    border: 1px solid #dbe8f7;
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(40, 73, 111, 0.07);
}

.filter-row {
    display: grid;
    grid-template-columns: 265px minmax(300px, 1fr) 156px 141px 132px 114px;
    gap: 18px;
    align-items: center;
}

.date-filter,
.search-box,
select,
.filter-btn {
    height: 45px;
    border: 1px solid #cfdef0;
    border-radius: 8px;
    background: #ffffff;
    color: #28496f;
    font-size: 14px;
    font-weight: 700;
}

.date-filter {
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.date-filter img {
    width: 24px;
    height: 24px;
}

.search-box {
    padding: 0 12px 0 16px;
    display: flex;
    align-items: center;
}

.search-box input {
    width: 100%;
    border: none;
    outline: none;
    color: #28496f;
    font-size: 14px;
    background: transparent;
}

.search-box input::placeholder {
    color: #8a9ab0;
    font-weight: 400;
}

.search-icon {
    font-size: 34px;
    line-height: 1;
    transform: rotate(-20deg);
    color: #28496f;
}

select {
    padding: 0 34px 0 12px;
    outline: none;
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, #28496f 50%),
        linear-gradient(135deg, #28496f 50%, transparent 50%);
    background-position:
        calc(100% - 17px) 18px,
        calc(100% - 10px) 18px;
    background-size: 8px 8px, 8px 8px;
    background-repeat: no-repeat;
}

.filter-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.filter-btn img {
    width: 24px;
    height: 24px;
}

.filter-counter {
    position: absolute;
    top: -7px;
    right: -7px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #2f80ed;
    color: #ffffff;
    font-size: 11px;
    line-height: 18px;
}

.filter-actions {
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.apply-btn {
    width: 310px;
    height: 38px;
    border: none;
    border-radius: 7px;
    background: #2f80ed;
    color: #ffffff;
    font-size: 15px;
    font-weight: 800;
}

.reset-btn {
    width: 134px;
    height: 38px;
    border: 1px solid #d5e2f2;
    border-radius: 7px;
    background: #ffffff;
    color: #28496f;
    font-size: 15px;
    font-weight: 700;
}

.summary-grid {
    margin-top: 22px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 23px;
}

.summary-card {
    min-height: 123px;
    padding: 26px 24px;
    display: flex;
    align-items: center;
    gap: 22px;
    background: #ffffff;
    border: 1px solid #dbe8f7;
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(40, 73, 111, 0.07);
}

.summary-icon {
    width: 53px;
    height: 53px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.summary-icon span {
    width: 36px;
    height: 36px;
    border: 2px solid currentColor;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    font-weight: 300;
    line-height: 1;
}

.income-card .summary-icon {
    color: #0aa66b;
    background: #d9fae9;
}

.expense-card .summary-icon {
    color: #ff5b3f;
    background: #ffe8e4;
}

.balance-card .summary-icon {
    color: #566dff;
    background: #e7edff;
}

.balance-card .summary-icon span {
    border: none;
    border-radius: 0;
    font-size: 35px;
    font-weight: 800;
}

.summary-info h3 {
    margin: 0 0 3px;
    font-size: 17px;
    font-weight: 800;
}

.summary-info strong {
    display: block;
    font-size: 22px;
    font-weight: 900;
    line-height: 1.15;
}

.income-card strong {
    color: #08a466;
}

.expense-card strong {
    color: #ed2f62;
}

.balance-card strong {
    color: #2f80ed;
}

.summary-info p {
    margin: 2px 0 0;
    font-size: 12px;
    color: #506e92;
}

.analytics-grid {
    margin-top: 23px;
    display: grid;
    grid-template-columns: 1.1fr 1fr 1fr 1.45fr;
    gap: 23px;
    align-items: stretch;
}

.analytics-card {
    min-height: 390px;
    padding: 24px 24px 20px;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid #dbe8f7;
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(40, 73, 111, 0.07);
}

.analytics-card h2 {
    margin: 0 0 20px;
    font-size: 16px;
    font-weight: 900;
    color: #28496f;
}

.analytics-table {
    width: 100%;
}

.analytics-table-head,
.analytics-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 96px 52px;
    align-items: center;
    column-gap: 10px;
}

.analytics-table-head {
    margin-bottom: 14px;
    color: #647895;
    font-size: 14px;
    font-weight: 800;
}

.analytics-row {
    min-height: 33px;
    color: #163d68;
    font-size: 13px;
    font-weight: 600;
}

.analytics-row span {
    min-width: 0;
}

.analytics-row span:first-child {
    display: flex;
    align-items: center;
    gap: 10px;
}

.analytics-row span:nth-child(2),
.analytics-row span:nth-child(3) {
    white-space: nowrap;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: 0 0 auto;
}

.green {
    background: #0aa66b;
}

.red {
    background: #ef2d5a;
}

.violet {
    background: #5849ec;
}

.orange {
    background: #f47a00;
}

.peach {
    background: #f47b3d;
}

.blue {
    background: #116dea;
}

.purple {
    background: #5849ec;
}

.tag {
    min-width: 73px;
    padding: 4px 12px;
    border-radius: 999px;
    text-align: center;
    font-size: 11px;
    font-weight: 800;
}

.tag-violet {
    color: #5b42f3;
    background: #f0eaff;
}

.tag-blue {
    color: #3478ff;
    background: #edf2ff;
}

.tag-green {
    color: #0aa66b;
    background: #e2f8ec;
}

.tag-orange {
    color: #ef7200;
    background: #ffeddf;
}

.tag-purple {
    color: #654dff;
    background: #f0eaff;
}

.tag-gray {
    color: #6e7f97;
    background: #f0f3f8;
}

.empty-analytics {
    min-height: 160px;
    padding: 36px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7c8da4;
    font-size: 14px;
    font-weight: 800;
    text-align: center;
    line-height: 1.5;
}

.card-link {
    margin-top: auto;
    padding: 0;
    border: none;
    background: transparent;
    color: #006bff;
    font-size: 12px;
    font-weight: 900;
    text-align: left;
}

.time-card {
    padding-left: 23px;
    padding-right: 18px;
}

.time-card-header {
    margin-bottom: 17px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.time-card-header h2 {
    margin: 0;
}

.period-tabs {
    height: 31px;
    padding: 3px;
    display: flex;
    align-items: center;
    gap: 3px;
    background: #f5f8fc;
    border-radius: 999px;
}

.period-tabs button {
    height: 25px;
    padding: 0 8px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: #6d7f99;
    font-size: 10px;
    font-weight: 800;
}

.period-tabs button.active {
    color: #2f80ed;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(40, 73, 111, 0.14);
}

.time-head,
.time-row {
    grid-template-columns: 1.4fr 1fr 1fr 1fr;
}

.time-row {
    min-height: 34px;
}

/* Модалки */

.analytics-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(20, 43, 73, 0.32);
}

.analytics-modal-overlay[hidden] {
    display: none;
}

.analytics-modal {
    width: min(560px, 100%);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    padding: 24px;
    background: #ffffff;
    border: 1px solid #dbe8f7;
    border-radius: 18px;
    box-shadow: 0 18px 44px rgba(40, 73, 111, 0.22);
}

.filters-modal {
    width: min(720px, 100%);
}

.analytics-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.analytics-modal-header h2 {
    margin: 0;
    color: #24466f;
    font-size: 24px;
    font-weight: 900;
}

.analytics-modal-close {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 10px;
    background: #eef5ff;
    color: #24466f;
    font-size: 26px;
    font-weight: 800;
    line-height: 1;
}

.analytics-modal-text {
    margin: 14px 0 20px;
    color: #587391;
    font-size: 14px;
    font-weight: 600;
}

.date-modal-fields {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.date-modal-fields label,
.filters-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    color: #28496f;
    font-size: 14px;
    font-weight: 800;
}

.date-modal-fields input,
.filters-field input,
.filters-field select {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1px solid #cfdef0;
    border-radius: 8px;
    outline: none;
    background-color: #ffffff;
    color: #28496f;
    font-size: 14px;
    font-weight: 600;
}

.filters-grid {
    margin-top: 18px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.filters-field-wide {
    grid-column: 1 / -1;
}

.filters-checkbox {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #28496f;
    font-size: 14px;
    font-weight: 800;
}

.filters-checkbox input {
    width: 18px;
    height: 18px;
    accent-color: #2f80ed;
}

.filters-tags {
    margin: 18px 0 0;
    padding: 14px;
    border: 1px solid #cfdef0;
    border-radius: 10px;
}

.filters-tags legend {
    padding: 0 7px;
    color: #28496f;
    font-size: 14px;
    font-weight: 900;
}

.filters-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filters-tag-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 11px;
    border-radius: 999px;
    background: #eef5ff;
    color: #28496f;
    font-size: 13px;
    font-weight: 800;
}

.filters-tag-checkbox input {
    accent-color: #2f80ed;
}

.filters-empty {
    color: #7c8da4;
    font-size: 13px;
    font-weight: 700;
}

.analytics-modal-actions {
    margin-top: 22px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.analytics-modal-cancel,
.analytics-modal-secondary,
.analytics-modal-primary {
    height: 40px;
    padding: 0 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 900;
}

.analytics-modal-cancel,
.analytics-modal-secondary {
    border: 1px solid #d5e2f2;
    background: #ffffff;
    color: #28496f;
}

.analytics-modal-primary {
    border: none;
    background: #2f80ed;
    color: #ffffff;
}

@media (max-width: 1300px) {
    .container {
        width: calc(100% - 40px);
    }

    .analytics-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .filter-row {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .header {
        padding-top: 20px;
    }

    .header-inner {
        height: auto;
        padding: 18px;
        flex-direction: column;
        gap: 18px;
    }

    .right-menu,
    .nav {
        flex-wrap: wrap;
        justify-content: center;
    }

    .filter-row,
    .summary-grid,
    .analytics-grid,
    .filters-grid,
    .date-modal-fields {
        grid-template-columns: 1fr;
    }

    .apply-btn,
    .reset-btn {
        width: 100%;
    }

    .filter-actions {
        flex-direction: column;
    }

    .time-card-header {
        align-items: flex-start;
        flex-direction: column;
    }
}