* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;

    background: #f4f5f7;

    color: #18191b;

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        "PingFang SC",
        "Microsoft YaHei",
        sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

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

.app-shell {
    width: 100%;
    max-width: 640px;
    min-height: 100vh;

    margin: 0 auto;

    padding:
        calc(18px + env(safe-area-inset-top))
        16px
        calc(32px + env(safe-area-inset-bottom));
}


/* Header */

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;

    margin-bottom: 22px;
}

.eyebrow {
    color: #979a9f;

    font-size: 13px;
}

.topbar h1 {
    margin: 3px 0 0;

    font-size: 27px;

    letter-spacing: -.5px;
}

.avatar {
    width: 43px;
    height: 43px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background: #1c1d20;
    color: #fff;

    font-weight: 600;
}


/* stats */

.stats-title {
    margin: 4px 3px 10px;
}

.stats-title > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.stats-title h2 {
    margin: 0;

    font-size: 18px;
}

.stats-title span {
    color: #999ca1;

    font-size: 12px;
}


/* black main card */

.summary-card {
    padding: 23px;

    border-radius: 24px;

    background: #1c1d20;

    color: #fff;

    box-shadow:
        0 10px 30px
        rgba(0,0,0,.08);
}

.summary-label {
    margin-bottom: 7px;

    color: rgba(255,255,255,.57);

    font-size: 13px;
}

.balance {
    margin-bottom: 26px;

    font-size: 35px;

    font-weight: 700;

    letter-spacing: -1px;
}

.summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;

    gap: 16px;
}

.summary-grid div {
    display: flex;
    flex-direction: column;

    gap: 5px;
}

.summary-grid span {
    color: rgba(255,255,255,.52);

    font-size: 12px;
}

.summary-grid strong {
    font-size: 17px;
}

.income-text {
    color: #218952;
}

.summary-grid .income-text {
    color: #8fe3b2;
}

.summary-grid .expense-text {
    color: #ffb7b7;
}


/* month */

.month-card {
    margin-top: 14px;

    padding: 19px;

    border-radius: 20px;

    background: white;

    box-shadow:
        0 4px 18px
        rgba(0,0,0,.035);
}

.month-header {
    display: flex;
    justify-content: space-between;

    margin-bottom: 18px;
}

.month-label {
    margin-bottom: 4px;

    color: #909399;

    font-size: 12px;
}

.month-header strong {
    font-size: 24px;
}

.month-date {
    color: #999ca2;

    font-size: 12px;
}

.month-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;

    gap: 12px;
}

.month-grid div {
    padding: 12px 13px;

    border-radius: 14px;

    background: #f6f7f8;
}

.month-grid span {
    display: block;

    margin-bottom: 5px;

    color: #8e9197;

    font-size: 12px;
}

.month-grid strong {
    font-size: 15px;
}

.green {
    color: #218952;
}


/* add button */

.add-button {
    height: 58px;

    margin: 17px 0 26px;

    display: flex;
    align-items: center;
    justify-content: center;

    gap: 9px;

    border-radius: 18px;

    background: #fff;

    font-size: 16px;
    font-weight: 650;

    box-shadow:
        0 4px 18px
        rgba(0,0,0,.04);
}

.add-button:active {
    transform: scale(.985);
}

.add-icon {
    width: 27px;
    height: 27px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background: #1c1d20;

    color: white;

    font-size: 21px;
}


/* list */

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin: 0 3px 11px;
}

.section-header h2 {
    margin: 0;

    font-size: 18px;
}

.section-header span {
    color: #999ca2;

    font-size: 12px;
}

.transaction-list {
    overflow: hidden;

    border-radius: 20px;

    background: #fff;
}

.transaction-row {
    min-height: 83px;

    display: flex;
    align-items: center;

    padding: 14px 15px;

    border-bottom:
        1px solid #f0f1f2;
}

.transaction-row:last-child {
    border-bottom: 0;
}

.category-icon {
    width: 43px;
    height: 43px;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    margin-right: 12px;

    border-radius: 14px;

    background: #fff1ed;

    color: #c25c3d;

    font-weight: 700;
}

.income-icon {
    background: #ebf7ef;
    color: #237e4c;
}

.transaction-main {
    min-width: 0;

    flex: 1;
}

.transaction-title {
    margin-bottom: 5px;

    font-size: 15px;
    font-weight: 650;
}

.transaction-meta,
.transaction-note {
    color: #92959a;

    font-size: 11px;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;
}

.transaction-note {
    margin-top: 3px;
}

.transaction-right {
    flex-shrink: 0;

    margin-left: 9px;

    text-align: right;
}

.transaction-amount {
    margin-bottom: 5px;

    font-size: 15px;

    font-weight: 650;
}

.transaction-date {
    color: #aaa;

    font-size: 10px;
}

.text-button {
    margin-top: 4px;

    padding: 0;

    border: 0;

    background: transparent;

    color: #aaa;

    font-size: 10px;
}


/* empty */

.empty-state {
    padding: 45px 20px;

    text-align: center;

    border-radius: 20px;

    background: white;
}

.empty-icon {
    width: 54px;
    height: 54px;

    margin: 0 auto 13px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 18px;

    background: #f0f1f3;

    font-size: 24px;
}

