:root {
    --bg: #f6f8fb;
    --card: #ffffff;
    --text: #172033;
    --muted: #667085;
    --line: #e6eaf0;
    --primary: #0b73bb;
    --primary2: #13b45b;
    --accent: #f6a400;
    --ok: #039855;
    --warn: #dc6803;
    --bad: #d92d20;
    --shadow: 0 14px 38px rgba(16, 24, 40, .08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: linear-gradient(180deg, #f8fbff 0, #f4f6f9 100%);
    color: var(--text);
    font-family: Inter, Arial, Helvetica, sans-serif;
}

a {
    color: inherit;
}

.wrap {
    max-width: 1240px;
    margin: 0 auto;
    padding: 24px;
}

/* =========================
   HEADER ADMIN
========================= */

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}

.app-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding-top: 14px;
    padding-bottom: 14px;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    min-width: 260px;
}

.app-logo-box {
    width: 72px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.app-logo-box img {
    width: 90px;
    max-width: none;
    height: auto;
    display: block;
}

.app-brand-text {
    font-size: 22px;
    font-weight: 900;
    letter-spacing: -0.04em;
    background: linear-gradient(90deg, var(--primary), var(--primary2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.app-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap;
}

.app-nav a {
    color: #344054;
    text-decoration: none;
    font-size: 14px;
    font-weight: 800;
    padding: 10px 13px;
    border-radius: 999px;
    transition: .15s ease;
}

.app-nav a:hover {
    background: #eef6ff;
    color: var(--primary);
}

.app-nav .logout-link:hover {
    background: #fef3f2;
    color: var(--bad);
}

/* Compatibilidade caso alguma página ainda use .top/.brand/.nav antigos */
.top {
    display: none;
}

/* =========================
   CONTEÚDO
========================= */

.main-content {
    min-height: calc(100vh - 155px);
    padding-top: 22px;
    padding-bottom: 38px;
}

h1 {
    font-size: 30px;
    margin: 8px 0 16px;
    letter-spacing: -0.03em;
}

h2 {
    margin-top: 26px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
    gap: 18px;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.card h3 {
    margin: 0 0 8px;
}

.metric {
    font-size: 38px;
    font-weight: 900;
    letter-spacing: -1px;
}

.muted {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

/* =========================
   BOTÕES
========================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    background: linear-gradient(135deg, var(--primary), #075a9c);
    color: #ffffff;
    text-decoration: none;
    border: 0;
    border-radius: 12px;
    padding: 11px 15px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(11, 115, 187, .16);
}

.btn.secondary {
    background: #eef2f7;
    color: #223046;
    box-shadow: none;
}

.btn.ok {
    background: var(--ok);
}

.btn.warn {
    background: var(--warn);
}

.btn.bad {
    background: var(--bad);
}

.btn.small {
    padding: 7px 10px;
    border-radius: 10px;
    font-size: 12px;
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* =========================
   FORMULÁRIOS
========================= */

.form {
    display: grid;
    gap: 14px;
}

.row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
}

.field label {
    display: block;
    font-size: 12px;
    font-weight: 900;
    margin-bottom: 6px;
    color: #344054;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    border: 1px solid #d0d5dd;
    border-radius: 13px;
    padding: 12px;
    background: #ffffff;
    font-size: 14px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: 3px solid rgba(11, 115, 187, .12);
    border-color: var(--primary);
}

.field textarea {
    min-height: 115px;
    resize: vertical;
}

/* =========================
   TABELAS
========================= */

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #ffffff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--line);
}

.table th,
.table td {
    border-bottom: 1px solid var(--line);
    padding: 12px;
    text-align: left;
    font-size: 13px;
    vertical-align: top;
}

.table th {
    background: #f8fafc;
    color: #475467;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.table tr:last-child td {
    border-bottom: 0;
}

/* =========================
   STATUS
========================= */

.badge {
    display: inline-block;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 900;
}

.PENDENTE {
    background: #fff1d6;
    color: #9a4d00;
}

.APROVADO {
    background: #dcfae6;
    color: #05603a;
}

.CORRECAO {
    background: #fee4e2;
    color: #b42318;
}

.REJEITADO {
    background: #fecdca;
    color: #912018;
}

/* =========================
   ALERTAS
========================= */

.alert {
    padding: 13px 15px;
    border-radius: 14px;
    margin-bottom: 14px;
    border: 1px solid transparent;
}

.alert-success {
    background: #ecfdf3;
    border-color: #abefc6;
}

.alert-danger {
    background: #fef3f2;
    border-color: #fecdca;
}

.alert-warning {
    background: #fffaeb;
    border-color: #fedf89;
}

/* =========================
   LOGIN
========================= */

.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    background:
        radial-gradient(circle at 20% 20%, rgba(19, 180, 91, .12), transparent 28%),
        radial-gradient(circle at 75% 20%, rgba(246, 164, 0, .14), transparent 25%),
        linear-gradient(180deg, #ffffff, #f5f8fb);
}

.login {
    max-width: 450px;
    width: 100%;
    margin: 0;
}

.login-logo {
    text-align: center;
    margin-bottom: 18px;
}

.login-logo img {
    width: 155px;
    max-width: 70%;
    object-fit: contain;
}

/* =========================
   NOVO LAUDO / STEPS
========================= */

.hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.hero .pill {
    background: #eef6ff;
    color: #075a9c;
    border-radius: 999px;
    padding: 8px 12px;
    font-weight: 800;
    font-size: 12px;
}

.stepper {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.step-dot {
    display: flex;
    align-items: center;
    gap: 7px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 9px 12px;
    color: #667085;
    font-size: 13px;
    font-weight: 800;
}

.step-dot.active {
    background: #eaf5ff;
    border-color: #b9dcff;
    color: #075a9c;
}

.step {
    display: none;
}

.step.active {
    display: block;
}

/* =========================
   POSSÍVEIS CAUSAS
========================= */

.cause-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 12px;
}

.cause-card {
    border: 1px solid #ffd1d1;
    background: #ffffff;
    border-radius: 16px;
    padding: 14px;
    text-align: left;
    cursor: pointer;
    transition: .15s;
    min-height: 100px;
}

.cause-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.cause-icon {
    font-size: 25px;
}

.cause-title {
    font-weight: 950;
    color: red;
    text-decoration: underline;
    margin-top: 6px;
    font-size: 17px;
}

/* =========================
   MODAL
========================= */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .54);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 20px;
}

.modal {
    max-width: 760px;
    background: #ffffff;
    border-radius: 22px;
    padding: 22px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .22);
}

