:root {
  --color-50: #eefaf8;
  --color-100: #d7f1eb;
  --color-200: #b6e4d7;
  --color-300: #7fcfbb;
  --color-400: #49b89c;
  --color-500: #1f9b7e;
  --color-600: #0f7c68;
  --color-700: #0d6154;
  --color-800: #0b4c44;
  --color-900: #083b36;

  --bg: #f6fbfc;
  --surface: #ffffff;
  --border: #d5e4e7;
  --text: #0e2a2d;
  --muted: #5c6f74;
  --card: #ffffff;
  --accent: var(--color-600);
  --accent-strong: var(--color-500);
  --shadow: 0 14px 48px rgba(8, 59, 54, 0.14);
  --body-bg: linear-gradient(180deg, rgba(255,255,255,0.94), rgba(245,251,252,0.96));
  --sidebar-bg: rgba(255,255,255,0.86);
  --topbar-bg: rgba(255,255,255,0.9);
  --footer-bg: #f9fbff;
}

.theme-dark {
  --bg: #0f1418;
  --surface: #161d23;
  --border: #24303b;
  --text: #e6edf3;
  --muted: #94a3b8;
  --card: #131a21;
  --accent: #3dd6b7;
  --accent-strong: #22b58f;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  --body-bg: linear-gradient(180deg, #0f1418, #0f1418);
  --sidebar-bg: rgba(22,29,35,0.92);
  --topbar-bg: rgba(22,29,35,0.9);
  --footer-bg: #11171d;
}

* { box-sizing: border-box; }
body {
  margin:0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  background: var(--body-bg);
  color: var(--text);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }

.app-body { display: flex; min-height: 100vh; }
.layout { display: grid; grid-template-columns: auto 1fr; width: 100%; }
.sidebar {
  background: var(--sidebar-bg);
  border-right: none;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: width 0.3s ease;
  min-height: 100vh;
  width: 260px;
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
}
.sidebar.collapsed { width: 78px; }
.sidebar.collapsed .menu-item span { display: none; }
.sidebar .submenu { padding-left: 12px; display: none; flex-direction: column; gap: 4px; }
.sidebar .menu-group.open > .submenu { display: flex; }
.sidebar .submenu .menu-item { padding-left: 10px; font-size: 13px; }
.sidebar .submenu .menu-group { padding-left: 0; }
.sidebar .submenu .menu-group .submenu { padding-left: 12px; }
.sidebar .submenu .menu-group .menu-item { padding-left: 10px; font-size: 13px; }
.menu-group { display: flex; flex-direction: column; gap: 4px; }
.menu-parent { cursor: default; }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.logo-mark {
  border-radius: 12px;
  padding: 4px;
  box-shadow: var(--shadow);
  background: #ffffff;
}
.logo-mark img { display: block; width: 90px; height: auto; }
.logo-mark.small { padding: 4px; }
.logo-mark.small img { width: 64px; }
.icon-btn {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: 0.2s ease;
  box-shadow: var(--shadow);
}
.icon-btn.sm { padding: 6px 8px; border-radius: 8px; font-size: 14px; }
.icon-btn.toggle-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 6px 20px rgba(8, 59, 54, 0.14);
}
.icon-btn.toggle-btn i { pointer-events: none; }
.icon-btn:hover, .icon-btn:focus { border-color: var(--accent); color: var(--accent-strong); outline: none; }
.menu { display: flex; flex-direction: column; gap: 6px; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--muted);
  border: 1px solid transparent;
  transition: 0.2s ease;
}
.menu-item:hover { color: var(--text); border-color: var(--border); background: rgba(31,155,126,0.12); }
.menu-item.active { background: rgba(31,155,126,0.18); color: var(--text); border-color: var(--accent); }
.menu-group.open > .menu-parent {
  background: rgba(31,155,126,0.16);
  color: var(--text);
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}
.menu-group.open > .menu-parent i { color: var(--accent-strong); }
.menu-group.open > .submenu {
  border-left: 2px solid rgba(31,155,126,0.28);
  margin-left: 6px;
  padding-left: 10px;
}

