/* Painel — Missão Amazônia (v2). Base visual do painel AMAS/Metodista, com a paleta verde da Missão. */
/* Fonte Inter hospedada localmente (sem Google Fonts: internet por satélite lenta/instável). Variável 400–700. */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("../fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("../fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
:root {
  --blue: #2E7D32; --blue-700: #256628; --blue-800: #1B5E20; --blue-50: #EEF7EF; --blue-100: #D8ECDA; --teal: #00695C;
  --brand-red: #E52421;
  --ink: #111827; --text: #374151; --muted: #6B7280; --line: #E5E7EB; --soft: #F3F4F6; --bg: #F5F7FA;
  --side: #1F6A2A; --side-2: rgba(255,255,255,.14);
  --ok: #146C43; --ok-bg: #D1E7DD; --warn: #B45309; --warn-bg: #FEF3C7; --err: #B91C1C; --err-bg: #FEE2E2;
  --in: #146C43; --out: #C62828;
  --radius: 12px; --shadow: 0 1px 2px rgba(16,24,40,.04), 0 2px 8px -2px rgba(16,24,40,.06);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  --side-w: 248px;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.55; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-800); }
h1, h2, h3 { color: var(--ink); margin: 0 0 .5em; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }
code { background: var(--soft); padding: 2px 6px; border-radius: 6px; font-size: .88em; }
.icon { width: 18px; height: 18px; flex-shrink: 0; vertical-align: -.22em; }
.icon--sm { width: 14px; height: 14px; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.d-block { display: block; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 600; color: var(--ink); }
.strong:hover { color: var(--blue); }
.right { text-align: right; }
.mt { margin-top: 22px; }
.mb-0 { margin-bottom: 0; }
.inline { display: inline; margin: 0; }
.tabular { font-variant-numeric: tabular-nums; }
.amount { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; color: var(--ink); }
.amount--in { color: var(--in); }
.amount--out { color: var(--out); }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* Botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 9px; border: 1px solid transparent;
  font-weight: 600; font-size: .88rem; transition: background .15s, border-color .15s, color .15s; white-space: nowrap; background: none; cursor: pointer; text-decoration: none; }
