:root {
  --brand-navy: #102746;
  --brand-navy-deep: #08182d;
  --brand-blue: #2f5da8;
  --brand-blue-soft: #d7e5fb;
  --brand-surface: #f3f7fc;
  --brand-card: #ffffff;
  --brand-border: rgba(16, 39, 70, 0.1);
  --brand-text: #17304e;
  --brand-muted: #64748b;
  --brand-success: #198754;
  --brand-warning: #f0b429;
  --brand-danger: #dc3545;
  --brand-info: #0d6efd;
  --shadow-soft: 0 24px 65px rgba(16, 39, 70, 0.12);
  --shadow-card: 0 16px 32px rgba(15, 35, 64, 0.08);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --sidebar-width: 280px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--brand-text);
  background:
    radial-gradient(circle at top right, rgba(47, 93, 168, 0.16), transparent 28%),
    radial-gradient(circle at bottom left, rgba(25, 135, 84, 0.12), transparent 22%),
    linear-gradient(180deg, #f9fbff 0%, #eff4fb 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
}

.fw-display {
  font-family: "Plus Jakarta Sans", "Segoe UI", sans-serif;
}

.text-muted-soft {
  color: var(--brand-muted) !important;
}

.page-section {
  margin-bottom: 1.5rem;
}

.public-page {
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 1.5rem;
}

.login-shell {
  width: min(1180px, 100%);
  min-height: calc(100vh - 3rem);
  display: grid;
  grid-template-columns: 1.15fr 0.9fr;
  border-radius: 34px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.login-showcase {
  position: relative;
  padding: 3.2rem;
  background:
    linear-gradient(145deg, rgba(8, 24, 45, 0.96), rgba(16, 39, 70, 0.92)),
    linear-gradient(120deg, rgba(47, 93, 168, 0.5), rgba(25, 135, 84, 0.15));
  color: #fff;
}

.login-showcase::before,
.login-showcase::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  filter: blur(4px);
}

.login-showcase::before {
  top: 2.5rem;
  right: -4rem;
  width: 240px;
  height: 240px;
  background: rgba(88, 157, 255, 0.24);
}

.login-showcase::after {
  bottom: -3rem;
  left: -2rem;
  width: 210px;
  height: 210px;
  background: rgba(25, 135, 84, 0.2);
}

.brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.15);
  margin-bottom: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-pill img {
  width: 30px;
  height: 30px;
}

.login-hero-title {
  font-size: clamp(2.2rem, 4vw, 3.6rem);
  line-height: 1.03;
  margin-bottom: 1rem;
}

.login-lead {
  max-width: 520px;
  font-size: 1.03rem;
  color: rgba(255, 255, 255, 0.8);
}

.showcase-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 2.2rem;
}

.showcase-metric {
  padding: 1.15rem;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.showcase-metric strong {
  display: block;
  font-size: 1.35rem;
}

.showcase-metric span {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.72);
}

.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.4rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 255, 0.96));
}

.login-card {
  width: min(460px, 100%);
  padding: 2.2rem;
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(16, 39, 70, 0.08);
  box-shadow: var(--shadow-card);
}

.login-card .form-control {
  min-height: 54px;
  border-radius: 16px;
  border-color: rgba(16, 39, 70, 0.12);
  padding-inline: 1rem;
}

.login-card .form-control:focus,
.filter-control:focus,
.form-select:focus {
  box-shadow: 0 0 0 0.25rem rgba(47, 93, 168, 0.12);
  border-color: rgba(47, 93, 168, 0.4);
}

.mini-caption {
  color: var(--brand-muted);
  font-size: 0.92rem;
}

.btn-hero {
  min-height: 54px;
  border-radius: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.btn-navy {
  color: #fff;
  background: linear-gradient(135deg, var(--brand-navy), var(--brand-blue));
  border: none;
}

.btn-navy:hover,
.btn-navy:focus {
  color: #fff;
  background: linear-gradient(135deg, #0c213c, #285091);
}

.btn-soft {
  background: rgba(47, 93, 168, 0.08);
  color: var(--brand-blue);
  border: 1px solid rgba(47, 93, 168, 0.15);
}

.btn-soft:hover {
  background: rgba(47, 93, 168, 0.14);
  color: var(--brand-blue);
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  padding: 1.5rem;
  background:
    linear-gradient(180deg, rgba(8, 24, 45, 0.98), rgba(16, 39, 70, 0.98)),
    linear-gradient(180deg, rgba(47, 93, 168, 0.35), transparent);
  color: #e5eefc;
  box-shadow: 16px 0 40px rgba(8, 24, 45, 0.16);
  z-index: 1040;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 2rem;
}

.sidebar-brand img {
  width: 44px;
  height: 44px;
}

.sidebar-brand small {
  color: rgba(229, 238, 252, 0.7);
}

.sidebar-nav {
  display: grid;
  gap: 0.35rem;
}

.nav-link-bridge {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.95rem 1rem;
  border-radius: 18px;
  color: rgba(229, 238, 252, 0.82);
  transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.nav-link-bridge:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(3px);
}

.nav-link-bridge.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.14), rgba(47, 93, 168, 0.28));
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-link-bridge i {
  font-size: 1rem;
}

