:root {
    --salmon: #015582;
    --salmon-dark: #01466b;
    --background: #f4f6fa;
    --card: #ffffff;
    --text: #172033;
    --muted: #667085;
    --border: #dfe5ef;
    --input-border: #b9c3d2;
    --danger: #a51d1d;
    --success: #176b3a;
}

/* =========================================================
   BASE
   ========================================================= */

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 15px;
    color: var(--text);
    background: var(--background);
}

h1 {
    margin-top: 0;
}

a {
    text-decoration: none;
}


/* =========================================================
   TOPO
   ========================================================= */

.topbar {
    min-height: 64px;
    padding: 0 24px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    background: var(--salmon);
    color: white;
}

.topbar a {
    color: white;
}

.brand {
    margin: 0;

    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 18px;
}

.nav-user span {
    color: white;
}

.inline {
    display: inline;
}

.nav-button {
    padding: 7px 12px !important;

    color: white !important;
    background: transparent !important;

    border: 1px solid rgba(255, 255, 255, 0.55) !important;
    border-radius: 8px;
}

.nav-button:hover {
    background: rgba(255, 255, 255, 0.15) !important;
}


/* =========================================================
   CONTEÚDO
   ========================================================= */

.container {
    width: 100%;
    max-width: 1120px;

    margin: 0 auto;
    padding: 34px 20px;
}

.muted {
    color: var(--muted);
}


/* =========================================================
   BOTÕES
   ========================================================= */

button,
.button,
.ghost,
.pages a {
    padding: 11px 15px;

    color: white;
    background: var(--salmon);

    border: 0;
    border-radius: 8px;

    font-family: inherit;
    font-size: 14px;
    font-weight: 600;

    text-decoration: none;
    cursor: pointer;

    transition: background-color 0.15s ease;
}

button:hover,
.button:hover,
.ghost:hover,
.pages a:hover {
    color: white;
    background: var(--salmon-dark);
}

button:focus,
.button:focus,
.ghost:focus {
    outline: 2px solid rgba(1, 85, 130, 0.25);
    outline-offset: 2px;
}

button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}


/* =========================================================
   PAINÉIS
   ========================================================= */

.panel,
.search,
.login {
    margin: 22px 0;
    padding: 22px;

    background: var(--card);

    border: 1px solid var(--border);
    border-radius: 14px;

    box-shadow: 0 8px 24px rgba(20, 40, 80, 0.06);
}


/* =========================================================
   LOGIN
   ========================================================= */

.login {
    max-width: 440px;

    margin: 70px auto;
}

.login h1 {
    margin: 0 0 20px;

    font-size: 30px;
    line-height: 1.25;
}

.login p {
    margin: 0 0 20px;

    color: var(--muted);
}

.login-form {
    display: flex;
    flex-direction: column;
}

.login-form label {
    display: block;

    margin: 0 0 7px;

    font-weight: 500;
}

.login-form input {
    width: 100%;

    margin: 0 0 17px;
    padding: 12px;

    font-family: inherit;
    font-size: 15px;

    background: white;

    border: 1px solid var(--input-border);
    border-radius: 8px;
}

.login-form input:focus {
    outline: none;

    border-color: var(--salmon);

    box-shadow: 0 0 0 3px rgba(1, 85, 130, 0.10);
}

.login-actions {
    display: block;

    margin-top: 2px;
}

.login-actions button {
    display: inline-block;

    position: static;
    float: none;
}


/* =========================================================
   PESQUISA
   ========================================================= */

.search label {
    display: block;

    margin-bottom: 8px;

    font-weight: 600;
}

.search > div {
    display: flex;

    gap: 10px;
}

.search input {
    flex: 1;

    min-width: 0;

    padding: 13px;

    font-family: inherit;
    font-size: 15px;

    border: 1px solid var(--input-border);
    border-radius: 8px;
}

.search input:focus {
    outline: none;

    border-color: var(--salmon);

    box-shadow: 0 0 0 3px rgba(1, 85, 130, 0.10);
}


/* =========================================================
   RESULTADOS DOS PDFs
   ========================================================= */

.card {
    display: flex;
    align-items: center;

    gap: 15px;

    margin: 9px 0;
    padding: 15px;

    background: white;

    border: 1px solid var(--border);
    border-radius: 12px;
}

.pdf {
    display: grid;
    place-items: center;

    flex: 0 0 48px;

    width: 48px;
    height: 48px;

    color: #be2130;
    background: #fff0f0;

    border-radius: 8px;

    font-weight: 800;
}

.meta {
    display: grid;

    flex: 1;

    min-width: 0;

    gap: 5px;
}

.meta strong {
    color: var(--text);
}

