:root {
  /* ===== CORES GERAIS ===== */
  --brand-700: #024637;
  --brand-800: #01382c;
  --brand-900: #021611;
  --brand-hover: #035241;
  --brand-soft: rgba(2, 70, 55, 0.08);

  /* ===== SIDEBAR ===== */
  --sidebar-bg: var(--brand-700);
  --sidebar-bg-hover: rgba(255, 255, 255, 0.08);
  --sidebar-text: #ffffff;
  --sidebar-muted: rgba(255, 255, 255, 0.78);
  --sidebar-border: rgba(255, 255, 255, 0.14);
  --sidebar-user-bg: rgba(255, 255, 255, 0.1);
  --sidebar-btn-bg: rgba(255, 255, 255, 0.18);
  --sidebar-btn-hover: rgba(255, 255, 255, 0.28);

  /* ===== TEMA CLARO ===== */
  --app-bg: #f3f4f6;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #1f2937;
  --text-muted: #6b7280;
  --heading: #111827;
  --border: rgba(15, 23, 42, 0.1);
  --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.06);
  --shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.12);

  --input-bg: #ffffff;
  --input-text: #1f2937;
  --input-border: #d1d5db;
  --input-focus: #198754;
  --input-focus-ring: 0 0 0 0.2rem rgba(25, 135, 84, 0.15);

  --link: #0f5132;
  --link-hover: #0b3d26;
  --soft-box-bg: #f8fbf9;
  --soft-box-border: #dbe7df;
  --soft-box-text: #1f2937;
  --soft-box-muted: #667085;

  --table-soft-bg: #ffffff;
  --table-soft-head: #f3f7f4;
  --table-soft-border: #d8e3dc;
  --table-soft-text: #1f2937;
  --table-soft-hover: #edf5ef;
}


html[data-theme="dark"] {
  color-scheme: dark;

  /* ===== TEMA ESCURO ===== */
  --app-bg: #002314;
  --surface: #04180b;
  --surface-soft: #0a2419;
  --text: #f3f4f6;
  --text-muted: #9cafa0;
  --heading: #f9fafb;
  --border: rgba(12, 79, 28, 0.24);
  --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.28);
  --shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.35);

  --input-bg: #0b1220;
  --input-text: #f3f4f6;
  --input-border: #374151;
  --input-focus: #3ddc97;
  --input-focus-ring: 0 0 0 0.2rem rgba(61, 220, 151, 0.12);

  --link: #8ee3bb;
  --link-hover: #b5f3d5;
  --soft-box-bg: #dceee2;
  --soft-box-border: #b8d0c0;
  --soft-box-text: #173326;
  --soft-box-muted: #4b6357;

  --table-soft-bg: #e3f1e7;
  --table-soft-head: #d2e6d8;
  --table-soft-border: #b8cdbd;
  --table-soft-text: #173326;
  --table-soft-hover: #d9ebde;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--app-bg);
  color: var(--text);
}

body.sidebar-mobile-open {
  overflow: hidden;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  color: var(--link-hover);
}

h1,
h2,
h3,
h4,
h5,
h6,
.titulo-card-atalho {
  color: var(--heading);
}

