:root {
    --green-dark: #004A34;
    --green: #17A64D;
    --green-soft: #E9F8EF;
    --yellow: #FBCD63;
    --cream: #FDFBF7;
    --text: #172033;
    --muted: #64748B;
    --line: #DDE5EE;
    --danger: #B42318;
    --danger-bg: #FEF3F2;
    --success: #067647;
    --success-bg: #ECFDF3;
    --shadow: 0 24px 70px rgba(0, 74, 52, .18);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #F4F7F6;
    color: var(--text);
}

.page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-page {
    background:
        radial-gradient(circle at top left, rgba(23,166,77,.25), transparent 35%),
        linear-gradient(135deg, #004A34 0%, #023826 45%, #F4F7F6 45%, #F4F7F6 100%);
}

.login-card {
    width: min(100%, 520px);
    background: rgba(255,255,255,.96);
    border: 1px solid rgba(255,255,255,.75);
    box-shadow: var(--shadow);
    border-radius: 28px;
    padding: 38px;
    backdrop-filter: blur(12px);
}

.login-card.small {
    max-width: 460px;
}

.brand-mark {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--green), var(--green-dark));
    color: white;
    display: grid;
    place-items: center;
    font-weight: 900;
    font-size: 24px;
    margin-bottom: 18px;
}

.brand-mark.error {
    background: linear-gradient(135deg, #D92D20, #7A271A);
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: .16em;
    font-size: 12px;
    font-weight: 800;
    color: var(--green);
    margin: 0 0 8px;
}

.eyebrow.light {
    color: var(--yellow);
}

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

h1 {
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.05;
    margin-bottom: 14px;
}

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

.subtitle {
    color: var(--muted);
    line-height: 1.55;
    margin-bottom: 26px;
}

.form-stack {
    display: grid;
    gap: 12px;
}

label {
    font-weight: 800;
    font-size: 14px;
}

input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 15px 16px;
    font-size: 17px;
    outline: none;
    background: #fff;
}

input:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 4px rgba(23,166,77,.12);
}

.btn {
    appearance: none;
    border: 0;
    border-radius: 14px;
    padding: 13px 18px;
    font-weight: 850;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--green);
    color: white;
    box-shadow: 0 10px 25px rgba(23,166,77,.24);
}

.btn-ghost {
    background: rgba(255,255,255,.12);
    color: white;
    border: 1px solid rgba(255,255,255,.24);
}

.btn-outline {
    background: white;
    color: var(--green-dark);
    border: 1px solid var(--line);
}

.btn-mini {
    padding: 8px 10px;
    font-size: 13px;
    border-radius: 10px;
    background: #EEF4F2;
    color: var(--green-dark);
}

.link-muted {
    color: var(--muted);
    text-align: center;
    text-decoration: none;
    font-weight: 700;
}

.security-note,
.info-box {
    background: var(--green-soft);
    color: var(--green-dark);
    padding: 14px;
    border-radius: 16px;
    margin-top: 20px;
    line-height: 1.45;
}

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

.alert-error {
    color: var(--danger);
    background: var(--danger-bg);
}

.alert-warning {
    color: #7A4F01;
    background: #FFFAEB;
}

.alert-success {
    color: var(--success);
    background: var(--success-bg);
}

/* ÁREA INTERNA */

.app-shell {
    min-height: 100vh;
    background: #F4F7F6;
}

