/* =====================================================================
   AMMA Sistema – design baseado nas Diretrizes de Interface da Apple
   Princípios: clareza, hierarquia por tipografia, cores semânticas
   (claro/escuro/contraste aumentado), alvos de toque ≥ 44 px no celular,
   barra lateral no computador → barra de abas no celular.
   Identidade: a régua tricolor (verde · ouro · azul) do papel timbrado.
   ===================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  color-scheme: light dark;

  /* marca (logomarca e papel timbrado) */
  --marca-verde: #14602e; --marca-verde-esc: #0c3f1e; --marca-ouro: #f0b429; --marca-azul: #0b57a4;

  /* superfícies */
  --bg: #f5f5f7; --card: #ffffff; --card-2: #fafafc; --el: #ffffff; --fld: #ffffff; --side-bg: #ececf1;
  --bar: rgba(250, 250, 252, .8); --bar-solid: #fafafc;

  /* texto */
  --txt: #1d1d1f; --txt2: #636366; --ph: #6e6e73;

  /* linhas e preenchimentos */
  --linha: #d2d2d7; --linha2: #e8e8ed; --borda-in: #848489;
  --fill: rgba(60, 60, 67, .07); --fill-2: rgba(60, 60, 67, .12); --sel: rgba(60, 60, 67, .12);

  /* destaque (ações) */
  --acc: #0062c0; --acc-h: #0053a6; --acc-a: #004a94; --acc-tx: #005cb2; --acc-bg: rgba(0, 98, 192, .1); --ring: rgba(0, 98, 192, .3); --on-acc: #ffffff;

  /* estados (cada cor significa uma coisa só) */
  --ok: #1b6e3a; --ok-bg: #e3f4e8; --ok-c: #2f8a4b;
  --bad: #b3261e; --bad-bg: #fdecea; --bad-solid: #c4281f;
  --warn: #8a4b00; --warn-bg: #fff1dc; --warn-c: #e08a00;
  --neu: #515156; --neu-bg: #ececef;
  --c-rec: #2f8a4b; --c-des: #0b57a4;

  /* camadas */
  --scrim: rgba(0, 0, 0, .38); --toast-bg: #2b2b2e; --toast-tx: #ffffff;
  --sombra: 0 0 0 .5px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .04), 0 6px 16px rgba(0, 0, 0, .03);
  --sombra-pop: 0 0 0 .5px rgba(0, 0, 0, .12), 0 28px 80px rgba(0, 0, 0, .3);
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23636366' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
  --chev-x: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='7' fill='%23636366'/%3E%3Cpath d='M5.5 5.5l5 5M10.5 5.5l-5 5' stroke='white' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");

  /* medidas */
  --raio: 12px; --raio-c: 8px; --ctl: 34px; --side-w: 244px; --bar-min: 56px; --bar-h: 56px; --tab-h: 52px;
  --seg: env(safe-area-inset-bottom, 0px);
  --fonte: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);

  /* nomes antigos (as telas ainda usam) */
  --verde: var(--ok); --verde-cl: var(--ok-bg); --verde-esc: var(--marca-verde-esc); --verde-md: var(--ok-c);
  --verm: var(--bad); --verm-cl: var(--bad-bg); --ouro: var(--warn-c); --ouro-cl: var(--warn-bg);
  --azul: var(--acc-tx); --azul-cl: var(--acc-bg); --laranja: var(--warn); --laranja-cl: var(--warn-bg);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161618; --card: #202023; --card-2: #26262a; --el: #2b2b2f; --fld: #2b2b2f; --side-bg: #1b1b1e;
    --bar: rgba(32, 32, 35, .78); --bar-solid: #202023;
    --txt: #f5f5f7; --txt2: #a1a1a6; --ph: #9d9da3;
    --linha: #3a3a3f; --linha2: #2c2c30; --borda-in: #808086;
    --fill: rgba(255, 255, 255, .07); --fill-2: rgba(255, 255, 255, .12); --sel: rgba(255, 255, 255, .12);
    --acc: #0a6fdc; --acc-h: #0962c4; --acc-a: #0855a8; --acc-tx: #7ab8ff; --acc-bg: rgba(102, 170, 255, .16); --ring: rgba(102, 170, 255, .38);
    --ok: #62d684; --ok-bg: rgba(82, 209, 124, .16); --ok-c: #4cc16f;
    --bad: #ff9189; --bad-bg: rgba(255, 98, 89, .16); --bad-solid: #d92d20;
    --warn: #ffc15e; --warn-bg: rgba(255, 179, 64, .16); --warn-c: #ffb340;
    --neu: #b0b0b5; --neu-bg: rgba(142, 142, 147, .18);
    --c-rec: #4cc16f; --c-des: #5aa2ff;
    --scrim: rgba(0, 0, 0, .55); --toast-bg: #3a3a3e;
    --sombra: 0 0 0 .5px rgba(255, 255, 255, .08), 0 1px 2px rgba(0, 0, 0, .4);
    --sombra-pop: 0 0 0 .5px rgba(255, 255, 255, .14), 0 28px 80px rgba(0, 0, 0, .65);
    --chev-x: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='7' fill='%23a1a1a6'/%3E%3Cpath d='M5.5 5.5l5 5M10.5 5.5l-5 5' stroke='%23161618' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23a1a1a6' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
  }
}

