/* Ouvidoria Campestre — tema Verde Campestre (claro/escuro) */

:root {
  --verde: #1f6b3b;
  --verde-escuro: #16502c;
  --verde-claro: #2f8c52;
  --areia: #f3ede1;
  --areia-2: #e8dfcc;
  --bg: #f6f7f3;
  --surface: #ffffff;
  --surface-2: #f1f3ec;
  --texto: #1f2a24;
  --texto-suave: #5c6b62;
  --borda: #dfe4da;
  --sombra: 0 1px 3px rgba(20,40,25,.08), 0 6px 20px rgba(20,40,25,.06);
  --raio: 14px;
  --raio-sm: 9px;
  --max: 1180px;

  --azul: #2563eb;
  --amarelo: #b8860b;
  --vermelho: #c0392b;
  --cinza: #6b7280;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html[data-tema="escuro"] {
  --areia: #1c241f;
  --areia-2: #233029;
  --bg: #11160f;
  --surface: #18211b;
  --surface-2: #1f2a23;
  --texto: #e7efe7;
  --texto-suave: #9fb1a4;
  --borda: #2c3a30;
  --verde: #3da866;
  --verde-claro: #4fbe78;
  --sombra: 0 1px 3px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--texto);
  background: var(--bg);
  line-height: 1.55;
}
.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 18px; }
a { color: var(--verde); }
h1, h2, h3 { font-family: var(--serif); color: var(--texto); line-height: 1.2; }
.muted { color: var(--texto-suave); }
.center { text-align: center; }
.req { color: var(--vermelho); }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .7rem 1.25rem; border-radius: var(--raio-sm); border: 1px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: .15s ease; line-height: 1.1;
}
.btn--primario { background: var(--verde); color: #fff; }
.btn--primario:hover { background: var(--verde-escuro); }
.btn--secundario { background: var(--surface); color: var(--verde); border-color: var(--verde); }
.btn--secundario:hover { background: var(--surface-2); }
.btn--texto { background: transparent; color: var(--texto-suave); }
.btn--texto:hover { color: var(--verde); }
.btn--bloco { width: 100%; }
.btn--mini { padding: .35rem .7rem; font-size: .85rem; border-radius: 7px; }

/* ---------- Header público ---------- */
.pub-header { background: var(--verde); color: #fff; }
.pub-header__in { display: flex; align-items: center; justify-content: space-between; padding: .8rem 18px; }
.brand { display: flex; align-items: center; gap: .7rem; color: #fff; text-decoration: none; }
.brand__mark { font-size: 1.8rem; }
.brand__txt strong { display: block; font-family: var(--serif); font-size: 1.15rem; }
.brand__txt small { display: block; opacity: .85; font-size: .72rem; max-width: 38ch; }
.pub-nav { display: flex; align-items: center; gap: 1rem; }
.pub-nav a { color: #fff; text-decoration: none; font-weight: 600; opacity: .92; }
.pub-nav a:hover { opacity: 1; text-decoration: underline; }
.tema-btn { background: rgba(255,255,255,.15); color: inherit; border: 0; border-radius: 8px; padding: .4rem .6rem; cursor: pointer; font-size: 1rem; }

.pub-main { padding: 2rem 18px 3rem; }

/* ---------- Hero / institucional ---------- */
.hero {
  background: linear-gradient(135deg, var(--verde) 0%, var(--verde-escuro) 100%);
  border-radius: var(--raio); color: #fff; padding: 2.6rem 2rem; margin-bottom: 2rem;
  box-shadow: var(--sombra);
}
.hero h1 { color: #fff; font-size: 2.1rem; margin: 0 0 .4rem; }
.hero__sub { opacity: .92; margin: 0 0 1.4rem; font-size: 1.05rem; }
.hero__cta { display: flex; gap: .8rem; flex-wrap: wrap; }
.hero__cta--centro { justify-content: center; margin-top: 1.4rem; }
.hero .btn--secundario { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.6); }
.hero .btn--secundario:hover { background: rgba(255,255,255,.22); }

.institucional {
  background: var(--surface); border: 1px solid var(--borda); border-left: 5px solid var(--verde);
  border-radius: var(--raio); padding: 1.8rem 2rem; box-shadow: var(--sombra);
}
.institucional p { margin: 0 0 1rem; }
.institucional__nota { font-weight: 600; color: var(--verde); }

/* ---------- Formulários ---------- */
.form-wrap { background: var(--surface); border: 1px solid var(--borda); border-radius: var(--raio); padding: 2rem; box-shadow: var(--sombra); max-width: 860px; margin: 0 auto; }
.form-wrap--estreito { max-width: 560px; }
.form label { display: block; margin: 0 0 1rem; font-weight: 600; }
.form input, .form select, .form textarea {
  width: 100%; margin-top: .35rem; padding: .65rem .7rem; font: inherit; font-weight: 400;
  border: 1px solid var(--borda); border-radius: var(--raio-sm); background: var(--surface);
  color: var(--texto);
}
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--verde-claro); outline-offset: 1px; border-color: var(--verde); }
.form textarea { resize: vertical; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.2rem; }
fieldset { border: 1px solid var(--borda); border-radius: var(--raio-sm); padding: .8rem 1rem; margin: 0 0 1rem; }
legend { font-weight: 700; padding: 0 .4rem; }
.radios { display: flex; gap: 1.2rem; flex-wrap: wrap; }
.radios label { font-weight: 500; display: flex; align-items: center; gap: .35rem; margin: 0; }
.radios input { width: auto; margin: 0; }
.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 500; }
.check input { width: auto; margin-top: .25rem; }
.declaracao { background: var(--surface-2); }
.form-acoes { display: flex; gap: .8rem; align-items: center; margin-top: .5rem; }
.erro-campo { display: block; color: var(--vermelho); font-weight: 600; font-size: .85rem; margin-top: .25rem; }
.hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }
.consulta-form { display: flex; gap: .8rem; align-items: flex-end; flex-wrap: wrap; }
.consulta-form label { flex: 1 1 220px; margin: 0; }

