:root {
  --bg: #f5f7f6;
  --surface: #ffffff;
  --ink: #17231f;
  --muted: #5f6f69;
  --line: #dde4e1;
  --brand: #1f6b4a;
  --brand-ink: #ffffff;
  --brand-soft: #e4f1ea;
  --accent: #b8860b;
  --ok: #1f7a4d;       --ok-bg: #e2f4ea;
  --aviso: #8a6d00;    --aviso-bg: #fff6d6;
  --atencao: #b45309;  --atencao-bg: #ffe9d1;
  --urgente: #b42318;  --urgente-bg: #fde4e1;
  --neutro: #475467;   --neutro-bg: #eaecf0;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 20, .06), 0 1px 3px rgba(16, 24, 20, .05);
  font-size: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; padding-top: 22px; padding-bottom: 40px; }
.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: #14513a; }
h1 { font-size: 1.65rem; line-height: 1.2; margin: .2em 0 .5em; }
h2 { font-size: 1.12rem; margin: 0 0 .7em; }
h3 { font-size: .98rem; margin: 1.1em 0 .4em; }
p { margin: .5em 0; }
small, .small { font-size: .84em; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.late { color: var(--urgente); font-weight: 600; }

/* cabeçalho */
.top { background: var(--brand); color: var(--brand-ink); box-shadow: var(--shadow); position: sticky; top: 0; z-index: 20; }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 10px 0; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { width: 38px; height: 38px; border-radius: 9px; background: #fff; color: var(--brand); display: grid; place-items: center; font-weight: 800; font-size: 1.2rem; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.15; }
.brand-txt small { opacity: .8; font-size: .75rem; }
.nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav a { color: #fff; text-decoration: none; padding: 7px 11px; border-radius: 7px; font-size: .92rem; }
.nav a:hover, .nav a.on { background: rgba(255, 255, 255, .17); }
.nav a.btn-login { background: #fff; color: var(--brand); font-weight: 600; }
.nav a.lang { border: 1px solid rgba(255, 255, 255, .45); font-size: .8rem; }
.nav a.user { font-weight: 600; }

.foot { border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: .82rem; padding: 14px 0; }
.foot .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* cartões e layout */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.card.empty { text-align: center; color: var(--muted); padding: 34px; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.cols.wide-left { grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); }
.cols > .card { margin-bottom: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; margin-bottom: 18px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.page-head h1 { margin: 0; }
.count { font-weight: 500; color: var(--muted); font-size: .6em; background: var(--neutro-bg); padding: 2px 9px; border-radius: 99px; vertical-align: middle; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumb { margin: 0 0 4px; font-size: .9rem; }
.note { color: var(--muted); font-size: .85rem; margin-top: 16px; }

/* hero e estatísticas */
.hero { background: linear-gradient(135deg, #1f6b4a 0%, #174f38 100%); color: #fff; border-radius: 14px; padding: 28px 28px 22px; margin-bottom: 20px; }
.hero h1 { margin-top: 0; font-size: 1.85rem; }
.hero p { max-width: 62ch; opacity: .93; }
.stats { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.stat { background: rgba(255, 255, 255, .13); border-radius: 10px; padding: 10px 18px; min-width: 120px; }
.stat b { display: block; font-size: 1.7rem; line-height: 1.1; }
.stat span { font-size: .8rem; opacity: .9; }

/* filtros e botões */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filters input[type=search] { flex: 1 1 260px; }
input, select, textarea, button { font: inherit; }
input[type=text], input[type=search], input[type=email], input[type=password], input[type=date], input[type=number], input[type=url], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #c3cdc8; border-radius: 8px; background: #fff; color: var(--ink);
}
.filters input, .filters select { width: auto; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid #5fb28b; outline-offset: 1px; }
textarea { resize: vertical; }
.btn { display: inline-block; background: var(--brand); color: #fff; border: 1px solid var(--brand); padding: 8px 15px; border-radius: 8px; text-decoration: none; cursor: pointer; font-weight: 600; font-size: .92rem; }
.btn:hover { background: #17573c; color: #fff; }
.btn.ghost { background: transparent; color: var(--brand); }
.btn.ghost:hover { background: var(--brand-soft); color: var(--brand); }
.btn.small { padding: 5px 11px; font-size: .84rem; }
button.link { background: none; border: 0; color: var(--brand); cursor: pointer; padding: 2px 4px; text-decoration: underline; font-size: .86rem; }
button.link.danger { color: var(--urgente); text-decoration: none; }
form.inline { display: inline; }
.inline select { width: auto; padding: 4px 6px; font-size: .86rem; }

/* formulários */
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack label, label { display: flex; flex-direction: column; gap: 4px; font-size: .88rem; font-weight: 600; color: #2b3a35; }
label small { font-weight: 400; color: var(--muted); }
label.check { flex-direction: row; align-items: center; font-weight: 400; gap: 8px; }
label.check input { width: auto; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin: 0 0 6px; display: flex; flex-direction: column; gap: 12px; }
legend { font-weight: 700; padding: 0 8px; color: var(--brand); }
.f2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.f3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.form-wide { max-width: 980px; }
.row-form { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.row-form input[type=text] { flex: 1 1 260px; width: auto; }
.row-form input[type=date] { width: auto; }
details.add { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 10px; }
details.add > summary { cursor: pointer; font-weight: 600; color: var(--brand); }
details.add form { margin-top: 12px; }
.inline-details { display: inline-block; }
.inline-details summary { cursor: pointer; color: var(--brand); font-size: .86rem; text-decoration: underline; }
.inline-pass { display: flex; gap: 6px; margin-top: 6px; }
.inline-pass input { width: 180px; }
.auth { max-width: 420px; margin: 40px auto; }
.auth h1 { font-size: 1.4rem; }
.auth .btn { align-self: flex-start; }

/* mensagens */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; font-size: .92rem; }
.f-ok { background: var(--ok-bg); border-color: #a9dcc0; color: #14532d; }
.f-err { background: var(--urgente-bg); border-color: #f4b6ae; color: #7a1a12; }
.alertbar { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 14px; }

/* tabelas */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #f1f5f3; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid #eef2f0; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcfb; }
tr.done td { opacity: .6; }
td.empty { text-align: center; color: var(--muted); padding: 28px; }
.card:not(.flush) table { margin-top: 4px; }

/* selos, etiquetas e chips */
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .76rem; font-weight: 700; white-space: nowrap; }
.e-em_vigor, .n-ok { background: var(--ok-bg); color: var(--ok); }
.e-em_revisao, .e-em_renovacao, .n-aviso { background: var(--aviso-bg); color: var(--aviso); }
.n-atencao { background: var(--atencao-bg); color: var(--atencao); }
.n-urgente, .n-expirado, .e-expirado, .e-denunciado { background: var(--urgente-bg); color: var(--urgente); }
.e-desconhecido, .n-desconhecido { background: #e8e4f8; color: #4b3a96; }
.e-rascunho, .n-encerrado { background: var(--neutro-bg); color: var(--neutro); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: .74rem; background: var(--neutro-bg); color: var(--neutro); margin: 1px 2px 1px 0; }
.tag.warn { background: var(--atencao-bg); color: var(--atencao); }
.tag.bad { background: var(--urgente-bg); color: var(--urgente); }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chip { background: var(--brand-soft); color: #14513a; border-radius: 99px; padding: 2px 10px; font-size: .78rem; }

/* cartões de acordo */
.mou-card { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: inherit; margin: 0; transition: border-color .15s, box-shadow .15s; }
.mou-card:hover { border-color: var(--brand); box-shadow: 0 3px 10px rgba(31, 107, 74, .14); color: inherit; }
.mou-card h3 { margin: 4px 0 0; font-size: 1.04rem; }
.mc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.mc-title { color: var(--muted); font-size: .86rem; margin: 0; }
.mc-dates { font-size: .84rem; margin: 6px 0 0; }
.kind { font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }

/* ficha */
.d-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.d-head h1 { margin: 2px 0 2px; }
.d-state { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.sub { color: var(--muted); margin: 0; max-width: 70ch; }
dl { margin: 0; display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px 14px; }
dt { color: var(--muted); font-size: .84rem; font-weight: 600; }
dd { margin: 0; }
.internal { background: #fffbea; border: 1px solid #f1e3a3; border-radius: 8px; padding: 8px 12px; font-size: .88rem; }

/* painel */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); display: block; }
a.kpi:hover { border-color: var(--brand); color: var(--ink); }
.kpi b { display: block; font-size: 1.9rem; line-height: 1; margin-bottom: 4px; }
.kpi span { font-size: .8rem; color: var(--muted); }
.kpi.warn { border-left: 4px solid var(--atencao); }
.kpi.warn b { color: var(--atencao); }
.kpi.bad { border-left: 4px solid var(--urgente); }
.kpi.bad b { color: var(--urgente); }

/* listas */
ul.timeline, ul.plist, ul.docs, ul.hist { list-style: none; margin: 0; padding: 0; }
.timeline li, .hist li { display: flex; gap: 14px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid #eef2f0; }
.timeline li:last-child, .hist li:last-child, .plist li:last-child, .docs li:last-child { border-bottom: 0; }
.tl-date { min-width: 118px; color: var(--muted); font-size: .84rem; }
.tl-body { flex: 1; }
.plist li, .docs li { padding: 8px 0; border-bottom: 1px solid #eef2f0; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; justify-content: space-between; }
.plist li.done > span { text-decoration: line-through; color: var(--muted); }
.docs li { justify-content: flex-start; }
.hist li { font-size: .86rem; }
.tabs { display: flex; gap: 4px; }
.tabs a { padding: 5px 12px; border-radius: 99px; text-decoration: none; background: var(--neutro-bg); color: var(--neutro); font-size: .85rem; }
.tabs a.on { background: var(--brand); color: #fff; }

/* gráfico */
.gantt { width: 100%; height: auto; display: block; }
.gantt text { font: 11px system-ui, sans-serif; fill: var(--muted); }
.gantt .g-year { font-weight: 700; }
.gantt .g-lbl { fill: var(--ink); font-size: 12px; }
.gantt .g-grid { stroke: #e3e9e6; stroke-width: 1; }
.gantt .g-today { stroke: var(--urgente); stroke-width: 1.5; stroke-dasharray: 4 3; }
.gantt .g-todaylbl { fill: var(--urgente); font-weight: 700; }
.gantt .g-bar { fill: #7fc4a0; }
.gantt .g-bar.n-ok { fill: #6dbb90; }
.gantt .g-bar.n-aviso { fill: #e7c547; }
.gantt .g-bar.n-atencao { fill: #f0a050; }
.gantt .g-bar.n-urgente, .gantt .g-bar.n-expirado { fill: #e5655a; }
.gantt .g-bar.n-encerrado { fill: #c3c9cf; }
.gantt .g-bar.n-desconhecido, .gantt .g-unk { fill: #b9acec; }
.legend { font-size: .8rem; color: var(--muted); display: flex; gap: 6px 14px; flex-wrap: wrap; align-items: center; margin: 8px 0 0; }
.lg { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.lg.n-ok { background: #6dbb90; } .lg.n-aviso { background: #e7c547; } .lg.n-atencao { background: #f0a050; }
.lg.n-urgente { background: #e5655a; } .lg.n-desconhecido { background: #b9acec; }

/* responsivo */
@media (max-width: 860px) {
  .cols, .cols.wide-left { grid-template-columns: 1fr; }
  .f3 { grid-template-columns: 1fr; }
  .f2 { grid-template-columns: 1fr; }
  dl { grid-template-columns: 1fr; gap: 2px; }
  dt { margin-top: 8px; }
  .d-state { align-items: flex-start; }
  .nav a { padding: 6px 8px; }
  .hero { padding: 20px; }
  .timeline li { flex-wrap: wrap; gap: 4px 12px; }
  .tl-date { min-width: 0; }
}
@media print {
  .top, .foot, .actions, .filters, .btn, details.add { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
}