.modal h2 {
    margin-top: 0;
    color: red;
    text-decoration: underline;
}

/* =========================
   FOTOS / EVIDÊNCIAS
========================= */

.photo-uploader {
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 14px;
    background: #fbfcfe;
}

.photo-preview {
    width: 100%;
    height: 230px;
    background: #f2f4f7;
    border: 1px dashed #98a2b3;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.photo-preview canvas,
.photo-preview img {
    max-width: 100%;
    max-height: 100%;
}

.tools {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.tool-active {
    outline: 3px solid rgba(11, 115, 187, .22);
}

.thumb {
    height: 76px;
    max-width: 126px;
    object-fit: cover;
    border: 1px solid #dddddd;
    border-radius: 10px;
}

.attention {
    border: 2px solid #111111;
    background: #ffffff;
    text-align: center;
    padding: 13px;
    border-radius: 10px;
    font-weight: 900;
}

.attention strong {
    display: block;
    color: red;
    text-decoration: underline;
    font-size: 20px;
    margin-bottom: 10px;
}

/* =========================
   FOOTER ADMIN
========================= */

.app-footer {
    border-top: 1px solid var(--line);
    background: #ffffff;
    color: #667085;
}

.app-footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding-top: 18px;
    padding-bottom: 18px;
    font-size: 13px;
}

.app-footer strong {
    color: #344054;
}

.app-footer-links {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
}

.app-footer-links a {
    color: var(--primary);
    text-decoration: none;
}

.app-footer-links a:hover {
    text-decoration: underline;
}

/* =========================
   UTILITÁRIOS
========================= */

.print-only {
    display: none;
}

/* =========================
   RESPONSIVO
========================= */

@media (max-width: 860px) {
    .app-header-inner {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .app-brand {
        min-width: auto;
    }

    .app-nav {
        justify-content: flex-start;
    }

    .app-footer-inner {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 720px) {
    .wrap {
        padding: 16px;
    }

    .hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .table {
        display: block;
        overflow-x: auto;
    }

    .step-dot {
        font-size: 12px;
    }
}

@media (max-width: 520px) {
    .app-logo-box {
        width: 48px;
        height: 34px;
    }

    .app-logo-box img {
        width: 76px;
    }

    .app-brand-text {
        font-size: 18px;
    }

    .app-nav a {
        font-size: 13px;
        padding: 8px 10px;
    }
}

/* =========================
   IMPRESSÃO
========================= */

@media print {
    body {
        background: #ffffff;
    }

    .no-print,
    .app-header,
    .app-footer,
    .top {
        display: none !important;
    }

    .wrap {
        padding: 0;
        max-width: none;
    }

    .print-only {
        display: block;
    }

    .card,
    .table {
        box-shadow: none;
    }
}