.main { display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: none;
  background: var(--topbar-bg);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 10;
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 78px 1fr; }
  .sidebar { width: 78px; }
  .sidebar .menu-item span { display: none; }
  .topbar { flex-wrap: wrap; gap: 10px; }
}
.brand-wrap { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 42px; height: 42px; object-fit: cover; border-radius: 8px; box-shadow: 0 4px 12px rgba(8,59,54,0.18); }
.subtitle { font-weight: 700; letter-spacing: 0.02em; color: var(--accent); font-size: 18px; }
.muted { color: var(--muted); font-size: 13px; }
.user-info { display: flex; align-items: center; gap: 8px; }
.user-meta { font-weight: 600; font-size: 9px; color: var(--text); white-space: nowrap; }
.theme-toggle { display: flex; align-items: center; gap: 6px; margin-left: 6px; }
.theme-btn {
  width: 20px;
  height: 20px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: none;
  box-shadow: none;
}
.theme-btn i { font-size: 16px; }
.theme-btn.active { color: var(--accent-strong); box-shadow: 0 6px 16px rgba(31,155,126,0.3); }

#content-area { flex: 1; padding: 18px; min-height: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.card {
  background: var(--card);
  border: none;
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.card-title { font-weight: 700; margin-bottom: 8px; }
.card.highlight { background: linear-gradient(135deg, rgba(31,155,126,0.15), rgba(15,124,104,0.22)); border-color: rgba(31,155,126,0.35); }
.noticia-box {
  background: var(--card);
  border: none;
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--text);
  box-shadow: var(--shadow);
}
.noticia-box h5 { margin: 0 0 6px; color: var(--text); }
.noticia-box p { margin: 6px 0 0; color: var(--text); }
.noticia-box a { color: var(--accent); font-weight: 600; }
.noticia-box small { display: block; color: var(--muted); }
.theme-dark .noticia-box h5,
.theme-dark .noticia-box p { color: #ffffff; }
.theme-dark .noticia-box small { color: #ffffff !important; }
.theme-dark .noticia-box .text-muted { color: #ffffff !important; }

.table-responsive { overflow-x: auto; }
.table-foot {
  position: sticky;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--card);
  padding: 6px 4px 2px;
  z-index: 2;
}
.table { width: 100%; border-collapse: collapse; background: transparent; }
.table th, .table td { padding: 8px 7px; border-bottom: 1px solid var(--border); text-align: left; font-size: 12px; background: transparent; }
.table th { color: var(--muted); font-size: 13px; }
.fip-table th { font-size: 10px; }
.fip-table td { font-size: 8px; }
.fip-card .table-responsive { max-width: 100%; }
.table tr:hover { background: rgba(31,155,126,0.08); }
.theme-dark .table { color: #ffffff; }
.theme-dark .table th, .theme-dark .table td { color: #ffffff; border-bottom: 1px solid rgba(255,255,255,0.35); background: transparent; }
.theme-dark .table tr:hover { background: rgba(255,255,255,0.06); }
.theme-dark .table-foot {
  background: #0f1418;
  border-top: 1px solid #1f2937;
}
.theme-dark .muted { color: #e5e8ed; }
.theme-dark .card-title,
.theme-dark .field span,
.theme-dark label,
.theme-dark .menu-item,
.theme-dark .card,
.theme-dark .user-meta { color: var(--text); }
.theme-dark .menu-group.open > .menu-parent {
  background: rgba(31,155,126,0.24);
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}
.theme-dark .menu-group.open > .submenu { border-left: 2px solid rgba(31,155,126,0.4); }
.theme-dark .subtitle { color: var(--accent); text-shadow: 0 1px 0 rgba(255,255,255,0.45); }
.theme-dark input,
.theme-dark select,
.theme-dark textarea { color: var(--text); background: var(--surface); border-color: var(--border); }
.theme-dark input[type="datetime-local"]::-webkit-calendar-picker-indicator { filter: invert(1); }
.theme-dark input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1); }
.theme-dark input[type="time"]::-webkit-calendar-picker-indicator { filter: invert(1); }
.theme-dark input::placeholder,
.theme-dark textarea::placeholder { color: #9fb3c8; }
.table .filter-row input {
  width: 100%;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 11px;
}
.theme-dark .table .filter-row input {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.2);
  color: #ffffff;
}

.footer {
    padding: 12px 18px;
    border-top: none;
    color: var(--muted);
    font-size: 10px;
  background: var(--footer-bg);
}

.multi-filter { position: relative; min-width: 140px; }
.mf-wrapper { position: relative; }
.mf-display {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font-size: 8px;
}
.mf-display i { margin-left: 6px; font-size: 8px; }
.theme-dark .mf-display {
  background: #1e2833;
  border-color: rgba(255,255,255,0.12);
  color: #e5e7eb;
}
.mf-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 220px;
  min-height: 240px;
  width: 260px;
  height: 240px; /* altura inicial */
  /* sem max-height para permitir redimensionar livremente */
  resize: both;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
  display: none;
  z-index: 5;
}
.mf-panel.open {
  display: flex;
  flex-direction: column;
}
.theme-dark .mf-panel {
  background: #11171d;
  border-color: rgba(255,255,255,0.12);
}
.mf-search {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 8px 10px;
  outline: none;
  font-size: 8px;
  background: transparent;
  color: var(--text);
  flex: 0 0 auto;
}
.theme-dark .mf-search {
  border-color: rgba(255,255,255,0.12);
  color: #e5e7eb;
}
.mf-options {
  min-height: 120px;
  overflow-y: auto;
  padding: 6px 8px;
  text-align: left;
  flex: 1 1 auto;
}
.mf-option {
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 8px;
}
.mf-option input {
  justify-self: center;
}
.mf-option span { white-space: nowrap; }
.mf-option input { margin: 0; }
.mf-option:hover { background: rgba(0, 0, 0, 0.04); }
.theme-dark .mf-option:hover { background: rgba(255, 255, 255, 0.06); }

.mf-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px;
  border-top: 1px solid var(--border);
}
.theme-dark .mf-actions {
  border-color: rgba(255,255,255,0.12);
}
.mf-btn {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #f4f6fb;
  font-size: 8px;
  cursor: pointer;
}
.mf-btn.ghost {
  background: transparent;
}
.mf-btn.primary {
  background: linear-gradient(135deg, var(--color-600), var(--color-400));
  color: #fff;
  border-color: transparent;
}
.theme-dark .mf-btn {
  background: #1e2833;
  border-color: rgba(255,255,255,0.12);
  color: #e5e7eb;
}
.theme-dark .mf-btn.primary {
  background: linear-gradient(135deg, var(--color-400), var(--color-500));
  border-color: transparent;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  flex-wrap: wrap;
  font-size: 10px;
}
.pagination button {
  min-width: 32px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  background: #ffffff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 10px;
  color: var(--text);
}
.pagination button.active {
  background: var(--color-100);
  border-color: var(--color-300);
  font-weight: 600;
}
.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.report-empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  width: 100%;
  padding: 24px;
  font-size: 2rem;
  font-weight: 700;
  color: #35566c;
  text-align: center;
}
.theme-dark .pagination button {
  background: #111827;
  border-color: #1f2937;
  color: #e5e7eb;
}
.theme-dark .pagination button.active {
  background: rgba(59,130,246,0.25);
  border-color: rgba(59,130,246,0.5);
  color: #e5e7eb;
}

