/* Estou Aqui — base visual (branco e cinza). Variáveis de destaque vêm de theme.php. */
:root {
  --bg: #ffffff;
  --surface: #f5f6f7;
  --surface-2: #eceef0;
  --border: #e1e4e8;
  --border-strong: #c4c9d0;
  --text: #1c1f23;
  --muted: #586070;
  --accent: #2b2f36;
  --accent-hover: #23262b;
  --accent-contrast: #ffffff;
  --accent-soft: rgba(43, 47, 54, 0.08);
  --ok: #17653f;
  --ok-bg: #e5f3ec;
  --warn: #7f4b00;
  --warn-bg: #fff1d6;
  --danger: #a3261f;
  --danger-bg: #fcebea;
  --info: #2a4660;
  --info-bg: #e8eff5;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 6px 20px rgba(16, 24, 40, 0.07);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --header-h: 56px;
  --clock-h: 30px;
  --nav-h: 62px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font: 16px/1.55 var(--font);
  color: var(--text);
  background: var(--bg);
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
}
img, svg, canvas, video { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
a { color: var(--text); text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--text); }
code, .code { font-family: var(--mono); font-size: .92em; background: var(--surface); padding: .1em .4em; border-radius: 6px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }
ul.plain, ol.plain { list-style: none; padding: 0; margin: 0 0 1em; }
ul.plain li { padding: .25rem 0; }

