* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    background: #f4f5f7;
}

body {
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Arial,
        sans-serif;

    background: #f4f5f7;
    color: #17181a;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

.app {
    width: 100%;
    max-width: 520px;
    min-height: 100vh;
    margin: 0 auto;
    padding: 22px 16px 0;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}

.header-label {
    font-size: 13px;
    color: #8a8d93;
    margin-bottom: 3px;
}

.header h1 {
    font-size: 25px;
    line-height: 1.15;
    font-weight: 750;
}

.avatar {
    width: 48px;
    height: 48px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 16px;

    background: #ffffff;

    font-size: 23px;

    box-shadow:
        0 5px 18px rgba(0, 0, 0, 0.05);
}

.period-switcher {
    display: grid;
    grid-template-columns: repeat(3, 1fr);

    gap: 5px;

    padding: 4px;
    margin-bottom: 18px;

    background: #e9eaed;

    border-radius: 14px;
}

.period-button {
    height: 38px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 10px;

    font-size: 13px;
    font-weight: 600;

    color: #73767c;

    transition: 0.15s ease;
}

.period-button.active {
    background: #ffffff;
    color: #17181a;

    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.07);
}

.balance-card {
    padding: 23px 20px;

    border-radius: 24px;

    background:
        linear-gradient(
            135deg,
            #20252c,
            #101216
        );

    color: #ffffff;

    box-shadow:
        0 14px 35px rgba(0, 0, 0, 0.16);
}

.balance-label {
    font-size: 13px;
    color: #afb3ba;
}

.balance-value {
    margin-top: 5px;

    font-size: 36px;
    line-height: 1.15;
    font-weight: 750;

    letter-spacing: -1px;
}

.balance-value.negative {
    color: #ff7474;
}

.balance-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;

    gap: 10px;

    margin-top: 23px;
}

.balance-stat {
    display: flex;
    align-items: center;

    gap: 10px;

    min-width: 0;
}

.balance-stat span {
    display: block;

    margin-bottom: 3px;

    font-size: 11px;
    color: #aeb2b8;
}

.balance-stat strong {
    display: block;

    font-size: 14px;
    white-space: nowrap;
}

.stat-icon {
    width: 34px;
    height: 34px;

    flex: 0 0 34px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 11px;

    font-size: 18px;
    font-weight: 700;
}

.income .stat-icon {
    color: #50d890;
    background: rgba(80, 216, 144, 0.12);
}

.expense .stat-icon {
    color: #ff6c6c;
    background: rgba(255, 108, 108, 0.12);
}

.section {
    margin-top: 30px;
}

.section-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;

    margin-bottom: 13px;
    padding: 0 3px;
}

.section-small {
    display: block;

    margin-bottom: 2px;

    font-size: 11px;

    color: #93969b;

    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.section-header h2 {
    font-size: 21px;
    font-weight: 730;
}

.section-total {
    padding-bottom: 2px;

    font-size: 14px;
    color: #55585d;
}

.categories {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-card {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: space-between;

    min-height: 77px;

    padding: 13px 14px 18px;

    overflow: hidden;

    border-radius: 18px;

    background: #ffffff;

    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.035);

    transition:
        transform 0.12s ease,
        background 0.12s ease;
}

.category-card:active {
    transform: scale(0.985);
    background: #fafafa;
}

.category-left {
    display: flex;
    align-items: center;
    gap: 12px;

    min-width: 0;
}

.category-icon {
    width: 45px;
    height: 45px;

    flex: 0 0 45px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 14px;

    background: #f2f4f7;

    font-size: 21px;
}

.category-info {
    min-width: 0;
}

.category-info strong {
    display: block;

    margin-bottom: 4px;

    overflow: hidden;

    font-size: 15px;
    font-weight: 650;

    white-space: nowrap;
    text-overflow: ellipsis;
}

.category-info span {
    display: block;

    font-size: 11px;
    color: #989ba0;
}

.category-right {
    flex: 0 0 auto;

    text-align: right;

    padding-left: 10px;
}

.category-right strong {
    display: block;

    margin-bottom: 4px;

    font-size: 14px;
    font-weight: 700;
}

.category-right span {
    display: block;

    font-size: 11px;
    color: #93969b;
}

.category-progress {
    position: absolute;

    left: 14px;
    right: 14px;
    bottom: 8px;

    height: 3px;

    overflow: hidden;

    border-radius: 4px;

    background: #eeeeef;
}

.category-progress-value {
    height: 100%;

    border-radius: 4px;

    background:
        linear-gradient(
            90deg,
            #6579ff,
            #8d72ff
        );
}

.debt-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;

    gap: 9px;
}

