:root {
    --admin-primary: #1f4e79;
    --admin-primary-dark: #153854;
    --admin-primary-light: #eaf2f8;

    --admin-white: #ffffff;
    --admin-background: #f4f7fa;
    --admin-text: #1f2937;
    --admin-muted: #64748b;
    --admin-border: #dce4eb;

    --admin-success: #18794e;
    --admin-danger: #b42318;
    --admin-warning: #9a6700;

    --admin-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--admin-background);
    color: var(--admin-text);
}

a {
    color: var(--admin-primary);
}

button,
input,
select,
textarea {
    font: inherit;
}

/* Cabeçalho */

.admin-header {
    position: sticky;
    z-index: 100;
    top: 0;
    background: var(--admin-white);
    border-bottom: 1px solid var(--admin-border);
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}

.admin-header-inner {
    width: min(1400px, 94%);
    min-height: 76px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 25px;
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--admin-text);
    text-decoration: none;
}

.admin-brand strong,
.admin-brand small {
    display: block;
}

.admin-brand strong {
    font-size: 17px;
}

.admin-brand small {
    margin-top: 3px;
    color: var(--admin-muted);
    font-size: 12px;
}

.admin-logo,
.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--admin-primary);
    color: #fff;
    font-weight: 800;
    letter-spacing: 1px;
}

.admin-logo {
    width: 46px;
    height: 46px;
    border-radius: 14px;
}

.admin-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-nav > a {
    padding: 10px 12px;
    color: var(--admin-text);
    border-radius: 9px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
}

.admin-nav > a:hover {
    background: var(--admin-primary-light);
    color: var(--admin-primary-dark);
}

.admin-user {
    display: flex;
    flex-direction: column;
    margin-left: 10px;
    padding-left: 18px;
    border-left: 1px solid var(--admin-border);
    font-size: 13px;
    font-weight: 700;
}

.admin-user small {
    margin-top: 2px;
    color: var(--admin-muted);
    font-size: 10px;
    font-weight: 500;
}

.logout-form {
    margin: 0;
}

.logout-button {
    padding: 9px 13px;
    border: 1px solid var(--admin-border);
    border-radius: 9px;
    background: #fff;
    color: var(--admin-danger);
    cursor: pointer;
    font-weight: 700;
}

.logout-button:hover {
    border-color: #f0b4ae;
    background: #fff4f3;
}

.mobile-menu-button {
    display: none;
    border: 0;
    background: transparent;
    color: var(--admin-primary-dark);
    cursor: pointer;
    font-size: 28px;
}

/* Conteúdo */

.admin-main {
    min-height: calc(100vh - 140px);
    padding: 35px 0 50px;
}

.admin-container {
    width: min(1400px, 94%);
    margin: 0 auto;
}

.admin-page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 26px;
}

.admin-page-heading h1 {
    margin: 5px 0 7px;
    color: var(--admin-primary-dark);
    font-size: clamp(27px, 3vw, 38px);
}

.admin-page-heading p {
    margin: 0;
    color: var(--admin-muted);
}

.back-link {
    display: inline-block;
    margin-bottom: 7px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
}

/* Cartões */

.admin-card {
    margin-bottom: 24px;
    padding: 25px;
    border: 1px solid var(--admin-border);
    border-radius: 18px;
    background: var(--admin-white);
    box-shadow: var(--admin-shadow);
}

.card-header {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.card-header h2 {
    margin: 0 0 5px;
    color: var(--admin-primary-dark);
    font-size: 21px;
}

.card-header p {
    margin: 0;
    color: var(--admin-muted);
    font-size: 14px;
}

/* Estatísticas */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 26px;
}

.stat-card {
    display: flex;
    flex-direction: column;
    min-height: 125px;
    padding: 22px;
    border: 1px solid var(--admin-border);
    border-radius: 17px;
    background: var(--admin-white);
    color: var(--admin-text);
    box-shadow: var(--admin-shadow);
    text-decoration: none;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 35px rgba(15, 23, 42, 0.1);
}

.stat-label {
    margin-bottom: auto;
    color: var(--admin-muted);
    font-size: 14px;
    font-weight: 700;
}

.stat-card strong {
    margin-top: 15px;
    color: var(--admin-primary-dark);
    font-size: 34px;
}

/* Botões */

.admin-button,
.table-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: var(--admin-primary);
    color: #fff;
    cursor: pointer;
    text-decoration: none;
    font-weight: 700;
}