:focus-visible { outline: 3px solid #1c1f23; outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 560px; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.mono { font-family: var(--mono); }
.ic { width: 1.25em; height: 1.25em; flex: 0 0 auto; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.2em; }
.ic-lg { width: 1.75em; height: 1.75em; }

/* ----- botões ----- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 46px; padding: .6rem 1.15rem;
  border-radius: var(--radius-sm); border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-contrast);
  font: 600 1rem/1.2 var(--font); text-decoration: none; cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-ghost { background: #fff; color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface); border-color: var(--text); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #8a1f19; border-color: #8a1f19; }
.btn-danger-ghost { background: #fff; color: var(--danger); border-color: #e3b5b1; }
.btn-danger-ghost:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn-sm { min-height: 38px; padding: .35rem .85rem; font-size: .92rem; }
.btn-block { width: 100%; }
.btn-icon { min-width: 46px; padding: .6rem; }
.btn-link { background: none; border: 0; padding: 0; min-height: 0; color: var(--text); text-decoration: underline; font: inherit; cursor: pointer; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1rem 0 0; }

/* ----- formulários ----- */
label { display: block; font-weight: 600; margin: 1rem 0 .35rem; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  width: 100%; min-height: 46px; padding: .65rem .85rem;
  font: 1rem/1.3 var(--font); color: var(--text); background: #fff;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  appearance: none; -webkit-appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, #586070 50%), linear-gradient(135deg, #586070 50%, transparent 50%); background-position: calc(100% - 20px) 55%, calc(100% - 14px) 55%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 2.2rem; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #1c1f23; outline-offset: 1px; }
input[readonly] { background: var(--surface); }
input::placeholder { color: #8a919d; }
.form label:first-child { margin-top: 0; }
.hint { color: var(--muted); font-size: .875rem; margin: .35rem 0 0; }
.field-error { color: var(--danger); font-size: .9rem; font-weight: 600; margin: .35rem 0 0; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .6rem 1rem 1rem; margin: 1.25rem 0 0; min-width: 0; }
legend { font-weight: 700; padding: 0 .4rem; }
.check, .radio { display: flex; gap: .7rem; align-items: flex-start; font-weight: 500; margin: .75rem 0 0; cursor: pointer; }
.check input, .radio input { width: 22px; height: 22px; margin: .15rem 0 0; flex: 0 0 auto; accent-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .4rem; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; margin: 0; }
.chip span { display: inline-flex; align-items: center; min-height: 44px; padding: .45rem 1rem; border: 1px solid var(--border-strong); border-radius: 999px; font-weight: 600; background: #fff; }
.chip input:checked + span { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.chip input:focus-visible + span { outline: 3px solid #1c1f23; outline-offset: 2px; }
.input-row { display: flex; gap: .5rem; }
.input-row > input { flex: 1 1 auto; min-width: 0; }
.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ----- cartões e avisos ----- */
.card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); margin: 0 0 1rem; }
.card > :last-child { margin-bottom: 0; }
.card-flat { box-shadow: none; background: var(--surface); }
.callout { border-radius: var(--radius-sm); padding: .9rem 1rem; margin: 1rem 0; border: 1px solid transparent; }
.callout > :last-child { margin-bottom: 0; }
.callout h2, .callout h3 { font-size: 1rem; margin-bottom: .3rem; }
.callout-info { background: var(--info-bg); border-color: #c8d9e8; color: var(--info); }
.callout-warn { background: var(--warn-bg); border-color: #f0d9a8; color: var(--warn); }
.callout-fail { background: var(--danger-bg); border-color: #efc3bf; color: var(--danger); }
.callout-ok { background: var(--ok-bg); border-color: #bfe0cd; color: var(--ok); }
.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .15rem .65rem; border-radius: 999px; font-size: .8rem; font-weight: 700; background: var(--surface-2); color: var(--text); white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-fail { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge .dot { width: .55rem; height: .55rem; border-radius: 50%; background: currentColor; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }
.empty .ic { width: 2.5em; height: 2.5em; stroke-width: 1.5; margin-bottom: .5rem; }

/* ----- tabelas (viram cartões no celular, sem rolagem horizontal) ----- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: .6rem .75rem; border-bottom: 1px solid var(--border); }
.table td { padding: .7rem .75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
@media (max-width: 760px) {
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table thead { display: none; }
  .table tr { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .35rem .75rem; margin-bottom: .75rem; background: #fff; }
  .table td { border: 0; padding: .35rem 0; display: flex; gap: .75rem; justify-content: space-between; }
  .table td::before { content: attr(data-label); color: var(--muted); font-size: .85rem; flex: 0 0 38%; }
  .table td.actions-cell { justify-content: flex-start; flex-wrap: wrap; }
  .table td.actions-cell::before { display: none; }
}

/* ----- avisos flutuantes e janelas ----- */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 14px + var(--sab)); z-index: 3000; display: flex; flex-direction: column; gap: .5rem; width: min(92vw, 440px); pointer-events: none; }
body.no-nav .toasts { bottom: calc(16px + var(--sab)); }
.toast { pointer-events: auto; background: #1c1f23; color: #fff; padding: .8rem 1rem; border-radius: var(--radius-sm); box-shadow: var(--shadow); display: flex; gap: .6rem; align-items: flex-start; animation: toast-in .2s ease-out; }
.toast-error { background: var(--danger); }
.toast-ok { background: var(--ok); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
dialog.dlg { border: 0; border-radius: var(--radius); padding: 0; width: min(92vw, 460px); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); color: var(--text); }
dialog.dlg::backdrop { background: rgba(16, 20, 26, .55); }
.dlg-body { padding: 1.25rem; }
.dlg-body h2 { margin-bottom: .5rem; }
.dlg-foot { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: flex-end; padding: 0 1.25rem 1.25rem; }
.spinner { width: 1.1em; height: 1.1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; vertical-align: -0.15em; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; justify-content: center; gap: .6rem; padding: 3rem 1rem; color: var(--muted); }

/* ----- cabeçalho e rodapé institucionais ----- */
.top { position: fixed; z-index: 1000; top: 0; left: 0; right: 0; height: calc(var(--header-h) + var(--sat)); padding-top: var(--sat); background: rgba(255, 255, 255, .96); border-bottom: 1px solid var(--border); backdrop-filter: saturate(1.4) blur(8px); }
.top .wrap { height: var(--header-h); display: flex; align-items: center; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 800; font-size: 1.1rem; text-decoration: none; color: var(--text); letter-spacing: -0.02em; }
.brand .ic { width: 1.45em; height: 1.45em; }
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 2rem 0 calc(2rem + var(--sab)); margin-top: 3rem; color: var(--muted); font-size: .9rem; }
.site-footer .foot-brand { display: flex; align-items: center; gap: .5rem; color: var(--text); margin-bottom: .75rem; }
.site-footer p { margin: 0 0 .5rem; }
.site-footer a { color: var(--muted); }

@media print {
  .top, .site-footer, .toasts, nav.bottom-nav, .clockbar { display: none !important; }
  body { padding: 0 !important; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
