:root {
    color-scheme: light;
    --black: #050505;
    --ink: #161616;
    --charcoal: #2a2a2a;
    --muted: #737373;
    --line: #e7e7e7;
    --soft: #f5f5f5;
    --white: #ffffff;
    --success: #137a45;
    --success-bg: #eaf8f0;
    --danger: #b42318;
    --danger-bg: #fff0ee;
    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 28px;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    min-width: 320px;
    background: var(--white);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

button,
input {
    font: inherit;
}

a {
    color: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.container {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.16em;
}

.eyebrow--light {
    color: #a6a6a6;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--black);
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    text-decoration: none;
}

.brand--light {
    color: var(--white);
}

.brand__mark {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 11px;
    background: var(--white);
    color: var(--black);
    font-size: 0.92rem;
}

.brand__mark--dark {
    border-color: var(--black);
    background: var(--black);
    color: var(--white);
}

/* Authentication */
.auth-page {
    min-height: 100vh;
    min-height: 100svh;
    background: var(--soft);
}

.auth-shell {
    display: grid;
    min-height: 100vh;
    min-height: 100svh;
    grid-template-columns: minmax(360px, 0.9fr) minmax(520px, 1.1fr);
}

.auth-brand {
    position: relative;
    display: flex;
    min-height: 100%;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(32px, 5vw, 72px);
    overflow: hidden;
    background: var(--black);
    color: var(--white);
}

.auth-brand::before,
.auth-brand::after {
    position: absolute;
    content: "";
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 50%;
}

.auth-brand::before {
    right: -180px;
    bottom: -120px;
    width: 520px;
    height: 520px;
}

.auth-brand::after {
    right: -50px;
    bottom: 10px;
    width: 260px;
    height: 260px;
}

.auth-brand > * {
    position: relative;
    z-index: 1;
}

.auth-brand__copy {
    max-width: 540px;
    margin: auto 0;
    padding: 60px 0;
}

.auth-brand__copy h1 {
    max-width: 530px;
    margin: 0;
    font-size: clamp(2.7rem, 5vw, 5.6rem);
    font-weight: 650;
    letter-spacing: -0.065em;
    line-height: 0.98;
}

.auth-brand__copy p:last-child {
    max-width: 470px;
    margin: 28px 0 0;
    color: #b9b9b9;
    font-size: 1.08rem;
}

.auth-brand__footer {
    margin: 0;
    color: #8d8d8d;
    font-size: 0.85rem;
}

.auth-panel {
    display: grid;
    min-height: 100%;
    padding: clamp(24px, 6vw, 80px);
    place-items: center;
    background: var(--white);
}

.auth-card {
    width: min(100%, 460px);
}

.auth-card--wide {
    width: min(100%, 600px);
}

.auth-card__heading {
    margin-bottom: 32px;
}

.auth-card__heading h2 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3rem);
    letter-spacing: -0.05em;
    line-height: 1.08;
}

.auth-card__heading > p:last-child {
    margin: 12px 0 0;
    color: var(--muted);
}

.form-stack {
    display: grid;
    gap: 18px;
}

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

.field {
    display: grid;
    gap: 8px;
}

.field > span {
    color: var(--charcoal);
    font-size: 0.85rem;
    font-weight: 700;
}

.field input {
    width: 100%;
    min-height: 54px;
    padding: 0 16px;
    border: 1px solid #d5d5d5;
    border-radius: var(--radius-sm);
    outline: none;
    background: var(--white);
    color: var(--ink);
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field input::placeholder {
    color: #a1a1a1;
}

.field input:focus {
    border-color: var(--black);
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.07);
}

.form-hint {
    margin: -8px 0 2px;
    color: var(--muted);
    font-size: 0.78rem;
}

.button {
    display: inline-flex;
    min-height: 54px;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 0 20px;
    border: 0;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 800;
    transition: transform 150ms ease, opacity 150ms ease;
}

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

.button:active {
    transform: translateY(0);
}

.button--primary {
    background: var(--black);
    color: var(--white);
}