.btn { display: inline-flex; align-items: center; justify-content: center; padding: 12px 14px; border-radius: 12px; border: 1px solid transparent; cursor: pointer; font-weight: 600; transition: 0.2s ease; }
.btn.sm { padding: 8px 13px; border-radius: 10px; font-size: 14px; }
.btn i { margin-right: 8px; }
.btn-primary { background: linear-gradient(135deg, var(--color-600), var(--color-400)); color: #ffffff; border-color: transparent; }
.btn-primary:hover, .btn-primary:focus { filter: brightness(1.05); }
.btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626); color: #ffffff; border-color: transparent; }
.btn-danger:hover, .btn-danger:focus { filter: brightness(1.05); }
.theme-dark .btn {
  color: #ffffff;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.2);
}
.theme-dark .btn:hover,
.theme-dark .btn:focus {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.3);
}

.form { display: flex; flex-direction: column; gap: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.field-full { grid-column: 1 / -1; }
.field-disabled:disabled,
.form-grid input:disabled,
.form-grid select:disabled,
.form-grid textarea:disabled {
  background: #eef2f4;
  color: #6b7280;
  border-color: #d1d5db;
  cursor: not-allowed;
}
.wizard-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(31,155,126,0.08);
}
.wizard-step-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.wizard-step-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}
.wizard-step-btn:focus {
  outline: 2px solid rgba(31,155,126,0.4);
  outline-offset: 2px;
}
.wizard-step { display: none; }
.wizard-step.active { display: block; }
.form-section {
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 10px;
  background: var(--surface);
}
.form-section-title {
  font-weight: 700;
  color: var(--accent);
  margin: 12px 0 6px;
  padding: 6px 10px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: rgba(31,155,126,0.08);
}
.field { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 12px; }
  .field input, .field select, .field textarea { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 12px; }
