/*
 * TDOC — Processos Detran
 * Tema visual alinhado ao portal www.detran.rj.gov.br
 *
 * As variáveis abaixo são os design tokens do próprio portal, copiados
 * verbatim de templates/portal/css/index.min.css. Não são aproximações.
 *
 * Observação: o portal declara `--azulDetran: #;` (valor vazio, bug no CSS
 * deles). Usamos --azulDetran-01 como cor base institucional.
 */

:root {
    --azul-detran: #00588c;
    --azul-detran-02: #004f8a;
    --azul-detran-03: #045b91;
    --azul-detran-04: #155bcb;
    --verde-detran: #24d699;
    --verde-detran-02: #05801b;
    --verde-detran-03: #169898;
    --cinza-detran: #e9ecef;
    --cinza-detran-01: #555;
    --cinza-detran-02: #333;
    --cinza-detran-03: #b3c2cb;
    --amarelo-detran: #e9962c;
    --vermelho: #dc3545;
    --contraste: #2c2c2c;

    --raio: 4px;
    --sombra: 0 1px 3px rgba(0, 0, 0, .12);
    --sombra-md: 0 2px 8px rgba(0, 0, 0, .10);
    --largura: 1200px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--cinza-detran-02);
    background: #f4f6f8;
}

a { color: var(--azul-detran-04); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- topo -- */

.gov-bar {
    background: var(--contraste);
    color: #fff;
    font-size: 12px;
}
.gov-bar .wrap {
    max-width: var(--largura);
    margin: 0 auto;
    padding: 6px 16px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
}
.gov-bar a { color: #fff; opacity: .85; }

.site-header {
    background: var(--azul-detran);
    color: #fff;
}
.site-header .wrap {
    max-width: var(--largura);
    margin: 0 auto;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}
.site-header .logo img { display: block; height: 40px; width: auto; }

.site-header .sistema {
    border-left: 1px solid rgba(255, 255, 255, .35);
    padding-left: 20px;
    line-height: 1.2;
}
.site-header .sistema strong { display: block; font-size: 17px; letter-spacing: .3px; }
.site-header .sistema span { font-size: 12px; opacity: .8; }

.site-header .sessao { margin-left: auto; text-align: right; font-size: 13px; }
.site-header .sessao .quem { display: block; opacity: .85; }
.site-header .sessao .quem b { opacity: 1; }
.site-header .sessao a.sair {
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .5);
    border-radius: var(--raio);
    padding: 3px 10px;
    display: inline-block;
    margin-top: 4px;
}
.site-header .sessao a.sair:hover { background: rgba(255, 255, 255, .12); text-decoration: none; }

/* ------------------------------------------------------------- navegação -- */

.site-nav { background: var(--azul-detran-02); box-shadow: var(--sombra); }
.site-nav ul {
    max-width: var(--largura);
    margin: 0 auto;
    padding: 0 8px;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
}
.site-nav a {
    display: block;
    padding: 11px 15px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
    border-bottom: 3px solid transparent;
}
.site-nav a:hover { background: rgba(255, 255, 255, .10); text-decoration: none; }
.site-nav a.ativo {
    background: rgba(255, 255, 255, .14);
    border-bottom-color: var(--amarelo-detran);
}

/* -------------------------------------------------------------- conteúdo -- */

main { max-width: var(--largura); margin: 22px auto 40px; padding: 0 16px; }

.card {
    background: #fff;
    border: 1px solid #dde3e8;
    border-radius: var(--raio);
    box-shadow: var(--sombra);
    padding: 22px;
}

h1, h2, h3 { color: var(--azul-detran); margin-top: 0; font-weight: 600; }
/* Sized on the existing scale so promoting the page headings from h3 to h1
   (A4) is a semantic fix, not a 30px visual jump. */
h1 { font-size: 22px; margin-bottom: 16px; }
h3 { font-size: 20px; margin-bottom: 16px; }

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.page-head h1, .page-head h3 { margin: 0; }

/* --------------------------------------------------------------- tabelas -- */

table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
    background: var(--cinza-detran);
    color: var(--cinza-detran-02);
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .4px;
    padding: 10px 12px;
    border-bottom: 2px solid var(--cinza-detran-03);
    white-space: nowrap;
}
thead th a { color: inherit; }
tbody td { padding: 10px 12px; border-bottom: 1px solid #eef1f4; vertical-align: top; }
tbody tr:hover { background: #f7fbfd; }
td.actions { white-space: nowrap; text-align: right; }
/* WCAG 2.5.8 floor is 24px; these links used to be 19.5px tall. */
td.actions a {
    display: inline-block;
    margin-left: 4px;
    padding: 4px 8px;
    min-height: 24px;
    font-size: 13px;
    border-radius: var(--raio);
}
td.actions a:hover { background: var(--cinza-detran); text-decoration: none; }
td.actions a:last-child { color: var(--vermelho); }

/* Empty-state row for the index tables. */
.empty { text-align: center; color: var(--cinza-detran-01); padding: 24px; }

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

/* --------------------------------------------------------------- formul. -- */

fieldset { border: 0; padding: 0; margin: 0 0 18px; }
legend {
    font-size: 16px;
    font-weight: 600;
    color: var(--azul-detran);
    padding: 0 0 12px;
    border-bottom: 1px solid var(--cinza-detran);
    width: 100%;
    margin-bottom: 16px;
}

.input { margin-bottom: 15px; max-width: 620px; }
.input label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: var(--cinza-detran-01); }
.input input[type=text],
.input input[type=password],
.input input[type=number],
.input input[type=date],
.input select,
.input textarea {
    width: 100%;
    padding: 8px 10px;
    font: inherit;
    font-size: 14px;
    color: var(--cinza-detran-02);
    border: 1px solid var(--cinza-detran-03);
    border-radius: var(--raio);
    background: #fff;
}
/* Opaque two-tone ring: the old rgba() shadow measured 1.31:1 against the
   field and never met WCAG 2.4.11. Readonly boxes are excluded so they do
   not look focusable. */
.input input:not([readonly]):focus, .input select:focus, .input textarea:focus {
    outline: 0;
    border-color: var(--azul-detran-04);
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--azul-detran-04);
}
/* Readonly stays selectable/copyable; only disabled gets the not-allowed
   cursor. Merging the two made readonly key fields look inert. */
