:root {
    color-scheme: light;
    --bg: #f6f7f9;
    --panel: #ffffff;
    --line: #d9dee7;
    --text: #17202f;
    --muted: #667085;
    --accent: #0f766e;
    --accent-dark: #115e59;
    --paid: #0f7a3f;
    --pending: #9a5b00;
    --canceled: #b42318;
    --neutral: #475467;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
}

.login-page {
    min-height: 100vh;
}

.login-shell {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 28px;
    width: min(100%, 420px);
}

.login-card h1 {
    margin-bottom: 22px;
}

.brand-logo {
    display: block;
    height: auto;
    max-width: 230px;
    width: 100%;
}

.login-logo {
    margin: 0 auto 22px;
    max-width: 280px;
}

.login-form {
    display: grid;
    gap: 14px;
}

.login-error {
    background: #fee4e2;
    border: 1px solid #fda29b;
    border-radius: 8px;
    color: #912018;
    margin-bottom: 14px;
    padding: 10px 12px;
}

.shell {
    width: min(1440px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 12px;
}

.app-menu {
    align-items: center;
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.app-menu a,
.app-menu span {
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    flex: 0 0 auto;
    font-size: 13px;
    font-weight: 700;
    padding: 8px 11px;
    text-decoration: none;
}

.app-menu .is-active {
    background: #eefaf8;
    border-color: #9edbd2;
    color: var(--accent);
}

.app-menu span {
    opacity: .55;
}

.app-menu .logout-link {
    margin-left: auto;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-size: 30px;
    line-height: 1.2;
}

.refresh,
button {
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    padding: 11px 16px;
    text-decoration: none;
}

.refresh:hover,
button:hover {
    background: var(--accent-dark);
}

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

.metrics article,
.filters,
.table-wrap,
.alert {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.metrics article {
    padding: 18px;
}

.metrics span,
.table-head span,
label {
    color: var(--muted);
    font-size: 13px;
}

.metrics strong {
    display: block;
    margin-top: 8px;
    font-size: 26px;
}

.filters {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(150px, 220px) minmax(210px, 280px) auto;
    align-items: end;
    gap: 12px;
    margin-bottom: 16px;
    padding: 14px;
}

label {
    display: grid;
    gap: 6px;
    font-weight: 700;
}

.button-text {
    display: inline;
}

input,
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    font: inherit;
    min-height: 42px;
    padding: 9px 11px;
}

.table-wrap {
    overflow: hidden;
}

.table-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}

.table-refresh {
    align-items: center;
    background: transparent;
    border: 1px solid var(--line);
    color: var(--accent);
    display: inline-flex;
    justify-content: center;
    min-height: 34px;
    min-width: 34px;
    padding: 0;
}

.table-refresh:hover {
    background: #eefaf8;
}

.refresh-icon {
    display: block;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-left-color: transparent;
    border-radius: 50%;
    position: relative;
}

.refresh-icon::after {
    content: "";
    border-left: 5px solid currentColor;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    position: absolute;
    right: -3px;
    top: -2px;
    transform: rotate(24deg);
}

.scroll {
    overflow-x: auto;
}

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

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

th {
    background: #eef2f6;
    color: #344054;
    font-size: 12px;
    text-transform: uppercase;
}

td {
    font-size: 14px;
}

tbody tr:hover {
    background: #f8fafc;
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    min-height: 24px;
    padding: 3px 9px;
}

.payment {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.payment.pix img {
    display: block;
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.is-paid {
    background: #dcfae6;
    color: var(--paid);
}

.is-pending {
    background: #fef0c7;
    color: var(--pending);
}

.is-canceled {
    background: #fee4e2;
    color: var(--canceled);
}

.is-neutral {
    background: #eef2f6;
    color: var(--neutral);
}

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

.pagination {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

.pagination a {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--text);
    font-weight: 700;
    padding: 10px 14px;
    text-decoration: none;
}

.pagination a.disabled {
    opacity: .45;
    pointer-events: none;
}

.alert {
    display: grid;
    gap: 8px;
    border-color: #fda29b;
    color: #912018;
    padding: 16px;
}

@media (max-width: 860px) {
    .shell {
        width: min(100% - 16px, 1440px);
        padding: 10px 0;
    }

    .topbar {
        align-items: center;
        gap: 10px;
        margin-bottom: 6px;
    }

    .app-menu {
        gap: 5px;
        margin-bottom: 8px;
    }

    .app-menu a,
    .app-menu span {
        border-radius: 7px;
        font-size: 11px;
        padding: 6px 8px;
    }

    .eyebrow {
        font-size: 10px;
        margin-bottom: 1px;
    }

    h1 {
        font-size: 20px;
        line-height: 1.1;
    }

    .brand-logo {
        max-width: 150px;
    }

    .login-logo {
        max-width: 220px;
    }

    .refresh,
    button {
        border-radius: 7px;
        font-size: 13px;
        min-height: 34px;
        padding: 8px 10px;
    }

    .metrics {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
        margin-bottom: 8px;
    }

    .metrics article {
        min-width: 0;
        padding: 8px 6px;
    }

    .metrics span {
        display: block;
        font-size: 9px;
        line-height: 1.15;
        min-height: 22px;
    }

    .metrics strong {
        font-size: clamp(13px, 3.5vw, 17px);
        line-height: 1.1;
        margin-top: 3px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .filters {
        grid-template-columns: minmax(86px, 1fr) minmax(74px, .72fr) minmax(104px, 1fr) 36px;
        gap: 5px;
        margin-bottom: 8px;
        padding: 6px;
    }

    .filter-search,
    .filter-submit {
        grid-column: auto;
    }

    label {
        gap: 0;
        font-size: 11px;
        min-width: 0;
    }

    .filter-label {
        border: 0;
        clip: rect(0 0 0 0);
        height: 1px;
        margin: -1px;
        overflow: hidden;
        padding: 0;
        position: absolute;
        white-space: nowrap;
        width: 1px;
    }

    input,
    select {
        border-radius: 7px;
        font-size: 11px;
        min-height: 34px;
        padding: 7px 8px;
    }

    .flatpickr-input[readonly] {
        font-size: 11px;
        padding-left: 7px;
        padding-right: 7px;
        text-overflow: ellipsis;
    }

    .filter-submit {
        align-items: center;
        display: inline-flex;
        justify-content: center;
        min-height: 34px;
        min-width: 36px;
        padding: 0;
        position: relative;
    }

    .filter-submit .button-text {
        display: none;
    }

    .filter-submit::before {
        content: "";
        width: 12px;
        height: 12px;
        border: 2px solid #fff;
        border-radius: 50%;
        transform: translate(-1px, -1px);
    }

    .filter-submit::after {
        content: "";
        width: 8px;
        height: 2px;
        background: #fff;
        border-radius: 999px;
        position: absolute;
        transform: translate(6px, 6px) rotate(45deg);
    }

    .table-head {
        align-items: center;
        flex-direction: row;
        justify-content: space-between;
        gap: 8px;
        padding: 8px 10px;
    }

    .table-refresh {
        flex: 0 0 auto;
        min-height: 30px;
        min-width: 30px;
    }

    .refresh-icon {
        width: 14px;
        height: 14px;
    }

    .page-count {
        margin-left: auto;
        text-align: right;
    }

    .table-head strong,
    .table-head span {
        font-size: 12px;
    }

    th,
    td {
        padding: 9px 10px;
    }

    th {
        font-size: 10px;
    }

    td {
        font-size: 12px;
    }
}
