/* Paineis - estilo compartilhado. Sobrio e utilitario. Sem dependencias externas. */
:root {
  --bg: #f5f6f4;
  --surface: #ffffff;
  --ink: #1e2a2f;
  --muted: #5e6b70;
  --line: #d9dedc;
  --brand: #2f5d50;
  --brand-ink: #ffffff;
  --danger: #a3381f;
  --ok: #2e7d4f;
  --warn: #9a6700;
  --radius: 6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.5 var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 1.25rem; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; margin: 2rem 0 0.75rem; font-weight: 650; }
p { margin: 0 0 1rem; max-width: 70ch; }
a { color: var(--brand); }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.hidden { display: none !important; }

:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }

/* ---------- Estrutura: menu lateral + conteudo ---------- */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.rail {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 1.25rem 0;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.rail .org { padding: 0 1.25rem 1rem; border-bottom: 1px solid var(--line); margin-bottom: 0.5rem; }
.rail .org strong { display: block; font-size: 1rem; line-height: 1.3; }
.rail .org span { font-size: 0.8rem; color: var(--muted); }
.rail .org img { max-width: 120px; max-height: 40px; display: block; margin-bottom: 0.5rem; }
.rail nav a {
  display: block; padding: 0.45rem 1.25rem; color: var(--ink); text-decoration: none;
  border-left: 3px solid transparent;
}
.rail nav a:hover { background: var(--bg); }
.rail nav a[aria-current="page"] { border-left-color: var(--brand); font-weight: 600; background: var(--bg); }
.rail .foot { padding: 1rem 1.25rem 0; border-top: 1px solid var(--line); margin-top: 0.75rem; font-size: 0.85rem; }
.rail .rail-search { padding: 0 1rem 0.5rem; }
.rail .rail-search input { width: 100%; font-size: 0.9rem; padding: 0.4rem 0.6rem; }
.search-results { min-width: min(560px, 90vw); }
.search-results h3 { margin: 1rem 0 0.25rem; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.search-results a { display: block; padding: 0.45rem 0.6rem; border-radius: var(--radius); text-decoration: none; color: var(--ink); }
.search-results a:hover, .search-results a:focus { background: var(--bg); }
.search-results a .muted { font-size: 0.85rem; }
.content { padding: 2rem 2.5rem 4rem; max-width: 1180px; width: 100%; }

.banner { padding: 0.65rem 1rem; border-radius: var(--radius); margin-bottom: 1.25rem; border: 1px solid; }
.banner.warn { background: #fdf6e3; border-color: #ecd9a6; color: #6b4a00; }
.banner.danger { background: #fbecea; border-color: #ecc3bb; color: #7a2512; }

/* ---------- Tabelas ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.55rem 0.75rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; font-size: 0.85rem; color: var(--muted); background: #fafbfa; }
tr:last-child td { border-bottom: 0; }
td.actions { white-space: nowrap; text-align: right; }
td.actions button { margin-left: 0.25rem; }
.empty { padding: 1.5rem; color: var(--muted); text-align: center; }

/* ---------- Resumo numerico ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 1.5rem; }
.stats div { padding: 1rem 1.25rem; border-right: 1px solid var(--line); }
.stats div:last-child { border-right: 0; }
.stats dt { font-size: 0.85rem; color: var(--muted); }
.stats dd { margin: 0.2rem 0 0; font-size: 1.35rem; font-weight: 650; font-variant-numeric: tabular-nums; }

/* ---------- Formularios ---------- */
details.form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 1rem; }
details.form > summary { cursor: pointer; padding: 0.7rem 1rem; font-weight: 600; color: var(--brand); list-style: none; }
details.form > summary::-webkit-details-marker { display: none; }
details.form > summary::before { content: "+ "; }
details.form[open] > summary::before { content: "- "; }
details.form form { padding: 0 1rem 1rem; }
form.inline, .toolbar { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: end; margin-bottom: 1rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.75rem 1rem; }
label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 0.4rem; color: var(--ink); font-size: 0.95rem; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid #bfc7c4; border-radius: var(--radius); padding: 0.45rem 0.6rem; min-height: 2.25rem;
}
textarea { min-height: 5rem; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent); }
.form-actions { margin-top: 1rem; display: flex; gap: 0.5rem; }

button, .button {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: var(--radius);
  padding: 0.45rem 0.9rem; min-height: 2.25rem; border: 1px solid var(--brand);
  background: var(--brand); color: var(--brand-ink); text-decoration: none; display: inline-block;
}
button.secondary, .button.secondary { background: var(--surface); color: var(--brand); }
button.danger { background: var(--surface); color: var(--danger); border-color: #d9a69a; }
button.small { padding: 0.2rem 0.6rem; min-height: 1.9rem; font-size: 0.85rem; }
button:disabled { opacity: 0.55; cursor: progress; }

/* ---------- Etiquetas de status ---------- */
.tag { display: inline-block; padding: 0.05rem 0.5rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600; border: 1px solid; white-space: nowrap; }
.tag.ok { color: var(--ok); border-color: #a9d1b9; background: #eef7f1; }
.tag.warn { color: var(--warn); border-color: #e2cc93; background: #fdf8ea; }
.tag.danger { color: var(--danger); border-color: #e3b5aa; background: #fbefec; }
.tag.neutral { color: var(--muted); border-color: var(--line); background: #f3f5f4; }

/* ---------- Arvore de ativos ---------- */
.tree { list-style: none; padding-left: 1.1rem; margin: 0; }
.tree.root { padding-left: 0; }
.tree li { padding: 0.15rem 0; }
.tree button.link { background: none; border: 0; color: var(--ink); padding: 0.1rem 0.25rem; min-height: auto; font-weight: 500; text-align: left; }
.tree button.link:hover, .tree button.link[aria-current="true"] { color: var(--brand); text-decoration: underline; }
.split { display: grid; grid-template-columns: minmax(240px, 1fr) 2fr; gap: 1.5rem; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; }

/* ---------- Avisos rapidos ---------- */
#toast { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 50; display: flex; flex-direction: column; gap: 0.5rem; }
#toast div { background: var(--ink); color: #fff; padding: 0.65rem 1rem; border-radius: var(--radius); max-width: 380px; }
#toast div.error { background: var(--danger); }

dialog { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.5rem; max-width: 520px; width: calc(100% - 2rem); color: var(--ink); }
dialog::backdrop { background: rgba(30, 42, 47, 0.35); }
dialog h2 { margin-top: 0; }
pre.code { white-space: pre-wrap; word-break: break-all; background: var(--bg); padding: 0.75rem; border-radius: var(--radius); font-size: 0.85rem; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.login form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 2rem; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 1rem; }
.login .brandmark { border-top: 4px solid var(--brand); margin: -2rem -2rem 0.5rem; border-radius: var(--radius) var(--radius) 0 0; }
.login h1 { margin: 0; }
.login img { max-width: 160px; max-height: 56px; }
.login .error { color: var(--danger); font-size: 0.9rem; min-height: 1.2em; }

/* ---------- Portaria (tablet) ---------- */
.gate { display: grid; grid-template-columns: minmax(300px, 420px) 1fr; gap: 2rem; align-items: start; }
.code-display { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.code-display span {
  flex: 1; aspect-ratio: 3 / 4; display: grid; place-items: center;
  font-size: 2.6rem; font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius);
}
.code-display span.filled { border-color: var(--ink); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
.keypad button { font-size: 1.6rem; min-height: 4.2rem; background: var(--surface); color: var(--ink); border: 1px solid #bfc7c4; }
.keypad button.go { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-size: 1.1rem; }
.keypad button[data-key="del"] { font-size: 1.1rem; }
.gate-result { padding: 1.5rem; border-radius: var(--radius); border: 2px solid var(--line); background: var(--surface); min-height: 10rem; }
.gate-result.granted { border-color: var(--ok); background: #eef7f1; }
.gate-result.denied { border-color: var(--danger); background: #fbefec; }
.gate-result strong { display: block; font-size: 2rem; line-height: 1.2; margin-bottom: 0.5rem; }

/* ---------- Morador (celular) ---------- */
.mobile { max-width: 560px; margin: 0 auto; padding: 1.25rem 1rem 6rem; }
.mobile header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.mobile header strong { font-size: 1.05rem; }
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--line);
  display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom, 0);
}
.tabbar a { flex: 1; max-width: 112px; text-align: center; padding: 0.7rem 0.25rem; font-size: 0.85rem; color: var(--muted); text-decoration: none; border-top: 3px solid transparent; }
.tabbar a[aria-current="page"] { color: var(--brand); border-top-color: var(--brand); font-weight: 600; }
.list { list-style: none; padding: 0; margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.list li { padding: 0.85rem 1rem; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .row { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.list .sub { color: var(--muted); font-size: 0.88rem; }
.list .value { font-weight: 650; font-variant-numeric: tabular-nums; }

/* ---------- Seletor de paineis (tela unica de login) ---------- */
.panel-choices { display: flex; flex-direction: column; gap: 0.6rem; }
.panel-choices button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.15rem; text-align: left; width: 100%;
  background: var(--surface); color: var(--ink); border: 1px solid #bfc7c4; padding: 0.8rem 1rem; min-height: 3.5rem;
}
.panel-choices button span { color: var(--muted); font-size: 0.88rem; font-weight: 400; }
.panel-choices button:hover { border-color: var(--brand); }
.panel-choices button[aria-current="true"] { border: 2px solid var(--brand); padding: calc(0.8rem - 1px) calc(1rem - 1px); }
.panel-choices button[aria-current="true"] strong { color: var(--brand); }

/* ---------- Responsivo ---------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 0.75rem 0; }
  .rail nav { display: flex; overflow-x: auto; }
  .rail nav a { white-space: nowrap; border-left: 0; border-bottom: 3px solid transparent; }
  .rail nav a[aria-current="page"] { border-bottom-color: var(--brand); }
  .content { padding: 1.25rem 1rem 3rem; }
  .split, .gate { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Avisos acima da barra de abas no celular */
@media (max-width: 600px) {
  #toast { left: 1rem; right: 1rem; bottom: 4.75rem; }
  #toast div { max-width: none; }
}

.mobile header nav.account { display: flex; gap: 0.75rem; font-size: 0.9rem; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- Mapa do condominio (fachada) ---------- */
.map-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 1rem 0; }
.segmented { display: flex; flex-wrap: wrap; border: 1px solid #bfc7c4; border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.segmented button { border: 0; border-radius: 0; background: var(--surface); color: var(--ink); font-weight: 500; min-height: 44px; padding: 0 16px; }
.segmented button + button { border-left: 1px solid #bfc7c4; }
.segmented button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 0.85rem; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(30, 42, 47, 0.2); display: inline-block; }
.map-layout { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.facade { flex: 999 1 560px; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 24px 0; overflow-x: auto; }
.facade-towers { display: flex; gap: 48px; align-items: flex-end; justify-content: center; min-width: max-content; padding: 0 16px; }
.tower { display: flex; flex-direction: column; align-items: center; }
.tower .tank { width: 56px; height: 18px; background: #cdd3d0; border: 1px solid #b4bcb8; border-bottom: 0; border-radius: 3px 3px 0 0; }
.tower .roof { align-self: stretch; background: var(--ink); color: #fff; text-align: center; font-weight: 650; font-size: 0.9rem; padding: 6px 12px; border-radius: 4px 4px 0 0; }
.tower .body { background: #e6e9e7; border-left: 1px solid #b4bcb8; border-right: 1px solid #b4bcb8; padding: 10px 12px 6px; display: flex; flex-direction: column; gap: 6px; }
.tower .row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; max-width: 560px; }
.tower .row > span { width: 22px; text-align: right; font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.tower .ground { align-self: stretch; height: 52px; background: #d4d9d6; border: 1px solid #b4bcb8; display: flex; align-items: flex-end; justify-content: center; gap: 10px; padding: 0 12px; font-size: 0.75rem; }
.tower .ground span { align-self: center; }
.tower .ground .door { width: 34px; height: 36px; background: var(--ink); border-radius: 3px 3px 0 0; }
.unit-btn { width: 48px; height: 44px; padding: 0; border-radius: 4px; font-size: 0.75rem; font-weight: 600; font-variant-numeric: tabular-nums; border: 1px solid rgba(30, 42, 47, 0.18); background: #d6e6dd; color: var(--ink); min-height: 0; }
.unit-btn.wide { width: auto; padding: 0 8px; }
.unit-btn[aria-pressed="true"] { outline: 3px solid var(--ink); outline-offset: 2px; }
.unit-btn.ok { background: #d6e6dd; color: var(--ink); }
.unit-btn.late { background: #f2c46d; color: var(--ink); }
.unit-btn.debt { background: #a3381f; color: #fff; }
.unit-btn.owner { background: #2f5d50; color: #fff; }
.unit-btn.rented { background: #9cc3d9; color: var(--ink); }
.unit-btn.empty { background: #f5f6f4; color: var(--muted); border: 1px dashed #9aa5a0; }
.ground-areas { margin: 0 -24px; padding: 14px 24px 18px; background: #eef1ef; border-top: 3px solid #8f9a95; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ground-areas .chip { font-size: 0.85rem; padding: 6px 12px; border-radius: 999px; border: 1px solid #b4bcb8; background: var(--surface); }
.ground-areas .chip.static { background: var(--bg); }
.unit-panel { flex: 1 1 300px; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.unit-panel h2 { margin: 2px 0 6px; font-size: 1.5rem; }
.unit-panel dl { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; font-size: 0.9rem; }
.unit-panel dt { color: var(--muted); font-size: 0.8rem; }
.unit-panel dd { margin: 0; font-variant-numeric: tabular-nums; }
.unit-panel h3 { margin: 0 0 6px; font-size: 0.95rem; }

/* ---------- Escolha do tipo (cartoes) ---------- */
dialog.wide { max-width: 1180px; width: calc(100% - 2rem); padding: 0; }
.picker { display: flex; height: min(640px, calc(100vh - 15rem)); min-height: 320px; }
.picker-side form, .picker-side { position: relative; }
dialog.wide { max-height: calc(100vh - 2rem); overflow: auto; }
.picker-main { flex: 1; min-width: 0; overflow: auto; padding: 18px 24px; display: flex; flex-direction: column; gap: 16px; }
.picker-side { width: 340px; flex-shrink: 0; border-left: 1px solid var(--line); background: #fafbfa; padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; overflow: auto; }
.picker-side > div:last-child { position: sticky; bottom: -18px; background: #fafbfa; padding: 10px 0 18px; }
@media (max-width: 860px) { .picker { flex-direction: column; height: auto; } .picker-side { width: auto; border-left: 0; border-top: 1px solid var(--line); } }
.picker-head { padding: 18px 24px 14px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.kind-group h3 { margin: 0; font-size: .95rem; display: inline; }
.kind-group .muted { font-size: .85rem; margin-left: 8px; }
.kind-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin-top: 8px; }
.kind-card { text-align: left; display: flex; flex-direction: column; gap: 6px; min-height: 112px; padding: 12px 14px; border-radius: 8px; background: var(--surface); color: var(--ink); border: 1px solid #cfd6d3; font-weight: 400; }
.kind-card strong { font-size: .95rem; }
.kind-card .desc { font-size: .82rem; color: var(--muted); line-height: 1.4; }
.kind-card .badges { display: flex; flex-wrap: wrap; gap: 4px; }
.kind-card .badges span { font-size: .7rem; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: #eef1ef; color: #3d474b; }
.kind-card[aria-pressed="true"] { background: #e9f1ed; border: 2px solid var(--brand); padding: 11px 13px; }
.kind-card[aria-disabled="true"] { background: #f3f4f3; color: #8b9591; border-color: #e2e6e4; cursor: not-allowed; }
.kind-card .why { font-size: .78rem; color: #8a2e18; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip-btn { min-height: 40px; padding: 0 14px; border-radius: 999px; background: var(--surface); color: var(--ink); border: 1px solid #bfc7c4; font-weight: 500; }
.chip-btn[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 600; }
.meter { height: 8px; background: #e6e9e7; border-radius: 999px; overflow: hidden; }
.meter > div { height: 100%; background: var(--brand); }
.meter.over > div { background: var(--danger); }

/* ---------- Assistente ---------- */
.wizard { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.wizard section { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.wizard h2 { margin: 0; font-size: 1.05rem; }
.choice { text-align: left; display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 8px; background: var(--surface); color: var(--ink); border: 1px solid #cfd6d3; font-weight: 400; }
.choice[aria-pressed="true"] { background: #e9f1ed; border: 2px solid var(--brand); padding: 11px 13px; }
.choice span { font-size: .82rem; color: var(--muted); }
.stepper { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stepper div { display: flex; align-items: center; gap: 6px; }
.stepper button { width: 44px; height: 44px; padding: 0; background: var(--surface); color: var(--ink); border: 1px solid #bfc7c4; font-size: 1.1rem; }
.stepper output { width: 44px; text-align: center; font-weight: 650; font-variant-numeric: tabular-nums; }
.preview-box { margin-top: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 18px 22px; display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-end; }
.preview-towers { display: flex; gap: 18px; align-items: flex-end; flex: 1; min-width: 0; overflow-x: auto; }
.mini { display: flex; flex-direction: column; align-items: center; }
.mini b { background: var(--ink); color: #fff; font-size: .72rem; padding: 2px 10px; border-radius: 3px 3px 0 0; align-self: stretch; text-align: center; }
.mini .cells { display: grid; gap: 2px; padding: 4px; background: #e6e9e7; border: 1px solid #b4bcb8; }
.mini .cells i { width: 12px; height: 8px; background: #d6e6dd; border: 1px solid #b4c8bc; border-radius: 1px; }


/* ---------- Listas selecionaveis (assembleias) ---------- */
.row-btn { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; text-align: left; background: var(--surface); color: var(--ink); border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 12px 14px; min-height: 56px; font-weight: 400; }
.row-btn[aria-pressed="true"] { background: #e9f1ed; box-shadow: inset 4px 0 0 var(--brand); }
.panel > .row-btn:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.panel > .row-btn:last-child { border-bottom: 0; border-radius: 0 0 var(--radius) var(--radius); }


/* ---------- Agenda semanal de reservas ---------- */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.week .day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-height: 180px; display: flex; flex-direction: column; gap: 6px; padding: 8px; }
.week .day.today { border-color: var(--brand); box-shadow: inset 0 3px 0 var(--brand); }
.week .day header { font-size: .78rem; color: var(--muted); text-transform: capitalize; }
.week .day.today header { color: var(--brand); font-weight: 650; }
.week .slot { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: left; background: #e9f1ed; border: 1px solid #bcd3c8; border-radius: 6px; color: var(--ink); padding: 6px 8px; min-height: 0; font-weight: 400; font-size: .78rem; }
.week .slot strong { font-variant-numeric: tabular-nums; }
.week .slot span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
button.link { background: none; border: 0; color: var(--brand); text-decoration: underline; padding: 0; min-height: 0; font: inherit; font-size: inherit; }
@media (max-width: 1100px) { .week { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); } }

/* Resultado do mes: DRE em duas colunas e evolucao em barras (sem biblioteca) */
.dre { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
@media (max-width: 860px) { .dre { grid-template-columns: 1fr; } }
.dre table td:first-child { width: 60%; }
.dre tfoot td { font-weight: 650; border-top: 2px solid var(--line); }
.result-line { display: flex; justify-content: space-between; align-items: baseline; padding: .6rem 0; border-top: 1px solid var(--line); }
.result-line strong { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.pos { color: var(--ok); }
.neg { color: var(--danger); }
.evo { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; align-items: end; height: 180px; padding: 0 .25rem; }
.evo .bars { display: flex; gap: 2px; align-items: end; height: 150px; }
.evo .bars > span { flex: 1; border-radius: 3px 3px 0 0; min-height: 2px; }
.evo .bars .in { background: var(--brand); }
.evo .bars .out { background: #c8793f; }
.evo .lbl { font-size: .7rem; color: var(--muted); text-align: center; margin-top: 4px; white-space: nowrap; }
.evo-legend { display: flex; gap: 1rem; font-size: .8rem; color: var(--muted); margin: .25rem 0 .75rem; }
.evo-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.evo .m { cursor: pointer; border: 0; background: none; padding: 0; width: 100%; }
.evo .m[aria-pressed="true"] .bars > span { outline: 2px solid var(--ink); outline-offset: -2px; }

/* Cobrancas: selecao em lote */
.bulk-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .6rem .9rem; margin: 0 0 .75rem; border: 1px solid var(--line); border-radius: var(--radius); background: #fafbfa; }
.bulk-bar strong { margin-right: .5rem; }
td.sel, th.sel { width: 32px; padding-right: 0; }
td.sel input, th.sel input { width: 18px; height: 18px; margin: 0; }
tr.selected td { background: #eef3f1; }

/* Inicio: alertas acionaveis (cada um leva para a tela que resolve) */
.alerts { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1.25rem; }
.alert { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .7rem 1rem; border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: var(--radius); background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 500; }
.alert:hover { background: #f4f7f5; }
.alert.grave { border-left-color: var(--danger); }
.banner.ok { border-color: #a9d1b9; background: #eef7f1; color: #24593c; }

/* Lista de opcoes marcaveis (escopo de usuario, audiencias) */
fieldset.check-list { border: 1px solid var(--line); border-radius: 8px; padding: 0.5rem 0.9rem 0.7rem; margin: 0.75rem 0; display: flex; flex-wrap: wrap; gap: 0.35rem 1.25rem; }
fieldset.check-list legend { font-size: 0.85rem; color: var(--muted); padding: 0 0.3rem; }

/* v0.22: carteira, manutencao, conciliacao */
.stats dd.ok { color: var(--ok); } .stats dd.danger { color: var(--danger); } .stats dd.warn { color: var(--warn); }
.stats.small dd { font-size: 1.05rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 0.75rem 1.5rem; margin-bottom: 1rem; }
.page-head h1 { margin-bottom: 0.25rem; }
.page-head .inline { margin: 0; }
.bar { background: #e7efec; border-radius: 4px; height: 10px; min-width: 120px; }
.bar div { background: var(--ok); height: 10px; border-radius: 4px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1.5rem; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; }
.card h2 { margin: 0 0 0.5rem; font-size: 1rem; }
ul.plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.95rem; }
ul.plain li { display: flex; justify-content: space-between; gap: 1rem; }
span.ok { color: var(--ok); } span.danger { color: var(--danger); } span.warn, div.warn { color: var(--warn); }

/* v0.24: termos de uso */
dialog#terms { max-width: 720px; }
.terms-body { max-height: 50vh; overflow: auto; border: 1px solid var(--line); border-radius: 6px; padding: 0.75rem 1rem; margin-bottom: 0.75rem; font-size: 0.92rem; }
.terms-body h2 { font-size: 1.1rem; margin: 0.5rem 0 0.25rem; } .terms-body h3 { font-size: 0.95rem; margin: 0.6rem 0 0.2rem; }

/* v0.25: abas internas */
.subtabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--line); }
.subtabs a { padding: 0.5rem 0.9rem; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; }
.subtabs a.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

/* v0.28: escolha em cartões (configuração de e-mail) */
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.75rem; }
.choice { display: flex; flex-direction: column; gap: 0.25rem; border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem; cursor: pointer; background: var(--surface); }
.choice.active { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 25%, transparent); }
.choice input { margin: 0 0 0.25rem; align-self: flex-start; }
.choice span.muted { font-size: 0.85rem; }
.live-gauge { height: 14px; background: #e7efec; border-radius: 7px; overflow: hidden; }
.live-gauge div { height: 100%; background: var(--ok); transition: width .4s; }

/* ---------- 0.30: menu por modulos, favoritos e Inicio analitico ---------- */
.rail nav { display: flex; flex-direction: column; }
.rail nav a { display: flex; align-items: center; gap: 0.6rem; }
.rail nav a svg { flex: 0 0 auto; }
.rail nav a svg.fav { color: var(--warn); }
.rail .nav-section { display: flex; justify-content: space-between; align-items: center; padding: 0.6rem 1.25rem 0.2rem; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.rail .nav-section a { font-size: 0.7rem; font-weight: 500; letter-spacing: 0; text-transform: none; padding: 0; border: 0; }
.rail .nav-empty { padding: 0.3rem 1.25rem 0.5rem; font-size: 0.8rem; margin: 0; }
.rail .nav-sep { height: 1px; background: var(--line); margin: 0.5rem 1.25rem; }
.rail .badge { margin-left: auto; font-size: 0.7rem; line-height: 1; padding: 0.2rem 0.45rem; border-radius: 10px; background: var(--bg); color: var(--muted); font-variant-numeric: tabular-nums; }
.rail .badge.warn { background: #fdf3df; color: #7a4a00; }
.rail .badge.danger { background: #fbecea; color: #8a2a1a; }
.rail .badge.ok { background: #e6f2ea; color: #1f5c38; }
.rail details.nav-group summary { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 1.25rem; cursor: pointer; list-style: none; color: var(--ink); }
.rail details.nav-group summary::-webkit-details-marker { display: none; }
.rail details.nav-group summary::after { content: "›"; margin-left: 0.25rem; color: var(--muted); transition: transform 0.15s; }
.rail details.nav-group[open] summary::after { transform: rotate(90deg); }
.rail details.nav-group[open] summary { font-weight: 600; }
.rail details.nav-group summary .count { margin-left: auto; font-size: 0.7rem; color: var(--muted); }
.rail details.nav-group a { padding: 0.35rem 1.25rem 0.35rem 2.85rem; font-size: 0.9rem; }
.star { width: 30px; height: 30px; font-size: 1rem; font-weight: 400; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; margin-left: 0.5rem; padding: 0; cursor: pointer; }
.star.on { color: var(--warn); border-color: #ecd9a6; }
.star:hover { background: var(--bg); }
.fav-manage { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.fav-manage h3 { margin: 0 0 0.5rem; font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.fav-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.5rem 0.7rem; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 0.4rem; }
.fav-row > span:first-child { display: flex; flex-direction: column; font-size: 0.9rem; }
.fav-row .muted { font-size: 0.75rem; }
.fav-row-actions { display: flex; gap: 0.2rem; }
.fav-row-actions .icon { width: 30px; height: 30px; padding: 0; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); color: var(--ink); cursor: pointer; }
.fav-row-actions .icon:disabled { opacity: 0.35; cursor: default; }
.fav-group-title { font-size: 0.75rem; color: var(--muted); margin: 0.6rem 0 0.2rem; }
.fav-manage label.check { display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0.4rem; margin: 0; font-size: 0.9rem; }
button.link { border: 0; background: none; color: var(--muted); font: inherit; cursor: pointer; padding: 0; }

.home-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.25rem; }
.home-head h1 { margin: 0 0 0.2rem; }
.home-head p { margin: 0; }
.home-head form.inline { margin: 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0.8rem; margin-bottom: 1.5rem; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 0.9rem 1rem; display: flex; flex-direction: column; gap: 0.3rem; }
.kpi-label { font-size: 0.8rem; color: var(--muted); }
.kpi strong { font-size: 1.45rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.kpi strong.danger, .kpi-note.danger, .fav-note.danger, .warn-text.danger { color: var(--danger); }
.kpi strong.ok, .kpi-note.ok, .fav-note.ok { color: var(--ok); }
.kpi strong.warn, .kpi-note.warn, .fav-note.warn, .warn-text { color: var(--warn); }
.kpi-note { font-size: 0.8rem; color: var(--muted); }
.home-section { margin-bottom: 1.5rem; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 0.6rem; }
.section-head h2 { margin: 0; font-size: 1rem; }
.section-head a { font-size: 0.85rem; }
.fav-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0.8rem; }
.fav-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 0.8rem 1rem; display: flex; flex-direction: column; gap: 0.2rem; text-decoration: none; color: var(--ink); min-height: 44px; }
.fav-card:hover { border-color: var(--brand); }
.fav-title { font-size: 0.8rem; color: var(--muted); }
.fav-card strong { font-size: 1.3rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.fav-card .unit { font-size: 0.85rem; font-weight: 400; color: var(--muted); }
.fav-note { font-size: 0.8rem; color: var(--muted); }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 0.8rem; margin-bottom: 1.5rem; }
.chart { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 0.9rem 1rem; display: flex; flex-direction: column; gap: 0.6rem; min-width: 0; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.chart-head h2 { margin: 0; font-size: 0.95rem; }
.chart-head a, .chart-head .muted, .chart .small { font-size: 0.75rem; }
.bars { display: flex; align-items: flex-end; gap: 0.5rem; height: 140px; border-bottom: 1px solid var(--line); padding-bottom: 2px; }
.bars.proj { gap: 2px; }
.bar-group { flex: 1; display: flex; align-items: flex-end; gap: 3px; height: 100%; min-width: 0; }
.bar-group.partial { opacity: 0.55; }
.bar { flex: 1; border-radius: 3px 3px 0 0; min-width: 2px; }
.bar.in { background: var(--brand); }
.bar.out { background: #c9d3cd; }
.bars.proj .bar { background: var(--brand); border-radius: 2px; }
.bars.proj .bar.neg { background: var(--danger); }
.axis { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--muted); }
.legend { display: flex; gap: 0.9rem; font-size: 0.75rem; color: var(--muted); }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 0.3rem; vertical-align: -1px; }
.legend .sw.in { background: var(--brand); } .legend .sw.out { background: #c9d3cd; }
.hbars { display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.8rem; }
.hbar { display: grid; grid-template-columns: 110px 1fr 46px; gap: 0.5rem; align-items: center; }
.hbar.selected .label { font-weight: 600; }
.hbar .label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar .track { height: 10px; background: var(--bg); border-radius: 5px; overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 5px; }
.hbar .fill.ok { background: var(--ok); } .hbar .fill.warn { background: var(--warn); } .hbar .fill.danger { background: var(--danger); }
.hbar .val { text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1.25rem; }
.alert.warn { border-left-color: var(--warn); }
.alert.neutral { border-left-color: var(--line); }
.activity { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0.6rem; font-size: 0.85rem; }
.activity-item { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.6rem 0.8rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.activity-item em { font-style: normal; color: var(--muted); }
@media (max-width: 720px) { .fav-manage { grid-template-columns: 1fr; } .hbar { grid-template-columns: 80px 1fr 42px; } }