.input input[readonly] {
    background: #f1f3f5;
    color: var(--cinza-detran-01);
}
.input input:disabled, .input select:disabled {
    background: #f1f3f5;
    color: var(--cinza-detran-01);
    cursor: not-allowed;
}
/* FormHelper nests the checkbox inside its <label>, so a gap on the wrapper
   never applied. The flex row has to live on the label itself. */
.input.checkbox { margin-bottom: 10px; }
.input.checkbox label {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 28px;
    margin: 0;
    font-weight: 400;
    color: var(--cinza-detran-02);
    cursor: pointer;
}
.input.checkbox input { width: 18px; height: 18px; accent-color: var(--azul-detran-04); }
.input.checkbox input[type=hidden] { display: none; }

.input .error-message,
.error-message {
    display: block;
    color: var(--vermelho);
    font-size: 12.5px;
    margin-top: 4px;
}
.input.error input, .input.error select, .input.error textarea { border-color: var(--vermelho); }

/* FormHelper emits the `required` wrapper class but the theme never styled
   it, so required fields were visually indistinguishable. */
.input.required > label::after { content: ' *'; color: var(--vermelho); font-weight: 700; }

p.help { font-size: 12.5px; color: var(--cinza-detran-01); margin: -10px 0 15px; }
/* The -10px above is right when the hint is a *sibling* of .input; when it is
   nested inside one (analises form) it dragged the text into the field. */
.input > p.help { margin: 4px 0 0; }

form.search {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    margin: 0;
}
form.search .input { margin-bottom: 0; min-width: 260px; }

/* --------------------------------------------------------------- botões -- */

button, .button, input[type=submit] {
    display: inline-block;
    padding: 8px 18px;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: var(--azul-detran-04);
    border: 1px solid var(--azul-detran-04);
    border-radius: var(--raio);
    cursor: pointer;
    text-decoration: none;
    line-height: 1.5;
}
button:hover, .button:hover, input[type=submit]:hover {
    background: var(--azul-detran-02);
    border-color: var(--azul-detran-02);
    text-decoration: none;
    color: #fff;
}
.button.cancel, .button.secundario {
    background: #fff;
    color: var(--cinza-detran-01);
    border-color: var(--cinza-detran-03);
}
.button.cancel:hover, .button.secundario:hover { background: var(--cinza-detran); color: var(--cinza-detran-02); }

/* ---------------------------------------------------------------- flash -- */

