/**
 * ERP ACOPA — Sistema de layout responsivo adaptativo
 * Mobile First + Progressive Enhancement
 * Breakpoints: 768 | 1024 | 1366 | 1920
 */

:root {
  /* Breakpoints (referência para media queries) */
  --bp-sm: 768px;
  --bp-md: 1024px;
  --bp-lg: 1366px;
  --bp-xl: 1920px;

  /* Sidebar */
  --sidebar-width: 232px;
  --sidebar-collapsed: 56px;

  /* Espaçamento fluido — densidade institucional */
  --space-xs: clamp(3px, 0.4vw, 6px);
  --space-sm: clamp(6px, 0.8vw, 10px);
  --space-md: clamp(8px, 1.2vw, 14px);
  --space-lg: clamp(12px, 1.6vw, 18px);
  --space-xl: clamp(14px, 2vw, 24px);

  /* Tipografia fluida */
  --font-sm: clamp(0.75rem, 0.85vw, 0.85rem);
  --font-md: clamp(0.8125rem, 0.95vw, 0.9375rem);
  --font-lg: clamp(0.9375rem, 1.1vw, 1.1rem);
  --font-xl: clamp(1.1rem, 1.35vw, 1.5rem);
  --font-2xl: clamp(1.3rem, 1.7vw, 1.9rem);

  /* Raio e header */
  --radius-fluid: clamp(4px, 0.6vw, 8px);
  --header-height: 78px;
  --content-padding: clamp(8px, 1.4vw, 16px);
}

/* ── Base fluida ── */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

img {
  max-width: 100%;
  height: auto;
}

/* Área de clique mínima WCAG (44×44) */
.icon-button,
.portal-icon-btn,
.portal-filter-btn,
.mobile-menu-btn {
  min-width: 44px;
  min-height: 44px;
}

/* ── Main content flexível — sticky header, sem padding fantasma ── */
#main-content {
  flex: 1;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-left: 0;
  padding: 12px var(--content-padding) var(--content-padding);
  overflow-x: hidden;
  box-sizing: border-box;
}

body.sidebar-collapsed #main-content {
  width: 100%;
  margin-left: 0;
}

.page-content {
  flex: 1;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

/* ── Topbar responsivo — sticky no fluxo ── */
.home-topbar {
  position: sticky !important;
  top: 0 !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: visible !important;
  left: auto !important;
  width: 100% !important;
  padding: 0;
}

body.sidebar-collapsed .home-topbar {
  left: var(--sidebar-collapsed);
}

.mobile-menu-btn {
  display: none !important;
  flex-shrink: 0;
}

.home-topbar .mobile-menu-btn {
  align-items: center;
  justify-content: center;
}

/* ── Dashboard / módulos ──
   #homePage usa .modules-layout (seções + listas) — NÃO grid auto-fit.
   Grid antigo empurrava a grade e criava vão branco sob a busca. */
#homePage {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.dashboard-grid {
  display: grid;
  gap: var(--space-md);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
}

/* ── Portal hero adaptativo ── */
.portal-hero {
  padding: var(--space-lg);
}

.portal-hero-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 28%);
  gap: var(--space-lg);
}

.portal-hero-logo {
  width: clamp(48px, 8vw, 72px);
  height: clamp(48px, 8vw, 72px);
}

.portal-hero-subtitle {
  font-size: var(--font-md);
}

/* ── Pesquisa inteligente — layout por breakpoint ── */
.portal-toolbar-layout {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.portal-search-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: stretch;
}

.portal-search-row .portal-search-area {
  flex: 1 1 280px;
  min-width: 0;
}

/* Desktop: filtros e busca na mesma linha */
@media (min-width: 1366px) {
  :root {
    --header-height: 80px;
  }

  .portal-toolbar-layout--search-first .portal-search-row {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
  }

  .portal-toolbar-layout--search-first .portal-filters {
    flex: 0 0 auto;
    margin-bottom: 0;
  }

  .portal-toolbar-layout--search-first .portal-search-area {
    flex: 1;
    min-width: 0;
  }
}

