* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html,
body {
  height: 100%;
}
body {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #1F2937;
  background: #F5F7FA;
}
a {
  color: #1565C0;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
img {
  max-width: 100%;
  height: auto;
}
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: #FFFFFF;
  border-bottom: 1px solid #E0E4EB;
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 0 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
header .logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 16px;
  color: #1565C0;
  flex-shrink: 0;
  transition: width 0.2s;
}
header .logo a { display: inline-flex; align-items: center; line-height: 0; }
header .logo .brand-logo { width: auto; height: 32px; display: block; }
header .logo .brand-suffix { font-size: 13px; color: #6B7280; font-weight: 500; letter-spacing: 0.4px; text-transform: uppercase; }
header p.page-title {
  margin-left: 16px;
  font-size: 18px;
  font-weight: 500;
  color: #1F2937;
}
header nav.user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
header nav.user .user-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #F5F7FA;
  color: #1F2937;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, box-shadow 0.12s;
  border: 1px solid transparent;
}
header nav.user .user-name::before {
  content: '\f007';                                     /* fa-user */
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  color: #1565C0;
  font-size: 12px;
}
header nav.user .user-name:hover {
  background: rgba(21, 101, 192, 0.10);
  color: #0D47A1;
  border-color: #1976D2;
}
header nav.user .loggout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #FCA5A5;
  background: #FFFFFF;
  color: #DC2626;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s;
}
header nav.user .loggout::before {
  content: '\f2f5';                                     /* fa-arrow-right-from-bracket */
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 12px;
}
header nav.user .loggout:hover {
  background: rgba(220, 38, 38, 0.08);
  border-color: #DC2626;
  text-decoration: none;
}
nav.menu {
  position: fixed;
  top: 56px;
  left: 0;
  bottom: 0;
  width: 64px;
  background: #FFFFFF;
  border-right: 1px solid #E0E4EB;
  overflow: hidden;
  padding: 16px 0;
  z-index: 90;
  transition: width 0.18s ease-in-out, box-shadow 0.18s ease-in-out;
  display: flex;
  flex-direction: column;
}
nav.menu ul {
  list-style: none;
  flex: 1 0 auto;            /* empurra .menu-footer pro fundo */
}
nav.menu li {
  margin: 4px 0;
}
nav.menu a {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 0;
  padding-left: 22px;
  color: #6B7280;
  white-space: nowrap;
  overflow: hidden;
  transition: background 0.15s, color 0.15s;
}
nav.menu a i {
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}
nav.menu a span {
  opacity: 0;
  transition: opacity 0.15s;
}
nav.menu a:hover {
  background: rgba(21, 101, 192, 0.08);
  color: #1565C0;
  text-decoration: none;
}
nav.menu a.active {
  background: rgba(21, 101, 192, 0.12);
  color: #1565C0;
  font-weight: 500;
}
nav.menu:hover {
  width: 240px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
}
nav.menu:hover a span {
  opacity: 1;
}

/* Rodapé do menu lateral — logo Codee-X. Visível só quando menu expandido (hover). */
.menu-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  border-top: 1px solid #E0E4EB;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}
nav.menu:hover .menu-footer { opacity: 1; pointer-events: auto; }
/* Override do `nav.menu a` (que tem padding-left:22px pros itens do menu) — link do logo
   é decorativo e precisa centralizar a imagem dentro do container flex. */
