:root {
    color-scheme: dark;
    --panel: #141414;
    --panel-soft: #1c1c1c;
    --line: #2d2a25;
    --text-muted: #a1a1aa;
    --accent: #d7fb72;
    --income: #34d399;
    --expense: #fb7185;
    --balance: #60a5fa;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background:
        radial-gradient(circle at 12% 0%, rgba(215, 251, 114, 0.10), transparent 26rem),
        linear-gradient(180deg, #101010 0%, #18140f 48%, #101010 100%);
    color: #f4f4f5;
}

button,
input {
    font: inherit;
}

.balance-number,
.tabular {
    font-variant-numeric: tabular-nums;
}


.fa-solid,
.fa-brands {
    display: inline-block;
    width: 1em;
    min-width: 1em;
    font-style: normal;
    line-height: 1;
    text-align: center;
}

.fa-x-twitter::before { content: "𝕏"; }
.fa-scroll::before { content: "📜"; }
.fa-palette::before { content: "🎨"; }
.fa-code::before { content: "⌘"; }
.fa-layer-group::before { content: "▣"; }
.fa-chart-column::before { content: "▥"; }
.fa-list-check::before { content: "☑"; }
.fa-search::before { content: "⌕"; }
.fa-sort::before { content: "↕"; }
.fa-chevron-left::before { content: "‹"; }
.fa-chevron-right::before { content: "›"; }
.fa-circle-question::before { content: "?"; }

.app-shell {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 24px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(16, 16, 16, 0.88);
    backdrop-filter: blur(16px);
}

.panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(20, 20, 20, 0.92);
}

.hero {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid rgba(215, 251, 114, 0.25);
    background:
        linear-gradient(115deg, rgba(16, 16, 16, 0.98) 0%, rgba(20, 20, 20, 0.90) 54%, rgba(215, 251, 114, 0.08) 100%),
        url('assets/profile.jpg') right 12% center / min(38vw, 420px) no-repeat;
}

.hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(16, 16, 16, 0) 0%, rgba(16, 16, 16, 0.68) 100%);
    pointer-events: none;
}

.hero-inner {
    position: relative;
    z-index: 1;
    min-height: 410px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    align-items: end;
    gap: 32px;
    padding: clamp(28px, 5vw, 56px);
}

.hero-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    border: 1px solid rgba(215, 251, 114, 0.28);
    border-radius: 999px;
    padding: 6px 10px;
    background: rgba(215, 251, 114, 0.08);
    color: #ecfccb;
    font-size: 12px;
    font-weight: 700;
}

.hero-title {
    margin: 18px 0 12px;
    max-width: 680px;
    font-size: clamp(32px, 5.2vw, 58px);
    line-height: 1.06;
    font-weight: 800;
    letter-spacing: 0;
}

.hero-title-line {
    display: block;
    white-space: nowrap;
}

.hero-copy {
    max-width: 620px;
    color: #d4d4d8;
    font-size: clamp(15px, 2vw, 18px);
    line-height: 1.8;
}

.balance-lockup {
    width: min(100%, 440px);
    margin-top: 32px;
    padding-top: 22px;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.balance-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: #d4d4d8;
    font-size: 13px;
    font-weight: 700;
}

.balance-value {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    flex-wrap: nowrap;
    max-width: 100%;
    margin-top: 8px;
    color: var(--accent);
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: clamp(38px, 8.6vw, 72px);
    font-weight: 800;
    line-height: 0.98;
    letter-spacing: 0;
    white-space: nowrap;
}

#remaining-balance {
    display: inline-block;
    flex: 0 0 auto;
    min-width: 0;
    text-align: right;
    transform-origin: 50% 52%;
    will-change: transform, opacity;
}

#remaining-balance.is-ticking {
    animation: counterTick 92ms steps(2, end);
}

@keyframes counterTick {
    0% {
        opacity: 0.72;
        transform: translateY(-0.13em) rotateX(36deg);
    }

    50% {
        opacity: 0.9;
        transform: translateY(0.05em) rotateX(-12deg);
    }

    100% {
        opacity: 1;
        transform: translateY(0) rotateX(0deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    html.fonts-ready body,
    html.fonts-timeout body {
        transition: none;
    }

    #remaining-balance.is-ticking {
        animation: none;
    }
}

.balance-unit {
    flex: 0 0 auto;
    margin-left: 6px;
    color: #ecfccb;
    font-size: clamp(18px, 2.4vw, 28px);
    font-weight: 700;
}

.progress-track {
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.12);
}

.progress-bar {
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, #d7fb72, #34d399);
    transition: width 700ms ease;
}

