/* marmo2 — estilo mobile-first. Tudo pensado primeiro para telefone. */
:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #17202e;
  --muted: #64748b;
  --line: #e4e8ee;
  --accent: #2f7d6e;
  --accent-ink: #ffffff;
  --accent-soft: #e6f2ef;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --warn: #b45309;
  --ok: #15803d;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 6px 20px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  padding-bottom: 76px; /* espaço p/ a barra inferior mobile */
}

a { color: inherit; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; }
h1 { font-size: 1.4rem; }
h2 { font-size: 1.1rem; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 12px 16px;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.topbar .brand-badge {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 1.1rem;
  background: var(--accent-soft); border: 1px solid var(--line);
}
.topbar .brand-name { font-weight: 700; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .brand-sub { font-size: .72rem; color: var(--muted); }
.topbar .spacer { flex: 1; }
.topbar .top-links { display: none; gap: 4px; }
.topbar .top-links a {
  text-decoration: none; color: var(--muted); font-size: .85rem; font-weight: 600;
  padding: 8px 12px; border-radius: 8px;
}
.topbar .top-links a.is-active { color: var(--accent); background: var(--accent-soft); }

/* ---------- Bottom nav (mobile) ---------- */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
}
.bottomnav a {
  flex: 1; text-align: center; text-decoration: none; color: var(--muted);
  font-size: .68rem; font-weight: 600; padding: 6px 2px; border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.bottomnav a.is-active { color: var(--accent); }
.bottomnav svg { width: 22px; height: 22px; }

/* ---------- Container ---------- */
.container { max-width: 960px; margin: 0 auto; padding: 16px; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px;
}
.card + .card { margin-top: 14px; }

.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat .label { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.stat .value { font-size: 1.3rem; font-weight: 800; margin-top: 4px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 0 18px; border-radius: 11px; font-size: .95rem; font-weight: 700;
  text-decoration: none; cursor: pointer; border: 1px solid transparent; background: var(--surface-2);
  color: var(--ink); -webkit-tap-highlight-color: transparent;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-outline { background: var(--surface); border-color: var(--line); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-block { width: 100%; }
.btn:active { transform: translateY(1px); }

/* ---------- Forms ---------- */
label { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
input, select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; font-size: 16px; /* 16px evita zoom no iOS */
  border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--ink);
  font-family: inherit;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field { margin-bottom: 12px; }
.field-row { display: grid; gap: 10px; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.badge-rascunho { background: #eef2f7; color: #475569; }
.badge-enviado { background: #e0edff; color: #1d4ed8; }
.badge-aprovado { background: #e3f5e9; color: var(--ok); }
.badge-recusado { background: var(--danger-soft); color: var(--danger); }

/* ---------- Listas ---------- */
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line);
  text-decoration: none; color: inherit;
}
.list-item:last-child { border-bottom: none; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 700; }
.list-item .li-sub { font-size: .82rem; color: var(--muted); }
.list-item .li-value { font-weight: 800; white-space: nowrap; }

.flash-wrap { max-width: 960px; margin: 0 auto; padding: 10px 16px 0; }
.flash { padding: 11px 14px; border-radius: 11px; font-size: .88rem; font-weight: 600; margin-bottom: 8px; }
.flash-success { background: #e3f5e9; color: var(--ok); }
.flash-error { background: var(--danger-soft); color: var(--danger); }
.flash-info { background: var(--accent-soft); color: var(--accent); }

.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.page-head h1 { margin: 0; }
.page-head .spacer { flex: 1; }
.muted { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }

/* ---------- Tabela ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.data th { text-align: left; font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line); }
table.data td { padding: 9px 8px; border-bottom: 1px solid var(--line); }

/* ---------- Desktop ---------- */
@media (min-width: 760px) {
  body { padding-bottom: 0; }
  .topbar .top-links { display: flex; }
  .bottomnav { display: none; }
  .grid-2 { grid-template-columns: repeat(4, 1fr); }
  .field-row { grid-template-columns: 1fr 1fr; }
}