.admin-button {
    min-height: 43px;
    padding: 11px 18px;
    border-radius: 11px;
}

.admin-button:hover,
.table-button:hover {
    background: var(--admin-primary-dark);
}

.button-secondary {
    border: 1px solid var(--admin-border);
    background: #fff;
    color: var(--admin-text);
}

.button-secondary:hover {
    background: #eef3f7;
    color: var(--admin-primary-dark);
}

.button-full {
    width: 100%;
}

.table-button {
    padding: 8px 13px;
    border-radius: 9px;
    font-size: 13px;
}

/* Formulários */

.admin-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.admin-field label {
    color: #334155;
    font-size: 13px;
    font-weight: 700;
}

.admin-field input,
.admin-field select,
.admin-field textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--admin-border);
    border-radius: 10px;
    outline: none;
    background: #fff;
    color: var(--admin-text);
}

.admin-field textarea {
    resize: vertical;
}

.admin-field input:focus,
.admin-field select:focus,
.admin-field textarea:focus {
    border-color: var(--admin-primary);
    box-shadow: 0 0 0 3px rgba(31, 78, 121, 0.12);
}

.filter-form {
    display: grid;
    grid-template-columns: minmax(260px, 2fr) minmax(180px, 1fr) minmax(200px, 1fr) auto;
    align-items: end;
    gap: 15px;
}

.filter-buttons {
    display: flex;
    gap: 8px;
}

/* Tabelas */

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

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--admin-border);
    text-align: left;
    vertical-align: middle;
}

.admin-table th {
    color: var(--admin-muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.admin-table td {
    font-size: 14px;
}

.admin-table tbody tr:hover {
    background: #f8fafc;
}

.admin-table tbody tr:last-child td {
    border-bottom: 0;
}

.table-subtitle {
    display: block;
    margin-top: 4px;
    color: var(--admin-muted);
    font-size: 12px;
}

/* Estados */

.estado {
    display: inline-flex;
    align-items: center;
    max-width: 230px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.2;
}

.estado-grande {
    padding: 9px 14px;
    font-size: 13px;
}

.estado-cinza {
    background: #edf0f3;
    color: #556170;
}

.estado-azul {
    background: #e5f0fc;
    color: #185a97;
}

.estado-amarelo {
    background: #fff6d8;
    color: #805d00;
}

.estado-laranja {
    background: #fff0df;
    color: #9a4d00;
}

.estado-verde {
    background: #e7f6ed;
    color: #18794e;
}

.estado-vermelho {
    background: #fdecea;
    color: #b42318;
}

.estado-roxo {
    background: #f0e9ff;
    color: #6941c6;
}

.estado-verde-escuro {
    background: #d7f0e3;
    color: #11633e;
}

/* Detalhe */

.details-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(310px, 0.85fr);
    gap: 25px;
    align-items: start;
}

.sticky-card {
    position: sticky;
    top: 100px;
}

.detail-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2px;
    overflow: hidden;
    margin-bottom: 26px;
    border: 1px solid var(--admin-border);
    border-radius: 13px;
    background: var(--admin-border);
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 16px;
    background: #fff;
}

.detail-item span,
.sidebar-details span {
    color: var(--admin-muted);
    font-size: 12px;
    font-weight: 700;
}

.detail-item strong,
.sidebar-details strong {
    overflow-wrap: anywhere;
}

.text-section {
    padding: 22px 0;
    border-top: 1px solid var(--admin-border);
}

.text-section h3 {
    margin: 0 0 12px;
    color: var(--admin-primary-dark);
    font-size: 17px;
}

.proposal-text {
    color: #334155;
    line-height: 1.7;
}

.sidebar-details {
    display: flex;
    flex-direction: column;
}

.sidebar-details > div {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 13px 0;
    border-bottom: 1px solid var(--admin-border);
}

.sidebar-details > div:last-child {
    border-bottom: 0;
}

/* Anexos */

.attachment-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.attachment-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 14px;
    border: 1px solid var(--admin-border);
    border-radius: 12px;
}

.attachment-item strong,
.attachment-item small {
    display: block;
}

.attachment-item small {
    margin-top: 4px;
    color: var(--admin-muted);
}

/* Histórico */

.timeline {
    position: relative;
}

.timeline-item {
    position: relative;
    display: grid;
    grid-template-columns: 22px 1fr;
    gap: 12px;
    padding-bottom: 25px;
}