.avatar-plate {
    align-self: center;
    justify-self: end;
    width: 220px;
    aspect-ratio: 1;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    overflow: hidden;
    background: #222;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

.avatar-plate img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.section {
    margin-top: 28px;
}

.section-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 14px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 20px;
    line-height: 1.3;
    font-weight: 800;
    letter-spacing: 0;
}

.section-caption {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 13px;
}

.policy-grid {
    display: grid;
    grid-template-columns: 1.4fr 0.8fr;
    gap: 20px;
    padding: 28px;
}

.policy-copy {
    margin: 0;
    color: #e4e4e7;
    line-height: 1.9;
}

.policy-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.policy-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.035);
    color: #f4f4f5;
    font-size: 14px;
    font-weight: 700;
}

.summary-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-top: 1px solid var(--line);
}

.summary-item {
    padding: 18px 20px;
    border-right: 1px solid var(--line);
}

.summary-item:last-child {
    border-right: 0;
}

.summary-label {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
}

.summary-value {
    margin-top: 5px;
    font-size: 24px;
    font-weight: 800;
    line-height: 1.1;
}

.chart-panel {
    padding: 24px;
}

.chart-wrap {
    position: relative;
    height: 360px;
    margin-top: 8px;
}

.legend-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    color: #d4d4d8;
    font-size: 12px;
}

.legend-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.035);
}

.legend-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.search-field {
    position: relative;
    width: min(100%, 320px);
}

.search-field input {
    width: 100%;
    min-height: 42px;
    border: 1px solid #34312b;
    border-radius: 8px;
    background: #101010;
    color: #f4f4f5;
    padding: 10px 12px 10px 38px;
    outline: none;
}

.search-field input:focus {
    border-color: rgba(215, 251, 114, 0.65);
    box-shadow: 0 0 0 3px rgba(215, 251, 114, 0.12);
}

.search-field i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #71717a;
}

.table-panel {
    padding: 24px;
}

.transaction-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.transaction-table th {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    text-align: left;
    white-space: nowrap;
}

.transaction-table td {
    padding: 15px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    vertical-align: top;
}

.transaction-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.035);
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
    color: var(--text-muted);
    font-size: 13px;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 38px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    color: #f4f4f5;
    cursor: pointer;
}

.pagination-button:hover:not(:disabled) {
    border-color: rgba(215, 251, 114, 0.42);
    color: #ecfccb;
}

.pagination-button:disabled {
    cursor: not-allowed;
    opacity: 0.42;
}

.faq-panel {
    padding: 24px;
}

.faq-list {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.faq-item {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.035);
}

.faq-item summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 52px;
    padding: 14px 16px;
    cursor: pointer;
    color: #f4f4f5;
    font-weight: 800;
    list-style: none;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: "+";
    flex: 0 0 auto;
    color: var(--accent);
    font-size: 20px;
    line-height: 1;
    font-weight: 800;
}

.faq-item[open] summary::after {
    content: "-";
}

.faq-answer {
    margin: 0;
    padding: 0 16px 16px;
    color: #d4d4d8;
    line-height: 1.8;
}

.is-sortable {
    cursor: pointer;
}

.amount-positive {
    color: var(--income);
    font-weight: 800;
}

.amount-negative {
    color: var(--expense);
    font-weight: 800;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 6px 10px;
    background: rgba(52, 211, 153, 0.11);
    color: #a7f3d0;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.top-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    color: #f4f4f5;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
}

.top-link:hover {
    border-color: rgba(215, 251, 114, 0.42);
    color: #ecfccb;
}

@media (max-width: 860px) {
    .app-shell {
        padding: 0 16px;
    }

    .hero {
        background:
            linear-gradient(180deg, rgba(16, 16, 16, 0.78) 0%, rgba(16, 16, 16, 0.98) 72%),
            url('assets/profile.jpg') center top / cover no-repeat;
    }

    .hero::after {
        display: none;
    }

    .hero-inner {
        min-height: 560px;
        grid-template-columns: 1fr;
        align-items: end;
        padding: 22px;
    }

    .hero-title {
        font-size: clamp(24px, 6.8vw, 40px);
        line-height: 1.14;
    }

    .avatar-plate {
        display: none;
    }

    .policy-grid {
        grid-template-columns: 1fr;
        padding: 20px;
    }

    .summary-strip {
        grid-template-columns: 1fr;
    }

    .summary-item {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .summary-item:last-child {
        border-bottom: 0;
    }

    .toolbar,
    .section-header {
        align-items: stretch;
        flex-direction: column;
    }

    .search-field {
        width: 100%;
    }

    .chart-wrap {
        height: 320px;
    }

    .transaction-table {
        min-width: 720px;
    }

    .pagination {
        align-items: stretch;
        flex-direction: column;
    }
}

@media (max-width: 380px) {
    .hero-title {
        font-size: 22px;
    }
}