/* Notebook */
@media (min-width: 1024px) and (max-width: 1365px) {
  :root {
    --header-height: 64px;
    --sidebar-width: var(--sidebar-collapsed);
  }

  #sidebar.erp-notebook-collapsed,
  #sidebar.erp-notebook-collapsed:not(.mobile-open) {
    width: var(--sidebar-collapsed);
  }

  #sidebar.erp-notebook-collapsed .brand-copy,
  #sidebar.erp-notebook-collapsed .nav-text,
  #sidebar.erp-notebook-collapsed .nav-chevron,
  #sidebar.erp-notebook-collapsed .nav-group-label,
  #sidebar.erp-notebook-collapsed .submenu {
    display: none;
  }

  #sidebar.erp-notebook-collapsed .brand-row {
    justify-content: center;
  }

  #sidebar.erp-notebook-collapsed nav a,
  #sidebar.erp-notebook-collapsed .submenu-trigger {
    justify-content: center;
    padding-inline: 10px;
  }

  body.erp-layout-notebook .home-main-column,
  body.erp-layout-notebook.sidebar-collapsed .home-main-column {
    width: calc(100% - var(--sidebar-collapsed));
    margin-left: var(--sidebar-collapsed);
  }

  body.erp-layout-notebook #main-content,
  body.erp-layout-notebook.sidebar-collapsed #main-content {
    width: 100%;
    margin-left: 0;
  }

  body.erp-layout-notebook .home-topbar,
  body.erp-layout-notebook.sidebar-collapsed .home-topbar {
    left: auto !important;
    width: 100% !important;
  }

  .portal-hero-grid {
    grid-template-columns: 1fr;
  }

  .portal-toolbar-layout--search-first .portal-search-area {
    order: -1;
    width: 100%;
  }

  .portal-toolbar-layout--search-first .portal-filters {
    order: 1;
    width: 100%;
  }

  .portal-toolbar-layout--search-first .portal-search-row {
    flex-direction: column;
  }
}

/* Desktop expandido */
@media (min-width: 1366px) {
  #sidebar.erp-desktop-expanded:not(.collapsed) {
    width: var(--sidebar-width);
  }

  body.erp-layout-desktop:not(.sidebar-collapsed) .home-main-column {
    width: calc(100% - var(--sidebar-width));
    margin-left: var(--sidebar-width);
  }

  body.erp-layout-desktop:not(.sidebar-collapsed) #main-content {
    width: 100%;
    margin-left: 0;
  }

  body.erp-layout-desktop:not(.sidebar-collapsed) .home-topbar {
    left: auto !important;
    width: 100% !important;
  }

  .portal-hero-grid {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 28%);
  }
}

/* Tooltips — menu recolhido (notebook e desktop) */
@media (min-width: 1024px) {
  #sidebar.collapsed nav a,
  #sidebar.collapsed .submenu-trigger,
  #sidebar.erp-notebook-collapsed nav a,
  #sidebar.erp-notebook-collapsed .submenu-trigger {
    position: relative;
  }

  #sidebar.collapsed nav a[data-tooltip]:hover::after,
  #sidebar.collapsed .submenu-trigger[data-tooltip]:hover::after,
  #sidebar.erp-notebook-collapsed nav a[data-tooltip]:hover::after,
  #sidebar.erp-notebook-collapsed .submenu-trigger[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--inst-blue, #0b2341);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    z-index: 1100;
    pointer-events: none;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.18);
  }
}

/* Ultrawide */
@media (min-width: 1920px) {
  .page-content {
    max-width: 100%;
  }

  .dashboard-grid {
    gap: var(--space-lg);
  }
}

/* Tablet */
@media (max-width: 1023px) {
  :root {
    --header-height: 64px;
  }

  #sidebar {
    transform: translateX(-100%);
    width: min(300px, calc(100vw - 32px));
    position: fixed;
  }

  #sidebar.mobile-open {
    transform: translateX(0);
  }

  #main-content,
  body.sidebar-collapsed #main-content {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
  }

  .home-topbar,
  body.sidebar-collapsed .home-topbar {
    left: 0;
  }

  .mobile-menu-btn {
    display: inline-flex !important;
  }

  #sidebar .brand-row .icon-button#sidebarToggle {
    display: none !important;
  }

  .portal-hero-grid {
    grid-template-columns: 1fr;
  }

  .portal-hero-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .portal-hero-right {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .portal-toolbar-layout--search-first .portal-filters {
    order: 1;
    width: 100%;
  }

  .portal-toolbar-layout--search-first .portal-search-area {
    order: -1;
    width: 100%;
  }

  .portal-toolbar-layout--search-first .portal-search-row {
    flex-direction: column;
  }

  /* Notebook: empilhar banner */
  .portal-hero-subtitle {
    display: block;
  }
}

