:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-contrast: #ffffff;
  --border: #e2e8f0;
  --navbar-bg: #0d6efd;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  line-height: 1.5;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: block;
  padding: 12px 0;
  background: var(--navbar-bg);
  border-bottom: none;
}
.topbar-inner { max-width: 1100px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 24px; width: 100%; }
.userbar { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.userbar a { padding: 6px 10px; border-radius: 8px; text-decoration: none; color: var(--text); }
.userbar a:hover { background: #eef2ff; }
.notif-bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 8px; text-decoration: none; color: var(--text); }
.notif-bell:hover { background: #eef2ff; }
.notif-badge { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: #ef4444; color: #fff; font-size: 11px; line-height: 16px; text-align: center; }
.notif-menu { min-width: 240px; max-height: 280px; overflow: auto; }
.notif-item small { display: block; color: var(--muted); font-size: 12px; }
.notif-empty { padding: 8px 10px; color: var(--muted); }
.brand {
  font-weight: 700;
  font-size: 18px;
}
.menu {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}
.menu a {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
}
.menu a:hover {
  background: #eef2ff;
}
.menu a.active {
  background: transparent;
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.dropdown { position: relative; }
.dropdown .dropdown-toggle {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
}
.content .btn-primary.dropdown-toggle { color: #ffffff; }
.dropdown.active .dropdown-toggle { background: transparent; color: #ffffff; text-decoration: underline; text-underline-offset: 4px; }
.dropdown .dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 180px;
  max-width: calc(100vw - 40px);
  padding: 6px;
  box-shadow: 0 8px 20px rgba(2, 6, 23, 0.08);
  z-index: 1000;
}
.userbar .dropdown .dropdown-menu { left: auto; right: 0; }
/* Disable hover-to-open globally; use Bootstrap click dropdowns */
/* removed hover open to avoid unintended behavior */
.dropdown .dropdown-menu a {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
}
.dropdown .dropdown-menu a:hover { background: #f1f5f9; }
.dropdown .dropdown-menu a.active { background: var(--primary); color: var(--primary-contrast); }
.content {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 20px;
}
.content-login { max-width: none; margin: 0; padding: 0; }
body.login-page { overflow: auto; background: #e5e7eb; }
.page h1 {
  margin: 0 0 8px;
  font-size: 28px;
}
.page p {
  margin: 0 0 16px;
  color: var(--muted);
}
.content .btn:not(.btn-primary):not(.btn-secondary):not(.btn-success):not(.btn-danger):not(.btn-warning):not(.btn-info):not(.btn-light):not(.btn-dark):not(.btn-outline-primary):not(.btn-outline-secondary):not(.btn-outline-success):not(.btn-outline-danger):not(.btn-outline-warning):not(.btn-outline-info):not(.btn-outline-light):not(.btn-outline-dark) {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--primary);
  color: var(--primary-contrast);
  text-decoration: none;
  border: 0;
}
.content .btn:not(.btn-primary):not(.btn-secondary):not(.btn-success):not(.btn-danger):not(.btn-warning):not(.btn-info):not(.btn-light):not(.btn-dark):hover { opacity: 0.9; }
.content .btn.btn-secondary { background: #64748b; }
.content .btn.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.content .btn.btn-outline:hover { background: #f1f5f9; }
.content .btn.btn-sm { padding: 6px 10px; border-radius: 6px; font-size: 13px; }
.btn-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { border-bottom: 1px solid var(--border); padding: 12px 14px; text-align: left; }
.table-wrap { margin-top: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: visible; box-shadow: 0 10px 30px rgba(2,6,23,0.06); }
.table-wrap h2 { margin: 0 0 12px; font-size: 22px; }
.table.perm-table { border-collapse: separate; border-spacing: 0; }
.table.perm-table thead th { background: #f8fafc; font-weight: 600; }
.table.perm-table tbody tr { transition: background-color .15s ease; }
.table.perm-table tbody tr:hover { background: #f1f5f9; }
.table-striped.perm-table > tbody > tr:nth-of-type(odd) { --bs-table-accent-bg: #f9fafb; background-color: #f9fafb; }
.modal { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; pointer-events: auto; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(2,6,23,0.35); z-index: 0; pointer-events: none; }
.modal-dialog { position: relative; z-index: 1; margin: 40px auto; width: 100%; max-width: 720px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; box-shadow: 0 20px 40px rgba(2,6,23,0.25); max-height: calc(100vh - 80px); display: flex; flex-direction: column; pointer-events: auto; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 16px; overflow: auto; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.reject-box { background: #f8fafc; border-top: 1px solid var(--border); }
.reject-box textarea { width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.kv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.kv-grid .span-2 { grid-column: 1 / -1; }
.kv { display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.kv .k { font-size: 12px; color: var(--muted); }
.kv .v { font-size: 14px; color: var(--text); }
.kv-inline { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 10px; }
.kv .sep { color: var(--muted); }
.form .grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form .grid .span-2 { grid-column: 1 / -1; }
.login-form .grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form .field { display: flex; flex-direction: column; gap: 6px; }
.form .field input { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); }
.form .field select { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); }
.form .actions { display: flex; gap: 8px; margin-top: 12px; }
.submenu { margin-top: 12px; display: flex; gap: 8px; }
.submenu a { padding: 6px 10px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; }
.submenu a:hover { background: #f1f5f9; }
@media (max-width: 640px) {
  .menu { flex-wrap: wrap; }
  .form .grid { grid-template-columns: 1fr; }
  .login-form .grid { grid-template-columns: 1fr; }
}
.login { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; gap: 8px; }
.login-footer { text-align: center; }
.login-form { margin-bottom: 16px; }
.login-actions { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.login-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 24px; box-shadow: 0 10px 30px rgba(2,6,23,0.08); }
.login-card.signup { max-width: 720px; }
.login-header { text-align: center; margin-bottom: 16px; }
.login-brand { font-weight: 800; font-size: 22px; letter-spacing: 0.5px; }
.login-title { font-size: 18px; margin-top: 8px; }
.login-subtitle { font-size: 14px; color: var(--muted); }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-form.signup .grid { gap: 16px; }
.login-form .grid .span-2 { grid-column: 1 / -1; }
.login-form .grid .row-span-3 { grid-row: span 3; }
.login-form .field label { font-size: 14px; color: var(--muted); }
.login-form .field input { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); }
.login-form .field select { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); }
.login-form .field input:focus, .login-form .field select:focus, .form .field input:focus, .form .field select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15); }
.login-form .field.field-inline { display: flex; flex-direction: row; align-items: center; gap: 8px; justify-content: flex-start; flex-wrap: wrap; }
.login-form .field.field-inline .inline-label { margin: 0; }
.login-form .field.field-inline .radio-group { display: flex; gap: 8px; }
.radio-group { display: flex; gap: 10px; flex-wrap: wrap; }
.radio-group .radio { display: inline-flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); cursor: pointer; }
.radio-group .radio:hover { background: #f1f5f9; }
.radio-group .radio input { width: 16px; height: 16px; accent-color: var(--primary); }
.btn-block { width: 100%; }
.alert { padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; }
.alert-error { background: #fee2e2; color: #7f1d1d; border: 1px solid #fecaca; }
.login-footer { margin-top: 16px; font-size: 12px; color: var(--muted); }
.pw-rules { list-style: none; padding: 0; margin: 8px 0 12px; }
.pw-rules li { padding: 6px 8px; border: 1px dashed var(--border); border-radius: 8px; margin-bottom: 6px; font-size: 13px; }
.pw-rules.pw-small li { font-size: 12px; padding: 4px 6px; }
.pw-rules li.pw-ok { border-color: #86efac; background: #f0fdf4; color: #166534; }
.pw-rules li.pw-bad { border-color: #fecaca; background: #fee2e2; color: #7f1d1d; }
.topbar .brand,
.topbar .menu a,
.topbar .dropdown .dropdown-toggle,
.topbar .notif-bell,
.topbar .userbar a { color: #ffffff; }
.topbar .menu a:hover,
.topbar .dropdown .dropdown-toggle:hover,
.topbar .notif-bell:hover,
.topbar .userbar a:hover { background: rgba(255,255,255,0.15); }
.topbar .dropdown .dropdown-menu { background: var(--surface); border: 1px solid var(--border); }
.topbar .dropdown .dropdown-menu a { color: var(--text); }
.topbar .dropdown .dropdown-menu a:hover { background: #f1f5f9; color: var(--text); }
.topbar .dropdown .dropdown-menu a.active { background: var(--primary); color: var(--primary-contrast); }
.navbar.bg-primary { background-color: var(--navbar-bg) !important; }
.navbar .container { max-width: 1100px; padding-left: 20px; padding-right: 20px; }
.navbar-nav { gap: 8px; }
.navbar-nav .nav-link.active { text-decoration: underline; text-underline-offset: 4px; }
.navbar .dropdown-menu { background: var(--surface); border: 1px solid var(--border); }
.navbar .dropdown-menu .dropdown-item:hover { background: #f1f5f9; color: var(--text); }
.navbar .dropdown-menu .dropdown-item.active { background: var(--primary); color: var(--primary-contrast); }
.navbar .navbar-brand { color: #ffffff !important; }
.navbar .nav-link { color: #ffffff !important; }
.navbar .nav-link:hover, .navbar .nav-link:focus { color: #ffffff !important; background: rgba(255,255,255,0.12); }
.navbar .dropdown-toggle { color: #ffffff !important; }
.navbar .notif-bell { color: #ffffff; }
.navbar .notif-bell:hover { background: rgba(255,255,255,0.15); }
.navbar .btn-outline-light { color: #ffffff; border-color: rgba(255,255,255,0.55); }
.navbar .btn-outline-light:hover, .navbar .btn-outline-light:focus { color: #ffffff; background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.75); }
.navbar .notif-bell { margin-right: 12px; flex-shrink: 0; }
.notif-menu .notif-item { display: block; text-decoration: none; color: var(--text); padding: 8px 10px; border-radius: 6px; }
.notif-menu .notif-item:hover { background: #f1f5f9; }
.site-footer { position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--border); color: var(--muted); margin-top: 0; z-index: 100; }
.site-footer .container { max-width: 1100px; padding-left: 20px; padding-right: 20px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.site-footer small { color: var(--muted); }
/* Reserve space so content não fique escondido pelo rodapé fixo */
.content { padding-bottom: 64px; }