.sidebar-footer {
  margin-top: auto;
  padding: 1.1rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-footer .status-dot {
  width: 10px;
  height: 10px;
  background: #2ad07f;
  border-radius: 50%;
  box-shadow: 0 0 0 6px rgba(42, 208, 127, 0.18);
}

.mobile-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(16, 39, 70, 0.08);
}

.desktop-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.toolbar-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(16, 39, 70, 0.08);
  color: var(--brand-muted);
}

.main-content {
  width: 100%;
  margin-left: var(--sidebar-width);
  padding: 1.5rem;
}

.content-surface {
  display: block;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-title {
  font-size: clamp(1.8rem, 2.2vw, 2.4rem);
  line-height: 1.02;
  margin-bottom: 0.35rem;
}

.surface-card {
  border: none;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.surface-card .card-body {
  padding: 1.35rem;
}

.stats-card {
  position: relative;
  border: none;
  border-radius: 24px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 255, 0.98));
  box-shadow: var(--shadow-card);
}

.stats-card::after {
  content: "";
  position: absolute;
  inset: auto -18px -24px auto;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(47, 93, 168, 0.12), transparent 65%);
}

.stats-icon {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  color: var(--brand-blue);
  background: rgba(47, 93, 168, 0.1);
}

.stats-value {
  font-size: 1.8rem;
  line-height: 1;
  font-weight: 800;
}

.stats-label {
  color: var(--brand-muted);
  font-size: 0.92rem;
}

.section-subtitle {
  color: var(--brand-muted);
  font-size: 0.92rem;
}

.table-shell {
  border-radius: 22px;
  overflow: hidden;
}

.table > :not(caption) > * > * {
  padding: 1rem 0.85rem;
  vertical-align: middle;
}

.table thead th {
  color: var(--brand-muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(16, 39, 70, 0.03);
  border-bottom: 1px solid rgba(16, 39, 70, 0.08);
}

.table tbody tr:hover {
  background: rgba(47, 93, 168, 0.04);
}

.data-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.48rem 0.8rem;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 108px;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.status-rascunho {
  color: #946200;
  background: rgba(240, 180, 41, 0.14);
}

.status-enviada {
  color: #0d6efd;
  background: rgba(13, 110, 253, 0.12);
}

.status-paga {
  color: #0c6b44;
  background: rgba(25, 135, 84, 0.14);
}

.status-cancelada {
  color: #b02a37;
  background: rgba(220, 53, 69, 0.12);
}

.filter-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
}

.filter-control,
.form-select,
.form-control,
.form-control-color {
  border-radius: 14px;
  border-color: rgba(16, 39, 70, 0.12);
}

.metric-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1rem;
  border-radius: 18px;
  background: rgba(16, 39, 70, 0.03);
}

.metric-inline strong {
  font-size: 1.15rem;
}

.module-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.5rem;
}

.invoice-preview-wrap,
.invoice-detail-wrap {
  border-radius: 24px;
  padding: 1.25rem;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.invoice-document {
  width: 100%;
  background: #fff;
  border-radius: 24px;
  border: 1px solid rgba(16, 39, 70, 0.08);
  padding: 2rem;
  color: #1c2f4a;
}

.invoice-top {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.6rem;
}

.invoice-brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.invoice-brand img {
  width: 60px;
  height: 60px;
}

.invoice-title-block {
  text-align: right;
}

.invoice-title-block h2 {
  margin: 0;
  font-size: 1.8rem;
}

.invoice-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.35rem;
}

.invoice-panel {
  padding: 1rem 1.05rem;
  border-radius: 18px;
  background: rgba(16, 39, 70, 0.03);
  border: 1px solid rgba(16, 39, 70, 0.06);
}

.invoice-panel h6 {
  margin-bottom: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.78rem;
  color: var(--brand-muted);
}

.invoice-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.35rem;
}

.invoice-table th,
.invoice-table td {
  padding: 0.85rem 0.7rem;
  border-bottom: 1px solid rgba(16, 39, 70, 0.08);
}

