:root {
  --bg: #f4f6f9; --card: #fff; --text: #1f2933; --muted: #6b7785; --line: #e3e8ef;
  --primary: #003C57; --primary-2: #0b5878; --primary-soft: #e3edf2; --danger: #c62828; --ok: #2e7d32; --warn: #b26a00;
  --badge: #d32f2f; --side: #fff;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.erro { color: var(--danger); margin-top: 8px; }

.layout { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: var(--side); border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
nav { display: flex; flex-direction: column; gap: 2px; }
nav a { padding: 9px 10px; border-radius: 8px; color: var(--text); display: flex; align-items: center; gap: 6px; }
nav a:hover { background: var(--bg); text-decoration: none; }
nav a.ativo { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.badge { margin-left: auto; background: var(--badge); color: #fff; border-radius: 10px; padding: 0 7px; font-size: 11px; font-weight: 600; line-height: 18px; }
.badge:empty { display: none; }
.sync-box { margin-top: auto; padding: 8px; }
main { flex: 1; padding: 24px 32px; max-width: 1200px; min-width: 0; }

h1 { font-size: 24px; font-weight: 500; margin: 0 0 18px; }
h2 { font-size: 17px; font-weight: 600; margin: 0 0 12px; }
.topo { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.topo h1 { margin: 0; margin-right: auto; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 12px; }
.btn { border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 6px; padding: 7px 14px; cursor: pointer; font: inherit; font-weight: 500; }
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-2); }
.btn.danger { color: var(--danger); }
.btn.link { border: none; background: none; color: var(--primary); padding: 4px 6px; text-transform: uppercase; font-size: 12px; font-weight: 600; }
.btn.link:hover { text-decoration: underline; }
.btn.full { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }

input, select, textarea { font: inherit; border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; background: #fff; color: var(--text); width: 100%; }
textarea { min-height: 90px; resize: vertical; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
label input, label select, label textarea { margin-top: 4px; color: var(--text); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 0 14px; }
.busca { max-width: 360px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { border: none; background: none; padding: 9px 14px; cursor: pointer; font: inherit; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button.ativo { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.item { display: flex; gap: 12px; }
.item .chk { padding-top: 3px; }
.item .chk input { width: auto; }
.item-corpo { flex: 1; min-width: 0; }
.item-topo { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.item-titulo { font-weight: 600; }
.item-data { margin-left: auto; color: var(--muted); font-size: 13px; white-space: nowrap; }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 4px; background: #eef1f5; color: #4a5562; }
.tag.nova { background: #5d6b7a; color: #fff; }
.tag.tratada { background: #e5f4e7; color: var(--ok); }
.tag.descartada { background: #f3f3f3; color: #999; }
.tag.vencida { background: #fdecea; color: var(--danger); }
.tag.hoje { background: #fff4e0; color: var(--warn); }
.texto { white-space: pre-wrap; background: #fafbfc; border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; margin-top: 8px; max-height: 420px; overflow: auto; font-size: 13px; }
.texto.curto { max-height: 64px; overflow: hidden; position: relative; }
.acoes { display: flex; gap: 2px; flex-wrap: wrap; margin-top: 6px; margin-left: -6px; }
.num { font-family: Consolas, monospace; font-size: 13px; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tr.clicavel:hover td { background: #f8fafc; cursor: pointer; }

.timeline { border-left: 2px solid var(--line); margin-left: 6px; padding-left: 16px; }
.timeline .ev { position: relative; padding: 6px 0 10px; }
.timeline .ev::before { content: ""; position: absolute; left: -22px; top: 11px; width: 10px; height: 10px; border-radius: 50%; background: #c5cfdb; }
.timeline .ev.nova::before { background: var(--badge); }

.vazio { text-align: center; color: var(--muted); padding: 40px 0; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { text-align: center; }
.stat b { display: block; font-size: 26px; font-weight: 500; }

.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 50; overflow: auto; }
.modal-body { width: 100%; max-width: 560px; }
.modal-acoes { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.toast { position: fixed; bottom: 20px; right: 20px; background: #263238; color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 60; max-width: 420px; }
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 320px; }

@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  nav { flex-direction: row; flex-wrap: wrap; }
  main { padding: 16px; }
  .grid2, .grid3, .stats { grid-template-columns: 1fr; }
}

/* ---------- Marca Nascimento & Muniz ---------- */
/* Recorta a área útil do PNG quadrado (3240x3240; logo em 532..2708 x 836..2368). */
.marca {
  width: 100%;
  aspect-ratio: 2176 / 1532;
  background: url("/logo-nascimento-muniz.png") no-repeat;
  background-size: 148.9% auto;
  background-position: 50% 48.95%;
}
.marca-link { display: block; padding: 4px 18px 6px; margin-bottom: 14px; border-bottom: 1px solid var(--line); text-decoration: none !important; }
.marca-link .marca { max-width: 170px; margin: 0 auto; }
.sistema { text-align: center; color: var(--primary); font-size: 11px; font-weight: 600; letter-spacing: .35em; margin: 8px 0 10px; padding-left: .35em; }
.marca.grande { max-width: 220px; margin: 6px auto 0; }
.login { background: linear-gradient(160deg, var(--primary-soft), var(--bg) 55%); }
.login-card { width: 340px; padding: 28px 28px 22px; }
.login-card .sistema { margin-bottom: 22px; }
th { color: var(--primary); }
@media (max-width: 760px) {
  .marca-link { display: flex; align-items: center; gap: 12px; padding: 0 4px 10px; }
  .marca-link .marca { max-width: 90px; margin: 0; }
  .marca-link .sistema { margin: 0; }
}

/* ---------- Movimentações compactas ---------- */
.card-mov { padding: 12px 16px; }
.mov-topo { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.mov-topo .item-titulo { font-size: 14px; }
.movs { border-left: 2px solid var(--line); margin-left: 4px; }
.mov { display: grid; grid-template-columns: 118px 1fr; gap: 10px; align-items: baseline; padding: 3px 0 3px 12px; position: relative; font-size: 13px; line-height: 1.4; }
.mov::before { content: ""; position: absolute; left: -5px; top: 9px; width: 8px; height: 8px; border-radius: 50%; background: #c5cfdb; }
.mov.nova::before { background: var(--badge); }
.mov.nova .mov-nome { font-weight: 600; }
.mov:hover { background: #f8fafc; }
.mov-data { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mov-nome { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mov-compl { color: var(--muted); font-weight: 400; }
.mov-nome .tag { font-size: 10px; padding: 0 5px; }
.mov-mais { margin: 2px 0 0 8px; }
@media (max-width: 760px) { .mov { grid-template-columns: 1fr; gap: 0; } .mov-nome { white-space: normal; } }