nav.menu .menu-footer a { padding: 0; gap: 0; display: inline-flex; }
.menu-footer-label { font-size: 10px; color: #9CA3AF; letter-spacing: 0.6px; text-transform: uppercase; }
.menu-footer-logo { width: 110px; height: auto; opacity: 0.85; transition: opacity 0.15s; display: block; }
.menu-footer-logo:hover { opacity: 1; }
main {
  margin-left: 64px;
  margin-top: 56px;
  padding: 24px;
  min-height: calc(100vh - 56px);
}
section.page {
  background: #FFFFFF;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  padding: 24px;
}
section.page > h1 {
  font-size: 20px;
  font-weight: 500;
  margin-bottom: 24px;
  color: #1F2937;
}
ul.nav-page {
  list-style: none;
  width: 100%;
  margin-bottom: 24px;
  padding: 0;
  display: flex;
  border-bottom: 2px solid #1565C0;
}
ul.nav-page li {
  min-height: 36px;
  padding: 4px 18px;
  margin-right: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #E0E4EB;
  border-bottom: 3px solid transparent;
  border-radius: 8px 8px 0 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 26px;
  text-align: center;
  white-space: nowrap;
  color: #6B7280;
  background: #F5F7FA;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s, transform 0.15s;
}
ul.nav-page li i {
  margin-right: 6px;
}
ul.nav-page li:hover:not(.selected) {
  color: #1565C0;
  background: rgba(21, 101, 192, 0.06);
  border-color: #1976D2;
}
ul.nav-page li.selected {
  color: #FFFFFF;
  background: #1565C0;
  border-color: #1565C0;
  border-bottom-color: #1565C0;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
  cursor: default;
}
.commands {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}
.commands .filters {
  flex: 1;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.commands button {
  white-space: nowrap;
}
.content-table table {
  width: 100%;
  border-collapse: collapse;
}
.content-table table th,
.content-table table td {
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid #E0E4EB;
  font-size: 14px;
}
.content-table table thead th {
  background: #F5F7FA;
  font-weight: 600;
  font-size: 13px;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.content-table table thead tr.column-filters th {
  background: #FFFFFF;
  padding: 6px 8px;
  text-transform: none;
  letter-spacing: 0;
}
.content-table table thead tr.column-filters th input,
.content-table table thead tr.column-filters th select {
  width: 100%;
  padding: 4px 8px;
  font-size: 13px;
  border: 1px solid #E0E4EB;
  border-radius: 4px;
  background: #FFFFFF;
}
.content-table table thead tr.column-filters th input:focus,
.content-table table thead tr.column-filters th select:focus {
  outline: none;
  border-color: #1565C0;
  box-shadow: 0 0 0 2px rgba(21, 101, 192, 0.18);
}
.content-table table tbody tr:hover {
  background: rgba(21, 101, 192, 0.04);
}
.content-table table td.actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}
.content-table table td.actions a,
.content-table table td.actions i {
  color: #6B7280;
  margin-left: 10px;
  cursor: pointer;
  transition: color 0.15s;
}
.content-table table td.actions a:hover,
.content-table table td.actions i:hover {
  color: #1565C0;
}
.content-table table td.actions a.delete-item:hover,
.content-table table td.actions i.delete-item:hover {
  color: #DC2626;
}
.content-table table td.empty {
  text-align: center;
  color: #9CA3AF;
  padding: 24px;
  font-style: italic;
}
.autocomplete {
  position: relative;
}
.autocomplete > input[type=text] {
  width: 100%;
}
.autocomplete.selected > input[type=text] {
  padding-right: 32px;
  background: rgba(22, 163, 74, 0.04);
  cursor: pointer;
}
.autocomplete.selected::after {
  content: '\f00c';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #16A34A;
  pointer-events: none;
  font-size: 12px;
}
.autocomplete .autocomplete-list {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  z-index: 50;
  max-height: 240px;
  overflow-y: auto;
  background: #FFFFFF;
  border: 1px solid #E0E4EB;
  border-radius: 4px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
}
.autocomplete .autocomplete-list .autocomplete-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid #F5F7FA;
}
.autocomplete .autocomplete-list .autocomplete-item:last-child {
  border-bottom: none;
}
.autocomplete .autocomplete-list .autocomplete-item:hover,
.autocomplete .autocomplete-list .autocomplete-item.highlight {
  background: rgba(21, 101, 192, 0.1);
  color: #1565C0;
}
.autocomplete .autocomplete-list .autocomplete-item .small {
  font-size: 11px;
  color: #9CA3AF;
  display: block;
}
.autocomplete .autocomplete-list .autocomplete-empty {
  padding: 8px 12px;
  color: #9CA3AF;
  font-size: 12px;
  font-style: italic;
}
.filters.period-filter {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  flex: none;
}
.filters.period-filter > select,
.filters.period-filter > input {
  width: 100%;
  min-width: 0;
}
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 16px;
}
@media (max-width: 768px) {
  .checkbox-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 640px) {
  .checkbox-grid {
    grid-template-columns: 1fr;
  }
}
.checkbox-card {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 8px 12px;
  border: 1px solid #E0E4EB;
  border-radius: 4px;
  background: #FFFFFF;
  transition: background 0.12s, border-color 0.12s;
}
.checkbox-card:hover {
  background: rgba(21, 101, 192, 0.06);
  border-color: #1976D2;
}
.checkbox-card input[type=checkbox],
.checkbox-card input[type=radio] {
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
  accent-color: #1565C0;
  flex-shrink: 0;
}
.checkbox-card span {
  font-size: 13px;
  color: #1F2937;
  line-height: 1.3;
}
.checkbox-card.off span {
  color: #9CA3AF;
  text-decoration: line-through;
}
.checkbox-card.on span {
  color: #1F2937;
  font-weight: 500;
}
.checkbox-card.on {
  border-color: #1976D2;
  background: rgba(21, 101, 192, 0.04);
}
.permission-groups {
  display: flex;
  flex-direction: column;
  gap: 16px;
  border: 1px solid #E0E4EB;
  border-radius: 4px;
  padding: 16px;
  background: #F5F7FA;
}
.permission-groups .permission-group h6 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #6B7280;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #E0E4EB;
}
.permission-groups .permission-group .permission-checks {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 16px;
}
@media (max-width: 768px) {
  .permission-groups .permission-group .permission-checks {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 640px) {
  .permission-groups .permission-group .permission-checks {
    grid-template-columns: 1fr;
  }
}
.permission-groups .permission-group .permission-check {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 8px 12px;
  border: 1px solid #E0E4EB;
  border-radius: 4px;
  background: #FFFFFF;
  transition: background 0.12s, border-color 0.12s;
}
.permission-groups .permission-group .permission-check:hover {
  background: rgba(21, 101, 192, 0.06);
  border-color: #1976D2;
}
.permission-groups .permission-group .permission-check input[type=checkbox] {
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
  accent-color: #1565C0;
  flex-shrink: 0;
}
.permission-groups .permission-group .permission-check span {
  font-size: 13px;
  color: #1F2937;
  line-height: 1.3;
}
.permission-groups .permission-group .permission-check.off span {
  color: #9CA3AF;
  text-decoration: line-through;
}
.permission-groups .permission-group .permission-check.on span {
  color: #1F2937;
  font-weight: 500;
}
.permission-groups .permission-group .permission-check.on {
  border-color: #1976D2;
  background: rgba(21, 101, 192, 0.04);
}
aside.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 32px 16px;
  overflow-y: auto;
}
aside.modal .modal-body {
  position: relative;
  background: #FFFFFF;
  border-radius: 12px;
  padding: 24px;
  width: 100%;
  max-width: 720px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}