.card,
.modal-content,
.dropdown-menu,
.list-group-item,
.offcanvas,
.popover,
.tooltip-inner {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.card-header,
.card-footer {
  background: var(--surface);
  border-color: var(--border);
}

/* ===== TABELAS ===== */
.table {
  --bs-table-color: var(--text);
  --bs-table-bg: var(--surface);
  --bs-table-border-color: var(--border);
  --bs-table-striped-bg: var(--surface-soft);
  --bs-table-striped-color: var(--text);
  --bs-table-hover-bg: var(--surface-soft);
  --bs-table-hover-color: var(--text);
  color: var(--text);
}

.table > :not(caption) > * > * {
  background-color: var(--bs-table-bg);
  color: var(--bs-table-color);
  border-color: var(--bs-table-border-color);
}

.table-light,
.table-light > th,
.table-light > td {
  background-color: var(--surface-soft) !important;
  color: var(--text) !important;
}

/* ===== TABELAS NO MODO ESCURO ===== */
html[data-theme="dark"] .table {
  --bs-table-color: #173326;
  --bs-table-bg: #e3f1e7;
  --bs-table-border-color: #b8cdbd;
  --bs-table-striped-bg: #d9ebde;
  --bs-table-striped-color: #173326;
  --bs-table-hover-bg: #d2e6d8;
  --bs-table-hover-color: #173326;
}

html[data-theme="dark"] table > :not(caption) > * > * {
  background-color: var(--bs-table-bg) !important;
  color: var(--bs-table-color) !important;
  border-color: var(--bs-table-border-color) !important;
}

html[data-theme="dark"] table thead th,
html[data-theme="dark"] table thead td {
  background-color: #317144 !important;
  color: #173326 !important;
  border-color: #b8cdbd !important;
}

html[data-theme="dark"] table tbody th,
html[data-theme="dark"] table tbody td {
  background-color: #55a56c !important;
  color: #173326 !important;
  border-color: #b8cdbd !important;
}

html[data-theme="dark"] .table-hover > tbody > tr:hover > * {
  background-color: #d2e6d8 !important;
  color: #173326 !important;
}

html[data-theme="dark"] .table-light,
html[data-theme="dark"] .table-light > th,
html[data-theme="dark"] .table-light > td {
  background-color: #d2e6d8 !important;
  color: #173326 !important;
}

.table-light,
.table-light > th,
.table-light > td {
  background-color: var(--surface-soft) !important;
  color: var(--text) !important;
}

.bg-light-subtle {
  background: var(--surface-soft) !important;
  color: var(--text) !important;
}

.soft-panel {
  background: var(--soft-box-bg) !important;
  border: 1px solid var(--soft-box-border) !important;
  color: var(--soft-box-text) !important;
}

.soft-panel .text-muted,
.soft-panel small,
.soft-panel .small {
  color: var(--soft-box-muted) !important;
}

html[data-theme="dark"] .table {
  --bs-table-bg: var(--table-soft-bg);
  --bs-table-color: var(--table-soft-text);
  --bs-table-border-color: var(--table-soft-border);
  --bs-table-striped-bg: var(--table-soft-hover);
  --bs-table-striped-color: var(--table-soft-text);
  --bs-table-hover-bg: var(--table-soft-hover);
  --bs-table-hover-color: var(--table-soft-text);
}

html[data-theme="dark"] table thead th,
html[data-theme="dark"] table thead td {
  background: var(--table-soft-head) !important;
  color: var(--table-soft-text) !important;
  border-color: var(--table-soft-border) !important;
}

html[data-theme="dark"] table tbody td,
html[data-theme="dark"] table tbody th {
  color: var(--table-soft-text) !important;
  border-color: var(--table-soft-border) !important;
}

.text-muted,
small.text-muted,
.card .text-muted {
  color: var(--text-muted) !important;
}

.form-control,
.form-select,
textarea {
  background: var(--input-bg);
  color: var(--input-text);
  border-color: var(--input-border);
}

.form-control::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

.form-control:focus,
.form-select:focus,
textarea:focus {
  background: var(--input-bg);
  color: var(--input-text);
  border-color: var(--input-focus);
  box-shadow: var(--input-focus-ring);
}

.form-check-input {
  background-color: var(--input-bg);
  border-color: var(--input-border);
}

.form-check-input:checked {
  background-color: var(--brand-700);
  border-color: var(--brand-700);
}

.form-check-input:focus {
  box-shadow: var(--input-focus-ring);
}

.bg-white,
.bg-light {
  background: var(--surface) !important;
}

.border,
.border-top,
.border-end,
.border-bottom,
.border-start {
  border-color: var(--border) !important;
}

.shadow-sm {
  box-shadow: var(--shadow-sm) !important;
}

hr {
  border-color: var(--border);
  opacity: 1;
}

html[data-theme="dark"] .titulo-card-atalho {
  color: #f3f4f6 !important;
}

html[data-theme="dark"] .sidebar-title,
html[data-theme="dark"] .section-title,
html[data-theme="dark"] .titulo-secao,
html[data-theme="dark"] .text-uppercase.fw-semibold,
html[data-theme="dark"] .text-uppercase.small {
  color: #d8efe6 !important;
  letter-spacing: 0.06em;
}

html[data-theme="dark"] .alert-danger {
  background-color: rgba(220, 53, 69, 0.16);
  border-color: rgba(220, 53, 69, 0.28);
  color: #f8d7da;
}

html[data-theme="dark"] .alert-success {
  background-color: rgba(25, 135, 84, 0.16);
  border-color: rgba(25, 135, 84, 0.28);
  color: #d1e7dd;
}

html[data-theme="dark"] .alert-info {
  background-color: rgba(13, 202, 240, 0.12);
  border-color: rgba(13, 202, 240, 0.22);
  color: #cff4fc;
}

html[data-theme="dark"] .alert-warning {
  background-color: rgba(255, 193, 7, 0.12);
  border-color: rgba(255, 193, 7, 0.22);
  color: #fff3cd;
}