/* contraste aumentado (ajuste do sistema) */
@media (prefers-contrast: more) {
  :root {
    --txt: #000000; --txt2: #3a3a3c; --ph: #48484a; --linha: #6e6e73; --linha2: #aeaeb2; --borda-in: #48484a;
    --acc: #004c99; --acc-h: #003d7a; --acc-tx: #004c99; --ok: #0d5128; --bad: #8f1c14; --warn: #6b3a00; --neu: #3a3a3c;
    --sombra: 0 0 0 1px var(--linha);
  }
}
@media (prefers-contrast: more) and (prefers-color-scheme: dark) {
  :root {
    --txt: #ffffff; --txt2: #d1d1d6; --ph: #c7c7cc; --linha: #98989d; --linha2: #636366; --borda-in: #aeaeb2;
    --acc: #0a5ec2; --acc-tx: #9ccaff; --ok: #8ae6a6; --bad: #ffb4ae; --warn: #ffd68a; --neu: #d1d1d6;
  }
}
/* transparência reduzida: barras sólidas */
@media (prefers-reduced-transparency: reduce) {
  :root { --bar: var(--bar-solid); }
  .topbar, .tabbar, .overlay { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
}

/* ---------- 2. Base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--fonte); font-size: 14px; line-height: 1.43; color: var(--txt); background: var(--bg); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; overscroll-behavior: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.012em; line-height: 1.2; }
h4 { font-size: 15px; }
p { margin: 0 0 10px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
a { color: var(--acc-tx); text-underline-offset: 2px; }
::selection { background: var(--acc-bg); }
::placeholder { color: var(--ph); opacity: 1; }
* { scrollbar-width: thin; scrollbar-color: var(--borda-in) transparent; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--acc-tx); outline-offset: 2px; border-radius: 6px; }
.hidden { display: none !important; }
.muted { color: var(--txt2); }
.mono { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.gap-sm { gap: 6px; } .gap-lg { gap: 20px; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; } .mt-lg { margin-top: 28px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 200; background: var(--acc); color: var(--on-acc); padding: 10px 16px; border-radius: 10px; font-weight: 600; text-decoration: none; transition: top .15s var(--ease); }
.skip:focus { top: 12px; outline-offset: 3px; }

/* régua tricolor do papel timbrado – assinatura da identidade */
.regua { display: block; height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--marca-verde) 0 40%, var(--marca-ouro) 40% 59%, var(--marca-azul) 59% 100%); }

.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- 3. Botões ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: var(--ctl); padding: 0 14px;
  border: 0; border-radius: var(--raio-c); background: var(--card); color: var(--txt); font-weight: 600; font-size: 14px; line-height: 1.2; white-space: nowrap; cursor: pointer; text-decoration: none;
  box-shadow: 0 0 0 1px var(--linha), 0 1px 1px rgba(0, 0, 0, .04); transition: background-color .12s, transform .12s var(--ease), box-shadow .12s;
}
@media (prefers-color-scheme: dark) { .btn { background: var(--el); } }
.btn:hover { background: var(--fill-2); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--acc); color: var(--on-acc); box-shadow: 0 1px 2px rgba(0, 0, 0, .18); }
.btn.primary:hover { background: var(--acc-h); }
.btn.primary:active { background: var(--acc-a); }
.btn.blue { background: var(--acc-bg); color: var(--acc-tx); box-shadow: none; }
.btn.blue:hover { background: var(--acc-bg); filter: brightness(.96); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); }
.btn.danger.solid { background: var(--bad-solid); color: #fff; box-shadow: none; }
.btn.danger.solid:hover { filter: brightness(.94); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--fill-2); }
.btn.sm { min-height: 28px; padding: 0 10px; font-size: 13px; border-radius: 7px; gap: 5px; }
.btn.block { width: 100%; }
.btn.icon-only { padding: 0; width: var(--ctl); }
.btn.sm.icon-only { width: 28px; }
.btn[disabled], .btn[aria-disabled=true] { opacity: .45; pointer-events: none; }
.btn:focus-visible { outline-offset: 2px; border-radius: var(--raio-c); }