.button--full {
    width: 100%;
}

.auth-switch {
    margin: 24px 0 0;
    color: var(--muted);
    text-align: center;
}

.auth-switch a {
    color: var(--black);
    font-weight: 800;
    text-underline-offset: 3px;
}

.alert {
    margin-bottom: 20px;
    padding: 13px 15px;
    border: 1px solid;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
}

.alert--success {
    border-color: #b7e3c9;
    background: var(--success-bg);
    color: var(--success);
}

.alert--error {
    border-color: #f5c5be;
    background: var(--danger-bg);
    color: var(--danger);
}

/* Dashboard */
.dashboard-page {
    min-height: 100vh;
    background: #fafafa;
}

.topbar {
    position: sticky;
    z-index: 20;
    top: 0;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(18px);
}

.topbar__inner {
    display: flex;
    min-height: 72px;
    align-items: center;
    justify-content: space-between;
}

.topbar__actions,
.profile-chip {
    display: flex;
    align-items: center;
}

.topbar__actions {
    gap: 12px;
}

.profile-chip {
    gap: 9px;
    font-size: 0.88rem;
    font-weight: 700;
}

.profile-chip__avatar {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 50%;
    background: var(--soft);
    color: var(--black);
}

.icon-button {
    display: grid;
    width: 40px;
    height: 40px;
    padding: 0;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--white);
    cursor: pointer;
}

.icon-button svg {
    width: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.dashboard-main {
    padding-top: 42px;
    padding-bottom: 70px;
}

.dashboard-alert {
    margin-bottom: 24px;
}

.dashboard-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}

.dashboard-heading h1 {
    margin: 0;
    font-size: clamp(2rem, 5vw, 3.6rem);
    letter-spacing: -0.055em;
    line-height: 1.02;
}

.dashboard-heading > div > p:last-child {
    margin: 12px 0 0;
    color: var(--muted);
}

.month-control {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 5px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--white);
}

.month-control a {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 9px;
    text-decoration: none;
}

.month-control a:hover {
    background: var(--soft);
}

.month-control input {
    min-height: 36px;
    padding: 0 6px;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--ink);
    font-weight: 750;
}

.balance-card {
    position: relative;
    display: flex;
    min-height: 230px;
    align-items: end;
    justify-content: space-between;
    gap: 30px;
    padding: clamp(28px, 5vw, 52px);
    overflow: hidden;
    border-radius: var(--radius-lg);
    background: var(--black);
    color: var(--white);
}

.balance-card__content,
.balance-card__plan {
    position: relative;
    z-index: 1;
}

.balance-card__content p,
.balance-card__plan span {
    margin: 0 0 6px;
    color: #adadad;
    font-size: 0.82rem;
}

.balance-card__content h2 {
    margin: 0;
    font-size: clamp(2.65rem, 8vw, 5rem);
    font-weight: 600;
    letter-spacing: -0.065em;
    line-height: 1;
}

.balance-card__content > span {
    display: block;
    margin-top: 12px;
    color: #898989;
    font-size: 0.82rem;
}

.balance-card__plan {
    display: grid;
    min-width: 190px;
    padding: 18px 20px;
    border: 1px solid rgba(255, 255, 255, 0.17);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(10px);
}

.balance-card__plan strong {
    font-size: 1.2rem;
}

.balance-card__decoration {
    position: absolute;
    top: -70px;
    right: 6%;
    width: 280px;
    height: 280px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    box-shadow: 0 0 0 70px rgba(255, 255, 255, 0.025), 0 0 0 140px rgba(255, 255, 255, 0.018);
}

.amount--negative {
    color: #ffb8b1;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: 14px 0;
}

.metric-card,
.panel {
    border: 1px solid var(--line);
    background: var(--white);
}

.metric-card {
    min-width: 0;
    padding: 20px;
    border-radius: var(--radius-md);
}

.metric-card__icon {
    display: grid;
    width: 34px;
    height: 34px;
    margin-bottom: 22px;
    place-items: center;
    border-radius: 50%;
    background: var(--soft);
    font-weight: 800;
}