.field .locked-field {
  background: #eef2f4;
  color: #6b7280;
  border-color: #d1d5db;
  pointer-events: none;
}
.field select option { color: var(--text); background: var(--surface); }
.field textarea { resize: both; min-height: 80px; }
.field input:focus { outline: 1px solid var(--accent); }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.field-inline { display: flex; align-items: center; }
.field-inline.align-end { justify-content: flex-end; }
.actions { display: flex; align-items: center; gap: 12px; }
.text-error { color: #fca5a5; }
.toast-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}
.toast {
  min-width: 240px;
  max-width: 360px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 12px;
}
.toast-success {
  border-color: rgba(16,185,129,0.4);
  background: rgba(16,185,129,0.12);
  color: #064e3b;
}
.char-counter {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
  text-align: right;
}
.municipio-list {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: var(--surface);
}
.municipio-list-head {
  font-weight: 700;
  font-size: 12px;
  color: var(--text);
  margin-bottom: 6px;
}
.municipio-list-body { display: flex; flex-direction: column; gap: 6px; }
.municipio-item {
  display: grid;
  grid-template-columns: 1.2fr 2.4fr 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: rgba(31,155,126,0.05);
}
.municipio-item small { color: var(--muted); font-size: 11px; }
.municipio-empty { color: var(--muted); font-size: 12px; }
.etapa-list {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: var(--surface);
  margin-top: 10px;
}
.etapa-list-head {
  font-weight: 700;
  font-size: 12px;
  color: var(--text);
  margin-bottom: 6px;
}
.etapa-list-body { display: flex; flex-direction: column; gap: 6px; }
.etapa-actions #subacao-add-etapa { margin-top: 12px; }
.etapa-item {
  display: grid;
  grid-template-columns: 1.4fr 2.6fr 1.4fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: rgba(31,155,126,0.05);
}
.etapa-item small { color: var(--muted); font-size: 11px; }
.etapa-empty { color: var(--muted); font-size: 12px; }
.relatorio-top { justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 10px; }
.relatorio-top-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; min-width: 320px; max-width: 520px; }
.btn.compact { padding: 6px 10px; font-size: 13px; }
.totais-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  min-width: 320px;
  max-width: 1000px;
  box-shadow: var(--shadow);
  word-break: normal;
  white-space: normal;
}
.totais-title { font-weight: 700; font-size: 12px; margin-bottom: 4px; }
.totais-row { font-size: 11px; display: flex; justify-content: space-between; gap: 6px; }
.totais-row .pos { color: #0b3c91; font-weight: 700; }
.totais-row .neg { color: #8b0000; font-weight: 700; }
.theme-dark .totais-row .pos { color: #6ea8ff; }
.theme-dark .totais-row .neg { color: #ff8b8b; }
.fip-table td.num { text-align: right; }
.fip-table td.num.pos { color: #0b3c91; font-weight: 600; }
.fip-table td.num.neg { color: #8b0000; font-weight: 600; }
.theme-dark .fip-table td.num.pos { color: #6ea8ff; }
.theme-dark .fip-table td.num.neg { color: #ff8b8b; }
.plan20-table th { font-size: 10px; }
.plan20-table td { font-size: 8px; }
.plan20-table td.num { text-align: right; }

/* Relatorio Plan21_NGER: destaque de colunas financeiras */
#plan21-relatorio-tabela th:nth-child(24),
#plan21-relatorio-tabela td:nth-child(24) {
  background: rgba(31, 155, 126, 0.12);
}
#plan21-relatorio-tabela th:nth-child(25),
#plan21-relatorio-tabela td:nth-child(25) {
  background: rgba(31, 155, 126, 0.16);
}
#plan21-relatorio-tabela th:nth-child(26),
#plan21-relatorio-tabela td:nth-child(26) {
  background: rgba(31, 155, 126, 0.2);
}
#plan21-relatorio-tabela th:nth-child(57),
#plan21-relatorio-tabela td:nth-child(57) {
  background: rgba(31, 155, 126, 0.12);
}
#plan21-relatorio-tabela th:nth-child(58),
#plan21-relatorio-tabela td:nth-child(58) {
  background: rgba(31, 155, 126, 0.16);
}
#plan21-relatorio-tabela th:nth-child(59),
#plan21-relatorio-tabela td:nth-child(59) {
  background: rgba(31, 155, 126, 0.2);
}

.theme-dark #plan21-relatorio-tabela th:nth-child(24),
.theme-dark #plan21-relatorio-tabela td:nth-child(24) {
  background: rgba(61, 214, 183, 0.14);
}
.theme-dark #plan21-relatorio-tabela th:nth-child(25),
.theme-dark #plan21-relatorio-tabela td:nth-child(25) {
  background: rgba(61, 214, 183, 0.18);
}
.theme-dark #plan21-relatorio-tabela th:nth-child(26),
.theme-dark #plan21-relatorio-tabela td:nth-child(26) {
  background: rgba(61, 214, 183, 0.22);
}
.theme-dark #plan21-relatorio-tabela th:nth-child(57),
.theme-dark #plan21-relatorio-tabela td:nth-child(57) {
  background: rgba(61, 214, 183, 0.14);
}
.theme-dark #plan21-relatorio-tabela th:nth-child(58),
.theme-dark #plan21-relatorio-tabela td:nth-child(58) {
  background: rgba(61, 214, 183, 0.18);
}
.theme-dark #plan21-relatorio-tabela th:nth-child(59),
.theme-dark #plan21-relatorio-tabela td:nth-child(59) {
  background: rgba(61, 214, 183, 0.22);
}
.page-size {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
}
.page-size label {
  color: var(--text);
}
.page-size .input,
.page-size select {
  font-size: 10px;
  padding: 6px 10px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  min-width: 70px;
  box-shadow: none;
}
.theme-dark .page-size select,
.theme-dark .page-size .input {
  background: #111827;
  border-color: #1f2937;
  color: #e5e7eb;
}