/* ---------- 4. Formulários ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; min-width: 0; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--txt2); }
.field label .req { color: var(--bad); }
.inp, select.inp, textarea.inp {
  width: 100%; min-height: var(--ctl); padding: 0 11px; border: 0; border-radius: var(--raio-c); background: var(--fld); color: var(--txt);
  box-shadow: inset 0 0 0 1px var(--borda-in); outline: none; transition: box-shadow .12s;
}
textarea.inp { padding: 8px 11px; resize: vertical; min-height: 84px; line-height: 1.45; }
select.inp { -webkit-appearance: none; appearance: none; padding-right: 30px; background-image: var(--chev); background-repeat: no-repeat; background-position: right 10px center; background-size: 12px; cursor: pointer; }
.inp:focus, .inp:focus-visible { box-shadow: inset 0 0 0 1.5px var(--acc-tx), 0 0 0 4px var(--ring); outline: none; }
.inp:disabled { background: var(--fill); color: var(--txt2); cursor: not-allowed; }
.inp[aria-invalid=true] { box-shadow: inset 0 0 0 1.5px var(--bad); }
input[type=date].inp, input[type=month].inp { min-width: 0; }
input[type=checkbox], input[type=radio] { accent-color: var(--acc); width: 18px; height: 18px; margin: 0; flex: none; }
.hint { font-size: 12px; color: var(--txt2); }
.grid { display: grid; gap: 0 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; } .span3 { grid-column: span 3; } .span4 { grid-column: span 4; }
.check { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; padding-top: 22px; }
.check label { font-weight: 500; color: var(--txt); font-size: 14px; }
.check-inline { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; cursor: pointer; }

.search { position: relative; }
.search input { padding-left: 32px; width: 280px; }
.inp[type=search] { -webkit-appearance: none; appearance: none; }
.inp[type=search]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; height: 14px; width: 14px; cursor: pointer; background: var(--chev-x) center/14px no-repeat; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--txt2); pointer-events: none; }

/* controle segmentado (abas) */
.tabs, .tabs-mini { display: inline-flex; gap: 2px; padding: 2px; background: var(--fill-2); border-radius: 10px; max-width: 100%; overflow-x: auto; margin-bottom: 18px; scrollbar-width: none; }
.tabs::-webkit-scrollbar, .tabs-mini::-webkit-scrollbar { display: none; }
.tabs button, .tabs-mini button { flex: 1 0 auto; min-height: 30px; padding: 0 11px; border: 0; border-radius: 8px; background: transparent; color: var(--txt); font-weight: 500; cursor: pointer; white-space: nowrap; transition: background-color .15s, box-shadow .15s; }
.tabs button:hover:not(.on), .tabs-mini button:hover:not(.on) { background: var(--fill); }
.tabs button:focus-visible, .tabs-mini button:focus-visible { outline-offset: -2px; }
.tabs button.on, .tabs-mini button.on { background: var(--card); font-weight: 650; box-shadow: 0 1px 3px rgba(0, 0, 0, .14), 0 0 0 .5px rgba(0, 0, 0, .06); }
@media (prefers-color-scheme: dark) { .tabs button.on, .tabs-mini button.on { background: #5a5a5f; color: #fff; } }
.tabs-mini { display: flex; }

/* ---------- 5. Entrada (login) ---------- */
#root { height: 100%; }
#login { height: 100%; min-height: 560px; overflow: auto; display: grid; grid-template-columns: minmax(360px, 5fr) 6fr; background: var(--bg); }
.login-art {
  position: relative; overflow: hidden; color: #fff; padding: 56px 60px 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
  background: var(--marca-verde-esc);
}
.login-art::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .9; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 520' preserveAspectRatio='xMaxYMax slice'%3E%3Ccircle cx='530' cy='338' r='66' fill='%23f0b429' fill-opacity='.4'/%3E%3Cpath d='M0 360C120 292 250 282 380 326S548 392 600 366V520H0Z' fill='%2314602e' fill-opacity='.7'/%3E%3Cpath d='M0 430C110 392 210 404 310 436S500 476 600 430V520H0Z' fill='%230b57a4' fill-opacity='.55'/%3E%3C/svg%3E") right bottom / cover no-repeat; }
.login-art > * { position: relative; z-index: 1; }
.login-art .logo-pill { display: inline-flex; background: #fff; border-radius: 20px; padding: 10px 18px; box-shadow: 0 10px 30px rgba(0, 0, 0, .28); }
.login-art .logo-pill img { height: 96px; display: block; }
.login-art h1 { font-size: clamp(28px, 3vw, 38px); line-height: 1.12; letter-spacing: -.025em; font-weight: 700; max-width: 540px; }
.login-art p { max-width: 480px; font-size: 16px; line-height: 1.55; color: rgba(255, 255, 255, .88); margin-top: 16px; }
.login-art .badges { display: grid; gap: 10px; font-size: 14.5px; color: rgba(255, 255, 255, .92); }
.login-art .badges span { display: flex; align-items: center; gap: 10px; }
.login-art .badges span::before { content: ""; width: 18px; height: 18px; flex: none; border-radius: 50%; background: rgba(255, 255, 255, .16) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center/11px no-repeat; }
.login-art .regua { width: 100%; max-width: 420px; height: 5px; }
.login-form-wrap { display: flex; justify-content: center; padding: 40px 32px; overflow: auto; }
.login-card { width: 100%; max-width: 396px; margin: auto; }
.login-card h2 { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 6px; }
.login-card .sub { color: var(--txt2); margin-bottom: 24px; font-size: 15px; }
.login-card .inp { min-height: 44px; font-size: 16px; border-radius: 10px; }
.login-card .btn.primary { min-height: 46px; font-size: 16px; border-radius: 10px; width: 100%; margin-top: 4px; }
.login-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; font-size: 14px; }
.login-links a { font-weight: 600; text-decoration: none; padding: 6px 0; }
.login-links a:hover { text-decoration: underline; }
.login-foot { margin-top: 32px; font-size: 12.5px; color: var(--txt2); text-align: center; line-height: 1.5; }
.mlogo-wrap { display: none; }

/* ---------- 6. Estrutura do aplicativo ---------- */
#app { position: relative; display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); height: 100%; transition: grid-template-columns .22s var(--ease); }
#app::before { content: ""; position: fixed; left: 0; right: 0; top: 0; height: 3px; z-index: 60; pointer-events: none; background: linear-gradient(90deg, var(--marca-verde) 0 40%, var(--marca-ouro) 40% 59%, var(--marca-azul) 59% 100%); }
#app.side-off { --side-w: 0px; }
.side { background: var(--side-bg); display: flex; flex-direction: column; overflow: hidden; min-width: 0; border-right: 1px solid var(--linha2); }
#app.side-off .side { visibility: hidden; }
.side .brand { display: flex; align-items: center; gap: 11px; padding: 20px 16px 12px; }
.side .brand .logo-pill { flex: none; width: 52px; height: 52px; display: grid; place-items: center; background: #fff; border-radius: 13px; box-shadow: 0 0 0 .5px rgba(0, 0, 0, .12), 0 2px 6px rgba(0, 0, 0, .08); }
.side .brand img { width: 46px; height: 46px; object-fit: contain; display: block; }
.side .brand .nm { font-weight: 700; font-size: 16px; letter-spacing: -.01em; line-height: 1.15; }
.side .brand .sb { font-size: 12px; color: var(--txt2); line-height: 1.25; margin-top: 2px; }
.side nav { flex: 1; overflow-y: auto; padding: 4px 10px 12px; }
.side .grp { font-size: 11.5px; font-weight: 600; color: var(--txt2); padding: 16px 10px 5px; }
.side a.nav { display: flex; align-items: center; gap: 10px; min-height: 32px; padding: 0 10px; margin-bottom: 1px; border-radius: 8px; color: var(--txt); text-decoration: none; cursor: pointer; font-weight: 500; font-size: 13.5px; transition: background-color .1s; }
.side a.nav .icon { width: 18px; height: 18px; color: var(--acc-tx); }
.side a.nav:hover { background: var(--fill); }
.side a.nav.on { background: var(--sel); font-weight: 650; }
.side a.nav:focus-visible { outline-offset: -2px; }
.side a.nav .badge, .tabbar .badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center; background: var(--bad-solid); color: #fff; font-size: 11.5px; font-weight: 700; border-radius: 999px; font-variant-numeric: tabular-nums; }
.side .user { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--linha2); }
.side .avatar { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--acc-bg); color: var(--acc-tx); font-weight: 700; }
.side .user .who { min-width: 0; flex: 1; }
.side .user .nm { font-weight: 600; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side .user .pf { font-size: 12px; color: var(--txt2); line-height: 1.25; }

.main { position: relative; min-width: 0; height: 100%; overflow: hidden; }
.topbar {
  position: absolute; z-index: 5; left: 0; right: 0; top: 0; min-height: var(--bar-min); display: flex; align-items: center; gap: 12px; padding: 4px 24px; padding-top: 7px;
  background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(22px); backdrop-filter: saturate(180%) blur(22px); border-bottom: 1px solid transparent; transition: border-color .15s;
}
.topbar.scrolled { border-bottom-color: var(--linha); }
.topbar .ttl { min-width: 0; flex: 1; }
.topbar h1 { font-size: 17px; font-weight: 650; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; outline: none; }
.topbar .sub { color: var(--txt2); font-size: 12.5px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar #vact { display: flex; align-items: center; gap: 8px; flex: none; }
#btnSide { flex: none; }
#view { position: absolute; inset: 0; overflow: auto; padding: calc(var(--bar-h) + 18px) 28px 44px; scroll-padding-top: calc(var(--bar-h) + 12px); outline: none; }
.fatal { padding: 60px 20px; text-align: center; }

.tabbar { display: none; }

/* ---------- 7. Cartões, tabelas, listas ---------- */
.card { background: var(--card); border-radius: var(--raio); box-shadow: var(--sombra); }
.card .hd { padding: 14px 18px; border-bottom: 1px solid var(--linha2); display: flex; align-items: center; gap: 12px; min-height: 52px; }
.card .hd h3 { font-size: 15px; }
.card .bd { padding: 16px 18px; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar h3 { font-size: 17px; }
.tbl-wrap { overflow: auto; border-radius: var(--raio); -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--card); }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--txt2); background: var(--card-2); padding: 9px 14px; border-bottom: 1px solid var(--linha); position: sticky; top: 0; z-index: 1; white-space: nowrap; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--linha2); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--fill); }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:focus-visible { outline-offset: -2px; }
.tbl td.act { text-align: right; white-space: nowrap; }
.tbl tfoot td { font-weight: 650; background: var(--card-2); border-top: 1px solid var(--linha); border-bottom: 0; }
.tbl tr.row-erro td { background: var(--bad-bg); }
.empty { padding: 48px 20px; text-align: center; color: var(--txt2); }
.empty b { display: block; color: var(--txt); font-size: 16px; font-weight: 650; margin-bottom: 4px; }

