:root {
    --bg: #edf4f1;
    --surface: #ffffff;
    --ink: #21312f;
    --muted: #66736f;
    --line: #ded8cc;
    --primary: #1f6f64;
    --primary-dark: #174f48;
    --accent: #d6933b;
    --danger: #b9453d;
    --ok: #2d7d4f;
    --shadow: 0 18px 60px rgba(37, 48, 45, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button,
input,
select {
    font: inherit;
}

input,
select {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    background: #fffdf9;
    color: var(--ink);
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 650;
}

button {
    border: 0;
    border-radius: 8px;
    min-height: 44px;
    padding: 11px 16px;
    font-weight: 800;
    cursor: pointer;
}

.primary {
    background: var(--primary);
    color: #fff;
}

.secondary {
    background: #e7f0ed;
    color: var(--primary-dark);
}

.auth-page {
    padding: 0;
    background:
        linear-gradient(135deg, rgba(31, 111, 100, 0.14), transparent 34%),
        linear-gradient(315deg, rgba(214, 147, 59, 0.12), transparent 32%),
        var(--bg);
}

.auth-layout {
    width: min(1180px, calc(100% - 32px));
    min-height: 100vh;
    margin: 0 auto;
    padding: 22px 0 34px;
    display: grid;
    grid-template-rows: auto 1fr;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 420px);
    gap: 24px;
    align-items: center;
}

.password-layout {
    width: min(440px, calc(100% - 32px));
    min-height: 100vh;
    margin: 0 auto;
    display: grid;
    place-items: center;
    padding: 28px 0;
}

.auth-top {
    grid-column: 1 / -1;
    min-height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-size: 1.12rem;
    font-weight: 900;
}

.auth-brand img {
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.auth-topline {
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 750;
}

.auth-hero {
    min-height: 620px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-content: center;
    gap: 28px;
    padding: clamp(28px, 5vw, 58px);
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(222, 216, 204, 0.8);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.hero-copy h1 {
    max-width: 720px;
    margin-bottom: 18px;
    font-size: clamp(2.7rem, 6vw, 5.2rem);
    line-height: 0.96;
}

.hero-copy .lead {
    max-width: 690px;
    margin-bottom: 24px;
    font-size: 1.16rem;
}

.trust-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.trust-row span {
    padding: 9px 12px;
    border: 1px solid rgba(31, 111, 100, 0.22);
    border-radius: 999px;
    background: #f8fbf9;
    color: var(--primary-dark);
    font-size: 0.9rem;
    font-weight: 850;
}

.dashboard-preview {
    width: min(100%, 600px);
    padding: 20px;
    background: #fffdf9;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 16px 42px rgba(37, 48, 45, 0.12);
}

.preview-top,
.preview-grid,
.preview-items div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.preview-top span,
.preview-total span,
.preview-grid span {
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 760;
}

.preview-top strong {
    display: block;
    margin-top: 3px;
    color: var(--ink);
    font-size: 1.05rem;
}

.preview-top img {
    width: 46px;
    height: 46px;
    object-fit: contain;
}

.preview-total {
    margin: 24px 0 18px;
    padding: 18px;
    border-radius: 8px;
    background: #edf4f1;
}

.preview-total strong {
    display: block;
    margin-top: 6px;
    color: var(--primary-dark);
    font-size: clamp(1.9rem, 4vw, 2.6rem);
    line-height: 1;
}

.preview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.preview-grid div {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.preview-grid strong {
    display: block;
    margin-top: 6px;
    font-size: 1.2rem;
}

.preview-items {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.preview-items div {
    justify-content: flex-start;
    padding: 12px 0 0;
    border-top: 1px solid var(--line);
}

.preview-items p {
    flex: 1;
    margin: 0;
    color: var(--ink);
    font-weight: 760;
}

.preview-items strong {
    font-size: 0.95rem;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--primary);
}

.dot.expense {
    background: var(--danger);
}

.dot.pending {
    background: var(--accent);
}

.auth-shell {
    width: min(1160px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
    gap: 24px;
    align-items: stretch;
}

.brand-panel,
.auth-card,
.panel,
.stats article,
.quick-home {
    background: var(--surface);
    border: 1px solid rgba(222, 216, 204, 0.8);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.brand-panel {
    min-height: 620px;
    padding: clamp(28px, 6vw, 64px);
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    align-items: center;
    overflow: hidden;
    position: relative;
}

.brand-copy {
    position: relative;
    z-index: 1;
}

.brand-logo {
    width: 112px;
    height: 112px;
    object-fit: contain;
    margin-bottom: 28px;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--primary);
    text-transform: uppercase;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0;
}

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

h1 {
    max-width: 680px;
    margin-bottom: 16px;
    font-size: clamp(2.4rem, 6vw, 5.4rem);
    line-height: 0.95;
    letter-spacing: 0;
}

h2 {
    margin-bottom: 0;
    font-size: 1.1rem;
}

.lead {
    max-width: 620px;
    color: var(--muted);
    font-size: 1.12rem;
    line-height: 1.65;
}

.auth-card {
    padding: 28px;
    align-self: center;
    width: 100%;
    position: sticky;
    top: 24px;
}

.brand-preview {
    position: relative;
    z-index: 1;
    width: min(100%, 520px);
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffdf9;
    box-shadow: 0 16px 38px rgba(37, 48, 45, 0.12);
}

.preview-header,
.preview-list div,
.auth-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.preview-header {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 800;
}

.preview-header strong {
    color: var(--primary-dark);
}

.preview-balance {
    margin: 24px 0 18px;
}

.preview-balance span,
.preview-list span,
.form-note {
    color: var(--muted);
}

.preview-balance strong {
    display: block;
    margin-top: 6px;
    font-size: 2.1rem;
    line-height: 1;
}

.preview-bars {
    height: 92px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    align-items: end;
    padding: 12px;
    border-radius: 8px;
    background: #edf4f1;
}

.preview-bars span {
    height: var(--size);
    min-height: 18px;
    border-radius: 7px 7px 3px 3px;
    background: var(--primary);
}

.preview-bars span:nth-child(even) {
    background: var(--accent);
}

.preview-list {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.preview-list div {
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

.preview-list strong {
    color: var(--ink);
}

.brand-benefits {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.brand-benefits span {
    border: 1px solid rgba(31, 111, 100, 0.22);
    border-radius: 999px;
    padding: 9px 12px;
    background: #edf4f1;
    color: var(--primary-dark);
    font-size: 0.9rem;
    font-weight: 800;
}

.auth-heading {
    justify-content: flex-start;
    margin-bottom: 22px;
}

.auth-heading .eyebrow {
    margin-bottom: 3px;
}

.auth-logo {
    width: 52px;
    height: 52px;
    object-fit: contain;
}

.form-note {
    margin: -4px 0 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.full-button {
    width: 100%;
}

.password-card {
    position: static;
}

.password-intro {
    margin: 0 0 16px;
}

.logout-link {
    display: inline-flex;
    margin-top: 18px;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 760;
}

.tabs,
.segmented {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 5px;
    background: #eee8dc;
    border-radius: 8px;
    margin-bottom: 18px;
}

.tab,
.segmented label {
    min-height: 42px;
    border-radius: 7px;
    display: grid;
    place-items: center;
    color: var(--muted);
}

.tab.active,
.segmented label.is-active {
    background: var(--surface);
    color: var(--primary-dark);
    box-shadow: 0 6px 18px rgba(37, 48, 45, 0.09);
}

.segmented input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.auth-form,
.stack-form {
    display: none;
    gap: 14px;
}

.auth-form.active,
.stack-form {
    display: grid;
}

.flash {
    border-radius: 8px;
    margin-bottom: 14px;
    padding: 12px 14px;
    font-weight: 700;
}

.flash.success {
    background: #e5f3ea;
    color: #236342;
}

.flash.error {
    background: #f9e4e0;
    color: #8d3028;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 12px clamp(18px, 5vw, 54px);
    background: rgba(246, 242, 234, 0.9);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(18px);
}

.app-mark {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 900;
}

.app-mark small {
    display: none;
}

.app-mark img {
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.topbar nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--muted);
    font-weight: 750;
}

.topbar nav a {
    padding: 9px 10px;
    border-radius: 8px;
}

.topbar nav a:hover {
    background: #eee8dc;
}

.app-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
}

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

.sidebar-mark {
    margin-bottom: 26px;
}

.sidebar-mark {
    align-items: flex-start;
}

.sidebar-mark span,
.sidebar-mark small {
    display: block;
}

.sidebar-mark small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 750;
}

.side-nav {
    display: grid;
    gap: 8px;
}

.side-nav a {
    border-radius: 8px;
    padding: 11px 12px;
    color: var(--muted);
    font-weight: 850;
}

.side-nav a:hover,
.side-nav a.active {
    background: #edf4f1;
    color: var(--primary-dark);
}

.app-main {
    min-width: 0;
    padding: 30px clamp(18px, 4vw, 42px) 54px;
}

.page-heading {
    margin-bottom: 22px;
}

.page-heading h1 {
    margin-bottom: 10px;
    font-size: clamp(2rem, 4vw, 3.6rem);
}

.page-heading .lead {
    margin-bottom: 0;
}

.cadastro-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.register-select-label {
    display: grid;
    gap: 7px;
    position: sticky;
    top: 22px;
    z-index: 8;
    width: 100%;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffdf9;
    box-shadow: 0 10px 28px rgba(37, 48, 45, 0.08);
}

.register-select {
    min-height: 50px;
    font-weight: 800;
}

.register-content {
    display: grid;
    gap: 22px;
    width: 100%;
}

.register-content > .panel {
    min-height: calc(100vh - 230px);
}

.is-hidden {
    display: none !important;
}

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

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 22px;
    align-items: end;
    margin-bottom: 22px;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 4rem);
}

.quick-home {
    padding: 18px;
    display: grid;
    gap: 12px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.stats article {
    padding: 18px;
}

.stats span,
.panel-title span,
.list-row span,
.list-row small {
    color: var(--muted);
}

.stats strong {
    display: block;
    margin-top: 8px;
    font-size: clamp(1.25rem, 2.4vw, 1.8rem);
}

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
    margin-bottom: 22px;
}

.panel {
    padding: 20px;
}

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

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

.check {
    display: flex;
    grid-template-columns: none;
    align-items: center;
    gap: 10px;
}

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

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

.list-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffdf9;
}

.list-row div {
    display: grid;
    gap: 2px;
}

.member-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    text-align: right;
}

.member-actions form {
    margin: 0;
}

.category-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-top: 22px;
}

.category-columns h3 {
    margin: 0 0 10px;
    font-size: 1rem;
}

.danger-button {
    min-height: 34px;
    padding: 7px 10px;
    border: 1px solid #efc8c4;
    background: #f9e4e0;
    color: #8d3028;
    font-size: 0.84rem;
}

.compact-button {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 0.84rem;
}

.row-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.row-actions form {
    margin: 0;
}

.modal {
    width: min(680px, calc(100% - 28px));
    max-height: min(760px, calc(100vh - 28px));
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0;
    background: var(--surface);
    box-shadow: 0 24px 80px rgba(37, 48, 45, 0.28);
}

.modal::backdrop {
    background: rgba(23, 31, 29, 0.48);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 20px;
    border-bottom: 1px solid var(--line);
}

.modal-header h2 {
    margin: 0;
}

.modal-form {
    padding: 20px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.icon-button {
    width: 36px;
    min-height: 36px;
    padding: 0;
    background: #edf4f1;
    color: var(--primary-dark);
}

.wide {
    box-shadow: none;
}

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

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.filter-buttons a {
    min-height: 40px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 12px;
    background: #fffdf9;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 850;
}

.filter-buttons a.active,
.filter-buttons a:hover {
    border-color: rgba(31, 111, 100, 0.28);
    background: #edf4f1;
    color: var(--primary-dark);
}

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

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

th {
    color: var(--muted);
    font-size: 0.84rem;
}

.pill {
    display: inline-flex;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 0.78rem;
    font-weight: 850;
}

.pill.paid {
    background: #e5f3ea;
    color: #236342;
}

.pill.open {
    background: #fff2d8;
    color: #8a5a13;
}

.danger-text {
    color: var(--danger);
    font-weight: 850;
}

.ok-text {
    color: var(--ok);
    font-weight: 850;
}

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

.split-note,
.amount-cell small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.amount-cell strong {
    display: block;
}

@media (max-width: 900px) {
    .app-layout,
    .cadastro-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: sticky;
        height: auto;
        top: 0;
        z-index: 10;
        padding: 12px 14px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
        box-shadow: 0 10px 28px rgba(37, 48, 45, 0.08);
    }

    .sidebar-mark {
        margin-bottom: 10px;
    }

    .side-nav {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
    }

    .side-nav a {
        min-height: 42px;
        display: grid;
        place-items: center;
        padding: 9px 8px;
        text-align: center;
        background: #f8fbf9;
        font-size: 0.9rem;
    }

    .app-main {
        padding: 18px 14px 42px;
    }

    .register-select-label {
        top: 118px;
    }

    .auth-layout {
        grid-template-columns: 1fr;
        padding-bottom: 22px;
    }

    .auth-hero {
        min-height: auto;
    }

    .auth-card {
        position: static;
    }

    .auth-shell,
    .hero,
    .grid,
    .stats {
        grid-template-columns: 1fr;
    }

    .brand-panel {
        min-height: auto;
        grid-template-columns: 1fr;
    }
}

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

    .auth-layout {
        width: min(100% - 22px, 1180px);
        gap: 14px;
        padding-top: 12px;
    }

    .side-nav {
        grid-template-columns: 1fr;
    }

    .sidebar {
        padding: 10px 11px;
    }

    .sidebar-mark {
        align-items: center;
    }

    .sidebar-mark img {
        width: 36px;
        height: 36px;
    }

    .side-nav {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .side-nav a {
        min-height: 40px;
        padding: 8px 4px;
        font-size: 0.82rem;
    }

    .register-select-label {
        top: 106px;
    }

    .auth-top {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .auth-topline {
        font-size: 0.84rem;
    }

    .auth-hero {
        padding: 20px;
    }

    .hero-copy h1 {
        font-size: 2.35rem;
        line-height: 1;
    }

    .hero-copy .lead {
        font-size: 1rem;
        line-height: 1.55;
    }

    .trust-row span {
        font-size: 0.82rem;
    }

    .dashboard-preview {
        padding: 16px;
    }

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

    .preview-total strong {
        font-size: 1.75rem;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .container {
        width: min(100% - 22px, 1180px);
        padding-top: 18px;
    }

    .form-pair {
        grid-template-columns: 1fr;
    }

    .brand-panel,
    .auth-card {
        padding: 20px;
    }

    .brand-logo {
        width: 86px;
        height: 86px;
        margin-bottom: 18px;
    }

    .brand-preview {
        padding: 16px;
    }

    .preview-balance strong {
        font-size: 1.65rem;
    }

    .list-row,
    .panel-title {
        align-items: flex-start;
        flex-direction: column;
    }

    .member-actions {
        width: 100%;
        align-items: flex-start;
        flex-direction: column;
        text-align: left;
    }

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

    .filter-buttons {
        display: grid;
        grid-template-columns: 1fr;
    }
}