.metric-card p {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 0.8rem;
}

.metric-card h3 {
    margin: 0;
    overflow: hidden;
    font-size: clamp(1.25rem, 2.5vw, 1.7rem);
    letter-spacing: -0.04em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.metric-card > span {
    display: block;
    margin-top: 9px;
    color: #929292;
    font-size: 0.74rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 14px;
    margin-top: 14px;
}

.panel {
    padding: clamp(20px, 3vw, 28px);
    border-radius: var(--radius-md);
}

.panel__heading {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 26px;
}

.panel__heading h2 {
    margin: 0;
    font-size: 1.35rem;
    letter-spacing: -0.035em;
}

.panel__meta {
    color: var(--muted);
    font-size: 0.78rem;
    white-space: nowrap;
}

.budget-progress-list {
    display: grid;
    gap: 22px;
}

.budget-progress__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 9px;
    font-size: 0.86rem;
}

.budget-progress__top strong {
    text-align: right;
}

.budget-progress__top small {
    color: var(--muted);
    font-weight: 500;
}

.progress-track {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #ededed;
}

.progress-track span {
    display: block;
    min-width: 0;
    height: 100%;
    border-radius: inherit;
}

.progress--dark {
    background: var(--black);
}

.progress--mid {
    background: #676767;
}

.progress--light {
    background: #aaaaaa;
}

.status-dot {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 0.75rem;
    white-space: nowrap;
}

.status-dot i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--black);
}

.quick-panel {
    background: #f3f3f3;
}

.chat-preview {
    display: grid;
    gap: 16px;
}

.chat-preview__bubble {
    width: fit-content;
    max-width: 85%;
    padding: 13px 15px;
    border-radius: 16px 16px 16px 4px;
    background: var(--black);
    color: var(--white);
    font-size: 0.85rem;
}

.chat-preview button {
    display: flex;
    min-height: 56px;
    align-items: center;
    justify-content: space-between;
    padding: 8px 9px 8px 17px;
    border: 1px solid #d7d7d7;
    border-radius: 16px;
    background: var(--white);
    color: #989898;
    text-align: left;
}

.chat-preview button b {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 12px;
    background: var(--black);
    color: var(--white);
}

.quick-panel__note {
    margin: 17px 0 0;
    color: var(--muted);
    font-size: 0.78rem;
}

.transactions-panel {
    margin-top: 14px;
}

.transaction-list {
    display: grid;
}

.transaction-row {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 14px 0;
    border-top: 1px solid var(--line);
}

.transaction-row:first-child {
    border-top: 0;
}

.transaction-row__icon {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border-radius: 50%;
    background: var(--soft);
    font-weight: 800;
}

.transaction-row__copy {
    min-width: 0;
}

.transaction-row__copy strong,
.transaction-row__copy span,
.transaction-row__amount small {
    display: block;
}