.pill { display: inline-flex; align-items: center; min-height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--neu-bg); color: var(--neu); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.info { background: var(--acc-bg); color: var(--acc-tx); }
.pill.neutral { background: var(--neu-bg); color: var(--neu); }

.alert { display: flex; gap: 10px; padding: 12px 14px; margin-bottom: 16px; border-radius: 12px; line-height: 1.45; background: var(--acc-bg); color: var(--txt); }
.alert .icon { width: 18px; height: 18px; margin-top: 1px; }
.alert.info .icon { color: var(--acc-tx); }
.alert.warn { background: var(--warn-bg); } .alert.warn .icon { color: var(--warn); }
.alert.bad { background: var(--bad-bg); } .alert.bad .icon { color: var(--bad); }
.alert.ok { background: var(--ok-bg); } .alert.ok .icon { color: var(--ok); }
.alert a { font-weight: 600; }

/* lista agrupada (portal e telas simples) */
.lista { background: var(--card); border-radius: var(--raio); box-shadow: var(--sombra); overflow: hidden; }
.lista .li { display: flex; align-items: center; gap: 14px; padding: 12px 18px; min-height: 56px; border-bottom: 1px solid var(--linha2); }
.lista .li:last-child { border-bottom: 0; }
.lista .li .tx { flex: 1; min-width: 0; }
.lista .li .tx b { display: block; font-weight: 600; }
.lista .li .tx span { display: block; font-size: 12.5px; color: var(--txt2); }
.lista .li .vl { font-weight: 650; font-variant-numeric: tabular-nums; }
.lista a.li { color: inherit; text-decoration: none; cursor: pointer; }
.lista a.li:hover { background: var(--fill); }
.lista a.li:focus-visible { outline-offset: -2px; }
.lista .li > .icon { width: 20px; height: 20px; color: var(--acc-tx); }
.lista .li > .icon.chev { width: 14px; height: 14px; color: var(--txt2); }
.lista .li .badge { min-width: 20px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center; background: var(--bad-solid); color: #fff; font-size: 11.5px; font-weight: 700; border-radius: 999px; }
.avatar-m { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--acc-bg); color: var(--acc-tx); font-weight: 700; }

/* painel */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { padding: 16px 18px; }
.kpi .lb { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--txt2); }
.kpi .lb::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--acc)); flex: none; }
.kpi .vl { font-size: 26px; font-weight: 700; margin-top: 8px; letter-spacing: -.022em; font-variant-numeric: tabular-nums; line-height: 1.1; overflow-wrap: anywhere; }
.kpi .sb { font-size: 12.5px; color: var(--txt2); margin-top: 5px; line-height: 1.35; }
.kpi.verde { --c: var(--ok-c); } .kpi.azul { --c: var(--acc); } .kpi.ouro { --c: var(--warn-c); } .kpi.verm { --c: var(--bad-solid); }
.kpi.verm .vl { color: var(--bad); }
.cols2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; margin-bottom: 14px; }
.cols3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.list-lite .it { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--linha2); }
.list-lite .it:last-child { border-bottom: 0; }
.bar { height: 8px; background: var(--fill-2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--acc); border-radius: 99px; }
.chart { width: 100%; height: auto; max-height: 260px; display: block; }
.chart .gl { stroke: var(--linha2); }
.chart text { fill: var(--txt2); font-family: var(--fonte); }
.chart .b-rec { fill: var(--c-rec); } .chart .b-des { fill: var(--c-des); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--txt2); align-items: center; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 6px; vertical-align: -2px; box-shadow: inset 0 0 0 1px rgba(128, 128, 128, .35); }
.legend .l-rec { background: var(--c-rec); } .legend .l-des { background: var(--c-des); }
.legend .s-ok { background: var(--ok-bg); box-shadow: inset 0 0 0 1.5px var(--ok); } .legend .s-bad { background: var(--bad-bg); box-shadow: inset 0 0 0 1.5px var(--bad); } .legend .s-warn { background: var(--warn-bg); box-shadow: inset 0 0 0 1.5px var(--warn); } .legend .s-neu { background: var(--neu-bg); box-shadow: inset 0 0 0 1.5px var(--neu); }

/* grade de contribuições */
.gridc td, .gridc th { padding: 6px 5px; text-align: center; font-size: 12.5px; }
.gridc td:first-child, .gridc th:first-child { text-align: left; padding-left: 14px; min-width: 190px; position: sticky; left: 0; background: var(--card); z-index: 1; font-weight: 600; }
.gridc th:first-child { background: var(--card-2); z-index: 3; }
.gridc tbody tr:hover td:first-child { background: var(--card); }
.cell { display: inline-flex; align-items: center; justify-content: center; min-width: 54px; min-height: 28px; padding: 0 6px; border-radius: 8px; font-weight: 650; cursor: pointer; box-shadow: inset 0 0 0 1px transparent; font-variant-numeric: tabular-nums; }
.cell.pago { background: var(--ok-bg); color: var(--ok); }
.cell.nao_pago { background: var(--bad-bg); color: var(--bad); }
.cell.pendente { background: var(--warn-bg); color: var(--warn); }
.cell.dispensado { background: var(--neu-bg); color: var(--neu); }
.cell.vazio { color: var(--txt2); background: transparent; font-weight: 400; }
.cell:hover { box-shadow: inset 0 0 0 1.5px currentColor; }
.cell:focus-visible { outline-offset: 1px; border-radius: 8px; }