/* Smartphone */
@media (max-width: 767px) {
  :root {
    --header-height: 56px;
  }

  .portal-hero-meta {
    grid-template-columns: 1fr;
  }

  .portal-hero-right .portal-mini-card:nth-child(n+3) {
    display: none;
  }

  .portal-motivation,
  .portal-hero-subtitle,
  .portal-section-title p {
    display: none;
  }

  .portal-hero-meta .portal-meta-pill:nth-child(n+2) {
    display: none;
  }

  .home-top-user-role {
    display: none;
  }

  .home-top-chip span {
    display: none;
  }

  .portal-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }

  .portal-filters::-webkit-scrollbar {
    display: none;
  }

  .portal-filter-btn {
    flex-shrink: 0;
  }

  .portal-search-shell {
    grid-template-columns: 1fr;
  }

  .portal-search-shell .portal-icon-btn {
    width: 100%;
  }

  .portal-section-title {
    margin-bottom: var(--space-sm);
  }

  .modal {
    padding: 10px;
  }

  .modal-card {
    padding: 14px;
    border-radius: 18px;
  }

  .fullscreen-modal .modal-card {
    width: calc(100vw - 8px);
    height: calc(100vh - 8px);
    border-radius: 16px;
  }
}

/* Foco visível — acessibilidade */
:focus-visible {
  outline: 2px solid var(--inst-accent, #ec7000);
  outline-offset: 2px;
}

/* Reduzir movimento */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ═══════════════════════════════════════════════════════════
   PÁGINAS DE FORMULÁRIO (recibo, cnpj, encaminhamento, etc.)
   ═══════════════════════════════════════════════════════════ */

html:has(body.erp-form-page),
html:has(body.erp-reembolso-page),
html:has(body.erp-tool-page) {
  height: 100%;
}

body.erp-form-page {
  display: flex !important;
  flex-direction: column !important;
  justify-content: stretch !important;
  align-items: stretch !important;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh !important;
  height: 100dvh !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  font-size: var(--font-md);
  box-sizing: border-box;
}

body.erp-form-page .container {
  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  min-height: 0 !important;
  flex: 1 1 auto;
  margin: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: clamp(16px, 2vw, 32px);
  overflow-x: hidden;
  overflow-y: auto;
  box-sizing: border-box;
}

body.erp-form-page h1,
body.erp-form-page .hero-title {
  font-size: clamp(1.35rem, 2.5vw, 2.125rem);
  line-height: 1.2;
}

body.erp-form-page .form-section h3 {
  font-size: clamp(1rem, 1.5vw, 1.3125rem);
}

body.erp-form-page .form-row {
  gap: clamp(12px, 2vw, 20px);
}

body.erp-form-page .form-group {
  width: auto !important;
  flex: 1 1 min(100%, 280px) !important;
  min-width: 0;
}

body.erp-form-page .form-group label,
body.erp-form-page .form-control {
  font-size: var(--font-md);
}

body.erp-form-page .payment-options {
  gap: clamp(8px, 1.5vw, 15px);
}

body.erp-form-page .payment-option {
  flex: 1 1 min(100%, 160px);
  max-width: none;
}

body.erp-form-page button[type="submit"],
body.erp-form-page .btn-primary {
  min-height: 44px;
}

body.erp-form-page .calc {
  width: min(320px, calc(100vw - 24px));
  max-width: 100%;
}

body.erp-form-page .assinaturas,
body.erp-form-page .recibo-servico .assinaturas {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
}

@media (max-width: 1023px) {
  body.erp-form-page .form-group {
    flex: 1 1 100% !important;
  }

  body.erp-form-page .cliente-tipo {
    flex-wrap: wrap;
  }
}

@media (max-width: 767px) {
  body.erp-form-page {
    height: auto !important;
    min-height: 100dvh;
    overflow-y: auto !important;
  }

  body.erp-form-page .container {
    min-height: 100dvh;
    padding: var(--space-md);
  }

  body.erp-form-page .payment-option {
    flex: 1 1 100%;
  }

  body.erp-form-page .calc {
    left: 12px;
    right: 12px;
    width: auto;
  }

  body.erp-form-page .assinaturas,
  body.erp-form-page .recibo-servico .assinaturas {
    flex-direction: column;
  }
}

/* ═══════════════════════════════════════════════════════════
   LOGIN (index.html)
   ═══════════════════════════════════════════════════════════ */

body.erp-login-page {
  overflow-x: hidden;
  overflow-y: auto;
  padding: clamp(12px, 2vw, 28px);
  min-height: 100vh;
  height: auto;
}

body.erp-login-page .shell {
  width: 100%;
  max-width: min(1220px, 100%);
  min-height: min(90vh, 100%);
  height: min(90vh, 1000px);
  max-height: none;
  grid-template-columns: 1.12fr 0.88fr;
}

body.erp-login-page .hero,
body.erp-login-page .login-brand,
body.erp-login-page .login-brand-showcase,
body.erp-login-page .login-logo,
body.erp-login-page .login-logo-mobile {
  animation: none !important;
}

body.erp-login-page .login-head h3 {
  font-size: clamp(1.5rem, 2.5vw, 2rem);
}

body.erp-login-page .field input,
body.erp-login-page .submit-btn {
  min-height: 44px;
}

@media (max-width: 1023px) {
  body.erp-login-page .shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: auto;
  }

  body.erp-login-page .hero {
    min-height: auto;
    aspect-ratio: 4 / 5;
    max-height: min(78vw, 560px);
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  body.erp-login-page .login-panel {
    padding: clamp(24px, 4vw, 40px) clamp(20px, 3vw, 34px);
  }
}

@media (max-width: 767px) {
  body.erp-login-page .hero {
    display: none;
  }

  body.erp-login-page .login-brand-showcase--mobile {
    display: block;
  }

  body.erp-login-page .shell {
    border-radius: clamp(16px, 3vw, 24px);
  }

  body.erp-login-page .login-panel,
  body.erp-login-page .login-card {
    padding: clamp(16px, 3vw, 22px);
  }

  body.erp-login-page .login-card {
    border-radius: clamp(18px, 3vw, 22px);
  }

  body.erp-login-page .row-between {
    flex-direction: column;
    align-items: flex-start;
  }

  body.erp-login-page .label {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  body.erp-login-page .login-meta {
    flex-direction: column;
    gap: 12px;
  }

  body.erp-login-page .login-meta div {
    max-width: 100%;
    min-width: 0;
  }

  body.erp-login-page .feedback-message {
    min-width: 0;
    width: 100%;
  }
}

/* ═══════════════════════════════════════════════════════════
   FERRAMENTAS (scanner, camera)
   ═══════════════════════════════════════════════════════════ */

body.erp-tool-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  font-size: var(--font-md);
}

body.erp-tool-page .top-identity {
  flex-shrink: 0;
  width: 100%;
}

body.erp-tool-page .top-identity-inner {
  max-width: none;
  width: 100%;
  padding-inline: clamp(12px, 2vw, 24px);
  box-sizing: border-box;
}

body.erp-tool-page .app-shell {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  width: 100% !important;
  max-width: none !important;
  min-width: 0;
  min-height: 0;
  height: 100dvh;
  margin: 0 !important;
  padding: calc(58px + clamp(8px, 1.2vw, 14px)) clamp(16px, 2.5vw, 28px) clamp(16px, 2vw, 24px);
  box-sizing: border-box;
  overflow-y: auto;
  overflow-x: hidden;
}

body.erp-tool-page .hero-panel {
  flex-shrink: 0;
}

body.erp-tool-page .workspace {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 22vw);
  gap: clamp(16px, 2vw, 22px);
  align-items: stretch;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
}

