html {
    width: 100%;
    min-height: 100%;
    background: var(--bg);
    overflow-x: hidden;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100svh;
    width: 100%;
    overflow-x: hidden;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: radial-gradient(circle at 80% 0%, rgba(16, 168, 255, .09), transparent 28%), var(--bg);
    -webkit-text-size-adjust: 100%;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background: var(--bg);
}

a {
    color: var(--blue);
    text-decoration: none;
}

button,
.button-link {
    border: 0;
    border-radius: 7px;
    padding: 13px 18px;
    color: white;
    background: var(--green);
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
    cursor: pointer;
}

button:hover,
.button-link:hover {
    background: var(--green-2);
}

input,
select {
    width: 100%;
    min-height: 54px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 0 16px;
    color: var(--text);
    background: var(--panel-2);
    font: inherit;
    outline: none;
}

input:focus,
select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(16, 168, 255, .13);
}

.auth-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    min-height: 100svh;
    padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.auth-card {
    width: min(760px, 100%);
    padding: clamp(28px, 5vw, 58px);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #1a1a1c;
    box-shadow: var(--shadow);
}

.logo-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(18px, 4vw, 34px);
    min-height: 285px;
    margin-bottom: 42px;
    border-radius: 8px;
    background: #19191b;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.02), 0 16px 36px rgba(0,0,0,.22);
}

.logo-mark {
    width: clamp(88px, 16vw, 160px);
    height: clamp(88px, 16vw, 160px);
    display: grid;
    place-items: center;
    color: #d9f5ff;
    font-size: clamp(82px, 14vw, 148px);
    font-weight: 950;
    line-height: 1;
    text-shadow: 0 3px 0 #055a9b, 0 10px 26px rgba(16, 168, 255, .35);
    background: linear-gradient(135deg, #f8f8f8 0 24%, #128bd0 25% 55%, #08295c 56% 70%, #d9d9dc 71%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.logo-text {
    font-size: clamp(58px, 12vw, 126px);
    font-weight: 900;
    line-height: 1;
    background: linear-gradient(#ffffff, #d9d9d9 44%, #5a5a5d 48%, #f1f1f1 58%, #8a8a8e);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 12px 22px rgba(0,0,0,.32);
}

.auth-form {
    display: grid;
    gap: 26px;
}

.auth-form input {
    min-height: 76px;
    font-size: clamp(18px, 2.5vw, 26px);
    font-weight: 700;
}

.auth-form button {
    min-height: 76px;
    margin-top: 22px;
    font-size: clamp(18px, 2.4vw, 26px);
}

.auth-link {
    display: block;
    width: fit-content;
    margin: 34px auto 0;
    font-size: 20px;
}

.app-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
    min-height: 100svh;
    background: var(--bg);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 26px 18px;
    border-right: 1px solid var(--line);
    background: #121214;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    color: var(--text);
    font-size: 25px;
    font-weight: 900;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 7px;
    background: linear-gradient(135deg, #f6f6f6, #158dcc 48%, #061f4e);
    color: white;
}

.nav {
    display: grid;
    gap: 8px;
    margin-top: 28px;
}

.nav a,
.logout {
    display: block;
    padding: 14px 15px;
    border-radius: 7px;
    color: var(--muted);
    font-weight: 700;
}

.nav a:hover,
.nav a.is-active {
    color: var(--text);
    background: var(--panel-2);
}

.logout {
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 20px;
}

.content {
    width: min(1220px, 100%);
    min-width: 0;
    padding: 34px;
}

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

.eyebrow {
    margin: 0 0 8px;
    color: var(--blue);
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 8px;
    font-size: clamp(32px, 5vw, 52px);
    line-height: 1;
}

h2 {
    margin-bottom: 0;
    font-size: 20px;
}

.muted,
.empty {
    color: var(--muted);
}

.month-filter {
    display: flex;
    gap: 10px;
    align-items: center;
}

.month-filter input {
    min-width: 180px;
}

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

.metric-card,
.panel,
.planning-hero {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 16px 38px rgba(0,0,0,.16);
}

.metric-card {
    display: grid;
    gap: 12px;
    min-height: 138px;
    padding: 22px;
}

.metric-card span,
.focus-panel span,
.planning-hero span {
    color: var(--muted);
    font-weight: 800;
}

.metric-card strong {
    font-size: clamp(25px, 3vw, 34px);
}

.accent-green strong {
    color: var(--green-2);
}

.accent-blue strong {
    color: var(--blue);
}

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

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(280px, .75fr);
    gap: 16px;
    margin-bottom: 16px;
}

.small-side {
    grid-template-columns: minmax(0, 1fr) 310px;
}

.panel {
    padding: 22px;
}

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

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

th,
td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    white-space: nowrap;
}

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.pill {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.pill.entrada,
.timeline-item.entrada b {
    color: var(--green-2);
    background: rgba(53, 210, 103, .11);
}

.pill.saida,
.timeline-item.saida b {
    color: #ff9b9b;
    background: rgba(255, 95, 95, .12);
}

.due-list,
.bars,
.timeline {
    display: grid;
    gap: 12px;
}

.due-item,
.timeline-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #202023;
}