/* ---------- 8. Janelas (sheets), avisos ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 7vh 20px 20px; overflow: auto; background: var(--scrim); animation: fade .18s var(--ease); }
.overlay.center { align-items: center; padding-top: 20px; }
@keyframes fade { from { opacity: 0; } }
.modal { display: flex; flex-direction: column; width: 100%; max-width: 760px; max-height: calc(100dvh - 11vh); background: var(--el); border-radius: 14px; box-shadow: var(--sombra-pop); animation: sheet .24s var(--ease); }
.modal.lg { max-width: 1040px; } .modal.sm { max-width: 460px; } .modal.xl { max-width: 1240px; }
@keyframes sheet { from { transform: translateY(-14px) scale(.985); opacity: 0; } }
.modal .grab { display: none; }
.modal .mh { flex: none; display: flex; align-items: center; gap: 10px; padding: 16px 20px 14px; border-bottom: 1px solid var(--linha2); }
.modal .mh h3 { font-size: 17px; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.modal .mh [data-close] { flex: none; min-height: 30px; width: 30px; padding: 0; border-radius: 50%; background: var(--fill-2); color: var(--txt2); box-shadow: none; }
.modal .mh [data-close]:hover { background: var(--linha); color: var(--txt); }
.modal .mbody { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 20px 20px 8px; overscroll-behavior: contain; }
.modal .mf { flex: none; display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--linha2); }
.modal.alert { max-width: 320px; border-radius: 16px; text-align: center; }
.modal.alert .mh { border: 0; padding: 22px 22px 4px; justify-content: center; }
.modal.alert .mbody { padding: 4px 22px 20px; }
.modal.alert .mbody p { margin-bottom: 4px; }
.modal.alert .mf { padding: 0; gap: 0; flex-wrap: nowrap; }
.modal.alert .mf .btn { flex: 1; min-height: 46px; border-radius: 0; box-shadow: none; background: transparent; color: var(--acc-tx); font-weight: 400; font-size: 16px; }
.modal.alert .mf .btn + .btn { border-left: 1px solid var(--linha2); }
.modal.alert .mf .btn:hover { background: var(--fill); }
.modal.alert .mf .btn.primary { font-weight: 650; }
.modal.alert .mf .btn.danger { color: var(--bad); }
.modal.alert .mf .btn:first-child { border-bottom-left-radius: 16px; } .modal.alert .mf .btn:last-child { border-bottom-right-radius: 16px; }

.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 99; max-width: calc(100vw - 32px); }
.toast { display: flex; align-items: flex-start; gap: 10px; background: var(--toast-bg); color: var(--toast-tx); padding: 12px 8px 12px 14px; border-radius: 14px; box-shadow: var(--sombra-pop); width: 380px; max-width: 100%; line-height: 1.4; animation: sheet .24s var(--ease); }
.toast .icon { width: 18px; height: 18px; margin-top: 1px; color: #62d684; }
.toast.err .icon { color: #ff9189; }
.toast .tx { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast button { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: rgba(255, 255, 255, .75); cursor: pointer; margin-top: -3px; }
.toast button:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; }

.drop { display: block; border: 1.5px dashed var(--borda-in); border-radius: 14px; padding: 36px 20px; text-align: center; color: var(--txt2); background: var(--card-2); transition: background-color .15s, border-color .15s; cursor: pointer; }
.drop .icon { width: 26px; height: 26px; color: var(--acc-tx); display: block; margin: 0 auto 8px; }
.drop:hover, .drop.over { border-color: var(--acc-tx); background: var(--acc-bg); }
.drop b { display: block; font-size: 16px; color: var(--txt); margin-bottom: 4px; }
.steps { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.steps .st { flex: 1 1 140px; padding: 9px 14px; border-radius: 10px; background: var(--fill); color: var(--txt2); font-weight: 600; font-size: 13px; }
.steps .st.on { background: var(--acc); color: var(--on-acc); }
.steps .st.done { background: var(--ok-bg); color: var(--ok); }
.sel-col { width: 34px; }
.dv { border-top: 1px solid var(--linha2); margin: 16px 0; }
.kv { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 8px 16px; font-size: 14px; margin: 0; }
.kv dt { color: var(--txt2); } .kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.prob { font-size: 12px; margin-top: 3px; line-height: 1.35; max-width: 360px; }
.prob.erro { color: var(--bad); font-weight: 600; }
.prob.aviso { color: var(--warn); }

/* calendário de hospedagem */
.cal-hd { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; } .cal-hd h3 { flex: 1; font-size: 19px; text-align: center; }
.icon.flip { transform: scaleX(-1); }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--linha2); border-radius: var(--raio); overflow: hidden; box-shadow: var(--sombra); }
.cal-dow { background: var(--card-2); padding: 8px 6px; text-align: center; font-size: 12px; font-weight: 600; color: var(--txt2); text-transform: uppercase; }
.cal-d { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-height: 104px; padding: 6px 8px; border: 0; background: var(--card); cursor: pointer; text-align: left; font: inherit; color: var(--txt); position: relative; overflow: hidden; }
.cal-d:hover { background: var(--fill); } .cal-d.fora { background: var(--card-2); color: var(--txt2); }
.cal-d .n { font-weight: 600; font-size: 13px; min-width: 24px; height: 24px; display: inline-grid; place-items: center; border-radius: 50%; }
.cal-d.hoje .n { background: var(--acc); color: var(--on-acc); }
.cal-d .q { position: absolute; right: 8px; top: 8px; background: var(--ok-bg); color: var(--ok); border-radius: 999px; min-width: 22px; height: 22px; padding: 0 6px; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; }
.cal-d .nm { width: 100%; font-size: 11.5px; line-height: 1.25; padding: 2px 6px; border-radius: 6px; background: var(--acc-bg); color: var(--acc-tx); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-d .nm.mais { background: transparent; color: var(--txt2); }
/* ---------- 9. Portal do município ---------- */
.pstatus { display: flex; align-items: center; gap: 16px; padding: 18px 20px; margin-bottom: 16px; }
.pstatus .ic { flex: none; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--ok-bg); color: var(--ok); }
.pstatus .ic .icon { width: 24px; height: 24px; stroke-width: 2.2; }
.pstatus.bad .ic { background: var(--bad-bg); color: var(--bad); }
.pstatus h2 { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.pstatus .tx { flex: 1; min-width: 0; }
.pstatus .tx p { margin: 4px 0 0; color: var(--txt2); }
.pfatos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.pfatos .card { padding: 16px 18px; }
.pfatos .lb { font-size: 12.5px; font-weight: 600; color: var(--txt2); }
.pfatos .vl { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; line-height: 1.12; }
.pfatos .sb { font-size: 12.5px; color: var(--txt2); margin-top: 4px; line-height: 1.35; }
.phead { display: flex; align-items: center; gap: 12px; margin: 4px 0 12px; }
.phead h3 { font-size: 19px; font-weight: 700; flex: 1; letter-spacing: -.015em; }
.phead .inp { width: auto; min-width: 110px; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.pcel { display: flex; flex-direction: column; gap: 3px; min-height: 92px; padding: 12px 14px; border-radius: 14px; background: var(--card); box-shadow: var(--sombra); }
.pcel .m { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--txt2); }
.pcel .m .icon { width: 15px; height: 15px; margin-left: auto; stroke-width: 2.4; }
.pcel b { font-size: 17px; font-weight: 700; letter-spacing: -.015em; font-variant-numeric: tabular-nums; margin-top: 4px; }
.pcel span.s { font-size: 12.5px; color: var(--txt2); line-height: 1.3; }
.pcel.pago { background: var(--ok-bg); box-shadow: none; } .pcel.pago .m .icon, .pcel.pago b { color: var(--ok); }
.pcel.nao_pago { background: var(--bad-bg); box-shadow: none; } .pcel.nao_pago .m .icon, .pcel.nao_pago b { color: var(--bad); }
.pcel.pendente { background: var(--warn-bg); box-shadow: none; } .pcel.pendente .m .icon, .pcel.pendente b { color: var(--warn); }
.pcel.dispensado { background: var(--neu-bg); box-shadow: none; } .pcel.dispensado b { color: var(--neu); }
.pcel.vazio { background: transparent; box-shadow: inset 0 0 0 1px var(--linha2); } .pcel.vazio b { color: var(--txt2); font-weight: 500; }
.psec { margin-bottom: 24px; }
.psec > h3 { font-size: 13px; font-weight: 600; color: var(--txt2); margin: 0 4px 8px; }

/* ---------- 10. Celular e janelas estreitas (classe compacta) ---------- */
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols2 { grid-template-columns: 1fr; } .cols3 { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .span3, .span4 { grid-column: span 2; }
  .pfatos { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  :root { --ctl: 44px; --bar-min: 52px; --bar-h: 52px; }
  body { font-size: 16px; }
  #login { grid-template-columns: 1fr; min-height: 100%; }
  .login-art { display: none; }
  .login-form-wrap { align-items: flex-start; padding: calc(28px + env(safe-area-inset-top, 0px)) 20px calc(28px + var(--seg)); }
  .mlogo-wrap { display: block; text-align: center; margin-bottom: 26px; }
  .mlogo-wrap img { height: 104px; display: block; margin: 0 auto 18px; border-radius: 22px; box-shadow: 0 0 0 .5px rgba(0, 0, 0, .1), 0 8px 24px rgba(0, 0, 0, .1); }
  .mlogo-wrap .regua { width: 120px; margin: 0 auto; }
  .login-card h2 { font-size: 28px; text-align: center; } .login-card .sub { text-align: center; }

  #app { display: block; }
  .side, #btnSide { display: none !important; }
  .topbar { flex-wrap: wrap; padding: calc(6px + env(safe-area-inset-top, 0px)) 16px 8px; gap: 2px 8px; align-content: center; min-height: calc(var(--bar-min) + env(safe-area-inset-top, 0px)); }
  .topbar h1 { font-size: 20px; font-weight: 700; }
  .topbar .sub { display: none; }
  .topbar #vact { order: 3; flex: 1 0 100%; overflow-x: auto; padding: 4px 0 2px; scrollbar-width: none; }
  .topbar #vact::-webkit-scrollbar { display: none; }
  #view { padding: calc(var(--bar-h) + 12px) 16px calc(var(--tab-h) + var(--seg) + 28px); scroll-padding-top: calc(var(--bar-h) + 12px); }

  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding-bottom: var(--seg); background: var(--bar); border-top: 1px solid var(--linha);
    -webkit-backdrop-filter: saturate(180%) blur(22px); backdrop-filter: saturate(180%) blur(22px);
  }
  .tabbar a.tab { position: relative; flex: 1; min-width: 0; min-height: var(--tab-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--txt2); text-decoration: none; font-size: 11px; font-weight: 600; cursor: pointer; padding: 4px 2px; }
  .tabbar a.tab .icon { width: 24px; height: 24px; stroke-width: 1.7; }
  .tabbar a.tab span.l { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tabbar a.tab.on { color: var(--acc-tx); }
  .tabbar a.tab.on .icon { stroke-width: 2.3; }
  .tabbar a.tab .badge { position: absolute; top: 3px; left: calc(50% + 6px); margin: 0; min-width: 18px; height: 18px; font-size: 11px; }
  .tabbar a.tab:focus-visible { outline-offset: -3px; }

  .btn { font-size: 16px; padding: 0 16px; }
  .btn.sm { min-height: 36px; font-size: 14px; padding: 0 12px; }
  .btn.sm::before { content: ""; position: absolute; inset: -4px -2px; }
  .btn.sm.icon-only { width: 36px; }
  .cell { min-height: 36px; min-width: 58px; }
  .inp, select.inp, textarea.inp { font-size: 16px; border-radius: 10px; }
  .field label { font-size: 13.5px; }
  .check label { font-size: 16px; }
  input[type=checkbox], input[type=radio] { width: 22px; height: 22px; }
  .grid { grid-template-columns: minmax(0, 1fr); } .span2, .span3, .span4 { grid-column: auto; }
  .search { flex: 1 1 100%; } .search input { width: 100%; }
  .toolbar { gap: 8px; } .toolbar .inp { width: 100% !important; max-width: none !important; } .toolbar > .btn { flex: 1 1 auto; }
  .toolbar input[type=date].inp { flex: 1 1 calc(50% - 28px); width: auto !important; min-width: 130px; }
  .toolbar > span.muted { flex: none; }
  .tbl[data-stack] .pill { white-space: normal; text-align: left; line-height: 1.25; padding-top: 2px; padding-bottom: 2px; }
  .toolbar .grow { display: none; }
  .kpis { grid-template-columns: minmax(0, 1fr); gap: 12px; } .kpi .vl { font-size: 28px; }
  .card .hd { flex-wrap: wrap; padding: 12px 16px; } .card .bd { padding: 14px 16px; }
  .tbl th, .tbl td { padding: 10px 12px; }
  .tbl-wrap { border-radius: var(--raio); }
  /* tabelas viram lista de cartões: título + campos rotulados + ações */
  .tbl[data-stack] { display: block; background: transparent; }
  .tbl[data-stack] thead { display: none; }
  .tbl[data-stack] tbody, .tbl[data-stack] tfoot { display: block; }
  .tbl[data-stack] tbody tr { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; padding: 14px 16px; border-bottom: 1px solid var(--linha2); background: var(--card); }
  .tbl[data-stack] tbody tr:last-child { border-bottom: 0; }
  .tbl[data-stack] td { display: block; padding: 0; border: 0; min-width: 0; overflow-wrap: anywhere; text-align: left !important; white-space: normal !important; }
  .tbl[data-stack] tbody tr:hover td { background: transparent; }
  .tbl[data-stack] td::before { content: attr(data-l); display: block; font-size: 11.5px; font-weight: 600; color: var(--txt2); margin-bottom: 1px; }
  .tbl[data-stack] td[data-l=""]::before, .tbl[data-stack] td.t1::before, .tbl[data-stack] td.sel-col::before, .tbl[data-stack] td.act::before { display: none; }
  .tbl[data-stack] td:empty { display: none; }
  .tbl[data-stack] td.t1 { order: -2; grid-column: 1 / -1; font-size: 16px; padding-right: 34px; }
  .tbl[data-stack] td.sel-col { position: absolute; right: 14px; top: 14px; }
  .tbl[data-stack] td.act { order: 99; grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; padding-top: 4px; }
  .tbl[data-stack] tfoot tr { display: block; padding: 12px 16px; background: var(--card-2); }
  .tbl[data-stack] tfoot td { display: block; padding: 2px 0; background: transparent; border: 0; font-weight: 650; }
  .tbl[data-stack] tfoot td::before { display: none; }
  .tabs { display: flex; } .tabs button { min-height: 36px; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; } .kv dt { margin-top: 10px; font-size: 12.5px; } .kv dt:first-child { margin-top: 0; }
  .steps .st { flex-basis: 100%; }
  .legend { gap: 6px 12px; }

  /* janela vira folha (sheet) vinda de baixo */
  .overlay, .overlay.center { align-items: flex-end; padding: 0; }
  .overlay.center { align-items: center; padding: 20px; }
  .modal { max-width: none !important; max-height: 92dvh; border-radius: 16px 16px 0 0; animation: sheet-up .3s var(--ease); touch-action: pan-y; }
  .modal.alert { max-width: 320px !important; border-radius: 16px; animation: sheet .24s var(--ease); }
  .modal .grab { display: block; flex: none; width: 36px; height: 5px; border-radius: 3px; background: var(--borda-in); opacity: .55; margin: 8px auto 0; }
  .modal .mh { padding: 10px 16px 12px; }
  .modal .mh [data-close] { width: 36px; min-height: 36px; }
  .modal .mbody { padding: 16px 16px 8px; }
  .modal .mf { padding: 12px 16px calc(12px + var(--seg)); }
  .modal .mf .grow { display: none; }
  .modal .mf .btn { flex: 1 1 auto; }
  .modal.alert .mf { padding: 0; }
  .toasts { left: 16px; right: 16px; bottom: calc(var(--tab-h) + var(--seg) + 12px); align-items: stretch; }
  .toast { width: 100%; }
  .cal-d { min-height: 58px; padding: 4px; align-items: center; } .cal-d .nm { display: none; } .cal-d .q { position: static; margin-top: 2px; }
  .pgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pfatos { display: block; background: var(--card); border-radius: var(--raio); box-shadow: var(--sombra); overflow: hidden; margin-bottom: 22px; }
  .pfatos .card { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; align-items: center; border-radius: 0; box-shadow: none; padding: 14px 16px; border-bottom: 1px solid var(--linha2); }
  .pfatos .card:last-child { border-bottom: 0; }
  .pfatos .lb { grid-area: 1 / 1; } .pfatos .sb { grid-area: 2 / 1; margin: 2px 0 0; } .pfatos .vl { grid-area: 1 / 2 / span 2 / 2; margin: 0; font-size: 20px; text-align: right; }
  .pstatus { padding: 16px; gap: 14px; } .pstatus h2 { font-size: 19px; }
  .lista .li { padding: 12px 16px; flex-wrap: wrap; }
  .phead h3 { font-size: 20px; }
}
@keyframes sheet-up { from { transform: translateY(100%); } }
@media (max-width: 380px) { .pgrid { grid-template-columns: minmax(0, 1fr); } }


/* ---------- Portal da Transparência (página pública) ---------- */
.tp { min-height: 100%; overflow: auto; height: 100%; background: var(--bg); }
.tp-wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.tp-top { background: var(--card); border-bottom: 1px solid var(--linha2); position: sticky; top: 0; z-index: 30; }
.tp-in { display: flex; align-items: center; gap: 16px; padding: 12px 20px; flex-wrap: wrap; }
.tp-in img { height: 52px; width: 52px; object-fit: contain; border-radius: 12px; box-shadow: 0 0 0 .5px rgba(0, 0, 0, .1); background: #fff; }
.tp-tt h1 { font-size: 20px; letter-spacing: -.02em; } .tp-tt .sub { color: var(--txt2); font-size: 12.5px; }
.tp-in nav { margin-left: auto; display: flex; gap: 2px; flex-wrap: wrap; }
.tp-in nav a { padding: 8px 11px; border-radius: 8px; text-decoration: none; color: var(--txt); font-weight: 500; font-size: 13.5px; }
.tp-in nav a:hover { background: var(--fill); }
.tp-top .regua { border-radius: 0; height: 4px; }
.tp-hero { padding: 36px 0 20px; }
.tp-hero h2 { font-size: clamp(25px, 4vw, 36px); font-weight: 700; letter-spacing: -.03em; max-width: 780px; line-height: 1.12; }
.tp-hero p { color: var(--txt2); max-width: 680px; font-size: 16px; margin-top: 10px; }
.tp-princ { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.tp-princ span { background: var(--acc-bg); color: var(--acc-tx); font-weight: 600; font-size: 12.5px; padding: 4px 11px; border-radius: 999px; }
.tp-bloco { margin: 0 0 40px; scroll-margin-top: 90px; }
.tp-bloco > h2 { font-size: 22px; letter-spacing: -.02em; margin-bottom: 4px; }
.tp-bloco > .lead { color: var(--txt2); margin-bottom: 14px; }
.tp-sub { font-size: 15px; margin: 18px 0 10px; display: flex; gap: 10px; align-items: center; }
.tp-card { margin-bottom: 14px; } .tp-card.vig { box-shadow: var(--sombra), 0 0 0 2px var(--ok-bg); }
.tp-card details { margin: 6px 0; } .tp-card summary { cursor: pointer; font-weight: 600; padding: 6px 0; } .tp-card details ul { margin: 6px 0 4px; padding-left: 20px; line-height: 1.55; }
.tp-ata { white-space: pre-wrap; line-height: 1.6; max-height: 340px; overflow: auto; padding: 12px 14px; background: var(--card-2); border-radius: 10px; font-size: 13.5px; }
.tp-pessoas { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.tp-pessoa { padding: 14px; display: flex; gap: 12px; align-items: center; }
.tp-pessoa .av { width: 42px; height: 42px; border-radius: 50%; background: var(--acc-bg); color: var(--acc-tx); display: grid; place-items: center; font-weight: 700; flex: none; }
.tp-pessoa b { display: block; } .tp-pessoa span { display: block; color: var(--txt2); font-size: 12.5px; }
.tp-barra { display: flex; align-items: center; gap: 10px; margin: 9px 0; font-size: 13.5px; } .tp-barra .nm { width: 180px; flex: none; } .tp-barra .bar { flex: 1; } .tp-barra .v { width: 112px; text-align: right; font-weight: 600; }
.tp-lgpd { background: var(--card); border-radius: var(--raio); box-shadow: var(--sombra); padding: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.tp-lgpd h3 { font-size: 15px; margin-bottom: 8px; } .tp-lgpd ul { margin: 0; padding-left: 18px; } .tp-lgpd li { margin: 4px 0; font-size: 13.5px; }
.tp-lgpd .sim li::marker { color: var(--ok); } .tp-lgpd .nao li::marker { color: var(--bad); }
.tp-rod { background: var(--side-bg); border-top: 1px solid var(--linha2); padding: 28px 0 40px; margin-top: 40px; font-size: 13px; color: var(--txt2); }
.tp-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; } .tp-rod b { color: var(--txt); display: block; margin-bottom: 4px; }
@media (max-width: 800px) { .tp-lgpd { grid-template-columns: 1fr; } .tp-barra .nm { width: 110px; } .tp-barra .v { width: 92px; } .tp-in nav { margin-left: 0; } .tp-top { position: static; } .tp-hero { padding-top: 22px; } }

.tp-marca { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; padding: 4px 0; }
.tp-marca b { display: block; font-size: 18px; letter-spacing: -.02em; } .tp-marca .sub { display: block; color: var(--txt2); font-size: 12.5px; }
.tp-main { padding-top: 8px; padding-bottom: 20px; }
.tp-hero h1, .tp-h1 { font-size: clamp(26px, 4vw, 38px); font-weight: 700; letter-spacing: -.03em; line-height: 1.12; max-width: 780px; }
.tp-h1 { font-size: clamp(24px, 3.4vw, 32px); margin-top: 6px; }
.tp-main .lead { color: var(--txt2); font-size: 16px; margin: 6px 0 20px; max-width: 680px; }
.tp-escolha { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin: 8px 0 28px; }
.tp-opcao { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 20px; text-decoration: none; color: inherit; min-height: 150px; transition: transform .15s var(--ease), box-shadow .15s; }
.tp-opcao:hover { transform: translateY(-2px); box-shadow: var(--sombra), 0 0 0 2px var(--acc-bg); }
.tp-opcao .n { position: absolute; right: 16px; top: 14px; color: var(--txt2); font-weight: 600; font-size: 13px; }
.tp-opcao .ic { width: 42px; height: 42px; border-radius: 12px; background: var(--acc-bg); color: var(--acc-tx); display: grid; place-items: center; margin-bottom: 8px; } .tp-opcao .ic .icon { width: 22px; height: 22px; }
.tp-opcao b { font-size: 17px; letter-spacing: -.01em; } .tp-opcao > span:last-child { color: var(--txt2); font-size: 13.5px; line-height: 1.4; }
.tp-voltar { display: flex; gap: 8px; align-items: center; margin: 16px 0 4px; font-size: 13.5px; color: var(--txt2); } .tp-voltar a { font-weight: 600; text-decoration: none; padding: 8px 0; }
.tp-outros { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--linha2); } .tp-outros h2 { font-size: 14px; color: var(--txt2); font-weight: 600; margin-bottom: 10px; }
.tp-lista { margin: 6px 0 4px; padding-left: 20px; line-height: 1.6; }
.tp-ant { margin-bottom: 10px; } .tp-ant > summary { cursor: pointer; padding: 14px 18px; } .tp-ant[open] > summary { border-bottom: 1px solid var(--linha2); } .tp-ant .tp-card { margin: 0; box-shadow: none; }
.tp-top { position: static; }
@media (max-width: 800px) { .tp-escolha { grid-template-columns: 1fr; } .tp-opcao { min-height: 0; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 16px; } .tp-opcao .ic { margin: 0; } .tp-opcao b { flex: 1; } .tp-opcao > span:last-child { flex: 1 0 100%; } .tp-opcao .n { display: none; } .tp-marca b { font-size: 16px; } }

/* ---------- 11. Acessibilidade: movimento e modo de alto contraste ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .btn:active { transform: none; }
}
@media (forced-colors: active) {
  .btn, .inp, .card, .pcel, .cell, .pill { border: 1px solid CanvasText; }
  .btn.primary { forced-color-adjust: none; background: Highlight; color: HighlightText; }
}

/* central de alertas */
.alertas .li.al-critico > .icon { color: var(--bad); }
.alertas .li.al-atencao > .icon { color: var(--warn); }
.alertas .li .badge.atencao { background: var(--warn-c); color: #1d1200; }
.alertas .li .badge.info { background: var(--acc); }
.alertas .li .badge { margin-left: auto; }