.topbar {
    background: linear-gradient(135deg, var(--green-dark), #01301F);
    color: white;
    padding: 28px clamp(18px, 5vw, 56px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.topbar-left {
    min-width: 0;
}

.topbar h1 {
    margin: 0;
}

.topbar-subtitle {
    margin: 0;
    color: rgba(255,255,255,.92);
    font-size: 16px;
}

.topbar-right {
    width: 96px;
    min-width: 96px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.topbar-logo {
    height: 34px;
    width: auto;
    max-width: 72px;
    object-fit: contain;
    display: block;
    opacity: .88;
}

.btn-sair {
    min-width: 74px;
    padding: 11px 15px;
    justify-content: center;
}

.content {
    padding: clamp(18px, 5vw, 56px);
    padding-bottom: 110px;
}

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

.summary-card,
.table-card,
.empty-state {
    background: white;
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .06);
}

.summary-card {
    padding: 22px;
    display: grid;
    gap: 6px;
}

.summary-card span {
    color: var(--muted);
    font-weight: 800;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.summary-card strong {
    font-size: 24px;
    color: var(--green-dark);
}

.summary-card small {
    color: var(--muted);
}

.table-card {
    overflow: hidden;
}

.table-header {
    padding: 24px 24px 10px;
}

.table-header p {
    color: var(--muted);
    margin-bottom: 16px;
}

.secure-label {
    color: var(--green-dark);
    font-weight: 700;
    margin-bottom: 12px;
}

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

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

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

th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    background: #F8FAFC;
}

code {
    font-family: "Cascadia Mono", Consolas, monospace;
    font-size: 12px;
    background: #F1F5F9;
    padding: 6px 8px;
    border-radius: 8px;
    display: inline-block;
    max-width: 320px;
    white-space: normal;
}

.badge {
    background: var(--green-soft);
    color: var(--green-dark);
    padding: 6px 8px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 12px;
}

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

.actions form {
    margin: 0;
}

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

/* RODAPÉ COM LOGO PEQUENO */

.footer-brand {
    position: fixed;
    right: 22px;
    bottom: 18px;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,.94);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 7px 10px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, .10);
}

.footer-brand img {
    height: 24px;
    width: auto;
    max-width: 52px;
    object-fit: contain;
    display: block;
}

.footer-brand span {
    color: var(--green-dark);
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

/* TOAST */

.toast {
    position: fixed;
    bottom: 22px;
    right: 22px;
    background: var(--green-dark);
    color: white;
    padding: 14px 18px;
    border-radius: 14px;
    box-shadow: var(--shadow);
    transform: translateY(18px);
    opacity: 0;
    pointer-events: none;
    transition: .2s ease;
    z-index: 40;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.error-detail {
    background: #111827;
    color: #F8FAFC;
    padding: 14px;
    border-radius: 12px;
    overflow: auto;
}

/* LOGO CAISP NA TELA DE LOGIN E VALIDAÇÃO */

.brand-mark-logo {
    width: 60px;
    height: 60px;
    border-radius: 22px;
    background: #ffffff;
    border: 1px solid rgba(0, 74, 52, 0.10);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
    box-shadow: 0 10px 28px rgba(0, 74, 52, 0.10);
    overflow: hidden;
}

.brand-mark-logo img {
    max-width: 50px;
    max-height: 50px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

/* RESPONSIVO */

@media (max-width: 820px) {
    .summary-grid {
        grid-template-columns: 1fr;
    }

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

    .topbar-right {
        width: auto;
        min-width: 0;
        align-items: flex-start;
    }

    .topbar-logo {
        height: 30px;
        max-width: 66px;
    }

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

    table {
        min-width: 0;
    }

    thead {
        display: none;
    }

    table,
    tbody,
    tr,
    td {
        display: block;
        width: 100%;
    }

    tr {
        border-bottom: 1px solid var(--line);
        padding: 12px;
    }

    td {
        border: 0;
        padding: 8px 4px;
    }

    td::before {
        content: attr(data-label);
        display: block;
        font-size: 11px;
        text-transform: uppercase;
        color: var(--muted);
        font-weight: 900;
        margin-bottom: 4px;
    }

    code {
        max-width: 100%;
    }

    .footer-brand {
        left: 12px;
        right: 12px;
        bottom: 12px;
        justify-content: center;
    }

    .footer-brand img {
        height: 22px;
        max-width: 48px;
    }

    .footer-brand span {
        font-size: 10px;
    }
}