.painel-wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}
.card.mini { padding: 12px; }
.tree-list { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.tree-item { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 8px; white-space: nowrap; width: 100%; }
.tree-item > .tree-controls { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.tree-item > span { white-space: nowrap; }
.tree-children { padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.tree-toggle { border: none; background: transparent; cursor: pointer; padding: 2px; color: var(--muted); }
.tree-toggle:focus { outline: none; }
.pill-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.pill-list li { padding: 6px 8px; background: rgba(31,155,126,0.12); border-radius: 8px; border: 1px solid var(--border); font-size: 13px; }

/* Login */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.85), rgba(255,255,255,0.85)),
    url("../img/logo.jpg") center/cover fixed;
}
.login-card {
  background: #ffffff;
  border: 1px solid #dce6e7;
  border-radius: 16px;
  padding: 22px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 18px;
  color: var(--text);
}
.login-header { display: flex; gap: 14px; align-items: center; }
.logo-hero {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  background: #0f7c68;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 24px rgba(15, 124, 104, 0.3);
}
.logo-hero img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }
.alert-stack { display: flex; flex-direction: column; gap: 8px; }
.alert { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: rgba(255,255,255,0.03); }
.alert-error { border-color: #ef4444; color: #fecdd3; background: rgba(248,113,113,0.08); }
.alert-error-strong { color: #7f1d1d; }
.alert-info { border-color: var(--primary); color: #0f4c4c; background: rgba(13,148,136,0.08); }
.dotacao-summary { margin-top: 12px; }
.dotacao-summary .table { table-layout: auto; }
.dotacao-summary th,
.dotacao-summary td { white-space: nowrap; overflow-wrap: normal; word-break: normal; }
.dotacao-summary-hidden .table,
.dotacao-summary-hidden .pagination,
.dotacao-summary-hidden .page-size { visibility: hidden; }
.dotacao-summary-row.selected { background: rgba(31,155,126,0.12); }
.subacao-rejeitado,
.subacao-rejeitado td,
.subacao-rejeitado th {
  color: #c62828 !important;
}
.dotacao-summary-warn {
  border-radius: 12px;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.6);
}
.dotacao-table-vertical th { width: 220px; }
.dotacao-table-vertical td { overflow-wrap: anywhere; word-break: break-word; }
.dotacao-actions { justify-content: flex-end; margin-top: 12px; }
.form-grid.dotacao-criteria-row {
  grid-template-columns: minmax(0, 1fr) 110px;
  column-gap: 10px;
  align-items: start;
}
.dotacao-criteria-row .pill-list { min-width: 0; }
.dotacao-criteria-box {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--surface);
}
.dotacao-criteria-box .pill-list { margin: 0; }
#dotacao-saldo-debug.dotacao-saldo-debug-active {
  background: rgba(31, 155, 126, 0.12);
  border: 1px solid rgba(31, 155, 126, 0.28);
  border-radius: 10px;
  color: var(--color-700);
  margin-top: 6px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.35;
}
.theme-dark #dotacao-saldo-debug.dotacao-saldo-debug-active {
  background: rgba(61, 214, 183, 0.12);
  border-color: rgba(61, 214, 183, 0.35);
  color: var(--accent);
}