.timeline-item:not(:last-child)::before {
    position: absolute;
    top: 13px;
    bottom: -2px;
    left: 6px;
    width: 2px;
    background: var(--admin-border);
    content: "";
}

.timeline-marker {
    position: relative;
    z-index: 1;
    width: 14px;
    height: 14px;
    margin-top: 5px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: var(--admin-primary);
    box-shadow: 0 0 0 2px var(--admin-primary);
}

.timeline-content {
    padding: 2px 0 0;
}

.timeline-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.timeline-heading time {
    color: var(--admin-muted);
    font-size: 12px;
}

.timeline-content p {
    margin: 12px 0 7px;
    line-height: 1.6;
}

.timeline-content small {
    color: var(--admin-muted);
}

/* Paginação */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin-top: 25px;
}

.pagination a {
    padding: 9px 13px;
    border: 1px solid var(--admin-border);
    border-radius: 9px;
    background: #fff;
    text-decoration: none;
    font-weight: 700;
}

.pagination span {
    color: var(--admin-muted);
    font-size: 13px;
}

/* Alertas */

.admin-alert {
    margin-bottom: 20px;
    padding: 14px 17px;
    border: 1px solid transparent;
    border-radius: 11px;
    line-height: 1.5;
}

.alert-sucesso {
    border-color: #a7dbbd;
    background: #eaf8f0;
    color: var(--admin-success);
}

.alert-erro {
    border-color: #efb5af;
    background: #fff0ef;
    color: var(--admin-danger);
}

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

/* Login */

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 25px;
    background:
        radial-gradient(circle at top left, #dcebf5, transparent 35%),
        radial-gradient(circle at bottom right, #dfeef6, transparent 40%),
        var(--admin-background);
}

.login-box {
    width: min(430px, 100%);
    padding: 35px;
    border: 1px solid var(--admin-border);
    border-radius: 21px;
    background: #fff;
    box-shadow: 0 25px 60px rgba(15, 23, 42, 0.12);
}

.login-logo {
    width: 66px;
    height: 66px;
    margin: 0 auto 20px;
    border-radius: 20px;
    font-size: 20px;
}

.login-box h1 {
    margin: 0;
    color: var(--admin-primary-dark);
    text-align: center;
}

.login-description {
    margin: 9px 0 25px;
    color: var(--admin-muted);
    text-align: center;
}

.login-box form {
    display: flex;
    flex-direction: column;
    gap: 17px;
}

.login-back {
    display: block;
    margin-top: 20px;
    color: var(--admin-muted);
    text-align: center;
    text-decoration: none;
    font-size: 13px;
}

/* Rodapé */

.admin-footer {
    padding: 22px;
    color: var(--admin-muted);
    text-align: center;
    font-size: 12px;
}

/* Responsivo */

@media (max-width: 1100px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .filter-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .filter-search {
        grid-column: 1 / -1;
    }

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

    .sticky-card {
        position: static;
    }
}

@media (max-width: 820px) {
    .admin-header-inner {
        min-height: 68px;
    }

    .mobile-menu-button {
        display: block;
    }

    .admin-nav {
        position: absolute;
        top: 68px;
        right: 3%;
        left: 3%;
        display: none;
        align-items: stretch;
        flex-direction: column;
        padding: 15px;
        border: 1px solid var(--admin-border);
        border-radius: 14px;
        background: #fff;
        box-shadow: var(--admin-shadow);
    }

    .admin-nav.aberto {
        display: flex;
    }

    .admin-user {
        margin: 5px 0;
        padding: 12px;
        border: 0;
        border-radius: 9px;
        background: var(--admin-background);
    }

    .logout-button {
        width: 100%;
    }

    .admin-page-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .detail-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .admin-main {
        padding-top: 22px;
    }

    .admin-container {
        width: 92%;
    }

    .admin-card {
        padding: 18px;
        border-radius: 15px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 11px;
    }

    .stat-card {
        min-height: 108px;
        padding: 16px;
    }

    .stat-card strong {
        font-size: 28px;
    }

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

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

    .filter-buttons {
        flex-direction: column;
    }

    .filter-buttons .admin-button {
        width: 100%;
    }

    .attachment-item {
        align-items: stretch;
        flex-direction: column;
    }

    .attachment-item .table-button {
        width: 100%;
    }

    .timeline-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 7px;
    }

    .pagination {
        flex-wrap: wrap;
    }

    .login-box {
        padding: 27px 21px;
    }
}