body.erp-tool-page .main-panel,
body.erp-tool-page .side-panel {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  height: auto;
}

body.erp-tool-page .content-grid {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body.erp-tool-page .upload-zone {
  flex: 1 1 auto;
  min-height: clamp(180px, 28vh, 420px);
  display: flex;
  align-items: center;
  justify-content: center;
}

body.erp-tool-page .utility-grid,
body.erp-tool-page .form-grid,
body.erp-tool-page .hero-grid {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

body.erp-tool-page .utility-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
  gap: var(--space-sm);
}

body.erp-tool-page .form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: var(--space-md);
}

@media (max-width: 1365px) {
  body.erp-tool-page .workspace {
    grid-template-columns: 1fr;
  }

  body.erp-tool-page .side-panel {
    position: relative;
    top: auto;
  }

  body.erp-tool-page .hero-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1023px) {
  body.erp-tool-page .hero-right {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.erp-tool-page .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767px) {
  body.erp-tool-page {
    height: auto;
    min-height: 100dvh;
    overflow-y: auto;
  }

  body.erp-tool-page .app-shell {
    height: auto;
    min-height: 100dvh;
    padding-top: calc(72px + 8px);
  }

  body.erp-tool-page .hero-meta,
  body.erp-tool-page .action-tools,
  body.erp-tool-page .button-row,
  body.erp-tool-page .modal-actions {
    flex-direction: column;
    align-items: stretch;
  }

  body.erp-tool-page .hero-right,
  body.erp-tool-page .utility-grid {
    grid-template-columns: 1fr;
  }

  body.erp-tool-page .meta-pill,
  body.erp-tool-page .tool-chip,
  body.erp-tool-page .dx-btn {
    width: 100%;
    min-height: 44px;
  }

  body.erp-tool-page .section-header {
    flex-direction: column;
  }

  body.erp-tool-page .top-identity-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ═══════════════════════════════════════════════════════════
   REEMBOLSO
   ═══════════════════════════════════════════════════════════ */

body.erp-reembolso-page {
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-start !important;
  align-items: stretch !important;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh !important;
  height: 100dvh !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  font-size: var(--font-md);
  box-sizing: border-box;
}

body.erp-reembolso-page .top-banner {
  flex-shrink: 0;
  width: 100%;
  position: relative !important;
  top: auto !important;
  left: auto !important;
}

body.erp-reembolso-page .container-app {
  flex: 1 1 auto;
  width: 100% !important;
  max-width: none !important;
  height: auto !important;
  min-height: 0 !important;
  margin: 0 !important;
  margin-top: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: clamp(16px, 2vw, 32px);
  overflow-x: hidden;
  overflow-y: auto;
  box-sizing: border-box;
}

body.erp-reembolso-page .hero-title {
  font-size: clamp(1.25rem, 2.5vw, 1.875rem);
}

body.erp-reembolso-page .form-group,
body.erp-reembolso-page .campo-grupo {
  min-width: 0;
  flex: 1 1 min(100%, 280px);
}

body.erp-reembolso-page .top-banner {
  padding: clamp(8px, 1.5vw, 10px);
  font-size: var(--font-sm);
}

@media (max-width: 1023px) {
  body.erp-reembolso-page .hero-card {
    flex-direction: column;
    align-items: flex-start;
  }

  body.erp-reembolso-page .hero-pill {
    align-self: flex-start;
  }

  body.erp-reembolso-page .assinaturas {
    flex-direction: column;
    gap: 14px;
  }

  body.erp-reembolso-page .linha-assinatura {
    width: 100%;
  }
}

@media (max-width: 767px) {
  body.erp-reembolso-page {
    height: auto !important;
    min-height: 100dvh;
    overflow-y: auto !important;
  }

  body.erp-reembolso-page .container-app {
    min-height: 0;
    padding: var(--space-md);
  }

  body.erp-reembolso-page .form-row,
  body.erp-reembolso-page .row-flex {
    flex-direction: column;
  }
}

/* Shell genérico — servicos2 e demais */
body .app-shell:not(#main-content) {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* ═══════════════════════════════════════════════════════════
   CABEÇALHO CLEAN COM LOGO (padrão payment-link)
   ═══════════════════════════════════════════════════════════ */

.erp-user-banner {
  flex-shrink: 0;
  width: 100%;
  background: linear-gradient(90deg, #ff6200, #ec7000);
  color: #fff;
  text-align: center;
  padding: 10px;
  font-size: clamp(0.8rem, 1vw, 0.9375rem);
  font-weight: 700;
  border-bottom: 2px solid #003b8e;
  z-index: 1000;
  letter-spacing: 0.02em;
  box-sizing: border-box;
}

.erp-page-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(10px, 2vw, 14px);
  margin-bottom: clamp(14px, 2vw, 18px);
  padding: clamp(10px, 1.5vw, 14px) clamp(12px, 2vw, 16px);
  border: 1px solid #d9e2f2;
  border-radius: 14px;
  background: linear-gradient(180deg, #f7faff, #ffffff);
  flex-shrink: 0;
}

.erp-page-hero__brand {
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.5vw, 14px);
  min-width: 0;
  flex: 1;
}

.erp-page-hero__copy {
  min-width: 0;
  flex: 1;
  text-align: left;
}

.erp-page-hero__kicker {
  font-size: clamp(0.68rem, 1vw, 0.75rem);
  color: #003b8e;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.erp-page-hero__kicker i {
  margin-right: 6px;
  opacity: 0.85;
}

.erp-page-hero__title {
  margin: 0 !important;
  font-size: clamp(1.25rem, 2.5vw, 1.875rem) !important;
  color: #003b8e;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-align: left;
}

.erp-page-hero__title .erp-accent {
  color: #ec7000;
}

.erp-page-hero__subtitle,
.erp-page-hero__subtitle[data-org-resumo] {
  margin: 4px 0 0;
  font-size: clamp(0.65rem, 0.95vw, 0.75rem);
  color: #64748b !important;
  font-weight: 600;
  line-height: 1.4;
  text-align: left;
  max-width: 100%;
}

.erp-page-hero__subtitle strong {
  color: #475569;
  font-weight: 700;
}

.erp-page-hero__desc {
  margin: 8px 0 0;
  font-size: clamp(0.75rem, 1.1vw, 0.8125rem);
  color: #4a5568;
  line-height: 1.45;
  max-width: 720px;
}

.erp-page-hero__desc i {
  margin-right: 6px;
  color: #ec7000;
}

.erp-page-hero__badge {
  background: #003b8e;
  color: #fff;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: clamp(0.68rem, 1vw, 0.75rem);
  font-weight: 700;
  flex-shrink: 0;
  white-space: nowrap;
}

#hero-foto-cidadao {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 0 0 auto;
  align-self: center;
  margin: 0 clamp(8px, 1.8vw, 18px);
}

#hero-foto-cidadao.is-visible {
  display: flex;
}

#hero-foto-cidadao .hero-foto-ring {
  width: clamp(96px, 10vw, 120px);
  height: clamp(96px, 10vw, 120px);
  border-radius: 50%;
  padding: 4px;
  background: linear-gradient(145deg, #003b8e 0%, #1d6fd8 45%, #ec7000 100%);
  box-shadow: 0 10px 28px rgba(0, 59, 142, 0.24), 0 3px 8px rgba(15, 23, 42, 0.1);
}

#hero-foto-cidadao img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid #fff;
  background: #e8eef8;
}

#hero-foto-cidadao .hero-foto-caption {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}

@media (max-width: 768px) {
  #hero-foto-cidadao .hero-foto-ring {
    width: 88px;
    height: 88px;
  }
}

.erp-page-hero__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.erp-page-hero-kpis {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.erp-page-hero-kpi {
  min-width: 72px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #f0f5ff;
  border: 1px solid #d9e2f2;
  text-align: center;
}

.erp-page-hero-kpi strong {
  display: block;
  font-size: 0.9rem;
  line-height: 1.1;
  color: #003b8e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.erp-page-hero-kpi span {
  display: block;
  margin-top: 2px;
  font-size: 0.65rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

body.erp-form-page .container > h1:first-child {
  display: none;
}

@media (max-width: 767px) {
  .erp-page-hero {
    flex-direction: column;
    align-items: stretch;
  }

  .erp-page-hero__badge,
  .erp-page-hero__meta {
    align-self: flex-start;
  }

  .erp-page-hero-kpis {
    width: 100%;
  }

  .erp-page-hero-kpi {
    flex: 1;
  }
}

