:root {
    color-scheme: light;
    --bg: #f3f4f1;
    --card: #ffffff;
    --text: #252522;
    --muted: #6f746d;
    --border: #d8ddd4;
    --border-soft: #edf0eb;
    --primary: #6f8f16;
    --primary-dark: #4f6810;
    --success: #25734b;
    --danger: #a53a3a;
    --info: #3b6d97;
    --warning: #a66b16;
    --shadow: 0 18px 50px rgba(44, 48, 38, .07);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        linear-gradient(180deg, rgba(255,255,255,.78), rgba(243,244,241,.98) 240px),
        var(--bg);
    color: var(--text);
}

a { color: inherit; }

.topbar {
    height: 88px;
    padding: 0 clamp(22px, 7vw, 118px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background:
        radial-gradient(circle at 18% 10%, rgba(213, 234, 125, .16), transparent 28%),
        linear-gradient(135deg, #07130d 0%, #101c16 58%, #1f2b14 100%);
    border-bottom: 1px solid rgba(213, 234, 125, .16);
    backdrop-filter: blur(12px);
}

.brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.brand img {
    display: block;
    width: 210px;
    max-height: 56px;
    object-fit: contain;
}

.topbar-user-area {
    display: flex;
    align-items: center;
    gap: 20px;
}

.notification-button {
    position: relative;
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #f8fbf4;
    cursor: default;
}

.icon-bell { font-size: 1.35rem; filter: grayscale(1) brightness(1.7); opacity: .88; }

.notification-count {
    position: absolute;
    top: -2px;
    right: -1px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #a33d3d;
    color: white;
    font-size: .72rem;
    font-weight: 900;
    box-shadow: 0 4px 12px rgba(163, 61, 61, .28);
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #f8fbf4;
    text-decoration: none;
}

.user-avatar {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 999px;
    background: rgba(255, 255, 255, .10);
    filter: grayscale(1) brightness(1.7);
}

.user-chip strong {
    display: block;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .95rem;
    line-height: 1.1;
}

.user-chip small {
    display: block;
    margin-top: 3px;
    color: rgba(248, 251, 244, .68);
    font-size: .76rem;
}

.page {
    max-width: 1240px;
    margin: 0 auto;
    padding: 28px 22px 46px;
}

.auth-card,
.panel,
.boleto-table-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.auth-card {
    max-width: 420px;
    margin: 48px auto;
    padding: 28px;
}

h1 { margin: 0 0 8px; font-size: 1.9rem; letter-spacing: -.035em; }
h2 { margin: 28px 0 14px; font-size: 1.1rem; }
p { margin: 0 0 22px; color: var(--muted); }
label { display: block; margin: 14px 0 6px; font-weight: 750; font-size: .9rem; }

input {
    width: 100%;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 12px;
    font: inherit;
    color: var(--text);
    background: white;
}

input:focus {
    outline: 0;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(111, 143, 22, .12);
}

button,
.btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 16px;
    border: 0;
    border-radius: 8px;
    background: var(--primary);
    color: white;
    font-weight: 850;
    text-decoration: none;
    cursor: pointer;
}

form button { width: 100%; margin-top: 20px; }
.muted-link { display: inline-block; margin-top: 18px; color: var(--muted); font-size: .9rem; }
.alert { padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid var(--border); background: white; }
.alert-danger { color: var(--danger); border-color: #efc4c4; background: #fff5f5; }
.alert-warning { color: #8d5a10; border-color: #f2daaa; background: #fffaf0; }

.panel { padding: 24px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin: 20px 0; }
.stats article { border: 1px solid var(--border); border-radius: 8px; padding: 18px; background: #fff; }
.stats strong { display: block; font-size: 1.9rem; }
.stats span { color: var(--muted); font-size: .9rem; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; background: white; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
th { color: #444a42; font-size: .86rem; font-weight: 850; }
tr:last-child td { border-bottom: 0; }
.text-end { text-align: right; }
.badge { display: inline-flex; padding: 4px 8px; border-radius: 999px; background: #eef2ff; color: #3730a3; font-size: .78rem; font-weight: 850; }
.empty { text-align: center; color: var(--muted); padding: 34px 20px; }

.boletos-page { display: grid; gap: 22px; }

.boletos-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 22px;
    padding: 6px 2px 2px;
}

.boletos-title-row p { margin-bottom: 0; max-width: 680px; }

.eyebrow {
    display: inline-flex;
    margin-bottom: 8px;
    color: var(--primary-dark);
    font-size: .74rem;
    font-weight: 950;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.sync-pill {
    flex: 0 0 auto;
    padding: 9px 13px;
    border: 1px solid #dfe7cf;
    border-radius: 999px;
    background: #fbfdf5;
    color: var(--primary-dark);
    font-size: .78rem;
    font-weight: 850;
}

.boleto-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    border: 1px solid var(--border-soft);
    border-radius: 4px;
    background: rgba(255, 255, 255, .66);
    overflow: hidden;
}

.boleto-metrics article {
    min-height: 96px;
    padding: 22px 28px;
    background: rgba(255, 255, 255, .78);
    border-right: 1px solid var(--border-soft);
}

.boleto-metrics article:last-child { border-right: 0; }

.boleto-metrics span {
    display: block;
    margin-bottom: 8px;
    color: #3d423a;
    font-weight: 780;
}

.boleto-metrics strong {
    display: block;
    color: #1f211f;
    font-size: 1.7rem;
    line-height: 1.05;
    letter-spacing: -.04em;
}

.boleto-toolbar {
    display: grid;
    grid-template-columns: minmax(280px, 430px) minmax(320px, 1fr);
    align-items: center;
    gap: 28px;
}

.boleto-search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    height: 44px;
}

.boleto-search input {
    height: 44px;
    border-radius: 6px 0 0 6px;
    border-right: 0;
    font-size: .98rem;
}

.boleto-search button {
    width: 44px;
    min-height: 44px;
    margin: 0;
    padding: 0;
    border-radius: 0 6px 6px 0;
    background: var(--primary);
    color: white;
    font-size: 1rem;
}

.boleto-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    min-height: 44px;
    border: 1px solid #cfd6cb;
    border-radius: 5px;
    overflow: hidden;
    background: white;
}

.boleto-tabs a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border-right: 1px solid #dfe4dc;
    color: #394035;
    text-decoration: none;
    font-weight: 760;
}

.boleto-tabs a:last-child { border-right: 0; }

.boleto-tabs a.active {
    background: #f4f8ec;
    color: var(--primary-dark);
    box-shadow: inset 0 -2px 0 var(--primary);
}

.boleto-table-card {
    border-radius: 3px;
    box-shadow: none;
    overflow: hidden;
}

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

.boleto-table {
    min-width: 920px;
    font-size: .98rem;
}

.boleto-table th {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    color: #292d27;
    background: rgba(255, 255, 255, .86);
    font-size: 1rem;
    font-weight: 850;
    text-transform: none;
    letter-spacing: 0;
}

.boleto-table td {
    padding: 17px 22px;
    border-bottom: 1px solid #d9ded5;
    color: #282d27;
    vertical-align: middle;
}

.boleto-table td small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: .77rem;
}

.expand-cell {
    width: 46px;
    color: #454a42;
    font-size: 1.25rem;
    text-align: center;
}

.money-cell {
    font-weight: 780;
    text-align: right;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: .86rem;
    font-weight: 780;
}

.status-paid { color: #1d6b42; background: #dff3e7; }
.status-pending { color: #2f638d; background: #e6f0fa; }
.status-overdue { color: #9a3333; background: #f7e4e4; }
.status-neutral { color: #596258; background: #edf0eb; }

.status-row-overdue { background: #fffafa; }
.status-row-paid { background: #fbfffc; }

.table-actions {
    display: flex;
    align-items: center;
    gap: 22px;
    flex-wrap: wrap;
}

.action-link,
.copy-line {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #376f43;
    font: inherit;
    font-weight: 820;
    text-decoration: none;
    white-space: nowrap;
}

.action-link::before {
    content: "⇩";
    margin-right: 8px;
    font-weight: 900;
}

.copy-line {
    color: #595e56;
}

.copy-line::before {
    content: "□";
    margin-right: 8px;
    color: #555b52;
    font-weight: 900;
}

@media (max-width: 900px) {
    .topbar {
        height: auto;
        min-height: 82px;
        padding: 14px 18px;
        gap: 16px;
    }

    .brand img { width: 172px; }
    .user-chip strong { max-width: 160px; }
    .boleto-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .boleto-metrics article:nth-child(2) { border-right: 0; }
    .boleto-metrics article:nth-child(-n+2) { border-bottom: 1px solid var(--border-soft); }
    .boleto-toolbar { grid-template-columns: 1fr; gap: 12px; }
}

@media (max-width: 620px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar-user-area {
        width: 100%;
        justify-content: space-between;
    }

    .page { padding: 20px 12px 34px; }
    .boletos-title-row { align-items: flex-start; flex-direction: column; }
    .boleto-metrics { grid-template-columns: 1fr; }
    .boleto-metrics article,
    .boleto-metrics article:nth-child(2) {
        border-right: 0;
        border-bottom: 1px solid var(--border-soft);
    }
    .boleto-metrics article:last-child { border-bottom: 0; }
    .boleto-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .boleto-tabs a:nth-child(2) { border-right: 0; }
    .boleto-tabs a:nth-child(-n+2) { border-bottom: 1px solid #dfe4dc; }
}