.dotacao-summary .table-responsive {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--surface);
  min-height: 56px;
}

.meta-fisica-table-wrap {
  margin-top: 10px;
  width: 100%;
}

.meta-fisica-table .meta-fisica-cell {
  min-width: 96px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 9px;
  font-family: inherit;
  line-height: 1.15;
  height: 24px;
}

.meta-fisica-table .meta-fisica-cell[readonly] {
  opacity: 0.95;
  cursor: not-allowed;
}

.meta-fisica-table .meta-fisica-cell-credito {
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(22, 163, 74, 0.28);
}

.meta-fisica-table .meta-fisica-cell-anulada {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(220, 38, 38, 0.28);
}

.meta-fisica-multi-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.meta-fisica-adjust-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.meta-fisica-adjust-line {
  display: flex;
  align-items: center;
}

.meta-fisica-multi-line {
  display: flex;
  align-items: center;
  gap: 4px;
}

.meta-fisica-mov-label {
  min-width: 118px;
  font-size: 9px;
  line-height: 1.1;
  color: var(--muted);
}

.meta-fisica-item-add,
.meta-fisica-item-remove {
  width: 12px;
  height: 12px;
  min-width: 12px;
  padding: 0;
  border: none;
  outline: none;
  background: transparent;
  color: #8f9ca3;
  font-size: 11px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.meta-fisica-item-add {
  align-self: flex-end;
  margin-top: 1px;
}

.meta-fisica-item-add:hover,
.meta-fisica-item-remove:hover,
.meta-fisica-item-add:focus,
.meta-fisica-item-remove:focus {
  color: var(--accent);
}

.meta-fisica-item-add:disabled {
  color: #b7c1c6;
  cursor: default;
}

.meta-fisica-add-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.meta-fisica-plus-btn {
  min-width: 18px;
  width: 18px;
  height: 18px;
  padding: 0;
  line-height: 1;
  font-size: 10px;
  border-radius: 5px;
  opacity: 0.85;
  background: #8f9ca3;
  border-color: #7f8d95;
  color: #ffffff;
}

.meta-fisica-plus-btn:hover,
.meta-fisica-plus-btn:focus {
  background: #7b8991;
  border-color: #6f7d85;
  color: #ffffff;
}

.meta-fisica-consultar-wrap {
  justify-content: flex-start;
  align-self: end;
}

#meta-fisica-page {
  grid-template-columns: minmax(700px, 1.35fr) minmax(500px, 1fr);
  align-items: start;
}

#meta-fisica-page .card {
  min-width: 0;
}

#meta-fisica-page .meta-fisica-table-wrap .table-responsive {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

#meta-fisica-page .meta-fisica-table {
  min-width: 700px;
}

#meta-fisica-page .meta-fisica-table th,
#meta-fisica-page .meta-fisica-table td {
  padding: 4px 6px;
}

#meta-fisica-page .meta-fisica-table th {
  font-size: 10px;
}

#meta-fisica-page .meta-fisica-table td {
  font-size: 9px;
}

@media (max-width: 1650px) {
  #meta-fisica-page {
    grid-template-columns: minmax(0, 1fr);
  }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal-card {
  background: var(--surface);
  border-radius: 12px;
  max-width: 920px;
  width: calc(100% - 48px);
  max-height: 85vh;
  overflow: auto;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
  padding: 20px 22px 18px;
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 10px;
}

.modal-logo {
  height: 42px;
  width: auto;
}

.modal-header-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--accent);
}

.modal-header-subtitle {
  font-size: 12px;
  color: var(--muted);
}

.modal-title {
  margin: 12px 0;
  font-weight: 700;
}