.meta small {
    color: var(--muted);

    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.actions {
    display: flex;
    align-items: center;

    gap: 10px;
}


/* =========================================================
   PAGINAÇÃO
   ========================================================= */

.pages {
    display: flex;
    justify-content: center;
    align-items: center;

    gap: 14px;

    margin: 20px;
}


/* =========================================================
   ADMIN - CRIAR UTILIZADOR
   ========================================================= */

.grid {
    display: grid;

    grid-template-columns:
        minmax(140px, 1fr)
        minmax(180px, 1.3fr)
        minmax(160px, 1fr)
        minmax(120px, 0.8fr)
        auto;

    gap: 15px;

    align-items: end;
}

.grid label {
    display: grid;

    gap: 7px;

    margin: 0;

    font-weight: 500;
}

.grid input,
.grid select {
    width: 100%;

    height: 42px;
    padding: 10px 12px;

    font-family: inherit;
    font-size: 14px;

    background: white;

    border: 1px solid var(--input-border);
    border-radius: 8px;
}

.grid input:focus,
.grid select:focus {
    outline: none;

    border-color: var(--salmon);

    box-shadow: 0 0 0 3px rgba(1, 85, 130, 0.10);
}


/* =========================================================
   ADMIN - TABELA UTILIZADORES
   ========================================================= */

.table {
    width: 100%;

    overflow-x: auto;
}

table {
    width: 100%;

    border-collapse: collapse;
}

th,
td {
    padding: 14px 12px;

    text-align: left;
    vertical-align: middle;

    border-bottom: 1px solid var(--border);
}

th {
    color: var(--text);

    font-weight: 600;
}

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


/* largura das primeiras colunas */

th:nth-child(1),
td:nth-child(1) {
    width: 16%;
}

th:nth-child(2),
td:nth-child(2) {
    width: 21%;
}

th:nth-child(3),
td:nth-child(3) {
    width: 12%;
}

th:nth-child(4),
td:nth-child(4) {
    width: 10%;
}


/* =========================================================
   COLUNA AÇÕES
   ========================================================= */

th.actions-column,
td.actions-cell {
    width: 41%;
    min-width: 510px;
}


/*
   Container geral das ações.

   Cria uma separação clara entre:
   1. Ativar / Desativar
   2. Alteração de password
*/

.user-actions {
    display: grid;

    grid-template-columns: 105px 1fr;

    align-items: center;

    column-gap: 28px;
}


/* =========================================================
   ATIVAR / DESATIVAR
   ========================================================= */

.status-action {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.status-action form {
    margin: 0;
    padding: 0;
}

.status-action button {
    width: 100px;
    height: 38px;

    padding: 0 12px;
}


/* =========================================================
   ALTERAÇÃO DA PASSWORD
   ========================================================= */

.password-action {
    padding-left: 28px;

    border-left: 1px solid var(--border);
}

.password-action form {
    display: grid;

    grid-template-columns: minmax(170px, 210px) 85px;

    align-items: center;

    gap: 12px;

    margin: 0;
    padding: 0;
}

.password-input {
    width: 100%;
    height: 38px;

    padding: 8px 11px;

    font-family: inherit;
    font-size: 14px;

    color: var(--text);
    background: white;

    border: 1px solid var(--input-border);
    border-radius: 8px;
}

.password-input::placeholder {
    color: #8a94a6;
}

.password-input:focus {
    outline: none;

    border-color: var(--salmon);

    box-shadow: 0 0 0 3px rgba(1, 85, 130, 0.10);
}

.password-action button {
    width: 85px;
    height: 38px;

    padding: 0 12px;
}


/* =========================================================
   BOTÕES PEQUENOS
   ========================================================= */

.small {
    min-height: 38px;

    padding: 0 12px;

    white-space: nowrap;
}


/* =========================================================
   MENSAGENS
   ========================================================= */

.ok,
.bad {
    margin: 12px 0;
    padding: 12px;

    border-radius: 8px;
}

.ok {
    color: var(--success);
    background: #eaf8ef;
}

.bad {
    color: var(--danger);
    background: #fff0f0;
}


/* =========================================================
   RESPONSIVE - TABLET
   ========================================================= */

@media (max-width: 1000px) {

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

    th.actions-column,
    td.actions-cell {
        min-width: 450px;
    }

    .user-actions {
        grid-template-columns: 100px 1fr;

        column-gap: 18px;
    }

    .password-action {
        padding-left: 18px;
    }

    .password-action form {
        grid-template-columns: minmax(150px, 1fr) 85px;
    }
}


/* =========================================================
   RESPONSIVE - MOBILE
   ========================================================= */

@media (max-width: 750px) {

    .topbar {
        align-items: stretch;
        flex-direction: column;

        gap: 12px;

        padding: 16px 20px;
    }

    .nav-user {
        flex-wrap: wrap;
    }

    .search > div {
        flex-direction: column;
    }

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

    .actions {
        width: 100%;
    }

    .actions a {
        flex: 1;

        text-align: center;
    }

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

    .login {
        margin: 35px auto;
    }


    /*
       A tabela mantém scroll horizontal para não
       destruir o alinhamento das colunas.
    */

    .table {
        overflow-x: auto;
    }


    /*
       Dentro da coluna Ações os dois grupos
       passam para linhas separadas.
    */

    .user-actions {
        display: flex;
        align-items: flex-start;
        flex-direction: column;

        gap: 14px;
    }

    .password-action {
        width: 100%;

        padding-top: 14px;
        padding-left: 0;

        border-top: 1px solid var(--border);
        border-left: 0;
    }

    .password-action form {
        display: flex;

        align-items: stretch;
        flex-direction: column;

        gap: 10px;
    }

    .password-input {
        width: 100%;
    }

    .password-action button {
        width: auto;
    }
}