aside.modal .modal-body form > .title,
aside.modal .modal-body > .title {
  font-size: 22px;
  font-weight: 600;
  text-align: center;
  color: #1F2937;
  padding: 0;
  margin-bottom: 8px;
}
aside.modal .modal-body span.close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  color: #9CA3AF;
  border-radius: 50%;
  transition: color 0.15s, background 0.15s;
  z-index: 1;
}
aside.modal .modal-body span.close:hover {
  color: #DC2626;
  background: rgba(220, 38, 38, 0.08);
}
aside.modal .modal-body form > hr,
aside.modal .modal-body > hr {
  border: none;
  border-top: 1px solid #E0E4EB;
  margin-bottom: 24px;
}
aside.modal .modal-body form > .actions,
aside.modal .modal-body > .actions {
  display: flex;
  gap: 16px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #E0E4EB;
}
aside.modal .modal-body form > .actions button,
aside.modal .modal-body > .actions button {
  width: 22%;
  min-width: 120px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  justify-content: center;
  text-align: center;
}
aside.confirm-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 300;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
}
aside.confirm-modal .confirm-body {
  background: #FFFFFF;
  border-radius: 12px;
  padding: 24px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  text-align: center;
}
aside.confirm-modal .confirm-body .icon {
  font-size: 38px;
  color: #F59E0B;
  margin-bottom: 16px;
}
aside.confirm-modal .confirm-body .title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #1F2937;
}
aside.confirm-modal .confirm-body .message {
  color: #6B7280;
  margin-bottom: 24px;
  font-size: 14px;
}
aside.confirm-modal .confirm-body .actions {
  display: flex;
  gap: 12px;
  justify-content: stretch;
}
aside.confirm-modal .confirm-body .actions button {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  justify-content: center;
  text-align: center;
}
/* system_prompt — textarea/input dentro do confirm-modal. */
aside.confirm-modal .confirm-body .prompt-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid #D1D5DB;
  border-radius: 8px;
  font-family: inherit;
  text-align: left;
  box-sizing: border-box;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
}
aside.confirm-modal .confirm-body .prompt-input:focus {
  border-color: #3B82F6;
}
aside.confirm-modal .confirm-body .prompt-hint {
  text-align: left;
  display: block;
  font-size: 12px;
  margin-bottom: 16px;
}
aside.confirm-modal .confirm-body .actions button.ok:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
form .field {
  margin-bottom: 16px;
}
form .field > label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #6B7280;
  margin-bottom: 4px;
}
form .field.required > label::after,
form .field:has(> input[required], > select[required], > textarea[required]) > label::after,
form .field:has(> .autocomplete[data-required="1"]) > label::after {
  content: ' *';
  color: #DC2626;
  font-weight: 700;
}
form .row {
  display: flex;
  gap: 16px;
}
form .row > .field {
  flex: 1;
}
input[type=text],
input[type=email],
input[type=password],
input[type=number],
input[type=date],
input[type=datetime-local],
input[type=tel],
input[type=url],
select,
textarea {
  width: 100%;
  padding: 8px 16px;
  border: 1px solid #E0E4EB;
  border-radius: 4px;
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  color: #1F2937;
  background: #FFFFFF;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type=text]:focus,
input[type=email]:focus,
input[type=password]:focus,
input[type=number]:focus,
input[type=date]:focus,
input[type=datetime-local]:focus,
input[type=tel]:focus,
input[type=url]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #1565C0;
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.12);
}
input[type=text]:disabled,
input[type=email]:disabled,
input[type=password]:disabled,
input[type=number]:disabled,
input[type=date]:disabled,
input[type=datetime-local]:disabled,
input[type=tel]:disabled,
input[type=url]:disabled,
select:disabled,
textarea:disabled,
input[type=text][readonly],
input[type=email][readonly],
input[type=password][readonly],
input[type=number][readonly],
input[type=date][readonly],
input[type=datetime-local][readonly],
input[type=tel][readonly],
input[type=url][readonly],
select[readonly],
textarea[readonly] {
  background: #F5F7FA;
  color: #6B7280;
}
textarea {
  resize: vertical;
  min-height: 80px;
}
span.info {
  display: block;
  padding: 8px 0;
  color: #1F2937;
  border-bottom: 1px dashed #E0E4EB;
}
button,
a.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  background: #1565C0;
  color: white;
  transition: background 0.15s;
}
button:hover,
a.btn:hover {
  background: #0D47A1;
  text-decoration: none;
}
button:disabled,
a.btn:disabled {
  background: #9CA3AF;
  cursor: not-allowed;
}
button.secondary,
a.btn.secondary {
  background: #FFFFFF;
  color: #1F2937;
  border: 1px solid #E0E4EB;
}
button.secondary:hover,
a.btn.secondary:hover {
  background: #F5F7FA;
}
button.danger,
a.btn.danger {
  background: #DC2626;
}
button.danger:hover,
a.btn.danger:hover {
  background: #bb1e1e;
}
button.success,
a.btn.success {
  background: #16A34A;
}
button.ghost,
a.btn.ghost {
  background: transparent;
  color: #1565C0;
}
button.ghost:hover,
a.btn.ghost:hover {
  background: rgba(21, 101, 192, 0.08);
}
.content-table {
  width: 100%;
  background: #FFFFFF;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
table {
  width: 100%;
  border-collapse: collapse;
}
table thead {
  background: #F5F7FA;
}
table thead th {
  text-align: left;
  padding: 8px 16px;
  font-weight: 500;
  font-size: 12px;
  color: #6B7280;
  border-bottom: 1px solid #E0E4EB;
}
table thead th.actions {
  text-align: right;
  width: 100px;
}
table tbody tr {
  border-bottom: 1px solid #E0E4EB;
  transition: background 0.1s;
}
table tbody tr:hover {
  background: #F5F7FA;
}
table tbody tr:last-child {
  border-bottom: none;
}
table tbody td {
  padding: 8px 16px;
  font-size: 14px;
}
table tbody td.actions {
  text-align: right;
  white-space: nowrap;
}
table tbody td.actions i {
  cursor: pointer;
  padding: 4px 8px;
  color: #6B7280;
}
table tbody td.actions i:hover {
  color: #1565C0;
}
p.message-error {
  display: none;
  padding: 8px 16px;
  background: rgba(220, 38, 38, 0.12);
  color: #DC2626;
  border-radius: 4px;
  margin-bottom: 16px;
}
p.message-error.show {
  display: block;
}
p.message-success {
  padding: 8px 16px;
  background: rgba(22, 163, 74, 0.12);
  color: #16A34A;
  border-radius: 4px;
}
.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}
.status-badge.active {
  background: rgba(22, 163, 74, 0.15);
  color: #16A34A;
}
.status-badge.inactive {
  background: rgba(156, 163, 175, 0.2);
  color: #6B7280;
}
.status-badge.blocked {
  background: rgba(220, 38, 38, 0.15);
  color: #DC2626;
}
.status-badge.trial {
  background: rgba(245, 158, 11, 0.15);
  color: #F59E0B;
}
section.login {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #1565C0 0%, #0D47A1 100%);
}
section.login .login-box {
  background: #FFFFFF;
  border-radius: 12px;
  padding: 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}