.debt-card {
    min-width: 0;

    padding: 16px;

    border-radius: 20px;

    background: #ffffff;

    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.035);
}

.debt-card.owe {
    background: #fff4f3;
}

.debt-card.owed {
    background: #effaf3;
}

.debt-title {
    margin-bottom: 13px;

    font-size: 12px;
    font-weight: 700;
}

.owe .debt-title {
    color: #c65151;
}

.owed .debt-title {
    color: #36835a;
}

.debt-row {
    margin-top: 11px;
}

.debt-row span {
    display: block;

    margin-bottom: 2px;

    overflow: hidden;

    font-size: 12px;
    color: #74777c;

    white-space: nowrap;
    text-overflow: ellipsis;
}

.debt-row strong {
    display: block;

    font-size: 14px;
}

.debt-empty {
    font-size: 13px;
    color: #96999e;
}

.plans {
    display: flex;
    flex-direction: column;

    gap: 8px;
}

.plan-card {
    display: grid;
    grid-template-columns: 76px 1fr auto;

    align-items: center;

    gap: 10px;

    min-height: 70px;

    padding: 12px 14px;

    border-radius: 18px;

    background: #ffffff;

    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.035);
}

.plan-date {
    font-size: 12px;
    font-weight: 700;

    color: #6077d7;
}

.plan-info {
    min-width: 0;
}

.plan-info strong {
    display: block;

    overflow: hidden;

    font-size: 13px;
    font-weight: 650;

    white-space: nowrap;
    text-overflow: ellipsis;
}

.plan-info span {
    display: block;

    margin-top: 3px;

    font-size: 11px;

    color: #92959a;
}

.plan-amount {
    font-size: 12px;
    font-weight: 700;

    white-space: nowrap;
}

.empty-card {
    display: flex;
    flex-direction: column;

    align-items: center;
    justify-content: center;

    padding: 30px 15px;

    border-radius: 20px;

    background: #ffffff;

    text-align: center;
}

.empty-icon {
    margin-bottom: 10px;

    font-size: 29px;
}

.empty-card strong {
    margin-bottom: 4px;

    font-size: 14px;
}

.empty-card span {
    font-size: 12px;

    color: #96999e;
}

.bottom-space {
    height: 110px;
}

.bottom-navigation {
    position: fixed;

    left: 50%;
    bottom: 0;

    z-index: 100;

    width: 100%;
    max-width: 520px;

    display: grid;
    grid-template-columns: repeat(4, 1fr);

    padding:
        8px 6px
        max(8px, env(safe-area-inset-bottom));

    background:
        rgba(255, 255, 255, 0.94);

    border-top:
        1px solid rgba(0, 0, 0, 0.06);

    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);

    transform: translateX(-50%);
}

.bottom-item {
    display: flex;
    flex-direction: column;

    align-items: center;
    justify-content: center;

    gap: 2px;

    min-height: 48px;

    color: #9a9da2;
}

.bottom-item span {
    font-size: 21px;
}

.bottom-item small {
    font-size: 9px;
}

.bottom-item.active {
    color: #566ce1;
}

@media (min-width: 700px) {

    .app {
        padding-top: 35px;
    }

    .bottom-navigation {
        border-left: 1px solid #eeeeef;
        border-right: 1px solid #eeeeef;
    }
}

.detail-header {
    display: flex;
    align-items: center;

    gap: 13px;

    margin-bottom: 21px;
}