.empty-state h3 {
    margin: 0 0 6px;
}

.empty-state p {
    margin: 0;

    color: #999ca2;

    font-size: 13px;
}


/* page */

.page-header {
    height: 48px;

    display: grid;

    grid-template-columns:
        48px 1fr 48px;

    align-items: center;

    margin-bottom: 20px;
}

.page-header h1 {
    margin: 0;

    text-align: center;

    font-size: 19px;
}

.back-button {
    width: 42px;
    height: 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background: #fff;

    font-size: 21px;
}


/* switch */

.type-switch {
    display: grid;

    grid-template-columns: 1fr 1fr;

    margin-bottom: 17px;

    padding: 4px;

    border-radius: 16px;

    background: #e5e6e8;
}

.type-switch input {
    display: none;
}

.type-switch span {
    height: 46px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 13px;

    color: #74777c;

    font-weight: 650;
}

.type-switch input:checked + span {
    background: white;
    color: #17181a;

    box-shadow:
        0 2px 7px
        rgba(0,0,0,.06);
}


/* form */

.entry-form {
    padding-bottom:
        calc(88px + env(safe-area-inset-bottom));
}

.form-card {
    padding: 18px;

    border-radius: 22px;

    background: white;
}

.field-label {
    display: flex;
    justify-content: space-between;

    margin: 0 0 7px;

    color: #74777c;

    font-size: 13px;
}

.field-label:not(:first-child) {
    margin-top: 19px;
}

.field-label small {
    color: #bbb;

    font-size: 11px;
}

.input {
    width: 100%;
    height: 52px;

    padding: 0 13px;

    border:
        1px solid #e3e5e7;

    border-radius: 14px;

    outline: 0;

    background: #fafafa;

    font-size: 16px;
}

.input:focus,
.textarea:focus {
    border-color: #aeb0b5;

    background: #fff;
}


/* buyer */

.option-grid {
    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 9px;
}

.option-button input {
    display: none;
}

.option-button span {
    height: 48px;

    display: flex;
    align-items: center;
    justify-content: center;

    border:
        1px solid #e2e3e5;

    border-radius: 14px;

    background: #fafafa;

    font-size: 14px;
}

.option-button input:checked + span {
    border-color: #1c1d20;

    background: #1c1d20;

    color: white;
}


/* number */

.number-input-wrap {
    display: flex;
    align-items: center;

    gap: 8px;
}

.number-input-wrap > span {
    flex-shrink: 0;

    color: #777;

    font-size: 15px;
}

.number-input {
    font-size: 18px;

    font-weight: 600;
}


/* result */

.calculate-card {
    min-height: 75px;

    margin-top: 20px;

    padding: 15px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    border-radius: 16px;

    background: #f3f4f5;
}

.calculate-card span {
    display: block;

    margin-bottom: 4px;

    color: #71747a;

    font-size: 12px;
}

.calculate-card small {
    color: #a0a3a8;

    font-size: 10px;
}

.calculate-card strong {
    font-size: 23px;
}


/* textarea */

.textarea {
    width: 100%;

    padding: 13px;

    border:
        1px solid #e3e5e7;

    border-radius: 14px;

    outline: none;

    resize: vertical;

    background: #fafafa;

    font-size: 15px;
}


/* date */

.auto-date {
    margin-top: 18px;

    padding-top: 15px;

    display: flex;
    justify-content: space-between;

    border-top:
        1px solid #eee;

    color: #8d9095;

    font-size: 12px;
}

.auto-date strong {
    color: #555;

    font-weight: 500;
}


/* button */

.bottom-action {
    position: fixed;

    left: 50%;
    bottom: 0;

    width: 100%;
    max-width: 640px;

    padding:
        12px 16px
        calc(12px + env(safe-area-inset-bottom));

    transform: translateX(-50%);

    background:
        rgba(244,245,247,.93);

    backdrop-filter: blur(14px);

    -webkit-backdrop-filter:
        blur(14px);
}

.btn {
    border: 0;
}

.btn-primary {
    background: #1c1d20;

    color: white;
}

.btn-large {
    width: 100%;
    height: 55px;

    border-radius: 16px;

    font-size: 16px;

    font-weight: 650;
}


/* Login */

.login-body {
    min-height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 20px;
}

.login-shell {
    width: 100%;
    max-width: 420px;
}

.login-brand {
    margin-bottom: 27px;

    text-align: center;
}

.brand-icon {
    width: 58px;
    height: 58px;

    margin: 0 auto 14px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 19px;

    background: #1c1d20;

    color: #fff;

    font-size: 27px;
}

.login-brand h1 {
    margin: 0 0 6px;

    font-size: 27px;
}

.login-brand p {
    margin: 0;

    color: #999ca2;

    font-size: 13px;
}

.login-card {
    padding: 20px;

    border-radius: 23px;

    background: #fff;
}

.login-card .btn {
    margin-top: 23px;
}

.alert {
    margin-bottom: 17px;

    padding: 12px 13px;

    border-radius: 12px;

    font-size: 13px;
}

.alert-error {
    background: #fff0f0;

    color: #b63838;
}