.message {
    padding: 11px 15px;
    border-radius: var(--raio);
    margin-bottom: 18px;
    font-size: 14px;
    border: 1px solid transparent;
}
.message.success { background: #e7f8ef; color: var(--verde-detran-02); border-color: #b7e7cd; }
.message.error   { background: #fdecee; color: #a71d2a; border-color: #f5c2c7; }
.message.warning { background: #fdf3e6; color: #8a5a12; border-color: #f6dcb8; }
.message.info    { background: #e8f1fb; color: var(--azul-detran-02); border-color: #c3dcf5; }
/* templates/element/flash/*.php all carry
   onclick="this.classList.add('hidden')" — without this rule that handler
   was a no-op and the flash could not be dismissed. */
.message.hidden { display: none; }

/* ----------------------------------------------------------- paginação -- */

.paginator { margin-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.pagination { list-style: none; display: flex; gap: 4px; padding: 0; margin: 0; }
.pagination li a, .pagination li.active a {
    display: block;
    padding: 5px 11px;
    border: 1px solid var(--cinza-detran-03);
    border-radius: var(--raio);
    font-size: 13px;
    background: #fff;
}
.pagination li.active a { background: var(--azul-detran-04); border-color: var(--azul-detran-04); color: #fff; }
.pagination li.disabled a { color: var(--cinza-detran-03); pointer-events: none; }
.paginator p { margin: 0; font-size: 13px; color: var(--cinza-detran-01); }

/* --------------------------------------------------------------- painel -- */

.servicos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
    margin-top: 6px;
}
.servico {
    display: block;
    background: #fff;
    border: 1px solid #dde3e8;
    border-top: 3px solid var(--azul-detran-04);
    border-radius: var(--raio);
    padding: 18px;
    color: inherit;
    box-shadow: var(--sombra);
    transition: box-shadow .15s, transform .15s;
}
.servico:hover { text-decoration: none; box-shadow: var(--sombra-md); transform: translateY(-2px); }
.servico strong { display: block; color: var(--azul-detran); font-size: 16px; margin-bottom: 4px; }
.servico span { font-size: 13px; color: var(--cinza-detran-01); }
.servico.indisponivel { border-top-color: var(--cinza-detran-03); opacity: .6; pointer-events: none; }
.servico.indisponivel strong { color: var(--cinza-detran-01); }
.servico .tag {
    display: inline-block;
    margin-top: 8px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .4px;
    background: var(--cinza-detran);
    color: var(--cinza-detran-01);
    border-radius: 10px;
    padding: 2px 9px;
}

/* --------------------------------------------------------------- login -- */

body.tela-login { background: var(--azul-detran); }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-box { background: #fff; border-radius: 6px; box-shadow: 0 8px 30px rgba(0, 0, 0, .25); padding: 32px; width: 100%; max-width: 400px; }
.login-box .marca { text-align: center; margin-bottom: 22px; }
.login-box .marca img { max-width: 210px; height: auto; }
.login-box h2 { text-align: center; font-size: 17px; color: var(--azul-detran); margin: 0 0 4px; }
.login-box .sub { text-align: center; font-size: 13px; color: var(--cinza-detran-01); margin: 0 0 22px; }
.login-box button { width: 100%; margin-top: 6px; }
.login-box .attempts { text-align: center; font-size: 12.5px; color: var(--vermelho); margin-top: 14px; }

/* -------------------------------------------------------------- rodapé -- */

.site-footer {
    background: var(--contraste);
    color: #cfd6dc;
    font-size: 12.5px;
    margin-top: 40px;
}
.site-footer .wrap {
    max-width: var(--largura);
    margin: 0 auto;
    padding: 20px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
}
.site-footer img { height: 34px; width: auto; opacity: .9; }
.site-footer a { color: #fff; }

@media (max-width: 720px) {
    .site-header .wrap { gap: 12px; }
    .site-header .sistema { border-left: 0; padding-left: 0; }
    .site-header .sessao { margin-left: 0; text-align: left; width: 100%; }
    form.search { flex-direction: column; align-items: stretch; }
    form.search .input { min-width: 0; }
}

/* ------------------------------------------------------- campo imutável -- */

/*
 * A value the operator cannot change. Rendered as text rather than a disabled
 * input, so it does not advertise an affordance the screen does not offer.
 */
.campo-fixo {
    margin-bottom: 15px;
    max-width: 620px;
    padding: 8px 12px;
    background: #f7f9fb;
    border-left: 3px solid var(--cinza-detran-03);
    border-radius: 0 var(--raio) var(--raio) 0;
}
.campo-fixo__rotulo {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--cinza-detran-01);
}
.campo-fixo__valor {
    display: block;
    font-size: 15px;
    color: var(--cinza-detran-02);
    font-variant-numeric: tabular-nums;
}
.campo-fixo__ajuda {
    display: block;
    font-size: 12.5px;
    color: var(--cinza-detran-01);
    margin-top: 3px;
}

td.empty { text-align: center; color: var(--cinza-detran-01); padding: 26px 12px; }

/* ---------------------------------------------------------------- ficha --
 *
 * Bloco e lista de dados das telas de detalhe (view). Nasceram em
 * templates/element/processos/estilos.php, escopadas a Processos; com as
 * fichas dos demais cadastros usando as mesmas duas classes, elas passaram a
 * ser vocabulário do sistema e vieram para cá — que é o TODO(review) que
 * aquele element registrava.
 */

.bloco { border: 1px solid #dde3e8; border-radius: var(--raio); padding: 16px; background: #fff; }
.bloco + .bloco { margin-top: 16px; }
.bloco > h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .4px; margin: 0 0 12px; }

.dados { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; font-size: 14px; }
.dados dt { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .3px; color: var(--cinza-detran-01); }
.dados dd { margin: 0; overflow-wrap: anywhere; }
