:root {
    --bg: #eef4f8;
    --surface: rgba(255, 255, 255, 0.86);
    --surface-strong: #ffffff;
    --surface-dark: #0f172a;
    --surface-dark-2: #18243d;
    --text: #162033;
    --muted: #617086;
    --line: rgba(110, 130, 160, 0.18);
    --accent: #1e7bff;
    --accent-2: #14b8a6;
    --danger: #dc2626;
    --success: #0f9f62;
    --shadow: 0 24px 60px rgba(22, 32, 51, 0.12);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: "Manrope", sans-serif;
    color: var(--text);
    overflow-x: hidden;
    background:
        radial-gradient(circle at top left, rgba(30, 123, 255, 0.16), transparent 28%),
        radial-gradient(circle at top right, rgba(20, 184, 166, 0.16), transparent 20%),
        linear-gradient(180deg, #f7fafc 0%, var(--bg) 100%);
}

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

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(280px, 310px) minmax(0, 1fr);
    align-items: stretch;
}

.sidebar {
    position: relative;
    min-height: 100%;
    width: 100%;
    max-width: none;
    background:
        radial-gradient(circle at top right, rgba(30, 123, 255, 0.35), transparent 20%),
        linear-gradient(180deg, var(--surface-dark) 0%, var(--surface-dark-2) 100%);
    color: #f8fafc;
    padding: 26px 22px 34px;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 24px;
    z-index: 20;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand strong,
.topbar h1,
.card h3,
.hero-title {
    font-family: "Sora", sans-serif;
}

.brand-mark {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: #031224;
    background: linear-gradient(135deg, #74f3d4 0%, #f9f871 100%);
    box-shadow: 0 14px 26px rgba(20, 184, 166, 0.24);
}

.brand p,
.muted,
.topbar p,
.soft-label {
    color: var(--muted);
}

.sidebar .brand p,
.sidebar-footer p {
    color: rgba(226, 232, 240, 0.72);
}

.nav {
    display: grid;
    gap: 10px;
}

.nav a {
    display: flex;
    align-items: center;
    min-height: 52px;
    padding: 12px 16px;
    border-radius: 16px;
    color: rgba(241, 245, 249, 0.84);
    border: 1px solid transparent;
    transition: 0.2s ease;
}

.nav a.active,
.nav a:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    transform: translateX(2px);
}

.sidebar-footer {
    margin-top: auto;
    padding: 18px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 0;
}

.main {
    padding: 32px;
    min-width: 0;
    width: 100%;
}

.sidebar-backdrop {
    display: none;
}

.topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 20px;
    margin-bottom: 24px;
}

.eyebrow {
    display: inline-flex;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(30, 123, 255, 0.08);
    color: var(--accent);
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 10px;
}

.topbar h1 {
    margin: 0;
    font-size: clamp(28px, 4vw, 38px);
    line-height: 1.1;
}

.topbar-copy p {
    max-width: 760px;
}

.userbox {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 14px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: var(--shadow);
    justify-self: end;
    max-width: 100%;
}

.userbox-meta {
    display: grid;
    gap: 4px;
    min-width: 0;
    flex: 1 1 220px;
}