.invoice-table th {
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--brand-muted);
}

.invoice-summary {
  margin-left: auto;
  width: min(320px, 100%);
}

.invoice-summary .summary-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid rgba(16, 39, 70, 0.06);
}

.invoice-summary .summary-line.total {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--brand-navy);
}

.invoice-footer {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px dashed rgba(16, 39, 70, 0.12);
  color: var(--brand-muted);
  font-size: 0.9rem;
}

.form-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.summary-box {
  padding: 1rem;
  border-radius: 18px;
  background: rgba(16, 39, 70, 0.03);
  border: 1px solid rgba(16, 39, 70, 0.06);
}

.summary-box span {
  display: block;
  color: var(--brand-muted);
  font-size: 0.8rem;
}

.summary-box strong {
  display: block;
  font-size: 1.15rem;
  margin-top: 0.2rem;
}

.integration-card {
  background:
    linear-gradient(135deg, rgba(16, 39, 70, 1), rgba(47, 93, 168, 0.92)),
    linear-gradient(180deg, rgba(25, 135, 84, 0.2), transparent);
  color: #fff;
}

.integration-card .card-body {
  padding: 1.45rem;
}

.integration-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.integration-item:last-child {
  border-bottom: 0;
}

.list-summary {
  display: grid;
  gap: 0.7rem;
}

.list-summary-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1rem;
  border-radius: 18px;
  background: rgba(16, 39, 70, 0.03);
  border: 1px solid rgba(16, 39, 70, 0.06);
}

.empty-state {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--brand-muted);
}

.empty-state i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 62px;
  height: 62px;
  margin-bottom: 1rem;
  border-radius: 18px;
  background: rgba(47, 93, 168, 0.08);
  color: var(--brand-blue);
  font-size: 1.5rem;
}

.logo-preview {
  width: 88px;
  height: 88px;
  border-radius: 24px;
  object-fit: cover;
  background: rgba(16, 39, 70, 0.04);
  border: 1px solid rgba(16, 39, 70, 0.08);
  padding: 0.35rem;
}

.alert-stack {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 1090;
  width: min(420px, calc(100vw - 2rem));
}

.alert-stack .alert {
  border: none;
  border-radius: 18px;
  box-shadow: var(--shadow-card);
}

.action-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.chart-canvas {
  width: 100%;
  min-height: 320px;
  display: block;
}

.pdf-export-root {
  position: fixed;
  left: -99999px;
  top: 0;
  width: 210mm;
  background: #fff;
  padding: 0;
  z-index: -1;
}

.offcanvas.app-offcanvas {
  background:
    linear-gradient(180deg, rgba(8, 24, 45, 0.98), rgba(16, 39, 70, 0.98)),
    linear-gradient(180deg, rgba(47, 93, 168, 0.35), transparent);
  color: #e5eefc;
}

.offcanvas.app-offcanvas .btn-close {
  filter: invert(1);
}

.offcanvas.app-offcanvas .nav-link-bridge {
  color: rgba(229, 238, 252, 0.82);
}

@media (max-width: 1199.98px) {
  .module-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 991.98px) {
  .public-page {
    padding: 0;
  }

  .login-shell {
    min-height: 100vh;
    border-radius: 0;
    grid-template-columns: 1fr;
  }

  .login-showcase {
    padding: 2.2rem 1.5rem;
  }

  .showcase-metrics {
    grid-template-columns: 1fr;
  }

  .main-content {
    margin-left: 0;
    padding: 0 1rem 1.2rem;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-bar,
  .form-summary,
  .invoice-meta {
    grid-template-columns: 1fr;
  }

  .invoice-top {
    flex-direction: column;
  }
}

@media (max-width: 767.98px) {
  .login-card,
  .surface-card .card-body,
  .invoice-document {
    padding: 1.25rem;
  }

  .stats-value {
    font-size: 1.5rem;
  }

  .action-group {
    width: 100%;
  }

  .table > :not(caption) > * > * {
    padding: 0.8rem 0.65rem;
  }
}

@media print {
  body {
    background: #fff;
  }

  .sidebar,
  .mobile-topbar,
  .desktop-toolbar,
  .page-header,
  .no-print,
  .alert-stack,
  .offcanvas-backdrop {
    display: none !important;
  }

  .main-content {
    margin: 0;
    padding: 0;
  }

  #page-content > :not(.print-target) {
    display: none !important;
  }

  .invoice-detail-wrap,
  .invoice-preview-wrap,
  .invoice-document {
    box-shadow: none;
    border: none;
    padding: 0;
  }
}
