.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 14px max(18px, calc((100vw - 1180px) / 2));
    border-bottom: 1px solid var(--line);
    background: rgba(5, 8, 21, 0.78);
    backdrop-filter: blur(18px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-right: auto;
    min-width: 0;
}

.brand-mark {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 16px;
    background: var(--gradient);
    box-shadow: 0 0 28px rgba(66, 216, 255, .28);
    color: #02050d;
    font-weight: 900;
}

.brand strong,
.brand small {
    display: block;
}

.brand small {
    color: var(--text-soft);
    font-size: 11px;
    letter-spacing: .16em;
}

.nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.nav a,
.nav-link-button,
.admin-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 10px 13px;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--text-sub);
}

.nav a.active,
.nav a:hover,
.nav-link-button:hover {
    border-color: var(--line-strong);
    color: var(--text-main);
    background: rgba(66, 216, 255, .09);
}

.nav-logout-form {
    margin: 0;
}

.nav-link-button {
    border: 1px solid transparent;
    background: transparent;
    font: inherit;
    cursor: pointer;
}

.admin-pill {
    border-color: var(--line);
    color: var(--text-main);
    background: rgba(255, 255, 255, .04);
}

.topbar-panel {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-toggle {
    display: none;
}

.card,
.hero-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        linear-gradient(160deg, rgba(255,255,255,.08), rgba(255,255,255,.02)),
        var(--surface-1);
    box-shadow: var(--shadow);
}

.card {
    padding: 22px;
}

.hero-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 30px;
    margin-bottom: 22px;
}

.page-title {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.page-title h1,
.hero-card h1 {
    margin: 6px 0 8px;
    font-size: clamp(30px, 5vw, 54px);
    line-height: 1;
}

.page-title p,
.hero-card p,
.section-heading p {
    margin: 0;
    color: var(--text-sub);
}

.eyebrow {
    color: var(--blue);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .18em;
    text-transform: uppercase;
}

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

.section-heading h1,
.section-heading h2 {
    margin: 0;
}

.section-heading span,
.section-heading a {
    color: var(--text-sub);
}

.stat-grid,
.content-grid {
    display: grid;
    gap: 18px;
    margin-bottom: 18px;
}

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

.content-grid {
    grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr);
}

.stat-card span {
    color: var(--text-sub);
}

.metric {
    display: block;
    margin-top: 12px;
    font-family: "Menlo", "Consolas", monospace;
    font-size: clamp(24px, 3vw, 34px);
}

.income {
    color: var(--green);
}

.expense {
    color: var(--red);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border: 0;
    border-radius: 14px;
    padding: 10px 16px;
    cursor: pointer;
    color: var(--text-main);
    transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
}

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

.btn-primary {
    background: var(--gradient);
    color: #030712;
    font-weight: 800;
    box-shadow: 0 12px 30px rgba(66, 216, 255, .18);
}

.btn-secondary {
    border: 1px solid var(--line);
    background: rgba(255,255,255,.05);
}

.btn-danger {
    background: rgba(255, 106, 138, .14);
    border: 1px solid rgba(255, 106, 138, .46);
}

.btn-small {
    min-height: 34px;
    padding: 7px 10px;
    border-radius: 11px;
}

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

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

.filter-grid .wide {
    grid-column: 1 / -1;
}

.inline-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.inline-actions.compact {
    flex-wrap: nowrap;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 16px;
    -webkit-overflow-scrolling: touch;
}

.tag {
    display: inline-flex;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    background: rgba(255,255,255,.06);
}

.tag.income {
    background: rgba(84, 240, 169, .12);
}

.tag.expense {
    background: rgba(255, 106, 138, .14);
}

.alert {
    margin-bottom: 18px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255,255,255,.06);
}

.alert-success {
    border-color: rgba(84, 240, 169, .38);
}

.alert-danger {
    border-color: rgba(255, 106, 138, .5);
}

.narrow-card {
    max-width: 560px;
    margin: 0 auto;
}

.short-input {
    min-width: 90px;
}
