@charset "utf-8";
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, Arial, sans-serif;
  font-size: 14px;
  color: #333;
  background: #f0f2f5;
  min-height: 100vh;
}
a { text-decoration: none; color: #2563eb; transition: color .2s; }
a:hover { color: #1d4ed8; text-decoration: underline; }

/* ===== HEADER ===== */
.header {
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 50%, #1d4ed8 100%);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  position: relative;
  z-index: 100;
}
.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-size: 18px;
  font-weight: 600;
}
.header-logo img { height: 48px; width: auto; border-radius: 6px; }
.header-user {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
}
.header-user .avatar-sm {
  width: 36px; height: 36px; border-radius: 50%;
  object-fit: cover; border: 2px solid rgba(255,255,255,.5);
}
.header-user .user-name { font-weight: 500; font-size: 13px; opacity: .9; }
.header-user a { color: #fff; opacity: .8; font-size: 13px; }
.header-user a:hover { opacity: 1; text-decoration: none; }

/* ===== NAV ===== */
.nav-bar {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 8px 24px;
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
  min-height: 54px;
}
.nav-bar > a, .nav-bar .dropdown > a {
  padding: 8px 16px;
  color: #475569;
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
  transition: all .2s;
  white-space: nowrap;
  cursor: pointer;
  border: none;
  background: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.4;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.nav-bar > a:hover, .nav-bar .dropdown > a:hover {
  background: #eef2ff;
  color: #2563eb;
  text-decoration: none;
}
.nav-bar > a.active, .nav-bar .dropdown > a.active {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  box-shadow: 0 2px 4px rgba(37,99,235,.25);
}
.nav-bar > a.active:hover, .nav-bar .dropdown > a.active:hover {
  color: #fff;
  background: linear-gradient(135deg, #1d4ed8, #1e3a8a);
}
.nav-bar .dropdown { position: relative; }
.nav-bar .dropdown > a::after {
  content: "▾";
  font-size: 10px;
  opacity: .6;
  margin-left: 2px;
  transition: transform .2s;
}
.nav-bar .dropdown:hover > a::after {
  transform: rotate(180deg);
}
.nav-bar .dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  min-width: 200px;
  z-index: 200;
  padding: 6px 0;
  margin-top: 0;
}
.nav-bar .dropdown:hover .dropdown-menu,
.nav-bar .dropdown.open .dropdown-menu {
  display: block;
}
/* Ponte invisível entre o link e o menu — mantém :hover ativo */
.nav-bar .dropdown::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  width: 200px;
  height: 20px;
}
.nav-bar .dropdown-menu a {
  display: block;
  padding: 10px 18px;
  border: none;
  font-size: 13px;
  color: #444;
  background: none;
  border-radius: 0;
  transition: all .15s;
}
.nav-bar .dropdown-menu a:first-child { border-radius: 10px 10px 0 0; }
.nav-bar .dropdown-menu a:last-child { border-radius: 0 0 10px 10px; }
.nav-bar .dropdown-menu a:only-child { border-radius: 10px; }
.nav-bar .dropdown-menu a:hover { background: #eef2ff; color: #2563eb; }
.nav-bar .dropdown-menu a.active { background: #eef2ff; color: #2563eb; font-weight: 600; box-shadow: none; }

/* ===== MAIN CONTENT ===== */
.main-content {
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 24px;
}

/* ===== CARDS ===== */
.card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  padding: 24px;
  margin-bottom: 20px;
}
.card-header {
  font-size: 18px;
  font-weight: 600;
  color: #1e3a5f;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid #f0f2f5;
}

/* ===== TABLES ===== */
.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  text-align: left;
  padding: 12px 10px;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
table td {
  padding: 10px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
table tr:hover td {
  background: #f8fafc;
}
table .actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
table .actions a svg, table .actions a img { width: 16px; height: 16px; opacity: .6; transition: opacity .2s; }
table .actions a:hover svg, table .actions a:hover img { opacity: 1; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
}
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; color: #fff; text-decoration: none; }
.btn-success { background: #059669; color: #fff; }
.btn-success:hover { background: #047857; color: #fff; text-decoration: none; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; text-decoration: none; }
.btn-warning { background: #d97706; color: #fff; }
.btn-warning:hover { background: #b45309; color: #fff; text-decoration: none; }
.btn-secondary { background: #e5e7eb; color: #374151; }
.btn-secondary:hover { background: #d1d5db; color: #1f2937; text-decoration: none; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; border-radius: 4px; }

/* ===== FORMS ===== */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 4px;
}
.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
  background: #fff;
}
.form-control:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
}

/* ===== PROFILE ===== */
.profile-header {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
}
.avatar-lg {
  width: 100px; height: 100px; border-radius: 50%;
  object-fit: cover;
  border: 4px solid #e5e7eb;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
}
.avatar-upload {
  position: relative;
  display: inline-block;
}
.avatar-upload input[type="file"] {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  top: 0; left: 0;
}
.avatar-upload .avatar-overlay {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,.6);
  color: #fff;
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 10px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .3s;
}
.avatar-upload:hover .avatar-overlay { opacity: 1; }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #9ca3af;
}
.empty-state img { opacity: .4; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 16px 0;
  font-size: 13px;
}
.pagination a {
  padding: 6px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  color: #374151;
  transition: all .2s;
}
.pagination a:hover {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
  text-decoration: none;
}
.pagination .current {
  padding: 6px 12px;
  background: #2563eb;
  color: #fff;
  border-radius: 6px;
  font-weight: 600;
}

/* ===== BADGES ===== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }

/* ===== LOGIN PAGE ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 50%, #1d4ed8 100%);
  padding: 20px;
}
.login-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  text-align: center;
}
.login-card .logo { max-width: 240px; margin-bottom: 24px; }
.login-card h1 {
  font-size: 22px;
  color: #1e3a5f;
  margin-bottom: 8px;
  font-weight: 700;
}
.login-card p { color: #6b7280; font-size: 14px; margin-bottom: 24px; }
.login-card .form-control { text-align: center; }
.login-card .btn { width: 100%; justify-content: center; padding: 12px; font-size: 15px; }
.login-card .footer-text { margin-top: 20px; font-size: 12px; color: #9ca3af; }

/* ===== ALERTS ===== */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
}
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* ===== FOOTER ===== */
.footer {
  text-align: center;
  padding: 20px;
  color: #9ca3af;
  font-size: 12px;
  border-top: 1px solid #e5e7eb;
  margin-top: 40px;
}

/* ===== PERMISSION PAGE ===== */
.permission-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f2f5;
  padding: 20px;
}
.permission-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
  padding: 40px;
  text-align: center;
  max-width: 420px;
}
.permission-card h2 { color: #dc2626; margin-bottom: 12px; }
.permission-card p { color: #6b7280; margin-bottom: 20px; }

/* ===== MODAL INLINE (for embedded modal forms) ===== */
.modal-inline {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  min-width: 320px;
}

/* ===== LEGACY ADMIN FORM OVERRIDES (for Modalbox content) ===== */
#MB_content .frm1 { font-size: 13px; border-color: #d1d5db; border-radius: 4px; padding: 4px 6px; }
#MB_content .btn1 { padding: 6px 16px; font-size: 13px; border-radius: 6px; }
#MB_content .Titulo16 { font-size: 15px; }
#MB_content select[size] { font-size: 13px; max-width: 100%; }
#MB_content input:not([type="radio"]):not([type="checkbox"]),
#MB_content textarea,
#MB_content select {
  max-width: 100% !important;
  box-sizing: border-box !important;
  width: 100% !important;
  min-width: 0;
}
#MB_content table { width: 100%; }
#MB_content table td { word-break: break-word; }
#MB_content textarea { width: 100% !important; }

@media (max-width: 768px) {
  #MB_content table td[bgcolor] { display: block; width: 100%; padding: 4px 0; font-weight: 600; font-size: 12px; }
  #MB_content table tr { display: block; margin-bottom: 8px; }
  #MB_content table td { display: block; width: 100%; padding: 2px 0; }
  #MB_content input[style*="width"],
  #MB_content select[style*="width"],
  #MB_content textarea[style*="width"] { width: 100% !important; max-width: 100% !important; }
  #MB_content hr { max-width: 100% !important; }
  #MB_content .confirm-excluir,
  #MB_content .excluido-ok { min-width: 0 !important; }
  #MB_content .btn1 { width: 100%; margin-bottom: 4px; }
  #MB_content form { min-width: 0 !important; }
  #MB_content .modal-inline { min-width: 0 !important; padding: 12px; }
}

/* ===== NAV TOGGLE (mobile) ===== */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  padding: 10px 16px;
  cursor: pointer;
  color: #475569;
  font-size: 18px;
  align-items: center;
  gap: 6px;
  min-height: 48px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  border-radius: 8px;
  font-weight: 500;
}
.nav-toggle:hover { background: #eef2ff; color: #2563eb; }
.nav-toggle::after { font-size: 14px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .header { padding: 0 16px; height: 60px; }
  .header-logo span { display: none; }
  .header-logo img { height: 38px; }
  .nav-bar { padding: 0; flex-direction: column; gap: 0; overflow: hidden; min-height: auto; }
  .nav-bar .nav-toggle { display: flex; width: 100%; border-bottom: 1px solid #e5e7eb; border-radius: 0; padding: 14px 16px; }
  .nav-bar .nav-toggle::after { content: "☰ Menu"; font-size: 13px; }
  .nav-bar.nav-open .nav-toggle::after { content: "✕ Fechar"; }
  .nav-bar > a, .nav-bar > .dropdown { display: none; }
  .nav-bar.nav-open > a, .nav-bar.nav-open > .dropdown { display: block; }
  .nav-bar > a { width: 100%; border-bottom: 1px solid #f3f4f6; padding: 14px 16px; white-space: normal; min-height: 48px; display: flex; align-items: center; border-radius: 0; }
  .nav-bar .dropdown { width: 100%; }
  .nav-bar .dropdown > a { width: 100%; padding: 14px 16px; border-bottom: 1px solid #f3f4f6; min-height: 48px; display: flex; align-items: center; box-sizing: border-box; border-radius: 0; }
  .nav-bar .dropdown > a::after { content: "▾"; margin-left: auto; }
  .nav-bar .dropdown-menu { position: static; box-shadow: none; border: none; border-radius: 0; min-width: auto; background: #f9fafb; display: none; }
  .nav-bar .dropdown { padding-bottom: 0; margin-bottom: 0; }
  .nav-bar .dropdown-menu a { padding: 12px 24px; font-size: 14px; min-height: 44px; display: flex; align-items: center; }
  .nav-bar .dropdown-menu a:first-child,
  .nav-bar .dropdown-menu a:last-child,
  .nav-bar .dropdown-menu a:only-child { border-radius: 0; }
  .nav-bar .dropdown.open .dropdown-menu { display: block; }
  .main-content { padding: 0 16px; margin: 16px auto; }
  .card { padding: 16px; border-radius: 8px; }
  .card-header { font-size: 16px; }
  .profile-header { flex-direction: column; text-align: center; }
  .avatar-lg { width: 80px; height: 80px; }
  table { font-size: 12px; }
  table th, table td { padding: 8px 6px; white-space: normal; word-break: break-word; }
  table .actions { flex-wrap: wrap; }
  .form-row { grid-template-columns: 1fr; }
  .btn { width: 100%; justify-content: center; }
  .btn-group { display: flex; flex-direction: column; gap: 8px; }
  .pagination { flex-wrap: wrap; }
  .footer { font-size: 11px; padding: 16px; }
  .footer a { color: #6b7280; text-decoration: underline; }
  .footer a:hover { color: #2563eb; }
  .footer a { display: inline-block; }
  .login-card { padding: 24px; }
  .login-card .logo { max-width: 180px; }
  .permission-card { padding: 24px; }
}

@media (max-width: 480px) {
  .header { padding: 0 12px; height: 54px; }
  .header-logo img { height: 32px; }
  .header-user .user-name { display: none; }
  .card { padding: 12px; }
  table { font-size: 11px; }
  table th, table td { padding: 6px 4px; }
  table .actions a img { width: 14px; height: 14px; }
  .login-card { padding: 20px; }
  .login-card h1 { font-size: 18px; }
}

/* ===== PRINT ===== */
@media print {
  .header, .nav-bar, .footer, .btn, .actions { display: none !important; }
  .card { box-shadow: none; border: 1px solid #ddd; }
  body { background: #fff; }
}
