:root {
  --azul: #0d3b66;
  --azul-2: #1f6feb;
  --verde: #1f9d55;
  --branco: #ffffff;
  --preto: #0f172a;
  --cinza: #eef2f7;
  --borda: #dbe3ee;
}

body {
  background: linear-gradient(180deg, #f8fbff 0%, var(--cinza) 100%);
  color: var(--preto);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

/* ---------- Auth ---------- */
.auth-page {
  min-height: 100vh;
  background: linear-gradient(140deg, #0b1220 0%, var(--azul) 45%, var(--azul-2) 100%);
}
.auth-wrapper { max-width: 1020px; }
.auth-panel {
  border-radius: 1.25rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .15);
}
.auth-hero {
  background: radial-gradient(circle at 20% 10%, rgba(255,255,255,.16), transparent 45%), #0f172a;
}
.auth-card,
.card-ui,
.card {
  border: 0;
  border-radius: 1rem;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .08);
}

/* ---------- App Shell ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 272px;
  background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
  color: var(--branco);
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1040;
  padding: 1rem;
  border-right: 1px solid rgba(255, 255, 255, .06);
  transition: transform .2s ease;
}
.sidebar .brand {
  font-weight: 700;
  color: var(--branco);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: .55rem;
  margin-bottom: 1rem;
  font-size: 1.02rem;
}
.sidebar .nav-link {
  color: #c7d2fe;
  border-radius: .65rem;
  padding: .58rem .75rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.sidebar .nav-link:hover,
.sidebar .nav-link.active {
  background: rgba(255, 255, 255, .12);
  color: #fff;
}

.main-wrap { margin-left: 272px; flex: 1; }
.topbar {
  background: var(--branco);
  border-bottom: 1px solid var(--borda);
  padding: .75rem 1rem;
  position: sticky;
  top: 0;
  z-index: 1030;
}

.notification-menu { width: 340px; border: 0; border-radius: .85rem; }
.notification-list { max-height: 280px; overflow: auto; }

/* ---------- Components ---------- */
.kpi { background: var(--branco); }
.kpi .icon {
  width: 42px;
  height: 42px;
  border-radius: .7rem;
  display: grid;
  place-items: center;
  color: #fff;
}
.icon-azul { background: var(--azul-2); }
.icon-verde { background: var(--verde); }
.icon-preto { background: var(--preto); }

.table-modern {
  border-collapse: separate;
  border-spacing: 0;
}
.table-modern thead th {
  background: #f8fafc;
  color: #334155;
  border-bottom: 1px solid #e2e8f0;
}
.table-modern tbody tr:hover { background: #f8fbff; }

.form-control,
.form-select {
  border-color: #d5dde8;
  padding-top: .55rem;
  padding-bottom: .55rem;
}
.form-control:focus,
.form-select:focus {
  border-color: #88b7ff;
  box-shadow: 0 0 0 .2rem rgba(31, 111, 235, .15);
}

.badge-status { font-weight: 600; }
.badge-pendente { background: #f59e0b; color: #111827; }
.badge-cadastrada { background: #2563eb; color:#fff; }
.badge-concluido { background: #16a34a; color:#fff; }

.btn-icon i { margin-right: .35rem; }
.modal-content { border: 0; border-radius: 1rem; }

/* ---------- DataTables tuning ---------- */
div.dataTables_wrapper div.dataTables_filter input {
  border-radius: .6rem;
  border: 1px solid #d5dde8;
}

/* ---------- Mobile sidebar ---------- */
@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 0 0 0 9999px rgba(2, 6, 23, 0);
  }
  .app-shell.sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: 0 0 0 9999px rgba(2, 6, 23, .45);
  }
  .main-wrap { margin-left: 0; }
}


.toast-gray {
  background: #4b5563;
  color: #f8fafc;
  border-radius: .85rem;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .25);
}
.toast-gray .toast-body { font-size: .92rem; }
.toast-gray-header {
  background: rgba(31, 41, 55, .9);
  color: #f8fafc;
  border-bottom: 1px solid rgba(255,255,255,.15);
}
.toast-gray-header small { color: #e5e7eb; }

/* ---------- Institutional footer ---------- */
.institutional-footer {
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  border-top: 1px solid rgba(255, 255, 255, .12);
  color: #e2e8f0;
}

.footer-title {
  color: #f8fafc;
  font-weight: 700;
  margin-bottom: .65rem;
}

.footer-logo {
  max-width: 210px;
  width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: .5rem;
  background: rgba(255, 255, 255, .95);
  padding: .4rem;
}

.footer-logo-placeholder {
  min-height: 62px;
  min-width: 210px;
  max-width: 240px;
  border: 1px dashed rgba(226, 232, 240, .45);
  border-radius: .6rem;
  color: #cbd5e1;
  font-size: .9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(148, 163, 184, .08);
  padding: .6rem;
}

.footer-portal-link {
  color: #93c5fd;
  font-weight: 600;
  text-decoration: none;
}
.footer-portal-link:hover,
.footer-portal-link:focus {
  color: #dbeafe;
  text-decoration: underline;
}

.footer-list li,
.footer-text {
  line-height: 1.6;
  color: #cbd5e1;
}

@media (max-width: 767px) {
  .footer-logo-placeholder {
    min-width: 100%;
    max-width: 100%;
  }
}

/* ---------- Premium institutional refinements ---------- */
:root {
  --gov-navy: #0b1f3a;
  --gov-blue: #1d4ed8;
  --gov-slate: #334155;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
}

body {
  background: radial-gradient(circle at 90% -10%, #dbeafe 0%, transparent 30%), linear-gradient(180deg, #f8fbff 0%, #eef3fa 100%);
}

.main-content-shell {
  min-height: calc(100vh - 180px);
}

.page-hero {
  background: linear-gradient(135deg, rgba(255,255,255,.92) 0%, rgba(241,245,249,.95) 100%);
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  padding: 1rem 1.15rem;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gov-navy);
}

.surface-card {
  border: 1px solid #e2e8f0;
  background: var(--surface);
}

.sidebar {
  background: linear-gradient(180deg, #0b1f3a 0%, #0f2a4d 60%, #12315b 100%);
  box-shadow: inset -1px 0 0 rgba(255,255,255,.08);
}

.brand {
  padding: .45rem;
  border-radius: .8rem;
  background: rgba(255,255,255,.06);
}

.brand-mark {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: .7rem;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: #fff;
}

.sidebar-section-title {
  margin-top: .9rem;
  margin-bottom: .55rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .72rem;
  color: rgba(226, 232, 240, .65);
}

.sidebar .nav-link {
  border: 1px solid transparent;
}

.sidebar .nav-link.active {
  background: linear-gradient(135deg, rgba(59,130,246,.28), rgba(37,99,235,.22));
  border-color: rgba(191,219,254,.35);
}

.topbar {
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(10px);
}

.topbar-kicker {
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #64748b;
  font-weight: 700;
}

.topbar-user-name {
  color: #0f172a;
  font-size: 1rem;
}

.role-pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  border: 1px solid #dbeafe;
  background: #eff6ff;
  color: #1e3a8a;
  border-radius: 999px;
  padding: .25rem .7rem;
  font-size: .76rem;
  font-weight: 700;
}

.kpi {
  border: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.table-premium thead th {
  text-transform: uppercase;
  letter-spacing: .05em;
  font-size: .74rem;
  color: #475569;
}

.table-premium tbody td {
  border-color: #e2e8f0;
  vertical-align: middle;
}

.form-control,
.form-select {
  border-radius: .72rem;
  background: #fff;
}

.modal-content {
  border-radius: 1rem;
  border: 1px solid #e2e8f0;
}

.toast-gray {
  animation: toastSlideIn .25s ease;
}

@keyframes toastSlideIn {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 1200px) {
  .sidebar { width: 248px; }
  .main-wrap { margin-left: 248px; }
}

@media (max-width: 991px) {
  .topbar { padding: .7rem .8rem; }
  .role-pill { display: none; }
  .page-hero { padding: .85rem .9rem; }
}

@media (max-width: 576px) {
  .kpi h4 { font-size: 1.25rem; }
  .table-premium { font-size: .92rem; }
}