section.login .login-box > .logo {
  text-align: center;
  margin-bottom: 24px;
  font-weight: 700;
  font-size: 24px;
  color: #1565C0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
section.login .login-box > .logo img { width: auto; height: 56px; max-width: 80%; }
section.login .login-box > .logo .brand-suffix { font-size: 13px; color: #6B7280; font-weight: 500; letter-spacing: 0.6px; text-transform: uppercase; }
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.card {
  background: #FFFFFF;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.card > .card-title {
  font-size: 12px;
  color: #6B7280;
  margin-bottom: 4px;
}
.card > .card-value {
  font-size: 28px;
  font-weight: 500;
  color: #1F2937;
  margin-bottom: 4px;
}
.card > .card-trend {
  font-size: 12px;
  color: #9CA3AF;
}
.card > .card-trend.positive {
  color: #16A34A;
}
.card > .card-trend.negative {
  color: #DC2626;
}
.chart-container {
  background: #FFFFFF;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  margin-bottom: 16px;
}
.chart-container > .chart-title {
  font-size: 14px;
  font-weight: 500;
  color: #1F2937;
  margin-bottom: 16px;
}
.w-full {
  width: 100%;
}
.w-auto {
  width: auto;
}
.w-half {
  width: 50%;
}
.w-third {
  width: 33.333%;
}
.w-quarter {
  width: 25%;
}
.flex {
  display: flex;
}
.flex-col {
  flex-direction: column;
}
.flex-1 {
  flex: 1;
}
.gap-sm {
  gap: 8px;
}
.gap-md {
  gap: 16px;
}
.gap-lg {
  gap: 24px;
}
.mt-sm {
  margin-top: 8px;
}
.mt-md {
  margin-top: 16px;
}
.mt-lg {
  margin-top: 24px;
}
.mb-sm {
  margin-bottom: 8px;
}
.mb-md {
  margin-bottom: 16px;
}
.mb-lg {
  margin-bottom: 24px;
}
.text-center {
  text-align: center;
}
.text-right {
  text-align: right;
}
.text-soft {
  color: #6B7280;
}
.text-mute {
  color: #9CA3AF;
}
.text-success {
  color: #16A34A;
}
.text-danger {
  color: #DC2626;
}
.hidden {
  display: none;
}
@media (max-width: 768px) {
  nav.menu {
    transform: translateX(-100%);
    transition: transform 0.2s;
    z-index: 150;
  }
  nav.menu.open {
    transform: translateX(0);
  }
  main {
    margin-left: 0;
  }
  header .logo {
    width: auto;
  }
  form .row {
    flex-direction: column;
  }
}
@media (max-width: 640px) {
  main {
    padding: 16px;
  }
  section.page {
    padding: 16px;
  }
  aside.modal .modal-body {
    padding: 16px;
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* ─────────── Loading indicators ─────────── */
#global-loader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  z-index: 9999;
  pointer-events: none;
  overflow: hidden;
}
#global-loader.active::before {
  content: '';
  position: absolute;
  left: -40%;
  top: 0;
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, transparent, #2563EB, transparent);
  animation: global-loader-slide 1.1s linear infinite;
}
@keyframes global-loader-slide {
  0%   { left: -40%; }
  100% { left: 100%; }
}

tr.table-loading td {
  color: #6B7280;
  font-size: 18px;
}
tr.table-loading .fa-spinner {
  color: #2563EB;
}

button.loading,
input[type=submit].loading {
  opacity: 0.7;
  cursor: wait;
}

/* Standalone permission-check (uso fora de .permission-groups, ex: customer features). */
form label.permission-check {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 10px 12px;
  border: 1px solid #E0E4EB;
  border-radius: 4px;
  background: #FFFFFF;
  transition: background 0.12s, border-color 0.12s;
  margin: 0;
  font-size: 13px;
  font-weight: 400;
  color: #1F2937;
  box-sizing: border-box;
}
form label.permission-check:hover { background: rgba(21, 101, 192, 0.06); border-color: #1976D2; }
form label.permission-check input[type=checkbox] {
  width: 16px; height: 16px; margin: 0;
  cursor: pointer; accent-color: #1565C0; flex-shrink: 0;
}
form label.permission-check span { line-height: 1.3; flex: 1; min-width: 0; }
form label.permission-check:has(input:checked) {
  border-color: #1976D2;
  background: rgba(21, 101, 192, 0.04);
}

/* Features grid (customer modal). Cards 100% width, empilhados, compactos. */
.features-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.features-grid > label.permission-check { width: 100%; }
.features-grid > label.permission-check span b { display: block; font-weight: 500; color: #1F2937; font-size: 13px; line-height: 1.2; }
.features-grid > label.permission-check span small { display: block; color: #6B7280; font-size: 12px; font-weight: 400; line-height: 1.2; }
.features-grid > label.permission-check:has(input:checked) span b { color: #0D47A1; }

/* Features agrupadas (Geral + Conty IA). */
.features-group { margin-top: 10px; }
.features-group:first-child { margin-top: 4px; }
.features-group-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #6B7280;
  margin: 0 0 6px;
}

/* ─────────── AI Usage subpage ─────────── */
.ai-usage-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.ai-usage-card {
  background: #FFFFFF;
  border: 1px solid #E0E4EB;
  border-radius: 6px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ai-usage-card-label { font-size: 12px; color: #6B7280; text-transform: uppercase; letter-spacing: 0.4px; }
.ai-usage-card-value { font-size: 22px; font-weight: 600; color: #1F2937; }
.ai-usage-card-sub   { font-size: 12px; color: #6B7280; }
.ai-usage-card-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.ai-usage-card-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; color: #1F2937; }
.ai-usage-card-list li.empty { color: #9CA3AF; font-style: italic; }
.ai-usage-card-list li small { color: #6B7280; }
.ai-usage-card-list li strong { color: #0D47A1; font-size: 12px; white-space: nowrap; }

.ai-usage-table th.num,
.ai-usage-table td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ai-usage-table tr.ai-usage-footer td { background: #F5F7FA; font-weight: 500; padding: 10px 8px; }
.ai-usage-table .text-soft { color: #6B7280; font-size: 11px; margin-left: 4px; }
.ai-usage-table .status-badge.trial { background: rgba(249,115,22,0.12); color: #C2410C; font-size: 10px; padding: 1px 5px; border-radius: 3px; }

.ai-usage-table thead tr.column-filters th input[type=date] { padding: 4px 6px; font-size: 11px; margin-bottom: 2px; }