.back-button {
    width: 44px;
    height: 44px;

    flex: 0 0 44px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 14px;

    background: #ffffff;

    font-size: 34px;
    line-height: 1;

    box-shadow:
        0 4px 15px rgba(0, 0, 0, 0.05);
}

.back-button:active {
    transform: scale(0.96);
}

.detail-header-title {
    min-width: 0;
}

.detail-header-title span {
    display: block;

    margin-bottom: 3px;

    font-size: 12px;
    color: #92959b;
}

.detail-header-title h1 {
    overflow: hidden;

    font-size: 23px;
    font-weight: 750;

    white-space: nowrap;
    text-overflow: ellipsis;
}

.category-total-card {
    display: flex;
    flex-direction: column;

    padding: 23px 20px;

    border-radius: 22px;

    background:
        linear-gradient(
            135deg,
            #606deb,
            #8164e8
        );

    color: #ffffff;

    box-shadow:
        0 12px 30px rgba(92, 92, 220, 0.2);
}

.category-total-card span {
    font-size: 12px;

    color:
        rgba(255, 255, 255, 0.72);
}

.category-total-card strong {
    margin-top: 5px;

    font-size: 32px;
    line-height: 1.2;

    letter-spacing: -0.8px;
}

.category-total-card small {
    margin-top: 13px;

    font-size: 11px;

    color:
        rgba(255, 255, 255, 0.72);
}

.transaction-list {
    display: flex;
    flex-direction: column;

    gap: 8px;
}

.transaction-card {
    display: grid;
    grid-template-columns:
        48px
        minmax(0, 1fr)
        auto;

    align-items: center;

    gap: 12px;

    min-height: 73px;

    padding: 12px 14px;

    border-radius: 18px;

    background: #ffffff;

    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.035);
}

.transaction-date {
    width: 48px;
    height: 48px;

    display: flex;
    flex-direction: column;

    align-items: center;
    justify-content: center;

    border-radius: 14px;

    background: #f1f3f7;
}

.transaction-date strong {
    font-size: 18px;
    line-height: 1;
}

.transaction-date span {
    margin-top: 4px;

    font-size: 8px;

    color: #8b8e94;
}

.transaction-info {
    min-width: 0;
}

.transaction-info > strong {
    display: block;

    overflow: hidden;

    font-size: 14px;
    font-weight: 650;

    white-space: nowrap;
    text-overflow: ellipsis;
}

.transaction-meta {
    display: flex;
    align-items: center;

    gap: 8px;

    margin-top: 5px;
}

.transaction-meta span {
    font-size: 10px;
    color: #92959a;
}

.transaction-meta span + span::before {
    content: "•";

    margin-right: 8px;

    color: #c1c3c7;
}

.transaction-amount {
    padding-left: 8px;

    font-size: 13px;
    font-weight: 750;

    color: #db5555;

    white-space: nowrap;
}

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: #f4f5f7;
}

.login-page {
    width: 100%;
    max-width: 420px;
    padding: 35px 22px;
    border-radius: 28px;
    background: #ffffff;
    text-align: center;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.08);
}

.login-logo {
    width: 65px;
    height: 65px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
    border-radius: 20px;
    background: #f0f2f8;
    font-size: 30px;
}

.login-page h1 {
    font-size: 25px;
}

.login-page > p {
    margin-top: 7px;
    font-size: 13px;
    color: #92959a;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 11px;
    margin-top: 27px;
}

.login-form input {
    width: 100%;
    height: 52px;
    padding: 0 15px;
    border: 1px solid #e3e5e9;
    border-radius: 14px;
    background: #f8f9fa;
    outline: none;
    font-size: 15px;
}

.login-form input:focus {
    border-color: #6678e8;
}

.login-form button {
    height: 52px;
    margin-top: 4px;
    border: 0;
    border-radius: 14px;
    background: #17191d;
    color: #ffffff;
    font-size: 15px;
    font-weight: 650;
    cursor: pointer;
}

.login-error {
    padding: 10px;
    border-radius: 11px;
    background: #fff0f0;
    color: #c64646;
    font-size: 12px;
}