.due-item span,
.timeline-item span {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 13px;
}

.bar-label {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.bar-track {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #2b2b2e;
}

.bar-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--green), var(--blue));
}

.focus-panel {
    display: grid;
    align-content: center;
    gap: 14px;
}

.focus-panel strong {
    font-size: 40px;
    color: var(--blue);
}

.form-panel {
    max-width: 960px;
}

.finance-form {
    display: grid;
    gap: 22px;
}

.segmented {
    display: inline-grid;
    grid-template-columns: 1fr 1fr;
    max-width: 360px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #141416;
}

.segmented input {
    position: absolute;
    opacity: 0;
}

.segmented span {
    display: block;
    padding: 12px 26px;
    border-radius: 7px;
    color: var(--muted);
    font-weight: 900;
    text-align: center;
    cursor: pointer;
}

.segmented input:checked + span {
    color: white;
    background: var(--green);
}

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

label span {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-weight: 800;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.check-row input {
    width: 18px;
    min-height: 18px;
}

.form-actions,
.actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.actions button {
    padding: 9px 12px;
    font-size: 12px;
}

.ghost-danger {
    background: transparent;
    color: var(--red);
    border: 1px solid rgba(255, 95, 95, .35);
}

.ghost-danger:hover {
    background: rgba(255, 95, 95, .12);
}

.planning-hero {
    padding: clamp(24px, 5vw, 44px);
    margin-bottom: 18px;
}

.planning-hero strong {
    display: block;
    margin: 8px 0 12px;
    font-size: clamp(42px, 8vw, 78px);
    line-height: 1;
}

.planning-hero.positive strong {
    color: var(--green-2);
}

.timeline-item time {
    display: grid;
    place-items: center;
    min-width: 64px;
    height: 48px;
    border-radius: 7px;
    background: #151517;
    color: var(--blue);
    font-weight: 900;
}

.flash {
    margin-bottom: 18px;
    padding: 14px 16px;
    border: 1px solid rgba(53, 210, 103, .35);
    border-radius: 7px;
    color: #d9ffe4;
    background: rgba(53, 210, 103, .12);
}

.flash-error {
    border-color: rgba(255, 95, 95, .38);
    color: #ffd6d6;
    background: rgba(255, 95, 95, .12);
}

@media (max-width: 960px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        position: relative;
        height: auto;
        padding: 14px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .nav {
        grid-template-columns: repeat(4, minmax(120px, 1fr));
        overflow-x: auto;
        margin-top: 14px;
    }

    .logout {
        position: static;
        margin-top: 8px;
    }

    .content {
        padding: 20px;
    }

    .page-header,
    .month-filter {
        align-items: stretch;
        flex-direction: column;
    }

    .metric-grid,
    .dashboard-grid,
    .small-side,
    .form-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .auth-page {
        padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    }

    .auth-card {
        padding: 18px;
    }

    .logo-panel {
        min-height: 150px;
        margin-bottom: 26px;
        padding: 16px;
        overflow: hidden;
    }

    .logo-mark {
        width: 72px;
        height: 72px;
        font-size: 68px;
    }

    .logo-text {
        font-size: clamp(48px, 18vw, 74px);
    }

    .auth-form input,
    .auth-form button {
        min-height: 62px;
    }

    .timeline-item,
    .due-item {
        align-items: flex-start;
        flex-direction: column;
    }
}