.modal-card .table th,
.modal-card .table td {
  color: var(--text);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.emp-record-modal .emp-record-card {
  width: min(900px, 92vw);
  background: var(--bg);
  border-radius: 22px;
  padding: 16px;
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.25);
  color: #0f2023;
}
.emp-record-header {
  display: grid;
  grid-template-columns: 84px 1fr 84px;
  align-items: center;
  gap: 10px;
  background: #4f98a3;
  border-radius: 18px;
  padding: 6px 12px;
}
.emp-record-header .emp-record-title {
  text-align: center;
  font-size: 42px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 2px;
}
.emp-record-sign {
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
}
.emp-record-sign svg {
  width: 100%;
  height: 100%;
}
.emp-record-logo {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  overflow: hidden;
  background: #ffffff;
  display: grid;
  place-items: center;
}
.emp-record-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.emp-record-body {
  margin-top: 10px;
  background: #ffffff;
  border-radius: 18px;
  padding: 22px 20px 20px;
  border: 6px solid #4f98a3;
}
.emp-record-message {
  text-align: center;
  font-weight: 800;
  font-size: 26px;
  color: #222;
  margin-bottom: 10px;
}
.emp-record-count {
  display: grid;
  grid-template-columns: 96px auto auto;
  align-items: center;
  gap: 8px;
  justify-content: center;
  margin: 12px 0 16px;
}
.emp-record-sign.small {
  width: 84px;
  height: 84px;
  display: grid;
  place-items: center;
}
.emp-record-sign.small img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.emp-record-digits {
  display: flex;
  gap: 6px;
  justify-content: center;
}
.emp-record-digits .digit {
  background: #e3392f;
  color: #ffffff;
  font-weight: 800;
  font-size: 56px;
  min-width: 64px;
  height: 78px;
  display: grid;
  place-items: center;
  border-radius: 4px;
}
.emp-record-digits.small .digit {
  font-size: 32px;
  min-width: 38px;
  height: 52px;
}
.emp-record-label {
  font-size: 34px;
  font-weight: 800;
  color: #222;
}
.emp-record-label.small {
  font-size: 24px;
}
.emp-record-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.emp-record-record-text {
  font-weight: 800;
  font-size: 24px;
  color: #222;
}
.emp-record-audit {
  text-align: center;
  font-size: 13px;
  color: #444;
  margin-top: 8px;
}
.emp-record-footer {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
}
.emp-record-footer-text {
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0.4px;
  text-align: center;
  flex: 0 0 auto;
  color: #0f2023;
}
.emp-record-work {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
}
.emp-record-work img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.emp-record-card {
  position: relative;
}
.emp-record-close-icon {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: #1f4950;
  font-weight: 800;
  cursor: pointer;
  line-height: 1;
}
.emp-record-close-icon:hover {
  background: #ffffff;
}

@media (max-width: 720px) {
  .emp-record-header {
    grid-template-columns: 64px 1fr 64px;
  }
  .emp-record-header .emp-record-title {
    font-size: 26px;
  }
  .emp-record-message {
    font-size: 18px;
  }
  .emp-record-count {
    grid-template-columns: 70px auto;
    justify-items: center;
  }
  .emp-record-label {
    font-size: 24px;
  }
  .emp-record-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}
.print-only { display: none; }
@media print {
  body { background: #ffffff; color: #000000; }
  .no-print { display: none !important; }
  .print-only { display: block !important; }
  .card, .dotacao-record { border: none; box-shadow: none; }
  .dotacao-results { display: block !important; }
  .dotacao-record { page-break-inside: avoid; }
  .dotacao-table-vertical th, .dotacao-table-vertical td { color: #000000; border-bottom: 1px solid #000000; }
  .dotacao-table-vertical { border: 1px solid #000000; }
  .print-logos { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
  .print-logos img { height: 48px; }
  .print-title { text-align: center; font-weight: 700; margin-bottom: 12px; }
}

.login-form .field { color: var(--text); }
.login-form .field input {
  background: #ffffff;
  border-color: #d7e4e6;
  color: var(--text);
}
.login-form .field input:focus { outline: 1px solid var(--accent); }
.password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.password-wrap input { width: 100%; padding-right: 44px; }
.toggle-visibility {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 6px;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.toggle-visibility:hover { color: var(--accent-strong); }

.login-card h1 { margin: 0; font-size: 20px; line-height: 1.2; color: var(--accent); }
.login-card p { margin: 0; color: var(--muted); }
.login-form a { color: var(--accent); text-decoration: none; }
.login-form a:hover { text-decoration: underline; }

@media (max-width: 640px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 20; height: 100vh; transform: translateX(-100%); width: 240px; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  #content-area { padding: 14px; }
}