/* ---------- Flash ---------- */
.flash { padding: .8rem 1rem; border-radius: var(--raio-sm); margin: 0 0 1.2rem; font-weight: 600; border: 1px solid; }
.flash--sucesso { background: #e7f5ec; color: #176b39; border-color: #b6dcc4; }
.flash--erro { background: #fdeceb; color: #9a2b22; border-color: #f1c4c0; }
.flash--aviso { background: #fdf6e3; color: #8a6d11; border-color: #ecdba6; }
html[data-tema="escuro"] .flash--sucesso { background: #14301f; color: #7fdba1; border-color: #2c5a3c; }
html[data-tema="escuro"] .flash--erro { background: #361a18; color: #f1a8a1; border-color: #5e2a26; }
html[data-tema="escuro"] .flash--aviso { background: #322a12; color: #e6c870; border-color: #574a1e; }

/* ---------- Sucesso / protocolo ---------- */
.sucesso { background: var(--surface); border: 1px solid var(--borda); border-radius: var(--raio); padding: 2.5rem 2rem; text-align: center; max-width: 620px; margin: 0 auto; box-shadow: var(--sombra); }
.sucesso__icone { width: 72px; height: 72px; margin: 0 auto 1rem; border-radius: 50%; background: var(--verde); color: #fff; font-size: 2.2rem; display: grid; place-items: center; }
.protocolo-box { background: var(--surface-2); border: 1px dashed var(--verde); border-radius: var(--raio); padding: 1.2rem; margin: 1.5rem 0; }
.protocolo-box__rotulo { display: block; font-size: .8rem; color: var(--texto-suave); text-transform: uppercase; letter-spacing: .05em; }
.protocolo-box__num { display: block; font-size: 1.9rem; font-family: var(--serif); letter-spacing: .04em; color: var(--verde); margin: .3rem 0 .8rem; }
.resultado-consulta { margin-top: 1.5rem; background: var(--surface-2); border-radius: var(--raio); padding: 1.4rem; border: 1px solid var(--borda); }
.resultado-consulta dl { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; margin: .5rem 0; }
.resultado-consulta dt { font-weight: 700; color: var(--texto-suave); }
.resultado-consulta dd { margin: 0; }
.andamento { font-size: 1.05rem; }

/* ---------- Footer público ---------- */
.pub-footer { background: var(--areia-2); margin-top: 3rem; padding: 1.6rem 0; color: var(--texto-suave); }
.pub-footer p { margin: .2rem 0; }
.pub-footer a { color: var(--verde); }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: .2rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 700; border: 1px solid transparent; white-space: nowrap; }
.st-nova { background:#e6effd; color:#1d4ed8; }
.st-analise { background:#fff4d6; color:#92710c; }
.st-apuracao { background:#ede3fb; color:#6b30c2; }
.st-aguardando { background:#fde9d6; color:#9a560b; }
.st-resolvida { background:#e2f6e8; color:#176b39; }
.st-arquivada { background:#eceff1; color:#546069; }
.pr-baixa { background:#eceff1; color:#546069; }
.pr-media { background:#e6effd; color:#1d4ed8; }
.pr-alta { background:#fde9d6; color:#9a560b; }
.pr-urgente { background:#fdeceb; color:#b3261e; }
.badge--perfil { background: rgba(255,255,255,.18); color: #fff; border-color: rgba(255,255,255,.35); }
.tag-anon { font-size: .7rem; color: var(--texto-suave); font-style: italic; }

/* ---------- Login ---------- */
.login-body { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, var(--verde) 0%, var(--verde-escuro) 100%); padding: 1rem; }
.login-card { background: var(--surface); border-radius: var(--raio); padding: 2.2rem; width: 100%; max-width: 400px; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.login-card__brand { text-align: center; margin-bottom: 1.4rem; }
.login-card__brand span { font-size: 2.4rem; }
.login-card__brand h1 { margin: .3rem 0 0; font-size: 1.4rem; }
.login-card__brand p { margin: 0; color: var(--texto-suave); }
.login-card__voltar { text-align: center; margin: 1rem 0 0; }

/* ---------- Admin shell ---------- */
.adm { background: var(--bg); }
.adm-shell { display: flex; min-height: 100vh; }
.adm-side { width: 240px; background: var(--verde-escuro); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.adm-side__brand { display: flex; align-items: center; gap: .6rem; padding: 1.2rem 1.2rem; font-size: 1.4rem; border-bottom: 1px solid rgba(255,255,255,.12); }
.adm-side__brand div strong { display: block; font-family: var(--serif); font-size: 1.1rem; }
.adm-side__brand div small { opacity: .8; font-size: .75rem; }
.adm-menu { display: flex; flex-direction: column; padding: .8rem 0; flex: 1; }
.adm-menu a { color: rgba(255,255,255,.85); text-decoration: none; padding: .7rem 1.3rem; font-weight: 600; border-left: 3px solid transparent; }
.adm-menu a:hover { background: rgba(255,255,255,.08); color: #fff; }
.adm-menu a.is-ativo { background: rgba(255,255,255,.14); color: #fff; border-left-color: #fff; }
.adm-side__rodape { padding: 1rem 1.3rem; border-top: 1px solid rgba(255,255,255,.12); display: flex; flex-direction: column; gap: .6rem; }
.adm-side__rodape .tema-btn { width: 100%; text-align: left; }
.adm-side__rodape .sair { color: #ffd9d4; text-decoration: none; font-weight: 600; }
.adm-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.adm-top { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.6rem; background: var(--surface); border-bottom: 1px solid var(--borda); position: sticky; top: 0; z-index: 5; }
.adm-top h1 { margin: 0; font-size: 1.3rem; }
.adm-top__user { display: flex; align-items: center; gap: .6rem; font-weight: 600; }
.adm-content { padding: 1.6rem; }

/* ---------- Cards dashboard ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1.6rem; }
.card-num { background: var(--surface); border: 1px solid var(--borda); border-radius: var(--raio); padding: 1.2rem; text-decoration: none; color: var(--texto); box-shadow: var(--sombra); border-top: 4px solid var(--verde); transition: .15s; }
.card-num:hover { transform: translateY(-2px); }
.card-num__valor { display: block; font-size: 2.1rem; font-weight: 800; font-family: var(--serif); }
.card-num__rotulo { display: block; color: var(--texto-suave); font-size: .85rem; font-weight: 600; }
.c-total { border-top-color: var(--verde); }
.c-nova { border-top-color: #1d4ed8; }
.c-analise { border-top-color: #92710c; }
.c-apuracao { border-top-color: #6b30c2; }
.c-aguardando { border-top-color: #9a560b; }
.c-resolvida { border-top-color: #176b39; }
.c-arquivada { border-top-color: #546069; }
.c-urgente { border-top-color: #b3261e; }

.painel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.metricao { font-size: 2rem; font-weight: 800; color: var(--verde); margin: .3rem 0; font-family: var(--serif); }
.mini-tab { width: 100%; border-collapse: collapse; }
.mini-tab td { padding: .35rem 0; border-bottom: 1px solid var(--borda); }
.mini-tab td.num { text-align: right; font-weight: 700; }

/* ---------- Cards genéricos ---------- */
.card { background: var(--surface); border: 1px solid var(--borda); border-radius: var(--raio); padding: 1.4rem; box-shadow: var(--sombra); margin-bottom: 1.4rem; }
.card--estreito { max-width: 480px; margin-left: auto; margin-right: auto; }
.card h2 { margin-top: 0; font-size: 1.15rem; }
.card h3 { font-size: 1rem; margin: 1.2rem 0 .4rem; color: var(--verde); }

/* ---------- Filtros ---------- */
.filtros__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .6rem 1rem; }
.filtros label { display: block; font-size: .82rem; font-weight: 600; color: var(--texto-suave); }
.filtros input, .filtros select { width: 100%; margin-top: .25rem; padding: .5rem; border: 1px solid var(--borda); border-radius: 8px; background: var(--surface); color: var(--texto); font: inherit; }
.filtros__acoes { display: flex; align-items: center; gap: .8rem; margin-top: 1rem; flex-wrap: wrap; }

/* ---------- Tabelas ---------- */
.tabela-wrap { overflow-x: auto; }
.tabela { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tabela th, .tabela td { padding: .6rem .7rem; text-align: left; border-bottom: 1px solid var(--borda); white-space: nowrap; }
.tabela th { color: var(--texto-suave); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
.tabela tbody tr:hover { background: var(--surface-2); }
.link-proto { font-weight: 700; text-decoration: none; }
.acoes-cel { display: flex; gap: .3rem; }
.inline-form { display: inline; }
.paginacao { display: flex; gap: .3rem; flex-wrap: wrap; }
.paginacao a { padding: .4rem .7rem; border: 1px solid var(--borda); border-radius: 8px; text-decoration: none; background: var(--surface); }
.paginacao a.is-ativo { background: var(--verde); color: #fff; border-color: var(--verde); }

/* ---------- Detalhe ---------- */
.detalhe-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.detalhe-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; align-items: start; }
.dados { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; }
.dados dt { font-weight: 700; color: var(--texto-suave); }
.dados dd { margin: 0; }
.texto-longo { background: var(--surface-2); padding: .8rem 1rem; border-radius: var(--raio-sm); white-space: pre-wrap; word-break: break-word; }
.anexos { list-style: none; padding: 0; margin: 0; }
.anexos li { padding: .4rem 0; border-bottom: 1px solid var(--borda); }
.historico { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--borda); }
.historico li { padding: .6rem 0 .6rem 1rem; position: relative; }
.historico li::before { content: ""; position: absolute; left: -7px; top: 1rem; width: 10px; height: 10px; border-radius: 50%; background: var(--verde); }
.historico__cab { display: flex; gap: .6rem; justify-content: space-between; flex-wrap: wrap; }
.historico__desc { color: var(--texto-suave); font-size: .9rem; margin-top: .2rem; }

/* ---------- Responsivo ---------- */
@media (max-width: 860px) {
  .grid-2, .detalhe-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .adm-shell { flex-direction: column; }
  .adm-side { width: 100%; height: auto; position: static; flex-direction: column; }
  .adm-menu { flex-direction: row; flex-wrap: wrap; padding: .4rem; }
  .adm-menu a { border-left: 0; border-radius: 8px; padding: .5rem .8rem; }
  .brand__txt small { display: none; }
  .hero h1 { font-size: 1.6rem; }
}