.transaction-row__copy strong {
    overflow: hidden;
    font-size: 0.9rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.transaction-row__copy span,
.transaction-row__amount small {
    color: var(--muted);
    font-size: 0.72rem;
}

.transaction-row__amount {
    font-size: 0.9rem;
    font-weight: 800;
    text-align: right;
}

.transaction-row__amount--income {
    color: var(--success);
}

.empty-state {
    padding: 32px 20px 22px;
    color: var(--muted);
    text-align: center;
}

.empty-state__icon {
    display: grid;
    width: 52px;
    height: 52px;
    margin: 0 auto 14px;
    place-items: center;
    border-radius: 50%;
    background: var(--soft);
    color: var(--black);
    font-size: 1.4rem;
}

.empty-state h3 {
    margin: 0;
    color: var(--ink);
    font-size: 1rem;
}

.empty-state p {
    max-width: 440px;
    margin: 7px auto 0;
    font-size: 0.82rem;
}

.mobile-nav {
    display: none;
}

@media (max-width: 920px) {
    .auth-shell {
        grid-template-columns: minmax(310px, 0.75fr) 1fr;
    }

    .auth-brand__copy h1 {
        font-size: clamp(2.4rem, 6vw, 4rem);
    }

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

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .container {
        width: min(100% - 28px, 1180px);
    }

    .auth-shell {
        display: block;
    }

    .auth-brand {
        min-height: 245px;
        padding: 24px;
    }

    .auth-brand__copy {
        padding: 44px 0 20px;
    }

    .auth-brand__copy h1 {
        max-width: 420px;
        font-size: clamp(2.3rem, 11vw, 3.3rem);
    }

    .auth-brand__copy p:last-child,
    .auth-brand__footer {
        display: none;
    }

    .auth-panel {
        min-height: auto;
        padding: 34px 22px 44px;
    }

    .auth-card__heading {
        margin-bottom: 25px;
    }

    .auth-card__heading h2 {
        font-size: 2rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .topbar__inner {
        min-height: 62px;
    }

    .profile-chip__name {
        display: none;
    }

    .dashboard-main {
        padding-top: 27px;
        padding-bottom: calc(104px + env(safe-area-inset-bottom));
    }

    .dashboard-heading {
        display: grid;
        align-items: start;
        margin-bottom: 22px;
    }

    .dashboard-heading h1 {
        font-size: clamp(2.1rem, 10vw, 3rem);
    }

    .month-control {
        width: 100%;
        justify-content: space-between;
    }

    .month-control form {
        flex: 1;
    }

    .month-control input {
        width: 100%;
        text-align: center;
    }

    .balance-card {
        min-height: 245px;
        flex-direction: column;
        align-items: stretch;
        justify-content: end;
        padding: 28px 24px;
        border-radius: 24px;
    }

    .balance-card__content h2 {
        font-size: clamp(2.75rem, 14vw, 4rem);
    }

    .balance-card__plan {
        min-width: 0;
    }

    .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        margin: 10px 0;
    }

    .metric-card {
        padding: 16px;
        border-radius: 17px;
    }

    .metric-card__icon {
        margin-bottom: 17px;
    }

    .metric-card h3 {
        font-size: clamp(1.05rem, 5vw, 1.35rem);
    }

    .metric-card > span {
        min-height: 34px;
    }

    .dashboard-grid {
        gap: 10px;
        margin-top: 10px;
    }

    .panel {
        padding: 20px;
        border-radius: 18px;
    }

    .panel__heading {
        margin-bottom: 22px;
    }

    .budget-progress__top {
        align-items: end;
    }

    .budget-progress__top strong {
        display: grid;
    }

    .transactions-panel {
        margin-top: 10px;
    }

    .mobile-nav {
        position: fixed;
        z-index: 50;
        right: 12px;
        bottom: calc(10px + env(safe-area-inset-bottom));
        left: 12px;
        display: grid;
        height: 72px;
        grid-template-columns: repeat(5, 1fr);
        align-items: center;
        padding: 7px 9px;
        border: 1px solid #252525;
        border-radius: 22px;
        background: rgba(5, 5, 5, 0.96);
        box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
        backdrop-filter: blur(18px);
    }

    .mobile-nav__item {
        display: grid;
        gap: 1px;
        place-items: center;
        color: #7f7f7f;
        font-size: 1.2rem;
        text-decoration: none;
    }

    .mobile-nav__item small {
        font-size: 0.58rem;
        font-weight: 700;
    }

    .mobile-nav__item--active {
        color: var(--white);
    }

    .mobile-nav__add {
        display: grid;
        width: 46px;
        height: 46px;
        margin: 0 auto;
        place-items: center;
        border: 0;
        border-radius: 15px;
        background: var(--white);
        color: var(--black);
        font-size: 1.8rem;
        line-height: 1;
    }
}

@media (max-width: 390px) {
    .metric-grid {
        grid-template-columns: 1fr;
    }

    .metric-card > span {
        min-height: 0;
    }

    .balance-card__content h2 {
        font-size: 2.7rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