.userbox-meta span {
    color: var(--muted);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.userbox .button {
    flex: 0 0 auto;
}

.grid {
    display: grid;
    gap: 20px;
}

.grid.cards {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.grid.two {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.grid.three {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.card {
    background: var(--surface);
    backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.82);
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: var(--shadow);
}

.card.tight {
    padding: 18px 20px;
}

.hero-card {
    position: relative;
    overflow: hidden;
}

.hero-card::after {
    content: "";
    position: absolute;
    inset: auto -40px -40px auto;
    width: 180px;
    height: 180px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(30, 123, 255, 0.24), transparent 70%);
}

.kpi-label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.kpi-value {
    margin: 10px 0 6px;
    font-size: clamp(28px, 4vw, 38px);
    line-height: 1;
    font-weight: 800;
}

.positive {
    color: var(--success);
}

.negative {
    color: var(--danger);
}

.warn {
    color: #d97706;
}

.metric-row,
.actions,
.stack-row {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}

.stack-row {
    flex-wrap: wrap;
    justify-content: flex-start;
}

.split {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 18px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 14px 10px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th {
    font-size: 13px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

form.grid-form {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

label {
    display: grid;
    gap: 8px;
    color: #324153;
    font-size: 14px;
    font-weight: 700;
}

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

input,
select,
textarea {
    width: 100%;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(109, 123, 143, 0.24);
    background: rgba(255, 255, 255, 0.96);
    color: var(--text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(30, 123, 255, 0.48);
    box-shadow: 0 0 0 4px rgba(30, 123, 255, 0.12);
    outline: none;
}

textarea {
    resize: vertical;
    min-height: 110px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 12px 18px;
    border: none;
    border-radius: 16px;
    font-weight: 800;
    cursor: pointer;
    color: #ffffff;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    box-shadow: 0 16px 26px rgba(15, 23, 42, 0.18);
}

.button.success {
    background: linear-gradient(135deg, #0f9f62 0%, #14b8a6 100%);
}

.button.danger {
    background: linear-gradient(135deg, #b91c1c 0%, #ef4444 100%);
}

.button.ghost {
    background: rgba(226, 232, 240, 0.7);
    color: var(--text);
    box-shadow: none;
}

.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.pill.income,
.pill.collection,
.pill.completed,
.pill.active {
    background: rgba(15, 159, 98, 0.12);
    color: var(--success);
}

.pill.expense,
.pill.payment,
.pill.cancelled,
.pill.danger,
.pill.passive {
    background: rgba(220, 38, 38, 0.12);
    color: var(--danger);
}

.pill.in_progress,
.pill.pending,
.pill.warn {
    background: rgba(217, 119, 6, 0.12);
    color: #b45309;
}

.pill.open,
.pill.success {
    background: rgba(30, 123, 255, 0.12);
    color: var(--accent);
}

.alert {
    margin-bottom: 18px;
    padding: 16px 18px;
    border-radius: 18px;
    font-weight: 700;
}

.alert.success {
    background: rgba(15, 159, 98, 0.12);
    color: #0c6f45;
}

.alert.error {
    background: rgba(220, 38, 38, 0.12);
    color: #9f1f1f;
}

.full {
    grid-column: 1 / -1;
}

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at top left, rgba(30, 123, 255, 0.18), transparent 24%),
        radial-gradient(circle at top right, rgba(20, 184, 166, 0.16), transparent 20%),
        linear-gradient(135deg, #f8fbfd 0%, #e8f0f6 100%);
}

.auth-page-minimal {
    overflow: hidden;
}

.login-stage {
    position: relative;
    width: 100%;
    min-height: calc(100vh - 48px);
    display: grid;
    place-items: center;
    padding: 20px 0;
}

.login-orb {
    position: absolute;
    border-radius: 999px;
    filter: blur(10px);
    pointer-events: none;
}

.orb-one {
    top: 10%;
    left: 12%;
    width: 260px;
    height: 260px;
    background: radial-gradient(circle, rgba(30, 123, 255, 0.16), transparent 70%);
}

.orb-two {
    right: 10%;
    bottom: 8%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(20, 184, 166, 0.15), transparent 72%);
}

.login-card-clean {
    position: relative;
    z-index: 1;
    width: min(100%, 560px);
    max-width: 560px;
    padding: 34px 32px;
    border-radius: 34px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 35px 80px rgba(15, 23, 42, 0.14);
    backdrop-filter: blur(18px);
}

.login-brand-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 30px;
}

.login-brand-mark {
    width: 56px;
    height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    font-family: "Sora", sans-serif;
    font-weight: 800;
    color: #031224;
    background: linear-gradient(135deg, #74f3d4 0%, #f9f871 100%);
    box-shadow: 0 16px 24px rgba(20, 184, 166, 0.18);
}

.login-brand-row strong {
    display: block;
    font-family: "Sora", sans-serif;
    font-size: 18px;
}

.login-brand-row p {
    margin: 4px 0 0;
    color: var(--muted);
}

.login-copy h1 {
    margin: 0;
    font-family: "Sora", sans-serif;
    font-size: clamp(30px, 4vw, 42px);
    line-height: 1.08;
}

.login-copy p {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 16px;
}

.auth-shell {
    width: min(1200px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(380px, 460px);
    gap: 24px;
    align-items: stretch;
}

.auth-showcase {
    position: relative;
    padding: 40px;
    border-radius: 36px;
    overflow: hidden;
    color: #f8fafc;
    background:
        radial-gradient(circle at top right, rgba(116, 243, 212, 0.24), transparent 18%),
        radial-gradient(circle at bottom left, rgba(249, 248, 113, 0.14), transparent 20%),
        linear-gradient(145deg, #0f172a 0%, #16243f 52%, #1e3a5f 100%);
    box-shadow: 0 32px 80px rgba(15, 23, 42, 0.22);
}

.auth-showcase::after {
    content: "";
    position: absolute;
    right: -60px;
    bottom: -60px;
    width: 220px;
    height: 220px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(116, 243, 212, 0.26), transparent 70%);
}

.auth-badge {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 16px;
    border-radius: 999px;
    font-weight: 800;
    color: #031224;
    background: linear-gradient(135deg, #74f3d4 0%, #f9f871 100%);
    margin-bottom: 18px;
}

.auth-title {
    margin: 0;
    font-family: "Sora", sans-serif;
    font-size: clamp(34px, 5vw, 58px);
    line-height: 1.05;
    letter-spacing: -0.03em;
}

.auth-subtitle {
    max-width: 640px;
    margin: 18px 0 0;
    font-size: 18px;
    line-height: 1.7;
    color: rgba(226, 232, 240, 0.82);
}

.auth-highlights {
    display: grid;
    gap: 14px;
    margin-top: 34px;
}

.auth-highlight {
    display: grid;
    gap: 6px;
    padding: 18px 20px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
}

.auth-highlight strong {
    font-size: 16px;
}

.auth-highlight span {
    color: rgba(226, 232, 240, 0.78);
    line-height: 1.6;
}

.auth-panel {
    display: flex;
    align-items: center;
}

.auth-card {
    width: min(100%, 520px);
    padding: 32px;
    border-radius: 32px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 30px 70px rgba(22, 32, 51, 0.16);
}

.auth-card.modern {
    width: 100%;
    padding: 34px 30px;
}

.auth-form {
    display: grid;
    gap: 16px;
    margin-top: 20px;
}

.auth-submit {
    margin-top: 8px;
    min-height: 54px;
    font-size: 16px;
}

.login-help,
.stat-strip,
.info-box {
    padding: 16px;
    border-radius: 18px;
    background: rgba(247, 250, 252, 0.92);
    border: 1px solid rgba(15, 23, 42, 0.06);
}

.mobile-menu-toggle {
    display: none;
    position: fixed;
    right: 16px;
    top: 16px;
    z-index: 40;
    width: 52px;
    height: 52px;
    padding: 0;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow);
}

.mobile-menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    margin: 5px auto;
    border-radius: 999px;
}

.data-list {
    display: grid;
    gap: 12px;
}

.data-item {
    padding: 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.58);
    border: 1px solid rgba(122, 139, 161, 0.18);
}

.data-item strong {
    display: block;
    margin-bottom: 4px;
}

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

.welcome-overlay {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(7, 14, 26, 0.54);
    backdrop-filter: blur(8px);
    animation: welcomeFadeIn 0.35s ease;
}

.welcome-overlay.is-hiding {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.welcome-card {
    position: relative;
    width: min(92vw, 560px);
    padding: 34px 28px;
    border-radius: 30px;
    text-align: center;
    color: #eff6ff;
    background:
        radial-gradient(circle at top right, rgba(116, 243, 212, 0.24), transparent 20%),
        linear-gradient(145deg, #111827 0%, #172554 100%);
    box-shadow: 0 34px 90px rgba(15, 23, 42, 0.34);
    border: 1px solid rgba(255, 255, 255, 0.14);
    overflow: hidden;
}

.welcome-card h2 {
    margin: 12px 0 8px;
    font-family: "Sora", sans-serif;
    font-size: clamp(28px, 4vw, 42px);
}

.welcome-card p {
    margin: 0 0 22px;
    color: rgba(226, 232, 240, 0.86);
    font-size: 18px;
}

.welcome-badge {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: #f8fafc;
    font-weight: 800;
}

.welcome-fireworks {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.firework-spark {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: radial-gradient(circle, #f9f871 0%, #74f3d4 50%, rgba(255, 255, 255, 0) 72%);
    box-shadow: 0 0 18px rgba(249, 248, 113, 0.7);
    animation: fireworkBurst ease-out forwards;
}

@keyframes fireworkBurst {
    0% {
        transform: translate(0, 0) scale(0.2);
        opacity: 0;
    }

    18% {
        opacity: 1;
    }

    100% {
        transform: translate(var(--spark-x), var(--spark-y)) scale(1.4);
        opacity: 0;
    }
}

@keyframes welcomeFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@media (min-width: 1121px) {
    .sidebar {
        transform: none !important;
        align-self: stretch;
    }
}

@media (max-width: 1120px) {
    body.menu-open {
        overflow: hidden;
    }

    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        min-height: 100vh;
        height: 100vh;
        width: min(88vw, 340px);
        max-width: min(88vw, 340px);
        transform: translateX(-100%);
        transition: transform 0.24s ease;
        box-shadow: 0 24px 60px rgba(15, 23, 42, 0.26);
        overflow-y: auto;
        padding-bottom: calc(34px + env(safe-area-inset-bottom, 0px));
    }

    body.menu-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(8, 15, 28, 0.42);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.24s ease;
        z-index: 18;
        border: none;
    }

    body.menu-open .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .mobile-menu-toggle {
        display: block;
    }

    .main {
        padding: 88px 14px 24px;
    }

    .topbar {
        grid-template-columns: 1fr;
        margin-bottom: 18px;
    }

    .topbar-copy p {
        max-width: none;
    }

    .userbox {
        width: 100%;
        padding: 12px;
        justify-self: stretch;
        justify-content: space-between;
    }

    .userbox .button {
        width: auto;
        min-width: 120px;
    }

    .login-stage {
        min-height: calc(100vh - 24px);
    }

    .login-card-clean {
        width: min(100%, 620px);
    }
}

@media (max-width: 720px) {
    .metric-row,
    .actions,
    .split {
        flex-direction: column;
        align-items: stretch;
    }

    .userbox {
        width: 100%;
        justify-content: space-between;
        align-items: flex-start;
        flex-direction: column;
    }

    .userbox .button {
        width: 100%;
    }

    .card {
        padding: 18px;
        border-radius: 22px;
    }

    .grid.two,
    .grid.three,
    .grid.cards {
        grid-template-columns: 1fr;
    }

    .brand {
        padding-right: 48px;
    }

    .kpi-value {
        font-size: 26px;
    }

    .nav a {
        min-height: 48px;
        padding: 10px 14px;
    }

    .main {
        padding: 84px 12px 20px;
    }

    .topbar h1 {
        font-size: 28px;
    }

    .eyebrow {
        font-size: 12px;
        padding: 7px 10px;
    }

    table {
        min-width: 620px;
    }
}

@media (max-width: 980px) {
    .login-card-clean {
        width: min(100%, 620px);
    }
}

@media (max-width: 640px) {
    .auth-page {
        padding: 12px;
    }

    .auth-showcase,
    .auth-card.modern {
        border-radius: 26px;
    }

    .auth-showcase {
        padding: 22px 18px;
    }

    .auth-title {
        font-size: 32px;
    }

    .auth-subtitle {
        font-size: 15px;
        line-height: 1.6;
    }

    .auth-card.modern {
        padding: 24px 18px;
    }

    .welcome-card {
        padding: 28px 18px;
        border-radius: 24px;
    }

    .welcome-card p {
        font-size: 16px;
    }

    .login-card-clean {
        padding: 24px 18px;
        border-radius: 26px;
    }

    .login-brand-row {
        margin-bottom: 22px;
    }

    .login-copy h1 {
        font-size: 28px;
    }
}