.btn--sm { min-height: 34px; padding: 0 12px; font-size: .82rem; }
.btn--block { width: 100%; }
.btn--primary { background: var(--blue); color: #fff; }
.btn--primary:hover { background: var(--blue-700); color: #fff; }
.btn--success { background: var(--ok); color: #fff; }
.btn--success:hover { background: #146C43; color: #fff; }
.btn--danger { background: #fff; color: var(--err); border-color: #F5C2C7; }
.btn--danger:hover { background: var(--err-bg); color: var(--err); }
.btn--outline { border-color: var(--line); color: var(--ink); background: #fff; }
.btn--outline:hover { border-color: var(--blue); color: var(--blue); }
.btn--ghost { color: var(--muted); }
.btn--ghost:hover { background: var(--soft); color: var(--ink); }
.btn--light { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.25); }
.btn--light:hover { background: #fff; color: var(--blue); }
.btn:disabled, .btn.is-disabled { opacity: .55; pointer-events: none; }
.icon-btn { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; border: 0; background: transparent; color: var(--muted); transition: all .15s; }
.icon-btn:hover { background: var(--soft); color: var(--ink); }
.icon-btn--danger:hover { background: var(--err-bg); color: var(--err); }
.link-btn { background: none; border: 0; color: var(--blue); font-size: .78rem; padding: 0; font-weight: 500; }

/* Layout */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: linear-gradient(180deg, #2E7D32 0%, var(--teal) 100%); color: rgba(255,255,255,.72); display: flex; flex-direction: column; z-index: 50; transition: transform .3s; }
.sidebar__brand { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 20px 20px 16px; border-bottom: 1px solid rgba(255,255,255,.07); }
.sidebar__brand img { width: 108px; height: auto; }
.sidebar__brand span { font-size: .68rem; text-transform: uppercase; letter-spacing: .18em; color: rgba(255,255,255,.88); font-weight: 600; }
.sidebar__nav { flex: 1; overflow-y: auto; padding: 12px 10px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.3) transparent; }
.sidebar__group { margin-bottom: 14px; }
.sidebar__label { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .14em; color: rgba(255,255,255,.85); padding: 0 12px 4px; font-weight: 600; }
.sidebar a { display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 8px; color: rgba(255,255,255,.74); font-weight: 500; font-size: .89rem; position: relative; }
.sidebar a .icon { width: 17px; height: 17px; opacity: .85; }
.sidebar a:hover { background: rgba(255,255,255,.14); color: #fff; }
.sidebar a.active { background: rgba(255,255,255,.22); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 #fff; }
.sidebar a.active .icon { opacity: 1; }
.sidebar__foot { display: flex; flex-direction: column; gap: 2px; }
.sidebar__foot a { font-size: .8rem; padding: 8px 12px; color: rgba(255,255,255,.88); }
.sidebar__brand img { width: 150px; height: auto; }
.sidebar .count { margin-left: auto; font-style: normal; background: #F9A825; color: #111; font-size: .7rem; font-weight: 700; min-width: 20px; height: 20px; border-radius: 99px; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; }
.sidebar__foot { padding: 10px; border-top: 1px solid rgba(255,255,255,.07); }
.sidebar-backdrop { display: none; }
.main { margin-left: var(--side-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 14px; height: 62px; padding: 0 26px; background: rgba(255,255,255,.94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar__title { font-size: 1.12rem; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-btn { display: none; }
.content { padding: 24px 26px 40px; max-width: 1440px; width: 100%; }

.user-menu { position: relative; }
.user-menu__btn { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 5px 8px; border-radius: 10px; color: var(--ink); }
.user-menu__btn:hover { background: var(--soft); }
.user-menu__name { display: flex; flex-direction: column; text-align: left; line-height: 1.2; }
.user-menu__name strong { font-size: .86rem; }
.user-menu__name small { color: var(--muted); font-size: .74rem; }
.dropdown { position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 20px 40px -12px rgba(0,0,0,.2); padding: 6px; display: none; }
.user-menu.is-open .dropdown { display: block; }
.dropdown a, .dropdown button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 8px; color: var(--ink); background: none; border: 0; font-size: .9rem; text-align: left; }
.dropdown a:hover, .dropdown button:hover { background: var(--soft); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--blue); color: #fff; font-weight: 700; font-size: .82rem; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.avatar--soft { background: var(--blue-50); color: var(--blue-800); }
.avatar--lg { width: 56px; height: 56px; font-size: 1.2rem; }
.avatar--photo { padding: 0; overflow: hidden; background: var(--soft); }
.avatar--photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar--xl { width: 96px; height: 96px; font-size: 1.8rem; }
.photo-field__row { display: flex; gap: 14px; align-items: center; }
.photo-field__preview { width: 96px; height: 96px; border-radius: 50%; overflow: hidden; background: var(--blue-50); color: var(--blue-800); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.6rem; flex-shrink: 0; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.photo-field__preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-field__body { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; min-width: 0; }
.avatar--f { background: #FCE7F3; color: #9D174D; }
.avatar--m { background: var(--blue-50); color: var(--blue-800); }

/* Cards */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card--flush { padding: 0; overflow: hidden; }
.card__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card__head h2, .card__title { font-size: .98rem; margin: 0; display: flex; align-items: center; gap: 8px; }
.card__title { margin-bottom: 12px; }
.card--flush > .card__head { padding: 16px 18px 0; }
.section-title { font-size: .74rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; margin: 6px 0 -4px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-2 > .card + .card, .grid-3 > .card + .card { margin-top: 0; }
.stack > * + * { margin-top: 16px; }

.welcome-box { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; padding: 24px 26px; border-radius: var(--radius); color: #fff; margin-bottom: 20px;
  background: radial-gradient(520px 220px at 100% 0%, rgba(255,255,255,.16), transparent 60%), linear-gradient(120deg, #1B5E20, var(--blue)); }
.welcome-box h2 { color: #fff; font-size: 1.4rem; margin: 0 0 4px; }
.welcome-box p { margin: 0; opacity: .85; }
.shortcuts { display: flex; gap: 8px; flex-wrap: wrap; }

/* Pendências do painel */
.pending { margin-bottom: 20px; padding: 16px 18px; }
.pending .card__head { margin-bottom: 8px; }
.pending__list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 6px 14px; }
.pending__item a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink); font-size: .88rem; border-left: 3px solid var(--line); background: var(--soft); }
.pending__item a:hover { background: var(--blue-50); color: var(--ink); }
.pending__item a span { flex: 1; min-width: 0; }
.pending__item a > .icon:last-child { color: var(--muted); }
.pending__item--err a { border-left-color: var(--out); } .pending__item--err a > .icon:first-child { color: var(--out); }
.pending__item--warn a { border-left-color: #F59E0B; } .pending__item--warn a > .icon:first-child { color: var(--warn); }
.pending__item--info a { border-left-color: var(--blue); } .pending__item--info a > .icon:first-child { color: var(--blue); }
@media (max-width: 640px) { .pending__list { grid-template-columns: 1fr; } }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi { display: flex; align-items: center; gap: 14px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); color: var(--text); transition: border-color .15s, transform .15s; min-width: 0; }
a.kpi:hover { border-color: var(--blue); color: var(--text); transform: translateY(-1px); }
.kpi__icon { width: 42px; height: 42px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--blue-50); color: var(--blue); }
.kpi__icon .icon { width: 21px; height: 21px; }
.kpi__body { display: flex; flex-direction: column; min-width: 0; }
.kpi__body small { color: var(--muted); font-size: .8rem; font-weight: 500; }
.kpi__body strong { font-size: 1.42rem; color: var(--ink); line-height: 1.2; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi__body em { font-style: normal; font-size: .76rem; color: var(--muted); }
.kpi--green .kpi__icon { background: var(--ok-bg); color: var(--ok); }
.kpi--red .kpi__icon { background: var(--err-bg); color: var(--out); }
.kpi--amber .kpi__icon { background: var(--warn-bg); color: var(--warn); }
.kpi--pink .kpi__icon { background: #FCE7F3; color: #BE185D; }
.kpi--slate .kpi__icon { background: var(--soft); color: var(--ink); }

/* Gráficos */
.chart-box { position: relative; height: 280px; }
.chart-box--sm { height: 220px; }
.chart-box--lg { height: 340px; }
.legend-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.legend-list li { display: flex; align-items: center; gap: 10px; font-size: .88rem; }
.legend-list i { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend-list span { flex: 1; min-width: 0; }
.legend-list b { font-variant-numeric: tabular-nums; color: var(--ink); }
.bar { height: 8px; background: var(--soft); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--blue); border-radius: 99px; }
.bar--ok > span { background: var(--ok); }
.bar--warn > span { background: #F59E0B; }
.bar--red > span { background: var(--out); }
.progress-row { display: grid; gap: 6px; }
.progress-row + .progress-row { margin-top: 14px; }
.progress-row__head { display: flex; justify-content: space-between; gap: 10px; font-size: .88rem; }

/* Toolbar / filtros / tabelas */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar p { margin: 0; }
.toolbar__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 16px; }
.filters .field { min-width: 150px; flex: 1; }
.filters .field--grow { flex: 3; min-width: 220px; }
.filters .field > span { font-size: .76rem; color: var(--muted); }
.filters .field input, .filters .field select { padding: 8px 10px; }
.filters__actions { display: flex; gap: 6px; }
.tabs { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.tabs a { padding: 6px 13px; border-radius: 8px; color: var(--muted); font-weight: 500; font-size: .86rem; }
.tabs a.active { background: var(--blue); color: #fff; }
.tabs a:not(.active):hover { background: var(--soft); color: var(--ink); }
.tabs a em { font-style: normal; opacity: .7; margin-left: 4px; }
.search { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; flex: 1; max-width: 360px; color: var(--muted); }
.search input { border: 0; outline: 0; padding: 9px 0; font: inherit; background: none; width: 100%; color: var(--ink); }
.select-sm { padding: 7px 9px; border: 1px solid #D1D5DB; border-radius: 8px; font: inherit; background: #fff; color: var(--ink); width: 100%; min-width: 0; }
.select-sm:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(46,125,50,.18); }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 10px 14px; background: #F9FAFB; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #FAFBFC; }
.table .actions { text-align: right; white-space: nowrap; width: 1%; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table tfoot td { background: #F9FAFB; font-weight: 700; color: var(--ink); border-top: 1px solid var(--line); }
.table tr.is-muted td { opacity: .55; }
.table tr.is-group td { background: #F9FAFB; font-weight: 600; color: var(--ink); }
.table--compact td, .table--compact th { padding: 8px 12px; }
.with-thumb { display: flex; align-items: center; gap: 12px; min-width: 0; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: .73rem; font-weight: 600; background: var(--soft); color: var(--muted); white-space: nowrap; line-height: 1.6; }
.badge--ok { background: var(--ok-bg); color: #0F5132; }
.badge--warn { background: var(--warn-bg); color: #92400E; }
.badge--red { background: var(--err-bg); color: var(--err); }
.badge--blue { background: var(--blue-50); color: var(--blue-800); }
.badge--muted { background: var(--soft); color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.pagination a, .pagination .gap { min-width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); }
.pagination .gap { border: 0; background: none; }
.pagination a.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.empty-state { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty-state .icon { width: 40px; height: 40px; color: var(--blue); opacity: .45; margin-bottom: 6px; }
.empty-state h2 { margin: 6px 0; font-size: 1.05rem; }
.empty-state p { margin: 0 0 14px; }

/* Formulários */
.back-link { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 14px; color: var(--muted); font-weight: 500; }
.back-link:hover { color: var(--blue); }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.form-side > .card + .card { margin-top: 16px; }
.form-side { position: sticky; top: 80px; }
.form-main { display: flex; flex-direction: column; gap: 14px; }
.form-main > .card + .card { margin-top: 0; }
.card.form-main, .form-section { display: flex; flex-direction: column; gap: 14px; }
.form-side .card { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; margin: 0; min-width: 0; }
.field > span { font-weight: 500; color: var(--ink); font-size: .86rem; }
.field > span b { color: var(--err); }
.field small { color: var(--muted); font-size: .78rem; }
.field input, .field select, .field textarea { width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1px solid #D1D5DB; border-radius: 8px; padding: 9px 11px; transition: border-color .15s, box-shadow .15s; min-height: 40px; }
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(46,125,50,.18); }
.field input:disabled, .field select:disabled { background: var(--soft); color: var(--muted); }
.field input[readonly] { background: var(--soft); }
.input-prefix { display: flex; align-items: stretch; }
.input-prefix em { font-style: normal; display: inline-flex; align-items: center; padding: 0 10px; background: var(--soft); border: 1px solid #D1D5DB; border-right: 0; border-radius: 8px 0 0 8px; color: var(--muted); font-size: .86rem; }
.input-prefix input { border-radius: 0 8px 8px 0 !important; text-align: right; font-variant-numeric: tabular-nums; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.row-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.span-2 { grid-column: span 2; }
.switch { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch__ui { width: 38px; height: 22px; border-radius: 99px; background: #D1D5DB; position: relative; flex-shrink: 0; transition: background .2s; margin-top: 1px; }
.switch__ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + .switch__ui { background: var(--blue); }
.switch input:checked + .switch__ui::after { transform: translateX(16px); }
.switch input:focus-visible + .switch__ui { box-shadow: 0 0 0 3px rgba(46,125,50,.28); }
.switch__text { display: flex; flex-direction: column; font-weight: 500; color: var(--ink); font-size: .88rem; }
.switch__text small { color: var(--muted); font-weight: 400; font-size: .78rem; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; }
.checks label { display: flex; gap: 8px; align-items: flex-start; font-size: .88rem; color: var(--ink); cursor: pointer; }
.checks input { width: 16px; height: 16px; accent-color: var(--blue); margin-top: 2px; flex-shrink: 0; }
fieldset.box { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 0; }
fieldset.box legend { font-weight: 600; color: var(--ink); font-size: .86rem; padding: 0 6px; }
.upload { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.upload__preview { width: 120px; height: 84px; border-radius: 10px; overflow: hidden; background: var(--soft); flex-shrink: 0; border: 1px dashed var(--line); display: flex; align-items: center; justify-content: center; }
.upload__preview img { width: 100%; height: 100%; object-fit: contain; }
.upload__empty .icon { width: 28px; height: 28px; color: var(--muted); opacity: .5; }
.upload__body { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; min-width: 0; }
.upload__remove { font-size: .82rem; color: var(--err); display: flex; gap: 6px; align-items: center; }
.field .upload__remove input { width: auto; min-height: 0; padding: 0; }
.sticky-save { position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(0deg, var(--bg) 60%, transparent); display: flex; gap: 10px; justify-content: flex-end; }

/* Anexos */
.dropzone { border: 1.5px dashed #B9DBBC; border-radius: 10px; background: #F4FAF5; padding: 12px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; transition: background .15s, border-color .15s; }
.dropzone.is-over { background: var(--blue-50); border-color: var(--blue); }
.dropzone__pick { flex: 1; min-width: 200px; display: flex; align-items: center; gap: 10px; cursor: pointer; color: var(--blue-800); position: relative; }
.dropzone__pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.dropzone__pick small { color: var(--muted); }
.dropzone__list { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; gap: 4px; }
.dropzone__list:empty { display: none; }
.dropzone__list li { display: flex; gap: 8px; align-items: center; font-size: .84rem; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.dropzone__list li small { margin-left: auto; color: var(--muted); }
.file-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 6px; }
.file-list li { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 8px 8px 12px; }
.file-list__main { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: var(--ink); }
.file-list__main .icon { color: var(--blue); }
.file-list__main span { display: flex; flex-direction: column; min-width: 0; }
.file-list__main strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list__main small { color: var(--muted); font-size: .76rem; }
.file-list__actions { display: flex; gap: 2px; }
.attachments__form { display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--line); padding-top: 14px; }
.attachments__form .btn { align-self: flex-start; }

.alert { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; font-weight: 500; transition: opacity .4s; border: 1px solid transparent; }
.alert .icon { margin-top: 1px; }
.alert--ok { background: var(--ok-bg); color: #0F5132; border-color: #BADBCC; }
.alert--err { background: var(--err-bg); color: #842029; border-color: #F5C2C7; }
.alert--warn { background: var(--warn-bg); color: #78350F; border-color: #FDE68A; }
.alert--info { background: var(--blue-50); color: #1B5E20; border-color: var(--blue-100); }
.alert a { color: inherit; text-decoration: underline; }

/* Ficha / detalhes */
.profile-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.profile-head h2 { margin: 0; font-size: 1.25rem; }
.profile-head p { margin: 2px 0 0; }
.profile-head__actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.dl { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 7px 18px; margin: 0; }
.dl dt { color: var(--muted); font-size: .86rem; }
.dl dd { margin: 0; color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }
.inline-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sensitive { border-left: 3px solid #F59E0B; }
.lock-note { display: flex; gap: 8px; align-items: center; color: var(--warn); font-size: .84rem; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; font-size: .88rem; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }
.timeline li::after { content: ""; position: absolute; left: 8.5px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline small { display: block; color: var(--muted); }
.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.totals div { background: var(--soft); border-radius: 10px; padding: 12px 14px; }
.totals small { display: block; color: var(--muted); font-size: .78rem; }
.totals strong { font-size: 1.15rem; color: var(--ink); font-variant-numeric: tabular-nums; }

/* Popover simples (details) */
.popover { position: relative; display: inline-block; }
.popover > summary { list-style: none; cursor: pointer; }
.popover > summary::-webkit-details-marker { display: none; }
.popover__body { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 280px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 20px 40px -12px rgba(0,0,0,.25); padding: 14px; display: flex; flex-direction: column; gap: 10px; text-align: left; white-space: normal; }

/* Termos */
.terms { max-width: 880px; }
.terms__doc { padding: 28px 32px; line-height: 1.7; }
.terms__doc h2 { font-size: 1.25rem; margin-bottom: 14px; }
.terms__doc h3 { font-size: .98rem; margin: 20px 0 6px; }
.terms__doc ul { padding-left: 20px; margin: 6px 0 10px; }
.terms__doc li + li { margin-top: 4px; }
.terms__accept { display: flex; flex-direction: column; gap: 14px; border: 2px solid var(--blue); }
.terms__check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; color: var(--ink); font-weight: 500; }
.terms__check input { width: 20px; height: 20px; accent-color: var(--blue); margin-top: 2px; flex-shrink: 0; }
@media (max-width: 640px) { .terms__doc { padding: 18px 16px; } }

/* Grupos */
.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.group-grid .card + .card { margin-top: 0; }
.group-card { display: flex; flex-direction: column; gap: 12px; }
.group-card__head { display: flex; gap: 12px; }
.group-card__head h3 { margin: 0 0 2px; font-size: 1rem; }
.group-card__head p { margin: 0; }
.group-card__meta { display: flex; gap: 16px; color: var(--muted); font-size: .84rem; flex-wrap: wrap; }
.group-card__meta span { display: inline-flex; gap: 6px; align-items: center; }
.group-card__actions { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.perm-grid { display: grid; gap: 16px; }
.perm-group { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px 4px; margin: 0; }
.perm-group legend { font-weight: 700; color: var(--ink); padding: 0 8px; font-size: .88rem; display: flex; gap: 10px; align-items: center; }
.perm { display: flex; gap: 12px; align-items: flex-start; padding: 9px 4px; border-bottom: 1px solid var(--soft); cursor: pointer; }
.perm:last-child { border-bottom: 0; }
.perm input { width: 17px; height: 17px; accent-color: var(--blue); margin-top: 2px; flex-shrink: 0; }
.perm span { display: flex; flex-direction: column; color: var(--ink); }
.perm small { color: var(--muted); font-family: ui-monospace, monospace; font-size: .72rem; }
.perm.is-disabled { opacity: .5; cursor: not-allowed; }
.perm-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px; }
.perm-list li { display: flex; gap: 8px; align-items: center; font-size: .88rem; }
.perm-list .on .icon { color: var(--ok); }
.perm-list .off { color: var(--muted); }
.perm-list .off .icon { color: #CBCBD0; }
.stat__icon { width: 42px; height: 42px; border-radius: 10px; background: var(--blue-50); color: var(--blue); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* Configurações */
.settings { display: flex; flex-direction: column; gap: 16px; max-width: 1000px; }
.settings .card + .card { margin-top: 0; }
.settings__fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.settings__fields .field:has(textarea) { grid-column: 1 / -1; }
.logo-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.logo-preview { height: 120px; border-radius: 10px; display: flex; align-items: center; justify-content: center; padding: 16px; border: 1px solid var(--line); }
.logo-preview img { max-height: 100%; width: auto; object-fit: contain; }
.logo-preview--light { background: #fff; }
.logo-preview--dark { background: var(--side); }

/* Login */
.login { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; background: #fff; }
.login__art { display: flex; flex-direction: column; justify-content: space-between; padding: 48px; color: #fff;
  background: radial-gradient(600px 400px at 100% 0%, rgba(255,255,255,.14), transparent 60%), linear-gradient(140deg, #1B5E20, var(--blue)); }
.login__art img { width: 260px; height: auto; }
.login__art p { font-size: 1.45rem; font-weight: 600; line-height: 1.45; max-width: 460px; margin: 0; }
.login__art small { font-size: .8rem; opacity: .75; text-transform: uppercase; letter-spacing: .12em; }
.login__panel { display: flex; align-items: center; justify-content: center; padding: 30px 20px; }
.login__form { width: 100%; max-width: 370px; display: flex; flex-direction: column; gap: 14px; }
.login__form h1 { font-size: 1.5rem; margin: 10px 0 0; }
.login__panel { position: relative; }
.login__lang { position: absolute; top: 16px; right: 16px; }
.login__form p { margin: -6px 0 4px; }
.login__logo { width: 180px; height: auto; margin: 0 auto; display: none; }
.login .btn--primary { min-height: 46px; margin-top: 4px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .9rem; align-self: center; }

/* Responsivo */
@media (max-width: 1200px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1100px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-side { position: static; }
  .hide-md { display: none; }
  .row-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 45; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0 12px; }
  .content { padding: 16px 12px 32px; }
  .grid-2, .grid-3, .settings__fields, .logo-fields { grid-template-columns: 1fr; }
  .user-menu__name { display: none; }
  .login { grid-template-columns: 1fr; }
  .login__art { display: none; }
  .login__logo { display: block; }
  .row-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .table--stack thead { display: none; }
  .table--stack, .table--stack tbody, .table--stack tr, .table--stack td { display: block; width: 100%; }
  .table--stack tr { padding: 10px 14px; border-bottom: 1px solid var(--line); position: relative; }
  .table--stack td { border: 0; padding: 2px 0; text-align: left !important; }
  .table--stack td.hide-sm { display: none; }
  .table--stack td[data-label]::before { content: attr(data-label); display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
  .table--stack td.actions { width: auto; padding-top: 6px; }
  .table--stack tfoot { display: block; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .search { max-width: none; }
  .row-2, .row-3, .row-4 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .welcome-box { padding: 20px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi { padding: 12px; gap: 10px; }
  .kpi__icon { width: 36px; height: 36px; }
  .kpi__body strong { font-size: 1.1rem; }
  .dl { grid-template-columns: 1fr; gap: 2px; }
  .dl dd { margin-bottom: 8px; }
}

/* Impressão */
@media print {
  .sidebar, .topbar, .no-print, .toolbar__actions, .filters, .pagination, .attachments__form { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; font-size: 12px; }
  .card, .kpi { box-shadow: none; break-inside: avoid; }
}

/* ── Missão Amazônia: complementos ─────────────────────────────────────────── */
.lang-switch { display: inline-flex; gap: 2px; background: var(--soft); border-radius: 9px; padding: 3px; margin: 0; }
.lang-switch__btn { border: 0; background: none; font: inherit; font-size: .72rem; font-weight: 700; letter-spacing: .04em; color: var(--muted); padding: 5px 9px; border-radius: 7px; cursor: pointer; }
.lang-switch__btn:hover { color: var(--ink); }
.lang-switch__btn.is-on { background: #fff; color: var(--blue-800); box-shadow: 0 1px 2px rgba(16,24,40,.1); }
.legal { background: var(--bg); }
.legal__top { background: linear-gradient(135deg, #1B5E20, var(--teal)); color: #fff; padding: 26px 16px; }
.legal__top h1 { color: #fff; margin: 4px 0; font-size: 1.5rem; }
.legal__top small { opacity: .85; }
.legal__wrap { max-width: 860px; margin: 0 auto; padding: 20px 16px 60px; }
.legal__top .legal__wrap { padding: 0; }
.legal__nav { font-size: .88rem; }
.badge--blue { background: var(--blue-50); color: var(--blue-800); }
.risk { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 99px; font-size: .72rem; font-weight: 700; color: #fff; }
.risk--vermelho { background: #d32f2f; } .risk--laranja { background: #c2570c; } .risk--amarelo { background: #f9a825; color: #3b2f00; }
.risk--verde { background: #2f7d33; } .risk--azul { background: #1976d2; }   /* contraste ≥ 4,5:1; fonte única (antes duplicada no painel.css) */
.mission-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 26px; font-size: .8rem; font-weight: 500; color: #fff; background: linear-gradient(90deg, #1B5E20, #2E7D32); }
.mission-bar a { color: #C8E6C9; } .mission-bar a:hover { color: #fff; }
.mission-bar--warn { background: linear-gradient(90deg, #BF360C, #D84315); }

/* ───────── Revisão de UX/acessibilidade (campo: tablet, sol, satélite) ───────── */
/* Foco sempre visível: anel claro + anel escuro (funciona sobre fundo branco, verde e imagens). */
a:focus-visible, button:focus-visible, summary:focus-visible, [role="button"]:focus-visible, [tabindex]:focus-visible,
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible {
  outline: 2px solid #fff; outline-offset: 0; box-shadow: 0 0 0 4px #0B57D0; border-radius: 6px;
}
.sidebar a:focus-visible, .mission-bar a:focus-visible, .mission-bar button:focus-visible { box-shadow: 0 0 0 4px #fff; outline-color: #0B57D0; }

/* Alvos de toque ≥ 40px em telas de toque e em tablets/celulares. */
@media (pointer: coarse), (max-width: 900px) {
  .btn--sm { min-height: 44px; padding: 0 14px; font-size: .88rem; }
  .icon-btn, .menu-btn { width: 44px; height: 44px; }
  td.actions .icon-btn + .icon-btn, td.actions form.inline, td.actions form + form, .icon-btn--danger { margin-left: 8px; }
  .lang-switch__btn { min-height: 40px; min-width: 40px; }
  .mission-bar a, .mission-bar__out, .back-link, .link-btn, .small a, .user-menu__btn { min-height: 40px; display: inline-flex; align-items: center; }
  .sidebar a, .sidebar__foot a { min-height: 44px; }
  .dropdown a, .dropdown button { min-height: 44px; }
  .tabs a, .tab { min-height: 40px; display: inline-flex; align-items: center; }
  .masc-x { width: 40px; height: 40px; }
  .field input[type="checkbox"], .field input[type="radio"] { width: 22px; height: 22px; }
}

/* Idioma coreano: sem caixa-alta/espaçamento de letras (não existe em hangul e prejudica a leitura). */
html:lang(ko) body * { text-transform: none !important; letter-spacing: normal !important; }

/* Rodapé livre: a última linha nunca fica sob o botão do chat/mascote. */
.content { padding-bottom: 96px; }

/* Seletor de idioma: na barra no desktop; dentro do menu do usuário no celular (libera o título da página). */
.dropdown .lang-switch { display: none; padding: 6px 6px 2px; }
.dropdown .lang-switch .lang-switch__btn { flex: 1; justify-content: center; text-align: center; padding: 6px 8px; width: auto; }
@media (max-width: 640px) {
  .topbar > .lang-switch { display: none; }
  .dropdown .lang-switch { display: flex; }
  .topbar__title { font-size: 1rem; }
  .topbar { gap: 8px; }
}

/* Tabelas largas rolam dentro do cartão em vez de cortar (cartões "flush" e tabelas de relatório). */
.card--flush { overflow-x: auto; overflow-y: hidden; }
@media (max-width: 900px) {
  .content table:not(.table--stack) { display: block; overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
  .filters__actions { display: flex; flex-wrap: wrap; gap: 8px; }
  .alert { flex-wrap: wrap; }
}

/* Botão desabilitado durante o envio (evita toque duplo em internet lenta). */
button.is-saving, .btn.is-saving { opacity: .75; cursor: progress; pointer-events: none; }

/* Diálogo de confirmação/motivo (substitui confirm()/prompt() nativos). */
dialog.ma-dialog { border: 0; border-radius: 14px; padding: 0; width: min(440px, calc(100vw - 28px)); box-shadow: 0 24px 60px -12px rgba(0,0,0,.45); color: var(--text); }
dialog.ma-dialog::backdrop { background: rgba(17,24,39,.55); }
.ma-dialog__body { padding: 20px 20px 8px; }
.ma-dialog__body h3 { margin: 0 0 8px; font-size: 1.05rem; color: var(--ink); }
.ma-dialog__body p { margin: 0 0 10px; line-height: 1.5; }
.ma-dialog__item { display: block; margin: 8px 0 10px; padding: 8px 10px; background: var(--soft); border-radius: 8px; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.ma-dialog__body textarea { width: 100%; min-height: 80px; font: inherit; border: 1px solid #D1D5DB; border-radius: 8px; padding: 9px 11px; }
.ma-dialog__foot { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 20px 18px; flex-wrap: wrap; }
.ma-dialog__foot .btn { min-height: 44px; }

/* Menu "…" (ações raras/destrutivas fora da vista principal). */
.more-menu { position: relative; display: inline-block; }
.more-menu > summary { list-style: none; cursor: pointer; }
.more-menu > summary::-webkit-details-marker { display: none; }
.more-menu__panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 220px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 20px 40px -12px rgba(0,0,0,.25); padding: 6px; }
.more-menu__panel .btn { width: 100%; justify-content: flex-start; }

/* Aviso de erro de rede persistente (formulários clínicos/financeiros). */
.net-error { margin: 10px 0; }
/* Aviso com botão: o texto ocupa a largura; o botão desce para a linha de baixo no celular. */
.alert > span { flex: 1 1 200px; min-width: 0; }
.alert > .btn { flex: 0 0 auto; text-decoration: none; }
@media (max-width: 640px) { .alert > .btn { margin-left: 28px; } }
/* Selos longos (nomes de medicamento etc.) quebram de linha em vez de estourar o cartão. */
@media (max-width: 900px) { .badge--warn { white-space: normal; max-width: 100%; overflow-wrap: anywhere; } }
/* Barra de salvar fixa: não fica sob o botão flutuante do chat (canto direito). */
.sticky-save { padding-right: 76px; }
@media (min-width: 901px) { .sticky-save { padding-right: 76px; } }

/* Barra de salvar no celular: nunca corta nem empurra botão para fora da tela.
   Os botões quebram em linhas: "Salvar" (principal) e a ação secundária lado a lado; "Cancelar" numa linha própria, discreto. */
@media (max-width: 640px) {
  .sticky-save { flex-wrap: wrap; justify-content: stretch; gap: 8px; }
  .sticky-save > .btn { flex: 1 1 calc(50% - 8px); min-width: 0; white-space: normal; text-align: center; line-height: 1.2; padding-top: 8px; padding-bottom: 8px; }
  .sticky-save > .btn--primary { order: 1; }
  .sticky-save > .btn--outline { order: 2; }
  .sticky-save > .btn--ghost { order: 3; flex: 1 1 100%; min-height: 34px; }
  .sticky-save > .btn:only-child, .sticky-save > .btn--primary:nth-last-child(1):nth-child(2) { flex-basis: 100%; }
}
